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
22 "Compile Fortran runtime as CUDA sources (experimental)" OFF
33 )
44
5+ option (FLANG_CUDA_RUNTIME_PTX_WITHOUT_GLOBAL_VARS
6+ "Do not compile global variables' definitions when producing PTX library" OFF
7+ )
8+
59set (FLANG_LIBCUDACXX_PATH "" CACHE PATH "Path to libcu++ package installation" )
610
711set (FLANG_EXPERIMENTAL_OMP_OFFLOAD_BUILD "off" CACHE STRING
@@ -56,6 +60,11 @@ macro(enable_cuda_compilation name files)
5660 # Add an OBJECT library consisting of CUDA PTX.
5761 llvm_add_library(${name} PTX OBJECT PARTIAL_SOURCES_INTENDED ${files} )
5862 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 ()
5968 endif ()
6069endmacro ()
6170
Original file line number Diff line number Diff line change @@ -23,9 +23,11 @@ extern char **environ;
2323
2424namespace Fortran ::runtime {
2525
26+ #ifndef FLANG_RUNTIME_NO_GLOBAL_VAR_DEFS
2627RT_OFFLOAD_VAR_GROUP_BEGIN
2728RT_VAR_ATTRS ExecutionEnvironment executionEnvironment;
2829RT_OFFLOAD_VAR_GROUP_END
30+ #endif // FLANG_RUNTIME_NO_GLOBAL_VAR_DEFS
2931
3032static void SetEnvironmentDefaults (const EnvironmentDefaultList *envDefaults) {
3133 if (!envDefaults) {
Original file line number Diff line number Diff line change 1919
2020namespace Fortran ::runtime::io {
2121
22+ #ifndef FLANG_RUNTIME_NO_GLOBAL_VAR_DEFS
2223RT_OFFLOAD_VAR_GROUP_BEGIN
2324RT_VAR_ATTRS ExternalFileUnit *defaultInput{nullptr }; // unit 5
2425RT_VAR_ATTRS ExternalFileUnit *defaultOutput{nullptr }; // unit 6
2526RT_VAR_ATTRS ExternalFileUnit *errorOutput{nullptr }; // unit 0 extension
2627RT_OFFLOAD_VAR_GROUP_END
28+ #endif // FLANG_RUNTIME_NO_GLOBAL_VAR_DEFS
2729
2830RT_OFFLOAD_API_GROUP_BEGIN
2931
Original file line number Diff line number Diff line change 1010
1111namespace Fortran ::runtime {
1212
13+ #ifndef FLANG_RUNTIME_NO_GLOBAL_VAR_DEFS
1314// clang-format off
1415RT_OFFLOAD_VAR_GROUP_BEGIN
1516const RT_CONST_VAR_ATTRS std::uint8_t UTF8FirstByteTable[256 ]{
@@ -40,6 +41,7 @@ const RT_CONST_VAR_ATTRS std::uint8_t UTF8FirstByteTable[256]{
4041};
4142RT_OFFLOAD_VAR_GROUP_END
4243// clang-format on
44+ #endif // FLANG_RUNTIME_NO_GLOBAL_VAR_DEFS
4345
4446RT_OFFLOAD_API_GROUP_BEGIN
4547// Non-minimal encodings are accepted.
You can’t perform that action at this time.
0 commit comments