Commit 1568ce9
Razvan Lupusoru
[acc][flang] Define hasUnknownDimensions in MappableType
The MappableType interface currently defines a `generateAccBounds`
method which examines a variable and generates `acc.bounds`
operations that encode its dimensions. The implementation can
extract bounds information in various ways: either from the MLIR
type itself or by analyzing the IR to find dimension information
from defining operations.
However, we need to distinguish between cases where dimensional
information is not directly available from the type itself.
This new `hasUnknownDimensions` API returns true when the MLIR
type does not encode dimensional information and there is no
associated descriptor or metadata that would make this
information extractable from the visible ssa value the represents
the variable. The expected use case is calling `generateAccBounds`
only when this returns true, as it indicates that bounds must be
extracted from the IR (by walking back from current variable to
its defining spots or its descriptor).
This supports cases such as raw references to arrays with
non-constant bounds (e.g., explicit-shape arrays in Fortran
where bounds are passed as arguments). This functionality could
also be leveraged for CIR VLA support in the future.
For FIR types:
- Box types return false (descriptor encodes dimensions)
- Reference types check if the pointee has dynamic size using
fir::hasDynamicSize()1 parent 4c6a38c commit 1568ce9
File tree
6 files changed
+48
-1
lines changed- flang
- include/flang/Optimizer/OpenACC/Support
- lib/Optimizer/OpenACC/Support
- test
- Fir/OpenACC
- lib/OpenACC
- mlir
- include/mlir/Dialect/OpenACC
- unittests/Dialect/OpenACC
6 files changed
+48
-1
lines changedLines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
| 63 | + | |
| 64 | + | |
63 | 65 | | |
64 | 66 | | |
65 | 67 | | |
| |||
Lines changed: 22 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
193 | 193 | | |
194 | 194 | | |
195 | 195 | | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
196 | 218 | | |
197 | 219 | | |
198 | 220 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
| 30 | + | |
29 | 31 | | |
30 | 32 | | |
31 | 33 | | |
| |||
62 | 64 | | |
63 | 65 | | |
64 | 66 | | |
| 67 | + | |
65 | 68 | | |
66 | 69 | | |
67 | 70 | | |
| |||
70 | 73 | | |
71 | 74 | | |
72 | 75 | | |
| 76 | + | |
73 | 77 | | |
74 | 78 | | |
75 | 79 | | |
| |||
80 | 84 | | |
81 | 85 | | |
82 | 86 | | |
| 87 | + | |
83 | 88 | | |
84 | 89 | | |
85 | 90 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
103 | 107 | | |
104 | 108 | | |
105 | 109 | | |
| |||
Lines changed: 12 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
259 | 259 | | |
260 | 260 | | |
261 | 261 | | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
262 | 274 | | |
263 | 275 | | |
264 | 276 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
766 | 766 | | |
767 | 767 | | |
768 | 768 | | |
769 | | - | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
770 | 772 | | |
771 | 773 | | |
772 | 774 | | |
| |||
0 commit comments