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
91 lines
4.4 KiB
LLVM
91 lines
4.4 KiB
LLVM
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 6
|
|
; RUN: opt < %s -S -mtriple=nvptx-nvidia-cuda -mcpu=sm_20 -passes=nvvm-intr-range | FileCheck %s
|
|
|
|
; When .reqntid specifies 3D dimensions, ntid.x/y/z should be replaced with
|
|
; constants and tid.x/y/z should get per-dimension ranges.
|
|
; Product 128*4*2 = 1024 is within the hardware limit.
|
|
define ptx_kernel i32 @test_reqntid_3d() "nvvm.reqntid"="128,4,2" {
|
|
; CHECK-LABEL: define ptx_kernel i32 @test_reqntid_3d(
|
|
; CHECK-SAME: ) #[[ATTR0:[0-9]+]] {
|
|
; CHECK-NEXT: [[TID_X:%.*]] = call range(i32 0, 128) i32 @llvm.nvvm.read.ptx.sreg.tid.x()
|
|
; CHECK-NEXT: [[TID_Y:%.*]] = call range(i32 0, 4) i32 @llvm.nvvm.read.ptx.sreg.tid.y()
|
|
; CHECK-NEXT: [[TID_Z:%.*]] = call range(i32 0, 2) i32 @llvm.nvvm.read.ptx.sreg.tid.z()
|
|
; CHECK-NEXT: [[NTID_X:%.*]] = call range(i32 128, 129) i32 @llvm.nvvm.read.ptx.sreg.ntid.x()
|
|
; CHECK-NEXT: [[NTID_Y:%.*]] = call range(i32 4, 5) i32 @llvm.nvvm.read.ptx.sreg.ntid.y()
|
|
; CHECK-NEXT: [[NTID_Z:%.*]] = call range(i32 2, 3) i32 @llvm.nvvm.read.ptx.sreg.ntid.z()
|
|
; CHECK-NEXT: [[A:%.*]] = add i32 [[TID_X]], [[TID_Y]]
|
|
; CHECK-NEXT: [[B:%.*]] = add i32 [[A]], [[TID_Z]]
|
|
; CHECK-NEXT: [[C:%.*]] = add i32 [[B]], [[NTID_X]]
|
|
; CHECK-NEXT: [[D:%.*]] = add i32 [[C]], [[NTID_Y]]
|
|
; CHECK-NEXT: [[E:%.*]] = add i32 [[D]], [[NTID_Z]]
|
|
; CHECK-NEXT: ret i32 [[E]]
|
|
;
|
|
%tid.x = call i32 @llvm.nvvm.read.ptx.sreg.tid.x()
|
|
%tid.y = call i32 @llvm.nvvm.read.ptx.sreg.tid.y()
|
|
%tid.z = call i32 @llvm.nvvm.read.ptx.sreg.tid.z()
|
|
%ntid.x = call i32 @llvm.nvvm.read.ptx.sreg.ntid.x()
|
|
%ntid.y = call i32 @llvm.nvvm.read.ptx.sreg.ntid.y()
|
|
%ntid.z = call i32 @llvm.nvvm.read.ptx.sreg.ntid.z()
|
|
%a = add i32 %tid.x, %tid.y
|
|
%b = add i32 %a, %tid.z
|
|
%c = add i32 %b, %ntid.x
|
|
%d = add i32 %c, %ntid.y
|
|
%e = add i32 %d, %ntid.z
|
|
ret i32 %e
|
|
}
|
|
|
|
; When .reqntid specifies only 1D, y and z default to 1.
|
|
define ptx_kernel i32 @test_reqntid_1d() "nvvm.reqntid"="128" {
|
|
; CHECK-LABEL: define ptx_kernel i32 @test_reqntid_1d(
|
|
; CHECK-SAME: ) #[[ATTR1:[0-9]+]] {
|
|
; CHECK-NEXT: [[TID_X:%.*]] = call range(i32 0, 128) i32 @llvm.nvvm.read.ptx.sreg.tid.x()
|
|
; CHECK-NEXT: [[TID_Y:%.*]] = call range(i32 0, 1) i32 @llvm.nvvm.read.ptx.sreg.tid.y()
|
|
; CHECK-NEXT: [[TID_Z:%.*]] = call range(i32 0, 1) i32 @llvm.nvvm.read.ptx.sreg.tid.z()
|
|
; CHECK-NEXT: [[NTID_X:%.*]] = call range(i32 128, 129) i32 @llvm.nvvm.read.ptx.sreg.ntid.x()
|
|
; CHECK-NEXT: [[NTID_Y:%.*]] = call range(i32 1, 2) i32 @llvm.nvvm.read.ptx.sreg.ntid.y()
|
|
; CHECK-NEXT: [[NTID_Z:%.*]] = call range(i32 1, 2) i32 @llvm.nvvm.read.ptx.sreg.ntid.z()
|
|
; CHECK-NEXT: [[A:%.*]] = add i32 [[TID_X]], [[TID_Y]]
|
|
; CHECK-NEXT: [[B:%.*]] = add i32 [[A]], [[TID_Z]]
|
|
; CHECK-NEXT: [[C:%.*]] = add i32 [[B]], [[NTID_X]]
|
|
; CHECK-NEXT: [[D:%.*]] = add i32 [[C]], [[NTID_Y]]
|
|
; CHECK-NEXT: [[E:%.*]] = add i32 [[D]], [[NTID_Z]]
|
|
; CHECK-NEXT: ret i32 [[E]]
|
|
;
|
|
%tid.x = call i32 @llvm.nvvm.read.ptx.sreg.tid.x()
|
|
%tid.y = call i32 @llvm.nvvm.read.ptx.sreg.tid.y()
|
|
%tid.z = call i32 @llvm.nvvm.read.ptx.sreg.tid.z()
|
|
%ntid.x = call i32 @llvm.nvvm.read.ptx.sreg.ntid.x()
|
|
%ntid.y = call i32 @llvm.nvvm.read.ptx.sreg.ntid.y()
|
|
%ntid.z = call i32 @llvm.nvvm.read.ptx.sreg.ntid.z()
|
|
%a = add i32 %tid.x, %tid.y
|
|
%b = add i32 %a, %tid.z
|
|
%c = add i32 %b, %ntid.x
|
|
%d = add i32 %c, %ntid.y
|
|
%e = add i32 %d, %ntid.z
|
|
ret i32 %e
|
|
}
|
|
|
|
; When .reqntid exceeds hardware limits, garbage-in/garbage-out: the range
|
|
; intersection with intrinsic builtin ranges may produce empty or unexpected
|
|
; ranges.
|
|
define ptx_kernel i32 @test_reqntid_invalid() "nvvm.reqntid"="2048" {
|
|
; CHECK-LABEL: define ptx_kernel i32 @test_reqntid_invalid(
|
|
; CHECK-SAME: ) #[[ATTR2:[0-9]+]] {
|
|
; CHECK-NEXT: [[TID_X:%.*]] = call range(i32 0, 1024) i32 @llvm.nvvm.read.ptx.sreg.tid.x()
|
|
; CHECK-NEXT: [[NTID_X:%.*]] = call range(i32 0, 0) i32 @llvm.nvvm.read.ptx.sreg.ntid.x()
|
|
; CHECK-NEXT: [[A:%.*]] = add i32 [[TID_X]], [[NTID_X]]
|
|
; CHECK-NEXT: ret i32 [[A]]
|
|
;
|
|
%tid.x = call i32 @llvm.nvvm.read.ptx.sreg.tid.x()
|
|
%ntid.x = call i32 @llvm.nvvm.read.ptx.sreg.ntid.x()
|
|
%a = add i32 %tid.x, %ntid.x
|
|
ret i32 %a
|
|
}
|
|
|
|
declare i32 @llvm.nvvm.read.ptx.sreg.tid.x()
|
|
declare i32 @llvm.nvvm.read.ptx.sreg.tid.y()
|
|
declare i32 @llvm.nvvm.read.ptx.sreg.tid.z()
|
|
declare i32 @llvm.nvvm.read.ptx.sreg.ntid.x()
|
|
declare i32 @llvm.nvvm.read.ptx.sreg.ntid.y()
|
|
declare i32 @llvm.nvvm.read.ptx.sreg.ntid.z()
|