This is an archive of the discontinued LLVM Phabricator instance.

[mlir][spirv] Use spv.store instead of init in var
ClosedPublic

Authored by raikonenfnu on Aug 22 2022, 5:35 PM.

Details

Summary
  • Add spv.store instead of init for spv.variable to fix data issues in some GPU drivers

Diff Detail

Event Timeline

raikonenfnu created this revision.Aug 22 2022, 5:35 PM
raikonenfnu requested review of this revision.Aug 22 2022, 5:35 PM
antiagainst accepted this revision.Aug 22 2022, 5:51 PM
antiagainst added inline comments.
mlir/lib/Conversion/TensorToSPIRV/TensorToSPIRV.cpp
73

Could you put some comments here like "// We could use the initializer directly; but certain driver compilers have bugs dealing with that. So for now use spv.Store for initialization." so that later we can recall why such behavior?

This revision is now accepted and ready to land.Aug 22 2022, 5:51 PM

Add in code comments to clarify why we need spv.store

raikonenfnu marked an inline comment as done.Aug 22 2022, 6:09 PM
raikonenfnu added inline comments.
mlir/lib/Conversion/TensorToSPIRV/TensorToSPIRV.cpp
73

Could you put some comments here like "// We could use the initializer directly; but certain driver compilers have bugs dealing with that. So for now use spv.Store for initialization." so that later we can recall why such behavior?

Done! thanks :)

kuhar added a subscriber: kuhar.Aug 22 2022, 8:40 PM
kuhar added inline comments.
mlir/lib/Conversion/TensorToSPIRV/TensorToSPIRV.cpp
77

This variable is unused:

llvm-project/mlir/lib/Conversion/TensorToSPIRV/TensorToSPIRV.cpp:77:22: warning: unused variable 'storeOp' [-Wunused-variable]
      spirv::StoreOp storeOp =
                     ^
This revision was automatically updated to reflect the committed changes.
kuhar added inline comments.Aug 22 2022, 8:42 PM
mlir/lib/Conversion/TensorToSPIRV/TensorToSPIRV.cpp
77

I fixed this when pushing

raikonenfnu marked an inline comment as done.Aug 22 2022, 8:47 PM
raikonenfnu added inline comments.
mlir/lib/Conversion/TensorToSPIRV/TensorToSPIRV.cpp
77

awesome! thanks 😄