Expand Windows GPU support, add native FSR RR, and improve SR interop
Add a native D3D12 FSR Ray Regeneration route for gfx1200/gfx1201, using the game's device and queue with embedded HLSL guide preparation and output composition. Preserve the vkd3d compatibility route for RDNA3 and expose explicit route overrides and diagnostics. Improve Windows runtime compatibility: - Retry rejected application-ID initialization with a project identity. - Defer expensive RR backend creation until feature creation. - Recover from transient submission failures without disabling later frames. - Add shared-buffer export fallbacks through explicit heaps and a private device on the same adapter. - Safely evict old RR descriptor sets when input views change. - Treat requested RR presets as hints when a configured model is available. - Expand SR/RR input formats and handle diffuse/specular hit distances, packed normals, depth-stencil resources, and unused FSR guides. Reduce SR overhead by batching output downloads and format conversion under one completion wait. Optimize strict M enc2/tube attention with bounded FP32 accumulation and the original FP64 fallback for ambiguous rounding cases. Extend RDNA4 tooling with gfx1200/gfx1201 native FP8 RR model builds, capability checks, architecture-aware deployment, and experimental K/M kernel paths. Require matching model and runtime arithmetic families. Add optional embedded FSR shader optimizations keyed by shader hash and exact original SPIR-V contents. Preserve reflected metadata and record optimizer provenance, artifact hashes, and cache identity. Simplify Windows installation with automatic backend dependency downloads, download progress and ETA, backed-up absolute OptiScaler library paths, and recovery from interrupted RR model builds. Add build-kernels.bat and a kernels-only build matrix for all eleven registered RDNA targets, with code-object target validation and SHA256 manifests. Expand conversion probes, numerical stress tests, temporal benchmark tooling, installer/deployment tests, and setup documentation. Document synthetic regression and timing results, experimental build options, and remaining RDNA4 hardware validation requirements.
This commit is contained in:
1 parent
a617c818de
commit
ac4ee6c225
67 files changed
+3147
-326
No files matched your search
@@ -35,7 +35,7 @@ try {
|
||||
$build = Join-Path $repo "build/native-engine-windows-$GpuArch"
|
||||
$headers = Join-Path $tools 'Vulkan-Headers-v1.4.341'
|
||||
$volk = Join-Path $tools 'volk'
|
||||
& $cmake --fresh -S $repo -B $build -G Ninja "-DCMAKE_MAKE_PROGRAM=$ninja" `
|
||||
& $cmake --fresh -S $repo -B $build -G Ninja '-DCMAKE_BUILD_TYPE=Release' "-DCMAKE_MAKE_PROGRAM=$ninja" `
|
||||
"-DCMAKE_C_COMPILER=$cCompiler" "-DCMAKE_CXX_COMPILER=$cxxCompiler" `
|
||||
"-DD4R_HIP_ROOT=$HipRoot" "-DD4R_GPU_ARCH=$GpuArch" `
|
||||
'-DD4R_BUILD_NATIVE_ENGINE=ON' "-DD4R_VULKAN_HEADERS_ROOT=$headers" "-DD4R_VOLK_ROOT=$volk" `
|
||||
|
||||
@@ -3,7 +3,7 @@ param([ValidateSet('enc0','enc1','enc2','enc3','enc4','dec5','dec4','dec3','dec2
|
||||
[string]$Layer='enc1', [ValidateSet('source','cu','wgp')][string]$Mode='source',
|
||||
[ValidateSet('baseline','load','store','both')][string]$NonTemporal='baseline',
|
||||
[ValidateSet(0,1,2,4)][int]$PosTiles=0, [switch]$ShareValues, [switch]$PrivateValues,
|
||||
[switch]$PackedAccumulator, [ValidateSet('lds','ds')][string]$LaneExchange='lds',
|
||||
[switch]$PackedAccumulator, [switch]$F16Wmma, [ValidateSet('lds','ds','native')][string]$LaneExchange='lds',
|
||||
[ValidateSet('gfx1100','gfx1101','gfx1102','gfx1103','gfx1150','gfx1151','gfx1152','gfx1153','gfx1154','gfx1200','gfx1201')]
|
||||
[string]$GpuArch='gfx1201',
|
||||
[string]$HipRoot, [string]$OutputDirectory)
|
||||
@@ -11,10 +11,12 @@ $ErrorActionPreference='Stop'
|
||||
$repo=[IO.Path]::GetFullPath((Join-Path $PSScriptRoot '../..'))
|
||||
if (!$HipRoot) { $HipRoot=Join-Path $repo '.tools/therock-10.2.0a20260929/_rocm_sdk_core' }
|
||||
if ($ShareValues -and $PrivateValues) { throw 'Choose shared or private V storage.' }
|
||||
if ($GpuArch -notmatch '^gfx12' -and $PackedAccumulator) {
|
||||
throw 'Packed accumulator experiments require gfx12.'
|
||||
if ($GpuArch -notmatch '^gfx12' -and ($PackedAccumulator -or $F16Wmma)) {
|
||||
throw 'Packed accumulator and F16 WMMA experiments require gfx12.'
|
||||
}
|
||||
if ($PackedAccumulator -and $F16Wmma) { throw 'Packed accumulator storage requires F32 WMMA.' }
|
||||
if (!$OutputDirectory) { $OutputDirectory=Join-Path $repo "build/native-k-experiment-$GpuArch-$Layer-$Mode-$NonTemporal-pos$PosTiles-share$([int][bool]$ShareValues)-private$([int][bool]$PrivateValues)-packed$([int][bool]$PackedAccumulator)" }
|
||||
if ($F16Wmma -and !$PSBoundParameters.ContainsKey('OutputDirectory')) { $OutputDirectory+='-f16-wmma' }
|
||||
$OutputDirectory=[IO.Path]::GetFullPath($OutputDirectory)
|
||||
foreach ($baseline in @('build/native-k-gfx1201','build/windows-rdna4-therock','dist/windows-rdna4-command-list')) {
|
||||
if ($OutputDirectory.StartsWith([IO.Path]::GetFullPath((Join-Path $repo $baseline)), [StringComparison]::OrdinalIgnoreCase)) {
|
||||
@@ -44,8 +46,9 @@ if ($ShareValues) {
|
||||
$flags+='-DPOS_VSHARE'
|
||||
}
|
||||
if ($PackedAccumulator) { $flags+='-DD4R_K_PACKED_ACC' }
|
||||
if ($F16Wmma) { $flags+='-DD4R_K_F16_WMMA' }
|
||||
if ($PrivateValues) { $flags+='-DD4R_K_PRIVATE_V' }
|
||||
if ($GpuArch -match '^gfx11') { $flags+='-DD4R_WINDOWS_GFX11_LANE_EXCHANGE' }
|
||||
if ($GpuArch -match '^gfx11' -and $LaneExchange -ne 'native') { $flags+='-DD4R_WINDOWS_GFX11_LANE_EXCHANGE' }
|
||||
if ($LaneExchange -eq 'ds') {
|
||||
if ($GpuArch -notmatch '^gfx11') { throw 'DS lane exchange experiment requires gfx11.' }
|
||||
$flags+='-DD4R_WINDOWS_GFX11_DS_EXCHANGE'
|
||||
@@ -69,6 +72,7 @@ if ($LASTEXITCODE) { throw 'Native object metadata extraction failed.' }
|
||||
mode=$Mode; nonTemporal=$NonTemporal; tokenTilesPerWave=$PosTiles; shareValues=[bool]$ShareValues;
|
||||
privateValues=[bool]$PrivateValues;
|
||||
packedAccumulator=[bool]$PackedAccumulator; laneExchange=$LaneExchange;
|
||||
f16Wmma=[bool]$F16Wmma;
|
||||
compiler=$compiler; arguments=$arguments;
|
||||
sourceCommit=(git -C $repo rev-parse HEAD); workingTreeDirty=[bool](& git -C $repo status --porcelain);
|
||||
compilerVersion=(& $compiler --version | Out-String).Trim();
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[ValidateSet('lds','ds','native')][string]$LaneExchange='lds',
|
||||
[ValidateSet('gfx1100','gfx1101','gfx1102','gfx1103','gfx1200','gfx1201')][string]$GpuArch='gfx1101',
|
||||
[switch]$ReferencePv,
|
||||
[string]$HipRoot, [string]$OutputDirectory
|
||||
)
|
||||
$ErrorActionPreference='Stop'
|
||||
$repo=[IO.Path]::GetFullPath((Join-Path $PSScriptRoot '../..'))
|
||||
if ($GpuArch -match '^gfx12') {
|
||||
if (!$PSBoundParameters.ContainsKey('LaneExchange')) { $LaneExchange='native' }
|
||||
if ($LaneExchange -ne 'native') { throw 'RDNA4 experiments use native lane exchange.' }
|
||||
}
|
||||
if (!$HipRoot) { $HipRoot=Join-Path $repo '.tools/therock-10.2.0a20260929/_rocm_sdk_core' }
|
||||
if (!$OutputDirectory) {
|
||||
$suffix=if ($ReferencePv) { '-reference-pv' } else { '-bounded-pv' }
|
||||
$OutputDirectory=Join-Path $repo "build/native-m-experiment-$GpuArch-$LaneExchange$suffix"
|
||||
}
|
||||
$OutputDirectory=[IO.Path]::GetFullPath($OutputDirectory)
|
||||
# Experiments never overwrite a package or an earlier candidate.
|
||||
New-Item -ItemType Directory $OutputDirectory -ErrorAction Stop | Out-Null
|
||||
$compiler=Join-Path $HipRoot 'lib/llvm/bin/clang++.exe'
|
||||
if (!(Test-Path -LiteralPath $compiler)) { $compiler=Join-Path $HipRoot 'bin/clang++.exe' }
|
||||
$flags=@('-x','hip','-std=c++17',"--offload-arch=$GpuArch",'--offload-device-only',
|
||||
'--no-gpu-bundle-output','-mno-wavefrontsize64','-nogpuinc','-nogpulib','-O3',
|
||||
'-DD4R_DEVICE_ONLY_MINIMAL','-DSWIN_EXACT','-DSWIN_EXACT_PV')
|
||||
if ($GpuArch -match '^gfx11' -and $LaneExchange -ne 'native') { $flags+='-DD4R_WINDOWS_GFX11_LANE_EXCHANGE' }
|
||||
if ($LaneExchange -eq 'ds') { $flags+='-DD4R_WINDOWS_GFX11_DS_EXCHANGE' }
|
||||
if ($ReferencePv) { $flags+='-DSWIN_EXACT_PV_REFERENCE' }
|
||||
$modules=@()
|
||||
foreach ($source in Get-ChildItem (Join-Path $repo 'kernels/m') -Filter '*.hip') {
|
||||
$object=Join-Path $OutputDirectory ($source.BaseName+'.hsaco')
|
||||
& $compiler @flags $source.FullName -o $object `
|
||||
> (Join-Path $OutputDirectory ($source.BaseName+'.stdout.log')) `
|
||||
2> (Join-Path $OutputDirectory ($source.BaseName+'.stderr.log'))
|
||||
if ($LASTEXITCODE) { throw "M compile failed: $($source.Name)" }
|
||||
$modules+=@{name=$source.BaseName; sha256=(Get-FileHash -LiteralPath $object -Algorithm SHA256).Hash}
|
||||
}
|
||||
@{architecture=$GpuArch; laneExchange=$LaneExchange; experimental=$true;
|
||||
numerics='SWIN_EXACT; SWIN_EXACT_PV'; validation='pending';
|
||||
compiler=$compiler; compilerVersion=(& $compiler --version | Out-String).Trim();
|
||||
flags=$flags; modules=$modules} | ConvertTo-Json -Depth 5 |
|
||||
Set-Content (Join-Path $OutputDirectory 'build-info.json') -Encoding UTF8
|
||||
Write-Host "Built strict M $LaneExchange candidate: $OutputDirectory. Validate before installing."
|
||||
@@ -1,11 +1,13 @@
|
||||
[CmdletBinding()]
|
||||
param([Parameter(Mandatory=$true)][string]$DlssDll, [string]$HipRoot, [string]$OutputDirectory, [switch]$HardwarePacking, [switch]$TokenLanes)
|
||||
param([Parameter(Mandatory=$true)][string]$DlssDll, [string]$HipRoot, [string]$OutputDirectory, [switch]$HardwarePacking, [switch]$TokenLanes,
|
||||
[ValidateSet('gfx1200','gfx1201')][string]$GpuArch='gfx1201')
|
||||
$ErrorActionPreference='Stop'
|
||||
$repo=[IO.Path]::GetFullPath((Join-Path $PSScriptRoot '../..'))
|
||||
if (!$HipRoot) { $HipRoot=Join-Path $repo '.tools/therock-10.2.0a20260929/_rocm_sdk_core' }
|
||||
if (!$OutputDirectory) { $OutputDirectory=Join-Path $repo $(if ($HardwarePacking) { 'build/native-m-fp8-hardware-pack' } else { 'build/native-m-fp8-experimental' }) }
|
||||
if (!$PSBoundParameters.ContainsKey('OutputDirectory') -and $GpuArch -ne 'gfx1201') { $OutputDirectory += "-$GpuArch" }
|
||||
$OutputDirectory=[IO.Path]::GetFullPath($OutputDirectory)
|
||||
if ($OutputDirectory -eq [IO.Path]::GetFullPath((Join-Path $repo 'build/native-m-gfx1201'))) {
|
||||
if ($OutputDirectory -eq [IO.Path]::GetFullPath((Join-Path $repo "build/native-m-$GpuArch"))) {
|
||||
throw 'Keep the validated FP16 baseline separate from the experimental FP8 build.'
|
||||
}
|
||||
$DlssDll=(Get-Item -LiteralPath $DlssDll -ErrorAction Stop).FullName
|
||||
@@ -22,7 +24,7 @@ foreach ($source in Get-ChildItem -LiteralPath (Join-Path $repo 'kernels/m') -Fi
|
||||
if ($TokenLanes) { $flags+='-DSWIN_TOKEN_LANES' }
|
||||
$object=Join-Path $OutputDirectory ($source.BaseName+'.hsaco')
|
||||
$ErrorActionPreference='Continue'
|
||||
& $compiler -x hip -std=c++17 --offload-arch=gfx1201 --offload-device-only --no-gpu-bundle-output `
|
||||
& $compiler -x hip -std=c++17 "--offload-arch=$GpuArch" --offload-device-only --no-gpu-bundle-output `
|
||||
-mno-wavefrontsize64 -nogpuinc -nogpulib -O3 -DD4R_DEVICE_ONLY_MINIMAL `
|
||||
-DSWIN_EXACT -DSWIN_EXACT_PV -DD4R_FP8_WMMA @flags $source.FullName `
|
||||
-o $object > (Join-Path $OutputDirectory ($source.BaseName+'.build.stdout.log')) `
|
||||
@@ -30,17 +32,17 @@ foreach ($source in Get-ChildItem -LiteralPath (Join-Path $repo 'kernels/m') -Fi
|
||||
$ErrorActionPreference='Stop'
|
||||
if ($LASTEXITCODE) { throw "Experimental FP8 compile failed: $($source.Name)" }
|
||||
$isa=Join-Path $OutputDirectory ($source.BaseName+'.isa.txt')
|
||||
& $disassembler --disassemble --mcpu=gfx1201 $object > $isa
|
||||
& $disassembler --disassemble "--mcpu=$GpuArch" $object > $isa
|
||||
if ($LASTEXITCODE -or !(Select-String -LiteralPath $isa -Pattern 'v_wmma_f32_16x16x16_fp8_fp8')) {
|
||||
throw "Native FP8 WMMA is absent from $($source.Name); no FP16 fallback is accepted."
|
||||
}
|
||||
if ($HardwarePacking -and !(Select-String -LiteralPath $isa -Pattern 'v_cvt_pk_fp8_f32')) { throw 'Native FP8 operand packing is absent from ISA.' }
|
||||
Write-Host "Compiled gfx1201 FP8 WMMA: $($source.BaseName)"
|
||||
Write-Host "Compiled $GpuArch FP8 WMMA: $($source.BaseName)"
|
||||
}
|
||||
if ($HardwarePacking) {
|
||||
$probeDirectory=Join-Path $OutputDirectory 'packing-probe'
|
||||
New-Item -ItemType Directory -Force $probeDirectory | Out-Null
|
||||
& $compiler -x hip -std=c++17 --offload-arch=gfx1201 --offload-device-only --no-gpu-bundle-output `
|
||||
& $compiler -x hip -std=c++17 "--offload-arch=$GpuArch" --offload-device-only --no-gpu-bundle-output `
|
||||
-mno-wavefrontsize64 -nogpuinc -nogpulib -O3 -DD4R_DEVICE_ONLY_MINIMAL `
|
||||
-DD4R_FP8_WMMA -DD4R_FP8_HW_PACK -DSWIN_EXACT -DSWIN_EXACT_PV `
|
||||
(Join-Path $repo 'tools/windows/fp8_pack_probe.hip') -o (Join-Path $probeDirectory 'fp8_pack_probe.hsaco')
|
||||
@@ -48,7 +50,7 @@ if ($HardwarePacking) {
|
||||
}
|
||||
& python (Join-Path $repo 'kernels/tools/kernel_manifest.py') $OutputDirectory $DlssDll
|
||||
if ($LASTEXITCODE) { throw 'Experimental FP8 manifest generation failed.' }
|
||||
@{architecture='gfx1201'; family='M'; experimental=$true; nativeFp8=$true; accuracy=$true;
|
||||
@{architecture=$GpuArch; family='M'; experimental=$true; nativeFp8=$true; accuracy=$true;
|
||||
numerics='SWIN_EXACT; SWIN_EXACT_PV; FP8 WMMA for e4m3 GEMMs; exact FP16 attention';
|
||||
validation='not validated; do not install before layer/full-network checks'; tokenLanes=[bool]$TokenLanes;
|
||||
compiler=$compiler; compilerVersion=(& $compiler --version | Select-Object -First 1);
|
||||
|
||||
@@ -6,7 +6,8 @@ param(
|
||||
[string]$ZludaRoot,
|
||||
[ValidateSet('cu','wgp')][string]$ShaderMode='cu',
|
||||
[string]$GpuArch='gfx1201',
|
||||
[string]$OutputDirectory
|
||||
[string]$OutputDirectory,
|
||||
[switch]$Wave64
|
||||
)
|
||||
$ErrorActionPreference='Stop'
|
||||
. (Join-Path $PSScriptRoot 'gpu-target.ps1')
|
||||
@@ -14,6 +15,8 @@ $ErrorActionPreference='Stop'
|
||||
$repo=[IO.Path]::GetFullPath((Join-Path $PSScriptRoot '../..'))
|
||||
if (!$ZludaRoot) { $ZludaRoot=Join-Path $repo 'dist/zluda-windows-final' }
|
||||
if (!$OutputDirectory) { $OutputDirectory=Join-Path $repo "build/private-textures-$GpuArch" }
|
||||
$waveFlags=@()
|
||||
if ($Wave64) { $waveFlags+='--wave64' }
|
||||
& python (Join-Path $repo 'tools/windows/build_native_texture.py') --dlss-dll $DlssDll --hip-root $HipRoot `
|
||||
--zluda-root $ZludaRoot --kernel $Kernel --output-directory $OutputDirectory --shader-mode $ShaderMode --gpu-arch $GpuArch
|
||||
--zluda-root $ZludaRoot --kernel $Kernel --output-directory $OutputDirectory --shader-mode $ShaderMode --gpu-arch $GpuArch @waveFlags
|
||||
if ($LASTEXITCODE) { throw "Native texture build failed ($LASTEXITCODE); inspect the output work directory." }
|
||||
@@ -4,17 +4,21 @@ param(
|
||||
[ValidateSet('stable','therock')][string]$RuntimeProfile='therock',
|
||||
[string]$ZludaRoot, [string]$DlssDll,
|
||||
[switch]$PackageGames,
|
||||
[switch]$KernelsOnly,
|
||||
[string]$BuildRoot, [string]$OutputRoot, [string]$ArchiveDirectory
|
||||
)
|
||||
$ErrorActionPreference='Stop'
|
||||
# Load the hash function in this scope before invoking child build scripts (PS 5.1).
|
||||
Import-Module Microsoft.PowerShell.Utility
|
||||
. (Join-Path $PSScriptRoot 'gpu-target.ps1')
|
||||
$repo=[IO.Path]::GetFullPath((Join-Path $PSScriptRoot '../..'))
|
||||
if (!$GpuArchitectures) { $GpuArchitectures=@(Get-D4RGpuTargets | ForEach-Object { $_.architecture }) }
|
||||
foreach ($arch in $GpuArchitectures) { [void](Get-D4RGpuTargetInfo $arch) }
|
||||
if (@($GpuArchitectures | Select-Object -Unique).Count -ne $GpuArchitectures.Count) { throw 'Duplicate GPU target.' }
|
||||
if (!$BuildRoot) { $BuildRoot=Join-Path $repo 'build/windows-gpu-coverage' }
|
||||
if (!$OutputRoot) { $OutputRoot=Join-Path $repo 'dist/windows-gpu-coverage' }
|
||||
if (!$BuildRoot) { $BuildRoot=Join-Path $repo $(if ($KernelsOnly) { 'build/windows-kernels' } else { 'build/windows-gpu-coverage' }) }
|
||||
if (!$OutputRoot) { $OutputRoot=Join-Path $repo $(if ($KernelsOnly) { 'dist/windows-kernels' } else { 'dist/windows-gpu-coverage' }) }
|
||||
if (!$ZludaRoot) { $ZludaRoot=Join-Path $repo 'dist/zluda-windows-final' }
|
||||
if ($KernelsOnly -and $PackageGames) { throw 'KernelsOnly cannot package games; game packages also require host DLLs.' }
|
||||
if ($ArchiveDirectory -and !$PackageGames) { throw 'ArchiveDirectory requires PackageGames.' }
|
||||
if ($PackageGames -and (!$DlssDll -or ![IO.Path]::IsPathRooted($DlssDll) -or !(Test-Path -LiteralPath $DlssDll))) {
|
||||
throw 'PackageGames requires an absolute path to your local nvngx_dlss.dll; it will not be redistributed.'
|
||||
@@ -27,8 +31,13 @@ foreach ($arch in $GpuArchitectures) {
|
||||
$log=Join-Path $BuildRoot "$arch-build.log"
|
||||
Write-Host "Building $arch (compile/package only; no GPU workloads). Log: $log"
|
||||
& (Join-Path $PSScriptRoot 'build-windows-rdna4.ps1') -RuntimeProfile $RuntimeProfile -GpuArch $arch `
|
||||
-ZludaRoot $ZludaRoot -BuildDirectory $build -InstallDirectory $diag *> $log
|
||||
$row=[ordered]@{architecture=$arch; compiled=$true; hardwareTestExecuted=$false; buildDirectory=$build; diagnosticRoot=$diag; log=$log}
|
||||
-ZludaRoot $ZludaRoot -BuildDirectory $build -InstallDirectory $diag -KernelsOnly:$KernelsOnly *> $log
|
||||
$objects=@(Get-ChildItem -LiteralPath $diag -Recurse -Filter '*.hsaco')
|
||||
if ($objects.Count -ne 19) { throw "Expected 19 code objects for $arch, found $($objects.Count). See $log" }
|
||||
foreach ($object in $objects) { Assert-D4RCodeObjectTarget $object.FullName $arch }
|
||||
$row=[ordered]@{architecture=$arch; compiled=$true; kernelsOnly=[bool]$KernelsOnly; codeObjectCount=$objects.Count;
|
||||
hardwareTestExecuted=$false; buildDirectory=$build; diagnosticRoot=$diag; log=$log;
|
||||
objects=@($objects | ForEach-Object { @{path=$_.FullName; sha256=(Get-FileHash -LiteralPath $_.FullName -Algorithm SHA256).Hash} })}
|
||||
if ($PackageGames) {
|
||||
$k="$BuildRoot-native-k-$arch"; $m="$BuildRoot-native-m-$arch"; $game="$OutputRoot-game-$arch"
|
||||
& (Join-Path $PSScriptRoot 'stage-native-k.ps1') -DlssDll $DlssDll -PackageRoot $diag -GpuArch $arch -OutputDirectory $k
|
||||
|
||||
@@ -6,7 +6,8 @@ param(
|
||||
[string]$ZludaRoot,
|
||||
[string]$ToolchainRoot,
|
||||
[string]$BuildDirectory,
|
||||
[string]$InstallDirectory
|
||||
[string]$InstallDirectory,
|
||||
[switch]$KernelsOnly
|
||||
)
|
||||
$ErrorActionPreference = 'Stop'
|
||||
. (Join-Path $PSScriptRoot 'gpu-target.ps1')
|
||||
@@ -24,6 +25,10 @@ if ($GpuArch -ne 'gfx1201') {
|
||||
if (!$PSBoundParameters.ContainsKey('BuildDirectory')) { $BuildDirectory += "-$GpuArch" }
|
||||
if (!$PSBoundParameters.ContainsKey('InstallDirectory')) { $InstallDirectory += "-$GpuArch" }
|
||||
}
|
||||
if ($KernelsOnly) {
|
||||
if (!$PSBoundParameters.ContainsKey('BuildDirectory')) { $BuildDirectory=Join-Path $repo "build/windows-kernels-$GpuArch" }
|
||||
if (!$PSBoundParameters.ContainsKey('InstallDirectory')) { $InstallDirectory=Join-Path $repo "dist/windows-kernels-$GpuArch" }
|
||||
}
|
||||
$HipRoot = [IO.Path]::GetFullPath($HipRoot).TrimEnd('\', '/')
|
||||
$BuildDirectory = [IO.Path]::GetFullPath($BuildDirectory).TrimEnd('\', '/')
|
||||
$InstallDirectory = [IO.Path]::GetFullPath($InstallDirectory).TrimEnd('\', '/')
|
||||
@@ -43,18 +48,21 @@ if (!(Test-Path $cmake) -or !(Test-Path $ninja)) {
|
||||
}
|
||||
New-Item -ItemType Directory -Force $BuildDirectory | Out-Null
|
||||
$minhook = Join-Path $repo 'external/MinHook'
|
||||
if (!(Test-Path (Join-Path $minhook 'include/MinHook.h'))) {
|
||||
& git clone --depth 1 --branch v1.3.4 https://github.com/TsudaKageyu/minhook.git $minhook
|
||||
if ($LASTEXITCODE) { throw 'MinHook 1.3.4 source download failed.' }
|
||||
}
|
||||
$minhookCommit = (& git -C $minhook rev-parse HEAD).Trim()
|
||||
if ($minhookCommit -ne 'c3fcafdc10146beb5919319d0683e44e3c30d537') {
|
||||
throw "Expected audited MinHook 1.3.4 source, found $minhookCommit"
|
||||
if (!$KernelsOnly) {
|
||||
if (!(Test-Path (Join-Path $minhook 'include/MinHook.h'))) {
|
||||
& git clone --depth 1 --branch v1.3.4 https://github.com/TsudaKageyu/minhook.git $minhook
|
||||
if ($LASTEXITCODE) { throw 'MinHook 1.3.4 source download failed.' }
|
||||
}
|
||||
$minhookCommit = (& git -C $minhook rev-parse HEAD).Trim()
|
||||
if ($minhookCommit -ne 'c3fcafdc10146beb5919319d0683e44e3c30d537') {
|
||||
throw "Expected audited MinHook 1.3.4 source, found $minhookCommit"
|
||||
}
|
||||
}
|
||||
$originalPath = $env:PATH
|
||||
try {
|
||||
$configure = @('--fresh', '-S', $repo, '-B', $BuildDirectory, '-G', 'Ninja', '-DCMAKE_BUILD_TYPE=RelWithDebInfo',
|
||||
"-DCMAKE_MAKE_PROGRAM=$ninja", "-DD4R_HIP_ROOT=$HipRoot", "-DD4R_GPU_ARCH=$GpuArch", "-DCMAKE_INSTALL_PREFIX=$InstallDirectory")
|
||||
$configure += "-DD4R_KERNELS_ONLY=$([int][bool]$KernelsOnly)"
|
||||
if ($ToolchainRoot) {
|
||||
$compiler = Join-Path $ToolchainRoot 'bin/x86_64-w64-mingw32-clang++.exe'
|
||||
if (!(Test-Path $compiler)) { throw "Compiler missing: $compiler" }
|
||||
@@ -68,12 +76,19 @@ try {
|
||||
$ErrorActionPreference = 'Stop'
|
||||
if ($LASTEXITCODE) { throw "CMake configure exit=$LASTEXITCODE" }
|
||||
$ErrorActionPreference = 'Continue'
|
||||
& $cmake --build $BuildDirectory --parallel 4 2>&1 | Tee-Object (Join-Path $BuildDirectory 'build.log')
|
||||
$buildArgs=@('--build', $BuildDirectory, '--parallel', '4')
|
||||
if ($KernelsOnly) { $buildArgs+=@('--target', 'd4r_native_compile', 'd4r_probe_code_object', 'd4r_pixel_code_object', 'd4r_wmma_code_object') }
|
||||
& $cmake @buildArgs 2>&1 | Tee-Object (Join-Path $BuildDirectory 'build.log')
|
||||
$ErrorActionPreference = 'Stop'
|
||||
if ($LASTEXITCODE) { throw "Build exit=$LASTEXITCODE" }
|
||||
$ErrorActionPreference = 'Continue'
|
||||
& $cmake --install $BuildDirectory 2>&1 | Tee-Object (Join-Path $BuildDirectory 'install.log')
|
||||
$installArgs=@('--install', $BuildDirectory)
|
||||
if ($KernelsOnly) { $installArgs+=@('--component', 'kernels') }
|
||||
& $cmake @installArgs 2>&1 | Tee-Object (Join-Path $BuildDirectory 'install.log')
|
||||
$ErrorActionPreference = 'Stop'
|
||||
if ($LASTEXITCODE) { throw "Install exit=$LASTEXITCODE" }
|
||||
Write-Host "Built diagnostics: $InstallDirectory"
|
||||
foreach ($object in Get-ChildItem -LiteralPath $BuildDirectory -Filter '*.hsaco') {
|
||||
Assert-D4RCodeObjectTarget $object.FullName $GpuArch
|
||||
}
|
||||
Write-Host "Built $GpuArch artifacts: $InstallDirectory"
|
||||
} finally { $env:PATH = $originalPath }
|
||||
Reference in new issue
Block a user