Skip to content

[flang][runtime][NFC] Allow different memmove function in assign #114301

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 1, 2024

Conversation

clementval
Copy link
Contributor

  • Add a parameter to the Assign function to be able to use a different memmove function. This is preparatory work to be able to use the Assign function between host and device data.

  • Expose the Assign function so it can be used from different files.

  • The new memmoveFct is not used in BlankPadCharacterAssignment yet since it is not clear if there is a need. It will be updated in case it is needed.

@clementval clementval changed the title [flang][runtime][NFC] Allow different memmov function in assign [flang][runtime][NFC] Allow different memmove function in assign Oct 30, 2024
@llvmbot llvmbot added flang:runtime flang Flang issues not falling into any other category labels Oct 30, 2024
@llvmbot
Copy link
Member

llvmbot commented Oct 30, 2024

@llvm/pr-subscribers-flang-runtime

Author: Valentin Clement (バレンタイン クレメン) (clementval)

Changes
  • Add a parameter to the Assign function to be able to use a different memmove function. This is preparatory work to be able to use the Assign function between host and device data.

  • Expose the Assign function so it can be used from different files.

  • The new memmoveFct is not used in BlankPadCharacterAssignment yet since it is not clear if there is a need. It will be updated in case it is needed.


Full diff: https://github.com/llvm/llvm-project/pull/114301.diff

2 Files Affected:

  • (modified) flang/include/flang/Runtime/assign.h (+23)
  • (modified) flang/runtime/assign.cpp (+8-19)
diff --git a/flang/include/flang/Runtime/assign.h b/flang/include/flang/Runtime/assign.h
index a1cc9eaf4355f6..ddd4d46f99ce3d 100644
--- a/flang/include/flang/Runtime/assign.h
+++ b/flang/include/flang/Runtime/assign.h
@@ -24,11 +24,34 @@
 #define FORTRAN_RUNTIME_ASSIGN_H_
 
 #include "flang/Runtime/entry-names.h"
+#include "flang/Runtime/freestanding-tools.h"
 
 namespace Fortran::runtime {
 class Descriptor;
+class Terminator;
+
+enum AssignFlags {
+  NoAssignFlags = 0,
+  MaybeReallocate = 1 << 0,
+  NeedFinalization = 1 << 1,
+  CanBeDefinedAssignment = 1 << 2,
+  ComponentCanBeDefinedAssignment = 1 << 3,
+  ExplicitLengthCharacterLHS = 1 << 4,
+  PolymorphicLHS = 1 << 5,
+  DeallocateLHS = 1 << 6
+};
+
+using MemmoveFct = void *(*)(void *, const void *, std::size_t);
+
+static void *MemmoveWrapper(void *dest, const void *src, std::size_t count) {
+  return Fortran::runtime::memmove(dest, src, count);
+}
+
+RT_API_ATTRS void Assign(Descriptor &to, const Descriptor &from,
+    Terminator &terminator, int flags, MemmoveFct memmoveFct = &MemmoveWrapper);
 
 extern "C" {
+
 // API for lowering assignment
 void RTDECL(Assign)(Descriptor &to, const Descriptor &from,
     const char *sourceFile = nullptr, int sourceLine = 0);
diff --git a/flang/runtime/assign.cpp b/flang/runtime/assign.cpp
index d558ada51cd21a..8f31fc4d127168 100644
--- a/flang/runtime/assign.cpp
+++ b/flang/runtime/assign.cpp
@@ -17,17 +17,6 @@
 
 namespace Fortran::runtime {
 
-enum AssignFlags {
-  NoAssignFlags = 0,
-  MaybeReallocate = 1 << 0,
-  NeedFinalization = 1 << 1,
-  CanBeDefinedAssignment = 1 << 2,
-  ComponentCanBeDefinedAssignment = 1 << 3,
-  ExplicitLengthCharacterLHS = 1 << 4,
-  PolymorphicLHS = 1 << 5,
-  DeallocateLHS = 1 << 6
-};
-
 // Predicate: is the left-hand side of an assignment an allocated allocatable
 // that must be deallocated?
 static inline RT_API_ATTRS bool MustDeallocateLHS(
@@ -250,8 +239,8 @@ static RT_API_ATTRS void BlankPadCharacterAssignment(Descriptor &to,
 // of elements, but their shape need not to conform (the assignment is done in
 // element sequence order). This facilitates some internal usages, like when
 // dealing with array constructors.
-RT_API_ATTRS static void Assign(
-    Descriptor &to, const Descriptor &from, Terminator &terminator, int flags) {
+RT_API_ATTRS void Assign(Descriptor &to, const Descriptor &from,
+    Terminator &terminator, int flags, MemmoveFct memmoveFct) {
   bool mustDeallocateLHS{(flags & DeallocateLHS) ||
       MustDeallocateLHS(to, from, terminator, flags)};
   DescriptorAddendum *toAddendum{to.Addendum()};
@@ -423,14 +412,14 @@ RT_API_ATTRS static void Assign(
             Assign(toCompDesc, fromCompDesc, terminator, nestedFlags);
           } else { // Component has intrinsic type; simply copy raw bytes
             std::size_t componentByteSize{comp.SizeInBytes(to)};
-            Fortran::runtime::memmove(to.Element<char>(toAt) + comp.offset(),
+            memmoveFct(to.Element<char>(toAt) + comp.offset(),
                 from.Element<const char>(fromAt) + comp.offset(),
                 componentByteSize);
           }
           break;
         case typeInfo::Component::Genre::Pointer: {
           std::size_t componentByteSize{comp.SizeInBytes(to)};
-          Fortran::runtime::memmove(to.Element<char>(toAt) + comp.offset(),
+          memmoveFct(to.Element<char>(toAt) + comp.offset(),
               from.Element<const char>(fromAt) + comp.offset(),
               componentByteSize);
         } break;
@@ -476,14 +465,14 @@ RT_API_ATTRS static void Assign(
         const auto &procPtr{
             *procPtrDesc.ZeroBasedIndexedElement<typeInfo::ProcPtrComponent>(
                 k)};
-        Fortran::runtime::memmove(to.Element<char>(toAt) + procPtr.offset,
+        memmoveFct(to.Element<char>(toAt) + procPtr.offset,
             from.Element<const char>(fromAt) + procPtr.offset,
             sizeof(typeInfo::ProcedurePointer));
       }
     }
   } else { // intrinsic type, intrinsic assignment
     if (isSimpleMemmove()) {
-      Fortran::runtime::memmove(to.raw().base_addr, from.raw().base_addr,
+      memmoveFct(to.raw().base_addr, from.raw().base_addr,
           toElements * toElementBytes);
     } else if (toElementBytes > fromElementBytes) { // blank padding
       switch (to.type().raw()) {
@@ -507,8 +496,8 @@ RT_API_ATTRS static void Assign(
     } else { // elemental copies, possibly with character truncation
       for (std::size_t n{toElements}; n-- > 0;
            to.IncrementSubscripts(toAt), from.IncrementSubscripts(fromAt)) {
-        Fortran::runtime::memmove(to.Element<char>(toAt),
-            from.Element<const char>(fromAt), toElementBytes);
+        memmoveFct(to.Element<char>(toAt), from.Element<const char>(fromAt),
+            toElementBytes);
       }
     }
   }

Copy link

github-actions bot commented Oct 31, 2024

✅ With the latest revision this PR passed the C/C++ code formatter.

Copy link
Contributor

@Renaud-K Renaud-K left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me. I know that you talked to Peter who has approved the design and with Jean off, maybe you can do a post commit review if needed.

@clementval clementval merged commit b278fe3 into main Nov 1, 2024
8 checks passed
@clementval clementval deleted the users/clementval/cuf_data_transfer_desc1 branch November 1, 2024 17:34
@clementval clementval restored the users/clementval/cuf_data_transfer_desc1 branch November 1, 2024 17:34
@llvm-ci
Copy link
Collaborator

llvm-ci commented Nov 1, 2024

LLVM Buildbot has detected a new failure on builder flang-runtime-cuda-gcc running on as-builder-7 while building flang at step 5 "build-FortranRuntime".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/152/builds/583

Here is the relevant piece of the build log for the reference
Step 5 (build-FortranRuntime) failure: build (failure)
...
0.086 [1/12/53] Building CUDA object CMakeFiles/FortranRuntime.dir/unit.cpp.o
0.090 [1/11/54] Building CUDA object CMakeFiles/FortranRuntime.dir/io-stmt.cpp.o
0.100 [1/10/55] Building CUDA object CMakeFiles/FortranRuntime.dir/io-api.cpp.o
0.125 [1/9/56] Building CUDA object CMakeFiles/FortranRuntime.dir/dot-product.cpp.o
0.150 [1/8/57] Building CUDA object CMakeFiles/FortranRuntime.dir/extrema.cpp.o
0.216 [1/7/58] Building CUDA object CMakeFiles/FortranRuntime.dir/matmul-transpose.cpp.o
0.262 [1/6/59] Building CUDA object CMakeFiles/FortranRuntime.dir/matmul.cpp.o
0.337 [1/5/60] Building CUDA object CMakeFiles/FortranRuntime.dir/findloc.cpp.o
1.980 [1/4/61] Building CXX object CMakeFiles/FortranRuntime.dir/temporary-stack.cpp.o
6.208 [1/3/62] Building CUDA object CMakeFiles/FortranRuntime.dir/allocatable.cpp.o
FAILED: CMakeFiles/FortranRuntime.dir/allocatable.cpp.o 
ccache /usr/local/cuda/bin/nvcc -forward-unknown-to-host-compiler -ccbin=/usr/bin/g++ -DFLANG_LITTLE_ENDIAN=1 -DGTEST_HAS_RTTI=0 -DRT_USE_LIBCUDACXX=1 -D_DEBUG -D_GLIBCXX_ASSERTIONS -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/buildbot/worker/as-builder-7/ramdisk/flang-runtime-cuda-gcc/llvm-project/flang/runtime/../include -I/home/buildbot/worker/as-builder-7/ramdisk/flang-runtime-cuda-gcc/build -I/home/buildbot/worker/third-party/nv/cccl/libcudacxx/include -G -g -O3 -DNDEBUG --generate-code=arch=compute_80,code=[compute_80,sm_80]   -U_GLIBCXX_ASSERTIONS -U_LIBCPP_ENABLE_ASSERTIONS -std=c++17  -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-rtti --expt-relaxed-constexpr -Xcudafe --diag_suppress=20208 -Xcudafe --display_error_number -MD -MT CMakeFiles/FortranRuntime.dir/allocatable.cpp.o -MF CMakeFiles/FortranRuntime.dir/allocatable.cpp.o.d -x cu -dc /home/buildbot/worker/as-builder-7/ramdisk/flang-runtime-cuda-gcc/llvm-project/flang/runtime/allocatable.cpp -o CMakeFiles/FortranRuntime.dir/allocatable.cpp.o
/home/buildbot/worker/as-builder-7/ramdisk/flang-runtime-cuda-gcc/llvm-project/flang/runtime/../include/flang/Runtime/assign.h(48): error: return value type does not match the function type
    return Fortran::runtime::memmove(dest, src, count);
           ^

1 error detected in the compilation of "/home/buildbot/worker/as-builder-7/ramdisk/flang-runtime-cuda-gcc/llvm-project/flang/runtime/allocatable.cpp".
6.876 [1/2/63] Building CUDA object CMakeFiles/FortranRuntime.dir/array-constructor.cpp.o
FAILED: CMakeFiles/FortranRuntime.dir/array-constructor.cpp.o 
ccache /usr/local/cuda/bin/nvcc -forward-unknown-to-host-compiler -ccbin=/usr/bin/g++ -DFLANG_LITTLE_ENDIAN=1 -DGTEST_HAS_RTTI=0 -DRT_USE_LIBCUDACXX=1 -D_DEBUG -D_GLIBCXX_ASSERTIONS -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/buildbot/worker/as-builder-7/ramdisk/flang-runtime-cuda-gcc/llvm-project/flang/runtime/../include -I/home/buildbot/worker/as-builder-7/ramdisk/flang-runtime-cuda-gcc/build -I/home/buildbot/worker/third-party/nv/cccl/libcudacxx/include -G -g -O3 -DNDEBUG --generate-code=arch=compute_80,code=[compute_80,sm_80]   -U_GLIBCXX_ASSERTIONS -U_LIBCPP_ENABLE_ASSERTIONS -std=c++17  -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-rtti --expt-relaxed-constexpr -Xcudafe --diag_suppress=20208 -Xcudafe --display_error_number -MD -MT CMakeFiles/FortranRuntime.dir/array-constructor.cpp.o -MF CMakeFiles/FortranRuntime.dir/array-constructor.cpp.o.d -x cu -dc /home/buildbot/worker/as-builder-7/ramdisk/flang-runtime-cuda-gcc/llvm-project/flang/runtime/array-constructor.cpp -o CMakeFiles/FortranRuntime.dir/array-constructor.cpp.o
/home/buildbot/worker/as-builder-7/ramdisk/flang-runtime-cuda-gcc/llvm-project/flang/runtime/../include/flang/Runtime/assign.h(48): error: return value type does not match the function type
    return Fortran::runtime::memmove(dest, src, count);
           ^

1 error detected in the compilation of "/home/buildbot/worker/as-builder-7/ramdisk/flang-runtime-cuda-gcc/llvm-project/flang/runtime/array-constructor.cpp".
7.222 [1/1/64] Building CUDA object CMakeFiles/FortranRuntime.dir/assign.cpp.o
FAILED: CMakeFiles/FortranRuntime.dir/assign.cpp.o 
ccache /usr/local/cuda/bin/nvcc -forward-unknown-to-host-compiler -ccbin=/usr/bin/g++ -DFLANG_LITTLE_ENDIAN=1 -DGTEST_HAS_RTTI=0 -DRT_USE_LIBCUDACXX=1 -D_DEBUG -D_GLIBCXX_ASSERTIONS -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/buildbot/worker/as-builder-7/ramdisk/flang-runtime-cuda-gcc/llvm-project/flang/runtime/../include -I/home/buildbot/worker/as-builder-7/ramdisk/flang-runtime-cuda-gcc/build -I/home/buildbot/worker/third-party/nv/cccl/libcudacxx/include -G -g -O3 -DNDEBUG --generate-code=arch=compute_80,code=[compute_80,sm_80]   -U_GLIBCXX_ASSERTIONS -U_LIBCPP_ENABLE_ASSERTIONS -std=c++17  -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-rtti --expt-relaxed-constexpr -Xcudafe --diag_suppress=20208 -Xcudafe --display_error_number -MD -MT CMakeFiles/FortranRuntime.dir/assign.cpp.o -MF CMakeFiles/FortranRuntime.dir/assign.cpp.o.d -x cu -dc /home/buildbot/worker/as-builder-7/ramdisk/flang-runtime-cuda-gcc/llvm-project/flang/runtime/assign.cpp -o CMakeFiles/FortranRuntime.dir/assign.cpp.o
/home/buildbot/worker/as-builder-7/ramdisk/flang-runtime-cuda-gcc/llvm-project/flang/runtime/../include/flang/Runtime/assign.h(48): error: return value type does not match the function type
    return Fortran::runtime::memmove(dest, src, count);
           ^

1 error detected in the compilation of "/home/buildbot/worker/as-builder-7/ramdisk/flang-runtime-cuda-gcc/llvm-project/flang/runtime/assign.cpp".
ninja: build stopped: subcommand failed.

@llvm-ci
Copy link
Collaborator

llvm-ci commented Nov 1, 2024

LLVM Buildbot has detected a new failure on builder flang-aarch64-libcxx running on linaro-flang-aarch64-libcxx while building flang at step 5 "build-unified-tree".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/89/builds/9626

Here is the relevant piece of the build log for the reference
Step 5 (build-unified-tree) failure: build (failure)
...
60.698 [167/3/7086] Linking CXX shared library lib/libclang-cpp.so.20.0git
60.705 [166/3/7087] Creating library symlink lib/libclang-cpp.so
64.499 [166/2/7088] Linking CXX shared library lib/libFortranSemantics.so.20.0git
64.507 [165/2/7089] Creating library symlink lib/libFortranSemantics.so
64.649 [160/6/7090] Linking CXX executable tools/flang/unittests/Evaluate/real.test
64.664 [160/5/7091] Linking CXX executable tools/flang/unittests/Evaluate/logical.test
64.679 [160/4/7092] Linking CXX executable tools/flang/unittests/Evaluate/integer.test
64.801 [160/3/7093] Linking CXX executable tools/flang/unittests/Evaluate/folding.test
64.862 [160/2/7094] Linking CXX executable tools/flang/unittests/Evaluate/expression.test
67.486 [160/1/7095] Building CXX object tools/flang/lib/Optimizer/Builder/CMakeFiles/FIRBuilder.dir/Runtime/Assign.cpp.o
FAILED: tools/flang/lib/Optimizer/Builder/CMakeFiles/FIRBuilder.dir/Runtime/Assign.cpp.o 
/usr/local/bin/c++ -DFLANG_INCLUDE_TESTS=1 -DFLANG_LITTLE_ENDIAN=1 -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/tcwg-buildbot/worker/flang-aarch64-libcxx/build/tools/flang/lib/Optimizer/Builder -I/home/tcwg-buildbot/worker/flang-aarch64-libcxx/llvm-project/flang/lib/Optimizer/Builder -I/home/tcwg-buildbot/worker/flang-aarch64-libcxx/llvm-project/flang/include -I/home/tcwg-buildbot/worker/flang-aarch64-libcxx/build/tools/flang/include -I/home/tcwg-buildbot/worker/flang-aarch64-libcxx/build/include -I/home/tcwg-buildbot/worker/flang-aarch64-libcxx/llvm-project/llvm/include -isystem /home/tcwg-buildbot/worker/flang-aarch64-libcxx/llvm-project/llvm/../mlir/include -isystem /home/tcwg-buildbot/worker/flang-aarch64-libcxx/build/tools/mlir/include -isystem /home/tcwg-buildbot/worker/flang-aarch64-libcxx/build/tools/clang/include -isystem /home/tcwg-buildbot/worker/flang-aarch64-libcxx/llvm-project/llvm/../clang/include -stdlib=libc++ -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -Werror -Wno-deprecated-copy -Wno-string-conversion -Wno-ctad-maybe-unsupported -Wno-unused-command-line-argument -Wstring-conversion           -Wcovered-switch-default -Wno-nested-anon-types -O3 -DNDEBUG -std=c++17 -fPIC  -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -MD -MT tools/flang/lib/Optimizer/Builder/CMakeFiles/FIRBuilder.dir/Runtime/Assign.cpp.o -MF tools/flang/lib/Optimizer/Builder/CMakeFiles/FIRBuilder.dir/Runtime/Assign.cpp.o.d -o tools/flang/lib/Optimizer/Builder/CMakeFiles/FIRBuilder.dir/Runtime/Assign.cpp.o -c /home/tcwg-buildbot/worker/flang-aarch64-libcxx/llvm-project/flang/lib/Optimizer/Builder/Runtime/Assign.cpp
In file included from ../llvm-project/flang/lib/Optimizer/Builder/Runtime/Assign.cpp:12:
../llvm-project/flang/include/flang/Runtime/assign.h:46:27: error: 'static' function 'MemmoveWrapper' declared in header file should be declared 'static inline' [-Werror,-Wunneeded-internal-declaration]
   46 | static RT_API_ATTRS void *MemmoveWrapper(
      |                           ^~~~~~~~~~~~~~
1 error generated.
ninja: build stopped: subcommand failed.

@llvm-ci
Copy link
Collaborator

llvm-ci commented Nov 1, 2024

LLVM Buildbot has detected a new failure on builder ppc64le-flang-rhel-clang running on ppc64le-flang-rhel-test while building flang at step 5 "build-unified-tree".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/157/builds/11656

Here is the relevant piece of the build log for the reference
Step 5 (build-unified-tree) failure: build (failure)
...
37.508 [488/8/6128] Building CXX object tools/mlir/test/lib/Transforms/CMakeFiles/MLIRTestTransforms.dir/TestDialectConversion.cpp.o
37.539 [488/7/6129] Building CXX object tools/mlir/test/lib/Tools/PDLL/CMakeFiles/MLIRTestPDLL.dir/TestPDLL.cpp.o
37.546 [488/6/6130] Linking CXX static library lib/libMLIRGPUToSPIRV.a
37.696 [487/6/6131] Linking CXX static library lib/libMLIRConvertToSPIRVPass.a
38.136 [487/5/6132] Building CXX object lib/Object/CMakeFiles/LLVMObject.dir/IRSymtab.cpp.o
45.842 [487/4/6133] Building CXX object lib/MC/MCParser/CMakeFiles/LLVMMCParser.dir/AsmParser.cpp.o
45.993 [486/4/6134] Linking CXX static library lib/libLLVMMCParser.a
46.178 [484/5/6135] Linking CXX static library lib/libLLVMPowerPCAsmParser.a
46.203 [481/7/6136] Linking CXX static library lib/libLLVMObject.a
46.228 [466/21/6137] Building CXX object tools/flang/lib/Optimizer/Builder/CMakeFiles/FIRBuilder.dir/Runtime/Assign.cpp.o
FAILED: tools/flang/lib/Optimizer/Builder/CMakeFiles/FIRBuilder.dir/Runtime/Assign.cpp.o 
ccache /home/buildbots/llvm-external-buildbots/clang.16.0.1/bin/clang++ -DFLANG_INCLUDE_TESTS=1 -DFLANG_LITTLE_ENDIAN=1 -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/build/tools/flang/lib/Optimizer/Builder -I/home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/llvm-project/flang/lib/Optimizer/Builder -I/home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/llvm-project/flang/include -I/home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/build/tools/flang/include -I/home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/build/include -I/home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/llvm-project/llvm/include -isystem /home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/llvm-project/llvm/../mlir/include -isystem /home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/build/tools/mlir/include -isystem /home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/build/tools/clang/include -isystem /home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/llvm-project/llvm/../clang/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -Werror -Wno-deprecated-copy -Wno-string-conversion -Wno-ctad-maybe-unsupported -Wno-unused-command-line-argument -Wstring-conversion           -Wcovered-switch-default -Wno-nested-anon-types -O3 -DNDEBUG -std=c++17  -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -MD -MT tools/flang/lib/Optimizer/Builder/CMakeFiles/FIRBuilder.dir/Runtime/Assign.cpp.o -MF tools/flang/lib/Optimizer/Builder/CMakeFiles/FIRBuilder.dir/Runtime/Assign.cpp.o.d -o tools/flang/lib/Optimizer/Builder/CMakeFiles/FIRBuilder.dir/Runtime/Assign.cpp.o -c /home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/llvm-project/flang/lib/Optimizer/Builder/Runtime/Assign.cpp
In file included from /home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/llvm-project/flang/lib/Optimizer/Builder/Runtime/Assign.cpp:12:
/home/buildbots/llvm-external-buildbots/workers/ppc64le-flang-rhel-test/ppc64le-flang-rhel-clang-build/llvm-project/flang/include/flang/Runtime/assign.h:46:27: error: 'static' function 'MemmoveWrapper' declared in header file should be declared 'static inline' [-Werror,-Wunneeded-internal-declaration]
static RT_API_ATTRS void *MemmoveWrapper(
                          ^
1 error generated.
46.426 [466/20/6138] Linking CXX static library lib/libLLVMXRay.a
46.434 [466/19/6139] Linking CXX static library lib/libLLVMDlltoolDriver.a
46.436 [466/18/6140] Linking CXX static library lib/libLLVMDebugInfoDWARF.a
46.444 [466/17/6141] Linking CXX static library lib/libLLVMRuntimeDyld.a
46.444 [466/16/6142] Linking CXX static library lib/libLLVMObjCopy.a
46.446 [466/15/6143] Linking CXX static library lib/libLLVMInterfaceStub.a
46.446 [466/14/6144] Linking CXX static library lib/libLLVMLibDriver.a
46.448 [466/13/6145] Linking CXX static library lib/libLLVMDebugInfoPDB.a
46.471 [466/12/6146] Linking CXX static library lib/libLLVMObjectYAML.a
46.499 [466/11/6147] Linking CXX static library lib/libLLVMJITLink.a
47.191 [466/10/6148] Linking CXX executable bin/llvm-ml
47.242 [466/9/6149] Linking CXX executable bin/llvm-strings
47.258 [466/8/6150] Linking CXX executable bin/llvm-mc
47.340 [466/7/6151] Linking CXX executable bin/llvm-mca
47.544 [466/6/6152] Linking CXX executable bin/llvm-size
47.625 [466/5/6153] Linking CXX executable bin/llvm-rc
47.708 [466/4/6154] Linking CXX executable bin/llvm-cvtres
47.890 [466/3/6155] Linking CXX executable bin/llvm-cxxdump
57.135 [466/2/6156] Building CXX object lib/CodeGen/AsmPrinter/CMakeFiles/LLVMAsmPrinter.dir/AsmPrinter.cpp.o
61.221 [466/1/6157] Building CXX object lib/LTO/CMakeFiles/LLVMLTO.dir/LTO.cpp.o
ninja: build stopped: subcommand failed.


using MemmoveFct = void *(*)(void *, const void *, std::size_t);

static RT_API_ATTRS void *MemmoveWrapper(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is the wrapper necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When building on the device the compiler is complaining when we address directly std:: function. Same was done in the allocator-registry

static RT_API_ATTRS void *MallocWrapper(std::size_t size) {
return std::malloc(size);
}
static RT_API_ATTRS void FreeWrapper(void *p) { return std::free(p); }

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the one that landed 7792dbe. Wrapper is not used on the host build.

smallp-o-p pushed a commit to smallp-o-p/llvm-project that referenced this pull request Nov 3, 2024
…m#114301)

- Add a parameter to the `Assign` function to be able to use a different
`memmove` function. This is preparatory work to be able to use the
`Assign` function between host and device data.
- Expose the `Assign` function so it can be used from different files. 

- The new `memmoveFct` is not used in `BlankPadCharacterAssignment` yet
since it is not clear if there is a need. It will be updated in case it
is needed.
smallp-o-p pushed a commit to smallp-o-p/llvm-project that referenced this pull request Nov 3, 2024
smallp-o-p pushed a commit to smallp-o-p/llvm-project that referenced this pull request Nov 3, 2024
NoumanAmir657 pushed a commit to NoumanAmir657/llvm-project that referenced this pull request Nov 4, 2024
…m#114301)

- Add a parameter to the `Assign` function to be able to use a different
`memmove` function. This is preparatory work to be able to use the
`Assign` function between host and device data.
- Expose the `Assign` function so it can be used from different files. 

- The new `memmoveFct` is not used in `BlankPadCharacterAssignment` yet
since it is not clear if there is a need. It will be updated in case it
is needed.
NoumanAmir657 pushed a commit to NoumanAmir657/llvm-project that referenced this pull request Nov 4, 2024
NoumanAmir657 pushed a commit to NoumanAmir657/llvm-project that referenced this pull request Nov 4, 2024
@clementval clementval deleted the users/clementval/cuf_data_transfer_desc1 branch December 4, 2024 18:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flang:runtime flang Flang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants