CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
73 lines
3.2 KiB
LLVM
73 lines
3.2 KiB
LLVM
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
|
|
; RUN: opt < %s -passes=loop-rotate -S | FileCheck %s
|
|
|
|
; LoopRotate restructures a loop so the exit test appears at the end of the
|
|
; loop body rather than the beginning. This test ensures the pass does not
|
|
; rotate a loop whose header contains a convergence.loop token that guards a
|
|
; convergent operation. Rotating the header would place the exit test before
|
|
; the convergence token, which breaks the convergence contract and enables
|
|
; later passes to collapse the loop into straight-line code.
|
|
;
|
|
; This is one of three sibling tests (LoopRotate, IndVarSimplify,
|
|
; SimpleLoopUnswitch) that each guard against a pass moving or removing the
|
|
; exit condition of a loop with a convergent operation, which can change the
|
|
; set of active threads inside the loop. See https://godbolt.org/z/K1a8xW1TE
|
|
; for the problematic pass pipeline and
|
|
; https://github.com/llvm/llvm-project/issues/180621 for full context.
|
|
|
|
define void @convergent_loop(i32 %tid, ptr %array) #0 {
|
|
; CHECK-LABEL: @convergent_loop(
|
|
; CHECK-NEXT: entry:
|
|
; CHECK-NEXT: [[TOK_ENTRY:%.*]] = call token @llvm.experimental.convergence.entry()
|
|
; CHECK-NEXT: br label [[FOR_COND:%.*]]
|
|
; CHECK: for.cond:
|
|
; CHECK-NEXT: [[I:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[INC:%.*]], [[FOR_BODY:%.*]] ]
|
|
; CHECK-NEXT: [[TOK_LOOP:%.*]] = call token @llvm.experimental.convergence.loop() [ "convergencectrl"(token [[TOK_ENTRY]]) ]
|
|
; CHECK-NEXT: [[CMP:%.*]] = icmp ult i32 [[I]], 8
|
|
; CHECK-NEXT: br i1 [[CMP]], label [[FOR_BODY]], label [[FOR_END_LOOPEXIT:%.*]]
|
|
; CHECK: for.body:
|
|
; CHECK-NEXT: [[CMP1:%.*]] = icmp eq i32 [[I]], [[TID:%.*]]
|
|
; CHECK-NEXT: [[INC]] = add nuw i32 [[I]], 1
|
|
; CHECK-NEXT: br i1 [[CMP1]], label [[IF_THEN:%.*]], label [[FOR_COND]]
|
|
; CHECK: if.then:
|
|
; CHECK-NEXT: [[WAVE:%.*]] = call i32 @llvm.dx.wave.reduce.umax.i32(i32 [[TID]]) [ "convergencectrl"(token [[TOK_LOOP]]) ]
|
|
; CHECK-NEXT: [[GEP:%.*]] = getelementptr inbounds i32, ptr [[ARRAY:%.*]], i32 [[TID]]
|
|
; CHECK-NEXT: store i32 [[WAVE]], ptr [[GEP]], align 4
|
|
; CHECK-NEXT: br label [[FOR_END:%.*]]
|
|
; CHECK: for.end.loopexit:
|
|
; CHECK-NEXT: br label [[FOR_END]]
|
|
; CHECK: for.end:
|
|
; CHECK-NEXT: ret void
|
|
;
|
|
entry:
|
|
%tok.entry = call token @llvm.experimental.convergence.entry()
|
|
br label %for.cond
|
|
|
|
for.cond:
|
|
%i = phi i32 [ 0, %entry ], [ %inc, %for.body ]
|
|
%tok.loop = call token @llvm.experimental.convergence.loop() [ "convergencectrl"(token %tok.entry) ]
|
|
%cmp = icmp ult i32 %i, 8
|
|
br i1 %cmp, label %for.body, label %for.end
|
|
|
|
for.body:
|
|
%cmp1 = icmp eq i32 %i, %tid
|
|
%inc = add nuw i32 %i, 1
|
|
br i1 %cmp1, label %if.then, label %for.cond
|
|
|
|
if.then:
|
|
%wave = call i32 @llvm.dx.wave.reduce.umax.i32(i32 %tid) [ "convergencectrl"(token %tok.loop) ]
|
|
%gep = getelementptr inbounds i32, ptr %array, i32 %tid
|
|
store i32 %wave, ptr %gep, align 4
|
|
br label %for.end
|
|
|
|
for.end:
|
|
ret void
|
|
}
|
|
|
|
declare token @llvm.experimental.convergence.entry() #1
|
|
declare token @llvm.experimental.convergence.loop() #1
|
|
declare i32 @llvm.dx.wave.reduce.umax.i32(i32) #1
|
|
|
|
attributes #0 = { convergent mustprogress nounwind "no-trapping-math"="true" }
|
|
attributes #1 = { convergent }
|