This is an archive of the discontinued LLVM Phabricator instance.

[AMDGPU] Deduce sign from address space
AbandonedPublic

Authored by sebastian-ne on Mar 30 2021, 6:14 AM.

Details

Reviewers
arsenm
rampitec
Summary

The immediate offset of flat instructions is signed for the global_
and scratch_ variants and unsigned for the flat_ variant.
We can deduce the signdness of the offset automatically from the address
space instead of passing it through everywhere.

Diff Detail

Event Timeline

sebastian-ne created this revision.Mar 30 2021, 6:14 AM
sebastian-ne requested review of this revision.Mar 30 2021, 6:14 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 30 2021, 6:14 AM
arsenm requested changes to this revision.Mar 30 2021, 6:21 AM

This isn't a property of the address space, but of the instruction. You can use flat instructions to access global address space. You cannot go backwards this way

This revision now requires changes to proceed.Mar 30 2021, 6:21 AM

We already use this connection in SIInstrInfo::isLegalFLATOffset, there is a check for ST.hasFlatSegmentOffsetBug() && AddrSpace == AMDGPUAS::FLAT_ADDRESS. I guess this is already broken then.

Is there a good way to find the instruction variant (global, scratch or flat) from the instruction (or intrinsic) or do we need to pass this through everywhere?

We already use this connection in SIInstrInfo::isLegalFLATOffset, there is a check for ST.hasFlatSegmentOffsetBug() && AddrSpace == AMDGPUAS::FLAT_ADDRESS. I guess this is already broken then.

Yeah, that's wrong

Is there a good way to find the instruction variant (global, scratch or flat) from the instruction (or intrinsic) or do we need to pass this through everywhere?

Something directly from the instruction should work, but that won't help you in the pattern matching contexts

sebastian-ne abandoned this revision.Mar 31 2021, 2:02 AM