6 Commits

Author SHA1 Message Date
Valentin Clement (バレンタイン クレメン)
bf81bdec66
[mlir][acc] Add isValidValueUse to OpenACCSupport (#171538)
Add a new API `isValidValueUse ` to OpenACCSupport. This is used in
ACCImplicitData to check value that are already legal in the OpenACC
region and do not require implicit clause to be generated. An example
would be a CUDA Fortran device variable that is already on the GPU.
2025-12-10 08:19:04 -08:00
nvptm
85e7860319
[mlir][acc] Make getDominatingDataClauses an OpenACC utility (#170549)
Moving getDominatingDataClauses to OpenACCUtils allows reuse.
2025-12-05 09:31:26 -08:00
Razvan Lupusoru
6a6b99aa80
[acc][flang][cir] Add recipes to data entry operations (#149210)
This patch refactors the OpenACC dialect to attach recipe symbols
directly to data operations (acc.private, acc.firstprivate,
acc.reduction)
rather than to compute constructs (acc.parallel, acc.serial, acc.loop).

Motivation:
The previous design required compute constructs to carry both the recipe
symbol and the variable reference, leading to complexity. Additionally,
recipes were required even when they could be generated automatically
through MappableType interfaces.

Changes:
- Data operations (acc.private, acc.firstprivate, acc.reduction) now
  require a 'recipe' attribute referencing their respective recipe
  operations
- Verifier enforces recipe attribute presence for non-MappableType
  operands; MappableType operands can generate recipes on demand
- Compute constructs (acc.parallel, acc.serial, acc.loop) no longer
  carry recipe symbols in their operands
- Updated flang lowering to attach recipes to data operations instead
  of passing them to compute constructs

Format Migration:
Old format:
```
  acc.parallel private(@recipe -> %var : !fir.ref<i32>) { ... }
```

New format:
```
  %private = acc.private varPtr(%var : !fir.ref<i32>)
              recipe(@recipe) -> !fir.ref<i32>
  acc.parallel private(%private : !fir.ref<i32>) { ... }
```

Test Updates:
- Updated all CIR and Flang OpenACC tests to new format
- Fixed CHECK lines to verify recipe attributes on data operations
2025-11-25 17:59:45 +00:00
Atmn Patel
621cbcde01
[mlir][acc] Adds attr to acc.present to identify default clause origin (#169114)
The `acc.present` Op as generated by ACCImplicitData does not provide a
way to differentiate between `acc.present` ops that are generated
implicitly and the ones that are generated as result of an explicit
`default(present)` clause in the source code. This differentiation would
allow for better communication to the user on the decisions made by the
compiler while managing data automatically between the host and the
device. This commit adds this information as a discardable attribute on
the `acc.present` op.
2025-11-24 10:15:00 -08:00
Kazu Hirata
2844d86734
[mlir] Remove unused local variables (NFC) (#167107)
Identified with bugprone-unused-local-non-trivial-variable.
2025-11-08 07:41:15 -08:00
Razvan Lupusoru
28c6ed5914
[mlir][acc] Add ACCImplicitData pass for implicit data attributes (#166472)
This change adds the ACCImplicitData pass which 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 (copyin,
copyout, present, firstprivate, etc.) for variables used within OpenACC
compute constructs (parallel, kernels, serial) that do not already have
explicit data clauses.

Key features:
- Respects default(none) and default(present) clauses
- Handles scalar vs. aggregate variables with different semantics:
  * Aggregates: present clause (if default(present)) or copy clause
  * Scalars: copy clause (kernels) or firstprivate (parallel/serial)
- Generates privatization recipes when needed for firstprivate clauses
- Performs alias analysis to avoid redundant data mappings
- Ensures proper data clause ordering for partial entity access
- Generates exit operations (copyout, delete) to match entry operations

Requirements:
- Types must implement acc::MappableType and/or acc::PointerLikeType
interfaces to be considered candidates.
- Operations accessing partial entities or creating subviews should
implement acc::PartialEntityAccess and/or mlir::ViewLikeOpInterface for
proper clause ordering.
- Optionally pre-register acc::OpenACCSupport and mlir::AliasAnalysis if
custom alias analysis, variable name determination, or error reporting
is needed.
2025-11-06 07:34:25 -08:00