Razvan Lupusoru c620d074a3
[acc][flang] Implement OpenACC interface for partial entity accesses (#165911)
For OpenACC clause ordering, such as maintaining appropriate
parent-child relationship ordering, we need to be able to walk
references back to their base entities. This introduces the operation
interface in the `acc` dialect named
`PartialEntityAccessOpInterface` which can be used for this purpose.

The interface provides two methods:
- `getBaseEntity()`: Returns the base entity being accessed
- `isCompleteView()`: Indicates whether the access covers the complete
entity to allow this interface to be attached to cases that only
conditionally offer a partial view

This also adds a utility function `mlir::acc::getBaseEntity()` that uses
this interface to retrieve the base entity from a value.

This work has some similarities with the ViewLikeOpInterface proposal
for FIR:
https://github.com/llvm/llvm-project/pull/164020
but it differs in the following ways:
- Attached only to operations where we can assume a partial entity
access
- Includes fir.declare operations due to common block storage
associations

Tests are included that demonstrate the interface on memref.subview
operations, implemented locally in the test since memref operations
already have ViewLikeOpInterface for similar purposes.
2025-10-31 13:24:51 -07:00
..