Skip to content

Commit 130530e

Browse files
committed
[CI] Use oneAPI for Windows postcommit builds
Signed-off-by: Sarnie, Nick <[email protected]>
1 parent a9a6856 commit 130530e

File tree

7 files changed

+109
-38
lines changed

7 files changed

+109
-38
lines changed

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,11 @@ jobs:
103103
&& success()
104104
&& github.repository == 'intel/llvm'
105105
uses: ./.github/workflows/sycl-windows-build.yml
106-
106+
with:
107+
compiler: icx
108+
build_configure_extra_args: --cmake-opt=-DCMAKE_C_FLAGS="/clang:-Wno-nonportable-include-path /clang:-Wno-cast-function-type-mismatch" --cmake-opt=-DCMAKE_CXX_FLAGS="/clang:-Wno-nonportable-include-path /clang:-Wno-cast-function-type-mismatch" --cmake-opt="-DCMAKE_EXE_LINKER_FLAGS=/manifest:no" --cmake-opt="-DCMAKE_MODULE_LINKER_FLAGS=/manifest:no" --cmake-opt="-DCMAKE_SHARED_LINKER_FLAGS=/manifest:no"
109+
build_cache_suffix: icx
110+
107111
e2e-win:
108112
needs: build-win
109113
# Continue if build was successful.
@@ -117,6 +121,7 @@ jobs:
117121
runner: '["Windows","gen12"]'
118122
sycl_toolchain_archive: ${{ needs.build-win.outputs.artifact_archive_name }}
119123
extra_lit_opts: --param gpu-intel-gen12=True
124+
compiler: icx
120125

121126
macos_default:
122127
name: macOS

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

Lines changed: 39 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ on:
1010
build_ref:
1111
type: string
1212
required: false
13+
build_configure_extra_args:
14+
type: string
15+
required: false
1316
changes:
1417
type: string
1518
description: 'Filter matches for the changed files in the PR'
@@ -22,6 +25,10 @@ on:
2225
description: 'Artifacts retention period'
2326
type: string
2427
default: 3
28+
compiler:
29+
type: string
30+
required: false
31+
default: "cl"
2532

2633
outputs:
2734
build_conclusion:
@@ -50,6 +57,12 @@ on:
5057
type: choice
5158
options:
5259
- 3
60+
compiler:
61+
type: choice
62+
options:
63+
- cl
64+
- icx
65+
5366
permissions: read-all
5467

5568
jobs:
@@ -61,37 +74,43 @@ jobs:
6174
outputs:
6275
build_conclusion: ${{ steps.build.conclusion }}
6376
steps:
77+
- uses: actions/checkout@v4
78+
with:
79+
path: src
80+
ref: ${{ inputs.build_ref || github.sha }}
81+
fetch-depth: 1
6482
- uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756
6583
with:
6684
arch: amd64
85+
- name: Setup oneAPI env
86+
uses: ./src/devops/actions/setup_windows_oneapi_env
87+
if: ${{ always() && !cancelled() && inputs.compiler == 'icx' }}
6788
- name: Set env
6889
run: |
6990
git config --system core.longpaths true
7091
git config --global core.autocrlf false
7192
echo "C:\Program Files\Git\usr\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
72-
echo "SCCACHE_DIR=D:\github\_work\cache\${{ inputs.build_cache_suffix }}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
73-
- uses: actions/checkout@v4
74-
with:
75-
path: src
76-
ref: ${{ inputs.build_ref || github.sha }}
77-
fetch-depth: 1
93+
echo "CCACHE_DIR=D:\github\_work\cache\${{ inputs.build_cache_suffix }}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
94+
echo "CCACHE_MAXSIZE=10G" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
7895
- name: Register cleanup after job is finished
7996
uses: ./src/devops/actions/cleanup
8097
- name: Configure
8198
shell: cmd
99+
env:
100+
ARGS: ${{ inputs.build_configure_extra_args }}
82101
# TODO switch to clang-cl and lld when this is fixed https://github.com/oneapi-src/level-zero/issues/83
83102
run: |
84103
mkdir build
85104
mkdir install
86105
IF NOT EXIST D:\github\_work\cache MKDIR D:\github\_work\cache
87106
IF NOT EXIST D:\github\_work\cache\${{inputs.build_cache_suffix}} MKDIR D:\github\_work\cache\${{inputs.build_cache_suffix}}
88107
python.exe src/buildbot/configure.py -o build ^
89-
--ci-defaults ^
90-
--cmake-opt="-DCMAKE_C_COMPILER=cl" ^
91-
--cmake-opt="-DCMAKE_CXX_COMPILER=cl" ^
108+
--ci-defaults %ARGS% ^
109+
--cmake-opt="-DCMAKE_C_COMPILER=${{inputs.compiler}}" ^
110+
--cmake-opt="-DCMAKE_CXX_COMPILER=${{inputs.compiler}}" ^
92111
--cmake-opt="-DCMAKE_INSTALL_PREFIX=%GITHUB_WORKSPACE%\install" ^
93-
--cmake-opt="-DCMAKE_CXX_COMPILER_LAUNCHER=sccache" ^
94-
--cmake-opt="-DCMAKE_C_COMPILER_LAUNCHER=sccache" ^
112+
--cmake-opt="-DCMAKE_CXX_COMPILER_LAUNCHER=ccache" ^
113+
--cmake-opt="-DCMAKE_C_COMPILER_LAUNCHER=ccache" ^
95114
--cmake-opt="-DLLVM_INSTALL_UTILS=ON" ^
96115
--cmake-opt="-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=SPIRV"
97116
- name: Build
@@ -101,16 +120,24 @@ jobs:
101120
cmake --build build --target sycl-toolchain
102121
- name: check-llvm
103122
if: always() && !cancelled() && contains(inputs.changes, 'llvm')
123+
shell: bash
104124
run: |
125+
if [[ ${{inputs.compiler}} == 'icx' ]]; then
126+
export LIT_FILTER="SYCL"
127+
fi
105128
cmake --build build --target check-llvm
106129
- name: check-clang
107130
if: always() && !cancelled() && contains(inputs.changes, 'clang')
108131
run: |
109132
cmake --build build --target check-clang
110133
- name: check-sycl
111134
if: always() && !cancelled() && contains(inputs.changes, 'sycl')
135+
shell: bash
112136
run: |
113-
cmake --build build --target check-sycl
137+
if [[ ${{inputs.compiler}} == 'icx' ]]; then
138+
export LIT_FILTER_OUT="host_tanpi_double_accuracy"
139+
fi
140+
cmake --build build --target check-sycl
114141
- name: check-sycl-unittests
115142
if: always() && !cancelled() && contains(inputs.changes, 'sycl')
116143
run: |

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

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ on:
3333
default: '{}'
3434
required: False
3535

36+
compiler:
37+
type: string
38+
required: false
39+
default: "cl"
40+
3641
permissions: read-all
3742

3843
jobs:
@@ -42,20 +47,23 @@ jobs:
4247
environment: WindowsCILock
4348
env: ${{ fromJSON(inputs.env) }}
4449
steps:
50+
# TODO: use cached_checkout
51+
- uses: actions/checkout@v4
52+
with:
53+
persist-credentials: false
54+
ref: ${{ inputs.ref || github.sha }}
55+
path: llvm
4556
- uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756
4657
with:
4758
arch: amd64
59+
- name: Setup oneAPI env
60+
uses: ./llvm/devops/actions/setup_windows_oneapi_env
61+
if: ${{ always() && !cancelled() && inputs.compiler == 'icx' }}
4862
- name: Set env
4963
run: |
5064
git config --system core.longpaths true
5165
git config --global core.autocrlf false
5266
echo "C:\Program Files\Git\usr\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
53-
# TODO: use cached_checkout
54-
- uses: actions/checkout@v4
55-
with:
56-
persist-credentials: false
57-
ref: ${{ inputs.ref || github.sha }}
58-
path: llvm
5967
- name: Register cleanup after job is finished
6068
uses: ./llvm/devops/actions/cleanup
6169
- name: Download compiler toolchain
@@ -84,6 +92,9 @@ jobs:
8492
shell: bash
8593
run: |
8694
# Run E2E tests.
95+
if [[ ${{inputs.compiler}} == 'icx' ]]; then
96+
export LIT_FILTER_OUT="compile_on_win_with_mdd"
97+
fi
8798
export LIT_OPTS="-v --no-progress-bar --show-unsupported --show-pass --show-xfail --max-time 3600 --time-tests ${{ inputs.extra_lit_opts }}"
8899
cmake --build build-e2e --target check-sycl-e2e
89100
- name: Detect hung tests
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Windows setup oneAPI env
2+
3+
runs:
4+
using: "composite"
5+
steps:
6+
- name: Setup oneAPI env
7+
shell: powershell
8+
run: |
9+
$batchFilePath = "C:\Program Files (x86)\Intel\oneAPI\setvars.bat"
10+
11+
$githubEnvFilePath = $env:GITHUB_ENV
12+
13+
$envBefore = Get-ChildItem Env: | ForEach-Object { "$($_.Name)=$($_.Value)" }
14+
15+
$envVars = & cmd.exe /c "call `"$batchFilePath`" && set" | Out-String
16+
17+
$envAfter = $envVars -split "`r`n" | Where-Object { $_ -match "^(.*?)=(.*)$" }
18+
19+
foreach ($envVar in $envAfter) {
20+
if ($envVar -match "^(.*?)=(.*)$") {
21+
$name = $matches[1]
22+
$value = $matches[2]
23+
$envBeforeVar = $envBefore | Where-Object { $_ -like "$name=*" }
24+
if (-not $envBeforeVar -or $envBeforeVar -ne "$name=$value") {
25+
Add-Content -Path $githubEnvFilePath -Value "$name=$value"
26+
}
27+
}
28+
}

sycl/source/CMakeLists.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,18 @@ function(add_sycl_rt_library LIB_NAME LIB_OBJ_NAME)
222222
target_compile_options(${LIB_OBJ_NAME} PRIVATE
223223
-Winstantiation-after-specialization)
224224
endif()
225+
226+
# When building using icx on Windows, the VERSION file
227+
# produced by cmake is used in source code
228+
# when including '<version>' because Windows is
229+
# case-insensitive and icx adds the build directory
230+
# to the system header search path.
231+
if (WIN32 AND CMAKE_CXX_COMPILER_ID MATCHES "IntelLLVM")
232+
set(VERSION_FILE "${CMAKE_BINARY_DIR}/VERSION")
233+
if(EXISTS ${VERSION_FILE})
234+
file(REMOVE ${VERSION_FILE})
235+
endif()
236+
endif()
225237
endfunction(add_sycl_rt_library)
226238

227239
set(SYCL_COMMON_SOURCES

sycl/source/detail/windows_ur.cpp

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -56,24 +56,6 @@ void *getOsLibraryFuncAddress(void *Library, const std::string &FunctionName) {
5656
GetProcAddress((HMODULE)Library, FunctionName.c_str()));
5757
}
5858

59-
static std::filesystem::path getCurrentDSODirPath() {
60-
wchar_t Path[MAX_PATH];
61-
auto Handle =
62-
getOSModuleHandle(reinterpret_cast<void *>(&getCurrentDSODirPath));
63-
DWORD Ret = GetModuleFileName(
64-
reinterpret_cast<HMODULE>(ExeModuleHandle == Handle ? 0 : Handle), Path,
65-
MAX_PATH);
66-
assert(Ret < MAX_PATH && "Path is longer than MAX_PATH?");
67-
assert(Ret > 0 && "GetModuleFileName failed");
68-
(void)Ret;
69-
70-
BOOL RetCode = PathRemoveFileSpec(Path);
71-
assert(RetCode && "PathRemoveFileSpec failed");
72-
(void)RetCode;
73-
74-
return std::filesystem::path(Path);
75-
}
76-
7759
void *getURLoaderLibrary() { return getPreloadedURLib(); }
7860

7961
} // namespace ur

sycl/unittests/assert/assert.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,10 +145,12 @@ static AssertHappened ExpectedToOutput = {
145145
};
146146

147147
static constexpr int KernelLaunchCounterBase = 0;
148-
static int KernelLaunchCounter = KernelLaunchCounterBase;
149148
static constexpr int MemoryMapCounterBase = 1000;
150149
static int MemoryMapCounter = MemoryMapCounterBase;
150+
#ifndef _WIN32
151+
static int KernelLaunchCounter = KernelLaunchCounterBase;
151152
static constexpr int PauseWaitOnIdx = KernelLaunchCounterBase + 1;
153+
#endif
152154

153155
// Mock redifinitions
154156
static ur_result_t redefinedKernelGetGroupInfoAfter(void *pParams) {
@@ -167,6 +169,7 @@ static ur_result_t redefinedKernelGetGroupInfoAfter(void *pParams) {
167169
return UR_RESULT_SUCCESS;
168170
}
169171

172+
#ifndef _WIN32
170173
static ur_result_t redefinedEnqueueKernelLaunchAfter(void *pParams) {
171174
auto params = *static_cast<ur_enqueue_kernel_launch_params_t *>(pParams);
172175
static ur_event_handle_t UserKernelEvent = **params.pphEvent;
@@ -197,6 +200,7 @@ static ur_result_t redefinedEventWaitPositive(void *pParams) {
197200
printf("Waiting for events %i, %i\n", EventIdx1, EventIdx2);
198201
return UR_RESULT_SUCCESS;
199202
}
203+
#endif
200204

201205
static ur_result_t redefinedEventWaitNegative(void *pParams) {
202206
auto params = *static_cast<ur_enqueue_events_wait_params_t *>(pParams);
@@ -223,6 +227,7 @@ static ur_result_t redefinedEnqueueMemBufferMapAfter(void *pParams) {
223227
return UR_RESULT_SUCCESS;
224228
}
225229

230+
#ifndef _WIN32
226231
static void setupMock(sycl::unittest::UrMock<> &Mock) {
227232
using namespace sycl::detail;
228233
mock::getCallbacks().set_after_callback("urKernelGetGroupInfo",
@@ -234,6 +239,7 @@ static void setupMock(sycl::unittest::UrMock<> &Mock) {
234239
mock::getCallbacks().set_before_callback("urEventWait",
235240
&redefinedEventWaitPositive);
236241
}
242+
#endif
237243

238244
namespace TestInteropKernel {
239245
const sycl::context *Context = nullptr;

0 commit comments

Comments
 (0)