Skip to content

Commit 2b7e8e1

Browse files
author
iclsrc
committed
Merge from 'sycl' to 'sycl-web' (20 commits)
2 parents 997b588 + 47f90e6 commit 2b7e8e1

File tree

60 files changed

+893
-405
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+893
-405
lines changed

.github/CODEOWNERS

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,13 @@ sycl/test-e2e/InvokeSimd/ @intel/dpcpp-esimd-reviewers
125125
buildbot/ @intel/dpcpp-devops-reviewers
126126
devops/ @intel/dpcpp-devops-reviewers
127127
sycl/cts_exclude_filter/ @intel/dpcpp-devops-reviewers
128+
.ci/ @intel/dpcpp-devops-reviewers
129+
130+
# Third-party dependencies updated by dependabot
131+
**/requirements.txt @intel/dpcpp-devops-reviewers
132+
**/requirements-hashed.txt @intel/dpcpp-devops-reviewers
133+
**/package-lock.json @intel/dpcpp-devops-reviewers
134+
llvm/utils/git/requirements_formatting.txt @intel/dpcpp-devops-reviewers
128135

129136
# dev-igc driver update
130137
devops/dependencies-igc-dev.json @intel/sycl-matrix-reviewers @intel/dpcpp-esimd-reviewers @intel/dpcpp-devops-reviewers

.github/workflows/sycl-linux-precommit.yml

Lines changed: 30 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -79,18 +79,35 @@ jobs:
7979

8080
toolchain_artifact: sycl_linux_ubuntu22
8181

82+
compat_read_exclude:
83+
name: Read compatibility testing exclude list
84+
runs-on: [Linux, build]
85+
outputs:
86+
FILTER: ${{ steps.result.outputs.FILTER }}
87+
steps:
88+
- uses: actions/checkout@v4
89+
with:
90+
sparse-checkout: |
91+
devops/
92+
- name: Register cleanup after job is finished
93+
uses: ./devops/actions/cleanup
94+
- id: result
95+
shell: bash
96+
run: |
97+
# Transform to format expected by `llvm-lit --filter-out "pattern1|pattern2|..."`.
98+
# First, remove comments/empty lines, then join lines with "|" as separator.
99+
echo FILTER="$(grep -v '^#\|^\W*$' devops/compat_ci_exclude.sycl-rel-6_2 | paste -sd '|')" >> $GITHUB_OUTPUT
100+
82101
run_prebuilt_e2e_tests:
83-
needs: [build, detect_changes]
102+
needs: [build, detect_changes, compat_read_exclude]
84103
if: ${{ always() && !cancelled() && needs.build.outputs.build_conclusion == 'success' }}
85104
strategy:
86105
fail-fast: false
87106
matrix:
88107
include:
89108
- name: GEN 12 Integrated
90109
runner: '["Linux", "gen12"]'
91-
image_options: -u 1001 --device=/dev/dri -v /dev/dri/by-path:/dev/dri/by-path --privileged --cap-add SYS_ADMIN
92110
target_devices: level_zero:gpu;opencl:gpu;opencl:cpu
93-
extra_lit_opts: --param gpu-intel-gen12=True
94111
- name: NVIDIA/CUDA
95112
runner: '["Linux", "cuda"]'
96113
image_options: -u 1001 --gpus all --cap-add SYS_ADMIN
@@ -102,45 +119,43 @@ jobs:
102119
extra_lit_opts: -j 1
103120
- name: Intel Arc A-Series Graphics
104121
runner: '["Linux", "arc"]'
105-
image_options: -u 1001 --device=/dev/dri -v /dev/dri/by-path:/dev/dri/by-path --privileged --cap-add SYS_ADMIN
106122
target_devices: level_zero:gpu;opencl:gpu;level_zero_v2:gpu
107-
extra_lit_opts: --param matrix-xmx8=True
108-
- name: E2E tests with dev igc on Intel Arc A-Series Graphics
123+
- name: Dev IGC / Intel Arc A-Series Graphics
109124
runner: '["Linux", "arc"]'
110125
image: ghcr.io/intel/llvm/ubuntu2404_intel_drivers:devigc
111-
image_options: -u 1001 --device=/dev/dri -v /dev/dri/by-path:/dev/dri/by-path --privileged --cap-add SYS_ADMIN
112126
target_devices: level_zero:gpu
113-
extra_lit_opts: --param matrix-xmx8=True
114127
use_igc_dev: true
115128
env: '{"LIT_FILTER":"Matrix/"}'
116-
- name: E2E tests on Intel Ponte Vecchio GPU
129+
- name: Intel Ponte Vecchio GPU
117130
runner: '["Linux", "pvc"]'
118-
image_options: -u 1001 --device=/dev/dri -v /dev/dri/by-path:/dev/dri/by-path --privileged --cap-add SYS_ADMIN
119131
target_devices: level_zero:gpu;opencl:gpu;level_zero_v2:gpu
120-
- name: Dev IGC on Intel Ponte Vecchio GPU
132+
- name: Dev IGC / Intel Ponte Vecchio GPU
121133
runner: '["Linux", "pvc"]'
122134
image: ghcr.io/intel/llvm/ubuntu2404_intel_drivers:devigc
123-
image_options: -u 1001 --device=/dev/dri -v /dev/dri/by-path:/dev/dri/by-path --privileged --cap-add SYS_ADMIN
124135
target_devices: level_zero:gpu
125136
use_igc_dev: true
126137
env: '{"LIT_FILTER":"Matrix/"}'
127138
- name: Intel Battlemage Graphics
128139
runner: '["Linux", "bmg"]'
129-
image_options: -u 1001 --device=/dev/dri -v /dev/dri/by-path:/dev/dri/by-path --privileged --cap-add SYS_ADMIN
130140
target_devices: level_zero_v1:gpu;level_zero_v2:gpu
131141
- name: Preview Mode
132142
runner: '["Linux", "gen12"]'
133-
image_options: -u 1001 --device=/dev/dri -v /dev/dri/by-path:/dev/dri/by-path --privileged --cap-add SYS_ADMIN
134143
target_devices: level_zero:gpu;opencl:gpu;opencl:cpu
135144
extra_lit_opts: --param test-preview-mode=True
136145
e2e_binaries_artifact: e2e_bin_preview
146+
- name: ABI compatibility against sycl-rel-6_2
147+
runner: '["Linux", "pvc"]'
148+
image: ghcr.io/intel/llvm/sycl_prebuilt_tests:sycl-rel-6_2
149+
target_devices: level_zero:gpu
150+
extra_lit_opts: '--param test-preview-mode=False --filter-out "${{ needs.compat_read_exclude.outputs.FILTER }}"'
151+
e2e_binaries_artifact: 'in-container'
137152

138153
uses: ./.github/workflows/sycl-linux-run-tests.yml
139154
with:
140155
name: ${{ matrix.name }}
141156
runner: ${{ matrix.runner }}
142157
image: ${{ matrix.image }}
143-
image_options: ${{ matrix.image_options }}
158+
image_options: ${{ matrix.image_options || '-u 1001 --device=/dev/dri -v /dev/dri/by-path:/dev/dri/by-path --privileged --cap-add SYS_ADMIN' }}
144159
target_devices: ${{ matrix.target_devices }}
145160
extra_lit_opts: ${{ matrix.extra_lit_opts }}
146161
repo_ref: ${{ github.sha }}

.github/workflows/sycl-linux-run-tests.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,9 @@ on:
6262
description: |
6363
When set in modes other than `run-only` results in artifact upload.
6464
For `run-only` mode, if specified, means downloading pre-built
65-
binaries from the artifact, otherwise they are expected to be part of
66-
the container.
65+
binaries from the artifact. If set to special value `in-container`
66+
then the binaries are expected to be stored in the container image
67+
instead of coming from an artifact.
6768
type: string
6869
default: ''
6970
required: False

.github/workflows/sycl-nightly.yml

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,34 +77,46 @@ jobs:
7777
image_options: -u 1001 --device=/dev/dri --device=/dev/kfd
7878
target_devices: hip:gpu
7979

80+
- name: Preview mode on AMD/HIP
81+
runner: '["Linux", "amdgpu"]'
82+
image_options: -u 1001 --device=/dev/dri --device=/dev/kfd
83+
target_devices: hip:gpu
84+
extra_lit_opts: --param test-preview-mode=True
85+
8086
- name: NVIDIA/CUDA
8187
runner: '["Linux", "cuda"]'
8288
image_options: -u 1001 --gpus all --cap-add SYS_ADMIN
8389
target_devices: cuda:gpu
8490

91+
- name: Preview mode on NVIDIA/CUDA
92+
runner: '["Linux", "cuda"]'
93+
image_options: -u 1001 --gpus all --cap-add SYS_ADMIN
94+
target_devices: cuda:gpu
95+
extra_lit_opts: --param test-preview-mode=True
96+
8597
- name: Intel L0 Gen12 GPU
8698
runner: '["Linux", "gen12"]'
87-
image_options: -u 1001 --device=/dev/dri -v /dev/dri/by-path:/dev/dri/by-path --privileged --cap-add SYS_ADMIN
8899
target_devices: level_zero:gpu
89100

90101
- name: Intel L0 Ponte Vecchio GPU
91102
runner: '["Linux", "pvc"]'
92-
image_options: -u 1001 --device=/dev/dri -v /dev/dri/by-path:/dev/dri/by-path --privileged --cap-add SYS_ADMIN
93103
target_devices: level_zero:gpu
94104

95105
- name: Intel L0 Battlemage GPU
96106
runner: '["Linux", "bmg"]'
97-
image_options: -u 1001 --device=/dev/dri -v /dev/dri/by-path:/dev/dri/by-path --privileged --cap-add SYS_ADMIN
98107
target_devices: level_zero:gpu
99108

109+
- name: Preview mode on Intel L0 Battlemage GPU
110+
runner: '["Linux", "bmg"]'
111+
target_devices: level_zero:gpu
112+
extra_lit_opts: --param test-preview-mode=True
113+
100114
- name: Intel L0 Arc A-Series GPU
101115
runner: '["Linux", "arc"]'
102-
image_options: -u 1001 --device=/dev/dri -v /dev/dri/by-path:/dev/dri/by-path --privileged --cap-add SYS_ADMIN
103116
target_devices: level_zero:gpu
104117

105118
- name: Intel OCL Gen12 GPU
106119
runner: '["Linux", "gen12"]'
107-
image_options: -u 1001 --device=/dev/dri -v /dev/dri/by-path:/dev/dri/by-path --privileged --cap-add SYS_ADMIN
108120
target_devices: opencl:gpu
109121

110122
- name: OCL CPU (AMD)
@@ -124,15 +136,14 @@ jobs:
124136

125137
- name: Preview mode on SPR/PVC
126138
runner: '["Linux", "pvc"]'
127-
image_options: -u 1001 --device=/dev/dri -v /dev/dri/by-path:/dev/dri/by-path --privileged --cap-add SYS_ADMIN
128139
target_devices: level_zero:gpu
129140
extra_lit_opts: --param test-preview-mode=True
130141

131142
uses: ./.github/workflows/sycl-linux-run-tests.yml
132143
with:
133144
name: ${{ matrix.name }}
134145
runner: ${{ matrix.runner }}
135-
image_options: ${{ matrix.image_options }}
146+
image_options: ${{ matrix.image_options || '-u 1001 --device=/dev/dri -v /dev/dri/by-path:/dev/dri/by-path --privileged --cap-add SYS_ADMIN' }}
136147
target_devices: ${{ matrix.target_devices }}
137148
tests_selector: e2e
138149
extra_lit_opts: "--param 'cxx_flags=-D_GLIBCXX_USE_CXX11_ABI=0' ${{ matrix.extra_lit_opts }}"

.github/workflows/sycl-post-commit.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ jobs:
5757
target_devices: level_zero:gpu
5858
- name: Intel Arc A-Series Graphics with Level Zero
5959
runner: '["Linux", "arc"]'
60-
extra_lit_opts: --param matrix-xmx8=True
6160
# Performance tests below. Specifics:
6261
# - only run performance tests (use LIT_FILTER env)
6362
# - ask llvm-lit to show all the output, even for PASS (-a)

.github/workflows/sycl-windows-precommit.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ on:
2525
- '.github/workflows/trivy.yml'
2626
- 'devops/containers/**'
2727
- 'devops/actions/build_container/**'
28+
- 'devops/compat_ci_exclude.sycl-rel-6_2'
2829
- 'unified-runtime/examples/**'
2930
- 'unified-runtime/scripts/**'
3031
- 'unified-runtime/test/**'

clang/lib/Sema/SemaSYCL.cpp

Lines changed: 57 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include "clang/AST/SYCLKernelInfo.h"
1919
#include "clang/AST/StmtSYCL.h"
2020
#include "clang/AST/TemplateArgumentVisitor.h"
21+
#include "clang/AST/Type.h"
2122
#include "clang/AST/TypeOrdering.h"
2223
#include "clang/AST/TypeVisitor.h"
2324
#include "clang/Analysis/CallGraph.h"
@@ -6737,23 +6738,75 @@ class FreeFunctionPrinter {
67376738
/// returned string Example:
67386739
/// \code
67396740
/// template <typename T1, typename T2>
6740-
/// void foo(T1 a, T2 b);
6741+
/// void foo(T1 a, int b, T2 c);
67416742
/// \endcode
6742-
/// returns string "T1 a, T2 b"
6743+
/// returns string "T1, int, T2"
67436744
std::string
67446745
getTemplatedParamList(const llvm::ArrayRef<clang::ParmVarDecl *> Parameters,
67456746
PrintingPolicy Policy) {
67466747
bool FirstParam = true;
67476748
llvm::SmallString<128> ParamList;
67486749
llvm::raw_svector_ostream ParmListOstream{ParamList};
67496750
Policy.SuppressTagKeyword = true;
6751+
67506752
for (ParmVarDecl *Param : Parameters) {
67516753
if (FirstParam)
67526754
FirstParam = false;
67536755
else
67546756
ParmListOstream << ", ";
6755-
ParmListOstream << Param->getType().getAsString(Policy);
6756-
ParmListOstream << " " << Param->getNameAsString();
6757+
6758+
// There are cases when we can't directly use neither the original
6759+
// argument type, nor its canonical version. An example would be:
6760+
// template<typename T>
6761+
// void kernel(sycl::accessor<T, 1>);
6762+
// template void kernel(sycl::accessor<int, 1>);
6763+
// Accessor has multiple non-type template arguments with default values
6764+
// and non-qualified type will not include necessary namespaces for all
6765+
// of them. Qualified type will have that information, but all references
6766+
// to T will be replaced to something like type-argument-0
6767+
// What we do instead is we iterate template arguments of both versions
6768+
// of a type in sync and take elements from one or another to get the best
6769+
// of both: proper references to template arguments of a kernel itself and
6770+
// fully-qualified names for enumerations.
6771+
//
6772+
// Moral of the story: drop integration header ASAP (but that is blocked
6773+
// by support for 3rd-party host compilers, which is important).
6774+
QualType T = Param->getType();
6775+
QualType CT = T.getCanonicalType();
6776+
6777+
auto *ET = dyn_cast<ElaboratedType>(T.getTypePtr());
6778+
if (!ET) {
6779+
ParmListOstream << T.getAsString(Policy);
6780+
continue;
6781+
}
6782+
6783+
auto *TST =
6784+
dyn_cast<TemplateSpecializationType>(ET->getNamedType().getTypePtr());
6785+
auto *CTST = dyn_cast<TemplateSpecializationType>(CT.getTypePtr());
6786+
if (!TST || !CTST) {
6787+
ParmListOstream << T.getAsString(Policy);
6788+
continue;
6789+
}
6790+
6791+
TemplateName TN = TST->getTemplateName();
6792+
auto SpecArgs = TST->template_arguments();
6793+
auto DeclArgs = CTST->template_arguments();
6794+
6795+
TN.getAsTemplateDecl()->printQualifiedName(ParmListOstream);
6796+
ParmListOstream << "<";
6797+
6798+
for (size_t I = 0, E = std::max(DeclArgs.size(), SpecArgs.size()),
6799+
SE = SpecArgs.size();
6800+
I < E; ++I) {
6801+
if (I != 0)
6802+
ParmListOstream << ", ";
6803+
if (I < SE) // A specialized argument exists, use it
6804+
SpecArgs[I].print(Policy, ParmListOstream, false /* IncludeType */);
6805+
else // Print a canonical form of a default argument
6806+
DeclArgs[I].print(Policy, ParmListOstream, false /* IncludeType */);
6807+
}
6808+
6809+
ParmListOstream << ">";
67576810
}
67586811
return ParamList.str().str();
67596812
}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
// RUN: %clang_cc1 -fsycl-is-device -internal-isystem %S/Inputs -triple spir64-unknown-unknown -sycl-std=2020 -fsycl-int-header=%t.h %s
2+
// RUN: FileCheck -input-file=%t.h %s
3+
//
4+
// The purpose of this test is to ensure that forward declarations of free
5+
// function kernels are emitted properly.
6+
// However, this test checks a specific scenario:
7+
// - free function kernel is a function template
8+
// - its argument is templated and has non-type template parameter (with default
9+
// value) that is an enumeration defined within a namespace
10+
11+
namespace ns {
12+
13+
enum class enum_A { A, B, C };
14+
15+
template<typename T, enum_A V = enum_A::B>
16+
class feature_A {};
17+
18+
namespace nested {
19+
enum class enum_B { A, B, C };
20+
21+
template<typename T, int V, enum_B V2 = enum_B::A, enum_A V3 = enum_A::C>
22+
struct feature_B {};
23+
}
24+
25+
inline namespace nested_inline {
26+
namespace nested2 {
27+
enum class enum_C { A, B, C };
28+
29+
template<int V = 42, enum_C V2 = enum_C::B>
30+
struct feature_C {};
31+
}
32+
} // namespace nested_inline
33+
} // namespace ns
34+
35+
template<typename T>
36+
[[__sycl_detail__::add_ir_attributes_function("sycl-nd-range-kernel", 2)]]
37+
void templated_on_A(ns::feature_A<T> Arg) {}
38+
template void templated_on_A(ns::feature_A<int>);
39+
40+
// CHECK: template <typename T> void templated_on_A(ns::feature_A<T, ns::enum_A::B>);
41+
42+
template<typename T, int V = 42>
43+
[[__sycl_detail__::add_ir_attributes_function("sycl-nd-range-kernel", 2)]]
44+
void templated_on_B(ns::nested::feature_B<T, V> Arg) {}
45+
template void templated_on_B(ns::nested::feature_B<int, 12>);
46+
47+
// CHECK: template <typename T, int V> void templated_on_B(ns::nested::feature_B<T, V, ns::nested::enum_B::A, ns::enum_A::C>);
48+
49+
template<int V>
50+
[[__sycl_detail__::add_ir_attributes_function("sycl-nd-range-kernel", 2)]]
51+
void templated_on_C(ns::nested2::feature_C<V> Arg) {}
52+
template void templated_on_C(ns::nested2::feature_C<42>);
53+
54+
// CHECK: template <int V> void templated_on_C(ns::nested2::feature_C<V, ns::nested2::enum_C::B>);

0 commit comments

Comments
 (0)