Compare commits

...

2 Commits

Author SHA1 Message Date
c7dd98e45c Fix extra params in config 2025-10-29 15:17:22 -07:00
4f2677dc46 Add conv ops to bench 2025-10-27 12:38:54 -07:00
3 changed files with 42 additions and 1 deletions

View File

@ -1659,7 +1659,7 @@ test_operator_microbenchmark() {
cd "${TEST_DIR}"/benchmarks/operator_benchmark
for OP_BENCHMARK_TESTS in matmul mm addmm bmm; do
for OP_BENCHMARK_TESTS in matmul mm addmm bmm conv; do
$TASKSET python -m pt.${OP_BENCHMARK_TESTS}_test --tag-filter long \
--output-json-for-dashboard "${TEST_REPORTS_DIR}/operator_microbenchmark_${OP_BENCHMARK_TESTS}_compile.json" \
--benchmark-name "PyTorch operator microbenchmark" --use-compile

View File

@ -11,6 +11,11 @@ def remove_cuda(config_list):
return [config for config in config_list if cuda_config not in config]
def remove_cpu(config_list):
cpu_config = {"device": "cpu"}
return [config for config in config_list if cpu_config not in config]
# Configs for conv-1d ops
conv_1d_configs_short = op_bench.config_list(
attr_names=["IC", "OC", "kernel", "stride", "N", "L"],
@ -127,6 +132,18 @@ conv_3d_configs_short = op_bench.config_list(
},
tags=["short"],
)
conv_3d_configs_long = op_bench.cross_product_configs(
IC=[16, 32],
OC=[32, 64],
kernel=[3, 5],
stride=[1, 2],
N=[1],
D=[128],
H=[128],
W=[128],
device=["cpu", "cuda"],
tags=["long"],
)
linear_configs_short = op_bench.config_list(
attr_names=["N", "IN", "OUT"],

View File

@ -38,6 +38,10 @@ class ConvTranspose1dBenchmark(op_bench.TorchBenchmarkBase):
op_bench.generate_pt_test(
configs.conv_1d_configs_short + configs.conv_1d_configs_long, Conv1dBenchmark
)
op_bench.generate_pt_gradient_test(
configs.remove_cpu(configs.conv_1d_configs_short + configs.conv_1d_configs_long),
Conv1dBenchmark,
)
if not torch.backends.mkldnn.is_acl_available():
@ -103,6 +107,20 @@ op_bench.generate_pt_test(
configs.conv_2d_pw_configs_short + configs.conv_2d_pw_configs_long,
Conv2dPointwiseBenchmark,
)
op_bench.generate_pt_gradient_test(
configs.remove_cpu(configs.conv_2d_configs_short + configs.conv_2d_configs_long),
Conv2dBenchmark,
)
op_bench.generate_pt_gradient_test(
configs.remove_cpu(configs.conv_2d_configs_short + configs.conv_2d_configs_long),
ConvTranspose2dBenchmark,
)
op_bench.generate_pt_gradient_test(
configs.remove_cpu(
configs.conv_2d_pw_configs_short + configs.conv_2d_pw_configs_long
),
Conv2dPointwiseBenchmark,
)
"""
@ -134,6 +152,12 @@ class ConvTranspose3dBenchmark(op_bench.TorchBenchmarkBase):
op_bench.generate_pt_test(configs.conv_3d_configs_short, Conv3dBenchmark)
op_bench.generate_pt_test(configs.conv_3d_configs_short, ConvTranspose3dBenchmark)
op_bench.generate_pt_gradient_test(
configs.remove_cpu(configs.conv_3d_configs_long), Conv3dBenchmark
)
op_bench.generate_pt_gradient_test(
configs.remove_cpu(configs.conv_3d_configs_long), ConvTranspose3dBenchmark
)
if __name__ == "__main__":