File tree Expand file tree Collapse file tree 2 files changed +22
-0
lines changed
include/mlir/Dialect/OpenACC Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -2391,6 +2391,11 @@ def OpenACC_LoopOp : OpenACC_Op<"loop",
23912391 // Return whether this LoopOp has a gang, worker, or vector applying to the
23922392 // 'default'/None device-type.
23932393 bool hasDefaultGangWorkerVector();
2394+
2395+ // Used to obtain the parallelism mode for the requested device type.
2396+ // This first checks if the mode is set for the device_type requested.
2397+ // And if not, it returns the non-device_type mode.
2398+ LoopParMode getDefaultOrDeviceTypeParallelism(DeviceType);
23942399 }];
23952400
23962401 let hasCustomAssemblyFormat = 1;
Original file line number Diff line number Diff line change @@ -2957,6 +2957,23 @@ bool acc::LoopOp::hasDefaultGangWorkerVector() {
29572957 getGangValue (GangArgType::Dim) || getGangValue (GangArgType::Static);
29582958}
29592959
2960+ acc::LoopParMode
2961+ acc::LoopOp::getDefaultOrDeviceTypeParallelism (DeviceType deviceType) {
2962+ if (hasSeq (deviceType))
2963+ return LoopParMode::loop_seq;
2964+ if (hasAuto (deviceType))
2965+ return LoopParMode::loop_auto;
2966+ if (hasIndependent (deviceType))
2967+ return LoopParMode::loop_independent;
2968+ if (hasSeq ())
2969+ return LoopParMode::loop_seq;
2970+ if (hasAuto ())
2971+ return LoopParMode::loop_auto;
2972+ assert (hasIndependent () &&
2973+ " loop must have default auto, seq, or independent" );
2974+ return LoopParMode::loop_independent;
2975+ }
2976+
29602977void acc::LoopOp::addGangOperands (
29612978 MLIRContext *context, llvm::ArrayRef<DeviceType> effectiveDeviceTypes,
29622979 llvm::ArrayRef<GangArgType> argTypes, mlir::ValueRange values) {
You can’t perform that action at this time.
0 commit comments