File tree Expand file tree Collapse file tree 4 files changed +15
-0
lines changed Expand file tree Collapse file tree 4 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,10 @@ option(FLANG_EXPERIMENTAL_CUDA_RUNTIME
2
2
"Compile Fortran runtime as CUDA sources (experimental)" OFF
3
3
)
4
4
5
+ option (FLANG_CUDA_RUNTIME_PTX_WITHOUT_GLOBAL_VARS
6
+ "Do not compile global variables' definitions when producing PTX library" OFF
7
+ )
8
+
5
9
set (FLANG_LIBCUDACXX_PATH "" CACHE PATH "Path to libcu++ package installation" )
6
10
7
11
set (FLANG_EXPERIMENTAL_OMP_OFFLOAD_BUILD "off" CACHE STRING
@@ -56,6 +60,11 @@ macro(enable_cuda_compilation name files)
56
60
# Add an OBJECT library consisting of CUDA PTX.
57
61
llvm_add_library(${name} PTX OBJECT PARTIAL_SOURCES_INTENDED ${files} )
58
62
set_property (TARGET obj.${name} PTX PROPERTY CUDA_PTX_COMPILATION ON )
63
+ if (FLANG_CUDA_RUNTIME_PTX_WITHOUT_GLOBAL_VARS)
64
+ target_compile_definitions (obj.${name} PTX
65
+ PRIVATE FLANG_RUNTIME_NO_GLOBAL_VAR_DEFS
66
+ )
67
+ endif ()
59
68
endif ()
60
69
endmacro ()
61
70
Original file line number Diff line number Diff line change @@ -23,9 +23,11 @@ extern char **environ;
23
23
24
24
namespace Fortran ::runtime {
25
25
26
+ #ifndef FLANG_RUNTIME_NO_GLOBAL_VAR_DEFS
26
27
RT_OFFLOAD_VAR_GROUP_BEGIN
27
28
RT_VAR_ATTRS ExecutionEnvironment executionEnvironment;
28
29
RT_OFFLOAD_VAR_GROUP_END
30
+ #endif // FLANG_RUNTIME_NO_GLOBAL_VAR_DEFS
29
31
30
32
static void SetEnvironmentDefaults (const EnvironmentDefaultList *envDefaults) {
31
33
if (!envDefaults) {
Original file line number Diff line number Diff line change 19
19
20
20
namespace Fortran ::runtime::io {
21
21
22
+ #ifndef FLANG_RUNTIME_NO_GLOBAL_VAR_DEFS
22
23
RT_OFFLOAD_VAR_GROUP_BEGIN
23
24
RT_VAR_ATTRS ExternalFileUnit *defaultInput{nullptr }; // unit 5
24
25
RT_VAR_ATTRS ExternalFileUnit *defaultOutput{nullptr }; // unit 6
25
26
RT_VAR_ATTRS ExternalFileUnit *errorOutput{nullptr }; // unit 0 extension
26
27
RT_OFFLOAD_VAR_GROUP_END
28
+ #endif // FLANG_RUNTIME_NO_GLOBAL_VAR_DEFS
27
29
28
30
RT_OFFLOAD_API_GROUP_BEGIN
29
31
Original file line number Diff line number Diff line change 10
10
11
11
namespace Fortran ::runtime {
12
12
13
+ #ifndef FLANG_RUNTIME_NO_GLOBAL_VAR_DEFS
13
14
// clang-format off
14
15
RT_OFFLOAD_VAR_GROUP_BEGIN
15
16
const RT_CONST_VAR_ATTRS std::uint8_t UTF8FirstByteTable[256 ]{
@@ -40,6 +41,7 @@ const RT_CONST_VAR_ATTRS std::uint8_t UTF8FirstByteTable[256]{
40
41
};
41
42
RT_OFFLOAD_VAR_GROUP_END
42
43
// clang-format on
44
+ #endif // FLANG_RUNTIME_NO_GLOBAL_VAR_DEFS
43
45
44
46
RT_OFFLOAD_API_GROUP_BEGIN
45
47
// Non-minimal encodings are accepted.
You can’t perform that action at this time.
0 commit comments