[flang][cuda] Carry over the CUDA attribute in target rewrite (#136811)

This commit is contained in:
Valentin Clement (バレンタイン クレメン)
2025-04-23 08:23:02 -07:00
committed by GitHub
parent 6c56160433
commit f11b3decdd
2 changed files with 7 additions and 2 deletions

View File

@@ -531,6 +531,11 @@ public:
if (callOp.getClusterSizeZ())
newCall.getClusterSizeZMutable().assign(callOp.getClusterSizeZ());
newCallResults.append(newCall.result_begin(), newCall.result_end());
if (auto cudaProcAttr =
callOp->template getAttrOfType<cuf::ProcAttributeAttr>(
cuf::getProcAttrName())) {
newCall->setAttr(cuf::getProcAttrName(), cudaProcAttr);
}
} else if constexpr (std::is_same_v<std::decay_t<A>, fir::CallOp>) {
fir::CallOp newCall;
if (callOp.getCallee()) {

View File

@@ -45,7 +45,7 @@ gpu.module @testmod {
func.func @main(%arg0: complex<f64>) {
%0 = llvm.mlir.constant(0 : i64) : i64
%1 = llvm.mlir.constant(0 : i32) : i32
gpu.launch_func @testmod::@_QPtest blocks in (%0, %0, %0) threads in (%0, %0, %0) : i64 dynamic_shared_memory_size %1 args(%arg0 : complex<f64>)
gpu.launch_func @testmod::@_QPtest blocks in (%0, %0, %0) threads in (%0, %0, %0) : i64 dynamic_shared_memory_size %1 args(%arg0 : complex<f64>) {cuf.proc_attr = #cuf.cuda_proc<global>}
return
}
@@ -54,4 +54,4 @@ func.func @main(%arg0: complex<f64>) {
// CHECK-LABEL: gpu.func @_QPtest
// CHECK-SAME: (%arg0: f64, %arg1: f64) kernel {
// CHECK: gpu.return
// CHECK: gpu.launch_func @testmod::@_QPtest blocks in (%{{.*}}, %{{.*}}, %{{.*}}) threads in (%{{.*}}, %{{.*}}, %{{.*}}) : i64 dynamic_shared_memory_size %{{.*}} args(%{{.*}} : f64, %{{.*}} : f64)
// CHECK: gpu.launch_func @testmod::@_QPtest blocks in (%{{.*}}, %{{.*}}, %{{.*}}) threads in (%{{.*}}, %{{.*}}, %{{.*}}) : i64 dynamic_shared_memory_size %{{.*}} args(%{{.*}} : f64, %{{.*}} : f64) {cuf.proc_attr = #cuf.cuda_proc<global>}