[all-commits] [llvm/llvm-project] c2892b: [flang-rt] Optimise ShallowCopy and use it in Copy...
Kajetan Puchalski via All-commits
all-commits at lists.llvm.org
Thu May 22 07:12:09 PDT 2025
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: c2892b0bdfb34bd4a79f357ee2f234a29f9e49f4
https://github.com/llvm/llvm-project/commit/c2892b0bdfb34bd4a79f357ee2f234a29f9e49f4
Author: Kajetan Puchalski <kajetan.puchalski at arm.com>
Date: 2025-05-22 (Thu, 22 May 2025)
Changed paths:
M flang-rt/include/flang-rt/runtime/descriptor.h
M flang-rt/include/flang-rt/runtime/tools.h
M flang-rt/lib/runtime/assign.cpp
M flang-rt/lib/runtime/tools.cpp
A flang-rt/unittests/Runtime/Assign.cpp
M flang-rt/unittests/Runtime/CMakeLists.txt
Log Message:
-----------
[flang-rt] Optimise ShallowCopy and use it in CopyInAssign (#140569)
Using Descriptor.Element<>() when iterating through a rank-1 array is
currently inefficient, because the generic implementation suitable for
arrays of any rank makes the compiler unable to perform optimisations
that would make the rank-1 case considerably faster.
This is currently done inside ShallowCopy, as well as by CopyInAssign,
where the implementation of elemental copies (inside Assign) is
equivalent to ShallowCopyDiscontiguousToDiscontiguous.
To address that, add a DescriptorIterator abstraction specialised for
arrays of various ranks, and use that throughout ShallowCopy to iterate
over the arrays.
Furthermore, depending on the pointer type passed to memcpy, the
optimiser can remove the memcpy calls from ShallowCopy altogether which
can result in substantial performance improvements on its own.
Specialise ShallowCopy for various element pointer types to make these
optimisations possible.
Finally, replace the call to Assign inside CopyInAssign with a call to
newly optimised ShallowCopy.
For the thornado-mini application, this reduces the runtime by 27.7%.
---------
Signed-off-by: Kajetan Puchalski <kajetan.puchalski at arm.com>
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list