[llvm] [AMDGPU] Fix SSID merge in SIMemoryLegalizer to use smallest inclusiv… (PR #208300)
Wooseok Lee via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 9 06:58:18 PDT 2026
================
@@ -130,26 +130,58 @@ class AMDGPUMachineModuleInfo final : public MachineModuleInfoELF {
return ClusterOneAddressSpaceSSID;
}
- /// In AMDGPU target synchronization scopes are inclusive, meaning a
- /// larger synchronization scope is inclusive of a smaller synchronization
- /// scope.
+ /// In AMDGPU, synchronization scopes are inclusive: a larger scope is
+ /// inclusive of a smaller one (e.g. agent includes workgroup).
+ ///
+ /// Returns the merged synchronization scope of \p A and \p B: the smallest
+ /// scope that is inclusive of both. Takes the larger inclusion level and,
+ /// if either scope is cross-address-space, the result is also
+ /// cross-address-space (since a one-AS scope cannot subsume a cross-AS
+ /// scope at the same level).
///
- /// \returns True if synchronization scope \p A is larger than or equal to
- /// synchronization scope \p B, false if synchronization scope \p A is smaller
- /// than synchronization scope \p B, or "std::nullopt" if either
- /// synchronization scope \p A or \p B is not supported by the AMDGPU target.
- std::optional<bool> isSyncScopeInclusion(SyncScope::ID A,
- SyncScope::ID B) const {
+ /// \returns The merged scope ID, or "std::nullopt" if either scope is not
+ /// supported by the AMDGPU target.
+ std::optional<SyncScope::ID> getMergedSyncScopeID(SyncScope::ID A,
----------------
wooseoklee wrote:
Thanks for the feedback. This is a good point. I will update the code.
https://github.com/llvm/llvm-project/pull/208300
More information about the llvm-commits
mailing list