Skip to content

Commit 0b2d72a

Browse files
authored
Merge branch 'main' into tests/issue-1443
2 parents d22e387 + 4d69029 commit 0b2d72a

78 files changed

Lines changed: 1773 additions & 346 deletions

File tree

Some content is hidden

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

.github/workflows/pr-matrix.yaml

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ concurrency:
1313
cancel-in-progress: true
1414

1515
jobs:
16+
# windows-nvidia runs on the frequent builder instead; see
17+
# Exec-Tests-Windows-NVIDIA below and docs/frequent-builder.md.
1618
Exec-Tests-Windows:
1719
permissions:
1820
contents: read
@@ -21,11 +23,8 @@ jobs:
2123
strategy:
2224
fail-fast: false
2325
matrix:
24-
SKU: [windows-intel, windows-nvidia]
26+
SKU: [windows-intel]
2527
TestTarget: [check-hlsl-d3d12, check-hlsl-vk, check-hlsl-clang-d3d12, check-hlsl-clang-vk]
26-
exclude:
27-
- { SKU: windows-nvidia, TestTarget: check-hlsl-vk }
28-
- { SKU: windows-nvidia, TestTarget: check-hlsl-clang-vk }
2928

3029
uses: ./.github/workflows/build-and-test-callable.yaml
3130
with:
@@ -36,6 +35,39 @@ jobs:
3635
SplitBuild: true
3736
LLVM-ExtraCMakeArgs: -DCMAKE_C_COMPILER=clang-cl -DCMAKE_CXX_COMPILER=clang-cl -DOFFLOADTEST_USE_CLANG_TIDY=ON
3837

38+
# Resolved once per PR so every frequent-builder cell tests the same
39+
# toolchain. See docs/frequent-builder.md.
40+
Resolve-Frequent-Builds:
41+
permissions:
42+
contents: read
43+
actions: read
44+
if: ${{ !contains(github.event.pull_request.labels.*.name, 'disable-default-tests') }}
45+
uses: ./.github/workflows/resolve-frequent-builds.yaml
46+
47+
# Consumes prebuilt LLVM/DXC rather than compiling them per cell, so these
48+
# cells take no generic build-pool capacity.
49+
Exec-Tests-Windows-NVIDIA:
50+
permissions:
51+
contents: read
52+
checks: write
53+
actions: read
54+
if: ${{ !contains(github.event.pull_request.labels.*.name, 'disable-default-tests') }}
55+
needs: Resolve-Frequent-Builds
56+
strategy:
57+
fail-fast: false
58+
matrix:
59+
TestTarget: [check-hlsl-d3d12, check-hlsl-clang-d3d12]
60+
61+
uses: ./.github/workflows/test-callable.yaml
62+
with:
63+
OS: windows
64+
Arch: x64
65+
SKU: windows-nvidia
66+
TestTarget: ${{ matrix.TestTarget }}
67+
OffloadTest-branch: ${{ github.event.pull_request.head.sha }}
68+
LlvmRunId: ${{ needs.Resolve-Frequent-Builds.outputs.LlvmRunId }}
69+
DxcRunId: ${{ needs.Resolve-Frequent-Builds.outputs.DxcRunId }}
70+
3971
Exec-Tests-Windows-Warp:
4072
permissions:
4173
contents: read
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: Resolve Frequent Builds
2+
3+
permissions:
4+
contents: read
5+
6+
# Picks the frequent-build runs whose artifacts a set of test cells consume.
7+
# Shared by pr-matrix.yaml and validate-frequent-builder.yaml so every caller
8+
# resolves identically. See docs/frequent-builder.md.
9+
10+
on:
11+
workflow_call:
12+
inputs:
13+
LlvmRunId:
14+
description: 'Pin a frequent-build-llvm.yaml run. Blank resolves the newest successful run on main.'
15+
required: false
16+
default: ''
17+
type: string
18+
DxcRunId:
19+
description: 'Pin a frequent-build-dxc.yaml run. Blank resolves the newest successful run on main.'
20+
required: false
21+
default: ''
22+
type: string
23+
outputs:
24+
LlvmRunId:
25+
description: 'Resolved frequent-build-llvm.yaml run ID.'
26+
value: ${{ jobs.resolve.outputs.LlvmRunId }}
27+
DxcRunId:
28+
description: 'Resolved frequent-build-dxc.yaml run ID.'
29+
value: ${{ jobs.resolve.outputs.DxcRunId }}
30+
31+
jobs:
32+
resolve:
33+
runs-on: ubuntu-26.04
34+
permissions:
35+
contents: read
36+
actions: read
37+
outputs:
38+
LlvmRunId: ${{ steps.resolve.outputs.llvm_run_id }}
39+
DxcRunId: ${{ steps.resolve.outputs.dxc_run_id }}
40+
steps:
41+
- name: Resolve frequent build runs
42+
id: resolve
43+
env:
44+
GH_TOKEN: ${{ github.token }}
45+
REPO: ${{ github.repository }}
46+
PINNED_LLVM: ${{ inputs.LlvmRunId }}
47+
PINNED_DXC: ${{ inputs.DxcRunId }}
48+
run: |
49+
set -euo pipefail
50+
# Trust only schedule/dispatch runs from this repo: a fork PR
51+
# branch named `main` also matches `branch=main`.
52+
resolve() {
53+
gh api \
54+
"/repos/$REPO/actions/workflows/$1/runs?status=success&branch=main&per_page=50" \
55+
--jq '[.workflow_runs[]
56+
| select((.event == "schedule" or .event == "workflow_dispatch")
57+
and .head_repository.full_name == env.REPO)][0].id // empty'
58+
}
59+
llvm_run_id="$PINNED_LLVM"
60+
if [ -z "$llvm_run_id" ]; then
61+
llvm_run_id=$(resolve frequent-build-llvm.yaml)
62+
fi
63+
if [ -z "$llvm_run_id" ]; then
64+
echo "::error::No successful frequent-build-llvm.yaml run on main. Dispatch it once to seed the artifacts."
65+
exit 1
66+
fi
67+
dxc_run_id="$PINNED_DXC"
68+
if [ -z "$dxc_run_id" ]; then
69+
dxc_run_id=$(resolve frequent-build-dxc.yaml)
70+
fi
71+
if [ -z "$dxc_run_id" ]; then
72+
echo "::error::No successful frequent-build-dxc.yaml run on main. Dispatch it once to seed the artifacts."
73+
exit 1
74+
fi
75+
echo "Using LLVM run $llvm_run_id and DXC run $dxc_run_id"
76+
echo "llvm_run_id=$llvm_run_id" >> "$GITHUB_OUTPUT"
77+
echo "dxc_run_id=$dxc_run_id" >> "$GITHUB_OUTPUT"

.github/workflows/test-callable.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ permissions:
55

66
# Runs one lit suite on a GPU runner against distributions built by earlier
77
# frequent-build-llvm.yaml and frequent-build-dxc.yaml runs, rebuilding the
8-
# offload-test-suite tools standalone from the PR head. No caller is wired
9-
# up yet; see the commented-out template in pr-matrix.yaml and
10-
# docs/frequent-builder.md.
8+
# offload-test-suite tools standalone from the PR head. Called by
9+
# pr-matrix.yaml for windows-nvidia and by validate-frequent-builder.yaml;
10+
# see docs/frequent-builder.md.
1111

1212
on:
1313
workflow_call:

.github/workflows/validate-frequent-builder.yaml

Lines changed: 4 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -91,51 +91,13 @@ on:
9191

9292
jobs:
9393
Resolve-Frequent-Builds:
94-
runs-on: ubuntu-24.04
9594
permissions:
9695
contents: read
9796
actions: read
98-
outputs:
99-
LlvmRunId: ${{ steps.resolve.outputs.llvm_run_id }}
100-
DxcRunId: ${{ steps.resolve.outputs.dxc_run_id }}
101-
steps:
102-
- name: Resolve frequent build runs
103-
id: resolve
104-
env:
105-
GH_TOKEN: ${{ github.token }}
106-
REPO: ${{ github.repository }}
107-
PINNED_LLVM: ${{ inputs.LlvmRunId }}
108-
PINNED_DXC: ${{ inputs.DxcRunId }}
109-
run: |
110-
set -euo pipefail
111-
# Trust only schedule/dispatch runs from this repo: a fork PR
112-
# branch named `main` also matches `branch=main`.
113-
resolve() {
114-
gh api \
115-
"/repos/$REPO/actions/workflows/$1/runs?status=success&branch=main&per_page=50" \
116-
--jq '[.workflow_runs[]
117-
| select((.event == "schedule" or .event == "workflow_dispatch")
118-
and .head_repository.full_name == env.REPO)][0].id // empty'
119-
}
120-
llvm_run_id="$PINNED_LLVM"
121-
if [ -z "$llvm_run_id" ]; then
122-
llvm_run_id=$(resolve frequent-build-llvm.yaml)
123-
fi
124-
if [ -z "$llvm_run_id" ]; then
125-
echo "::error::No successful frequent-build-llvm.yaml run on main. Dispatch it once to seed the artifacts."
126-
exit 1
127-
fi
128-
dxc_run_id="$PINNED_DXC"
129-
if [ -z "$dxc_run_id" ]; then
130-
dxc_run_id=$(resolve frequent-build-dxc.yaml)
131-
fi
132-
if [ -z "$dxc_run_id" ]; then
133-
echo "::error::No successful frequent-build-dxc.yaml run on main. Dispatch it once to seed the artifacts."
134-
exit 1
135-
fi
136-
echo "Using LLVM run $llvm_run_id and DXC run $dxc_run_id"
137-
echo "llvm_run_id=$llvm_run_id" >> "$GITHUB_OUTPUT"
138-
echo "dxc_run_id=$dxc_run_id" >> "$GITHUB_OUTPUT"
97+
uses: ./.github/workflows/resolve-frequent-builds.yaml
98+
with:
99+
LlvmRunId: ${{ inputs.LlvmRunId }}
100+
DxcRunId: ${{ inputs.DxcRunId }}
139101

140102
Exec-Test:
141103
permissions:

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ endif ()
174174
add_subdirectory(third-party/libpng)
175175
set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS_BUILDTREE_ONLY png_static)
176176

177+
include(AgilitySDK)
177178
include(Warp)
178179

179180
# This must be after the third-party targets are generated so that we only apply
@@ -202,6 +203,7 @@ if (OFFLOADTEST_USE_CLANG_TIDY)
202203
endif()
203204
# Only lint headers that live inside this project's source tree.
204205
set(CLANG_TIDY_ARGS ${CLANG_TIDY_ARGS}
206+
--config-file=${CMAKE_CURRENT_SOURCE_DIR}/.clang-tidy
205207
--header-filter=^${CMAKE_CURRENT_SOURCE_DIR}/.*)
206208
if (OFFLOADTEST_CLANG_TIDY_APPLY_FIX)
207209
set(CLANG_TIDY_ARGS ${CLANG_TIDY_ARGS} --fix)

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ pip3 install pyyaml
3636

3737
On Windows, the [Graphics Tools](https://learn.microsoft.com/en-us/windows/win32/direct3d12/directx-12-programming-environment-set-up#debug-layer) optional feature is additionally required to run the test suite.
3838

39+
Windows builds use the app-local DirectX 12 Agility SDK runtime from the
40+
`Microsoft.Direct3D.D3D12` NuGet package. The default `AGILITY_SDK_VERSION=LKG`
41+
selects the repository's known-good version; `System`, `Latest`, or an explicit
42+
NuGet version may be selected instead. See [Direct3D on
43+
Windows](docs/Direct3D.md) for details.
44+
3945
# Building
4046

4147
The LLVM project provides a CMake cache file,

cmake/modules/AgilitySDK.cmake

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
include(NuGet)
2+
3+
function(setup_agility_sdk version)
4+
if (NOT WIN32)
5+
return()
6+
endif()
7+
8+
if (version STREQUAL "System")
9+
set_property(GLOBAL PROPERTY OFFLOADTEST_AGILITY_SDK_SYSTEM TRUE)
10+
return()
11+
endif()
12+
13+
guess_nuget_arch(nuget_arch)
14+
if (nuget_arch STREQUAL "x86")
15+
set(agility_arch "win32")
16+
elseif (nuget_arch STREQUAL "x64" OR nuget_arch STREQUAL "arm64")
17+
set(agility_arch "${nuget_arch}")
18+
else()
19+
message(FATAL_ERROR
20+
"The DirectX 12 Agility SDK does not support ${nuget_arch}.")
21+
endif()
22+
23+
if (version STREQUAL "LKG")
24+
set(version "1.619.5")
25+
set(version_description "Latest Known Good (${version})")
26+
elseif (version STREQUAL "Latest")
27+
set(version_description "Latest stable")
28+
else()
29+
set(version_description "Custom (${version})")
30+
endif()
31+
32+
message(STATUS "Fetching DirectX 12 Agility SDK ${version_description}...")
33+
download_nuget_package("Microsoft.Direct3D.D3D12" "${version}"
34+
agility_archive)
35+
36+
set(extract_dir "${CMAKE_CURRENT_BINARY_DIR}/agility-sdk")
37+
file(REMOVE_RECURSE "${extract_dir}")
38+
file(ARCHIVE_EXTRACT
39+
INPUT "${agility_archive}"
40+
DESTINATION "${extract_dir}"
41+
PATTERNS
42+
"*.nuspec"
43+
"build/native/bin/${agility_arch}/D3D12Core.dll"
44+
"build/native/bin/${agility_arch}/d3d12SDKLayers.dll")
45+
46+
file(GLOB nuspec_files "${extract_dir}/*.nuspec")
47+
list(LENGTH nuspec_files nuspec_count)
48+
if (NOT nuspec_count EQUAL 1)
49+
message(FATAL_ERROR
50+
"Expected one NuGet specification in the Agility SDK package, "
51+
"found ${nuspec_count}.")
52+
endif()
53+
54+
list(GET nuspec_files 0 nuspec_file)
55+
file(READ "${nuspec_file}" nuspec)
56+
string(REGEX MATCH "<version>([^<]+)</version>" unused "${nuspec}")
57+
set(package_version "${CMAKE_MATCH_1}")
58+
if (NOT package_version MATCHES "^1\\.([0-9]+)(\\.|$)")
59+
message(FATAL_ERROR
60+
"Cannot derive D3D12SDKVersion from Agility SDK package version "
61+
"'${package_version}'.")
62+
endif()
63+
set(AGILITY_SDK_VERSION_NUMBER "${CMAKE_MATCH_1}")
64+
65+
set(package_bin "${extract_dir}/build/native/bin/${agility_arch}")
66+
foreach(runtime_file D3D12Core.dll d3d12SDKLayers.dll)
67+
if (NOT EXISTS "${package_bin}/${runtime_file}")
68+
message(FATAL_ERROR
69+
"Agility SDK package ${package_version} does not contain "
70+
"${agility_arch}/${runtime_file}.")
71+
endif()
72+
endforeach()
73+
74+
install(FILES
75+
"${package_bin}/D3D12Core.dll"
76+
"${package_bin}/d3d12SDKLayers.dll"
77+
DESTINATION "${LLVM_TOOLS_INSTALL_DIR}/D3D12"
78+
COMPONENT offload-tools)
79+
80+
configure_file(
81+
"${CMAKE_CURRENT_LIST_DIR}/AgilitySDK.cpp.in"
82+
"${CMAKE_CURRENT_BINARY_DIR}/AgilitySDK.cpp"
83+
@ONLY)
84+
set_property(GLOBAL PROPERTY OFFLOADTEST_AGILITY_SDK_SOURCE
85+
"${CMAKE_CURRENT_BINARY_DIR}/AgilitySDK.cpp")
86+
set_property(GLOBAL PROPERTY OFFLOADTEST_AGILITY_SDK_BIN_DIR
87+
"${package_bin}")
88+
89+
message(STATUS
90+
"Using DirectX 12 Agility SDK ${package_version} "
91+
"(D3D12SDKVersion ${AGILITY_SDK_VERSION_NUMBER})")
92+
endfunction()
93+
94+
function(target_enable_agility_sdk target)
95+
get_property(agility_source GLOBAL PROPERTY OFFLOADTEST_AGILITY_SDK_SOURCE)
96+
if (agility_source)
97+
target_sources(${target} PRIVATE "${agility_source}")
98+
get_property(agility_bin_dir GLOBAL
99+
PROPERTY OFFLOADTEST_AGILITY_SDK_BIN_DIR)
100+
add_custom_command(TARGET ${target} POST_BUILD
101+
COMMAND "${CMAKE_COMMAND}" -E make_directory
102+
"$<TARGET_FILE_DIR:${target}>/D3D12"
103+
COMMAND "${CMAKE_COMMAND}" -E copy_if_different
104+
"${agility_bin_dir}/D3D12Core.dll"
105+
"$<TARGET_FILE_DIR:${target}>/D3D12/D3D12Core.dll"
106+
COMMAND "${CMAKE_COMMAND}" -E copy_if_different
107+
"${agility_bin_dir}/d3d12SDKLayers.dll"
108+
"$<TARGET_FILE_DIR:${target}>/D3D12/d3d12SDKLayers.dll"
109+
VERBATIM)
110+
else()
111+
get_property(use_system_sdk GLOBAL
112+
PROPERTY OFFLOADTEST_AGILITY_SDK_SYSTEM)
113+
if (use_system_sdk)
114+
add_custom_command(TARGET ${target} POST_BUILD
115+
COMMAND "${CMAKE_COMMAND}" -E remove_directory
116+
"$<TARGET_FILE_DIR:${target}>/D3D12"
117+
VERBATIM)
118+
endif()
119+
endif()
120+
endfunction()
121+
122+
set(AGILITY_SDK_VERSION "LKG" CACHE STRING
123+
"DirectX 12 Agility SDK version (LKG, System, Latest, or a NuGet version)")
124+
set_property(CACHE AGILITY_SDK_VERSION PROPERTY STRINGS LKG System Latest)
125+
setup_agility_sdk("${AGILITY_SDK_VERSION}")

cmake/modules/AgilitySDK.cpp.in

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
extern "C" {
2+
__declspec(dllexport) extern const unsigned int D3D12SDKVersion =
3+
@AGILITY_SDK_VERSION_NUMBER@;
4+
__declspec(dllexport) extern const char *D3D12SDKPath = ".\\D3D12\\";
5+
}

0 commit comments

Comments
 (0)