This is an archive of the discontinued LLVM Phabricator instance.

[mlir][spirv] Fix scf.yield pattern conversion
ClosedPublic

Authored by kuhar on Mar 14 2023, 12:31 PM.

Details

Summary

Only rewrite scf.yield when the parent op is supported by
scf-to-spirv.

Fixes: #61380, #61107, #61148

Diff Detail

Event Timeline

kuhar created this revision.Mar 14 2023, 12:31 PM
kuhar requested review of this revision.Mar 14 2023, 12:31 PM
kuhar planned changes to this revision.Mar 14 2023, 12:40 PM

I discovered I skipped some existing tests, this doesn't always work. Working on a fix.

kuhar updated this revision to Diff 505223.Mar 14 2023, 12:48 PM

Fix test failures. Add a regression test.

antiagainst accepted this revision.Mar 14 2023, 3:04 PM
antiagainst added inline comments.
mlir/lib/Conversion/SCFToSPIRV/SCFToSPIRV.cpp
297

We don't need to check the dialect here given we are explicitly checking the ops?

This revision is now accepted and ready to land.Mar 14 2023, 3:04 PM
kuhar marked an inline comment as done.Mar 14 2023, 3:06 PM
kuhar added inline comments.
mlir/lib/Conversion/SCFToSPIRV/SCFToSPIRV.cpp
297

scf.yield can be inside an already converted op like spirv::LoopOp or other ops we don't know about. Not sure if there's a better way to guard against this. Alternatively, we could list all scf. ops we definitely don't support.

antiagainst added inline comments.Mar 14 2023, 3:09 PM
mlir/lib/Conversion/SCFToSPIRV/SCFToSPIRV.cpp
297

I see. Makes sense.

This revision was automatically updated to reflect the committed changes.
kuhar marked an inline comment as done.