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
125 lines
6.6 KiB
MLIR
125 lines
6.6 KiB
MLIR
// RUN: mlir-opt -split-input-file -amdgpu-emulate-atomics=chipset=gfx90a %s | FileCheck %s --check-prefixes=CHECK,GFX90A
|
|
// RUN: mlir-opt -split-input-file -amdgpu-emulate-atomics=chipset=gfx1030 %s | FileCheck %s --check-prefixes=CHECK,GFX10
|
|
// RUN: mlir-opt -split-input-file -amdgpu-emulate-atomics=chipset=gfx1100 %s | FileCheck %s --check-prefixes=CHECK,GFX11
|
|
// RUN: mlir-opt -split-input-file -amdgpu-emulate-atomics=chipset=gfx1200 %s | FileCheck %s --check-prefixes=CHECK,GFX12
|
|
// RUN: mlir-opt -split-input-file -amdgpu-emulate-atomics=chipset=gfx942 %s | FileCheck %s --check-prefixes=CHECK,GFX942
|
|
// RUN: mlir-opt -split-input-file -amdgpu-emulate-atomics=chipset=gfx950 %s | FileCheck %s --check-prefixes=CHECK,GFX950
|
|
|
|
// -----
|
|
|
|
func.func @atomic_fmax(%val: f32, %buffer: memref<?xf32>, %idx: i32) -> f32 {
|
|
// CHECK: func @atomic_fmax
|
|
// CHECK-SAME: ([[val:%.+]]: f32, [[buffer:%.+]]: memref<?xf32>, [[idx:%.+]]: i32)
|
|
// CHECK: gpu.printf "Begin\0A"
|
|
// GFX10: amdgpu.raw_buffer_atomic_fmax {foo, indexOffset = 4 : i32} [[val]] -> [[buffer]][[[idx]]]
|
|
// GFX11: amdgpu.raw_buffer_atomic_fmax {foo, indexOffset = 4 : i32} [[val]] -> [[buffer]][[[idx]]]
|
|
// GFX12: amdgpu.raw_buffer_atomic_fmax {foo, indexOffset = 4 : i32} [[val]] -> [[buffer]][[[idx]]]
|
|
// GFX90A: [[ld:%.+]] = amdgpu.raw_buffer_load {foo, indexOffset = 4 : i32} [[buffer]][[[idx]]]
|
|
// GFX90A: cf.br [[loop:\^.+]]([[ld]] : f32)
|
|
// GFX90A: [[loop]]([[arg:%.+]]: f32):
|
|
// GFX90A: [[operated:%.+]] = arith.maximumf [[val]], [[arg]]
|
|
// GFX90A: [[atomicRes:%.+]] = amdgpu.raw_buffer_atomic_cmpswap {foo, indexOffset = 4 : i32} [[operated]], [[arg]] -> [[buffer]][[[idx]]]
|
|
// GFX90A: [[argCast:%.+]] = arith.bitcast [[arg]] : f32 to i32
|
|
// GFX90A: [[resCast:%.+]] = arith.bitcast [[atomicRes]] : f32 to i32
|
|
// GFX90A: [[test:%.+]] = arith.cmpi eq, [[resCast]], [[argCast]]
|
|
// GFX90A: cf.cond_br [[test]], [[post:\^.+]]([[arg]] : f32), [[loop]]([[atomicRes]] : f32)
|
|
// GFX90A: [[post]]([[old:%.+]]: f32):
|
|
// GFX942: [[ld:%.+]] = amdgpu.raw_buffer_load {foo, indexOffset = 4 : i32} [[buffer]][[[idx]]]
|
|
// GFX942: cf.br [[loop:\^.+]]([[ld]] : f32)
|
|
// GFX942: [[loop]]([[arg:%.+]]: f32):
|
|
// GFX942: [[operated:%.+]] = arith.maximumf [[val]], [[arg]]
|
|
// GFX942: [[atomicRes:%.+]] = amdgpu.raw_buffer_atomic_cmpswap {foo, indexOffset = 4 : i32} [[operated]], [[arg]] -> [[buffer]][[[idx]]]
|
|
// GFX942: [[argCast:%.+]] = arith.bitcast [[arg]] : f32 to i32
|
|
// GFX942: [[resCast:%.+]] = arith.bitcast [[atomicRes]] : f32 to i32
|
|
// GFX942: [[test:%.+]] = arith.cmpi eq, [[resCast]], [[argCast]]
|
|
// GFX942: cf.cond_br [[test]], [[post:\^.+]]([[arg]] : f32), [[loop]]([[atomicRes]] : f32)
|
|
// GFX942: [[post]]([[old:%.+]]: f32):
|
|
// GFX950: [[ld:%.+]] = amdgpu.raw_buffer_load {foo, indexOffset = 4 : i32} [[buffer]][[[idx]]]
|
|
// GFX950: cf.br [[loop:\^.+]]([[ld]] : f32)
|
|
// GFX950: [[loop]]([[arg:%.+]]: f32):
|
|
// GFX950: [[operated:%.+]] = arith.maximumf [[val]], [[arg]]
|
|
// GFX950: [[atomicRes:%.+]] = amdgpu.raw_buffer_atomic_cmpswap {foo, indexOffset = 4 : i32} [[operated]], [[arg]] -> [[buffer]][[[idx]]]
|
|
// GFX950: [[argCast:%.+]] = arith.bitcast [[arg]] : f32 to i32
|
|
// GFX950: [[resCast:%.+]] = arith.bitcast [[atomicRes]] : f32 to i32
|
|
// GFX950: [[test:%.+]] = arith.cmpi eq, [[resCast]], [[argCast]]
|
|
// GFX950: cf.cond_br [[test]], [[post:\^.+]]([[arg]] : f32), [[loop]]([[atomicRes]] : f32)
|
|
// GFX950: [[post]]([[old:%.+]]: f32):
|
|
// CHECK-NEXT: gpu.printf "End\0A"
|
|
// CHECK-NEXT: return
|
|
gpu.printf "Begin\n"
|
|
%old = amdgpu.raw_buffer_atomic_fmax {foo, indexOffset = 4 : i32} %val -> %buffer[%idx] : f32 -> memref<?xf32>, i32
|
|
gpu.printf "End\n"
|
|
func.return %old : f32
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @atomic_fmax_f64(%val: f64, %buffer: memref<?xf64>, %idx: i32) {
|
|
// CHECK: func @atomic_fmax_f64
|
|
// CHECK-SAME: ([[val:%.+]]: f64, [[buffer:%.+]]: memref<?xf64>, [[idx:%.+]]: i32)
|
|
// CHECK: gpu.printf "Begin\0A"
|
|
// GFX90A: amdgpu.raw_buffer_atomic_fmax [[val]] -> [[buffer]][[[idx]]]
|
|
// GFX10: amdgpu.raw_buffer_atomic_fmax [[val]] -> [[buffer]][[[idx]]]
|
|
// GFX11: amdgpu.raw_buffer_atomic_fmax [[val]] -> [[buffer]][[[idx]]]
|
|
// GFX12: amdgpu.raw_buffer_atomic_fmax [[val]] -> [[buffer]][[[idx]]]
|
|
// GFX942: amdgpu.raw_buffer_atomic_fmax [[val]] -> [[buffer]][[[idx]]]
|
|
// GFX950: amdgpu.raw_buffer_atomic_fmax [[val]] -> [[buffer]][[[idx]]]
|
|
// CHECK-NEXT: gpu.printf "End\0A"
|
|
gpu.printf "Begin\n"
|
|
%old = amdgpu.raw_buffer_atomic_fmax %val -> %buffer[%idx] : f64 -> memref<?xf64>, i32
|
|
gpu.printf "End\n"
|
|
func.return
|
|
}
|
|
|
|
// -----
|
|
|
|
func.func @atomic_fadd(%val: f32, %buffer: memref<?xf32>, %idx: i32) {
|
|
// CHECK: func @atomic_fadd
|
|
// GFX90A: amdgpu.raw_buffer_atomic_fadd
|
|
// GFX10: amdgpu.raw_buffer_load
|
|
// GFX10: amdgpu.raw_buffer_atomic_cmpswap
|
|
// GFX11: amdgpu.raw_buffer_atomic_fadd
|
|
// GFX12: amdgpu.raw_buffer_atomic_fadd
|
|
// GFX942: amdgpu.raw_buffer_atomic_fadd
|
|
// GFX950: amdgpu.raw_buffer_atomic_fadd
|
|
%old = amdgpu.raw_buffer_atomic_fadd %val -> %buffer[%idx] : f32 -> memref<?xf32>, i32
|
|
func.return
|
|
}
|
|
|
|
// CHECK: func @atomic_fadd_v2f16
|
|
func.func @atomic_fadd_v2f16(%val: vector<2xf16>, %buffer: memref<?xf16>, %idx: i32) {
|
|
// GFX90A: amdgpu.raw_buffer_atomic_fadd
|
|
// GFX10: amdgpu.raw_buffer_load
|
|
// GFX10: amdgpu.raw_buffer_atomic_cmpswap
|
|
// Note: the atomic operation itself will be done over i32, and then we use bitcasts
|
|
// to scalars in order to test for exact bitwise equality instead of float
|
|
// equality.
|
|
// GFX11: %[[old:.+]] = amdgpu.raw_buffer_atomic_cmpswap
|
|
// GFX11: %[[vecCastExpected:.+]] = vector.bitcast %{{.*}} : vector<2xf16> to vector<1xi32>
|
|
// GFX11: %[[scalarExpected:.+]] = vector.extract %[[vecCastExpected]][0]
|
|
// GFX11: %[[vecCastOld:.+]] = vector.bitcast %[[old]] : vector<2xf16> to vector<1xi32>
|
|
// GFX11: %[[scalarOld:.+]] = vector.extract %[[vecCastOld]][0]
|
|
// GFX11: arith.cmpi eq, %[[scalarOld]], %[[scalarExpected]]
|
|
// GFX942: amdgpu.raw_buffer_atomic_fadd
|
|
// GFX12: amdgpu.raw_buffer_atomic_fadd
|
|
// GFX950: amdgpu.raw_buffer_atomic_fadd
|
|
%old = amdgpu.raw_buffer_atomic_fadd %val -> %buffer[%idx] : vector<2xf16> -> memref<?xf16>, i32
|
|
func.return
|
|
}
|
|
|
|
// CHECK: func @atomic_fadd_v2bf16
|
|
func.func @atomic_fadd_v2bf16(%val: vector<2xbf16>, %buffer: memref<?xbf16>, %idx: i32) {
|
|
// GFX90A: amdgpu.raw_buffer_load
|
|
// GFX90A: amdgpu.raw_buffer_atomic_cmpswap
|
|
// GFX10: amdgpu.raw_buffer_load
|
|
// GFX10: amdgpu.raw_buffer_atomic_cmpswap
|
|
// GFX11: amdgpu.raw_buffer_load
|
|
// GFX11: amdgpu.raw_buffer_atomic_cmpswap
|
|
// GFX942: amdgpu.raw_buffer_load
|
|
// GFX942: amdgpu.raw_buffer_atomic_cmpswap
|
|
// GFX12: amdgpu.raw_buffer_atomic_fadd
|
|
// GFX950: amdgpu.raw_buffer_atomic_fadd
|
|
%old = amdgpu.raw_buffer_atomic_fadd %val -> %buffer[%idx] : vector<2xbf16> -> memref<?xbf16>, i32
|
|
func.return
|
|
}
|