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
2 changes: 2 additions & 0 deletions flang/lib/Lower/ConvertCall.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,8 @@ Fortran::lower::genCallOpAndResult(
!cuf::isCUDADeviceContext(builder.getRegion())) {
for (auto [oper, arg] :
llvm::zip(operands, caller.getPassedArguments())) {
if (arg.testTKR(Fortran::common::IgnoreTKR::Contiguous))
continue;
if (auto boxTy = mlir::dyn_cast<fir::BaseBoxType>(oper.getType())) {
const Fortran::semantics::Symbol *sym = caller.getDummySymbol(arg);
if (sym && Fortran::evaluate::IsCUDADeviceSymbol(*sym))
Expand Down
25 changes: 20 additions & 5 deletions flang/test/Lower/CUDA/cuda-runtime-check.cuf
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ contains
call foo(a(1:10,1:10:2))
end subroutine

! CHECK-LABEL: func.func @_QMsection_testPtest_host()
! CHECK: fir.call @_FortranACUFDescriptorCheckSection
! CHECK: fir.call @_QMsection_testPfoo

attributes(device) subroutine zoo(a)
real, device, dimension(:,:) :: a
end subroutine
Expand All @@ -25,12 +29,23 @@ contains
allocate(a(10,10))
call zoo(a(1:10,1:10:2))
end subroutine
end module

! CHECK-LABEL: func.func @_QMsection_testPtest_host()
! CHECK: fir.call @_FortranACUFDescriptorCheckSection
! CHECK: fir.call @_QMsection_testPfoo

! CHECK-LABEL: func.func @_QMsection_testPtest_device()
! CHECK-NOT: fir.call @_FortranACUFDescriptorCheckSection
! CHECK: fir.call @_QMsection_testPzoo

subroutine ignore(a)
real, device, dimension(:,:) :: a
!dir$ ignore_tkr(c) a
end subroutine

subroutine test_host2()
real, device, allocatable, dimension(:,:) :: a
allocate(a(10,10))
call ignore(a(1:10,1:10:2))
end subroutine

! CHECK-LABEL: func.func @_QMsection_testPtest_host2()
! CHECK-NOT: fir.call @_FortranACUFDescriptorCheckSection
! CHECK: fir.call @_QMsection_testPignore
end module