Skip to content

[flang][cuda] Fix CUDA generic resolution for VALUE arguments in device procedures #140952

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jun 10, 2025
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
7 changes: 7 additions & 0 deletions flang/lib/Semantics/check-call.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1033,6 +1033,13 @@ static void CheckExplicitDataArg(const characteristics::DummyDataObject &dummy,
*actualDataAttr == common::CUDADataAttr::Managed)) {
actualDataAttr = common::CUDADataAttr::Device;
}
// For device procedures, treat actual arguments with VALUE attribute as
// device data
if (!actualDataAttr && actualLastSymbol && IsValue(*actualLastSymbol) &&
(*procedure.cudaSubprogramAttrs ==
common::CUDASubprogramAttrs::Device)) {
actualDataAttr = common::CUDADataAttr::Device;
}
}
if (dummyDataAttr == common::CUDADataAttr::Device &&
(dummyIsAssumedShape || dummyIsAssumedRank) &&
Expand Down
11 changes: 7 additions & 4 deletions flang/test/Semantics/cuf21.cuf
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,22 @@ module mlocModule
end interface maxlocUpdate
contains

attributes(global) subroutine maxlocPartialMaskR_32F1D()
attributes(global) subroutine maxlocPartialMaskR_32F1D(back)
implicit none
logical, intent(in), value :: back
real(4) :: mval

call maxlocUpdate(mval)
call maxlocUpdate(mval, back)

end subroutine maxlocPartialMaskR_32F1D

attributes(device) subroutine maxlocUpdateR_32F(mval)
attributes(device) subroutine maxlocUpdateR_32F(mval, back)
real(4) :: mval
logical :: back
end subroutine maxlocUpdateR_32F

attributes(device) subroutine maxlocUpdateR_64F(mval)
attributes(device) subroutine maxlocUpdateR_64F(mval, back)
real(8) :: mval
logical :: back
end subroutine maxlocUpdateR_64F
end module
Loading