Skip to content

Commit ed21504

Browse files
author
iclsrc
committed
Merge from 'sycl' to 'sycl-web'
2 parents 801e12e + 51dcb29 commit ed21504

File tree

58 files changed

+1321
-981
lines changed

Some content is hidden

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

58 files changed

+1321
-981
lines changed

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

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -86,15 +86,13 @@ jobs:
8686
image_options: -u 1001 --device=/dev/dri --privileged --cap-add SYS_ADMIN
8787
target_devices: level_zero:gpu;opencl:gpu;opencl:cpu
8888
reset_intel_gpu: true
89-
install_drivers: ${{ contains(needs.detect_changes.outputs.filters, 'drivers') }}
9089
extra_lit_opts: --param gpu-intel-gen12=True
9190
- name: E2E tests on Intel Arc A-Series Graphics
9291
runner: '["Linux", "arc"]'
9392
image: ghcr.io/intel/llvm/ubuntu2204_intel_drivers:latest
9493
image_options: -u 1001 --device=/dev/dri --privileged --cap-add SYS_ADMIN
9594
target_devices: level_zero:gpu;opencl:gpu
9695
reset_intel_gpu: true
97-
install_drivers: ${{ contains(needs.detect_changes.outputs.filters, 'drivers') }}
9896
extra_lit_opts: --param matrix-xmx8=True --param gpu-intel-dg2=True
9997
env: '{"LIT_FILTER":${{ needs.determine_arc_tests.outputs.arc_tests }} }'
10098
- name: E2E tests with dev igc on Intel Arc A-Series Graphics
@@ -103,14 +101,9 @@ jobs:
103101
image_options: -u 1001 --device=/dev/dri --privileged --cap-add SYS_ADMIN
104102
target_devices: level_zero:gpu;opencl:gpu
105103
reset_intel_gpu: true
106-
install_drivers: >-
107-
${{ contains(needs.detect_changes.outputs.filters, 'drivers') ||
108-
contains(needs.detect_changes.outputs.filters, 'devigccfg') }}
109-
use_dev_igc: ${{ contains(needs.detect_changes.outputs.filters, 'devigccfg') }}
110104
extra_lit_opts: --param matrix-xmx8=True --param gpu-intel-dg2=True
111105
env: '{"LIT_FILTER":${{ needs.determine_arc_tests.outputs.arc_tests }} }'
112-
# Run only if the PR does not have the 'ci-no-devigc' label.
113-
skip_run: ${{ contains(github.event.pull_request.labels.*.name, 'ci-no-devigc') }}
106+
use_igc_dev: true
114107

115108
uses: ./.github/workflows/sycl-linux-run-tests.yml
116109
with:
@@ -120,11 +113,13 @@ jobs:
120113
image_options: ${{ matrix.image_options }}
121114
target_devices: ${{ matrix.target_devices }}
122115
reset_intel_gpu: ${{ matrix.reset_intel_gpu }}
123-
install_drivers: ${{ matrix.install_drivers }}
124-
use_dev_igc: ${{ matrix.use_dev_igc }}
125116
extra_lit_opts: ${{ matrix.extra_lit_opts }}
126117
env: ${{ matrix.env || '{}' }}
127-
skip_run: ${{ matrix.skip_run || 'false' }}
118+
119+
install_igc_driver: ${{ contains(needs.detect_changes.outputs.filters, 'drivers') }}
120+
install_dev_igc_driver: ${{ matrix.use_igc_dev && contains(needs.detect_changes.outputs.filters, 'devigccfg') || 'false' }}
121+
# Run only if the PR does not have the 'ci-no-devigc' label.
122+
skip_run: ${{matrix.use_igc_dev && contains(github.event.pull_request.labels.*.name, 'ci-no-devigc') || 'false'}}
128123

129124
ref: ${{ github.sha }}
130125
merge_ref: ''

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,10 @@ on:
6565
reset_intel_gpu:
6666
type: string
6767
required: False
68-
install_drivers:
68+
install_igc_driver:
6969
type: string
7070
required: False
71-
use_dev_igc:
71+
install_dev_igc_driver:
7272
type: string
7373
required: False
7474
env:
@@ -134,13 +134,13 @@ on:
134134
Extra options to be added to LIT_OPTS.
135135
default: ''
136136

137-
install_drivers:
137+
install_igc_driver:
138138
type: choice
139139
options:
140140
- false
141141
- true
142142

143-
use_dev_igc:
143+
install_dev_igc_driver:
144144
type: choice
145145
options:
146146
- false
@@ -193,15 +193,15 @@ jobs:
193193
run: |
194194
git -C khronos_sycl_cts submodule update --init
195195
- name: Install drivers
196-
if: inputs.install_drivers == 'true'
196+
if: inputs.install_igc_driver == 'true' || inputs.install_dev_igc_driver == 'true'
197197
env:
198198
GITHUB_TOKEN: ${{ github.token }}
199199
run: |
200-
if [ "${{ inputs.use_dev_igc }}" = "true" ]; then
200+
if [ "${{ inputs.install_dev_igc_driver }}" = "true" ]; then
201201
# If libllvm14 is already installed (dev igc docker), still return true.
202202
sudo apt-get install -yqq libllvm14 || true;
203203
fi
204-
sudo -E bash devops/scripts/install_drivers.sh llvm/devops/dependencies.json ${{ inputs.use_dev_igc == 'true' && 'llvm/devops/dependencies-igc-dev.json --use-dev-igc' || '' }} --all
204+
sudo -E bash devops/scripts/install_drivers.sh llvm/devops/dependencies.json ${{ inputs.install_dev_igc_driver == 'true' && 'llvm/devops/dependencies-igc-dev.json --use-dev-igc' || '' }} --all
205205
- name: Source OneAPI TBB vars.sh
206206
shell: bash
207207
run: |

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12374,6 +12374,8 @@ def err_bit_cast_type_size_mismatch : Error<
1237412374
"__builtin_bit_cast source size does not equal destination size (%0 vs %1)">;
1237512375

1237612376
// SYCL-specific diagnostics
12377+
def warn_sycl_incorrect_use_attribute_non_kernel_function : Warning<
12378+
"%0 attribute can only be applied to a SYCL kernel function">, InGroup<SyclStrict>;
1237712379
def warn_sycl_kernel_num_of_template_params : Warning<
1237812380
"'sycl_kernel' attribute only applies to a function template with at least"
1237912381
" two template parameters">, InGroup<IgnoredAttributes>;

clang/include/clang/Sema/SemaSYCL.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,8 @@ class SemaSYCL : public SemaBase {
259259
// useful notes that shows where the kernel was called.
260260
bool DiagnosingSYCLKernel = false;
261261

262+
llvm::DenseSet<const FunctionDecl *> SYCLKernelFunctions;
263+
262264
public:
263265
SemaSYCL(Sema &S);
264266

@@ -300,6 +302,10 @@ class SemaSYCL : public SemaBase {
300302
void addSyclDeviceDecl(Decl *d) { SyclDeviceDecls.insert(d); }
301303
llvm::SetVector<Decl *> &syclDeviceDecls() { return SyclDeviceDecls; }
302304

305+
void addSYCLKernelFunction(const FunctionDecl *FD) {
306+
SYCLKernelFunctions.insert(FD);
307+
}
308+
303309
/// Lazily creates and returns SYCL integration header instance.
304310
SYCLIntegrationHeader &getSyclIntegrationHeader() {
305311
if (SyclIntHeader == nullptr)
@@ -375,6 +381,8 @@ class SemaSYCL : public SemaBase {
375381
SourceLocation Loc,
376382
DeviceDiagnosticReason Reason);
377383

384+
void performSYCLDelayedAttributesAnalaysis(const FunctionDecl *FD);
385+
378386
/// Tells whether given variable is a SYCL explicit SIMD extension's "private
379387
/// global" variable - global variable in the private address space.
380388
bool isSYCLEsimdPrivateGlobal(VarDecl *VDecl) {

clang/lib/Sema/Sema.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1909,6 +1909,10 @@ class DeferredDiagnosticsEmitter
19091909
void checkFunc(SourceLocation Loc, FunctionDecl *FD) {
19101910
auto &Done = DoneMap[InOMPDeviceContext > 0 ? 1 : 0];
19111911
FunctionDecl *Caller = UsePath.empty() ? nullptr : UsePath.back();
1912+
1913+
if (!Caller && S.LangOpts.SYCLIsDevice)
1914+
S.SYCL().performSYCLDelayedAttributesAnalaysis(FD);
1915+
19121916
if ((!ShouldEmitRootNode && !S.getLangOpts().OpenMP && !Caller) ||
19131917
S.shouldIgnoreInHostDeviceCheck(FD) || InUsePath.count(FD))
19141918
return;

clang/lib/Sema/SemaSYCL.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -882,6 +882,8 @@ class SingleDeviceFunctionTracker {
882882
// having a kernel lambda with a lambda call inside of it.
883883
KernelBody = CurrentDecl;
884884
}
885+
if (KernelBody)
886+
Parent.SemaSYCLRef.addSYCLKernelFunction(KernelBody);
885887
}
886888

887889
// Recurse.
@@ -6852,3 +6854,19 @@ ExprResult SemaSYCL::ActOnUniqueStableNameExpr(SourceLocation OpLoc,
68526854

68536855
return BuildUniqueStableNameExpr(OpLoc, LParen, RParen, TSI);
68546856
}
6857+
6858+
void SemaSYCL::performSYCLDelayedAttributesAnalaysis(const FunctionDecl *FD) {
6859+
if (SYCLKernelFunctions.contains(FD))
6860+
return;
6861+
6862+
for (const auto *KernelAttr : std::vector<AttributeCommonInfo *>{
6863+
FD->getAttr<SYCLReqdWorkGroupSizeAttr>(),
6864+
FD->getAttr<IntelReqdSubGroupSizeAttr>(),
6865+
FD->getAttr<SYCLWorkGroupSizeHintAttr>(),
6866+
FD->getAttr<VecTypeHintAttr>()}) {
6867+
if (KernelAttr)
6868+
Diag(KernelAttr->getLoc(),
6869+
diag::warn_sycl_incorrect_use_attribute_non_kernel_function)
6870+
<< KernelAttr;
6871+
}
6872+
}

clang/test/Driver/sycl.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// Failing on Windows - temporarily disable
2+
// REQUIRES: system-linux
3+
14
// RUN: %clang -### -fsycl -c %s 2>&1 | FileCheck %s --check-prefix=ENABLED
25
// RUN: %clang -### -fsycl %s 2>&1 | FileCheck %s --check-prefix=ENABLED
36
// RUN: %clang -### -fno-sycl -fsycl %s 2>&1 | FileCheck %s --check-prefix=ENABLED

clang/test/SemaSYCL/check-work-group-size-hint-device.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717

1818
// Produce a conflicting attribute warning when the args are different.
1919
[[sycl::work_group_size_hint(4, 1, 1)]] void f3(); // expected-note {{previous attribute is here}}
20-
[[sycl::work_group_size_hint(1, 1, 32)]] void f3() {} // expected-warning {{attribute 'work_group_size_hint' is already applied with different arguments}}
20+
[[sycl::work_group_size_hint(1, 1, 32)]] void f3() {} // expected-warning {{attribute 'work_group_size_hint' is already applied with different arguments}} \
21+
// expected-warning {{'work_group_size_hint' attribute can only be applied to a SYCL kernel function}}
2122

2223
// 1 and 2 dim versions
2324
[[sycl::work_group_size_hint(2)]] void f4(); // ok
@@ -70,10 +71,13 @@ void instantiate() {
7071
f8<0>(); // expected-note {{in instantiation}}
7172
#endif
7273

74+
// expected-warning@#f9prev {{'work_group_size_hint' attribute can only be applied to a SYCL kernel function}}
7375
f9<1, 1, 1>(); // OK, args are the same on the redecl.
7476

7577
// expected-warning@#f9 {{attribute 'work_group_size_hint' is already applied with different arguments}}
7678
// expected-note@#f9prev {{previous attribute is here}}
79+
// expected-warning@#f9prev {{'work_group_size_hint' attribute can only be applied to a SYCL kernel function}}
80+
7781
f9<1, 2, 3>(); // expected-note {{in instantiation}}
7882
}
7983

@@ -97,14 +101,14 @@ class Functor16x2x1 {
97101

98102
class Functor4x4x4 {
99103
public:
100-
[[sycl::work_group_size_hint(4, 4, 4)]] void operator()() const {};
104+
[[sycl::work_group_size_hint(4, 4, 4)]] void operator()() const {}; // expected-warning {{'work_group_size_hint' attribute can only be applied to a SYCL kernel function}}
101105
};
102106

103107
// Checking whether propagation of the attribute happens or not, according to the SYCL version.
104108
#if defined(EXPECT_PROP) // if attribute is propagated, then we expect errors here
105109
void f8x8x8(){};
106110
#else // otherwise no error
107-
[[sycl::work_group_size_hint(8, 8, 8)]] void f8x8x8(){};
111+
[[sycl::work_group_size_hint(8, 8, 8)]] void f8x8x8(){}; // expected-warning {{'work_group_size_hint' attribute can only be applied to a SYCL kernel function}}
108112
#endif
109113
class FunctorNoProp {
110114
public:

clang/test/SemaSYCL/device_has.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ enum class aspect {
1717

1818
[[sycl::device_has("123")]] void func1() {} // expected-error{{'device_has' attribute argument is invalid; argument must be device aspect of type sycl::aspect}}
1919
[[sycl::device_has(fake_cl::sycl::aspect::aspect1)]] void func2() {} // expected-error{{'device_has' attribute argument is invalid; argument must be device aspect of type sycl::aspect}}
20-
2120
[[sycl::device_has(sycl::aspect::cpu)]] void func3(); // expected-note{{previous attribute is here}}
2221
[[sycl::device_has(sycl::aspect::gpu)]] void func3() {} // expected-warning{{attribute 'device_has' is already applied}}
2322

clang/test/SemaSYCL/intel-max-work-group-size.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,15 @@ void instantiate() {
7070
// a declaration along with [[sycl::reqd_work_group_size(X1, Y1, Z1)]]
7171
// attribute, check to see if values of reqd_work_group_size arguments are
7272
// equal or less than values coming from max_work_group_size attribute.
73-
[[sycl::reqd_work_group_size(64, 64, 64)]] // expected-note {{conflicting attribute is here}}
73+
[[sycl::reqd_work_group_size(64, 64, 64)]] // expected-note {{conflicting attribute is here}} // expected-warning {{'reqd_work_group_size' attribute can only be applied to a SYCL kernel function}}
7474
[[intel::max_work_group_size(64, 16, 64)]] // expected-error {{'max_work_group_size' attribute conflicts with 'reqd_work_group_size' attribute}}
7575
void
7676
f9() {}
7777

7878
[[intel::max_work_group_size(4, 4, 4)]] void f10();
7979
[[sycl::reqd_work_group_size(2, 2, 2)]] void f10(); // OK
8080

81-
[[sycl::reqd_work_group_size(2, 2, 2)]] [[intel::max_work_group_size(4, 4, 4)]] void f11() {} // OK
81+
[[sycl::reqd_work_group_size(2, 2, 2)]] [[intel::max_work_group_size(4, 4, 4)]] void f11() {} // expected-warning {{'reqd_work_group_size' attribute can only be applied to a SYCL kernel function}}
8282

8383
[[sycl::reqd_work_group_size(64, 64, 64)]] void f12(); // expected-note {{conflicting attribute is here}}
8484
[[intel::max_work_group_size(16, 16, 16)]] void f12(); // expected-error {{'max_work_group_size' attribute conflicts with 'reqd_work_group_size' attribute}}
@@ -91,14 +91,14 @@ f13() {}
9191
[[sycl::reqd_work_group_size(64, 64, 64)]] void f14(); // expected-error{{'reqd_work_group_size' attribute conflicts with 'max_work_group_size' attribute}}
9292

9393
[[cl::reqd_work_group_size(1, 2, 3)]] // expected-warning {{attribute 'cl::reqd_work_group_size' is deprecated}} \
94-
// expected-note {{did you mean to use 'sycl::reqd_work_group_size' instead?}}
94+
// expected-note {{did you mean to use 'sycl::reqd_work_group_size' instead?}} // expected-warning {{'reqd_work_group_size' attribute can only be applied to a SYCL kernel function}}
9595
[[intel::max_work_group_size(1, 2, 3)]] void
9696
f15() {} // OK
9797

9898
[[intel::max_work_group_size(2, 3, 7)]] void f16(); // expected-note {{conflicting attribute is here}}
9999
[[sycl::reqd_work_group_size(7, 3, 2)]] void f16(); // expected-error{{'reqd_work_group_size' attribute conflicts with 'max_work_group_size' attribute}}
100100

101-
[[intel::max_work_group_size(1, 2, 3)]] [[sycl::reqd_work_group_size(1, 2, 3)]] void f17(){}; // OK
101+
[[intel::max_work_group_size(1, 2, 3)]] [[sycl::reqd_work_group_size(1, 2, 3)]] void f17(){}; // expected-warning {{'reqd_work_group_size' attribute can only be applied to a SYCL kernel function}}
102102

103103
[[sycl::reqd_work_group_size(16)]] // expected-note {{conflicting attribute is here}}
104104
[[intel::max_work_group_size(16, 1, 1)]] void // expected-error {{'max_work_group_size' attribute conflicts with 'reqd_work_group_size' attribute}}

clang/test/SemaSYCL/reqd-sub-group-size.cpp

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,19 @@ int main() {
3333
return 0;
3434
}
3535
[[intel::reqd_sub_group_size(16)]] SYCL_EXTERNAL void B();
36-
[[intel::reqd_sub_group_size(16)]] void A() {
36+
[[intel::reqd_sub_group_size(16)]] void A() // expected-warning {{'reqd_sub_group_size' attribute can only be applied to a SYCL kernel function}}
37+
{
3738
}
3839

39-
[[intel::reqd_sub_group_size(16)]] SYCL_EXTERNAL void B() {
40+
[[intel::reqd_sub_group_size(16)]] SYCL_EXTERNAL void B() { // expected-warning {{'reqd_sub_group_size' attribute can only be applied to a SYCL kernel function}}
4041
A();
4142
}
4243
// expected-note@+1 {{conflicting attribute is here}}
43-
[[intel::reqd_sub_group_size(2)]] void sg_size2() {}
44+
[[intel::reqd_sub_group_size(2)]] void sg_size2() {} // expected-warning {{'reqd_sub_group_size' attribute can only be applied to a SYCL kernel function}}
4445

45-
// expected-note@+2 {{conflicting attribute is here}}
46-
// expected-error@+1 {{conflicting attributes applied to a SYCL kernel}}
46+
// expected-note@+3 {{conflicting attribute is here}}
47+
// expected-error@+2 {{conflicting attributes applied to a SYCL kernel}}
48+
// expected-warning@+1 {{'reqd_sub_group_size' attribute can only be applied to a SYCL kernel function}}
4749
[[intel::reqd_sub_group_size(4)]] __attribute__((sycl_device)) void sg_size4() {
4850
sg_size2();
4951
}
@@ -67,7 +69,7 @@ int main() {
6769

6870
// No diagnostic is emitted because the arguments match.
6971
[[intel::reqd_sub_group_size(12)]] void same();
70-
[[intel::reqd_sub_group_size(12)]] void same() {} // OK
72+
[[intel::reqd_sub_group_size(12)]] void same() {} // expected-warning {{'reqd_sub_group_size' attribute can only be applied to a SYCL kernel function}}
7173

7274
// No diagnostic because the attributes are synonyms with identical behavior.
7375
[[sycl::reqd_sub_group_size(12)]] void same(); // OK
@@ -117,10 +119,12 @@ int check() {
117119

118120
// Test that checks template parameter support on function.
119121
template <int N>
120-
// expected-error@+1{{'reqd_sub_group_size' attribute requires a positive integral compile time constant expression}}
122+
// expected-error@+2{{'reqd_sub_group_size' attribute requires a positive integral compile time constant expression}}
123+
// expected-warning@+1 {{'reqd_sub_group_size' attribute can only be applied to a SYCL kernel function}}
121124
[[intel::reqd_sub_group_size(N)]] void func3() {}
122125

123126
template <int N>
127+
// expected-warning@+1 {{'reqd_sub_group_size' attribute can only be applied to a SYCL kernel function}}
124128
[[intel::reqd_sub_group_size(4)]] void func4(); // expected-note {{previous attribute is here}}
125129

126130
template <int N>

0 commit comments

Comments
 (0)