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
101 lines
3.6 KiB
MLIR
101 lines
3.6 KiB
MLIR
// RUN: mlir-opt -allow-unregistered-dialect -gpu-launch-sink-index-computations -split-input-file -verify-diagnostics %s | FileCheck %s
|
|
|
|
|
|
// CHECK-LABEL: @extra_constants
|
|
// CHECK-SAME: %[[ARG0:.*]]: memref<?xf32>
|
|
func.func @extra_constants(%arg0: memref<?xf32>) {
|
|
%cst = arith.constant 8 : index
|
|
%cst2 = arith.constant 2 : index
|
|
%c0 = arith.constant 0 : index
|
|
%cst3 = memref.dim %arg0, %c0 : memref<?xf32>
|
|
// CHECK: gpu.launch blocks
|
|
gpu.launch blocks(%bx, %by, %bz) in (%grid_x = %cst, %grid_y = %cst,
|
|
%grid_z = %cst)
|
|
threads(%tx, %ty, %tz) in (%block_x = %cst, %block_y = %cst,
|
|
%block_z = %cst) {
|
|
// CHECK-NOT: arith.constant 8
|
|
// CHECK: %[[CST2:.*]] = arith.constant 2
|
|
// CHECK-NEXT: %[[CST0:.*]] = arith.constant 0
|
|
// CHECK-NEXT: %[[DIM:.*]] = memref.dim %[[ARG0]], %[[CST0]]
|
|
// CHECK-NEXT: "use"(%[[CST2]], %[[ARG0]], %[[DIM]]) : (index, memref<?xf32>, index) -> ()
|
|
// CHECK-NEXT: gpu.terminator
|
|
"use"(%cst2, %arg0, %cst3) : (index, memref<?xf32>, index) -> ()
|
|
gpu.terminator
|
|
}
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
// CHECK-LABEL: @extra_constants_not_inlined
|
|
// CHECK-SAME: %[[ARG0:.*]]: memref<?xf32>
|
|
func.func @extra_constants_not_inlined(%arg0: memref<?xf32>) {
|
|
%cst = arith.constant 8 : index
|
|
%cst2 = arith.constant 2 : index
|
|
%c0 = arith.constant 0 : index
|
|
// CHECK: %[[CST_X:.*]] = "secret_constant"()
|
|
%cst3 = "secret_constant"() : () -> index
|
|
// CHECK: gpu.launch blocks
|
|
gpu.launch blocks(%bx, %by, %bz) in (%grid_x = %cst, %grid_y = %cst,
|
|
%grid_z = %cst)
|
|
threads(%tx, %ty, %tz) in (%block_x = %cst, %block_y = %cst,
|
|
%block_z = %cst) {
|
|
// CHECK-NOT: arith.constant 8
|
|
// CHECK-NOT: "secret_constant"()
|
|
// CHECK: %[[CST2:.*]] = arith.constant 2
|
|
// CHECK-NEXT: "use"(%[[CST2]], %[[ARG0]], %[[CST_X]]) : (index, memref<?xf32>, index) -> ()
|
|
// CHECK-NEXT: gpu.terminator
|
|
"use"(%cst2, %arg0, %cst3) : (index, memref<?xf32>, index) -> ()
|
|
gpu.terminator
|
|
}
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
// CHECK-LABEL: @multiple_uses
|
|
func.func @multiple_uses(%arg0 : memref<?xf32>) {
|
|
%c1 = arith.constant 1 : index
|
|
%c2 = arith.constant 2 : index
|
|
// CHECK: gpu.launch blocks
|
|
gpu.launch blocks(%bx, %by, %bz) in (%grid_x = %c1, %grid_y = %c1,
|
|
%grid_z = %c1)
|
|
threads(%tx, %ty, %tz) in (%block_x = %c1, %block_y = %c1,
|
|
%block_z = %c1) {
|
|
// CHECK: %[[C2:.*]] = arith.constant 2
|
|
// CHECK-NEXT: "use1"(%[[C2]], %[[C2]])
|
|
// CHECK-NEXT: "use2"(%[[C2]])
|
|
// CHECK-NEXT: gpu.terminator
|
|
"use1"(%c2, %c2) : (index, index) -> ()
|
|
"use2"(%c2) : (index) -> ()
|
|
gpu.terminator
|
|
}
|
|
return
|
|
}
|
|
|
|
// -----
|
|
|
|
// CHECK-LABEL: @multiple_uses2
|
|
func.func @multiple_uses2(%arg0 : memref<*xf32>) {
|
|
%c1 = arith.constant 1 : index
|
|
%c2 = arith.constant 2 : index
|
|
%d = memref.dim %arg0, %c2 : memref<*xf32>
|
|
// CHECK: gpu.launch blocks
|
|
gpu.launch blocks(%bx, %by, %bz) in (%grid_x = %c1, %grid_y = %c1,
|
|
%grid_z = %c1)
|
|
threads(%tx, %ty, %tz) in (%block_x = %c1, %block_y = %c1,
|
|
%block_z = %c1) {
|
|
// CHECK: %[[C2:.*]] = arith.constant 2 : index
|
|
// CHECK: %[[D:.*]] = memref.dim %[[ARG:.*]], %[[C2]]
|
|
// CHECK: "use1"(%[[D]])
|
|
// CHECK: "use2"(%[[C2]], %[[C2]])
|
|
// CHECK: "use3"(%[[ARG]])
|
|
// CHECK: gpu.terminator
|
|
"use1"(%d) : (index) -> ()
|
|
"use2"(%c2, %c2) : (index, index) -> ()
|
|
"use3"(%arg0) : (memref<*xf32>) -> ()
|
|
gpu.terminator
|
|
}
|
|
return
|
|
}
|