-
Notifications
You must be signed in to change notification settings - Fork 14.5k
[AMDGPU] Add NoaliasAddrSpace to AAMDnodes #149247
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
Open
Shoreshen
wants to merge
3
commits into
llvm:main
Choose a base branch
from
Shoreshen:add-noaliasaddrspace-AAMDNodes
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+32
−14
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -759,18 +759,18 @@ class MDString : public Metadata { | |||||
/// memory access used by the alias-analysis infrastructure. | ||||||
struct AAMDNodes { | ||||||
explicit AAMDNodes() = default; | ||||||
explicit AAMDNodes(MDNode *T, MDNode *TS, MDNode *S, MDNode *N) | ||||||
: TBAA(T), TBAAStruct(TS), Scope(S), NoAlias(N) {} | ||||||
explicit AAMDNodes(MDNode *T, MDNode *TS, MDNode *S, MDNode *N, MDNode *NAS) | ||||||
: TBAA(T), TBAAStruct(TS), Scope(S), NoAlias(N), NoAliasAddrSpace(NAS) {} | ||||||
|
||||||
bool operator==(const AAMDNodes &A) const { | ||||||
return TBAA == A.TBAA && TBAAStruct == A.TBAAStruct && Scope == A.Scope && | ||||||
NoAlias == A.NoAlias; | ||||||
NoAlias == A.NoAlias && NoAliasAddrSpace == A.NoAliasAddrSpace; | ||||||
} | ||||||
|
||||||
bool operator!=(const AAMDNodes &A) const { return !(*this == A); } | ||||||
|
||||||
explicit operator bool() const { | ||||||
return TBAA || TBAAStruct || Scope || NoAlias; | ||||||
return TBAA || TBAAStruct || Scope || NoAlias || NoAliasAddrSpace; | ||||||
} | ||||||
|
||||||
/// The tag for type-based alias analysis. | ||||||
|
@@ -785,6 +785,9 @@ struct AAMDNodes { | |||||
/// The tag specifying the noalias scope. | ||||||
MDNode *NoAlias = nullptr; | ||||||
|
||||||
/// The tag specifying the noalias address space scope. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
It's not a scope |
||||||
MDNode *NoAliasAddrSpace = nullptr; | ||||||
|
||||||
// Shift tbaa Metadata node to start off bytes later | ||||||
LLVM_ABI static MDNode *shiftTBAA(MDNode *M, size_t off); | ||||||
|
||||||
|
@@ -806,6 +809,8 @@ struct AAMDNodes { | |||||
Result.TBAAStruct = Other.TBAAStruct == TBAAStruct ? TBAAStruct : nullptr; | ||||||
Result.Scope = Other.Scope == Scope ? Scope : nullptr; | ||||||
Result.NoAlias = Other.NoAlias == NoAlias ? NoAlias : nullptr; | ||||||
Result.NoAliasAddrSpace = | ||||||
Other.NoAliasAddrSpace == NoAliasAddrSpace ? NoAliasAddrSpace : nullptr; | ||||||
return Result; | ||||||
} | ||||||
|
||||||
|
@@ -818,6 +823,7 @@ struct AAMDNodes { | |||||
TBAAStruct ? shiftTBAAStruct(TBAAStruct, Offset) : nullptr; | ||||||
Result.Scope = Scope; | ||||||
Result.NoAlias = NoAlias; | ||||||
Result.NoAliasAddrSpace = NoAliasAddrSpace; | ||||||
return Result; | ||||||
} | ||||||
|
||||||
|
@@ -833,6 +839,7 @@ struct AAMDNodes { | |||||
Result.TBAAStruct = TBAAStruct; | ||||||
Result.Scope = Scope; | ||||||
Result.NoAlias = NoAlias; | ||||||
Result.NoAliasAddrSpace = NoAliasAddrSpace; | ||||||
return Result; | ||||||
} | ||||||
|
||||||
|
@@ -860,20 +867,21 @@ struct AAMDNodes { | |||||
template<> | ||||||
struct DenseMapInfo<AAMDNodes> { | ||||||
static inline AAMDNodes getEmptyKey() { | ||||||
return AAMDNodes(DenseMapInfo<MDNode *>::getEmptyKey(), | ||||||
nullptr, nullptr, nullptr); | ||||||
return AAMDNodes(DenseMapInfo<MDNode *>::getEmptyKey(), nullptr, nullptr, | ||||||
nullptr, nullptr); | ||||||
} | ||||||
|
||||||
static inline AAMDNodes getTombstoneKey() { | ||||||
return AAMDNodes(DenseMapInfo<MDNode *>::getTombstoneKey(), | ||||||
return AAMDNodes(DenseMapInfo<MDNode *>::getTombstoneKey(), nullptr, | ||||||
nullptr, nullptr, nullptr); | ||||||
} | ||||||
|
||||||
static unsigned getHashValue(const AAMDNodes &Val) { | ||||||
return DenseMapInfo<MDNode *>::getHashValue(Val.TBAA) ^ | ||||||
DenseMapInfo<MDNode *>::getHashValue(Val.TBAAStruct) ^ | ||||||
DenseMapInfo<MDNode *>::getHashValue(Val.Scope) ^ | ||||||
DenseMapInfo<MDNode *>::getHashValue(Val.NoAlias); | ||||||
DenseMapInfo<MDNode *>::getHashValue(Val.NoAlias) ^ | ||||||
DenseMapInfo<MDNode *>::getHashValue(Val.NoAliasAddrSpace); | ||||||
} | ||||||
|
||||||
static bool isEqual(const AAMDNodes &LHS, const AAMDNodes &RHS) { | ||||||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,7 @@ define amdgpu_ps void @flat_atomic_fadd_f32_no_rtn_intrinsic(ptr %ptr, float %da | |
; GFX942-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1 | ||
; GFX942-NEXT: [[REG_SEQUENCE:%[0-9]+]]:vreg_64_align2 = REG_SEQUENCE [[COPY]], %subreg.sub0, [[COPY1]], %subreg.sub1 | ||
; GFX942-NEXT: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr2 | ||
; GFX942-NEXT: FLAT_ATOMIC_ADD_F32 [[REG_SEQUENCE]], [[COPY2]], 0, 0, implicit $exec, implicit $flat_scr :: (load store syncscope("agent") seq_cst (s32) on %ir.ptr) | ||
; GFX942-NEXT: FLAT_ATOMIC_ADD_F32 [[REG_SEQUENCE]], [[COPY2]], 0, 0, implicit $exec, implicit $flat_scr :: (load store syncscope("agent") seq_cst (s32) on %ir.ptr, !noalias.addrspace !0) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you add MIR tests for print/parse of this |
||
; GFX942-NEXT: S_ENDPGM 0 | ||
; | ||
; GFX11-LABEL: name: flat_atomic_fadd_f32_no_rtn_intrinsic | ||
|
@@ -23,7 +23,7 @@ define amdgpu_ps void @flat_atomic_fadd_f32_no_rtn_intrinsic(ptr %ptr, float %da | |
; GFX11-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1 | ||
; GFX11-NEXT: [[REG_SEQUENCE:%[0-9]+]]:vreg_64 = REG_SEQUENCE [[COPY]], %subreg.sub0, [[COPY1]], %subreg.sub1 | ||
; GFX11-NEXT: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr2 | ||
; GFX11-NEXT: FLAT_ATOMIC_ADD_F32 [[REG_SEQUENCE]], [[COPY2]], 0, 0, implicit $exec, implicit $flat_scr :: (load store syncscope("agent") seq_cst (s32) on %ir.ptr) | ||
; GFX11-NEXT: FLAT_ATOMIC_ADD_F32 [[REG_SEQUENCE]], [[COPY2]], 0, 0, implicit $exec, implicit $flat_scr :: (load store syncscope("agent") seq_cst (s32) on %ir.ptr, !noalias.addrspace !0) | ||
; GFX11-NEXT: S_ENDPGM 0 | ||
%ret = call float @llvm.amdgcn.flat.atomic.fadd.f32.p1.f32(ptr %ptr, float %data) | ||
ret void | ||
|
@@ -38,7 +38,7 @@ define amdgpu_ps float @flat_atomic_fadd_f32_rtn_intrinsic(ptr %ptr, float %data | |
; GFX942-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1 | ||
; GFX942-NEXT: [[REG_SEQUENCE:%[0-9]+]]:vreg_64_align2 = REG_SEQUENCE [[COPY]], %subreg.sub0, [[COPY1]], %subreg.sub1 | ||
; GFX942-NEXT: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr2 | ||
; GFX942-NEXT: [[FLAT_ATOMIC_ADD_F32_RTN:%[0-9]+]]:vgpr_32 = FLAT_ATOMIC_ADD_F32_RTN [[REG_SEQUENCE]], [[COPY2]], 0, 1, implicit $exec, implicit $flat_scr :: (load store syncscope("agent") seq_cst (s32) on %ir.ptr) | ||
; GFX942-NEXT: [[FLAT_ATOMIC_ADD_F32_RTN:%[0-9]+]]:vgpr_32 = FLAT_ATOMIC_ADD_F32_RTN [[REG_SEQUENCE]], [[COPY2]], 0, 1, implicit $exec, implicit $flat_scr :: (load store syncscope("agent") seq_cst (s32) on %ir.ptr, !noalias.addrspace !0) | ||
; GFX942-NEXT: $vgpr0 = COPY [[FLAT_ATOMIC_ADD_F32_RTN]] | ||
; GFX942-NEXT: SI_RETURN_TO_EPILOG implicit $vgpr0 | ||
; | ||
|
@@ -50,7 +50,7 @@ define amdgpu_ps float @flat_atomic_fadd_f32_rtn_intrinsic(ptr %ptr, float %data | |
; GFX11-NEXT: [[COPY1:%[0-9]+]]:vgpr_32 = COPY $vgpr1 | ||
; GFX11-NEXT: [[REG_SEQUENCE:%[0-9]+]]:vreg_64 = REG_SEQUENCE [[COPY]], %subreg.sub0, [[COPY1]], %subreg.sub1 | ||
; GFX11-NEXT: [[COPY2:%[0-9]+]]:vgpr_32 = COPY $vgpr2 | ||
; GFX11-NEXT: [[FLAT_ATOMIC_ADD_F32_RTN:%[0-9]+]]:vgpr_32 = FLAT_ATOMIC_ADD_F32_RTN [[REG_SEQUENCE]], [[COPY2]], 0, 1, implicit $exec, implicit $flat_scr :: (load store syncscope("agent") seq_cst (s32) on %ir.ptr) | ||
; GFX11-NEXT: [[FLAT_ATOMIC_ADD_F32_RTN:%[0-9]+]]:vgpr_32 = FLAT_ATOMIC_ADD_F32_RTN [[REG_SEQUENCE]], [[COPY2]], 0, 1, implicit $exec, implicit $flat_scr :: (load store syncscope("agent") seq_cst (s32) on %ir.ptr, !noalias.addrspace !0) | ||
; GFX11-NEXT: $vgpr0 = COPY [[FLAT_ATOMIC_ADD_F32_RTN]] | ||
; GFX11-NEXT: SI_RETURN_TO_EPILOG implicit $vgpr0 | ||
%ret = call float @llvm.amdgcn.flat.atomic.fadd.f32.p1.f32(ptr %ptr, float %data) | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The constructor signature change is a breaking change that removes the 4-parameter constructor. Consider providing both constructors for backward compatibility, with the 4-parameter version defaulting NoAliasAddrSpace to nullptr.
Copilot uses AI. Check for mistakes.