-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Allow Specifying SGMasks for Inline Asm #155491
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
linuxrocks123
wants to merge
7
commits into
llvm:main
Choose a base branch
from
linuxrocks123:swdev-549227
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.
+129
−0
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
dca720f
Attempt to add inline asm to sched group barriers
linuxrocks123 88abb6e
Allow specifying sched group barrier masks for inline asm
linuxrocks123 35b281b
Switch to StringRef
linuxrocks123 a3f52ee
Add testcase
linuxrocks123 a24521a
Guess the constraints instead of using user-provided hints
linuxrocks123 9604498
Fix error-that-should-be-warning, code may or may not be correct
linuxrocks123 aac0dd4
Update testcase; update algorithm to something maybe right
linuxrocks123 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
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 |
---|---|---|
@@ -0,0 +1,74 @@ | ||
; RUN: llc -O3 -mcpu=gfx942 < %s | FileCheck %s | ||
; CHECK: v_add_f32_e32 | ||
; CHECK-NEXT: ;;#ASMSTART | ||
; CHECK-NEXT: v_mfma_f64 | ||
; CHECK-NEXT: ;;#ASMEND | ||
; CHECK: v_add_f32_e32 | ||
; ModuleID = '<stdin>' | ||
source_filename = "llvm-link" | ||
target datalayout = "e-p:64:64-p1:64:64-p2:32:32-p3:32:32-p4:64:64-p5:32:32-p6:32:32-p7:160:256:256:32-p8:128:128:128:48-p9:192:256:256:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-v2048:2048-n32:64-S32-A5-G1-ni:7:8:9" | ||
target triple = "amdgcn-amd-amdhsa" | ||
|
||
@llvm.compiler.used = appending addrspace(1) global [1 x ptr] [ptr addrspacecast (ptr addrspace(1) @__hip_cuid_bffb86447932ec40 to ptr)], section "llvm.metadata" | ||
@__hip_cuid_bffb86447932ec40 = addrspace(1) global i8 0 | ||
|
||
; Function Attrs: convergent mustprogress norecurse nounwind | ||
define protected amdgpu_kernel void @_Z17group4_sum_floaatPfPKfi(ptr addrspace(1) noalias noundef writeonly captures(none) %to.coerce, ptr addrspace(1) noalias noundef readonly captures(none) %from.coerce, i32 noundef %length) local_unnamed_addr #0 { | ||
entry: | ||
%0 = tail call i32 @llvm.amdgcn.workgroup.id.x() | ||
%mul = shl i32 %0, 6 | ||
%1 = tail call i32 @llvm.amdgcn.workitem.id.x() | ||
%add = add i32 %mul, %1 | ||
%cmp = icmp slt i32 %add, %length | ||
br i1 %cmp, label %if.then, label %if.end | ||
|
||
if.then: ; preds = %entry | ||
%idx.ext = sext i32 %add to i64 | ||
%add.ptr = getelementptr inbounds float, ptr addrspace(1) %to.coerce, i64 %idx.ext | ||
%mul3 = shl nsw i32 %add, 2 | ||
%idx.ext4 = sext i32 %mul3 to i64 | ||
%add.ptr5 = getelementptr inbounds float, ptr addrspace(1) %from.coerce, i64 %idx.ext4 | ||
%2 = load <2 x float>, ptr addrspace(1) %add.ptr5, align 16, !tbaa !0 | ||
%a20 = add i64 %idx.ext4, 2 | ||
%a21 = getelementptr inbounds float, ptr addrspace(1) %from.coerce, i64 %a20 | ||
%a22 = load <2 x float>, ptr addrspace(1) %a21, align 16, !tbaa !0 | ||
%3 = extractelement <2 x float> %a22, i64 1 | ||
%4 = extractelement <2 x float> %2, i64 0 | ||
%5 = tail call contract noundef float asm "v_mfma_f64_4x4x4f64 $0, $1, $2, 0", "=a,v,v"(<2 x float> %2, <2 x float> %a22) #3, !srcloc !3 | ||
%6 = extractelement <2 x float> %2, i64 1 | ||
%7 = extractelement <2 x float> %a22, i64 0 | ||
%add6 = fadd contract float %6, %7 | ||
%add7 = fadd contract float %5, %add6 | ||
store float %add7, ptr addrspace(1) %add.ptr, align 4, !tbaa !4 | ||
tail call void @llvm.amdgcn.sched.group.barrier(i32 16, i32 1, i32 0) | ||
tail call void @llvm.amdgcn.sched.group.barrier(i32 2, i32 5, i32 0) | ||
tail call void @llvm.amdgcn.sched.group.barrier(i32 16, i32 1, i32 0) | ||
tail call void @llvm.amdgcn.sched.group.barrier(i32 2, i32 1, i32 0) | ||
tail call void @llvm.amdgcn.sched.group.barrier(i32 8, i32 1, i32 0) | ||
tail call void @llvm.amdgcn.sched.group.barrier(i32 2, i32 1, i32 0) | ||
br label %if.end | ||
|
||
if.end: ; preds = %if.then, %entry | ||
ret void | ||
} | ||
|
||
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) | ||
declare noundef i32 @llvm.amdgcn.workgroup.id.x() #1 | ||
|
||
; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none) | ||
declare noundef range(i32 0, 1024) i32 @llvm.amdgcn.workitem.id.x() #1 | ||
|
||
; Function Attrs: convergent nocallback nofree nounwind willreturn | ||
declare void @llvm.amdgcn.sched.group.barrier(i32 immarg, i32 immarg, i32 immarg) #2 | ||
|
||
attributes #0 = { convergent mustprogress norecurse nounwind "amdgpu-agpr-alloc"="0" "amdgpu-flat-work-group-size"="1,1024" "amdgpu-no-completion-action" "amdgpu-no-default-queue" "amdgpu-no-dispatch-id" "amdgpu-no-dispatch-ptr" "amdgpu-no-flat-scratch-init" "amdgpu-no-heap-ptr" "amdgpu-no-hostcall-ptr" "amdgpu-no-implicitarg-ptr" "amdgpu-no-lds-kernel-id" "amdgpu-no-multigrid-sync-arg" "amdgpu-no-queue-ptr" "amdgpu-no-workgroup-id-x" "amdgpu-no-workgroup-id-y" "amdgpu-no-workgroup-id-z" "amdgpu-no-workitem-id-x" "amdgpu-no-workitem-id-y" "amdgpu-no-workitem-id-z" "amdgpu-waves-per-eu"="4,8" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="gfx942" "target-features"="+16-bit-insts,+atomic-buffer-global-pk-add-f16-insts,+atomic-ds-pk-add-16-insts,+atomic-fadd-rtn-insts,+atomic-flat-pk-add-16-insts,+atomic-fmin-fmax-global-f64,+atomic-global-pk-add-bf16-inst,+ci-insts,+dl-insts,+dot1-insts,+dot10-insts,+dot2-insts,+dot3-insts,+dot4-insts,+dot5-insts,+dot6-insts,+dot7-insts,+dpp,+fp8-conversion-insts,+fp8-insts,+gfx8-insts,+gfx9-insts,+gfx90a-insts,+gfx940-insts,+mai-insts,+s-memrealtime,+s-memtime-inst,+wavefrontsize64,+xf32-insts" "uniform-work-group-size"="true" } | ||
attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) } | ||
attributes #2 = { convergent nocallback nofree nounwind willreturn } | ||
attributes #3 = { convergent nounwind memory(none) } | ||
|
||
!0 = !{!1, !1, i64 0} | ||
!1 = !{!"omnipotent char", !2, i64 0} | ||
!2 = !{!"Simple C++ TBAA"} | ||
!3 = !{i64 129} | ||
!4 = !{!5, !5, i64 0} | ||
!5 = !{!"float", !1, i64 0} |
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.
Is this needed for the test to work?