[llvm-branch-commits] [flang] [llvm] [mlir] [Flang][OpenMP][MLIR] Initial declare target to for variables implementation (PR #119589)
Akash Banerjee via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Wed Sep 24 07:59:57 PDT 2025
================
@@ -0,0 +1,35 @@
+// RUN: mlir-translate -mlir-to-llvmir %s | FileCheck %s
+
+// This tests the replacement of operations for `declare target to` with the
+// generated `declare target to` global variable inside of target op regions when
+// lowering to IR for device. Unfortunately, as the host file is not passed as a
+// module attribute, we miss out on the metadata and entry info.
+
+module attributes {llvm.target_triple = "amdgcn-amd-amdhsa", omp.is_gpu = true, omp.is_target_device = true} {
+ // CHECK-DAG: @_QMtest_0Ezii = global [11 x float] zeroinitializer
+ llvm.mlir.global external @_QMtest_0Ezii() {addr_space = 0 : i32, omp.declare_target = #omp.declaretarget<device_type = (any), capture_clause = (to)>} : !llvm.array<11 x f32> {
+ %0 = llvm.mlir.zero : !llvm.array<11 x f32>
+ llvm.return %0 : !llvm.array<11 x f32>
+ }
+
+ // CHECK-DAG: define weak_odr protected amdgpu_kernel void @{{.*}}(ptr %{{.*}}) {{.*}} {
----------------
TIFitis wrote:
Nit: Should this be a `CHECK-LABEL` followed by `CHECK-DAGs`?
https://github.com/llvm/llvm-project/pull/119589
More information about the llvm-branch-commits
mailing list