Skip to content

Commit

Permalink
original run script
Browse files Browse the repository at this point in the history
  • Loading branch information
newling committed Oct 31, 2024
1 parent 803d182 commit b61f8aa
Showing 1 changed file with 28 additions and 36 deletions.
64 changes: 28 additions & 36 deletions build_tools/ci/cpu_comparison/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -594,34 +594,29 @@ def run(self, config):
raise NotImplementedError("Subclasses must implement this method")


# Run with:
#
# ./run.py output_dir ../../../../builds/iree-clang ../../../../peano_wheels/august_1_2024/llvm-aie/ --test-set ConvolutionTemplate -vv --xrt_lite_n_core_rows=4 --xrt_lite_n_core_cols=4 --additional-aie-compilation-flags="--mlir-print-ir-before-all --aie2xclbin-print-ir-before-all" > dump.mlir 2>&1
#
#
class ConvolutionTemplateSet(TestSet):
def __init__(self):
super().__init__("ConvolutionTemplate")

def run(self, config):

testSet = [
# {
# "conv_type": "conv_2d_nhwc_hwcf",
# "N": 2,
# "IH": 14,
# "IC": 32,
# "OC": 64,
# "KH": 3,
# "input_element_type": "i32",
# "output_element_type": "i32",
# },
{
"conv_type": "conv_2d_nhwc_hwcf",
"N": 1,
"IH": 6,
"N": 2,
"IH": 14,
"IC": 32,
"OC": 64,
"KH": 3,
"input_element_type": "i32",
"output_element_type": "i32",
},
{
"conv_type": "conv_2d_nhwc_hwcf",
"N": 2,
"IH": 14,
"IC": 32,
"OC": 8,
"OC": 64,
"KH": 3,
"input_element_type": "bf16",
"output_element_type": "f32",
Expand All @@ -636,23 +631,23 @@ def run(self, config):
"input_element_type": "i8",
"output_element_type": "i32",
},
# {
# "conv_type": "depthwise_conv_2d_nhwc_hwc",
# "N": 1,
# "IH": 14,
# "IC": 64,
# "KH": 3,
# "input_element_type": "i32",
# "output_element_type": "i32",
# },
{
"conv_type": "depthwise_conv_2d_nhwc_hwc",
"N": 1,
"IH": 14,
"IC": 64,
"KH": 3,
"input_element_type": "i32",
"output_element_type": "i32",
},
]

output_dir = config.output_dir
test_name = output_dir / "test_from_template.mlir"
for testMap in testSet:
convGen = ConvolutionMlirGenerator(**testMap)
convGen.write_to_file(test_name)
n_conv_repeats = 1
n_conv_repeats = 4

aie_vs_llvm_cpu(
config,
Expand Down Expand Up @@ -692,14 +687,6 @@ def run(self, config):
test_files_dir = config.file_dir / "test_files"
output_dir = config.output_dir

# Test(s) of the form matmul(A,B) where A:MxK, B:KxN
test_name = output_dir / "test_from_template.mlir"
template_name = matmul_template_dir / "matmul_MxK_KxN.mlir"
generate_matmul_test(test_name, template_name, 32, 32, 64, "bf16", "f32")
aie_vs_llvm_cpu(config, test_name)

raise RuntimeError("Done!")

# Test(s) of the form matmul(A,B) + C where A:MxK, B:KxN, C:MxN
test_name = output_dir / "test_from_template_full_bias.mlir"
template_name = matmul_template_dir / "matmul_bias_MxK_KxN_MxN.mlir"
Expand Down Expand Up @@ -727,6 +714,11 @@ def run(self, config):
function_name="three_$mm$",
)

# Test(s) of the form matmul(A,B) where A:MxK, B:KxN
test_name = output_dir / "test_from_template.mlir"
template_name = matmul_template_dir / "matmul_MxK_KxN.mlir"
generate_matmul_test(test_name, template_name, 32, 32, 64, "bf16", "f32")
aie_vs_llvm_cpu(config, test_name)

# Test(s) of the form matmul(A,B) + C where A:MxK, B:KxN, C:N
test_name = output_dir / "test_from_template_bias_N.mlir"
Expand Down

0 comments on commit b61f8aa

Please sign in to comment.