Reproduce gfx12 FP16 accumulator differences and preserve K baseline
This commit is contained in:
1 parent
9dece89599
commit
bf4923aa4c
8 files changed
+254
-2
No files matched your search
@@ -0,0 +1,40 @@
|
||||
[CmdletBinding()]
|
||||
param([ValidateSet('enc0','enc1','enc2','enc3','enc4','dec5','dec4','dec3','dec2','dec1','dec0')]
|
||||
[string]$Layer='enc1', [string]$HipRoot, [string]$OutputDirectory)
|
||||
$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 'build/native-k-f16-wmma-experimental' }
|
||||
$OutputDirectory=[IO.Path]::GetFullPath($OutputDirectory)
|
||||
if ($OutputDirectory -eq [IO.Path]::GetFullPath((Join-Path $repo 'build/native-k-gfx1201'))) {
|
||||
throw 'Keep the validated baseline separate from this experimental build.'
|
||||
}
|
||||
$compiler=Join-Path $HipRoot 'lib/llvm/bin/clang++.exe'
|
||||
if (!(Test-Path -LiteralPath $compiler)) { $compiler=Join-Path $HipRoot 'bin/clang++.exe' }
|
||||
if (!(Test-Path -LiteralPath $compiler)) { throw "HIP compiler missing under $HipRoot" }
|
||||
$name="dltss_pwin_${Layer}_layer"
|
||||
$source=Join-Path $repo "kernels/k/$name.hip"
|
||||
$flags=@()
|
||||
if ((Get-Content -LiteralPath $source -Raw) -match '// d4r-build-flags: ([^\r\n]+)') { $flags=$Matches[1].Trim().Split(' ') }
|
||||
New-Item -ItemType Directory -Force $OutputDirectory | Out-Null
|
||||
$object=Join-Path $OutputDirectory "$name.hsaco"
|
||||
$ErrorActionPreference='Continue'
|
||||
& $compiler -x hip -std=c++17 --offload-arch=gfx1201 --offload-device-only --no-gpu-bundle-output `
|
||||
-mno-wavefrontsize64 -nogpuinc -nogpulib -O3 -DD4R_DEVICE_ONLY_MINIMAL `
|
||||
-DD4R_K_FP16_BASELINE -DD4R_K_F16_WMMA @flags $source -o $object `
|
||||
> (Join-Path $OutputDirectory "$name.build.stdout.log") 2> (Join-Path $OutputDirectory "$name.build.stderr.log")
|
||||
$ErrorActionPreference='Stop'
|
||||
if ($LASTEXITCODE) { throw "Experimental K FP16 WMMA compile failed: $Layer" }
|
||||
$isa=Join-Path $OutputDirectory "$name.isa.txt"
|
||||
& (Join-Path (Split-Path $compiler) 'llvm-objdump.exe') --disassemble --mcpu=gfx1201 $object > $isa
|
||||
if ($LASTEXITCODE -or !(Select-String -LiteralPath $isa -Pattern 'v_wmma_f16_16x16x16_f16')) {
|
||||
throw 'Packed FP16 WMMA is absent from ISA; no alternative instruction is accepted.'
|
||||
}
|
||||
& (Join-Path (Split-Path $compiler) 'llvm-readobj.exe') --notes $object `
|
||||
> (Join-Path $OutputDirectory "$name.metadata.txt")
|
||||
if ($LASTEXITCODE) { throw 'Native object metadata extraction failed.' }
|
||||
@{layer=$Layer; architecture='gfx1201'; experimental=$true; numericalValidation='pending';
|
||||
compiler=$compiler; sha256=(Get-FileHash -LiteralPath $object -Algorithm SHA256).Hash} |
|
||||
ConvertTo-Json | Set-Content -LiteralPath (Join-Path $OutputDirectory "$name.build-info.json") -Encoding UTF8
|
||||
Write-Host "Compiled experimental gfx1201 packed FP16 WMMA: $Layer. Validate before selecting another layer."
|
||||
# This script does not generate an override manifest or install into the game.
|
||||
@@ -0,0 +1,24 @@
|
||||
[CmdletBinding()]
|
||||
param([string]$HipRoot, [string]$PackageRoot, [string]$OutputDirectory)
|
||||
$ErrorActionPreference='Stop'
|
||||
$repo=[IO.Path]::GetFullPath((Join-Path $PSScriptRoot '../..'))
|
||||
if (!$HipRoot) { $HipRoot=Join-Path $repo '.tools/therock-10.2.0a20260929/_rocm_sdk_core' }
|
||||
if (!$PackageRoot) { $PackageRoot=Join-Path $repo 'dist/windows-rdna4-command-list' }
|
||||
if (!$OutputDirectory) { $OutputDirectory=Join-Path $repo ('test-results/wmma-f16-' + (Get-Date -Format 'yyyyMMdd-HHmmss-fff')) }
|
||||
$compiler=Join-Path $HipRoot 'lib/llvm/bin/clang++.exe'
|
||||
if (!(Test-Path -LiteralPath $compiler)) { $compiler=Join-Path $HipRoot 'bin/clang++.exe' }
|
||||
New-Item -ItemType Directory -Force $OutputDirectory | Out-Null
|
||||
$module=Join-Path $OutputDirectory 'wmma_f16_compare.hsaco'
|
||||
& $compiler -x hip -std=c++17 --offload-arch=gfx1201 --offload-device-only --no-gpu-bundle-output `
|
||||
-mno-wavefrontsize64 -nogpuinc -nogpulib -O3 (Join-Path $repo 'tools/windows/wmma_f16_compare.hip') -o $module
|
||||
if ($LASTEXITCODE) { throw 'WMMA arithmetic probe compilation failed.' }
|
||||
$previousPython=$env:PYTHONPATH
|
||||
try {
|
||||
$env:PYTHONPATH="$(Join-Path $repo '.tools/python/vendor');$previousPython"
|
||||
& python.exe (Join-Path $repo 'tools/windows/wmma_f16_compare.py') `
|
||||
--probe (Join-Path $PackageRoot 'bin/d4r_native_replay_probe.exe') --module $module `
|
||||
--hip-root $HipRoot --output-dir $OutputDirectory
|
||||
if ($LASTEXITCODE) { throw "WMMA arithmetic diagnostic failed; logs: $OutputDirectory" }
|
||||
} finally { $env:PYTHONPATH=$previousPython }
|
||||
# A successful diagnostic is not acceptance of native FP16 accumulators for K.
|
||||
# Read baselineEquivalent/gameOptimizationAccepted in validation.json.
|
||||
Reference in new issue
Block a user