You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[flang][acc] Use non-boxed value for assumed-size in acc data clause
Assumed-size arrays end up looking as follows at the HLFIR level:
```
func.func @_QPsub(%arg0: !fir.ref<!fir.array<?xf64>> {fir.bindc_name =
"arr"}) {
...
%1 = fir.shape %c-1 : (index) -> !fir.shape<1>
%2:2 = hlfir.declare %arg0(%1) dummy_scope %0 {uniq_name =
"_QFsubEarr"} : (!fir.ref<!fir.array<?xf64>>, !fir.shape<1>,
!fir.dscope) -> (!fir.box<!fir.array<?xf64>>,
!fir.ref<!fir.array<?xf64>>)
```
The declare operation produces an entity with Fortran properties
(wrapped via a box) or the raw data pointer. The current acc lowering
uses the box value.
During ConvertHLFIRtoFIR, this leads to a forced materialization of
descriptor even though the descriptor itself does not hold useful
extent information (it holds -1). Other operations such as those that
index the array access the raw pointer directly and thus do not force
materialization of descriptor.
Since there is nothing useful in descriptor and since at end of the
day the acc dialect can accept a pointer to the data, make it
consistent. This is useful property because without any acc data
clauses, an assumed-size array becomes live-in via raw pointer
typically. Thus, the materialization of descriptor is not something
acc lowering forces.
0 commit comments