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
[SPIRV] Unsigned division, remainder and comparison fail on emulated i8 and i16 #25316
Compiling an i8 arith.divui for Vulkan fails in iree-convert-to-spirv:
divui_i8.mlir:2:8: error: bitwidth emulation is not implemented yet on unsigned op pattern version
%0 = arith.divui %lhs, %rhs : tensor<4xi8>
^
divui_i8.mlir:2:8: error: failed to legalize operation 'arith.divui': %57 = "arith.divui"(%37, %56) : (i8, i8) -> i8
The default Vulkan target has only the Shader capability (#spirv.vce<v1.3, [Shader], []>), so i8 and i16 are emulated in i32. The Arith to SPIR-V conversion rejects unsigned division, remainder and comparison on emulated types. On i8 and i16:
arith.remui and arith.ceildivui fail with the same error.
arith.cmpi with ult, ule, ugt or uge fails with bitwidth emulation is not implemented yet on unsigned op.
The signed versions of these ops compile, and so does arith.divui on i32.
Expected: these ops compile, as their signed versions do.
The check is in upstream MLIR: spirv::ElementwiseOpPattern in mlir/lib/Conversion/SPIRVCommon/Pattern.h, and ElementwiseArithOpPattern, CeilDivUIOpPattern and CmpIOpPattern in mlir/lib/Conversion/ArithToSPIRV/ArithToSPIRV.cpp. arith-to-spirv-unsupported.mlir expects this error.
Since llvm/torch-mlir#4896, uint8 division lowers to arith.divui. With the torch-mlir bump in #25309, ONNX test_div_uint8 hits this error and is an expected compile failure on Vulkan.
Activity
[Integrate] Update torch-mlir to ba6c16a6 (#25309)
[Integrate] Update torch-mlir to 55fcb892 (#25365)