Skip to content

Commit 53a117a

Browse files
authored
[WARP] Make default WARP version "Last Known Good" (#343)
We've encountered a fair number of problems with the System as the default verison of WARP, instead using a Last Known Good will hopefully make it easier for contributors to get up and working. This change adds two new special versions for the `WARP_VERSION` option: `LKG` and `Latest`. At the moment the `LKG` version is 1.0.14.2 for arm64 and 1.0.10.1 for x86. This PR also adds a set of build jobs to run periodic builds with the current WARP pre-release build. Fixes #340
1 parent 6aae421 commit 53a117a

File tree

9 files changed

+92
-13
lines changed

9 files changed

+92
-13
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Windows D3D12 Warp Preview Clang
2+
3+
permissions:
4+
contents: read
5+
checks: write
6+
7+
on:
8+
workflow_dispatch:
9+
schedule:
10+
- cron: '0 */2 * * *' # run every 2 hours
11+
12+
jobs:
13+
Windows-D3D12-Warp-Clang:
14+
uses: ./.github/workflows/build-and-test-callable.yaml
15+
with:
16+
OS: windows
17+
SKU: windows-amd
18+
TestTarget: check-hlsl-clang-warp-d3d12
19+
OffloadTest-branch: ${{ github.ref }}
20+
LLVM-ExtraCMakeArgs: -DCMAKE_C_COMPILER=clang-cl -DCMAKE_CXX_COMPILER=clang-cl -DOFFLOADTEST_USE_CLANG_TIDY=On -DWARP_VERSION=1.0.15-preview
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Windows D3D12 Warp Preview DXC
2+
3+
permissions:
4+
contents: read
5+
checks: write
6+
7+
on:
8+
workflow_dispatch:
9+
schedule:
10+
- cron: '0 */2 * * *' # run every 2 hours
11+
12+
jobs:
13+
Windows-D3D12-Warp-DXC:
14+
uses: ./.github/workflows/build-and-test-callable.yaml
15+
with:
16+
OS: windows
17+
SKU: windows-amd
18+
BuildType: Debug
19+
TestTarget: check-hlsl-warp-d3d12
20+
OffloadTest-branch: ${{ github.ref }}
21+
LLVM-ExtraCMakeArgs: -DCMAKE_C_COMPILER=clang-cl -DCMAKE_CXX_COMPILER=clang-cl -DWARP_VERSION=1.0.15-preview

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ Experimental Runtime test suite for HLSL
88
| Windows DirectX12 AMD GPU | ![DXC](https://github.com/llvm/offload-test-suite/actions/workflows/windows-amd-dxc-d3d12.yaml/badge.svg) | ![Clang](https://github.com/llvm/offload-test-suite/actions/workflows/windows-amd-clang-d3d12.yaml/badge.svg) |
99
| Windows DirectX12 Intel GPU | ![DXC](https://github.com/llvm/offload-test-suite/actions/workflows/windows-intel-dxc-d3d12.yaml/badge.svg) | ![Clang](https://github.com/llvm/offload-test-suite/actions/workflows/windows-intel-clang-d3d12.yaml/badge.svg) |
1010
| Windows DirectX12 NVIDIA GPU | ![DXC](https://github.com/llvm/offload-test-suite/actions/workflows/windows-nvidia-dxc-d3d12.yaml/badge.svg) | ![Clang](https://github.com/llvm/offload-test-suite/actions/workflows/windows-nvidia-clang-d3d12.yaml/badge.svg) |
11-
| Windows DirectX12 Warp | ![DXC](https://github.com/llvm/offload-test-suite/actions/workflows/windows-amd-dxc-warp-d3d12.yaml/badge.svg) | ![Clang](https://github.com/llvm/offload-test-suite/actions/workflows/windows-amd-clang-warp-d3d12.yaml/badge.svg) |
11+
| Windows DirectX12 Warp (LKG) | ![DXC](https://github.com/llvm/offload-test-suite/actions/workflows/windows-amd-dxc-warp-d3d12.yaml/badge.svg) | ![Clang](https://github.com/llvm/offload-test-suite/actions/workflows/windows-amd-clang-warp-d3d12.yaml/badge.svg) |
12+
| Windows DirectX12 Warp (1.0.15-preview) | ![DXC](https://github.com/llvm/offload-test-suite/actions/workflows/windows-amd-dxc-warp-preview-d3d12.yaml/badge.svg) | ![Clang](https://github.com/llvm/offload-test-suite/actions/workflows/windows-amd-clang-warp-preview-d3d12.yaml/badge.svg) |
1213
| Windows Vulkan AMD GPU | ![DXC](https://github.com/llvm/offload-test-suite/actions/workflows/windows-amd-dxc-vk.yaml/badge.svg) | ![Clang](https://github.com/llvm/offload-test-suite/actions/workflows/windows-amd-clang-vk.yaml/badge.svg) |
1314
| Windows Vulkan Intel GPU | ![DXC](https://github.com/llvm/offload-test-suite/actions/workflows/windows-intel-dxc-vk.yaml/badge.svg) | ![Clang](https://github.com/llvm/offload-test-suite/actions/workflows/windows-intel-clang-vk.yaml/badge.svg) |
1415
| Windows Vulkan NVIDIA GPU | ![DXC](https://github.com/llvm/offload-test-suite/actions/workflows/windows-nvidia-dxc-vk.yaml/badge.svg) | ![Clang](https://github.com/llvm/offload-test-suite/actions/workflows/windows-nvidia-clang-vk.yaml/badge.svg) |

cmake/modules/Warp.cmake

Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,24 +21,54 @@ function(setup_warp version)
2121
return()
2222
endif()
2323

24-
message(STATUS "Fetching WARP ${version}...")
24+
if (version STREQUAL "LKG")
25+
if (NUGET_ARCH STREQUAL "arm64")
26+
set(version "1.0.14.2")
27+
else()
28+
set(version "1.0.10.1")
29+
endif()
30+
set(version_description "Latest Known Good (${version})")
31+
else ()
32+
set(version_description "Custom (${version})")
33+
endif()
34+
35+
message(STATUS "Fetching WARP ${version_description}...")
2536

2637
set(WARP_ARCHIVE "${CMAKE_CURRENT_BINARY_DIR}/Microsoft.Direct3D.WARP.${version}.zip")
27-
file(DOWNLOAD "https://www.nuget.org/api/v2/package/Microsoft.Direct3D.WARP/${version}/" ${WARP_ARCHIVE})
38+
if (version STREQUAL "Latest")
39+
file(DOWNLOAD "https://www.nuget.org/api/v2/package/Microsoft.Direct3D.WARP/" ${WARP_ARCHIVE})
40+
else()
41+
file(DOWNLOAD "https://www.nuget.org/api/v2/package/Microsoft.Direct3D.WARP/${version}/" ${WARP_ARCHIVE})
42+
endif()
2843

2944
guess_nuget_arch(NUGET_ARCH)
3045

31-
file(ARCHIVE_EXTRACT INPUT ${WARP_ARCHIVE} DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/warp" PATTERNS *${NUGET_ARCH}*dll *${NUGET_ARCH}*pdb)
46+
# This is all awfulness to work around the fact that the last known good WRAP
47+
# for x64 is before arm64 support was shipped via NuGet, and the packaging
48+
# changed and we just aren't allowed to have nice things.
49+
file(ARCHIVE_EXTRACT INPUT ${WARP_ARCHIVE} DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/warp" PATTERNS *dll *pdb)
3250

33-
file(GLOB_RECURSE LIBS "${CMAKE_CURRENT_BINARY_DIR}/warp/*.dll" $<IF:$<CONFIG:DEBUG>,"${CMAKE_CURRENT_BINARY_DIR}/warp/*.pdb">)
51+
file(GLOB_RECURSE LIBS "${CMAKE_CURRENT_BINARY_DIR}/warp/build/native/*/${NUGET_ARCH}/*.dll"
52+
$<IF:$<CONFIG:DEBUG>,"${CMAKE_CURRENT_BINARY_DIR}/warp/build/native/*/${NUGET_ARCH}/*.pdb">)
53+
54+
if (${NUGET_ARCH} STREQUAL "x64" AND NOT LIBS)
55+
file(GLOB_RECURSE LIBS "${CMAKE_CURRENT_BINARY_DIR}/warp/build/native/amd64/*.dll"
56+
$<IF:$<CONFIG:DEBUG>,"${CMAKE_CURRENT_BINARY_DIR}/warp/build/native/amd64/*.pdb">)
57+
endif ()
58+
59+
if (NOT LIBS)
60+
message(FATAL_ERROR "Requested version of WARP does not support current architecture (or it was packaged in a way we don't handle).")
61+
endif()
3462

63+
file(MAKE_DIRECTORY "${LLVM_RUNTIME_OUTPUT_INTDIR}")
3564
foreach(FILE ${LIBS})
3665
get_filename_component(FILENAME ${FILE} NAME)
3766
file(COPY_FILE ${FILE} "${LLVM_RUNTIME_OUTPUT_INTDIR}/${FILENAME}")
3867
endforeach()
3968

4069
file(REMOVE_RECURSE "${CMAKE_CURRENT_BINARY_DIR}/warp")
70+
set_property(GLOBAL PROPERTY WARP_ARCHITECTURE ${NUGET_ARCH})
4171
endfunction()
4272

43-
set(WARP_VERSION "System" CACHE STRING "")
44-
setup_warp(${WARP_VERSION})
73+
set(WARP_VERSION "LKG" CACHE STRING "")
74+
setup_warp(${WARP_VERSION})

docs/WARP.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@ WARP:
1515
non-WARP configurations. This is useful if you're running Windows in a VM and
1616
do not have a physical GPU.
1717

18-
* **WARP_VERSION** - Defaults to `System` which uses the system version of WARP.
19-
This option may also be set to an explicit WARP version, and the configuration
20-
step will pull WARP from NuGet. See the [NuGet package
21-
listing](https://www.nuget.org/packages/Microsoft.Direct3D.WARP) to identify
22-
valid versions.
18+
* **WARP_VERSION** - Defaults to `LKG` which uses a Known-Good version of WARP.
19+
This is the default version tested in the GitHub actions. Alternatively this
20+
option may be set to the special values `System` to use the system version or
21+
`Latest` to use the latest non-preview version, or it may be set to an
22+
explicit WARP version, and the configuration step will pull WARP from NuGet.
23+
See the [NuGet package listing](https://www.nuget.org/packages/Microsoft.Direct3D.WARP)
24+
to identify valid versions.

test/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ endif()
171171
if (OFFLOADTEST_ENABLE_D3D12 AND WIN32)
172172
set(TEST_d3d12 True)
173173
set(FORCE_WARP True)
174+
get_property(WARP_ARCHITECTURE GLOBAL PROPERTY WARP_ARCHITECTURE)
174175
add_offloadtest_lit_suite(warp-d3d12)
175176

176177
if (OFFLOADTEST_TEST_CLANG)

test/Feature/HLSLLib/firstbithigh.64.test

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@ DescriptorSets:
9090
# UNSUPPORTED: DXC-Vulkan
9191

9292
# https://github.com/microsoft/DirectXShaderCompiler/issues/7502
93-
# WARP firstbithigh(s64 -1) should return -1 but returns 32
93+
# WARP firstbithigh(s64 -1) should return -1 but returns 32 on older versions of
94+
# Warp. This was fixed for x86 in 1.0.14, but not for arm64.
9495
# XFAIL: DirectX-WARP
9596

9697
# https://github.com/llvm/llvm-project/issues/143171

test/lit.cfg.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ def setDeviceFeatures(config, device, compiler):
5353
config.available_features.add(API)
5454
if "Microsoft Basic Render Driver" in device["Description"]:
5555
config.available_features.add("%s-WARP" % API)
56+
config.available_features.add("WARP-%s" % config.warp_arch)
5657
if "Intel" in device["Description"]:
5758
config.available_features.add("%s-Intel" % API)
5859
if "UHD Graphics" in device["Description"] and API == "DirectX":

test/lit.site.cfg.py.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ config.offloadtest_dxc = '"' + path(r"@DXC_EXECUTABLE@") + '"'
99
config.offloadtest_supports_spirv = @SUPPORTS_SPIRV@
1010
config.offloadtest_test_clang = @FORCE_CLANG@
1111
config.offloadtest_test_warp = @FORCE_WARP@
12+
if config.offloadtest_test_warp:
13+
config.warp_arch = r"@WARP_ARCHITECTURE@"
1214
config.offloadtest_dxc_dir = r"@DXC_DIR@"
1315
config.goldenimage_dir = r"@GOLDENIMAGE_DIR@"
1416

0 commit comments

Comments
 (0)