This is an archive of the discontinued LLVM Phabricator instance.

[HIPSPV] Fix literals are mapped to Generic address space
ClosedPublic

Authored by linjamaki on Feb 2 2022, 11:38 PM.

Details

Summary

This issue is an oversight in D108621.

Literals in HIP are emitted as global constant variables with default
address space which maps to Generic address space for HIPSPV. In
SPIR-V such variables translate to OpVariable instructions with
Generic storage class which are not legal. Fix by mapping literals
to CrossWorkGroup address space.

The literals are not mapped to UniformConstant because the “flat”
pointers in HIP may reference them and “flat” pointers are modeled
as Generic pointers in SPIR-V. In SPIR-V/OpenCL UniformConstant
pointers may not be casted to Generic.

Diff Detail

Event Timeline

linjamaki created this revision.Feb 2 2022, 11:38 PM
linjamaki edited the summary of this revision. (Show Details)Feb 2 2022, 11:53 PM
linjamaki published this revision for review.Feb 2 2022, 11:57 PM
linjamaki added reviewers: Anastasia, yaxunl.
Herald added a project: Restricted Project. · View Herald TranscriptFeb 2 2022, 11:57 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
yaxunl accepted this revision.Feb 3 2022, 6:52 AM

LGTM. Thanks.

This revision is now accepted and ready to land.Feb 3 2022, 6:52 AM

Thanks for the review, @yaxunl. Could you push this to the LLVM? And to the LLVM 14 release branch too, if possible?

yaxunl added a subscriber: tstellar.Feb 4 2022, 3:37 PM

Thanks for the review, @yaxunl. Could you push this to the LLVM? And to the LLVM 14 release branch too, if possible?

Sure. @tstellar What is the current procedure for cherry-picking a fix to a release branch? Thanks.

@yaxunl This looks good to me, you can go ahead and cherry-pick it directly to release/14.x.

This revision was landed with ongoing or failed builds.Feb 5 2022, 2:29 PM
This revision was automatically updated to reflect the committed changes.
yaxunl added a comment.Feb 7 2022, 7:34 AM

It has been cherry-picked to 14.x by 02d5b112