UnitAttr:$asyncAttr,
Variadic<IntOrIndex>:$waitOperands,
UnitAttr:$waitAttr,
- Optional<IntOrIndex>:$numGangs,
+ Variadic<IntOrIndex>:$numGangs,
Optional<IntOrIndex>:$numWorkers,
Optional<IntOrIndex>:$vectorLength,
Optional<I1>:$ifCond,
UnitAttr:$asyncAttr,
Variadic<IntOrIndex>:$waitOperands,
UnitAttr:$waitAttr,
- Optional<IntOrIndex>:$numGangs,
+ Variadic<IntOrIndex>:$numGangs,
Optional<IntOrIndex>:$numWorkers,
Optional<IntOrIndex>:$vectorLength,
Optional<I1>:$ifCond,
Value ParallelOp::getDataOperand(unsigned i) {
unsigned numOptional = getAsync() ? 1 : 0;
- numOptional += getNumGangs() ? 1 : 0;
+ numOptional += getNumGangs().size();
numOptional += getNumWorkers() ? 1 : 0;
numOptional += getVectorLength() ? 1 : 0;
numOptional += getIfCond() ? 1 : 0;
*this, getReductionRecipes(), getReductionOperands(), "reduction",
"reductions", false)))
return failure();
+ if (getNumGangs().size() > 3)
+ return emitOpError() << "num_gangs expects a maximum of 3 values";
return checkDataOperands<acc::ParallelOp>(*this, getDataClauseOperands());
}
Value KernelsOp::getDataOperand(unsigned i) {
unsigned numOptional = getAsync() ? 1 : 0;
+ numOptional += getWaitOperands().size();
+ numOptional += getNumGangs().size();
+ numOptional += getNumWorkers() ? 1 : 0;
+ numOptional += getVectorLength() ? 1 : 0;
numOptional += getIfCond() ? 1 : 0;
numOptional += getSelfCond() ? 1 : 0;
- return getOperand(getWaitOperands().size() + numOptional + i);
+ return getOperand(numOptional + i);
}
LogicalResult acc::KernelsOp::verify() {
+ if (getNumGangs().size() > 3)
+ return emitOpError() << "num_gangs expects a maximum of 3 values";
return checkDataOperands<acc::KernelsOp>(*this, getDataClauseOperands());
}
"test.openacc_dummy_op"() : () -> ()
acc.yield
}
+
+// -----
+
+%i64value = arith.constant 1 : i64
+// expected-error@+1 {{num_gangs expects a maximum of 3 values}}
+acc.parallel num_gangs(%i64value, %i64value, %i64value, %i64value : i64, i64, i64, i64) {
+}
}
acc.parallel num_gangs(%idxValue: index) {
}
+ acc.parallel num_gangs(%i64value, %i64value, %idxValue : i64, i64, index) {
+ }
acc.parallel num_workers(%i64value: i64) {
}
acc.parallel num_workers(%i32value: i32) {
// CHECK-NEXT: }
// CHECK: acc.parallel num_gangs([[IDXVALUE]] : index) {
// CHECK-NEXT: }
+// CHECK: acc.parallel num_gangs([[I64VALUE]], [[I64VALUE]], [[IDXVALUE]] : i64, i64, index) {
+// CHECK-NEXT: }
// CHECK: acc.parallel num_workers([[I64VALUE]] : i64) {
// CHECK-NEXT: }
// CHECK: acc.parallel num_workers([[I32VALUE]] : i32) {