[flang-commits] [flang] [flang][cuda] Add new entry points function for data transfer (PR #108244)

Valentin Clement バレンタイン クレメン via flang-commits flang-commits at lists.llvm.org
Mon Sep 16 09:33:05 PDT 2024


================
@@ -0,0 +1,45 @@
+//===-- include/flang/Runtime/CUDA/memory.h ---------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef FORTRAN_RUNTIME_CUDA_MEMORY_H_
+#define FORTRAN_RUNTIME_CUDA_MEMORY_H_
+
+#include "flang/Runtime/descriptor.h"
+#include "flang/Runtime/entry-names.h"
+#include <cstddef>
+
+static constexpr unsigned kHostToDevice = 0;
+static constexpr unsigned kDeviceToHost = 1;
+static constexpr unsigned kDeviceToDevice = 2;
+
+namespace Fortran::runtime::cuda {
+
+extern "C" {
+
+// Set value to the data hold by a descriptor.
+void RTDECL(CUFMemsetDescriptor)(const Descriptor &desc, void *value,
+    const char *sourceFile = nullptr, int sourceLine = 0);
+
+// Data transfer from a pointer to a descriptor.
+void RTDECL(CUFDataTransferDescPtr)(const Descriptor &dst, void *src,
+    std::size_t bytes, unsigned mode, const char *sourceFile = nullptr,
+    int sourceLine = 0);
+
+// Data transfer from a descriptor to a pointer.
+void RTDECL(CUFDataTransferPtrDesc)(void *dst, const Descriptor &src,
+    std::size_t bytes, unsigned mode, const char *sourceFile = nullptr,
+    int sourceLine = 0);
+
+// Data transfer from a descriptor to a descriptor.
+void RTDECL(CUFDataTransferDescDesc)(const Descriptor &dst,
+    const Descriptor &src, unsigned mode, const char *sourceFile = nullptr,
----------------
clementval wrote:

@vzakhari Do you have any more concerns about these new entry points?

https://github.com/llvm/llvm-project/pull/108244


More information about the flang-commits mailing list