[flang][cuda] cuf.alloc in device context should be converted to fir.alloc (#116110)
Update `inDeviceContext` to account for the gpu.func operation.
This commit is contained in:
parent
fd2e4004cd
commit
ec066d30e2
@ -251,6 +251,8 @@ struct CUFDeallocateOpConversion
|
||||
static bool inDeviceContext(mlir::Operation *op) {
|
||||
if (op->getParentOfType<cuf::KernelOp>())
|
||||
return true;
|
||||
if (auto funcOp = op->getParentOfType<mlir::gpu::GPUFuncOp>())
|
||||
return true;
|
||||
if (auto funcOp = op->getParentOfType<mlir::func::FuncOp>()) {
|
||||
if (auto cudaProcAttr =
|
||||
funcOp.getOperation()->getAttrOfType<cuf::ProcAttributeAttr>(
|
||||
|
@ -73,4 +73,14 @@ func.func @_QPtest_type() {
|
||||
// CHECK: %[[CONV_BYTES:.*]] = fir.convert %[[BYTES]] : (index) -> i64
|
||||
// CHECK: fir.call @_FortranACUFMemAlloc(%[[CONV_BYTES]], %c0{{.*}}, %{{.*}}, %{{.*}}) : (i64, i32, !fir.ref<i8>, i32) -> !fir.llvm_ptr<i8>
|
||||
|
||||
gpu.module @cuda_device_mod [#nvvm.target] {
|
||||
gpu.func @_QMalloc() kernel {
|
||||
%0 = cuf.alloc !fir.box<!fir.heap<!fir.array<?xf32>>> {bindc_name = "a", data_attr = #cuf.cuda<device>, uniq_name = "_QMallocEa"} -> !fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>>
|
||||
gpu.return
|
||||
}
|
||||
}
|
||||
|
||||
// CHECK-LABEL: gpu.func @_QMalloc() kernel
|
||||
// CHECK: fir.alloca !fir.box<!fir.heap<!fir.array<?xf32>>> {bindc_name = "a", uniq_name = "_QMallocEa"}
|
||||
|
||||
} // end module
|
||||
|
Loading…
x
Reference in New Issue
Block a user