Skip to content

Model K (D3D12): 16-byte aligned loads in the wide stages (-53 us GPU time per frame at 1440p on RADV, byte-identical) #661

Model K (D3D12): 16-byte aligned loads in the wide stages (-53 us GPU time per frame at 1440p on RADV, byte-identical)

Model K (D3D12): 16-byte aligned loads in the wide stages (-53 us GPU time per frame at 1440p on RADV, byte-identical) #661

Workflow file for this run

# CPU checks for every pull request and for main: licence (REUSE), line endings, the CPU builds and the CPU test set.
# No GPU job: kernels, the runtime library and the GPU tests are built and run by the maintainer (CONTRIBUTING.md).
name: CI
on:
pull_request:
push:
branches: [main]
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
checks:
name: Licence and line endings
runs-on: windows-2022
steps:
- uses: actions/checkout@v4.2.2
- uses: actions/setup-python@v5.3.0
with:
python-version: "3.12"
- name: Line endings
run: python tools/ci/check_line_endings.py
- name: Vendored model entry order (OptiScaler WrongGPU edition)
run: python tools/ci/check_vendored_model_entries.py
- name: Licence (REUSE)
run: |
$PSNativeCommandUseErrorActionPreference = $true
python -m pip install --disable-pip-version-check reuse==5.0.2
reuse lint
# The CPU builds and tests run as parallel jobs; each builds what it needs (no build output is shared between jobs).
# "CPU build and tests" (the required check) passes only when all of them pass.
converter-shared:
name: "CPU: converter and shared settings"
runs-on: windows-2022
timeout-minutes: 60
env:
CMAKE_BUILD_PARALLEL_LEVEL: "4"
PYTHONDONTWRITEBYTECODE: "1"
steps:
- uses: actions/checkout@v4.2.2
- uses: actions/setup-python@v5.3.0
with:
python-version: "3.12"
- name: Python packages
run: python -m pip install --disable-pip-version-check numpy ninja
- uses: ilammy/msvc-dev-cmd@v1.13.0
with:
arch: x64
- name: Converter
run: |
$PSNativeCommandUseErrorActionPreference = $true
cmake -S clean/converter -B out/converter -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_POLICY_DEFAULT_CMP0091=NEW -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded
cmake --build out/converter
ctest --test-dir out/converter --output-on-failure
- name: Shared settings
run: |
$PSNativeCommandUseErrorActionPreference = $true
cmake -S clean/wgshared -B out/wgshared -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_POLICY_DEFAULT_CMP0091=NEW -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded
cmake --build out/wgshared
ctest --test-dir out/wgshared --output-on-failure
frontend:
name: "CPU: FSR front end"
runs-on: windows-2022
timeout-minutes: 60
env:
CMAKE_BUILD_PARALLEL_LEVEL: "4"
PYTHONDONTWRITEBYTECODE: "1"
steps:
- uses: actions/checkout@v4.2.2
- uses: actions/setup-python@v5.3.0
with:
python-version: "3.12"
- name: Python packages
run: python -m pip install --disable-pip-version-check numpy ninja
- uses: ilammy/msvc-dev-cmd@v1.13.0
with:
arch: x64
- name: FSR front end (CPU tests)
run: |
$PSNativeCommandUseErrorActionPreference = $true
cmake -S clean/fsr -B out/frontend -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_POLICY_DEFAULT_CMP0091=NEW -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded -DWG_MODEL_K=OFF -DWG_BUILD_ID=ci -DWG_BUILD_ASI=ON
cmake --build out/frontend
ctest --test-dir out/frontend --output-on-failure -R "unit|hosted|diagnostic|support" -E "overlay|split|d3d12"
launcher:
name: "CPU: launcher"
runs-on: windows-2022
timeout-minutes: 60
env:
CMAKE_BUILD_PARALLEL_LEVEL: "4"
PYTHONDONTWRITEBYTECODE: "1"
steps:
- uses: actions/checkout@v4.2.2
- uses: actions/setup-python@v5.3.0
with:
python-version: "3.12"
- name: Python packages
run: python -m pip install --disable-pip-version-check numpy ninja
- uses: ilammy/msvc-dev-cmd@v1.13.0
with:
arch: x64
- name: HIP runtime stand-in for the launcher tests
run: |
$PSNativeCommandUseErrorActionPreference = $true
New-Item -ItemType Directory -Force out/mockhip | Out-Null
cl /nologo /LD /O2 clean/installer/tests/mock_hip.c /Fe:out/mockhip/amdhip64_7.dll /Fo:out/mockhip/
"WRONGGPU_HIP_RUNTIME=$PWD\out\mockhip\amdhip64_7.dll" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
- name: Launcher core (CPU tests)
run: |
$PSNativeCommandUseErrorActionPreference = $true
cmake -S clean/installer -B out/launcher-tests -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_POLICY_DEFAULT_CMP0091=NEW -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded -DWRONGGPU_PAYLOAD_DIR="$PWD/out/no-payload" -DWRONGGPU_TESTING=OFF -DWRONGGPU_PRESET_K=OFF -DWRONGGPU_DIRECT_ROUTE=OFF
cmake --build out/launcher-tests --target wg-core-tests launcher-core-tests coexist-core-tests convert-ignore-tests model-choice-tests model-choice-k-tests model-choice-k-only-tests
ctest --test-dir out/launcher-tests --output-on-failure -R "^(wg-core|launcher-core|coexist-core|convert-ignore|model-choice|model-choice-k|model-choice-k-only|source-size|wording)$"
- name: Test launcher from the test suite's stand-in payload (and a release build refusing it)
run: |
$PSNativeCommandUseErrorActionPreference = $true
python clean/installer/tests/run_installer_tests.py --work out/mock --prepare-only
$common = @("-G", "Ninja", "-DCMAKE_BUILD_TYPE=Release", "-DCMAKE_POLICY_DEFAULT_CMP0091=NEW", "-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded",
"-DWRONGGPU_PAYLOAD_DIR=$PWD/out/mock/prepared/payload", "-DWRONGGPU_MAP=$PWD/out/mock/prepared/test-map.json", "-DWRONGGPU_VERSION=0.3.0-test")
cmake -S clean/installer -B out/launcher-mock @common -DWRONGGPU_TESTING=ON
cmake --build out/launcher-mock --target WrongGPU launcher-core-tests
# the core tests in a WRONGGPU_TESTING build too: its test-only rules (the rr-prepare helper keeps the tests' LOCALAPPDATA)
out/launcher-mock/launcher-core-tests.exe
# the launcher suite runs only a testing build, by its identity (launcher_build_facts.py): this launcher and its restorer
# pass; the negative controls (not testing builds, one carrying the hooks' strings) are refused
python -c "import sys; sys.path.insert(0, 'clean/installer/tests'); import launcher_build_facts as f; ok = [p for p in ('WrongGPU.exe', 'WrongGPU-Restore.exe') if f.missing_test_hooks('out/launcher-mock/' + p)]; bad = [p for p in ('wg-test-canary.exe', 'wg-test-canary-strings.exe') if not f.missing_test_hooks('out/launcher-mock/' + p)]; sys.exit('not accepted: %s; not refused: %s' % (ok, bad) if ok or bad else 0)"
# the negative control: a release build (WRONGGPU_TESTING=OFF) with the same stand-in refuses it at the payload step
cmake -S clean/installer -B out/launcher-mock-release @common -DWRONGGPU_TESTING=OFF
$PSNativeCommandUseErrorActionPreference = $false
cmake --build out/launcher-mock-release --target gen/payload_table.h *> out/mock-release.log
$refused = $LASTEXITCODE -ne 0
Get-Content out/mock-release.log | Select-Object -Last 15
if (-not $refused) { throw "a release build embedded the test suite's stand-in runtime" }
if (-not (Select-String -Path out/mock-release.log -SimpleMatch "test suite's stand-in runtime" -Quiet)) { throw "the release build failed for another reason" }
$global:LASTEXITCODE = 0 # the refused build above was the expected result; the step's exit code is the last native one
release-models:
# The front end and launcher with the release's model flags (BUILDING.md 4.1 and 5.2: Model L and Model K on), so a
# change that breaks the build players get fails here too; the jobs above keep the Model M-only configuration.
name: "CPU: release model flags (Model L and K on)"
runs-on: windows-2022
timeout-minutes: 60
env:
CMAKE_BUILD_PARALLEL_LEVEL: "4"
PYTHONDONTWRITEBYTECODE: "1"
steps:
- uses: actions/checkout@v4.2.2
- uses: actions/setup-python@v5.3.0
with:
python-version: "3.12"
- name: Python packages
run: python -m pip install --disable-pip-version-check numpy ninja
- uses: ilammy/msvc-dev-cmd@v1.13.0
with:
arch: x64
- name: HIP runtime stand-in for the launcher tests
run: |
$PSNativeCommandUseErrorActionPreference = $true
New-Item -ItemType Directory -Force out/mockhip | Out-Null
cl /nologo /LD /O2 clean/installer/tests/mock_hip.c /Fe:out/mockhip/amdhip64_7.dll /Fo:out/mockhip/
"WRONGGPU_HIP_RUNTIME=$PWD\out\mockhip\amdhip64_7.dll" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
- name: FSR front end with Model L and Model K (build and CPU tests)
run: |
$PSNativeCommandUseErrorActionPreference = $true
cmake -S clean/fsr -B out/frontend-models -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_POLICY_DEFAULT_CMP0091=NEW -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded -DWG_MODEL_K=ON -DWG_MODEL_L=ON -DWG_BUILD_ID=ci -DWG_BUILD_ASI=ON
cmake --build out/frontend-models
ctest --test-dir out/frontend-models --output-on-failure -R "unit|hosted|diagnostic|support" -E "overlay|split|d3d12"
- name: Launcher with Preset K and the Model L / K choices (build and CPU tests)
run: |
$PSNativeCommandUseErrorActionPreference = $true
cmake -S clean/installer -B out/launcher-models -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_POLICY_DEFAULT_CMP0091=NEW -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded -DWRONGGPU_PAYLOAD_DIR="$PWD/out/no-payload" -DWRONGGPU_TESTING=OFF -DWRONGGPU_PRESET_K=ON -DWRONGGPU_MODEL_K=ON -DWRONGGPU_MODEL_L=ON -DWRONGGPU_DIRECT_ROUTE=OFF
cmake --build out/launcher-models --target wg-core-tests launcher-core-tests coexist-core-tests convert-ignore-tests model-choice-tests model-choice-k-tests model-choice-k-only-tests
ctest --test-dir out/launcher-models --output-on-failure -R "^(wg-core|launcher-core|coexist-core|convert-ignore|model-choice|model-choice-k|model-choice-k-only|source-size|wording)$"
- name: Payload packager and package check refuse a developer runtime (R1)
# The packager (clean/installer/tools/make_payload.py) runs clean/tests/check_no_dev_diagnostics.py on every runtime
# library it embeds and refuses the payload for dev-diagnostics=1 or a missing marker; tools/release runs the same
# check on the final package. Here the real packager is run on runtime files carrying each marker, and the check on
# packages (zip, launcher executable): what is tested are the bytes that would ship, not source strings.
run: |
$PSNativeCommandUseErrorActionPreference = $true
python -m unittest clean.tests.test_dev_diagnostics_off -v
- name: Package gate on the real runtime library (R1)
# The runtime library is built from this tree (clean/runner/build.py --runtime-only --no-embed: the C++ runtime without
# the GPU code objects) in the release configuration the package gets, and as a developer build; the gate's functions
# then check THOSE libraries: the release one passes the real packager (marker, no developer-diagnostic code text,
# build manifest with its SHA-256); the developer one, the same with a forged marker, a stripped and a changed
# library are refused.
run: |
$PSNativeCommandUseErrorActionPreference = $true
$clang = (Get-Command clang++ -ErrorAction SilentlyContinue).Source
if (-not $clang) { $clang = "C:\Program Files\LLVM\bin\clang++.exe" }
python tools/ci/check_release_runtime.py --out out/runtime-gate --cxx $clang
rr-plugin:
name: "CPU: Ray Reconstruction plugin"
runs-on: windows-2022
timeout-minutes: 60
env:
CMAKE_BUILD_PARALLEL_LEVEL: "4"
PYTHONDONTWRITEBYTECODE: "1"
steps:
- uses: actions/checkout@v4.2.2
- uses: actions/setup-python@v5.3.0
with:
python-version: "3.12"
- name: Python packages
run: python -m pip install --disable-pip-version-check numpy ninja
- uses: ilammy/msvc-dev-cmd@v1.13.0
with:
arch: x64
- name: Ray Reconstruction plugin (build and CPU tests)
run: |
$PSNativeCommandUseErrorActionPreference = $true
$env:VSDEVCMD = Join-Path $env:VSINSTALLDIR 'Common7\Tools\VsDevCmd.bat'
python clean/rr_f/proxy/tools/build.py --out out/rr-proxy --no-tests
python tools/ci/run_proxy_core_tests.py out/rr-proxy
"WG_RR_PROXY_BUILD=$PWD\out\rr-proxy" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
- name: Python tests that need the plugin build (CPU)
run: python tools/ci/run_python_tests.py --group proxy
python:
name: "CPU: Python tests ${{ matrix.shard }}/3"
runs-on: windows-2022
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
shard: [1, 2, 3]
env:
CMAKE_BUILD_PARALLEL_LEVEL: "4"
PYTHONDONTWRITEBYTECODE: "1"
steps:
- uses: actions/checkout@v4.2.2
- uses: actions/setup-python@v5.3.0
with:
python-version: "3.12"
- name: Python packages
run: python -m pip install --disable-pip-version-check numpy ninja
- uses: ilammy/msvc-dev-cmd@v1.13.0
with:
arch: x64
- name: Python tests (CPU)
run: python tools/ci/run_python_tests.py --jobs 3 --shard ${{ matrix.shard }}/3
build-and-test:
name: CPU build and tests
if: ${{ always() }}
needs: [converter-shared, frontend, launcher, release-models, rr-plugin, python]
runs-on: ubuntu-24.04
timeout-minutes: 5
steps:
- name: All CPU jobs passed
env:
RESULTS: ${{ toJSON(needs) }}
run: |
echo "$RESULTS"
test "$(echo "$RESULTS" | jq -r '[.[].result] | all(. == "success")')" = true