Skip to content

Commit c09a236

Browse files
[WIP][SYCL] Run multiple triples at once in check-sycl
We don't have complex rules in those tests so it should be easy to update the tests to support this scenario. It should save use about 2-3 out of 8 minutes for the `check-sycl` target by reducing number of host compilations.
1 parent 6e4584d commit c09a236

File tree

7 files changed

+50
-29
lines changed

7 files changed

+50
-29
lines changed

sycl/test/CMakeLists.txt

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,26 @@ add_lit_testsuite(check-sycl-deploy "Running the SYCL regression tests"
5757
)
5858
set_target_properties(check-sycl-deploy PROPERTIES FOLDER "SYCL tests")
5959

60+
set(TRIPLES "spir64-unknown-unknown")
61+
if (SYCL_BUILD_PI_CUDA OR (SYCL_BUILD_PI_HIP AND "${SYCL_BUILD_PI_HIP_PLATFORM}" STREQUAL "NVIDIA"))
62+
set(TRIPLES "${TRIPLES},nvptx64-nvidia-cuda")
63+
endif()
64+
if ((SYCL_BUILD_PI_HIP AND "${SYCL_BUILD_PI_HIP_PLATFORM}" STREQUAL "AMD"))
65+
set(TRIPLES "${TRIPLES},amdgcn-amd-amdhsa")
66+
endif()
67+
68+
add_lit_testsuite(check-sycl-combined-triples "Running device-agnostic SYCL regression tests for all avaialble triples"
69+
${CMAKE_CURRENT_BINARY_DIR}
70+
ARGS ${RT_TEST_ARGS}
71+
PARAMS "SYCL_TRIPLE=${TRIPLES}"
72+
DEPENDS ${SYCL_TEST_DEPS}
73+
${SYCL_TEST_EXCLUDE}
74+
)
75+
76+
add_custom_target(check-sycl)
77+
add_dependencies(check-sycl check-sycl-combined-triples)
78+
set_target_properties(check-sycl PROPERTIES FOLDER "SYCL tests")
79+
6080
add_lit_testsuite(check-sycl-spirv "Running device-agnostic SYCL regression tests for SPIR-V"
6181
${CMAKE_CURRENT_BINARY_DIR}
6282
ARGS ${RT_TEST_ARGS}
@@ -73,10 +93,6 @@ add_lit_testsuite(check-sycl-dumps "Running ABI dump tests only"
7393
EXCLUDE_FROM_CHECK_ALL
7494
)
7595

76-
add_custom_target(check-sycl)
77-
add_dependencies(check-sycl check-sycl-spirv)
78-
set_target_properties(check-sycl PROPERTIES FOLDER "SYCL tests")
79-
8096
if(SYCL_BUILD_PI_CUDA)
8197
add_lit_testsuite(check-sycl-ptx "Running device-agnostic SYCL regression tests for NVidia PTX"
8298
${CMAKE_CURRENT_BINARY_DIR}
@@ -88,7 +104,6 @@ if(SYCL_BUILD_PI_CUDA)
88104

89105
add_custom_target(check-sycl-cuda)
90106
add_dependencies(check-sycl-cuda check-sycl-ptx)
91-
add_dependencies(check-sycl check-sycl-cuda)
92107
endif()
93108

94109
if(SYCL_BUILD_PI_HIP)
@@ -116,8 +131,6 @@ if(SYCL_BUILD_PI_HIP)
116131
else()
117132
message(FATAL_ERROR "SYCL_BUILD_PI_HIP_PLATFORM must be set to either 'AMD' or 'NVIDIA' (set to: '${SYCL_BUILD_PI_HIP_PLATFORM}')")
118133
endif()
119-
120-
add_dependencies(check-sycl check-sycl-hip)
121134
endif()
122135

123136
if(SYCL_ENABLE_KERNEL_FUSION)

sycl/test/basic_tests/macros.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
1-
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple -fsycl-device-only -dM -E %s -o %t.device
21
// RUN: %clangxx %fsycl-host-only -dM -E %s -o %t.host
2+
// RUN: %clangxx -fsycl -fsycl-targets=spir64-unknown-unknown -fsycl-device-only -dM -E %s -o %t.device.spirv
3+
// RUN: %if cuda %{ %clangxx -fsycl -fsycl-targets=nvptx64-nvidia-cuda -fsycl-device-only -dM -E %s -o %t.device.cuda %}
4+
// RUN: %if hip_amd %{ %clangxx -fsycl -fsycl-targets=amdgcn-amd-amdhsa -fsycl-device-only -dM -E %s -o %t.device.hip %}
5+
//
6+
// RUN: FileCheck %s < %t.host --check-prefixes=COMMON --implicit-check-not=__SPIRV
7+
// RUN: FileCheck %s < %t.device.spirv --check-prefixes=DEVICE,COMMON --implicit-check-not=__SPIRV
8+
// RUN: %if cuda %{ FileCheck %s < %t.device.cuda --check-prefixes=DEVICE,COMMON --implicit-check-not=__SPIRV %}
9+
// RUN: %if hip_amd %{ FileCheck %s < %t.device.hip --check-prefixes=DEVICE,COMMON --implicit-check-not=__SPIRV %}
310
//
411
// FIXME: we should also check that we don't leak __SYCL* and SYCL* macro from
512
// our header files.
6-
// RUN: FileCheck %s < %t.device --check-prefixes=DEVICE,COMMON \
7-
// RUN: --implicit-check-not=__SPIRV
8-
// RUN: FileCheck %s < %t.host --check-prefixes=COMMON \
9-
// RUN: --implicit-check-not=__SPIRV
1013
//
1114
// COMMON-DAG: #define SYCL_LANGUAGE_VERSION
1215
// COMMON-DAG: #define __SYCL_COMPILER_VERSION

sycl/test/basic_tests/macros_no_rdc.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11
// clang-format off
2-
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple -fsycl-device-only -E -dD -fno-sycl-rdc %s -o %t.device
32
// RUN: %clangxx %fsycl-host-only -fno-sycl-rdc -E -dD %s -o %t.host
3+
// RUN: %clangxx -fsycl -fsycl-targets=spir64-unknown-unknown -fsycl-device-only -E -dD -fno-sycl-rdc %s -o %t.device.spirv
4+
// RUN: %if cuda %{ %clangxx -fsycl -fsycl-targets=nvptx64-nvidia-cuda -fsycl-device-only -E -dD -fno-sycl-rdc %s -o %t.device.cuda %}
5+
// RUN: %if hip_amd %{ %clangxx -fsycl -fsycl-targets=amdgcn-amd-amdhsa -fsycl-device-only -E -dD -fno-sycl-rdc %s -o %t.device.hip %}
46
//
5-
// RUN: FileCheck --match-full-lines %s < %t.device --check-prefixes=DEVICE-FULL-LINE --implicit-check-not="#define SYCL_EXTERNAL"
67
// RUN: FileCheck --match-full-lines %s < %t.host --check-prefixes=HOST
8+
// RUN: FileCheck --match-full-lines %s < %t.device.spirv --check-prefixes=DEVICE-FULL-LINE --implicit-check-not="#define SYCL_EXTERNAL"
9+
// RUN: %if cuda %{ FileCheck --match-full-lines %s < %t.device.cuda --check-prefixes=DEVICE-FULL-LINE --implicit-check-not="#define SYCL_EXTERNAL" %}
10+
// RUN: %if hip_amd %{ FileCheck --match-full-lines %s < %t.device.hip --check-prefixes=DEVICE-FULL-LINE --implicit-check-not="#define SYCL_EXTERNAL" %}
711
//
812
// Remove __DPCPP_SYCL_EXTERNAL to simplify regex for DEVICE prefix
9-
// RUN: sed -i 's|__DPCPP_SYCL_EXTERNAL||g' %t.device
10-
// RUN: FileCheck %s < %t.device --check-prefixes=DEVICE
13+
// RUN: sed 's|__DPCPP_SYCL_EXTERNAL||g' %t.device.spirv | FileCheck %s --check-prefixes=DEVICE
14+
// RUN: %if cuda %{ sed 's|__DPCPP_SYCL_EXTERNAL||g' %t.device.cuda | FileCheck %s --check-prefixes=DEVICE %}
15+
// RUN: %if hip_amd %{ sed 's|__DPCPP_SYCL_EXTERNAL||g' %t.device.hip | FileCheck %s --check-prefixes=DEVICE %}
16+
// RUN:
1117
//
1218
// With -fno-sycl-rdc, device code should not define or use SYCL_EXTERNAL
1319
// DEVICE-FULL-LINE: #define __DPCPP_SYCL_EXTERNAL __attribute__((sycl_device))

sycl/test/esimd/odr.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,11 @@
44
// Template functions must have the same instantiation in both sources to cause
55
// ODR problems potentially - esimd::min is used for that purpose.
66
//
7-
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple -DSOURCE1 -c %s -o %t1.o
8-
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple -DSOURCE2 -c %s -o %t2.o
9-
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %t1.o %t2.o -o %t.exe
7+
// CUDA/HIP do not support intrinsics generated by the ESIMD compilation path:
108
//
11-
// CUDA does not support intrinsics generated by the ESIMD compilation path:
12-
// UNSUPPORTED: cuda || hip_amd
9+
// RUN: %clangxx -fsycl -fsycl-targets=spir64-unknown-unknown -DSOURCE1 -c %s -o %t1.o
10+
// RUN: %clangxx -fsycl -fsycl-targets=spir64-unknown-unknown -DSOURCE2 -c %s -o %t2.o
11+
// RUN: %clangxx -fsycl -fsycl-targets=spir64-unknown-unknown %t1.o %t2.o -o %t.exe
1312

1413
#include <iostream>
1514
#include <sycl/ext/intel/esimd.hpp>

sycl/test/extensions/bfloat16.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
// RUN: %clangxx -fsycl-device-only -fsycl-targets=%sycl_triple -S -Xclang -no-enable-noundef-analysis %s -Xclang -opaque-pointers -o - | FileCheck %s
2-
3-
// UNSUPPORTED: cuda || hip_amd
1+
// Use explicit spir64 triple as not yet supported on CUDA/HIP.
2+
// RUN: %clangxx -fsycl-device-only -fsycl-targets=spir64-unknown-unknown -S -Xclang -no-enable-noundef-analysis %s -Xclang -opaque-pointers -o - | FileCheck %s
43

54
#include <sycl/ext/oneapi/bfloat16.hpp>
65
#include <sycl/sycl.hpp>

sycl/test/lit.cfg.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,11 +131,11 @@
131131
if config.native_cpu_be == "ON":
132132
config.available_features.add('native_cpu_be')
133133

134-
if triple == 'nvptx64-nvidia-cuda':
134+
if 'nvptx64-nvidia-cuda' in triple:
135135
llvm_config.with_system_environment('CUDA_PATH')
136136
config.available_features.add('cuda')
137137

138-
if triple == 'amdgcn-amd-amdhsa':
138+
if 'amdgcn-amd-amdhsa' in triple:
139139
llvm_config.with_system_environment('ROCM_PATH')
140140
config.available_features.add('hip_amd')
141141
# For AMD the specific GPU has to be specified with --offload-arch

sycl/test/regression/joint_group_conflict.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple -fPIC -DCASE1 %s -c -o %t.1.o
2-
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple -fPIC -DCASE2 %s -c -o %t.2.o
3-
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple -shared %t.1.o %t.2.o -o %t.so
1+
// TODO: Stop disabling opaque pointers once it can work.
2+
// RUN: %clangxx -Xclang -no-opaque-pointers -fsycl -fsycl-targets=%sycl_triple -fPIC -DCASE1 %s -c -o %t.1.o
3+
// RUN: %clangxx -Xclang -no-opaque-pointers -fsycl -fsycl-targets=%sycl_triple -fPIC -DCASE2 %s -c -o %t.2.o
4+
// RUN: %clangxx -Xclang -no-opaque-pointers -fsycl -fsycl-targets=%sycl_triple -shared %t.1.o %t.2.o -o %t.so
45
//
56
// Some of the above compiler options will not work on Windows.
67
// UNSUPPORTED: windows

0 commit comments

Comments
 (0)