Skip to content

[SYCL] Run multiple triples at once in check-sycl #10635

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 3 commits into from
Aug 2, 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
27 changes: 20 additions & 7 deletions sycl/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,26 @@ add_lit_testsuite(check-sycl-deploy "Running the SYCL regression tests"
)
set_target_properties(check-sycl-deploy PROPERTIES FOLDER "SYCL tests")

set(TRIPLES "spir64-unknown-unknown")
if (SYCL_BUILD_PI_CUDA OR (SYCL_BUILD_PI_HIP AND "${SYCL_BUILD_PI_HIP_PLATFORM}" STREQUAL "NVIDIA"))
set(TRIPLES "${TRIPLES},nvptx64-nvidia-cuda")
endif()
if ((SYCL_BUILD_PI_HIP AND "${SYCL_BUILD_PI_HIP_PLATFORM}" STREQUAL "AMD"))
set(TRIPLES "${TRIPLES},amdgcn-amd-amdhsa")
endif()

add_lit_testsuite(check-sycl-combined-triples "Running device-agnostic SYCL regression tests for all avaialble triples"
${CMAKE_CURRENT_BINARY_DIR}
ARGS ${RT_TEST_ARGS}
PARAMS "SYCL_TRIPLE=${TRIPLES}"
DEPENDS ${SYCL_TEST_DEPS}
${SYCL_TEST_EXCLUDE}
)

add_custom_target(check-sycl)
add_dependencies(check-sycl check-sycl-combined-triples)
set_target_properties(check-sycl PROPERTIES FOLDER "SYCL tests")

add_lit_testsuite(check-sycl-spirv "Running device-agnostic SYCL regression tests for SPIR-V"
${CMAKE_CURRENT_BINARY_DIR}
ARGS ${RT_TEST_ARGS}
Expand All @@ -73,10 +93,6 @@ add_lit_testsuite(check-sycl-dumps "Running ABI dump tests only"
EXCLUDE_FROM_CHECK_ALL
)

add_custom_target(check-sycl)
add_dependencies(check-sycl check-sycl-spirv)
set_target_properties(check-sycl PROPERTIES FOLDER "SYCL tests")

if(SYCL_BUILD_PI_CUDA)
add_lit_testsuite(check-sycl-ptx "Running device-agnostic SYCL regression tests for NVidia PTX"
${CMAKE_CURRENT_BINARY_DIR}
Expand All @@ -88,7 +104,6 @@ if(SYCL_BUILD_PI_CUDA)

add_custom_target(check-sycl-cuda)
add_dependencies(check-sycl-cuda check-sycl-ptx)
add_dependencies(check-sycl check-sycl-cuda)
endif()

if(SYCL_BUILD_PI_HIP)
Expand Down Expand Up @@ -116,8 +131,6 @@ if(SYCL_BUILD_PI_HIP)
else()
message(FATAL_ERROR "SYCL_BUILD_PI_HIP_PLATFORM must be set to either 'AMD' or 'NVIDIA' (set to: '${SYCL_BUILD_PI_HIP_PLATFORM}')")
endif()

add_dependencies(check-sycl check-sycl-hip)
endif()

if(SYCL_ENABLE_KERNEL_FUSION)
Expand Down
13 changes: 8 additions & 5 deletions sycl/test/basic_tests/macros.cpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple -fsycl-device-only -dM -E %s -o %t.device
// RUN: %clangxx %fsycl-host-only -dM -E %s -o %t.host
// RUN: %clangxx -fsycl -fsycl-targets=spir64-unknown-unknown -fsycl-device-only -dM -E %s -o %t.device.spirv
// RUN: %if cuda %{ %clangxx -fsycl -fsycl-targets=nvptx64-nvidia-cuda -fsycl-device-only -dM -E %s -o %t.device.cuda %}
// RUN: %if hip_amd %{ %clangxx -fsycl -fsycl-targets=amdgcn-amd-amdhsa -fsycl-device-only -dM -E %s -o %t.device.hip %}
//
// RUN: FileCheck %s < %t.host --check-prefixes=COMMON --implicit-check-not=__SPIRV
// RUN: FileCheck %s < %t.device.spirv --check-prefixes=DEVICE,COMMON --implicit-check-not=__SPIRV
// RUN: %if cuda %{ FileCheck %s < %t.device.cuda --check-prefixes=DEVICE,COMMON --implicit-check-not=__SPIRV %}
// RUN: %if hip_amd %{ FileCheck %s < %t.device.hip --check-prefixes=DEVICE,COMMON --implicit-check-not=__SPIRV %}
//
// FIXME: we should also check that we don't leak __SYCL* and SYCL* macro from
// our header files.
// RUN: FileCheck %s < %t.device --check-prefixes=DEVICE,COMMON \
// RUN: --implicit-check-not=__SPIRV
// RUN: FileCheck %s < %t.host --check-prefixes=COMMON \
// RUN: --implicit-check-not=__SPIRV
//
// COMMON-DAG: #define SYCL_LANGUAGE_VERSION
// COMMON-DAG: #define __SYCL_COMPILER_VERSION
Expand Down
14 changes: 10 additions & 4 deletions sycl/test/basic_tests/macros_no_rdc.cpp
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
// clang-format off
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple -fsycl-device-only -E -dD -fno-sycl-rdc %s -o %t.device
// RUN: %clangxx %fsycl-host-only -fno-sycl-rdc -E -dD %s -o %t.host
// RUN: %clangxx -fsycl -fsycl-targets=spir64-unknown-unknown -fsycl-device-only -E -dD -fno-sycl-rdc %s -o %t.device.spirv
// RUN: %if cuda %{ %clangxx -fsycl -fsycl-targets=nvptx64-nvidia-cuda -fsycl-device-only -E -dD -fno-sycl-rdc %s -o %t.device.cuda %}
// RUN: %if hip_amd %{ %clangxx -fsycl -fsycl-targets=amdgcn-amd-amdhsa -fsycl-device-only -E -dD -fno-sycl-rdc %s -o %t.device.hip %}
//
// RUN: FileCheck --match-full-lines %s < %t.device --check-prefixes=DEVICE-FULL-LINE --implicit-check-not="#define SYCL_EXTERNAL"
// RUN: FileCheck --match-full-lines %s < %t.host --check-prefixes=HOST
// RUN: FileCheck --match-full-lines %s < %t.device.spirv --check-prefixes=DEVICE-FULL-LINE --implicit-check-not="#define SYCL_EXTERNAL"
// RUN: %if cuda %{ FileCheck --match-full-lines %s < %t.device.cuda --check-prefixes=DEVICE-FULL-LINE --implicit-check-not="#define SYCL_EXTERNAL" %}
// RUN: %if hip_amd %{ FileCheck --match-full-lines %s < %t.device.hip --check-prefixes=DEVICE-FULL-LINE --implicit-check-not="#define SYCL_EXTERNAL" %}
//
// Remove __DPCPP_SYCL_EXTERNAL to simplify regex for DEVICE prefix
// RUN: sed -i 's|__DPCPP_SYCL_EXTERNAL||g' %t.device
// RUN: FileCheck %s < %t.device --check-prefixes=DEVICE
// RUN: sed 's|__DPCPP_SYCL_EXTERNAL||g' %t.device.spirv | FileCheck %s --check-prefixes=DEVICE
// RUN: %if cuda %{ sed 's|__DPCPP_SYCL_EXTERNAL||g' %t.device.cuda | FileCheck %s --check-prefixes=DEVICE %}
// RUN: %if hip_amd %{ sed 's|__DPCPP_SYCL_EXTERNAL||g' %t.device.hip | FileCheck %s --check-prefixes=DEVICE %}
// RUN:
//
// With -fno-sycl-rdc, device code should not define or use SYCL_EXTERNAL
// DEVICE-FULL-LINE: #define __DPCPP_SYCL_EXTERNAL __attribute__((sycl_device))
Expand Down
9 changes: 4 additions & 5 deletions sycl/test/esimd/odr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@
// Template functions must have the same instantiation in both sources to cause
// ODR problems potentially - esimd::min is used for that purpose.
//
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple -DSOURCE1 -c %s -o %t1.o
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple -DSOURCE2 -c %s -o %t2.o
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %t1.o %t2.o -o %t.exe
// CUDA/HIP do not support intrinsics generated by the ESIMD compilation path:
//
// CUDA does not support intrinsics generated by the ESIMD compilation path:
// UNSUPPORTED: cuda || hip_amd
// RUN: %clangxx -fsycl -fsycl-targets=spir64-unknown-unknown -DSOURCE1 -c %s -o %t1.o
// RUN: %clangxx -fsycl -fsycl-targets=spir64-unknown-unknown -DSOURCE2 -c %s -o %t2.o
// RUN: %clangxx -fsycl -fsycl-targets=spir64-unknown-unknown %t1.o %t2.o -o %t.exe

#include <iostream>
#include <sycl/ext/intel/esimd.hpp>
Expand Down
5 changes: 2 additions & 3 deletions sycl/test/extensions/bfloat16.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// RUN: %clangxx -fsycl-device-only -fsycl-targets=%sycl_triple -S -Xclang -no-enable-noundef-analysis %s -Xclang -opaque-pointers -o - | FileCheck %s

// UNSUPPORTED: cuda || hip_amd
// Use explicit spir64 triple as not yet supported on CUDA/HIP.
// RUN: %clangxx -fsycl-device-only -fsycl-targets=spir64-unknown-unknown -S -Xclang -no-enable-noundef-analysis %s -Xclang -opaque-pointers -o - | FileCheck %s

#include <sycl/ext/oneapi/bfloat16.hpp>
#include <sycl/sycl.hpp>
Expand Down
4 changes: 2 additions & 2 deletions sycl/test/lit.cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,11 @@
if config.native_cpu_be == "ON":
config.available_features.add('native_cpu_be')

if triple == 'nvptx64-nvidia-cuda':
if 'nvptx64-nvidia-cuda' in triple:
llvm_config.with_system_environment('CUDA_PATH')
config.available_features.add('cuda')

if triple == 'amdgcn-amd-amdhsa':
if 'amdgcn-amd-amdhsa' in triple:
llvm_config.with_system_environment('ROCM_PATH')
config.available_features.add('hip_amd')
# For AMD the specific GPU has to be specified with --offload-arch
Expand Down
6 changes: 3 additions & 3 deletions sycl/test/regression/joint_group_conflict.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple -fPIC -DCASE1 %s -c -o %t.1.o
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple -fPIC -DCASE2 %s -c -o %t.2.o
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple -shared %t.1.o %t.2.o -o %t.so
// RUN: %clangxx -Xclang -opaque-pointers -fsycl -fsycl-targets=%sycl_triple -fPIC -DCASE1 %s -c -o %t.1.o
// RUN: %clangxx -Xclang -opaque-pointers -fsycl -fsycl-targets=%sycl_triple -fPIC -DCASE2 %s -c -o %t.2.o
// RUN: %clangxx -Xclang -opaque-pointers -fsycl -fsycl-targets=%sycl_triple -shared %t.1.o %t.2.o -o %t.so
//
// Some of the above compiler options will not work on Windows.
// UNSUPPORTED: windows
Expand Down