Create simplified functions for each rank with "x<rank>" suffix
that implement multidimensional reductions. To enable this I had to fix
an issue with taking incorrect box shape in cases of sliced embox/rebox.
Depends on D133818
Paths
| Differential D133820
[flang] Support multidimensional reductions in SimplifyIntrinsicsPass. ClosedPublic Authored by vzakhari on Sep 13 2022, 5:26 PM.
Details Summary Create simplified functions for each rank with "x<rank>" suffix Depends on D133818
Diff Detail
Event TimelineComment Actions Again, thanks for the work here. It looks roughly like I had imagined [although I was kind of wishfully thinking that maybe we could just treat ND as 1D, just larger - at least for things where "ordering isn't important", such as sum or maxval]
Comment Actions
If you mean that we could have used a single loop vs the loop nest, then I do not think it is easily possible. fir.coordinate_of provided with the multiple indices accounts for the dimension strides (which can be anything in case of slicing) - that we would have to do manually if using a single loop. Using the loop nest looks much cleaner to me and consistent with the rest of FIR generation. Comment Actions
Also importantly, multidimensional iteration spaces and access coordinates are consistent with other aspects of MLIR, so more generally amenable to reusing the standard MLIR optimization passes rather than reinventing them. This revision is now accepted and ready to land.Sep 19 2022, 11:17 AM Closed by commit rG8bd76ac15153: [flang] Support multidimensional reductions in SimplifyIntrinsicsPass. (authored by vzakhari). · Explain WhySep 19 2022, 12:17 PM This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 461301 flang/lib/Optimizer/Transforms/SimplifyIntrinsics.cpp
flang/test/Transforms/simplifyintrinsics.fir
|
Not that it matters a huge amount, but isn't Fortran limiting number of dimensions to 6? And thus asking for 16 is a bit excessive?