[Mlir-commits] [mlir] [mlir][TOSA] restore unrealized casts when lowering rescale ops (PR #141096)

Artem Gindinson llvmlistbot at llvm.org
Fri May 23 05:13:49 PDT 2025


AGindinson wrote:

Hi Thomas,

No problem, and very good that you've brought up SPIR-V - I haven't checked that, as I was using a non-SPIRV pipeline.

> Is unrealized_conversion_cast the correct way to cast between signed/unsigned and signless type? If yes then it's just a bug in the SPIR-V conversion and this patch is fine.

I believe that's the correct way to view it, yes. Given the role of the Builtin dialect, it would be natural to expect successful conversions for the other dialects.
https://mlir.llvm.org/docs/Dialects/Builtin/#builtinunrealized_conversion_cast-unrealizedconversioncastop

If without the builtin casts the SPIR-V conversion succeeds and the signedness looks correct, I think it would suffice to mark the builtin op as legal. Like here: https://github.com/llvm/llvm-project/blob/main/mlir/lib/Conversion/ArithToSPIRV/ArithToSPIRV.cpp#L1358. Would you prefer I do this within the current PR or as a follow-up?

https://github.com/llvm/llvm-project/pull/141096


More information about the Mlir-commits mailing list