3 Commits

Author SHA1 Message Date
Razvan Lupusoru
f3599e55d1
[mlir][acc] Add OpenACCSupport for extensible dialect handling (#164510)
The OpenACC dialect must coexist with source language dialects (FIR,
CIR, etc.) to enable offloading. While type interfaces
(`PointerLikeType` and `MappableType`) provide the primary contract for
variable mapping, some scenarios require pipeline-specific customization
or need to express information that cannot be adequately captured
through operation and type interfaces alone.

This commit introduces the `OpenACCSupport` analysis, which provides
extensible support APIs that can be customized per-pipeline. The
analysis follows the Concept-Model pattern used in MLIR's
`AliasAnalysis` and is never invalidated, persisting throughout the pass
pipeline.

The initial API, `getVariableName(Value) -> string`, retrieves variable
names from MLIR values by:
- Checking for `acc.var_name` attributes
- Extracting names from ACC data clause operations (e.g., `acc.copyin`)
- Walking through `ViewLikeOpInterface` operations to find the source

This will be used in the implicit data mapping pass to automatically
generate device mappings with correct user-visible variable names.

Usage: Passes call `getAnalysis<OpenACCSupport>()` to get a cached
instance with either the default or a previously- registered custom
implementation. Custom implementations can be registered in a setup pass
by calling `setImplementation()` before the consumer pass runs.
2025-10-22 08:26:21 -07:00
Razvan Lupusoru
484284ef5e
[mlir][acc] Introduce createAndPopulate for recipe creation (#162917)
Private and firstprivate recipes can now be created and populated
through the createAndPopulate method. The populating of recipe bodies is
done through using the PointerLikeType and MappableType interfaces (with
MappableType support still in progress).

The existing create() API remains available for cases where dialects
need manual recipe population (e.g., for frontend-specific semantics
like default value initialization or constructor calls).

Testing exercises the new API with memref types.
2025-10-14 17:34:33 +00:00
Razvan Lupusoru
0c087bd4f9
[mlir][acc] Extend PointerLikeType to provide alloc, dealloc, copy (#162328)
A variable in an acc data clause operation must have a type that
implements either PointerLikeType or a MappableType interface. These
interfaces provide the contract that allows acc dialect and its
transform passes to interact with a source dialect.

One of these requirements is ability to generate code that creates
memory for a private copy and ability to initialize that copy from
another variable. Thus, update the PointerLikeType API to provide the
means to create allocation, deallocation, and copy. This will be used as
a way to fill in privatization and firstprivatization recipes.

This new API was implemented for memref along with testing to exercise
it via the implementation of a testing pass.
2025-10-08 17:20:11 +00:00