[clang] [OpenACC][CIR] Lower 'num_workers' for parallel/kernels (PR #136578)
Erich Keane via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 21 10:46:24 PDT 2025
================
@@ -136,6 +154,51 @@ class OpenACCClauseCIREmitter final
if (!clause.getArchitectures().empty())
operation.setDeviceType(
decodeDeviceType(clause.getArchitectures()[0].getIdentifierInfo()));
+ } else if constexpr (isOneOfTypes<OpTy, ParallelOp, SerialOp, KernelsOp>) {
+ // Nothing to do here, these constructs don't have any IR for these, as
+ // they just modify the other clauses IR. So setting of `lastDeviceType`
+ // (done above) is all we need.
+ } else {
+ return clauseNotImplemented(clause);
+ }
+ }
+
+ void VisitNumWorkersClause(const OpenACCNumWorkersClause &clause) {
+ if constexpr (isOneOfTypes<OpTy, ParallelOp, KernelsOp>) {
+ // Collect the 'existing' device-type attributes so we can re-create them
+ // and insert them.
+ llvm::SmallVector<mlir::Attribute> deviceTypes;
+ mlir::ArrayAttr existingDeviceTypes =
+ operation.getNumWorkersDeviceTypeAttr();
+
+ if (existingDeviceTypes) {
+ for (const mlir::Attribute &Attr : existingDeviceTypes)
----------------
erichkeane wrote:
Yeah, you're probably right. I'll fix this here and 1 other place.
https://github.com/llvm/llvm-project/pull/136578
More information about the cfe-commits
mailing list