Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions flang/include/flang/Evaluate/tools.h
Original file line number Diff line number Diff line change
Expand Up @@ -1352,8 +1352,7 @@ inline bool IsCUDADataTransfer(const A &lhs, const B &rhs) {
// Special cases performed on the host:
// - Only managed or unifed symbols are involved on RHS and LHS.
// - LHS is managed or unified and the RHS is host only.
if ((lhsNbManagedSymbols >= 1 && rhsNbManagedSymbols == 1 &&
rhsNbSymbols == 1) ||
if ((lhsNbManagedSymbols >= 1 && rhsNbManagedSymbols == rhsNbSymbols) ||
(lhsNbManagedSymbols >= 1 && rhsNbSymbols == 0)) {
return false;
}
Expand Down
16 changes: 16 additions & 0 deletions flang/test/Lower/CUDA/cuda-data-transfer.cuf
Original file line number Diff line number Diff line change
Expand Up @@ -588,3 +588,19 @@ end subroutine
! CHECK: %{{.*}} = cuf.alloc !fir.type<_QMmod1Tt3{spheres:!fir.box<!fir.heap<!fir.array<?x!fir.type<_QMmod1Ts{c:!fir.array<3xf32>}>>>>}> {bindc_name = "t", data_attr = #cuf.cuda<managed>, uniq_name = "_QFsub30Et"} -> !fir.ref<!fir.type<_QMmod1Tt3{spheres:!fir.box<!fir.heap<!fir.array<?x!fir.type<_QMmod1Ts{c:!fir.array<3xf32>}>>>>}>>
! CHECK: hlfir.assign
! CHECK-NOT: cuf.data_transfer

! Test that assigment with only managed variables on both rhs and lhs is done
! on the host.

subroutine sub31()
type :: t30
real, managed, allocatable :: q(:)
end type
type(t30), managed, allocatable :: x(:)
x(4)%q = x(3)%q
end subroutine

! CHECK-LABEL: func.func @_QPsub31()
! CHECK: cuf.alloc !fir.box<!fir.heap<!fir.array<?x!fir.type<_QFsub31Tt30{q:!fir.box<!fir.heap<!fir.array<?xf32>>>}>>>>
! CHECK: hlfir.assign
! CHECK-NOT: cuf.data_transfer