Skip to content

Commit 017326a

Browse files
authored
Add enable_fusion_modeling for conv2d and conv3d (#3343)
Summary: This is to have more accurate benchmarking for fusion Test Plan: ``` python $SCRIPT_PATH $OUTPUT_FILE \ --recipe_name $RECIPE_NAME \ --shape_gen_name $SHAPE_GEN_NAME \ --M $M --K $K --N $N \ --D $D --H $H --W $W \ --kernel_size $kernel_size \ --enable_fusion_modeling \ --op_name conv3d ``` Reviewers: Subscribers: Tasks: Tags:
1 parent 1b80794 commit 017326a

File tree

1 file changed

+20
-6
lines changed

1 file changed

+20
-6
lines changed

benchmarks/float8/float8_inference_roofline.py

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -370,13 +370,27 @@ def run(
370370
if do_benchmarks:
371371
# create the model
372372
if op_name == "conv2d":
373-
m_orig = nn.Sequential(
374-
nn.Conv2d(K_val, N_val, kernel_size, bias=False)
375-
).to(memory_format=torch.channels_last)
373+
if not enable_fusion_modeling:
374+
m_orig = nn.Sequential(
375+
nn.Conv2d(K_val, N_val, kernel_size, bias=False)
376+
).to(memory_format=torch.channels_last)
377+
else:
378+
m_orig = nn.Sequential(
379+
nn.ReLU(),
380+
nn.Conv2d(K_val, N_val, kernel_size, bias=False),
381+
nn.ReLU(),
382+
).to(memory_format=torch.channels_last)
376383
elif op_name == "conv3d":
377-
m_orig = nn.Sequential(
378-
nn.Conv3d(K_val, N_val, kernel_size, bias=False)
379-
).to(memory_format=torch.channels_last_3d)
384+
if not enable_fusion_modeling:
385+
m_orig = nn.Sequential(
386+
nn.Conv3d(K_val, N_val, kernel_size, bias=False)
387+
).to(memory_format=torch.channels_last_3d)
388+
else:
389+
m_orig = nn.Sequential(
390+
nn.ReLU(),
391+
nn.Conv3d(K_val, N_val, kernel_size, bias=False),
392+
nn.ReLU(),
393+
).to(memory_format=torch.channels_last_3d)
380394
else:
381395
if not enable_fusion_modeling:
382396
m_orig = nn.Sequential(nn.Linear(K_val, N_val, bias=False))

0 commit comments

Comments
 (0)