Skip to content

Instantly share code, notes, and snippets.

@bjacob
Created February 1, 2023 21:27
Show Gist options
  • Save bjacob/f0eac303616906dc95aaa26875041d14 to your computer and use it in GitHub Desktop.
Save bjacob/f0eac303616906dc95aaa26875041d14 to your computer and use it in GitHub Desktop.
Data tiling example

Compile for LLVM-CPU, AArch64, with +i8mm extension, causing MaterializeEncoding to pick (8, 8, 8) tile sizes:

tools/iree-compile --iree-hal-target-backends=llvm-cpu --iree-llvm-target-triple=aarch64-none-linux-android29 --iree-llvm-target-cpu-features=+i8mm  --iree-flow-enable-data-tiling ~/matmul.mlir --mlir-disable-threading -o /tmp/a.vmfb --mlir-print-ir-after-all 2>/tmp/log

Compiler for VMVX with microkernels, causing dynamic tile sizes:

tools/iree-compile --iree-hal-target-backends=vmvx --iree-flow-enable-data-tiling --iree-vmvx-enable-microkernels ~/matmul.mlir --mlir-disable-threading -o /tmp/a.vmfb --mlir-print-ir-after-all 2>/tmp/log
func.func @matmul_DYNxDYNxi8_times_DYNxDYNxi8_into_DYNxDYNxi32(%lhs: tensor<?x?xi8>, %rhs: tensor<?x?xi8>, %acc: tensor<?x?xi32>) -> tensor<?x?xi32> {
%result = linalg.matmul ins(%lhs, %rhs: tensor<?x?xi8>, tensor<?x?xi8>) outs(%acc: tensor<?x?xi32>) -> tensor<?x?xi32>
return %result: tensor<?x?xi32>
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment