Skip to content

[libcxx] Add testing configuration for GPU targets #104515

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

Merged
merged 1 commit into from
Nov 4, 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
4 changes: 4 additions & 0 deletions libcxx/cmake/caches/AMDGPU.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ set(LIBCXXABI_ENABLE_SHARED OFF CACHE BOOL "")
set(LIBCXXABI_ENABLE_THREADS OFF CACHE BOOL "")
set(LIBCXXABI_USE_LLVM_UNWINDER OFF CACHE BOOL "")

# Test configuration.
set(LIBCXX_TEST_CONFIG "amdgpu-libc++-shared.cfg.in" CACHE STRING "")
set(LIBCXX_TEST_PARAMS "optimization=none;long_tests=False;executor=amdhsa-loader" CACHE STRING "")

# Necessary compile flags for AMDGPU.
set(LIBCXX_ADDITIONAL_COMPILE_FLAGS
"-nogpulib;-flto;-fconvergent-functions;-Xclang;-mcode-object-version=none" CACHE STRING "")
Expand Down
4 changes: 4 additions & 0 deletions libcxx/cmake/caches/NVPTX.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ set(LIBCXXABI_ENABLE_SHARED OFF CACHE BOOL "")
set(LIBCXXABI_ENABLE_THREADS OFF CACHE BOOL "")
set(LIBCXXABI_USE_LLVM_UNWINDER OFF CACHE BOOL "")

# Test configuration.
set(LIBCXX_TEST_CONFIG "nvptx-libc++-shared.cfg.in" CACHE STRING "")
set(LIBCXX_TEST_PARAMS "optimization=none;long_tests=False;executor=nvptx-loader" CACHE STRING "")

# Necessary compile flags for NVPTX.
set(LIBCXX_ADDITIONAL_COMPILE_FLAGS
"-nogpulib;-flto;-fconvergent-functions;--cuda-feature=+ptx63" CACHE STRING "")
Expand Down
29 changes: 29 additions & 0 deletions libcxx/test/configs/amdgpu-libc++-shared.cfg.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
lit_config.load_config(config, '@CMAKE_CURRENT_BINARY_DIR@/cmake-bridge.cfg')

config.substitutions.append(('%{flags}',
f'--target={config.target_triple} -Wno-multi-gpu -flto -mcpu=native'))
config.substitutions.append(('%{compile_flags}',
'-nogpulib -fno-builtin-printf -I %{include-dir} '
'-I %{target-include-dir} -I %{libcxx-dir}/test/support'
))
config.substitutions.append(('%{link_flags}',
'-nostdlib++ -startfiles -stdlib '
'-Wl,-mllvm,-amdgpu-lower-global-ctor-dtor=0 '
'-L %{lib-dir} -lc++ -lc++abi -lclang_rt.builtins'
))

config.substitutions.append(('%{exec}',
'%{executor}'
))

config.stdlib = 'llvm-libc++'

import os, site
site.addsitedir(os.path.join('@LIBCXX_SOURCE_DIR@', 'utils'))
import libcxx.test.params, libcxx.test.config
libcxx.test.config.configure(
libcxx.test.params.DEFAULT_PARAMETERS,
libcxx.test.features.DEFAULT_FEATURES,
config,
lit_config
)
30 changes: 30 additions & 0 deletions libcxx/test/configs/nvptx-libc++-shared.cfg.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
lit_config.load_config(config, '@CMAKE_CURRENT_BINARY_DIR@/cmake-bridge.cfg')

config.substitutions.append(('%{flags}',
f'--target={config.target_triple} -Wno-multi-gpu -flto -march=native'))
config.substitutions.append(('%{compile_flags}',
'-nogpulib -fno-builtin-printf -I %{include-dir} '
'-I %{target-include-dir} -I %{libcxx-dir}/test/support'
))
config.substitutions.append(('%{link_flags}',
'-nostdlib++ -startfiles -stdlib '
'-L %{lib-dir} -lc++ -lc++abi '
'-Wl,--suppress-stack-size-warning '
'-Wl,-mllvm,-nvptx-lower-global-ctor-dtor=1 '
'-Wl,-mllvm,-nvptx-emit-init-fini-kernel'
))
config.substitutions.append(('%{exec}',
'%{executor} --no-parallelism'
))

config.stdlib = 'llvm-libc++'

import os, site
site.addsitedir(os.path.join('@LIBCXX_SOURCE_DIR@', 'utils'))
import libcxx.test.params, libcxx.test.config
libcxx.test.config.configure(
libcxx.test.params.DEFAULT_PARAMETERS,
libcxx.test.features.DEFAULT_FEATURES,
config,
lit_config
)
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
//
//===----------------------------------------------------------------------===//

// FIXME: This takes over an hour to compile, disable for now.
// UNSUPPORTED: LIBCXX-AMDGPU-FIXME
// UNSUPPORTED: LIBCXX-NVPTX-FIXME

// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
// UNSUPPORTED: GCC-ALWAYS_INLINE-FIXME

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
//
//===----------------------------------------------------------------------===//

// FIXME: This takes over an hour to compile, disable for now.
// UNSUPPORTED: LIBCXX-AMDGPU-FIXME
// UNSUPPORTED: LIBCXX-NVPTX-FIXME

// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
// ADDITIONAL_COMPILE_FLAGS(has-fconstexpr-steps): -fconstexpr-steps=10000000
// ADDITIONAL_COMPILE_FLAGS(has-fconstexpr-ops-limit): -fconstexpr-ops-limit=70000000
Expand Down
8 changes: 8 additions & 0 deletions libcxx/utils/libcxx/test/features.py
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,14 @@ def _mingwSupportsModules(cfg):
""",
),
),
Feature(
name="LIBCXX-AMDGPU-FIXME",
when=lambda cfg: "__AMDGPU__" in compilerMacros(cfg),
),
Feature(
name="LIBCXX-NVPTX-FIXME",
when=lambda cfg: "__NVPTX__" in compilerMacros(cfg),
),
Feature(
name="can-create-symlinks",
when=lambda cfg: "_WIN32" not in compilerMacros(cfg)
Expand Down
Loading