[flang-commits] [flang] Removing CUF runtime dependency with llvm::EnableABIBreakingChecks (PR #111200)
Renaud Kauffmann via flang-commits
flang-commits at lists.llvm.org
Fri Oct 4 12:35:46 PDT 2024
https://github.com/Renaud-K created https://github.com/llvm/llvm-project/pull/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
>From 5510f44845198c503d07114a07cb75690b28b464 Mon Sep 17 00:00:00 2001
From: Renaud-K <rkauffmann at nvidia.com>
Date: Fri, 4 Oct 2024 12:29:27 -0700
Subject: [PATCH] Removing CUF runtime dependency with
llvm::EnableABIBreakingChecks
---
flang/include/flang/Runtime/CUDA/common.h | 13 -------------
flang/lib/Optimizer/Transforms/CufOpConversion.cpp | 12 ++++++++++++
2 files changed, 12 insertions(+), 13 deletions(-)
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