[flang][cuda] Remove too restrictive assert for data transfer (#152398)
When the rhs is a an array element, the assert was triggered but this is still a valid transfer. Remove the assert. The operation has a verifier to check its validity.
This commit is contained in:
parent
8381f95dec
commit
2696e8c149
@ -4898,7 +4898,6 @@ private:
|
||||
|
||||
// device = device
|
||||
if (lhsIsDevice && rhsIsDevice) {
|
||||
assert(rhs.isVariable() && "CUDA Fortran assignment rhs is not legal");
|
||||
auto transferKindAttr = cuf::DataTransferKindAttr::get(
|
||||
builder.getContext(), cuf::DataTransferKind::DeviceDevice);
|
||||
cuf::DataTransferOp::create(builder, loc, rhsVal, lhsVal, shape,
|
||||
|
@ -444,3 +444,15 @@ subroutine sub23(n)
|
||||
end subroutine
|
||||
|
||||
! CHECK-LABEL: func.func @_QPsub23
|
||||
|
||||
subroutine sub24()
|
||||
real, managed :: m
|
||||
real, device :: d(4)
|
||||
m = d(1)
|
||||
end
|
||||
|
||||
! CHECK-LABEL: func.func @_QPsub24()
|
||||
! CHECK: %[[D:.*]]:2 = hlfir.declare %1(%2) {data_attr = #cuf.cuda<device>, uniq_name = "_QFsub24Ed"} : (!fir.ref<!fir.array<4xf32>>, !fir.shape<1>) -> (!fir.ref<!fir.array<4xf32>>, !fir.ref<!fir.array<4xf32>>)
|
||||
! CHECK: %[[M:.*]]:2 = hlfir.declare %4 {data_attr = #cuf.cuda<managed>, uniq_name = "_QFsub24Em"} : (!fir.ref<f32>) -> (!fir.ref<f32>, !fir.ref<f32>)
|
||||
! CHECK: %[[D1:.*]] = hlfir.designate %[[D]]#0 (%c1{{.*}}) : (!fir.ref<!fir.array<4xf32>>, index) -> !fir.ref<f32>
|
||||
! CHECK: cuf.data_transfer %[[D1]] to %[[M]]#0 {transfer_kind = #cuf.cuda_transfer<device_device>} : !fir.ref<f32>, !fir.ref<f32>
|
||||
|
Loading…
x
Reference in New Issue
Block a user