Lower the F08 NORM2 intrinsic.
The implementation follows the pattern used in comparable intrinsics. Change the runtime API for Norm2 so it does not expect an (optional) mask argument since the Norm2 intrinsic does not accept a mask in Fortran.
Paths
| Differential D138150
[flang] Lower F08 NORM2 intrinsic ClosedPublic Authored by tarunprabhu on Nov 16 2022, 1:13 PM.
Details Summary Lower the F08 NORM2 intrinsic. The implementation follows the pattern used in comparable intrinsics. Change the runtime API for Norm2 so it does not expect an (optional) mask argument since the Norm2 intrinsic does not accept a mask in Fortran.
Diff Detail
Event TimelineComment Actions
The runtime implementations of Norm2 eventually use DoTotalReduction which needs a mask argument. We would need to provide an alternative to/overload of DoTotalReduction that does not require a mask. Comment Actions
Couldn't Norm2 runtime implementation just pass a nullptr mask to DoTotalReduction instead ? Comment Actions
Oh, I didn't realize that one could do that. I'll try it. Comment Actions Change the runtime API to not require a mask argument since a mask is not used in the Norm2 intrinsic. Instead, pass a null parameter to the internal runtime routines that actually carry out the computation. Update tests to reflect this change. Comment Actions
Did you push the patch with the runtime API update ? I do not see a change to flang/include/flang/Runtime/reduction.h. Comment Actions @jeanPerier, in the previous patch, I said that I had changed the runtime API when all I did was create a null value and pass that along to the runtime. Sorry, that was a silly thing to do and say, This one _actually_ changes the runtime API.
Comment Actions Please just make sure to run clang-format on your changes in flang/runtime/extrema.cpp. Otherwise, looks great, thanks for solving my comments. This revision is now accepted and ready to land.Dec 2 2022, 12:24 AM This revision was landed with ongoing or failed builds.Dec 5 2022, 12:56 PM Closed by commit rG7fe4abbbc270: [flang] Lower F08 NORM2 intrinsic (authored by tarunprabhu). · Explain Why This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 480211 flang/include/flang/Optimizer/Builder/Runtime/Reduction.h
flang/include/flang/Runtime/reduction.h
flang/lib/Lower/IntrinsicCall.cpp
flang/lib/Optimizer/Builder/Runtime/Reduction.cpp
flang/runtime/extrema.cpp
flang/test/Lower/Intrinsics/norm2.f90
|
If the mask argument of the runtime is not needed for NORM2, I would rather prefer we remove it from the runtime signature if @klausler can confirm it had no purpose.