Skip to content

Commit 8f8b1b0

Browse files
[mlir][acc][nfc] Update type interface descriptions (#147807)
PointerLikeType and MappableType interfaces are now described with more detail.
1 parent bb7cea0 commit 8f8b1b0

File tree

1 file changed

+28
-3
lines changed

1 file changed

+28
-3
lines changed

mlir/include/mlir/Dialect/OpenACC/OpenACCTypeInterfaces.td

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,27 @@ def OpenACC_PointerLikeTypeInterface : TypeInterface<"PointerLikeType"> {
1515
let cppNamespace = "::mlir::acc";
1616

1717
let description = [{
18-
An interface for pointer-like types that point to an OpenACC var.
18+
This is a minimal interface to interact with acc dialect data clause
19+
operations to represent an OpenACC variable. The reason for its existence
20+
is to create a minimal contract between a source dialect and the acc
21+
dialect - and it works on the basis that this is a pointer that can
22+
be mapped to device memory. This exists for the following reasons:
23+
- Many dialects choose to represent their variables as pointers.
24+
Specifically locals are created with some form of `alloca` and globals
25+
are referred through by their address.
26+
- Eventually all such pointers end up as LLVM pointers along with LLVM
27+
types whose size is computable. This is the minimal information needed
28+
to map a variable.
29+
- The OpenACC spec describes reference counters in terms of memory
30+
addressability. In 2.6.7. It says: "A structured reference counter
31+
is incremented when entering each data or compute region that contain
32+
an explicit data clause or implicitly-determined data attributes for
33+
that section of memory". This implies addressability of memory.
34+
- Attach semantics (2.6.8 attachment counter) are specified using
35+
"address" terminology: "The attachment counter for a pointer is set to
36+
one whenever the pointer is attached to new target address, and
37+
incremented whenever an attach action for that pointer is performed for
38+
the same target address."
1939
}];
2040

2141
// By convention, any of the pointer types associated with this interface
@@ -57,8 +77,13 @@ def OpenACC_MappableTypeInterface : TypeInterface<"MappableType"> {
5777
let cppNamespace = "::mlir::acc";
5878

5979
let description = [{
60-
An interface to capture type-based semantics for mapping in a manner that
61-
makes it convertible to size-based semantics.
80+
This interface is a richer contract than being a pointer-like type
81+
and can be used in conjunction with it.
82+
It should be attached to types that a source dialect considers to
83+
be variables. And unlike pointer-like type, it can be attached to variables
84+
which the source dialect does not represent through the use of memory.
85+
The richer API allows for post-frontend type-based semantics to be
86+
applied such as generating recipes or extracting array bounds.
6287
}];
6388

6489
let methods = [

0 commit comments

Comments
 (0)