CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
82 lines
2.9 KiB
CMake
82 lines
2.9 KiB
CMake
#===-- cmake/modules/AddFlangRTOffload.cmake -------------------------------===#
|
|
#
|
|
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
# See https://llvm.org/LICENSE.txt for license information.
|
|
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
#
|
|
#===------------------------------------------------------------------------===#
|
|
|
|
macro(enable_cuda_compilation name files)
|
|
if (FLANG_RT_EXPERIMENTAL_OFFLOAD_SUPPORT STREQUAL "CUDA")
|
|
if (FLANG_RT_ENABLE_SHARED)
|
|
message(FATAL_ERROR
|
|
"FLANG_RT_ENABLE_SHARED is not supported for CUDA offload build of Flang-RT"
|
|
)
|
|
endif()
|
|
|
|
enable_language(CUDA)
|
|
|
|
set_target_properties(${name}.static
|
|
PROPERTIES
|
|
CUDA_SEPARABLE_COMPILATION ON
|
|
)
|
|
|
|
# Treat all supported sources as CUDA files.
|
|
set_source_files_properties(${files} PROPERTIES LANGUAGE CUDA)
|
|
set(CUDA_COMPILE_OPTIONS)
|
|
if ("${CMAKE_CUDA_COMPILER_ID}" MATCHES "Clang")
|
|
# Allow varargs.
|
|
set(CUDA_COMPILE_OPTIONS
|
|
-Xclang -fcuda-allow-variadic-functions
|
|
)
|
|
endif()
|
|
if ("${CMAKE_CUDA_COMPILER_ID}" MATCHES "NVIDIA")
|
|
set(CUDA_COMPILE_OPTIONS
|
|
--expt-relaxed-constexpr
|
|
# Disable these warnings:
|
|
# 'long double' is treated as 'double' in device code
|
|
-Xcudafe --diag_suppress=20208
|
|
-Xcudafe --display_error_number
|
|
)
|
|
endif()
|
|
set_source_files_properties(${files} PROPERTIES COMPILE_OPTIONS
|
|
"${CUDA_COMPILE_OPTIONS}")
|
|
|
|
# Create a .a library consisting of CUDA PTX.
|
|
# This is different from a regular static library. The CUDA_PTX_COMPILATION
|
|
# property can only be applied to object libraries and create *.ptx files
|
|
# instead of *.o files. The .a will consist of those *.ptx files only.
|
|
|
|
set(sources ${files})
|
|
list(REMOVE_ITEM sources
|
|
io-api.cpp io-error.cpp io-stmt.cpp descriptor-io.cpp namelist.cpp)
|
|
list(APPEND sources io-stmt-minimal.cpp)
|
|
add_flangrt_library(obj.${name}PTX OBJECT ${sources})
|
|
set_target_properties(obj.${name}PTX PROPERTIES
|
|
CUDA_PTX_COMPILATION ON
|
|
CUDA_SEPARABLE_COMPILATION ON
|
|
)
|
|
add_flangrt_library(${name}PTX STATIC "$<TARGET_OBJECTS:obj.${name}PTX>")
|
|
|
|
# Apply configuration options
|
|
if (FLANG_RT_CUDA_RUNTIME_PTX_WITHOUT_GLOBAL_VARS)
|
|
target_compile_definitions(obj.${name}PTX
|
|
PRIVATE FLANG_RUNTIME_NO_GLOBAL_VAR_DEFS
|
|
)
|
|
endif()
|
|
|
|
# When using libcudacxx headers files, we have to use them
|
|
# for all files of Flang-RT.
|
|
if (EXISTS "${FLANG_RT_LIBCUDACXX_PATH}/include")
|
|
foreach (tgt IN ITEMS "${name}.static" "obj.${name}PTX")
|
|
target_include_directories(${tgt} AFTER PRIVATE "${FLANG_RT_LIBCUDACXX_PATH}/include")
|
|
target_compile_definitions(${tgt} PRIVATE RT_USE_LIBCUDACXX=1)
|
|
endforeach ()
|
|
endif ()
|
|
foreach (tgt IN ITEMS "obj.${name}PTX")
|
|
target_compile_definitions(${tgt} PRIVATE RT_CUDA_THIN_IO=1)
|
|
endforeach ()
|
|
endif()
|
|
endmacro()
|
|
|