Skip to content

Commit 1156179

Browse files
committed
Fix tests
1 parent 0885d06 commit 1156179

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

flang/lib/Optimizer/Transforms/CUFGPUToLLVMConversion.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,15 @@ class CUFGPUToLLVMConversion
298298
fir::LLVMTypeConverter typeConverter(module, /*applyTBAA=*/false,
299299
/*forceUnifiedTBAATree=*/false, *dl);
300300
cuf::populateCUFGPUToLLVMConversionPatterns(typeConverter, patterns);
301-
target.addIllegalOp<mlir::gpu::LaunchFuncOp>();
301+
302+
target.addDynamicallyLegalOp<mlir::gpu::LaunchFuncOp>([&](mlir::gpu::LaunchFuncOp op) {
303+
if (op.getOperation()->getAttrOfType<cuf::ProcAttributeAttr>(
304+
cuf::getProcAttrName()))
305+
return false;
306+
return true;
307+
});
308+
309+
302310
target.addIllegalOp<cuf::SharedMemoryOp>();
303311
target.addLegalDialect<mlir::LLVM::LLVMDialect>();
304312
if (mlir::failed(mlir::applyPartialConversion(getOperation(), target,

flang/test/Fir/CUDA/cuda-gpu-launch-func.mlir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ module attributes {dlti.dl_spec = #dlti.dl_spec<#dlti.dl_entry<!llvm.ptr<272>, d
180180
%2 = llvm.mlir.constant(0 : i32) : i32
181181
%3 = llvm.mlir.constant(10 : index) : i64
182182
%token = cuf.stream_cast %stream : !llvm.ptr
183-
gpu.launch_func [%token] @cuda_device_mod::@_QMmod1Psub1 blocks in (%3, %3, %0) threads in (%3, %3, %0) : i64 dynamic_shared_memory_size %2
183+
gpu.launch_func [%token] @cuda_device_mod::@_QMmod1Psub1 blocks in (%3, %3, %0) threads in (%3, %3, %0) : i64 dynamic_shared_memory_size %2 {cuf.proc_attr = #cuf.cuda_proc<global>}
184184
llvm.return
185185
}
186186
gpu.binary @cuda_device_mod [#gpu.object<#nvvm.target, "">]

flang/test/Fir/CUDA/cuda-launch.fir

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -154,10 +154,5 @@ module attributes {gpu.container_module, dlti.dl_spec = #dlti.dl_spec<#dlti.dl_e
154154
// CHECK-LABEL: func.func @_QQmain()
155155
// CHECK: %[[STREAM:.*]] = fir.alloca i64 {bindc_name = "stream", uniq_name = "_QMtest_callFhostEstream"}
156156
// CHECK: %[[DECL_STREAM:.*]]:2 = hlfir.declare %[[STREAM]] {uniq_name = "_QMtest_callFhostEstream"} : (!fir.ref<i64>) -> (!fir.ref<i64>, !fir.ref<i64>)
157-
<<<<<<< HEAD
158157
// CHECK: %[[TOKEN:.*]] = cuf.stream_cast %[[DECL_STREAM]]#0 : !fir.ref<i64>
159158
// CHECK: gpu.launch_func [%[[TOKEN]]] @cuda_device_mod::@_QMdevptrPtest
160-
=======
161-
// CHECK: %[[TOKEN:.*]] = cuf.stream_cast %[[DECL_STREAM]]#0 : <i64>
162-
// CHECK: gpu.launch_func [%[[TOKEN]]] @cuda_device_mod::@_QMdevptrPtest blocks in (%{{.*}}, %{{.*}}, %{{.*}}) threads in (%{{.*}}, %{{.*}}, %{{.*}}) dynamic_shared_memory_size %c0{{.*}} {cuf.proc_attr = #cuf.cuda_proc<grid_global>}
163-
>>>>>>> 9075a18bf3c4 ([flang][cuda] Only convert launch from CUDA Fortran kernels)

0 commit comments

Comments
 (0)