Skip to content

Commit 38b2755

Browse files
authored
Revert "[flang][cuda] Implicitly load cudadevice module in device/global subprogram" (#91827)
Reverts #91668
1 parent 504cf55 commit 38b2755

File tree

9 files changed

+1
-181
lines changed

9 files changed

+1
-181
lines changed

flang/include/flang/Semantics/semantics.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -215,10 +215,8 @@ class SemanticsContext {
215215
void UseFortranBuiltinsModule();
216216
const Scope *GetBuiltinsScope() const { return builtinsScope_; }
217217

218-
const Scope &GetCUDABuiltinsScope();
219-
const Scope &GetCUDADeviceScope();
220-
221218
void UsePPCBuiltinTypesModule();
219+
const Scope &GetCUDABuiltinsScope();
222220
void UsePPCBuiltinsModule();
223221
Scope *GetPPCBuiltinTypesScope() { return ppcBuiltinTypesScope_; }
224222
const Scope *GetPPCBuiltinsScope() const { return ppcBuiltinsScope_; }
@@ -294,7 +292,6 @@ class SemanticsContext {
294292
const Scope *builtinsScope_{nullptr}; // module __Fortran_builtins
295293
Scope *ppcBuiltinTypesScope_{nullptr}; // module __Fortran_PPC_types
296294
std::optional<const Scope *> cudaBuiltinsScope_; // module __CUDA_builtins
297-
std::optional<const Scope *> cudaDeviceScope_; // module cudadevice
298295
const Scope *ppcBuiltinsScope_{nullptr}; // module __ppc_intrinsics
299296
std::list<parser::Program> modFileParseTrees_;
300297
std::unique_ptr<CommonBlockMap> commonBlockMap_;

flang/lib/Semantics/check-cuda.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,6 @@ struct DeviceExprChecker
8282
}
8383
}
8484
}
85-
if (sym->owner().IsModule() &&
86-
sym->owner().parent().IsIntrinsicModules() &&
87-
DEREF(sym->owner().symbol()).name() == "__cuda_device_builtins") {
88-
return {};
89-
}
9085
} else if (x.GetSpecificIntrinsic()) {
9186
// TODO(CUDA): Check for unsupported intrinsics here
9287
return {};

flang/lib/Semantics/resolve-names.cpp

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3797,19 +3797,6 @@ bool SubprogramVisitor::Pre(const parser::PrefixSpec::Attributes &attrs) {
37973797
subp->set_cudaSubprogramAttrs(attr);
37983798
}
37993799
}
3800-
if (auto attrs{subp->cudaSubprogramAttrs()}) {
3801-
if (*attrs == common::CUDASubprogramAttrs::Global ||
3802-
*attrs == common::CUDASubprogramAttrs::Device) {
3803-
// Implicitly USE the cudadevice module by copying its symbols in the
3804-
// current scope.
3805-
const Scope &scope{context().GetCUDADeviceScope()};
3806-
for (auto sym : scope.GetSymbols()) {
3807-
if (!currScope().FindSymbol(sym->name())) {
3808-
currScope().CopySymbol(sym);
3809-
}
3810-
}
3811-
}
3812-
}
38133800
}
38143801
return false;
38153802
}

flang/lib/Semantics/semantics.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -543,14 +543,6 @@ const Scope &SemanticsContext::GetCUDABuiltinsScope() {
543543
return **cudaBuiltinsScope_;
544544
}
545545

546-
const Scope &SemanticsContext::GetCUDADeviceScope() {
547-
if (!cudaDeviceScope_) {
548-
cudaDeviceScope_ = GetBuiltinModule("cudadevice");
549-
CHECK(cudaDeviceScope_.value() != nullptr);
550-
}
551-
return **cudaDeviceScope_;
552-
}
553-
554546
void SemanticsContext::UsePPCBuiltinsModule() {
555547
if (ppcBuiltinsScope_ == nullptr) {
556548
ppcBuiltinsScope_ = GetBuiltinModule("__ppc_intrinsics");

flang/module/__cuda_device_builtins.f90

Lines changed: 0 additions & 74 deletions
This file was deleted.

flang/module/cudadevice.f90

Lines changed: 0 additions & 21 deletions
This file was deleted.

flang/test/Semantics/cuf-device-procedures01.cuf

Lines changed: 0 additions & 35 deletions
This file was deleted.

flang/test/Semantics/cuf-device-procedures02.cuf

Lines changed: 0 additions & 17 deletions
This file was deleted.

flang/tools/f18/CMakeLists.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ set(MODULES
1212
"__ppc_intrinsics"
1313
"mma"
1414
"__cuda_builtins"
15-
"__cuda_device_builtins"
16-
"cudadevice"
1715
"ieee_arithmetic"
1816
"ieee_exceptions"
1917
"ieee_features"
@@ -33,8 +31,6 @@ if (NOT CMAKE_CROSSCOMPILING)
3331
elseif(${filename} STREQUAL "__ppc_intrinsics" OR
3432
${filename} STREQUAL "mma")
3533
set(depends ${FLANG_INTRINSIC_MODULES_DIR}/__ppc_types.mod)
36-
elseif(${filename} STREQUAL "cudadevice")
37-
set(depends ${FLANG_INTRINSIC_MODULES_DIR}/__cuda_device_builtins.mod)
3834
else()
3935
set(depends ${FLANG_INTRINSIC_MODULES_DIR}/__fortran_builtins.mod)
4036
if(NOT ${filename} STREQUAL "__fortran_type_info")

0 commit comments

Comments
 (0)