Skip to content

Commit 0c458d9

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

File tree

4 files changed

+52
-72
lines changed

4 files changed

+52
-72
lines changed

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

Lines changed: 5 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"
109+
build_cache_suffix: icx
110+
107111
e2e-win:
108112
needs: build-win
109113
# Continue if build was successful.

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

Lines changed: 47 additions & 8 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,12 +57,18 @@ 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:
5669
build:
5770
name: Build + LIT
58-
runs-on: [Windows, build]
71+
runs-on: [Windows, build-test]
5972
environment: WindowsCILock
6073
# TODO use cached checkout
6174
outputs:
@@ -64,12 +77,36 @@ jobs:
6477
- uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756
6578
with:
6679
arch: amd64
80+
- name: oneAPI setup
81+
if: ${{ always() && !cancelled() && inputs.compiler == 'icx' }}
82+
run: |
83+
$batchFilePath = "C:\Program Files (x86)\Intel\oneAPI\setvars.bat"
84+
85+
$githubEnvFilePath = $env:GITHUB_ENV
86+
87+
$envBefore = Get-ChildItem Env: | ForEach-Object { "$($_.Name)=$($_.Value)" }
88+
89+
$envVars = & cmd.exe /c "call `"$batchFilePath`" && set" | Out-String
90+
91+
$envAfter = $envVars -split "`r`n" | Where-Object { $_ -match "^(.*?)=(.*)$" }
92+
93+
foreach ($envVar in $envAfter) {
94+
if ($envVar -match "^(.*?)=(.*)$") {
95+
$name = $matches[1]
96+
$value = $matches[2]
97+
$envBeforeVar = $envBefore | Where-Object { $_ -like "$name=*" }
98+
if (-not $envBeforeVar -or $envBeforeVar -ne "$name=$value") {
99+
Add-Content -Path $githubEnvFilePath -Value "$name=$value"
100+
}
101+
}
102+
}
67103
- name: Set env
68104
run: |
69105
git config --system core.longpaths true
70106
git config --global core.autocrlf false
71107
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
108+
echo "CCACHE_DIR=D:\github\_work\cache\${{ inputs.build_cache_suffix }}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
109+
echo "CCACHE_MAXSIZE=10G" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
73110
- uses: actions/checkout@v4
74111
with:
75112
path: src
@@ -78,25 +115,27 @@ jobs:
78115
- name: Register cleanup after job is finished
79116
uses: ./src/devops/actions/cleanup
80117
- name: Configure
118+
env:
119+
ARGS: ${{ inputs.build_configure_extra_args }}
81120
shell: cmd
82121
# TODO switch to clang-cl and lld when this is fixed https://github.com/oneapi-src/level-zero/issues/83
83122
run: |
84123
mkdir build
124+
fsutil.exe file setCaseSensitiveInfo build enable
85125
mkdir install
86126
IF NOT EXIST D:\github\_work\cache MKDIR D:\github\_work\cache
87127
IF NOT EXIST D:\github\_work\cache\${{inputs.build_cache_suffix}} MKDIR D:\github\_work\cache\${{inputs.build_cache_suffix}}
88128
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" ^
129+
--ci-defaults %ARGS% ^
130+
--cmake-opt="-DCMAKE_C_COMPILER=${{inputs.compiler}}" ^
131+
--cmake-opt="-DCMAKE_CXX_COMPILER=${{inputs.compiler}}" ^
92132
--cmake-opt="-DCMAKE_INSTALL_PREFIX=%GITHUB_WORKSPACE%\install" ^
93-
--cmake-opt="-DCMAKE_CXX_COMPILER_LAUNCHER=sccache" ^
94-
--cmake-opt="-DCMAKE_C_COMPILER_LAUNCHER=sccache" ^
133+
--cmake-opt="-DCMAKE_CXX_COMPILER_LAUNCHER=ccache" ^
134+
--cmake-opt="-DCMAKE_C_COMPILER_LAUNCHER=ccache" ^
95135
--cmake-opt="-DLLVM_INSTALL_UTILS=ON" ^
96136
--cmake-opt="-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=SPIRV"
97137
- name: Build
98138
id: build
99-
shell: bash
100139
run: |
101140
cmake --build build --target sycl-toolchain
102141
- name: check-llvm

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: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -145,10 +145,8 @@ 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;
151-
static constexpr int PauseWaitOnIdx = KernelLaunchCounterBase + 1;
152150

153151
// Mock redifinitions
154152
static ur_result_t redefinedKernelGetGroupInfoAfter(void *pParams) {
@@ -167,37 +165,6 @@ static ur_result_t redefinedKernelGetGroupInfoAfter(void *pParams) {
167165
return UR_RESULT_SUCCESS;
168166
}
169167

170-
static ur_result_t redefinedEnqueueKernelLaunchAfter(void *pParams) {
171-
auto params = *static_cast<ur_enqueue_kernel_launch_params_t *>(pParams);
172-
static ur_event_handle_t UserKernelEvent = **params.pphEvent;
173-
int Val = KernelLaunchCounter++;
174-
// This output here is to reduce amount of time requried to debug/reproduce a
175-
// failing test upon feature break
176-
printf("Enqueued %i\n", Val);
177-
178-
if (PauseWaitOnIdx == Val) {
179-
// It should be copier kernel. Check if it depends on user's one.
180-
EXPECT_EQ(*params.pnumEventsInWaitList, 1U);
181-
EXPECT_EQ(*params.pphEventWaitList[0], UserKernelEvent);
182-
}
183-
184-
return UR_RESULT_SUCCESS;
185-
}
186-
187-
static ur_result_t redefinedEventWaitPositive(void *pParams) {
188-
auto params = *static_cast<ur_event_wait_params_t *>(pParams);
189-
// there should be two events: one is for memory map and the other is for
190-
// copier kernel
191-
assert(*params.pnumEvents == 2);
192-
193-
int EventIdx1 = reinterpret_cast<int *>((*params.pphEventWaitList)[0])[0];
194-
int EventIdx2 = reinterpret_cast<int *>((*params.pphEventWaitList)[1])[0];
195-
// This output here is to reduce amount of time requried to debug/reproduce
196-
// a failing test upon feature break
197-
printf("Waiting for events %i, %i\n", EventIdx1, EventIdx2);
198-
return UR_RESULT_SUCCESS;
199-
}
200-
201168
static ur_result_t redefinedEventWaitNegative(void *pParams) {
202169
auto params = *static_cast<ur_enqueue_events_wait_params_t *>(pParams);
203170
// For negative tests we do not expect the copier kernel to be used, so
@@ -223,18 +190,6 @@ static ur_result_t redefinedEnqueueMemBufferMapAfter(void *pParams) {
223190
return UR_RESULT_SUCCESS;
224191
}
225192

226-
static void setupMock(sycl::unittest::UrMock<> &Mock) {
227-
using namespace sycl::detail;
228-
mock::getCallbacks().set_after_callback("urKernelGetGroupInfo",
229-
&redefinedKernelGetGroupInfoAfter);
230-
mock::getCallbacks().set_after_callback("urEnqueueKernelLaunch",
231-
&redefinedEnqueueKernelLaunchAfter);
232-
mock::getCallbacks().set_after_callback("urEnqueueMemBufferMap",
233-
&redefinedEnqueueMemBufferMapAfter);
234-
mock::getCallbacks().set_before_callback("urEventWait",
235-
&redefinedEventWaitPositive);
236-
}
237-
238193
namespace TestInteropKernel {
239194
const sycl::context *Context = nullptr;
240195
const sycl::device *Device = nullptr;

0 commit comments

Comments
 (0)