Skip to content
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

Revert "[flang][cuda] Implicitly load cudadevice module in device/global subprogram" #91827

Merged
merged 1 commit into from
May 11, 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
5 changes: 1 addition & 4 deletions flang/include/flang/Semantics/semantics.h
Original file line number Diff line number Diff line change
Expand Up @@ -215,10 +215,8 @@ class SemanticsContext {
void UseFortranBuiltinsModule();
const Scope *GetBuiltinsScope() const { return builtinsScope_; }

const Scope &GetCUDABuiltinsScope();
const Scope &GetCUDADeviceScope();

void UsePPCBuiltinTypesModule();
const Scope &GetCUDABuiltinsScope();
void UsePPCBuiltinsModule();
Scope *GetPPCBuiltinTypesScope() { return ppcBuiltinTypesScope_; }
const Scope *GetPPCBuiltinsScope() const { return ppcBuiltinsScope_; }
Expand Down Expand Up @@ -294,7 +292,6 @@ class SemanticsContext {
const Scope *builtinsScope_{nullptr}; // module __Fortran_builtins
Scope *ppcBuiltinTypesScope_{nullptr}; // module __Fortran_PPC_types
std::optional<const Scope *> cudaBuiltinsScope_; // module __CUDA_builtins
std::optional<const Scope *> cudaDeviceScope_; // module cudadevice
const Scope *ppcBuiltinsScope_{nullptr}; // module __ppc_intrinsics
std::list<parser::Program> modFileParseTrees_;
std::unique_ptr<CommonBlockMap> commonBlockMap_;
Expand Down
5 changes: 0 additions & 5 deletions flang/lib/Semantics/check-cuda.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,6 @@ struct DeviceExprChecker
}
}
}
if (sym->owner().IsModule() &&
sym->owner().parent().IsIntrinsicModules() &&
DEREF(sym->owner().symbol()).name() == "__cuda_device_builtins") {
return {};
}
} else if (x.GetSpecificIntrinsic()) {
// TODO(CUDA): Check for unsupported intrinsics here
return {};
Expand Down
13 changes: 0 additions & 13 deletions flang/lib/Semantics/resolve-names.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3797,19 +3797,6 @@ bool SubprogramVisitor::Pre(const parser::PrefixSpec::Attributes &attrs) {
subp->set_cudaSubprogramAttrs(attr);
}
}
if (auto attrs{subp->cudaSubprogramAttrs()}) {
if (*attrs == common::CUDASubprogramAttrs::Global ||
*attrs == common::CUDASubprogramAttrs::Device) {
// Implicitly USE the cudadevice module by copying its symbols in the
// current scope.
const Scope &scope{context().GetCUDADeviceScope()};
for (auto sym : scope.GetSymbols()) {
if (!currScope().FindSymbol(sym->name())) {
currScope().CopySymbol(sym);
}
}
}
}
}
return false;
}
Expand Down
8 changes: 0 additions & 8 deletions flang/lib/Semantics/semantics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -543,14 +543,6 @@ const Scope &SemanticsContext::GetCUDABuiltinsScope() {
return **cudaBuiltinsScope_;
}

const Scope &SemanticsContext::GetCUDADeviceScope() {
if (!cudaDeviceScope_) {
cudaDeviceScope_ = GetBuiltinModule("cudadevice");
CHECK(cudaDeviceScope_.value() != nullptr);
}
return **cudaDeviceScope_;
}

void SemanticsContext::UsePPCBuiltinsModule() {
if (ppcBuiltinsScope_ == nullptr) {
ppcBuiltinsScope_ = GetBuiltinModule("__ppc_intrinsics");
Expand Down
74 changes: 0 additions & 74 deletions flang/module/__cuda_device_builtins.f90

This file was deleted.

21 changes: 0 additions & 21 deletions flang/module/cudadevice.f90

This file was deleted.

35 changes: 0 additions & 35 deletions flang/test/Semantics/cuf-device-procedures01.cuf

This file was deleted.

17 changes: 0 additions & 17 deletions flang/test/Semantics/cuf-device-procedures02.cuf

This file was deleted.

4 changes: 0 additions & 4 deletions flang/tools/f18/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ set(MODULES
"__ppc_intrinsics"
"mma"
"__cuda_builtins"
"__cuda_device_builtins"
"cudadevice"
"ieee_arithmetic"
"ieee_exceptions"
"ieee_features"
Expand All @@ -33,8 +31,6 @@ if (NOT CMAKE_CROSSCOMPILING)
elseif(${filename} STREQUAL "__ppc_intrinsics" OR
${filename} STREQUAL "mma")
set(depends ${FLANG_INTRINSIC_MODULES_DIR}/__ppc_types.mod)
elseif(${filename} STREQUAL "cudadevice")
set(depends ${FLANG_INTRINSIC_MODULES_DIR}/__cuda_device_builtins.mod)
else()
set(depends ${FLANG_INTRINSIC_MODULES_DIR}/__fortran_builtins.mod)
if(NOT ${filename} STREQUAL "__fortran_type_info")
Expand Down
Loading