Skip to content
This repository has been archived by the owner on Mar 21, 2024. It is now read-only.

Add a profile for ICC-2022. #403

Merged
merged 7 commits into from
Mar 23, 2023
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
7 changes: 7 additions & 0 deletions .upstream-tests/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@ if (NOT MSVC)
--compiler-options=-Wextra")
endif()

# Intel OneAPI compiler has fast math enabled by default which breaks almost all floating point tests
if (${CMAKE_CXX_COMPILER_ID} STREQUAL "IntelLLVM")
set(LIBCUDACXX_TEST_COMPILER_FLAGS
"${LIBCUDACXX_TEST_COMPILER_FLAGS} \
--compiler-options=-fno-fast-math")
endif()
Comment on lines +47 to +51
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These options seem to be targeting nvcc (nvc++?) when icpx is the host compiler. Should this code be under if (${CMAKE_CUDA_COMPILER_ID} STREQUAL "NVIDIA")?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAIK this should be applied always because of our libcxx tests where we pretent to be a standard library

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I specifically disabled libcxx tests with this compiler. We can turn them on later, but I wanted our most important coverage to come first.


if (${CMAKE_CUDA_COMPILER_ID} STREQUAL "NVIDIA")
set(LIBCUDACXX_TEST_COMPILER_FLAGS
"${LIBCUDACXX_TEST_COMPILER_FLAGS} \
Expand Down
14 changes: 14 additions & 0 deletions environments/linux/docker/compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,20 @@ services:

## Configured images ##
### Ubuntu 22.04 images:
icc-2022:
image: "libcudacxx/icc-2022"
profiles: ["icc-2022", "all", "base"]
tty: true
build:
context: ../../../
dockerfile: environments/linux/docker/icc.base.Dockerfile
target: libcudacxx-configured
args:
ICC_TOOLKIT_VER: "2022.2.1"
HOST_CXX: "icpx"
BUILDKIT_INLINE_CACHE: "1"
ROOT_IMAGE: "nvcr.io/nvidia/cuda:12.1.0-devel-ubuntu22.04"
deploy: *deploy-template

gcc-11:
extends:
Expand Down
95 changes: 95 additions & 0 deletions environments/linux/docker/icc.base.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# Copyright (c) 2018-2023 NVIDIA Corporation
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
# Released under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.

ARG ROOT_IMAGE

FROM ${ROOT_IMAGE} AS devenv

ARG COMPILERS="gcc clang"
ARG ICC_TOOLKIT_VER="latest"
ARG CMAKE_VER=3.23.1
ARG CMAKE_URL=https://github.com/Kitware/CMake/releases/download/v${CMAKE_VER}/cmake-${CMAKE_VER}-Linux-x86_64.sh

# `-y` answers yes to any interactive prompts.
# `-qq` because apt is noisy
ARG APT_GET="apt-get -y -qq"

ENV TZ=US/Pacific
ENV DEBIAN_FRONTEND=noninteractive
# apt-key complains about non-interactive usage.
ENV APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1

SHELL ["/usr/bin/env", "bash", "-c"]

ADD ${CMAKE_URL} /tmp/cmake.sh

# Install baseline development tools
RUN function comment() { :; }; \
comment "Sources for gcc"; \
source /etc/os-release; \
${APT_GET} update; \
comment "Install basic build tools"; \
${APT_GET} --no-install-recommends install apt-utils curl wget git zip unzip tar \
sudo make software-properties-common ninja-build ccache pkg-config \
python3 python3-wheel python3-pip; \
comment "Install GCC and Clang"; \
# Unattended installation hack
${APT_GET} install gcc g++ ${COMPILERS}; \
comment "Install CMake"; \
sh /tmp/cmake.sh --skip-license --prefix=/usr; \
comment "Install Python utils"; \
update-alternatives --quiet --install /usr/bin/python python $(which python3) 3; \
update-alternatives --quiet --set python $(which python3); \
python3 -m pip install setuptools wheel; \
python3 -m pip install lit; \
rm -rf /var/lib/apt/lists/*

# Snag Intel stuff
RUN wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | \
gpg --dearmor | sudo tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null; \
echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" | \
sudo tee /etc/apt/sources.list.d/oneAPI.list; \
${APT_GET} update; ${APT_GET} install intel-dpcpp-cpp-compiler-${ICC_TOOLKIT_VER};

ENV PATH="$PATH:/opt/intel/oneapi/compiler/${ICC_TOOLKIT_VER}/linux/bin"

# Assemble libcudacxx specific bits

FROM devenv AS libcudacxx-configured

# Default path according to CUDA Docker image, overridable if the image requires it
ARG CUDACXX_PATH=/usr/local/cuda/bin/nvcc

ARG HOST_CXX=gcc
ARG CXX_DIALECT=11

# Attempt to load env from cccl/cuda
ARG TEST_WITH_NVRTC=OFF

# Docker on Windows can't follow symlinks???
ADD . /libcudacxx
ADD ./include/cuda/std/detail/libcxx/include /libcudacxx/libcxx/include
ADD ./.upstream-tests/test /libcudacxx/test
ADD ./.upstream-tests/utils /libcudacxx/utils

ENV CUDAFLAGS="-allow-unsupported-compiler"

RUN cmake -S /libcudacxx -B /build \
-G Ninja \
-DLIBCUDACXX_ENABLE_STATIC_LIBRARY=OFF \
-DLIBCUDACXX_ENABLE_LIBCUDACXX_TESTS=ON \
-DLIBCUDACXX_ENABLE_LIBCXX_TESTS=OFF \
-DLIBCUDACXX_TEST_COMPILER_FLAGS="-allow-unsupported-compiler" \
-DLIBCUDACXX_TEST_WITH_NVRTC=${TEST_WITH_NVRTC} \
-DLIBCUDACXX_TEST_STANDARD_VER=c++${CXX_DIALECT} \
-DLIBCXX_ENABLE_FILESYSTEM=OFF \
-DCMAKE_CXX_COMPILER=${HOST_CXX} \
-DCMAKE_CUDA_COMPILER=${CUDACXX_PATH} \
-DCMAKE_CUDA_FLAGS="-allow-unsupported-compiler"

RUN ninja -C /build libcudacxx_tu_tests && ninja -C /build clean
# RUN ninja -C /build cxx

ENV LIBCUDACXX_SITE_CONFIG=/build/test/lit.site.cfg
22 changes: 20 additions & 2 deletions include/cuda/std/detail/libcxx/include/__config
Original file line number Diff line number Diff line change
Expand Up @@ -648,8 +648,8 @@ typedef __char32_t char32_t;
#define _LIBCUDACXX_HAS_VIRTUAL_DESTRUCTOR(...) __has_virtual_destructor(__VA_ARGS__)
#endif

#if __check_builtin(is_literal)
#define _LIBCUDACXX_IS_LITERAL(...) __is_literal(__VA_ARGS__)
#if __check_builtin(is_literal_type)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regarding __check_builtin -> __has_builtin changes that used to be here. The __has_builtin has different result compared to !__is_identifier for some compilers. Here's a reference.

#define _LIBCUDACXX_IS_LITERAL(...) __is_literal_type(__VA_ARGS__)
#endif

#if !defined(_LIBCUDACXX_HAS_NO_ASAN) && !__has_feature(address_sanitizer)
Expand Down Expand Up @@ -682,6 +682,10 @@ typedef __char32_t char32_t;
#define _LIBCUDACXX_ADDRESSOF(...) __builtin_addressof(__VA_ARGS__)
#endif

#if __check_builtin(decay)
#define _LIBCUDACXX_DECAY(...) __decay(__VA_ARGS__)
#endif

#if __check_builtin(is_array)
#define _LIBCUDACXX_IS_ARRAY(...) __is_array(__VA_ARGS__)
#endif
Expand Down Expand Up @@ -2034,6 +2038,20 @@ extern "C" _LIBCUDACXX_FUNC_VIS void __sanitizer_annotate_contiguous_container(
# define _LIBCUDACXX_CPO_ACCESSIBILITY _LIBCUDACXX_INLINE_VAR
#endif

#if defined(__INTEL_LLVM_COMPILER)
# define _LIBCUDACXX_USE_DECAY_FALLBACK
# define _LIBCUDACXX_USE_MAKE_SIGNED_FALLBACK
# define _LIBCUDACXX_USE_MAKE_UNSIGNED_FALLBACK
# define _LIBCUDACXX_USE_REMOVE_ALL_EXTENTS_FALLBACK
# define _LIBCUDACXX_USE_REMOVE_CONST_FALLBACK
# define _LIBCUDACXX_USE_REMOVE_CV_FALLBACK
# define _LIBCUDACXX_USE_REMOVE_CVREF_FALLBACK
# define _LIBCUDACXX_USE_REMOVE_EXTENT_FALLBACK
# define _LIBCUDACXX_USE_REMOVE_POINTER_FALLBACK
# define _LIBCUDACXX_USE_REMOVE_VOLATILE_FALLBACK
# define _LIBCUDACXX_USE_REMOVE_REFERENCE_T_FALLBACK
#endif // __INTEL_LLVM_COMPILER

#endif // __cplusplus

#endif // _LIBCUDACXX_CONFIG
6 changes: 3 additions & 3 deletions include/cuda/std/detail/libcxx/include/__type_traits/decay.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ struct decay {
#else

template <class _Up, bool>
struct __decay {
struct __decay_impl {
typedef _LIBCUDACXX_NODEBUG_TYPE __remove_cv_t<_Up> type;
};

template <class _Up>
struct __decay<_Up, true> {
struct __decay_impl<_Up, true> {
public:
typedef _LIBCUDACXX_NODEBUG_TYPE __conditional_t
<
Expand All @@ -64,7 +64,7 @@ struct _LIBCUDACXX_TEMPLATE_VIS decay
private:
typedef _LIBCUDACXX_NODEBUG_TYPE __libcpp_remove_reference_t<_Tp> _Up;
public:
typedef _LIBCUDACXX_NODEBUG_TYPE typename __decay<_Up, __libcpp_is_referenceable<_Up>::value>::type type;
typedef _LIBCUDACXX_NODEBUG_TYPE typename __decay_impl<_Up, __libcpp_is_referenceable<_Up>::value>::type type;
};
#endif // defined(_LIBCUDACXX_DECAY) && !defined(_LIBCUDACXX_USE_DECAY_FALLBACK)

Expand Down
3 changes: 3 additions & 0 deletions libcxx/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,9 @@ function(cxx_add_warning_flags target)
-Wno-literal-suffix
-Wno-c++14-compat
-Wno-noexcept-type)
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "IntelLLVM")
target_add_compile_flags_if_supported(${target} PRIVATE
-fno-fast-math)
endif()
if (LIBCXX_ENABLE_WERROR)
target_add_compile_flags_if_supported(${target} PRIVATE -Werror)
Expand Down