[flang-commits] [flang] 72f3804 - Removing CUF runtime dependency with llvm::EnableABIBreakingChecks (#111200)
via flang-commits
flang-commits at lists.llvm.org
Fri Oct 4 13:18:12 PDT 2024
Author: Renaud Kauffmann
Date: 2024-10-04T13:18:08-07:00
New Revision: 72f38040ddc8c2eca712c29b86ea0209faab4d57
URL: https://github.com/llvm/llvm-project/commit/72f38040ddc8c2eca712c29b86ea0209faab4d57
DIFF: https://github.com/llvm/llvm-project/commit/72f38040ddc8c2eca712c29b86ea0209faab4d57.diff
LOG: Removing CUF runtime dependency with llvm::EnableABIBreakingChecks (#111200)
getMemType happens to only be used in CufOpConversion.cpp. So, moving it
here for now. If it needs to be shared with the runtime, then care
should be taken in not bringing the include `#include
"flang/Optimizer/Dialect/CUF/Attributes/CUFAttr.h"` which introduces the
dependency with llvm::EnableABIBreakingChecks
Added:
Modified:
flang/include/flang/Runtime/CUDA/common.h
flang/lib/Optimizer/Transforms/CufOpConversion.cpp
Removed:
################################################################################
diff --git a/flang/include/flang/Runtime/CUDA/common.h b/flang/include/flang/Runtime/CUDA/common.h
index 4abccf5b341cf7..b73bc390ea8c9e 100644
--- a/flang/include/flang/Runtime/CUDA/common.h
+++ b/flang/include/flang/Runtime/CUDA/common.h
@@ -9,7 +9,6 @@
#ifndef FORTRAN_RUNTIME_CUDA_COMMON_H_
#define FORTRAN_RUNTIME_CUDA_COMMON_H_
-#include "flang/Optimizer/Dialect/CUF/Attributes/CUFAttr.h"
#include "flang/Runtime/descriptor.h"
#include "flang/Runtime/entry-names.h"
@@ -35,16 +34,4 @@ static constexpr unsigned kDeviceToDevice = 2;
terminator.Crash("'%s' failed with '%s'", #expr, name); \
}(expr)
-static inline unsigned getMemType(cuf::DataAttribute attr) {
- if (attr == cuf::DataAttribute::Device)
- return kMemTypeDevice;
- if (attr == cuf::DataAttribute::Managed)
- return kMemTypeManaged;
- if (attr == cuf::DataAttribute::Unified)
- return kMemTypeUnified;
- if (attr == cuf::DataAttribute::Pinned)
- return kMemTypePinned;
- llvm::report_fatal_error("unsupported memory type");
-}
-
#endif // FORTRAN_RUNTIME_CUDA_COMMON_H_
diff --git a/flang/lib/Optimizer/Transforms/CufOpConversion.cpp b/flang/lib/Optimizer/Transforms/CufOpConversion.cpp
index 5870b0985532d2..24dc8e2354b120 100644
--- a/flang/lib/Optimizer/Transforms/CufOpConversion.cpp
+++ b/flang/lib/Optimizer/Transforms/CufOpConversion.cpp
@@ -36,6 +36,18 @@ using namespace Fortran::runtime::cuda;
namespace {
+static inline unsigned getMemType(cuf::DataAttribute attr) {
+ if (attr == cuf::DataAttribute::Device)
+ return kMemTypeDevice;
+ if (attr == cuf::DataAttribute::Managed)
+ return kMemTypeManaged;
+ if (attr == cuf::DataAttribute::Unified)
+ return kMemTypeUnified;
+ if (attr == cuf::DataAttribute::Pinned)
+ return kMemTypePinned;
+ llvm::report_fatal_error("unsupported memory type");
+}
+
template <typename OpTy>
static bool isPinned(OpTy op) {
if (op.getDataAttr() && *op.getDataAttr() == cuf::DataAttribute::Pinned)
More information about the flang-commits
mailing list