This is an archive of the discontinued LLVM Phabricator instance.

[mlir][spirv] Support integer signedness
ClosedPublic

Authored by antiagainst on Mar 4 2020, 7:49 AM.

Details

Summary

This commit updates SPIR-V dialect to support integer signedness
by relaxing various checks for signless to just normal integers.

The hack for spv.Bitcast can now be removed.

Depends On D75610

Diff Detail

Unit TestsFailed

Event Timeline

antiagainst created this revision.Mar 4 2020, 7:49 AM
Herald added a project: Restricted Project. · View Herald Transcript
mravishankar accepted this revision.Mar 4 2020, 10:25 AM

Minor nits, but happy to see that this got resolved and bitcast can now be autogened.

mlir/docs/Dialects/SPIR-V.md
261

Do we need no signedness semantics. This is effectively saying no signedness is same as unsigned. Might as well make that explicit?

mlir/include/mlir/Dialect/SPIRV/SPIRVBase.td
2948

Just to make sure I understand this, the presence of "signless" is effectively legacy. We are treating them as unsigned implicitly.

This revision is now accepted and ready to land.Mar 4 2020, 10:25 AM
antiagainst marked 4 inline comments as done.Mar 4 2020, 12:11 PM
antiagainst added inline comments.
mlir/docs/Dialects/SPIR-V.md
261

We still need it. They are serving different APIs: for Vulkan generally we want signless (but it's complicated. There are cases where one still want signedness semantics like image sampling stuff; it's due to historical reasons that high-level programming language was directly sent to the drivers). For OpenCL signedness is something they care.

mlir/include/mlir/Dialect/SPIRV/SPIRVBase.td
2948

Not really. We still want signless. It's just that the spec serializes both of them into one state... (I don't have the context as for why that decision instead of using three numbers...)

This revision was automatically updated to reflect the committed changes.
antiagainst marked 2 inline comments as done.