Skip to content

Commit 4b7e2c9

Browse files
Merge branch 'sycl' into sycl-devops-pr/udit/pvc_e2e
2 parents 0914234 + 15929c6 commit 4b7e2c9

File tree

77 files changed

+1113
-233
lines changed

Some content is hidden

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

77 files changed

+1113
-233
lines changed

.github/workflows/sycl-containers-igc-dev.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
imagefile: ubuntu2404_intel_drivers
3434
tag: devigc
3535
build_args: |
36-
"use_latest=false"
36+
"use_unstable_driver=false"
3737
"use_igc_dev=true"
3838
steps:
3939
- name: Checkout

.github/workflows/sycl-containers.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,22 +54,22 @@ jobs:
5454
- name: Intel Drivers Ubuntu 22.04 Docker image
5555
file: ubuntu2204_intel_drivers
5656
tag: latest
57-
build_args: "use_latest=false"
57+
build_args: "use_unstable_driver=false"
5858
- name: Intel Drivers Ubuntu 24.04 Docker image
5959
file: ubuntu2404_intel_drivers
6060
tag: latest
61-
build_args: "use_latest=false"
61+
build_args: "use_unstable_driver=false"
6262
- name: Intel Drivers (unstable) Ubuntu 24.04 Docker image
6363
file: ubuntu2404_intel_drivers
6464
tag: unstable
65-
build_args: "use_latest=true"
65+
build_args: "use_unstable_driver=true"
6666
- name: Build + Intel Drivers Ubuntu 22.04 Docker image
6767
file: ubuntu2204_intel_drivers
6868
tag: alldeps
6969
build_args: |
7070
base_image=ghcr.io/intel/llvm/ubuntu2204_build
7171
base_tag=latest
72-
use_latest=false
72+
use_unstable_driver=false
7373
steps:
7474
- name: Checkout
7575
uses: actions/checkout@v4

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

Lines changed: 47 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,53 @@ jobs:
7272
else
7373
echo 'arc_tests="Matrix/"' >> "$GITHUB_OUTPUT"
7474
fi
75+
76+
build_e2e_tests:
77+
needs: [build]
78+
if: ${{ always() && !cancelled() && needs.build.outputs.build_conclusion == 'success' }}
79+
uses: ./.github/workflows/sycl-linux-run-tests.yml
80+
with:
81+
name: Build e2e tests
82+
runner: '["Linux", "build"]'
83+
image: ghcr.io/intel/llvm/ubuntu2404_intel_drivers:latest
84+
image_options: -u 1001
85+
ref: ${{ github.sha }}
86+
merge_ref: ''
87+
sycl_toolchain_artifact: sycl_linux_default
88+
sycl_toolchain_archive: ${{ needs.build.outputs.artifact_archive_name }}
89+
sycl_toolchain_decompress_command: ${{ needs.build.outputs.artifact_decompress_command }}
90+
e2e_testing_mode: 'build-only'
91+
run_prebuilt_e2e_tests:
92+
needs: [build, build_e2e_tests]
93+
if: ${{ always() && !cancelled() && needs.build.outputs.build_conclusion == 'success' }}
94+
strategy:
95+
fail-fast: false
96+
matrix:
97+
include:
98+
- name: Intel
99+
runner: '["Linux", "gen12"]'
100+
image: ghcr.io/intel/llvm/ubuntu2404_intel_drivers:latest
101+
image_options: -u 1001 --device=/dev/dri -v /dev/dri/by-path:/dev/dri/by-path --privileged --cap-add SYS_ADMIN
102+
target_devices: level_zero:gpu;opencl:gpu;opencl:cpu
103+
reset_intel_gpu: true
104+
extra_lit_opts: --param gpu-intel-gen12=True
105+
uses: ./.github/workflows/sycl-linux-run-tests.yml
106+
with:
107+
name: ${{ matrix.name }}
108+
runner: ${{ matrix.runner }}
109+
image: ${{ matrix.image }}
110+
image_options: ${{ matrix.image_options }}
111+
target_devices: ${{ matrix.target_devices }}
112+
extra_lit_opts: --param fallback-to-build-if-requires-build-and-run=True ${{ matrix.extra_lit_opts }}
113+
reset_intel_gpu: ${{ matrix.reset_intel_gpu }}
114+
ref: ${{ github.sha }}
115+
merge_ref: ''
116+
sycl_toolchain_artifact: sycl_linux_default
117+
sycl_toolchain_archive: ${{ needs.build.outputs.artifact_archive_name }}
118+
sycl_toolchain_decompress_command: ${{ needs.build.outputs.artifact_decompress_command }}
119+
e2e_binaries_artifact: sycl_e2e_bin_default
120+
e2e_testing_mode: 'run-only'
121+
75122
test:
76123
needs: [build, detect_changes, determine_arc_tests]
77124
if: ${{ always() && !cancelled() && needs.build.outputs.build_conclusion == 'success' }}
@@ -90,13 +137,6 @@ jobs:
90137
image_options: -u 1001 --device=/dev/dri --device=/dev/kfd
91138
target_devices: ext_oneapi_hip:gpu
92139
reset_intel_gpu: false
93-
- name: Intel
94-
runner: '["Linux", "gen12"]'
95-
image: ghcr.io/intel/llvm/ubuntu2404_intel_drivers:latest
96-
image_options: -u 1001 --device=/dev/dri -v /dev/dri/by-path:/dev/dri/by-path --privileged --cap-add SYS_ADMIN
97-
target_devices: level_zero:gpu;opencl:gpu;opencl:cpu
98-
reset_intel_gpu: true
99-
extra_lit_opts: --param gpu-intel-gen12=True
100140
- name: E2E tests on Intel Arc A-Series Graphics
101141
runner: '["Linux", "arc"]'
102142
image: ghcr.io/intel/llvm/ubuntu2404_intel_drivers:latest

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

Lines changed: 56 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ on:
1919

2020
target_devices:
2121
type: string
22-
required: True
22+
required: False
2323
extra_cmake_args:
2424
type: string
2525
required: False
@@ -59,6 +59,30 @@ on:
5959
default: ''
6060
required: False
6161

62+
e2e_binaries_artifact:
63+
description: |
64+
By setting this the E2E binaries folder will not be created, rather it
65+
will be downloaded and extracted from the specified artifact. When
66+
running tests in `run-only` mode this must be provided.
67+
type: string
68+
default: ''
69+
required: False
70+
e2e_testing_mode:
71+
description: |
72+
Testing mode to run E2E tests in, can be either `full`, `build-only`
73+
or `run-only`. In `build-only` mode an artifact of the E2E binaries
74+
will be uploaded.
75+
type: string
76+
default: 'full'
77+
artifact_suffix:
78+
description: 'Suffix for E2E binaries artifact that is output when in `build-only`.'
79+
type: string
80+
default: 'default'
81+
retention-days:
82+
description: 'E2E binaries artifact retention period.'
83+
type: string
84+
default: 1
85+
6286
reset_intel_gpu:
6387
type: string
6488
required: False
@@ -88,6 +112,7 @@ on:
88112
- '["Linux", "arc"]'
89113
- '["Linux", "pvc"]'
90114
- '["cts-cpu"]'
115+
- '["Linux", "build"]'
91116
image:
92117
description: |
93118
Use option ending with ":build" for AMDGPU, ":latest" for the rest.
@@ -143,6 +168,11 @@ on:
143168
options:
144169
- false
145170
- true
171+
e2e_testing_mode:
172+
type: choice
173+
options:
174+
- "full"
175+
- "build-only"
146176

147177
permissions:
148178
contents: read
@@ -271,8 +301,19 @@ jobs:
271301
cat /usr/local/lib/igc/IGCTAG.txt
272302
fi
273303
304+
- name: Download E2E Binaries
305+
if: inputs.e2e_binaries_artifact != ''
306+
uses: actions/download-artifact@v4
307+
with:
308+
name: ${{ inputs.e2e_binaries_artifact }}
309+
- name: Extract E2E Binaries
310+
if: inputs.e2e_binaries_artifact != ''
311+
run: |
312+
mkdir build-e2e
313+
tar -I 'zstd' -xf e2e_binaries.tar.zst -C build-e2e
314+
274315
- name: Deduce E2E CMake options
275-
if: inputs.tests_selector == 'e2e'
316+
if: inputs.tests_selector == 'e2e' && inputs.e2e_binaries_artifact == ''
276317
id: cmake_opts
277318
shell: bash
278319
env:
@@ -282,14 +323,14 @@ jobs:
282323
echo "opts=$CMAKE_EXTRA_ARGS" >> $GITHUB_OUTPUT
283324
fi
284325
- name: Configure E2E tests
285-
if: inputs.tests_selector == 'e2e'
326+
if: inputs.tests_selector == 'e2e' && inputs.e2e_binaries_artifact == ''
286327
run: |
287-
cmake -GNinja -B./build-e2e -S./llvm/sycl/test-e2e -DSYCL_TEST_E2E_TARGETS="${{ inputs.target_devices }}" -DCMAKE_CXX_COMPILER="$(which clang++)" -DLLVM_LIT="$PWD/llvm/llvm/utils/lit/lit.py" ${{ steps.cmake_opts.outputs.opts }}
328+
cmake -GNinja -B./build-e2e -S./llvm/sycl/test-e2e -DCMAKE_CXX_COMPILER="$(which clang++)" -DLLVM_LIT="$PWD/llvm/llvm/utils/lit/lit.py" ${{ steps.cmake_opts.outputs.opts }}
288329
- name: SYCL End-to-end tests
289330
shell: bash {0}
290331
if: inputs.tests_selector == 'e2e'
291332
env:
292-
LIT_OPTS: -v --no-progress-bar --show-unsupported --show-pass --show-xfail --max-time 3600 --time-tests ${{ inputs.extra_lit_opts }}
333+
LIT_OPTS: -v --no-progress-bar --show-unsupported --show-pass --show-xfail --max-time 3600 --time-tests --param test-mode=${{ inputs.e2e_testing_mode }} --param sycl_devices=${{ inputs.target_devices }} ${{ inputs.extra_lit_opts }}
293334
run: |
294335
ninja -C build-e2e check-sycl-e2e > e2e.log 2>&1
295336
exit_code=$?
@@ -376,3 +417,13 @@ jobs:
376417
grep 'exit code: [^0]' -r logs >> $GITHUB_STEP_SUMMARY
377418
378419
exit $ret
420+
- name: Pack E2E binaries
421+
if: ${{ always() && !cancelled() && inputs.e2e_testing_mode == 'build-only'}}
422+
run: tar -I 'zstd -9' -cf e2e_binaries.tar.zst -C ./build-e2e .
423+
- name: Upload E2E binaries
424+
if: ${{ always() && !cancelled() && inputs.e2e_testing_mode == 'build-only'}}
425+
uses: actions/upload-artifact@v4
426+
with:
427+
name: sycl_e2e_bin_${{ inputs.artifact_suffix }}
428+
path: e2e_binaries.tar.zst
429+
retention-days: ${{ inputs.retention-days }}

devops/containers/ubuntu2204_intel_drivers.Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ FROM $base_image:$base_tag
55

66
ENV DEBIAN_FRONTEND=noninteractive
77

8-
ARG use_latest=true
8+
ARG use_unstable_driver=true
99

1010
USER root
1111

@@ -18,7 +18,7 @@ COPY dependencies.json /
1818
RUN mkdir /runtimes
1919
ENV INSTALL_LOCATION=/runtimes
2020
RUN --mount=type=secret,id=github_token \
21-
if [ "$use_latest" = "true" ]; then \
21+
if [ "$use_unstable_driver" = "true" ]; then \
2222
install_driver_opt=" --use-latest"; \
2323
else \
2424
install_driver_opt=" dependencies.json"; \

devops/containers/ubuntu2404_intel_drivers.Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ FROM $base_image:$base_tag
55

66
ENV DEBIAN_FRONTEND=noninteractive
77

8-
ARG use_latest=true
8+
ARG use_unstable_driver=true
99

1010
USER root
1111

@@ -18,7 +18,7 @@ COPY dependencies.json /
1818
RUN mkdir /runtimes
1919
ENV INSTALL_LOCATION=/runtimes
2020
RUN --mount=type=secret,id=github_token \
21-
if [ "$use_latest" = "true" ]; then \
21+
if [ "$use_unstable_driver" = "true" ]; then \
2222
install_driver_opt=" --use-latest"; \
2323
else \
2424
install_driver_opt=" dependencies.json"; \

llvm/lib/SYCLLowerIR/SanitizerKernelMetadata.cpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,29 @@ PreservedAnalyses SanitizerKernelMetadataPass::run(Module &M,
3838
auto &DL = M.getDataLayout();
3939
auto &Ctx = M.getContext();
4040

41+
// Fix device global type, by wrapping a structure type
42+
{
43+
assert(KernelMetadata->getValueType()->isArrayTy());
44+
45+
auto *KernelMetadataOld = KernelMetadata;
46+
47+
StructType *StructTypeWithArray = StructType::create(Ctx);
48+
StructTypeWithArray->setBody(KernelMetadataOld->getValueType());
49+
50+
KernelMetadata = new GlobalVariable(
51+
M, StructTypeWithArray, false, GlobalValue::ExternalLinkage,
52+
ConstantStruct::get(StructTypeWithArray,
53+
KernelMetadataOld->getInitializer()),
54+
"", nullptr, GlobalValue::NotThreadLocal, 1); // Global AddressSpace
55+
KernelMetadata->takeName(KernelMetadataOld);
56+
KernelMetadata->setUnnamedAddr(GlobalValue::UnnamedAddr::Local);
57+
KernelMetadata->setDSOLocal(true);
58+
KernelMetadata->copyAttributesFrom(KernelMetadataOld);
59+
KernelMetadata->copyMetadata(KernelMetadataOld, 0);
60+
61+
KernelMetadataOld->eraseFromParent();
62+
}
63+
4164
// Fix attributes
4265
KernelMetadata->addAttribute(
4366
"sycl-device-global-size",

llvm/test/tools/sycl-post-link/device-sanitizer/asan.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ $_ZTSZZ4mainENKUlRN4sycl3_V17handlerEE_clES2_E8MyKernel = comdat any
1818

1919
@__asan_kernel = internal addrspace(1) constant [55 x i8] c"_ZTSZZ4mainENKUlRN4sycl3_V17handlerEE_clES2_E8MyKernel\00"
2020
@__AsanKernelMetadata = appending dso_local local_unnamed_addr addrspace(1) global [1 x { i64, i64 }] [{ i64, i64 } { i64 ptrtoint (ptr addrspace(1) @__asan_kernel to i64), i64 54 }] #2
21-
; CHECK-IR: @__AsanKernelMetadata {{.*}} !spirv.Decorations
21+
; CHECK-IR: @__AsanKernelMetadata = dso_local local_unnamed_addr addrspace(1) global %0 { {{.*}} }, !spirv.Decorations
2222
@__spirv_BuiltInGlobalInvocationId = external dso_local local_unnamed_addr addrspace(1) constant <3 x i64>, align 32
2323
@__asan_func = internal addrspace(2) constant [106 x i8] c"typeinfo name for main::'lambda'(sycl::_V1::handler&)::operator()(sycl::_V1::handler&) const::MyKernelR_4\00"
2424

llvm/test/tools/sycl-post-link/device-sanitizer/msan.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ $_ZTSZZ4mainENKUlRN4sycl3_V17handlerEE_clES2_E8MyKernel = comdat any
1818

1919
@__msan_kernel = internal addrspace(1) constant [55 x i8] c"_ZTSZZ4mainENKUlRN4sycl3_V17handlerEE_clES2_E8MyKernel\00"
2020
@__MsanKernelMetadata = appending dso_local local_unnamed_addr addrspace(1) global [1 x { i64, i64 }] [{ i64, i64 } { i64 ptrtoint (ptr addrspace(1) @__msan_kernel to i64), i64 54 }] #0
21-
; CHECK-IR: @__MsanKernelMetadata {{.*}} !spirv.Decorations
21+
; CHECK-IR: @__MsanKernelMetadata = dso_local local_unnamed_addr addrspace(1) global %0 { {{.*}} }, !spirv.Decorations
2222
@__spirv_BuiltInGlobalInvocationId = external dso_local local_unnamed_addr addrspace(1) constant <3 x i64>, align 32
2323
@__asan_func = internal addrspace(2) constant [106 x i8] c"typeinfo name for main::'lambda'(sycl::_V1::handler&)::operator()(sycl::_V1::handler&) const::MyKernelR_4\00"
2424

sycl/doc/design/KernelProgramCache.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -415,15 +415,16 @@ When adding a new program to cache, we check if the size of the program cache ex
415415

416416
#### Persistent cache eviction
417417

418-
Persistent cache eviction is going to be applied based on file last access
419-
(read/write) date (access time). On SYCL application shutdown phase cache
420-
eviction process is initiated which walks through cache directories as follows:
421-
422-
- if the file is locked, go to the next file;
423-
- otherwise check file access time:
424-
- if file access time is above threshold, delete the file and remove parent
425-
directory while they are unlocked and empty;
426-
- otherwise do nothing.
418+
Persistent cache eviction can be enabled using the SYCL_CACHE_MAX_SIZE environment variable and is based on the LRU strategy.
419+
420+
- A new file, called `cache_size.txt`, is created at the root of the persistent cache directory. This file contains the total size of the cache in bytes. When a new item is added to the cache, the size of the item is added to the total size in the `cache_size.txt` file. When the total size exceeds the threshold, the eviction process is initiated.
421+
422+
- Whenever a cache entry is added or accessed, the corresponding cache item directory is updated with the current time. This is done by creating a new file, called `<entry name>_access_time.txt`, in the cache item directory. This file contains the current time in nanoseconds since the epoch. When the eviction process is initiated, we use this file to determine the last access time of the cache item.
423+
424+
- When a new item is added to the cache, we check if the total size exceeds the threshold. If so, we iterate through the cache item directories and delete the least recently accessed items until the total size is below half the cache size.
425+
426+
Note that once the eviction is triggered, the cache size is reduced to half the cache size to avoid frequent eviction.
427+
427428

428429
## Cache limitations
429430

0 commit comments

Comments
 (0)