-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[AMDGPU] Mark cluster_workgroup_id_* intrinsics always uniform #159439
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
rampitec
merged 1 commit into
main
from
users/rampitec/09-17-_amdgpu_mark_cluster_workgroup_id__intrinsics_always_uniform
Sep 17, 2025
Merged
[AMDGPU] Mark cluster_workgroup_id_* intrinsics always uniform #159439
rampitec
merged 1 commit into
main
from
users/rampitec/09-17-_amdgpu_mark_cluster_workgroup_id__intrinsics_always_uniform
Sep 17, 2025
Conversation
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
@llvm/pr-subscribers-backend-amdgpu Author: Stanislav Mekhanoshin (rampitec) ChangesFull diff: https://github.com/llvm/llvm-project/pull/159439.diff 2 Files Affected:
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUSearchableTables.td b/llvm/lib/Target/AMDGPU/AMDGPUSearchableTables.td
index 7be18998ff6b0..2393346839707 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUSearchableTables.td
+++ b/llvm/lib/Target/AMDGPU/AMDGPUSearchableTables.td
@@ -398,6 +398,14 @@ def : AlwaysUniform<int_amdgcn_icmp>;
def : AlwaysUniform<int_amdgcn_fcmp>;
def : AlwaysUniform<int_amdgcn_ballot>;
def : AlwaysUniform<int_amdgcn_if_break>;
+def : AlwaysUniform<int_amdgcn_cluster_workgroup_id_x>;
+def : AlwaysUniform<int_amdgcn_cluster_workgroup_id_y>;
+def : AlwaysUniform<int_amdgcn_cluster_workgroup_id_z>;
+def : AlwaysUniform<int_amdgcn_cluster_workgroup_flat_id>;
+def : AlwaysUniform<int_amdgcn_cluster_workgroup_max_id_x>;
+def : AlwaysUniform<int_amdgcn_cluster_workgroup_max_id_y>;
+def : AlwaysUniform<int_amdgcn_cluster_workgroup_max_id_z>;
+def : AlwaysUniform<int_amdgcn_cluster_workgroup_max_flat_id>;
def : AlwaysUniform<int_amdgcn_workgroup_id_x>;
def : AlwaysUniform<int_amdgcn_workgroup_id_y>;
def : AlwaysUniform<int_amdgcn_workgroup_id_z>;
diff --git a/llvm/test/Analysis/UniformityAnalysis/AMDGPU/always_uniform.ll b/llvm/test/Analysis/UniformityAnalysis/AMDGPU/always_uniform.ll
index 99d9e28425107..9ff670bee0f89 100644
--- a/llvm/test/Analysis/UniformityAnalysis/AMDGPU/always_uniform.ll
+++ b/llvm/test/Analysis/UniformityAnalysis/AMDGPU/always_uniform.ll
@@ -119,6 +119,70 @@ define void @s_getreg(ptr addrspace(1) inreg %out) {
ret void
}
+; CHECK-LABEL: for function 'cluster_workgroup_id_x':
+; CHECK: ALL VALUES UNIFORM
+define void @cluster_workgroup_id_x(ptr addrspace(1) inreg %out) {
+ %result = call i32 @llvm.amdgcn.cluster.workgroup.id.x()
+ store i32 %result, ptr addrspace(1) %out, align 4
+ ret void
+}
+
+; CHECK-LABEL: for function 'cluster_workgroup_id_y':
+; CHECK: ALL VALUES UNIFORM
+define void @cluster_workgroup_id_y(ptr addrspace(1) inreg %out) {
+ %result = call i32 @llvm.amdgcn.cluster.workgroup.id.y()
+ store i32 %result, ptr addrspace(1) %out, align 4
+ ret void
+}
+
+; CHECK-LABEL: for function 'cluster_workgroup_id_z':
+; CHECK: ALL VALUES UNIFORM
+define void @cluster_workgroup_id_z(ptr addrspace(1) inreg %out) {
+ %result = call i32 @llvm.amdgcn.cluster.workgroup.id.z()
+ store i32 %result, ptr addrspace(1) %out, align 4
+ ret void
+}
+
+; CHECK-LABEL: for function 'cluster_workgroup_flat_id':
+; CHECK: ALL VALUES UNIFORM
+define void @cluster_workgroup_flat_id(ptr addrspace(1) inreg %out) {
+ %result = call i32 @llvm.amdgcn.cluster.workgroup.flat.id()
+ store i32 %result, ptr addrspace(1) %out, align 4
+ ret void
+}
+
+; CHECK-LABEL: for function 'cluster_workgroup_max_id_x':
+; CHECK: ALL VALUES UNIFORM
+define void @cluster_workgroup_max_id_x(ptr addrspace(1) inreg %out) {
+ %result = call i32 @llvm.amdgcn.cluster.workgroup.max.id.x()
+ store i32 %result, ptr addrspace(1) %out, align 4
+ ret void
+}
+
+; CHECK-LABEL: for function 'cluster_workgroup_max_id_y':
+; CHECK: ALL VALUES UNIFORM
+define void @cluster_workgroup_max_id_y(ptr addrspace(1) inreg %out) {
+ %result = call i32 @llvm.amdgcn.cluster.workgroup.max.id.y()
+ store i32 %result, ptr addrspace(1) %out, align 4
+ ret void
+}
+
+; CHECK-LABEL: for function 'cluster_workgroup_max_id_z':
+; CHECK: ALL VALUES UNIFORM
+define void @cluster_workgroup_max_id_z(ptr addrspace(1) inreg %out) {
+ %result = call i32 @llvm.amdgcn.cluster.workgroup.max.id.z()
+ store i32 %result, ptr addrspace(1) %out, align 4
+ ret void
+}
+
+; CHECK-LABEL: for function 'cluster_workgroup_max_flat_id':
+; CHECK: ALL VALUES UNIFORM
+define void @cluster_workgroup_max_flat_id(ptr addrspace(1) inreg %out) {
+ %result = call i32 @llvm.amdgcn.cluster.workgroup.max.flat.id()
+ store i32 %result, ptr addrspace(1) %out, align 4
+ ret void
+}
+
; CHECK-LABEL: for function 's_memtime':
; CHECK: ALL VALUES UNIFORM
define void @s_memtime(ptr addrspace(1) inreg %out) {
@@ -144,6 +208,14 @@ declare i64 @llvm.amdgcn.ballot.i32(i1) #1
declare i32 @llvm.amdgcn.workgroup.id.x() #0
declare i32 @llvm.amdgcn.workgroup.id.y() #0
declare i32 @llvm.amdgcn.workgroup.id.z() #0
+declare i32 @llvm.amdgcn.cluster.workgroup.id.x()
+declare i32 @llvm.amdgcn.cluster.workgroup.id.y()
+declare i32 @llvm.amdgcn.cluster.workgroup.id.z()
+declare i32 @llvm.amdgcn.cluster.workgroup.flat.id()
+declare i32 @llvm.amdgcn.cluster.workgroup.max.id.x()
+declare i32 @llvm.amdgcn.cluster.workgroup.max.id.y()
+declare i32 @llvm.amdgcn.cluster.workgroup.max.id.z()
+declare i32 @llvm.amdgcn.cluster.workgroup.max.flat.id()
attributes #0 = { nounwind readnone }
attributes #1 = { nounwind readnone convergent }
|
@llvm/pr-subscribers-llvm-analysis Author: Stanislav Mekhanoshin (rampitec) ChangesFull diff: https://github.com/llvm/llvm-project/pull/159439.diff 2 Files Affected:
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUSearchableTables.td b/llvm/lib/Target/AMDGPU/AMDGPUSearchableTables.td
index 7be18998ff6b0..2393346839707 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUSearchableTables.td
+++ b/llvm/lib/Target/AMDGPU/AMDGPUSearchableTables.td
@@ -398,6 +398,14 @@ def : AlwaysUniform<int_amdgcn_icmp>;
def : AlwaysUniform<int_amdgcn_fcmp>;
def : AlwaysUniform<int_amdgcn_ballot>;
def : AlwaysUniform<int_amdgcn_if_break>;
+def : AlwaysUniform<int_amdgcn_cluster_workgroup_id_x>;
+def : AlwaysUniform<int_amdgcn_cluster_workgroup_id_y>;
+def : AlwaysUniform<int_amdgcn_cluster_workgroup_id_z>;
+def : AlwaysUniform<int_amdgcn_cluster_workgroup_flat_id>;
+def : AlwaysUniform<int_amdgcn_cluster_workgroup_max_id_x>;
+def : AlwaysUniform<int_amdgcn_cluster_workgroup_max_id_y>;
+def : AlwaysUniform<int_amdgcn_cluster_workgroup_max_id_z>;
+def : AlwaysUniform<int_amdgcn_cluster_workgroup_max_flat_id>;
def : AlwaysUniform<int_amdgcn_workgroup_id_x>;
def : AlwaysUniform<int_amdgcn_workgroup_id_y>;
def : AlwaysUniform<int_amdgcn_workgroup_id_z>;
diff --git a/llvm/test/Analysis/UniformityAnalysis/AMDGPU/always_uniform.ll b/llvm/test/Analysis/UniformityAnalysis/AMDGPU/always_uniform.ll
index 99d9e28425107..9ff670bee0f89 100644
--- a/llvm/test/Analysis/UniformityAnalysis/AMDGPU/always_uniform.ll
+++ b/llvm/test/Analysis/UniformityAnalysis/AMDGPU/always_uniform.ll
@@ -119,6 +119,70 @@ define void @s_getreg(ptr addrspace(1) inreg %out) {
ret void
}
+; CHECK-LABEL: for function 'cluster_workgroup_id_x':
+; CHECK: ALL VALUES UNIFORM
+define void @cluster_workgroup_id_x(ptr addrspace(1) inreg %out) {
+ %result = call i32 @llvm.amdgcn.cluster.workgroup.id.x()
+ store i32 %result, ptr addrspace(1) %out, align 4
+ ret void
+}
+
+; CHECK-LABEL: for function 'cluster_workgroup_id_y':
+; CHECK: ALL VALUES UNIFORM
+define void @cluster_workgroup_id_y(ptr addrspace(1) inreg %out) {
+ %result = call i32 @llvm.amdgcn.cluster.workgroup.id.y()
+ store i32 %result, ptr addrspace(1) %out, align 4
+ ret void
+}
+
+; CHECK-LABEL: for function 'cluster_workgroup_id_z':
+; CHECK: ALL VALUES UNIFORM
+define void @cluster_workgroup_id_z(ptr addrspace(1) inreg %out) {
+ %result = call i32 @llvm.amdgcn.cluster.workgroup.id.z()
+ store i32 %result, ptr addrspace(1) %out, align 4
+ ret void
+}
+
+; CHECK-LABEL: for function 'cluster_workgroup_flat_id':
+; CHECK: ALL VALUES UNIFORM
+define void @cluster_workgroup_flat_id(ptr addrspace(1) inreg %out) {
+ %result = call i32 @llvm.amdgcn.cluster.workgroup.flat.id()
+ store i32 %result, ptr addrspace(1) %out, align 4
+ ret void
+}
+
+; CHECK-LABEL: for function 'cluster_workgroup_max_id_x':
+; CHECK: ALL VALUES UNIFORM
+define void @cluster_workgroup_max_id_x(ptr addrspace(1) inreg %out) {
+ %result = call i32 @llvm.amdgcn.cluster.workgroup.max.id.x()
+ store i32 %result, ptr addrspace(1) %out, align 4
+ ret void
+}
+
+; CHECK-LABEL: for function 'cluster_workgroup_max_id_y':
+; CHECK: ALL VALUES UNIFORM
+define void @cluster_workgroup_max_id_y(ptr addrspace(1) inreg %out) {
+ %result = call i32 @llvm.amdgcn.cluster.workgroup.max.id.y()
+ store i32 %result, ptr addrspace(1) %out, align 4
+ ret void
+}
+
+; CHECK-LABEL: for function 'cluster_workgroup_max_id_z':
+; CHECK: ALL VALUES UNIFORM
+define void @cluster_workgroup_max_id_z(ptr addrspace(1) inreg %out) {
+ %result = call i32 @llvm.amdgcn.cluster.workgroup.max.id.z()
+ store i32 %result, ptr addrspace(1) %out, align 4
+ ret void
+}
+
+; CHECK-LABEL: for function 'cluster_workgroup_max_flat_id':
+; CHECK: ALL VALUES UNIFORM
+define void @cluster_workgroup_max_flat_id(ptr addrspace(1) inreg %out) {
+ %result = call i32 @llvm.amdgcn.cluster.workgroup.max.flat.id()
+ store i32 %result, ptr addrspace(1) %out, align 4
+ ret void
+}
+
; CHECK-LABEL: for function 's_memtime':
; CHECK: ALL VALUES UNIFORM
define void @s_memtime(ptr addrspace(1) inreg %out) {
@@ -144,6 +208,14 @@ declare i64 @llvm.amdgcn.ballot.i32(i1) #1
declare i32 @llvm.amdgcn.workgroup.id.x() #0
declare i32 @llvm.amdgcn.workgroup.id.y() #0
declare i32 @llvm.amdgcn.workgroup.id.z() #0
+declare i32 @llvm.amdgcn.cluster.workgroup.id.x()
+declare i32 @llvm.amdgcn.cluster.workgroup.id.y()
+declare i32 @llvm.amdgcn.cluster.workgroup.id.z()
+declare i32 @llvm.amdgcn.cluster.workgroup.flat.id()
+declare i32 @llvm.amdgcn.cluster.workgroup.max.id.x()
+declare i32 @llvm.amdgcn.cluster.workgroup.max.id.y()
+declare i32 @llvm.amdgcn.cluster.workgroup.max.id.z()
+declare i32 @llvm.amdgcn.cluster.workgroup.max.flat.id()
attributes #0 = { nounwind readnone }
attributes #1 = { nounwind readnone convergent }
|
shiltian
approved these changes
Sep 17, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
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.
No description provided.