12 Commits

Author SHA1 Message Date
Zhen Wang
51937fc996
Revert "[flang][OpenMP] Use cuf.alloc for privatization of CUDA Fortr… (#186891)
…an device arrays (#185984)"

This reverts commit fb18d570b0466ca2a401aba11d6e58b206aebc1a.

This PR caused compilation failures with allocatable arrays, reverting
now for more investigation.
2026-03-16 21:51:07 +00:00
Zhen Wang
fb18d570b0
[flang][OpenMP] Use cuf.alloc for privatization of CUDA Fortran device arrays (#185984)
When CUDA Fortran device arrays are listed in an OpenMP private clause,
the compiler previously allocated private copies on the host heap using
fir.allocmem. This caused device-side operations to receive host
pointers instead of device pointers, leading to cudaErrorIllegalAddress
(700).

Fix by detecting symbols with a CUDA data attribute (device, managed,
unified, etc.) during privatization and using cuf.alloc / cuf.free
instead of fir.allocmem / fir.freemem, so the private copies reside in
device memory.
2026-03-13 16:18:14 +00:00
Valentin Clement (バレンタイン クレメン)
a224ba0689
[flang][cuda] Support data transfer with parenthesis around rhs (#183201) 2026-02-25 10:44:31 -08:00
Valentin Clement (バレンタイン クレメン)
f57f338313
[flang][cuda] Add double descriptor information in allocate/deallocate operations (#170901)
After https://github.com/llvm/llvm-project/pull/169740, the allocate and
deallocate cuf operation can be converted later. Update the way to
recognize double descriptor case by adding this information directly on
the operation itself.
2025-12-05 11:08:45 -08:00
Valentin Clement (バレンタイン クレメン)
e55071b157
[flang][cuda] Extent detection of data transfer with conversion (#163852) 2025-10-16 20:33:50 +00:00
Valentin Clement (バレンタイン クレメン)
3e9802159b
[flang][cuda] Remove set_allocator_idx operation (#157747)
The allocator index is set from the component genre #157731 . There is
no more need of an operation to set it at a later point.
2025-09-09 14:20:19 -07:00
Valentin Clement (バレンタイン クレメン)
f9b9e9b7d5
[flang][cuda] Fix buildbot failure after #153242 (#153500) 2025-08-13 14:54:33 -07:00
Valentin Clement (バレンタイン クレメン)
a2899c457e
[flang][cuda] Support data transfer with conversion (#153242)
When the rhs of the data transfer is from a different type, allocate a
new temp on the host and first transfer the rhs to it. Then, use the
elemental op created to do the conversion.
2025-08-13 10:55:15 -07:00
Valentin Clement (バレンタイン クレメン)
35f003d13b
[flang][cuda] Fix buildbot after #152418 (#152437) 2025-08-06 22:24:35 -07:00
Valentin Clement (バレンタイン クレメン)
eb0ddba26b
Reland "[flang][cuda] Set the allocator of derived type component after allocation" (#152418)
Reviewed in #152379
- Move the allocator index set up after the allocate statement otherwise
the derived type descriptor is not allocated.
- Support array of derived-type with device component
2025-08-06 21:49:55 -07:00
Valentin Clement (バレンタイン クレメン)
7d3134f6cc
Revert "[flang][cuda] Set the allocator of derived type component after allocation" (#152402)
Reverts llvm/llvm-project#152379

Buildbot failure
https://lab.llvm.org/buildbot/#/builders/207/builds/4905
2025-08-06 15:55:53 -07:00
Valentin Clement (バレンタイン クレメン)
d897355876
[flang][cuda] Set the allocator of derived type component after allocation (#152379)
- Move the allocator index set up after the allocate statement otherwise
the derived type descriptor is not allocated.
- Support array of derived-type with device component
2025-08-06 15:14:00 -07:00