Skip to content

Commit f706837

Browse files
authored
[flang][mlir][openacc] Switch device_type representation to an enum (#70250)
Switch the representation from scalar integer to a enumeration. The parser transform the string in the input to the correct enumeration.
1 parent 101008b commit f706837

File tree

20 files changed

+146
-113
lines changed

20 files changed

+146
-113
lines changed

flang/include/flang/Parser/dump-parse-tree.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ class ParseTreeDumper {
101101
NODE(parser, AccSelfClause)
102102
NODE(parser, AccStandaloneDirective)
103103
NODE(parser, AccDeviceTypeExpr)
104+
NODE_ENUM(parser::AccDeviceTypeExpr, Device)
104105
NODE(parser, AccDeviceTypeExprList)
105106
NODE(parser, AccTileExpr)
106107
NODE(parser, AccTileExprList)

flang/include/flang/Parser/parse-tree.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4061,9 +4061,9 @@ struct AccWaitArgument {
40614061
};
40624062

40634063
struct AccDeviceTypeExpr {
4064-
TUPLE_CLASS_BOILERPLATE(AccDeviceTypeExpr);
4064+
ENUM_CLASS(Device, Star, Default, Nvidia, Radeon, Host, Multicore)
4065+
WRAPPER_CLASS_BOILERPLATE(AccDeviceTypeExpr, Device);
40654066
CharBlock source;
4066-
std::tuple<std::optional<ScalarIntExpr>> t; // if null then *
40674067
};
40684068

40694069
struct AccDeviceTypeExprList {

flang/lib/Lower/OpenACC.cpp

Lines changed: 57 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ static void createDeclareAllocFuncWithArg(mlir::OpBuilder &modBuilder,
150150
builder, loc, registerFuncOp.getArgument(0), asFortranDesc, bounds,
151151
/*structured=*/false, /*implicit=*/true,
152152
mlir::acc::DataClause::acc_update_device, descTy);
153-
llvm::SmallVector<int32_t> operandSegments{0, 0, 0, 0, 0, 1};
153+
llvm::SmallVector<int32_t> operandSegments{0, 0, 0, 0, 1};
154154
llvm::SmallVector<mlir::Value> operands{updateDeviceOp.getResult()};
155155
createSimpleOp<mlir::acc::UpdateOp>(builder, loc, operands, operandSegments);
156156

@@ -219,7 +219,7 @@ static void createDeclareDeallocFuncWithArg(
219219
builder, loc, loadOp, asFortran, bounds,
220220
/*structured=*/false, /*implicit=*/true,
221221
mlir::acc::DataClause::acc_update_device, loadOp.getType());
222-
llvm::SmallVector<int32_t> operandSegments{0, 0, 0, 0, 0, 1};
222+
llvm::SmallVector<int32_t> operandSegments{0, 0, 0, 0, 1};
223223
llvm::SmallVector<mlir::Value> operands{updateDeviceOp.getResult()};
224224
createSimpleOp<mlir::acc::UpdateOp>(builder, loc, operands, operandSegments);
225225
modBuilder.setInsertionPointAfter(postDeallocOp);
@@ -1416,27 +1416,35 @@ static void genAsyncClause(Fortran::lower::AbstractConverter &converter,
14161416
}
14171417
}
14181418

1419-
static void genDeviceTypeClause(
1420-
Fortran::lower::AbstractConverter &converter, mlir::Location clauseLocation,
1419+
static mlir::acc::DeviceType
1420+
getDeviceType(Fortran::parser::AccDeviceTypeExpr::Device device) {
1421+
switch (device) {
1422+
case Fortran::parser::AccDeviceTypeExpr::Device::Star:
1423+
return mlir::acc::DeviceType::Star;
1424+
case Fortran::parser::AccDeviceTypeExpr::Device::Default:
1425+
return mlir::acc::DeviceType::Default;
1426+
case Fortran::parser::AccDeviceTypeExpr::Device::Nvidia:
1427+
return mlir::acc::DeviceType::Nvidia;
1428+
case Fortran::parser::AccDeviceTypeExpr::Device::Radeon:
1429+
return mlir::acc::DeviceType::Radeon;
1430+
case Fortran::parser::AccDeviceTypeExpr::Device::Host:
1431+
return mlir::acc::DeviceType::Host;
1432+
case Fortran::parser::AccDeviceTypeExpr::Device::Multicore:
1433+
return mlir::acc::DeviceType::Multicore;
1434+
}
1435+
return mlir::acc::DeviceType::Default;
1436+
}
1437+
1438+
static void gatherDeviceTypeAttrs(
1439+
fir::FirOpBuilder &builder, mlir::Location clauseLocation,
14211440
const Fortran::parser::AccClause::DeviceType *deviceTypeClause,
1422-
llvm::SmallVectorImpl<mlir::Value> &operands,
1441+
llvm::SmallVector<mlir::Attribute> &deviceTypes,
14231442
Fortran::lower::StatementContext &stmtCtx) {
14241443
const Fortran::parser::AccDeviceTypeExprList &deviceTypeExprList =
14251444
deviceTypeClause->v;
1426-
for (const auto &deviceTypeExpr : deviceTypeExprList.v) {
1427-
const auto &expr = std::get<std::optional<Fortran::parser::ScalarIntExpr>>(
1428-
deviceTypeExpr.t);
1429-
if (expr) {
1430-
operands.push_back(fir::getBase(converter.genExprValue(
1431-
*Fortran::semantics::GetExpr(expr), stmtCtx, &clauseLocation)));
1432-
} else {
1433-
// * was passed as value and will be represented as a special constant.
1434-
fir::FirOpBuilder &firOpBuilder = converter.getFirOpBuilder();
1435-
mlir::Value star = firOpBuilder.createIntegerConstant(
1436-
clauseLocation, firOpBuilder.getIndexType(), starCst);
1437-
operands.push_back(star);
1438-
}
1439-
}
1445+
for (const auto &deviceTypeExpr : deviceTypeExprList.v)
1446+
deviceTypes.push_back(mlir::acc::DeviceTypeAttr::get(
1447+
builder.getContext(), getDeviceType(deviceTypeExpr.v)));
14401448
}
14411449

14421450
static void genIfClause(Fortran::lower::AbstractConverter &converter,
@@ -2443,10 +2451,10 @@ genACCInitShutdownOp(Fortran::lower::AbstractConverter &converter,
24432451
mlir::Location currentLocation,
24442452
const Fortran::parser::AccClauseList &accClauseList) {
24452453
mlir::Value ifCond, deviceNum;
2446-
llvm::SmallVector<mlir::Value> deviceTypeOperands;
24472454

2448-
fir::FirOpBuilder &firOpBuilder = converter.getFirOpBuilder();
2455+
fir::FirOpBuilder &builder = converter.getFirOpBuilder();
24492456
Fortran::lower::StatementContext stmtCtx;
2457+
llvm::SmallVector<mlir::Attribute> deviceTypes;
24502458

24512459
// Lower clauses values mapped to operands.
24522460
// Keep track of each group of operands separately as clauses can appear
@@ -2464,19 +2472,23 @@ genACCInitShutdownOp(Fortran::lower::AbstractConverter &converter,
24642472
} else if (const auto *deviceTypeClause =
24652473
std::get_if<Fortran::parser::AccClause::DeviceType>(
24662474
&clause.u)) {
2467-
genDeviceTypeClause(converter, clauseLocation, deviceTypeClause,
2468-
deviceTypeOperands, stmtCtx);
2475+
gatherDeviceTypeAttrs(builder, clauseLocation, deviceTypeClause,
2476+
deviceTypes, stmtCtx);
24692477
}
24702478
}
24712479

24722480
// Prepare the operand segment size attribute and the operands value range.
24732481
llvm::SmallVector<mlir::Value, 6> operands;
2474-
llvm::SmallVector<int32_t, 3> operandSegments;
2475-
addOperands(operands, operandSegments, deviceTypeOperands);
2482+
llvm::SmallVector<int32_t, 2> operandSegments;
2483+
24762484
addOperand(operands, operandSegments, deviceNum);
24772485
addOperand(operands, operandSegments, ifCond);
24782486

2479-
createSimpleOp<Op>(firOpBuilder, currentLocation, operands, operandSegments);
2487+
Op op =
2488+
createSimpleOp<Op>(builder, currentLocation, operands, operandSegments);
2489+
if (!deviceTypes.empty())
2490+
op.setDeviceTypesAttr(
2491+
mlir::ArrayAttr::get(builder.getContext(), deviceTypes));
24802492
}
24812493

24822494
void genACCSetOp(Fortran::lower::AbstractConverter &converter,
@@ -2485,8 +2497,9 @@ void genACCSetOp(Fortran::lower::AbstractConverter &converter,
24852497
mlir::Value ifCond, deviceNum, defaultAsync;
24862498
llvm::SmallVector<mlir::Value> deviceTypeOperands;
24872499

2488-
fir::FirOpBuilder &firOpBuilder = converter.getFirOpBuilder();
2500+
fir::FirOpBuilder &builder = converter.getFirOpBuilder();
24892501
Fortran::lower::StatementContext stmtCtx;
2502+
llvm::SmallVector<mlir::Attribute> deviceTypes;
24902503

24912504
// Lower clauses values mapped to operands.
24922505
// Keep track of each group of operands separately as clauses can appear
@@ -2509,21 +2522,24 @@ void genACCSetOp(Fortran::lower::AbstractConverter &converter,
25092522
} else if (const auto *deviceTypeClause =
25102523
std::get_if<Fortran::parser::AccClause::DeviceType>(
25112524
&clause.u)) {
2512-
genDeviceTypeClause(converter, clauseLocation, deviceTypeClause,
2513-
deviceTypeOperands, stmtCtx);
2525+
gatherDeviceTypeAttrs(builder, clauseLocation, deviceTypeClause,
2526+
deviceTypes, stmtCtx);
25142527
}
25152528
}
25162529

25172530
// Prepare the operand segment size attribute and the operands value range.
25182531
llvm::SmallVector<mlir::Value> operands;
2519-
llvm::SmallVector<int32_t, 4> operandSegments;
2520-
addOperands(operands, operandSegments, deviceTypeOperands);
2532+
llvm::SmallVector<int32_t, 3> operandSegments;
25212533
addOperand(operands, operandSegments, defaultAsync);
25222534
addOperand(operands, operandSegments, deviceNum);
25232535
addOperand(operands, operandSegments, ifCond);
25242536

2525-
createSimpleOp<mlir::acc::SetOp>(firOpBuilder, currentLocation, operands,
2526-
operandSegments);
2537+
auto op = createSimpleOp<mlir::acc::SetOp>(builder, currentLocation, operands,
2538+
operandSegments);
2539+
if (!deviceTypes.empty()) {
2540+
assert(deviceTypes.size() == 1 && "expect only one value for acc.set");
2541+
op.setDeviceTypeAttr(mlir::cast<mlir::acc::DeviceTypeAttr>(deviceTypes[0]));
2542+
}
25272543
}
25282544

25292545
static void
@@ -2535,6 +2551,7 @@ genACCUpdateOp(Fortran::lower::AbstractConverter &converter,
25352551
mlir::Value ifCond, async, waitDevnum;
25362552
llvm::SmallVector<mlir::Value> dataClauseOperands, updateHostOperands,
25372553
waitOperands, deviceTypeOperands;
2554+
llvm::SmallVector<mlir::Attribute> deviceTypes;
25382555

25392556
// Async and wait clause have optional values but can be present with
25402557
// no value as well. When there is no value, the op has an attribute to
@@ -2563,8 +2580,8 @@ genACCUpdateOp(Fortran::lower::AbstractConverter &converter,
25632580
} else if (const auto *deviceTypeClause =
25642581
std::get_if<Fortran::parser::AccClause::DeviceType>(
25652582
&clause.u)) {
2566-
genDeviceTypeClause(converter, clauseLocation, deviceTypeClause,
2567-
deviceTypeOperands, stmtCtx);
2583+
gatherDeviceTypeAttrs(builder, clauseLocation, deviceTypeClause,
2584+
deviceTypes, stmtCtx);
25682585
} else if (const auto *hostClause =
25692586
std::get_if<Fortran::parser::AccClause::Host>(&clause.u)) {
25702587
genDataOperandOperations<mlir::acc::GetDevicePtrOp>(
@@ -2602,11 +2619,13 @@ genACCUpdateOp(Fortran::lower::AbstractConverter &converter,
26022619
addOperand(operands, operandSegments, async);
26032620
addOperand(operands, operandSegments, waitDevnum);
26042621
addOperands(operands, operandSegments, waitOperands);
2605-
addOperands(operands, operandSegments, deviceTypeOperands);
26062622
addOperands(operands, operandSegments, dataClauseOperands);
26072623

26082624
mlir::acc::UpdateOp updateOp = createSimpleOp<mlir::acc::UpdateOp>(
26092625
builder, currentLocation, operands, operandSegments);
2626+
if (!deviceTypes.empty())
2627+
updateOp.setDeviceTypesAttr(
2628+
mlir::ArrayAttr::get(builder.getContext(), deviceTypes));
26102629

26112630
genDataExitOperations<mlir::acc::GetDevicePtrOp, mlir::acc::UpdateHostOp>(
26122631
builder, updateHostOperands, /*structured=*/false);
@@ -2787,7 +2806,7 @@ static void createDeclareAllocFunc(mlir::OpBuilder &modBuilder,
27872806
builder, loc, addrOp, asFortranDesc, bounds,
27882807
/*structured=*/false, /*implicit=*/true,
27892808
mlir::acc::DataClause::acc_update_device, addrOp.getType());
2790-
llvm::SmallVector<int32_t> operandSegments{0, 0, 0, 0, 0, 1};
2809+
llvm::SmallVector<int32_t> operandSegments{0, 0, 0, 0, 1};
27912810
llvm::SmallVector<mlir::Value> operands{updateDeviceOp.getResult()};
27922811
createSimpleOp<mlir::acc::UpdateOp>(builder, loc, operands, operandSegments);
27932812

@@ -2863,7 +2882,7 @@ static void createDeclareDeallocFunc(mlir::OpBuilder &modBuilder,
28632882
builder, loc, addrOp, asFortran, bounds,
28642883
/*structured=*/false, /*implicit=*/true,
28652884
mlir::acc::DataClause::acc_update_device, addrOp.getType());
2866-
llvm::SmallVector<int32_t> operandSegments{0, 0, 0, 0, 0, 1};
2885+
llvm::SmallVector<int32_t> operandSegments{0, 0, 0, 0, 1};
28672886
llvm::SmallVector<mlir::Value> operands{updateDeviceOp.getResult()};
28682887
createSimpleOp<mlir::acc::UpdateOp>(builder, loc, operands, operandSegments);
28692888
modBuilder.setInsertionPointAfter(postDeallocOp);

flang/lib/Parser/openacc-parsers.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,15 @@ TYPE_PARSER(construct<AccSizeExpr>(scalarIntExpr) ||
5353
construct<AccSizeExpr>("*" >> construct<std::optional<ScalarIntExpr>>()))
5454
TYPE_PARSER(construct<AccSizeExprList>(nonemptyList(Parser<AccSizeExpr>{})))
5555

56-
TYPE_PARSER(construct<AccDeviceTypeExpr>(scalarIntExpr) ||
57-
construct<AccDeviceTypeExpr>(
58-
"*" >> construct<std::optional<ScalarIntExpr>>()))
56+
TYPE_PARSER(sourced(construct<AccDeviceTypeExpr>(
57+
first("*" >> pure(AccDeviceTypeExpr::Device::Star),
58+
"DEFAULT" >> pure(AccDeviceTypeExpr::Device::Default),
59+
"NVIDIA" >> pure(AccDeviceTypeExpr::Device::Nvidia),
60+
"ACC_DEVICE_NVIDIA" >> pure(AccDeviceTypeExpr::Device::Nvidia),
61+
"RADEON" >> pure(AccDeviceTypeExpr::Device::Radeon),
62+
"HOST" >> pure(AccDeviceTypeExpr::Device::Host),
63+
"MULTICORE" >> pure(AccDeviceTypeExpr::Device::Multicore)))))
64+
5965
TYPE_PARSER(
6066
construct<AccDeviceTypeExprList>(nonemptyList(Parser<AccDeviceTypeExpr>{})))
6167

flang/test/Lower/OpenACC/acc-init.f90

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
! RUN: bbc -fopenacc -emit-hlfir %s -o - | FileCheck %s
55

66
subroutine acc_init
7+
implicit none
78
logical :: ifCondition = .TRUE.
89
integer :: ifInt = 1
910

@@ -23,15 +24,16 @@ subroutine acc_init
2324
!CHECK: [[DEVNUM:%.*]] = arith.constant 1 : i32
2425
!CHECK: acc.init device_num([[DEVNUM]] : i32){{$}}
2526

26-
!$acc init device_num(1) device_type(1, 2)
27+
!$acc init device_num(1) device_type(host, multicore)
2728
!CHECK: [[DEVNUM:%.*]] = arith.constant 1 : i32
28-
!CHECK: [[DEVTYPE1:%.*]] = arith.constant 1 : i32
29-
!CHECK: [[DEVTYPE2:%.*]] = arith.constant 2 : i32
30-
!CHECK: acc.init device_type([[DEVTYPE1]], [[DEVTYPE2]] : i32, i32) device_num([[DEVNUM]] : i32){{$}}
29+
!CHECK: acc.init device_num([[DEVNUM]] : i32) attributes {device_types = [#acc.device_type<host>, #acc.device_type<multicore>]}
3130

3231
!$acc init if(ifInt)
3332
!CHECK: %[[IFINT:.*]] = fir.load %{{.*}} : !fir.ref<i32>
3433
!CHECK: %[[CONV:.*]] = fir.convert %[[IFINT]] : (i32) -> i1
3534
!CHECK: acc.init if(%[[CONV]])
3635

36+
!$acc init device_type(nvidia)
37+
!CHECK: acc.init attributes {device_types = [#acc.device_type<nvidia>]}
38+
3739
end subroutine acc_init

flang/test/Lower/OpenACC/acc-set.f90

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ program test_acc_set
1414

1515
!$acc set device_type(*)
1616

17-
!$acc set device_type(0)
17+
!$acc set device_type(multicore)
1818

1919
end
2020

@@ -34,10 +34,8 @@ program test_acc_set
3434
! CHECK: %[[C0:.*]] = arith.constant 0 : i32
3535
! CHECK: acc.set device_num(%[[C0]] : i32)
3636

37-
! CHECK: %[[C_1:.*]] = arith.constant -1 : index
38-
! CHECK: acc.set device_type(%[[C_1]] : index)
37+
! CHECK: acc.set attributes {device_type = #acc.device_type<*>}
3938

40-
! CHECK: %[[C0:.*]] = arith.constant 0 : i32
41-
! CHECK: acc.set device_type(%[[C0]] : i32)
39+
! CHECK: acc.set attributes {device_type = #acc.device_type<multicore>}
4240

4341

flang/test/Lower/OpenACC/acc-shutdown.f90

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,8 @@ subroutine acc_shutdown
2222
!CHECK: [[DEVNUM:%.*]] = arith.constant 1 : i32
2323
!CHECK: acc.shutdown device_num([[DEVNUM]] : i32){{$}}
2424

25-
!$acc shutdown device_num(1) device_type(1, 2)
25+
!$acc shutdown device_num(1) device_type(default, nvidia)
2626
!CHECK: [[DEVNUM:%.*]] = arith.constant 1 : i32
27-
!CHECK: [[DEVTYPE1:%.*]] = arith.constant 1 : i32
28-
!CHECK: [[DEVTYPE2:%.*]] = arith.constant 2 : i32
29-
!CHECK: acc.shutdown device_type([[DEVTYPE1]], [[DEVTYPE2]] : i32, i32) device_num([[DEVNUM]] : i32){{$}}
27+
!CHECK: acc.shutdown device_num([[DEVNUM]] : i32) attributes {device_types = [#acc.device_type<default>, #acc.device_type<nvidia>]}
3028

3129
end subroutine acc_shutdown

flang/test/Lower/OpenACC/acc-update.f90

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -145,20 +145,17 @@ subroutine acc_update
145145
! FIR: acc.update_host accPtr(%[[DEVPTR_A]] : !fir.ref<!fir.array<10x10xf32>>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[A]] : !fir.ref<!fir.array<10x10xf32>>) {name = "a", structured = false}
146146
! HLFIR: acc.update_host accPtr(%[[DEVPTR_A]] : !fir.ref<!fir.array<10x10xf32>>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[DECLA]]#1 : !fir.ref<!fir.array<10x10xf32>>) {name = "a", structured = false}
147147

148-
!$acc update host(a) device_type(1, 2)
148+
!$acc update host(a) device_type(default, host)
149149
! FIR: %[[DEVPTR_A:.*]] = acc.getdeviceptr varPtr(%[[A]] : !fir.ref<!fir.array<10x10xf32>>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref<!fir.array<10x10xf32>> {dataClause = #acc<data_clause acc_update_host>, name = "a", structured = false}
150150
! HLFIR: %[[DEVPTR_A:.*]] = acc.getdeviceptr varPtr(%[[DECLA]]#1 : !fir.ref<!fir.array<10x10xf32>>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref<!fir.array<10x10xf32>> {dataClause = #acc<data_clause acc_update_host>, name = "a", structured = false}
151-
! CHECK: [[DEVTYPE1:%.*]] = arith.constant 1 : i32
152-
! CHECK: [[DEVTYPE2:%.*]] = arith.constant 2 : i32
153-
! CHECK: acc.update device_type([[DEVTYPE1]], [[DEVTYPE2]] : i32, i32) dataOperands(%[[DEVPTR_A]] : !fir.ref<!fir.array<10x10xf32>>){{$}}
151+
! CHECK: acc.update dataOperands(%[[DEVPTR_A]] : !fir.ref<!fir.array<10x10xf32>>) attributes {device_types = [#acc.device_type<default>, #acc.device_type<host>]}
154152
! FIR: acc.update_host accPtr(%[[DEVPTR_A]] : !fir.ref<!fir.array<10x10xf32>>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[A]] : !fir.ref<!fir.array<10x10xf32>>) {name = "a", structured = false}
155153
! HLFIR: acc.update_host accPtr(%[[DEVPTR_A]] : !fir.ref<!fir.array<10x10xf32>>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[DECLA]]#1 : !fir.ref<!fir.array<10x10xf32>>) {name = "a", structured = false}
156154

157155
!$acc update host(a) device_type(*)
158156
! FIR: %[[DEVPTR_A:.*]] = acc.getdeviceptr varPtr(%[[A]] : !fir.ref<!fir.array<10x10xf32>>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref<!fir.array<10x10xf32>> {dataClause = #acc<data_clause acc_update_host>, name = "a", structured = false}
159157
! HLFIR: %[[DEVPTR_A:.*]] = acc.getdeviceptr varPtr(%[[DECLA]]#1 : !fir.ref<!fir.array<10x10xf32>>) bounds(%{{.*}}, %{{.*}}) -> !fir.ref<!fir.array<10x10xf32>> {dataClause = #acc<data_clause acc_update_host>, name = "a", structured = false}
160-
! CHECK: [[DEVTYPE3:%.*]] = arith.constant -1 : index
161-
! CHECK: acc.update device_type([[DEVTYPE3]] : index) dataOperands(%[[DEVPTR_A]] : !fir.ref<!fir.array<10x10xf32>>){{$}}
158+
! CHECK: acc.update dataOperands(%[[DEVPTR_A]] : !fir.ref<!fir.array<10x10xf32>>) attributes {device_types = [#acc.device_type<*>]}
162159
! FIR: acc.update_host accPtr(%[[DEVPTR_A]] : !fir.ref<!fir.array<10x10xf32>>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[A]] : !fir.ref<!fir.array<10x10xf32>>) {name = "a", structured = false}
163160
! HLFIR: acc.update_host accPtr(%[[DEVPTR_A]] : !fir.ref<!fir.array<10x10xf32>>) bounds(%{{.*}}, %{{.*}}) to varPtr(%[[DECLA]]#1 : !fir.ref<!fir.array<10x10xf32>>) {name = "a", structured = false}
164161

flang/test/Semantics/OpenACC/acc-data.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ program openacc_data_validity
184184
!$acc data copy(aa) wait
185185
!$acc end data
186186

187-
!$acc data copy(aa) device_type(1) wait
187+
!$acc data copy(aa) device_type(default) wait
188188
!$acc end data
189189

190190
end program openacc_data_validity

flang/test/Semantics/OpenACC/acc-init-validity.f90

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ program openacc_init_validity
2020
!$acc init if(ifInt)
2121
!$acc init device_num(1)
2222
!$acc init device_num(i)
23-
!$acc init device_type(i)
24-
!$acc init device_type(2, i, j)
25-
!$acc init device_num(i) device_type(i, j) if(ifCondition)
23+
!$acc init device_type(default)
24+
!$acc init device_type(nvidia, radeon)
25+
!$acc init device_num(i) device_type(host, multicore) if(ifCondition)
2626

2727
!$acc parallel
2828
!ERROR: Directive INIT may not be called within a compute region
@@ -94,7 +94,7 @@ program openacc_init_validity
9494
!$acc init device_num(1) device_num(i)
9595

9696
!ERROR: At most one DEVICE_TYPE clause can appear on the INIT directive
97-
!$acc init device_type(2) device_type(i, j)
97+
!$acc init device_type(nvidia) device_type(default, *)
9898

9999
!ERROR: Must have LOGICAL or INTEGER type
100100
!$acc init if(ifReal)

0 commit comments

Comments
 (0)