You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[VMVX] lower linalg.batch_matmul to DT microkernels #15314
We are able to run linalg.batch_matmul on llvm-cpu data-tiling + ukernel path, but not for vmvx. Most of features are done in #14431
To enable it on vmvx, we need:
Enhance DecomposeBatchMmt4DOps pass to handle batch_size != 1 cases. If the linalg.batch_mmt4d has non-one batch size, we tile the dimension with size=1 and lower it to linalg.mmt4d using the existing patterns.
@Shukla-Gaurav to create an e2e-to-end correctness test for batch_matmul that can easily be run on any backend including VMVX, create it as a .mlir file in tests/e2e/linalg.
The conv2d.mlir test there is a good example to start from.
In CMakeLists.txt add a iree_check_single_backend_test_suite call like this to test VMVX + data-tiling + microkernels:
Eventually to make this PR pass CI, you will have to lift that to BUILD.Bazel. It's not hard, just a bit convoluted due to the usage of enforce_glob. Then run python build_tools/bazel_to_cmake/bazel_to_cmake.py to generate CMakeLists.txt, it will overwrite your hand-edited CMakeLists.txt, save it before and iterate until bazel_to_cmake's output is identical.
@hanhanW I made progress on updating the DecomposeBatchMmt4DOps pass in order to add support for non unit batch dims.
I am not blocked on anything, exploring the codebase related to Tiling and Fusion. Thanks for asking.
Activity
hanhanW commentedon Oct 27, 2023
We are going to use upstream SCFTiling method, here is an example:
https://github.com/openxla/iree/blob/f29895e5192c0525cbb4980813330ab2c750da70/compiler/src/iree/compiler/Codegen/LLVMCPU/LLVMCPUTile.cpp#L92-L97
hanhanW commentedon Oct 30, 2023
An e2e example is below:
To compile the program:
iree-compile --output-format=vm-bytecode --iree-hal-target-backends=vmvx --iree-vmvx-enable-microkernels --iree-opt-data-tiling ~/repro.mlir -o /tmp/a.vmfb===
What we want is scf::tileConsumerAndFuseProducerGreedilyUsingSCFForOp because we'd like to fuse fill op as well. E.g.,
should be lowered to
then the rest of patterns will rewrite
linalg.batch_mmt4dop withlinalg.mmt4dop, e.g.,bjacob commentedon Oct 30, 2023
@Shukla-Gaurav to create an e2e-to-end correctness test for batch_matmul that can easily be run on any backend including VMVX, create it as a
.mlirfile in tests/e2e/linalg.The
conv2d.mlirtest there is a good example to start from.In CMakeLists.txt add a
iree_check_single_backend_test_suitecall like this to test VMVX + data-tiling + microkernels:Eventually to make this PR pass CI, you will have to lift that to BUILD.Bazel. It's not hard, just a bit convoluted due to the usage of
enforce_glob. Then runpython build_tools/bazel_to_cmake/bazel_to_cmake.pyto generate CMakeLists.txt, it will overwrite your hand-edited CMakeLists.txt, save it before and iterate until bazel_to_cmake's output is identical.Shukla-Gaurav commentedon Nov 1, 2023
Thanks for all the reference @bjacob @hanhanW
hanhanW commentedon Nov 2, 2023
I'd like to check in if there are any updates? I'm happy to help if there are any issues.
Shukla-Gaurav commentedon Nov 3, 2023
@hanhanW I made progress on updating the DecomposeBatchMmt4DOps pass in order to add support for non unit batch dims.
I am not blocked on anything, exploring the codebase related to Tiling and Fusion. Thanks for asking.
[CodeGen] Lower linalg.BatchMmt4DOp for non unit batch dimension. (#1…
[CodeGen] Lower linalg.BatchMmt4DOp for non unit batch dimension. (#1…
[VMVX] Enable ukernels for batch_matmul using static shape path. (#15733
[CodeGen] Lower linalg.BatchMmt4DOp for non unit batch dimension. (ir…
[VMVX] Enable ukernels for batch_matmul using static shape path. (ire…