Skip to content

[flang][cuda] Add proper TODO for cuda fortran assignment #85705

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 1 commit into from
Mar 19, 2024
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
14 changes: 14 additions & 0 deletions flang/include/flang/Evaluate/tools.h
Original file line number Diff line number Diff line change
Expand Up @@ -1218,6 +1218,20 @@ bool CheckForCoindexedObject(parser::ContextualMessages &,
const std::optional<ActualArgument> &, const std::string &procName,
const std::string &argName);

/// Check if any of the symbols part of the expression has a cuda data
/// attribute.
inline bool HasCUDAAttrs(const Expr<SomeType> &expr) {
for (const Symbol &sym : CollectSymbols(expr)) {
if (const auto *details =
sym.GetUltimate().detailsIf<semantics::ObjectEntityDetails>()) {
if (details->cudaDataAttr()) {
return true;
}
}
}
return false;
}

} // namespace Fortran::evaluate

namespace Fortran::semantics {
Expand Down
5 changes: 5 additions & 0 deletions flang/lib/Lower/Bridge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3692,6 +3692,11 @@ class FirConverter : public Fortran::lower::AbstractConverter {
const Fortran::evaluate::ProcedureRef *userDefinedAssignment) {
mlir::Location loc = getCurrentLocation();
fir::FirOpBuilder &builder = getFirOpBuilder();

if (Fortran::evaluate::HasCUDAAttrs(assign.lhs) ||
Fortran::evaluate::HasCUDAAttrs(assign.rhs))
TODO(loc, "Assignement with CUDA Fortran variables");

// Gather some information about the assignment that will impact how it is
// lowered.
const bool isWholeAllocatableAssignment =
Expand Down
2 changes: 1 addition & 1 deletion flang/test/Lower/CUDA/cuda-module-use.cuf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

subroutine sub1()
use cuf_mod
md = 1.0
! md = 1.0 ! currently a TODO
end

! CHECK-LABEL: func.func @_QPsub1()
Expand Down