The build option was plumbed all the way to the compiler (the generated vcxproj carries R8FORGE_CELL_SIZE=17) but geometry.hh still said = 11, so every width built an 11 bit toolchain -- which is why the first matrix run printed identical tapes for all nine widths. My earlier '16 and 32 verified' claims were therefore measurements of 11 bit binaries: synth_test and full_add are bit level blocks whose tape does not depend on the width, so they never noticed. Now at -DR8FORGE_CELL_SIZE=17: asm/test.r8asm 108789 characters (64513 at 11), examples/calc.r8asm 112795 (62585), and one session prints '> 000046' -- D is 6 at 17 bits, which is exactly floor(17*log10 2)+1. tests/widths.ps1 now prints the flagship and calculator tape lengths, because that is the evidence that a width took effect; an unchanged 64513 means it did not.
52 lines
2.5 KiB
PowerShell
52 lines
2.5 KiB
PowerShell
# Build the toolchain at a set of cell widths and run what is meaningful there.
|
|
#
|
|
# powershell -File tests\widths.ps1 # 1,2,7,8,11,16,17,31,32
|
|
# powershell -File tests\widths.ps1 -Widths 8,11,32 # just these
|
|
#
|
|
# Per width: configure with -DR8FORGE_CELL_SIZE, build, run the `widthfree` ctest
|
|
# label (bit level slices, the synthesizer, the looping demo and the macro comment
|
|
# format -- all true at any width), then try one calculator session. The 11 bit
|
|
# baseline (byte_ops, examples, the flagship tape) only means anything at the
|
|
# default geometry, so it is not part of this script.
|
|
#
|
|
# Native commands report through $LASTEXITCODE, and their stderr must not be piped
|
|
# into the output stream: PowerShell turns that into an ErrorRecord.
|
|
param(
|
|
[int[]]$Widths = @(1, 2, 7, 8, 11, 16, 17, 31, 32),
|
|
[string]$CMake = "C:/Program Files/Microsoft Visual Studio/18/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/bin/cmake.exe"
|
|
)
|
|
$ErrorActionPreference = "Continue"
|
|
$root = Split-Path -Parent $PSScriptRoot
|
|
$ctest = Join-Path (Split-Path $CMake) "ctest.exe"
|
|
$failed = @()
|
|
|
|
foreach ($w in $Widths) {
|
|
$dir = Join-Path $root "build$w"
|
|
Write-Host "=== cell $w"
|
|
& $CMake -S $root -B $dir "-DR8FORGE_CELL_SIZE=$w" 2>$null | Out-Null
|
|
& $CMake --build $dir --config Release 2>$null | Out-Null
|
|
|
|
& $ctest --test-dir $dir -C Release -L widthfree 2>$null | Out-Null
|
|
if ($LASTEXITCODE -ne 0) { Write-Host " widthfree tests FAILED"; $failed += $w }
|
|
else { Write-Host " widthfree tests ok" }
|
|
|
|
# Tape lengths are the honest evidence that the width took effect: the
|
|
# flagship is full of %rep _CELL_SIZE, so it must grow with the width.
|
|
$r8 = Join-Path $dir "Release\r8forge.exe"
|
|
$flagship = (& $r8 "asm/test.r8asm" --quiet 2>$null | Out-String).Length
|
|
Write-Host (" flagship tape: $flagship chars (11 bit: 64513)")
|
|
|
|
$derive = Join-Path $dir "Release\r8forge_derive.exe"
|
|
$calc = (& $r8 "examples/calc.r8asm" --quiet 2>$null | Out-String).Length
|
|
$out = & $derive "examples/calc.r8asm" 0 -i "12 34 + ." 2>$null | Out-String
|
|
if ($LASTEXITCODE -eq 0) {
|
|
Write-Host (" calc: $calc chars" + $(if ($calc -gt 65536) { " (over the viz limit)" } else { "" }))
|
|
Write-Host (" calc run: " + ($out.Trim() -replace '\s+', ' '))
|
|
} else { Write-Host " calc: does not run at this width" }
|
|
|
|
Remove-Item -Recurse -Force $dir
|
|
}
|
|
|
|
if ($failed.Count -gt 0) { Write-Host ("FAILED at widths: " + ($failed -join ", ")); exit 1 }
|
|
Write-Host "all requested widths ok"
|