Skip to content

AMDGPU: Scratch instructions are trivially disjoint from SMEM and buffer instructions #65287

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 8, 2023

Conversation

nhaehnle
Copy link
Collaborator

@nhaehnle nhaehnle commented Sep 5, 2023

Scratch instructions are always in addrspace(5), which can only alias with flat (and itself). SMEM and buffer instructions can never reference those address spaces, so they are trivially disjoint.

…fer instructions

Scratch instructions are always in addrspace(5), which can only alias
with flat (and itself). SMEM and buffer instructions can never reference
those address spaces, so they are trivially disjoint.
Copy link
Collaborator

@piotrAMD piotrAMD left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Perhaps even better would be to use address space checks (addrspacesMayAlias).

}

if (isSMRD(MIa)) {
if (isSMRD(MIb))
return checkInstOffsetsDoNotOverlap(MIa, MIb);

return !isFLAT(MIb) && !isMUBUF(MIb) && !isMTBUF(MIb);
if (isFLAT(MIb))
return isFLATScratch(MIb);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks backwards?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function returns true if the instructions are trivially disjoint. SMRD is trivially disjoint from FLAT if it's FLAT-scratch, but not otherwise.

@arsenm
Copy link
Contributor

arsenm commented Sep 6, 2023

LGTM. Perhaps even better would be to use address space checks (addrspacesMayAlias).

Part of the point of this is to avoid inspecting the MMO which isn't guaranteed to be there

@nhaehnle nhaehnle merged commit 2eb767c into llvm:main Sep 8, 2023
@jayfoad
Copy link
Contributor

jayfoad commented Sep 8, 2023

LGTM. Perhaps even better would be to use address space checks (addrspacesMayAlias).

Part of the point of this is to avoid inspecting the MMO which isn't guaranteed to be there

I know MMOs are allowed to be dropped, but in practice they rarely or never are, so I don't see the problem with relying on them for optimization. If we ever find that optimizations are missed because MMOs are dropped then that's just a QoI issue, and we can try to fix whatever pass dropped them.

@arsenm
Copy link
Contributor

arsenm commented Sep 8, 2023

We can change that, someone just need to add a verifier check and fix where ever they are dropped

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants