[flang-commits] [flang] [llvm] [flang-rt] Add APIs to retrive base_addr and DataSizeInBytes from Descriptor. (PR #152756)
via flang-commits
flang-commits at lists.llvm.org
Tue Aug 19 02:14:55 PDT 2025
skc7 wrote:
> There is a `fir.box_addr` operation that will return the base address directly without the need of a runtime call. But in your case I think you probably want to have a specific entry point for OpenMP that takes two flang descriptors or a flang descriptor and a pointer because you will need to take into account more than just the base adds and the size. You need to know if both descriptor are contiguous or not, if they are the same size and so on.
>
> There is a pretty similar use case with the CUDA Fortran data transfer on assignment and the runtime entry point is taking descriptor directly. I would suggest to do the same.
For PR #140523, fortran runtime `assign` call in omp.target needs to be hoisted out, and to be replaced by new API, which does memcpy of device pointers. But this required openmp runtime dependency as in #145465(initial PR for this work).
I have looked at CUDA runtimeAPIs which internally call cuda runtime calls like below.
We are not looking to have any openmp runtime dependency on flang-rt APIs as in #145465
"""
void RTDEF(CUFDescriptorSync)(Descriptor *dst, const Descriptor *src,
const char *sourceFile, int sourceLine) {
std::size_t count{src->SizeInBytes()};
CUDA_REPORT_IF_ERROR(**cudaMemcpy**(
(void *)dst, (const void *)src, count, cudaMemcpyHostToDevice));
}
"""
https://github.com/llvm/llvm-project/pull/152756
More information about the flang-commits
mailing list