[Mlir-commits] [flang] [mlir] [acc][flang] Add isDeviceData APIs for device data detection (PR #176219)
Valentin Clement バレンタイン クレメン
llvmlistbot at llvm.org
Thu Jan 15 10:57:15 PST 2026
================
@@ -1487,4 +1489,131 @@ template bool OpenACCPointerLikeModel<fir::LLVMPointerType>::genStore(
mlir::Value valueToStore,
mlir::TypedValue<mlir::acc::PointerLikeType> destPtr) const;
+/// Helper function to check if a CUDA attribute represents device data.
+static bool isCUDADeviceAttribute(cuf::DataAttribute attr) {
+ return attr == cuf::DataAttribute::Device ||
+ attr == cuf::DataAttribute::Managed ||
+ attr == cuf::DataAttribute::Constant ||
+ attr == cuf::DataAttribute::Shared ||
+ attr == cuf::DataAttribute::Unified;
+}
+
+/// Helper function to check if an operation has CUDA device data attributes.
+static bool hasCUDADeviceDataAttr(mlir::Operation *op) {
+ if (!op)
+ return false;
+
+ // Check for CUF data attribute on the operation
+ if (auto dataAttr = cuf::getDataAttr(op)) {
+ if (isCUDADeviceAttribute(dataAttr.getValue()))
+ return true;
+ }
----------------
clementval wrote:
no braces
https://github.com/llvm/llvm-project/pull/176219
More information about the Mlir-commits
mailing list