[Mlir-commits] [mlir] [mlir][SPIRV] Fix lookup logic `spirv.target_env` for `gpu.module` (PR #147262)

Jaeho Kim llvmlistbot at llvm.org
Tue Jul 8 02:53:27 PDT 2025


oojahooo wrote:

> Could you add a test that shows where this comes up? I'm not sure if we should look up the target env in`"targets"` attribute in **any** of possible parents

Thank you for your comment. I added a test that reproduces the situation I had in mind.
If target env is inserted via the `spirv-attach-target` pass when no op—including `builtin.module` or `gpu.module`—has an existing one, then under the current implementation, the target env is attached only to the `"targets"` array attribute of `gpu.module`, and does not appear elsewhere.
When the `convert-gpu-to-spirv` pass is run in this case, it fails to find the target env in `"targets"` and instead falls back to the default target env, which leads to a legalization failure of the `memref.load` op.

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


More information about the Mlir-commits mailing list