Skip to content

Commit 2fcc38b

Browse files
authored
Update windows workflow to build ARM64 (Xilinx#9620)
Include work-around arm compiler optimization bug, aggresive optimization fails to see that code is in fact reachable. Signed-off-by: Soren Soe <2106410+stsoe@users.noreply.github.com>
1 parent e13369e commit 2fcc38b

2 files changed

Lines changed: 36 additions & 14 deletions

File tree

.github/workflows/build-windows.yml

Lines changed: 29 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,20 @@ env:
1717

1818
jobs:
1919
build-windows:
20-
runs-on: windows-latest
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
include:
24+
- runner: windows-latest
25+
triplet: x64-windows
26+
cmake_arch: x64
27+
build_dir: WRelease
28+
- runner: windows-11-arm
29+
triplet: arm64-windows
30+
cmake_arch: ARM64
31+
build_dir: WRelease-arm64
32+
33+
runs-on: ${{ matrix.runner }}
2134

2235
steps:
2336
- name: Checkout repository
@@ -50,30 +63,32 @@ jobs:
5063
${{ github.workspace }}/vcpkg/installed
5164
${{ github.workspace }}/vcpkg/buildtrees
5265
${{ github.workspace }}/vcpkg/downloads
53-
key: vcpkg-win-${{ runner.os }}-${{ hashFiles('src/vcpkg.json') }}
66+
key: vcpkg-win-${{ matrix.runner }}-${{ matrix.triplet }}-${{ hashFiles('src/vcpkg.json') }}
5467
restore-keys: |
55-
vcpkg-win-${{ runner.os }}-
68+
vcpkg-win-${{ matrix.runner }}-${{ matrix.triplet }}-
5669
5770
- name: Install vcpkg dependencies (manifest)
5871
run: |
59-
.\vcpkg\vcpkg.exe install --x-manifest-root="${{ github.workspace }}\src" --triplet=x64-windows
72+
.\vcpkg\vcpkg.exe install --x-manifest-root="${{ github.workspace }}\src" --triplet=${{ matrix.triplet }}
6073
working-directory: ${{ github.workspace }}
6174

6275
- name: Configure CMake (Release)
6376
run: |
6477
# github.workspace expands with backslashes on Windows; normalize to forward slashes for CMake
6578
$ws = "${{ github.workspace }}" -replace '\\', '/'
6679
$vcpkgRoot = "$ws/vcpkg"
67-
$triplet = "x64-windows"
80+
$triplet = "${{ matrix.triplet }}"
81+
$buildDir = "${{ matrix.build_dir }}"
6882
# vcpkg toolchain (manifest mode) installs to build/vcpkg_installed/<triplet>; OpenCL.dll is there
69-
$kronos = "$ws/build/WRelease/vcpkg_installed/$triplet"
83+
$kronos = "$ws/build/$buildDir/vcpkg_installed/$triplet"
7084
$src = "$ws/src"
71-
$build = "$ws/build/WRelease"
85+
$build = "$ws/build/$buildDir"
7286
New-Item -ItemType Directory -Force -Path $build
87+
# Pass triplet as literal so vcpkg subprocess does not re-interpret $triplet
7388
cmake -B $build -S $src `
74-
-G "Visual Studio 17 2022" -A x64 `
89+
-G "Visual Studio 17 2022" -A ${{ matrix.cmake_arch }} `
7590
-DCMAKE_TOOLCHAIN_FILE="$vcpkgRoot/scripts/buildsystems/vcpkg.cmake" `
76-
-DVCPKG_TARGET_TRIPLET=x64-windows `
91+
-DVCPKG_TARGET_TRIPLET=${{ matrix.triplet }} `
7792
-DKHRONOS="$kronos" `
7893
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON `
7994
-DMSVC_PARALLEL_JOBS=4
@@ -82,21 +97,21 @@ jobs:
8297
- name: Build (Release)
8398
run: |
8499
$ws = "${{ github.workspace }}" -replace '\\', '/'
85-
$build = "$ws/build/WRelease"
100+
$build = "$ws/build/${{ matrix.build_dir }}"
86101
cmake --build $build --config Release --verbose
87102
shell: pwsh
88103

89104
- name: Install (staging)
90105
run: |
91106
$ws = "${{ github.workspace }}" -replace '\\', '/'
92-
$build = "$ws/build/WRelease"
93-
$prefix = "$ws/build/WRelease/xilinx/xrt"
107+
$build = "$ws/build/${{ matrix.build_dir }}"
108+
$prefix = "$build/xilinx/xrt"
94109
cmake --install $build --config Release --prefix $prefix --verbose
95110
shell: pwsh
96111

97112
- name: Upload build artifacts
98113
uses: actions/upload-artifact@v4
99114
with:
100-
name: xrt-windows-Release
101-
path: ${{ github.workspace }}/build/WRelease/xilinx/xrt
115+
name: xrt-windows-${{ matrix.triplet }}-Release
116+
path: ${{ github.workspace }}/build/${{ matrix.build_dir }}/xilinx/xrt
102117
retention-days: 7

src/runtime_src/core/common/api/xrt_bo.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1914,6 +1914,10 @@ xrtBOExport(xrtBufferHandle bhdl)
19141914
xrtBufferHandle
19151915
xrtBOAllocFromXcl(xrtDeviceHandle dhdl, xclBufferHandle xhdl)
19161916
{
1917+
#ifdef _MSC_VER
1918+
# pragma warning(push)
1919+
# pragma warning(disable : 4702) // unreachable code (false positive on ARM64)
1920+
#endif
19171921
try {
19181922
return xdp::native::profiling_wrapper(__func__, [dhdl, xhdl] {
19191923
auto boh = alloc_xbuf(xrt_to_core_device(dhdl), xcl_buffer_handle{xhdl});
@@ -1930,6 +1934,9 @@ xrtBOAllocFromXcl(xrtDeviceHandle dhdl, xclBufferHandle xhdl)
19301934
send_exception_message(ex.what());
19311935
}
19321936
return nullptr;
1937+
#ifdef _MSC_VER
1938+
# pragma warning(pop)
1939+
#endif
19331940
}
19341941

19351942
int

0 commit comments

Comments
 (0)