[mlir][spirv] Fix extended umul expansion for WebGPU
authorJakub Kuderski <kubak@google.com>
Thu, 5 Jan 2023 23:37:49 +0000 (18:37 -0500)
committerJakub Kuderski <kubak@google.com>
Thu, 5 Jan 2023 23:41:26 +0000 (18:41 -0500)
commit47232bea9e5ecc5ad999f53ec2895d2c07427572
treeac009649ae81ac5066023825e3407c43651135bd
parent2c6ecc9db624442dcc4c80ab02d15e0833c7f8a3
[mlir][spirv] Fix extended umul expansion for WebGPU

Fix an off-by-one error in extended umul extension for WebGPU.
Revert to the long multiplication algorithm originally added to wide
integer emulation, which was deleted in D139776. It is much easier
to see why it is correct.

Add runtime tests based on the mlir-vulkan-runner. These run both with
and without umul extension.

Issue: https://github.com/llvm/llvm-project/issues/59563

Reviewed By: antiagainst

Differential Revision: https://reviews.llvm.org/D141085
mlir/lib/Dialect/SPIRV/Transforms/SPIRVWebGPUTransforms.cpp
mlir/test/Dialect/SPIRV/Transforms/webgpu-prepare.mlir
mlir/test/mlir-vulkan-runner/umul_extended.mlir [new file with mode: 0644]
mlir/tools/mlir-vulkan-runner/CMakeLists.txt
mlir/tools/mlir-vulkan-runner/mlir-vulkan-runner.cpp
utils/bazel/llvm-project-overlay/mlir/BUILD.bazel