[flang][cuda][NFC] Fix typo in CUFAllocDescriptor (#120797)
Missing `r` in the function name.
This commit is contained in:
parent
81831ef3e7
commit
e650ac1654
@ -18,7 +18,7 @@ namespace Fortran::runtime::cuda {
|
||||
extern "C" {
|
||||
|
||||
/// Allocate a descriptor in managed.
|
||||
Descriptor *RTDECL(CUFAllocDesciptor)(
|
||||
Descriptor *RTDECL(CUFAllocDescriptor)(
|
||||
std::size_t, const char *sourceFile = nullptr, int sourceLine = 0);
|
||||
|
||||
/// Deallocate a descriptor allocated in managed or unified memory.
|
||||
|
@ -1210,12 +1210,12 @@ genCUFAllocDescriptor(mlir::Location loc,
|
||||
llvmPointerType, {llvmIntPtrType, llvmPointerType, llvmInt32Type});
|
||||
|
||||
auto llvmFunc = mod.lookupSymbol<mlir::LLVM::LLVMFuncOp>(
|
||||
RTNAME_STRING(CUFAllocDesciptor));
|
||||
RTNAME_STRING(CUFAllocDescriptor));
|
||||
auto funcFunc =
|
||||
mod.lookupSymbol<mlir::func::FuncOp>(RTNAME_STRING(CUFAllocDesciptor));
|
||||
mod.lookupSymbol<mlir::func::FuncOp>(RTNAME_STRING(CUFAllocDescriptor));
|
||||
if (!llvmFunc && !funcFunc)
|
||||
mlir::OpBuilder::atBlockEnd(mod.getBody())
|
||||
.create<mlir::LLVM::LLVMFuncOp>(loc, RTNAME_STRING(CUFAllocDesciptor),
|
||||
.create<mlir::LLVM::LLVMFuncOp>(loc, RTNAME_STRING(CUFAllocDescriptor),
|
||||
fctTy);
|
||||
|
||||
mlir::Type structTy = typeConverter.convertBoxTypeAsStruct(boxTy);
|
||||
@ -1224,7 +1224,7 @@ genCUFAllocDescriptor(mlir::Location loc,
|
||||
genConstantIndex(loc, llvmIntPtrType, rewriter, boxSize);
|
||||
llvm::SmallVector args = {sizeInBytes, sourceFile, sourceLine};
|
||||
return rewriter
|
||||
.create<mlir::LLVM::CallOp>(loc, fctTy, RTNAME_STRING(CUFAllocDesciptor),
|
||||
.create<mlir::LLVM::CallOp>(loc, fctTy, RTNAME_STRING(CUFAllocDescriptor),
|
||||
args)
|
||||
.getResult();
|
||||
}
|
||||
@ -1735,7 +1735,7 @@ static bool isDeviceAllocation(mlir::Value val) {
|
||||
(callOp.getCallee().value().getRootReference().getValue().starts_with(
|
||||
RTNAME_STRING(CUFMemAlloc)) ||
|
||||
callOp.getCallee().value().getRootReference().getValue().starts_with(
|
||||
RTNAME_STRING(CUFAllocDesciptor))))
|
||||
RTNAME_STRING(CUFAllocDescriptor))))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
@ -3127,7 +3127,7 @@ struct LoadOpConversion : public fir::FIROpConversion<fir::LoadOp> {
|
||||
inputBoxStorage.getDefiningOp())) {
|
||||
if (callOp.getCallee() &&
|
||||
(*callOp.getCallee())
|
||||
.starts_with(RTNAME_STRING(CUFAllocDesciptor))) {
|
||||
.starts_with(RTNAME_STRING(CUFAllocDescriptor))) {
|
||||
// CUDA Fortran local descriptor are allocated in managed memory. So
|
||||
// new storage must be allocated the same way.
|
||||
auto mod = load->getParentOfType<mlir::ModuleOp>();
|
||||
|
@ -342,7 +342,7 @@ struct CUFAllocOpConversion : public mlir::OpRewritePattern<cuf::AllocOp> {
|
||||
// Convert descriptor allocations to function call.
|
||||
auto boxTy = mlir::dyn_cast_or_null<fir::BaseBoxType>(op.getInType());
|
||||
mlir::func::FuncOp func =
|
||||
fir::runtime::getRuntimeFunc<mkRTKey(CUFAllocDesciptor)>(loc, builder);
|
||||
fir::runtime::getRuntimeFunc<mkRTKey(CUFAllocDescriptor)>(loc, builder);
|
||||
auto fTy = func.getFunctionType();
|
||||
mlir::Value sourceLine =
|
||||
fir::factory::locationToLineNo(builder, loc, fTy.getInput(2));
|
||||
|
@ -18,7 +18,7 @@ namespace Fortran::runtime::cuda {
|
||||
extern "C" {
|
||||
RT_EXT_API_GROUP_BEGIN
|
||||
|
||||
Descriptor *RTDEF(CUFAllocDesciptor)(
|
||||
Descriptor *RTDEF(CUFAllocDescriptor)(
|
||||
std::size_t sizeInBytes, const char *sourceFile, int sourceLine) {
|
||||
return reinterpret_cast<Descriptor *>(CUFAllocManaged(sizeInBytes));
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ func.func @_QPsub1() {
|
||||
}
|
||||
|
||||
// CHECK-LABEL: func.func @_QPsub1()
|
||||
// CHECK: %[[DESC_RT_CALL:.*]] = fir.call @_FortranACUFAllocDesciptor(%{{.*}}, %{{.*}}, %{{.*}}) : (i64, !fir.ref<i8>, i32) -> !fir.ref<!fir.box<none>>
|
||||
// CHECK: %[[DESC_RT_CALL:.*]] = fir.call @_FortranACUFAllocDescriptor(%{{.*}}, %{{.*}}, %{{.*}}) : (i64, !fir.ref<i8>, i32) -> !fir.ref<!fir.box<none>>
|
||||
// CHECK: %[[DESC:.*]] = fir.convert %[[DESC_RT_CALL]] : (!fir.ref<!fir.box<none>>) -> !fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>>
|
||||
// CHECK: %[[DECL_DESC:.*]]:2 = hlfir.declare %[[DESC]] {data_attr = #cuf.cuda<device>, fortran_attrs = #fir.var_attrs<allocatable>, uniq_name = "_QFsub1Ea"} : (!fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>>) -> (!fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>>, !fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>>)
|
||||
// CHECK: %[[BOX_NONE:.*]] = fir.convert %[[DECL_DESC]]#1 : (!fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>>) -> !fir.ref<!fir.box<none>>
|
||||
|
@ -8,7 +8,7 @@ module attributes {dlti.dl_spec = #dlti.dl_spec<#dlti.dl_entry<f80, dense<128> :
|
||||
%c48 = arith.constant 48 : index
|
||||
%1 = fir.convert %c48 : (index) -> i64
|
||||
%2 = fir.convert %0 : (!fir.ref<!fir.char<1,8>>) -> !fir.ref<i8>
|
||||
%3 = fir.call @_FortranACUFAllocDesciptor(%1, %2, %c4_i32) : (i64, !fir.ref<i8>, i32) -> !fir.ref<!fir.box<none>>
|
||||
%3 = fir.call @_FortranACUFAllocDescriptor(%1, %2, %c4_i32) : (i64, !fir.ref<i8>, i32) -> !fir.ref<!fir.box<none>>
|
||||
%4 = fir.convert %3 : (!fir.ref<!fir.box<none>>) -> !fir.ref<!fir.box<!fir.heap<!fir.array<?xi32>>>>
|
||||
%5 = fir.zero_bits !fir.heap<!fir.array<?xi32>>
|
||||
%6 = fircg.ext_embox %5(%c0) {allocator_idx = 2 : i32} : (!fir.heap<!fir.array<?xi32>>, index) -> !fir.box<!fir.heap<!fir.array<?xi32>>>
|
||||
@ -18,13 +18,13 @@ module attributes {dlti.dl_spec = #dlti.dl_spec<#dlti.dl_entry<f80, dense<128> :
|
||||
}
|
||||
|
||||
// CHECK-LABEL: llvm.func @_QQmain()
|
||||
// CHECK-COUNT-2: llvm.call @_FortranACUFAllocDesciptor
|
||||
// CHECK-COUNT-2: llvm.call @_FortranACUFAllocDescriptor
|
||||
|
||||
fir.global linkonce @_QQclX3C737464696E3E00 constant : !fir.char<1,8> {
|
||||
%0 = fir.string_lit "<stdin>\00"(8) : !fir.char<1,8>
|
||||
fir.has_value %0 : !fir.char<1,8>
|
||||
}
|
||||
func.func private @_FortranACUFAllocDesciptor(i64, !fir.ref<i8>, i32) -> !fir.ref<!fir.box<none>> attributes {fir.runtime}
|
||||
func.func private @_FortranACUFAllocDescriptor(i64, !fir.ref<i8>, i32) -> !fir.ref<!fir.box<none>> attributes {fir.runtime}
|
||||
}
|
||||
|
||||
// -----
|
||||
@ -55,7 +55,7 @@ module attributes {dlti.dl_spec = #dlti.dl_spec<f80 = dense<128> : vector<2xi64>
|
||||
|
||||
// CHECK-LABEL: llvm.func @_QQmain()
|
||||
// CHECK: llvm.call @_FortranACUFMemAlloc
|
||||
// CHECK: llvm.call @_FortranACUFAllocDesciptor
|
||||
// CHECK: llvm.call @_FortranACUFAllocDescriptor
|
||||
|
||||
// -----
|
||||
|
||||
@ -73,7 +73,7 @@ module attributes {dlti.dl_spec = #dlti.dl_spec<f80 = dense<128> : vector<2xi64>
|
||||
%c72 = arith.constant 72 : index
|
||||
%3 = fir.convert %c72 : (index) -> i64
|
||||
%4 = fir.convert %2 : (!fir.ref<!fir.char<1,11>>) -> !fir.ref<i8>
|
||||
%5 = fir.call @_FortranACUFAllocDesciptor(%3, %4, %c14_i32) : (i64, !fir.ref<i8>, i32) -> !fir.ref<!fir.box<none>>
|
||||
%5 = fir.call @_FortranACUFAllocDescriptor(%3, %4, %c14_i32) : (i64, !fir.ref<i8>, i32) -> !fir.ref<!fir.box<none>>
|
||||
%6 = fir.convert %5 : (!fir.ref<!fir.box<none>>) -> !fir.ref<!fir.box<!fir.heap<!fir.array<?x?xf32>>>>
|
||||
%7 = fir.zero_bits !fir.heap<!fir.array<?x?xf32>>
|
||||
%8 = fircg.ext_embox %7(%c0, %c0) {allocator_idx = 2 : i32} : (!fir.heap<!fir.array<?x?xf32>>, index, index) -> !fir.box<!fir.heap<!fir.array<?x?xf32>>>
|
||||
@ -83,7 +83,7 @@ module attributes {dlti.dl_spec = #dlti.dl_spec<f80 = dense<128> : vector<2xi64>
|
||||
%c48 = arith.constant 48 : index
|
||||
%10 = fir.convert %c48 : (index) -> i64
|
||||
%11 = fir.convert %9 : (!fir.ref<!fir.char<1,11>>) -> !fir.ref<i8>
|
||||
%12 = fir.call @_FortranACUFAllocDesciptor(%10, %11, %c20_i32) : (i64, !fir.ref<i8>, i32) -> !fir.ref<!fir.box<none>>
|
||||
%12 = fir.call @_FortranACUFAllocDescriptor(%10, %11, %c20_i32) : (i64, !fir.ref<i8>, i32) -> !fir.ref<!fir.box<none>>
|
||||
%13 = fir.convert %12 : (!fir.ref<!fir.box<none>>) -> !fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>>
|
||||
%14 = fir.zero_bits !fir.heap<!fir.array<?xf32>>
|
||||
%15 = fircg.ext_embox %14(%c0) {allocator_idx = 2 : i32} : (!fir.heap<!fir.array<?xf32>>, index) -> !fir.box<!fir.heap<!fir.array<?xf32>>>
|
||||
@ -120,9 +120,9 @@ module attributes {dlti.dl_spec = #dlti.dl_spec<f80 = dense<128> : vector<2xi64>
|
||||
%0 = fir.string_lit "dummy.mlir\00"(11) : !fir.char<1,11>
|
||||
fir.has_value %0 : !fir.char<1,11>
|
||||
}
|
||||
func.func private @_FortranACUFAllocDesciptor(i64, !fir.ref<i8>, i32) -> !fir.ref<!fir.box<none>> attributes {fir.runtime}
|
||||
func.func private @_FortranACUFAllocDescriptor(i64, !fir.ref<i8>, i32) -> !fir.ref<!fir.box<none>> attributes {fir.runtime}
|
||||
func.func private @_FortranACUFAllocatableAllocate(!fir.ref<!fir.box<none>>, i64, i1, !fir.box<none>, !fir.ref<i8>, i32) -> i32 attributes {fir.runtime}
|
||||
}
|
||||
|
||||
// CHECK-LABEL: llvm.func @_QQmain()
|
||||
// CHECK-COUNT-4: llvm.call @_FortranACUFAllocDesciptor
|
||||
// CHECK-COUNT-4: llvm.call @_FortranACUFAllocDescriptor
|
||||
|
@ -66,7 +66,7 @@ TEST(AllocatableCUFTest, DescriptorAllocationTest) {
|
||||
// REAL(4), DEVICE, ALLOCATABLE :: a(:)
|
||||
auto a{createAllocatable(TypeCategory::Real, 4)};
|
||||
Descriptor *desc = nullptr;
|
||||
desc = RTNAME(CUFAllocDesciptor)(a->SizeInBytes());
|
||||
desc = RTNAME(CUFAllocDescriptor)(a->SizeInBytes());
|
||||
EXPECT_TRUE(desc != nullptr);
|
||||
RTNAME(CUFFreeDesciptor)(desc);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user