Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
5563786
cuda: integrate the Windows 5090 runtime prerequisites
ashhart Nov 10, 2026
22632e0
cuda: bind tuned attention to the shared row contract
ashhart Nov 10, 2026
1c07e9f
tools: preserve constrained Qwen XML string newlines
ashhart Nov 10, 2026
e61d817
windows: package the native server as tensorfold.exe
ashhart Nov 10, 2026
e86332d
cache: preserve Qwen retained state and admit concurrent cache runs
ashhart Nov 10, 2026
10d9e85
docs: disclose the Windows preview qualification and cache decode def…
ashhart Nov 10, 2026
e237e7c
cuda: spell the compact attention export names explicitly
ashhart Nov 10, 2026
68ec3b6
tests: keep preview contract help outside the shared usage block
ashhart Nov 10, 2026
64d54f9
tests: share Living Weights with the Qwen modelopt host checks
ashhart Nov 10, 2026
1adada1
windows: build and audit the 5090 preview from pinned inputs
ashhart Nov 10, 2026
f675fb4
lanes: exclude initialization samples from steady decode costs
ashhart Nov 10, 2026
6de1343
cuda: compose preview loading, draft and cache extensions with main
ashhart Nov 10, 2026
e2d85b8
tests: follow typed Qwen checkpoint ownership through load plans
ashhart Nov 10, 2026
765faf6
core: keep initialization pricing and preview checks with their owners
ashhart Nov 10, 2026
d9a3f36
tests: retain shared CUDA image declarations and trim repeated comments
ashhart Nov 10, 2026
e24cd8e
ci: preserve the scanner context through MSVC environment setup
ashhart Nov 11, 2026
44679e1
ci: resolve Windows compiler environment keys and expose safe build s…
ashhart Nov 11, 2026
3bf5b82
cuda: share unchanged FP8 and CTA tensor-transfer primitives
ashhart Nov 11, 2026
8694699
Report controlled package failure stages without exposing raw logs
ashhart Nov 11, 2026
d525733
Correct CI option fixtures and diagnose runtime path refusals early
ashhart Nov 11, 2026
26287c9
Inspect embedded runtime frames after bounded decompression
ashhart Nov 11, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
60 changes: 60 additions & 0 deletions .github/workflows/windows-5090-preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Windows 5090 preview
on:
push:
branches: ['windows/5090-runtime-base']
workflow_dispatch:
permissions:
contents: read
concurrency:
group: windows-5090-preview-${{ github.ref }}
cancel-in-progress: true
jobs:
preview:
runs-on: windows-2022
timeout-minutes: 150
env:
PYTHONDONTWRITEBYTECODE: '1'
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262
with:
persist-credentials: false
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065
with:
python-version: '3.14'
- uses: mlugg/setup-zig@d1434d08867e3ee9daa34448df10607b98908d29
with:
version: 0.17.0
use-cache: false
- name: Exercise preupload refusal controls without a GPU
run: python -m unittest discover -s tools/cuda/cublaslt_bridge -p "test_*.py" -v
- name: Build and audit the exact Windows preview
shell: pwsh
env:
TF_PREVIEW_CONTEXT_DIGESTS: ${{ secrets.WINDOWS_PREVIEW_PRIVATE_CONTEXT }}
run: |
$ErrorActionPreference = 'Stop'
$tfPreviewContext = $env:TF_PREVIEW_CONTEXT_DIGESTS
$vswhere = Join-Path ([Environment]::GetFolderPath('ProgramFilesX86')) 'Microsoft Visual Studio\Installer\vswhere.exe'
$installation = & $vswhere -latest -version '[17.0,18.0)' -products '*' -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath
if ($LASTEXITCODE -ne 0 -or @($installation).Count -ne 1) { throw 'MSVC installation lookup failed' }
$setup = Join-Path $installation 'Common7\Tools\VsDevCmd.bat'
$command = 'call "' + $setup + '" -no_logo -arch=x64 -host_arch=x64 >nul && set'
$lines = & $env:ComSpec /d /s /c $command
if ($LASTEXITCODE -ne 0) { throw 'MSVC environment initialization failed' }
foreach ($line in $lines) {
$split = $line.IndexOf('=')
if ($split -gt 0) { [Environment]::SetEnvironmentVariable($line.Substring(0, $split), $line.Substring($split + 1), 'Process') }
}
$env:TF_PREVIEW_CONTEXT_DIGESTS = $tfPreviewContext
python tools/cuda/cublaslt_bridge/build_preview.py --execute --work C:\tf-preview
if ($LASTEXITCODE -ne 0) { throw 'Windows preview build or artifact review failed; nothing was uploaded' }
- name: Recheck the precise publication bytes immediately before upload
run: python tools/cuda/cublaslt_bridge/build_preview.py --verify-publication C:\tf-preview\publish
- name: Upload the reviewed preview and build provenance
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02
with:
name: tensorfold-windows-5090-preview-${{ github.sha }}
path: C:\tf-preview\publish
if-no-files-found: error
compression-level: 0
retention-days: 14
3 changes: 3 additions & 0 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ fn poolChecks(b: *std.Build, target: std.Build.ResolvedTarget, test_step: *std.B

pub fn build(b: *std.Build) void {
@import("zig/build/fixed_cpu.zig").apply(b); // first: everything below compiles for the host it sets
const prefill_rows = @import("zig/build/qwen_prefill_config.zig").option(b);
defer @import("zig/build/qwen_prefill_config.zig").wire(b, prefill_rows);
// -Dgpu: one server for one GPU, nothing else (zig/build/product.zig)
if (@import("zig/build/product.zig").requested(b)) |gpu| {
@import("zig/build/product.zig").build(b, gpu);
Expand Down Expand Up @@ -95,6 +97,7 @@ pub fn build(b: *std.Build) void {
_ = ids_files.addCopyFile(b.path("zig/src/families/nemotron/draft_ids.txt"), "draft_ids.txt");
const draft_ids = b.createModule(.{ .root_source_file = ids_files.add("draft_ids.zig", "pub const text = @embedFile(\"draft_ids.txt\");\n") });
const test_step = b.step("test", "Unit tests (macOS includes available Metal device checks)");
@import("zig/build/qwen_prefill_config.zig").tests(b, test_step);
@import("zig/build/gguf_host.zig").steps(b, test_step);
@import("zig/build/glm_ocr.zig").hostTests(b, test_step);
@import("zig/build/dots_mocr.zig").hostTests(b, test_step);
Expand Down
31 changes: 24 additions & 7 deletions docs/WINDOWS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,23 @@
# TensorFold on Windows (native)

`tensorfold-native.exe` runs on Windows with an NVIDIA GPU through the same CUDA engine the Linux build uses, and with an
## Native serving executable and distribution

`zig build native` installs the Windows serving engine as `zig-out\native\bin\tensorfold.exe`.
A Windows distribution ZIP exposes it as `bin\tensorfold.exe`; keep the archive's `bin`, `lib` and notices together.
The separate `zig-out\bin\tensorfold.exe` is the checkpoint utility, so use the native path for serving.
The native binary retains `tensorfold-native VERSION` on `--version` for existing desktop clients.

```powershell
.\zig-out\native\bin\tensorfold.exe --version
.\zig-out\native\bin\tensorfold.exe --help
.\zig-out\native\bin\tensorfold.exe serve --help
.\zig-out\native\bin\tensorfold.exe capabilities --json
```

[Release packaging](../packaging/README.md#windows-x86_64) documents the Windows target, reviewed DLL overlay,
source/runtime manifests, checksums and CPU-only PowerShell smoke. Packaging does not qualify a GPU or checkpoint.

`tensorfold.exe` runs on Windows with an NVIDIA GPU through the same CUDA engine the Linux build uses, and with an
AMD GPU through the HIP backend when the build opts in (`-Dhip=true`). Metal is macOS's. Windows is supported from
source only.
The PR reports RTX 4090 (`x86_64-windows`, `sm_89`) and NVIDIA RTX Spark N1X (`aarch64-windows`, `sm_121`) runs.
Expand All @@ -23,7 +40,7 @@ zig build native install -Dsm=89 -Dstrip=true ^
```

`-Dsm` takes the GPU's compute capability without the dot, comma separated for several: 86 (RTX 30), 89 (RTX 40),
120 (RTX 50), 121 (GB10 / RTX Spark N1X). The server is `zig-out\native\bin\tensorfold-native.exe`;
120 (RTX 50), 121 (GB10 / RTX Spark N1X). The server is `zig-out\native\bin\tensorfold.exe`;
`zig-out\bin\tf-cuda-test.exe` runs the GPU suites (`tf-cuda-test info`, `smoke`, `glue`, `sample`, `quant-ref`,
`affine8`, `modelopt`, `exlr8`).

Expand Down Expand Up @@ -80,9 +97,9 @@ and MIOpen found.
## Run

```bat
tensorfold-native pull TensorFold/NVIDIA-Nemotron-3.5-Lightning-30B-A3B-MLX-4bit
tensorfold-native models
tensorfold-native serve <model path> --name local-model --parallel 1 --context 8192 --temperature 0 --no-thinking
tensorfold.exe pull TensorFold/NVIDIA-Nemotron-3.5-Lightning-30B-A3B-MLX-4bit
tensorfold.exe models
tensorfold.exe serve <model path> --name local-model --parallel 1 --context 8192 --temperature 0 --no-thinking
```

The server listens on `http://127.0.0.1:8080/v1`. Ctrl+C (or closing the console) stops it cleanly.
Expand All @@ -108,8 +125,8 @@ Nemotron 3.5 Lightning serves as on Linux. The Qwen3.5 hybrids have a CUDA engin
the same rounding points, so a window of up to 16 rows reproduces one-token steps bit for bit:

```bat
tensorfold-native serve <Qwen3.5-2B-MLX-4bit> --name qwen2b --context 32768
tensorfold-native serve <Qwen3.8-27B-MLX-4bit> --name qwen27b --context 8192 --parallel 4 ^
tensorfold.exe serve <Qwen3.5-2B-MLX-4bit> --name qwen2b --context 32768
tensorfold.exe serve <Qwen3.8-27B-MLX-4bit> --name qwen27b --context 8192 --parallel 4 ^
--drafter <Qwen3.8-27B-DFlash2>
```

Expand Down
5 changes: 4 additions & 1 deletion docs/optimization-ledger.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ last two hold the families with only a Metal, HIP or scoring backend.
| --- | --- | --- | --- | --- | --- |
| 1. Prompt tail | done [#2229] | yes | yes | open [#2432] | open [#2432] |
| 2. Paged KV | done C[#1750] M[#1294] | done [#1169] | done [#1163] | done [#1619] | done C[#935] M[#1537] |
| 3. Prompt store | done [#1357] | yes (host store) | done [#1732] | done [#1883] | yes C open M[#1850] |
| 3. Prompt store | done [#1357]; Windows preview pending [#2433] | yes (host store) | done [#1732] | done [#1883] | yes C open M[#1850] |
| 4. iGPU states | done [#2113] | done¹ | yes | done¹ | done¹ |
| 5. State walk | yes | yes | open [#2215] | yes | yes |
| 6. KV ledger | done [#2127] | done [#2127] | done [#2127] | done [#2127] | done [#2127] |
Expand Down Expand Up @@ -142,6 +142,9 @@ dory `dory` (C), mm3 `minimax_m3` (C, M), dsv41 `deepseek_v41` (its own CUDA bin
M), lfm2m `lfm2_moe` (M; C on [#1492]), lfm3 `lfm3` (X; C on [#1508]), qwen4 `qwen4` (C, M),
ling `ling` (host package only, no engine yet; CUDA plan in [#850]).

The q3.5 [Windows 5090 preview](receipts/windows-5090-preview/README.md) ports cache admission and the hybrid NVFP4 prompt path.
Its rebased head still needs GPU qualification, and historical highest-thinking warm coding decode is about 0.29% slower with cache on.

| Optimization | q27 | lfm2 | llama | step5 |
| --- | --- | --- | --- | --- |
| 1. Prompt tail | no (Metal) | no (n/a) | no (Metal) | no (Metal) |
Expand Down
69 changes: 69 additions & 0 deletions docs/receipts/windows-5090-preview/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# Windows 5090 preview evidence

This draft ports the previously tested Windows runtime onto current main and publishes the serving program as `tensorfold.exe`.
The new source build needs fresh GPU qualification before release or deployment.
Its CPU build checks do not transfer the historical executable's performance or fidelity results to the new head.

## Remaining performance issue

The historical E36 executable's counterbalanced single-stream run used cache-on, cache-off, cache-off, cache-on cohorts with paired workloads.
The highest-thinking coding repeat requests had a geometric mean cache-on/off decode ratio of **0.997091**, about **0.29% slower**, with five of six pairs below one.
Both order-pair medians were below one, at 0.995450 and 0.998206.
No regression allowance was accepted and this result did not authorize cache promotion.

The preview now excludes initialization-tagged first-round samples from the lone-stream timing estimator.
A synthetic production-loop regression reproduces a 50 ms switch sample replacing a retained 10 ms calibration; the fix retains that calibration while later 5 ms steady samples still update it.
The same tests retain the first 16-row trial, original timing events and complete greedy/sampled token streams.
This fixes an estimator defect; its effect on the historical 0.29% GPU deficit remains unverified until matched 5090 measurements can run.
The six pairs include observations from the same four cohorts, not six independent machines or runs.

`cache-decode-pairs.csv` retains all 72 numeric pair observations across medium/xhigh, prose/chat/code and first/repeat requests.
It excludes prompts, replies, device identifiers and process logs.
Recompute the twelve cells with:

```sh
python3 tools/release/compare_cache_decode.py docs/receipts/windows-5090-preview/cache-decode-pairs.csv
```

`historical-evidence.json` identifies the old executable and the scope of these observations.
The old binary is not redistributed here because its original compiler-to-source binding is incomplete.
The preview must use fresh source-built CUDA images and runtime libraries with their own input/output manifests.

## Reproducing the recorded configuration

The preview is compiled with `-Dqwen-prefill-max-rows=8192`.
That is a prompt chunk capacity, not a context-window setting or a new fidelity qualification.
Set `TF_QWEN_PREFILL_ROWS=4096` for the upstream arithmetic path, with the experimental settings below unset.
The alternate hybrid profile requires the complete tuple below; startup rejects partial combinations before device/model access.
The directory and library values are operator-provided inputs, not bundled weights or machine-specific paths.

| Setting | Recorded value |
| --- | --- |
| `TF_QWEN_NVFP4_MLP_DIR` | Alternate calibrated NVFP4/BF16 layer checkpoint directory |
| `TF_CUBLAS_BRIDGE` | Absolute path to the package's fresh `bin/tf_cublaslt_bridge.dll` |
| `TF_CUBLAS_PREFILL` | `1` |
| `TF_QWEN_NVFP4_PREFILL` | `1` |
| `TF_QWEN_NVFP4_TMA` | `1` |
| `TF_QWEN_NVFP4_SCOPE` | `layers` |
| `TF_CUDA_WARPS8` | `2` |
| `TF_QWEN_EXPAND_KV` | `1` |
| `TF_QWEN_PREFILL_ROWS` | `7680` |
| `TF_DRAFT_BLOCK` | `8` |
| `TF_DRAFT_GRAPH` | `1` |
| `TF_DRAFT_QWEN3_NORM` | `1` |
| `TF_DRAFT_FEEDBACK_WEIGHT` | `0.2` |

Use the dense affine4/group64 primary Qwen3.8-27B checkpoint and its DFlash2 drafter, retaining the package's `lib/tfgrammar.dll` for structured output and required tools.
Serve one stream with `bin/tensorfold.exe serve <primary> --name qwen27 --parallel 1 --drafter <drafter>` and choose `reasoning_effort` per request.
For a paired cache comparison, run the same executable/checkpoints/settings with `--prompt-cache-gib 0`, then an explicit nonzero budget, using identical prompts and alternating run order.
Do not enable the inactive FP8 attention/activation, alternate GDN, target-prefill graph or multi-lane proposal experiments through this profile.

## Validation still required

The historical candidate passed cache correctness, actual eight/sixteen-stream overlap and progress checks, cancellation, and medium/xhigh coding tool workflows.
Those results apply to that executable only.
The rebased preview still needs same-checkpoint token equality, independent fidelity for the hybrid weight path, cold prompt throughput and counterbalanced decode measurements on each advertised GPU/shape.
The active hybrid path keeps the primary affine embedding/head and selected vectors, while alternate NVFP4/BF16 projections supply the layers.
That checkpoint combination is not an arithmetic-equivalence claim against the primary affine checkpoint alone.
CUDA runtime contract execution, active 7,680-row prefill fidelity and the newly produced bridge's GPU behavior remain unrun.
The main inference server is deliberately left untouched while this draft is prepared.
Loading
Loading