Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions mlir/include/mlir/Dialect/OpenACC/Transforms/Passes.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
#ifndef MLIR_DIALECT_OPENACC_TRANSFORMS_PASSES_H
#define MLIR_DIALECT_OPENACC_TRANSFORMS_PASSES_H

#include "mlir/Dialect/Arith/IR/Arith.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/Dialect/OpenACC/OpenACC.h"
#include "mlir/Pass/Pass.h"

namespace mlir {
Expand Down
36 changes: 36 additions & 0 deletions mlir/include/mlir/Dialect/OpenACC/Transforms/Passes.td
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,40 @@ def LegalizeDataValuesInRegion : Pass<"openacc-legalize-data-values", "mlir::fun
];
}

def ACCImplicitData : Pass<"acc-implicit-data", "mlir::ModuleOp"> {
let summary = "Generate implicit data attributes for OpenACC compute constructs";
let description = [{
This pass implements the OpenACC specification for "Variables with
Implicitly Determined Data Attributes" (OpenACC 3.4 spec, section 2.6.2).

The pass automatically generates data clause operations for variables used
within OpenACC compute constructs (parallel, kernels, serial) that do not
already have explicit data clauses. The semantics follow these rules:

1. If there is a default(none) clause visible, no implicit data actions
apply.

2. An aggregate variable (arrays, derived types, etc.) will be treated as:
- In a present clause when default(present) is visible.
- In a copy clause otherwise.

3. A scalar variable will be treated as if it appears in:
- A copy clause if the compute construct is a kernels construct.
- A firstprivate clause otherwise (parallel, serial).
}];
let dependentDialects = ["mlir::acc::OpenACCDialect",
"mlir::memref::MemRefDialect",
"mlir::arith::ArithDialect"];
let options = [
Option<"enableImplicitReductionCopy", "enable-implicit-reduction-copy",
"bool", "true",
"Enable applying implicit copy in lieu of implicit firstprivate for "
"reduction variables. This allows uniform treatment of reduction "
"variables between combined constructs (e.g., 'parallel loop') and "
"separate constructs (e.g., 'parallel' followed by 'loop'), where "
"the OpenACC spec requires copy semantics for the former but "
"firstprivate would normally apply for the latter.">
];
}

#endif // MLIR_DIALECT_OPENACC_TRANSFORMS_PASSES
Loading