Skip to content

cli: tensorfold device says what this machine runs, saved in ~/.tensorfold/device.json - #3107

Merged
ashhart merged 5 commits into
mainfrom
lead/device-profile
Nov 18, 2026
Merged

ashhart merged 5 commits into
mainfrom
lead/device-profile

Conversation

@ashhart

@ashhart ashhart commented Nov 13, 2026

Copy link
Copy Markdown
Owner

People often can't tell whether TensorFold will run on their machine before they try a model. This adds a device check.

  • tensorfold device [--json] [--rescan] scans the machine (OS, CPU, RAM, each GPU's memory and compute capability, or the Apple chip) and joins it with what this binary was built for: which backend runs here, or why none does; which checkpoint formats this device serves; how much memory model weights may take; and which models in the Hugging Face cache fit.
  • Bare tensorfold, tensorfold help and --help start with a two-line summary, for example This machine: Apple M3 Ultra, 256 GiB unified memory, macOS 27.2.1. Supported: Metal. These read only cheap OS sources (sysctl, /proc, /sys, DXGI or the registry); no GPU driver is opened. Only tensorfold device asks the CUDA driver, and it makes no context.
  • The profile is kept in ~/.tensorfold/device.json (%USERPROFILE% on Windows) with a schema number, scan time, binary version and a hardware fingerprint. It holds no serial number, host name, user name or path. It is scanned again only when the hardware or the binary changes, or with --rescan.
  • serve reads a current profile and stops before loading only for what the machine certainly can't run: a driver-reported compute capability this build's recorded kernels don't cover, an Intel Mac, or a family the device can't run (Llama before the M5, MiniMax-M3.1-Flash off a GB10). With no profile, a stale one, or a GPU known only by its name, serve behaves exactly as before. TENSORFOLD_DEVICE_CHECK=0 skips the check.
  • The format rules come from the code: sm_80 to sm_89 cards run NVFP4 and FP8 by decoding to BF16, the FP4 tensor-core paths need sm_12x, and Hopper (sm_90) and sm_100/103 have no kernels in this build. Until cuda: the release server refuses a GPU it has no kernels for, by name, at startup (#2904) #2914 lands, CUDA builds don't record their kernel list, so the report assumes the release set (sm_80, 86, 120, 121) and serve never refuses on compute-capability grounds; after cuda: the release server refuses a GPU it has no kernels for, by name, at startup (#2904) #2914 the recorded list is used. The two change different lines and merge cleanly.

Docs: docs/device.md, and one line in the README's quick start.

Tests: zig build test-device (27 tests; also in zig build test) covers recorded and built-to-format readings (macOS M3 Ultra and M5 Ultra, GB10 Linux, Intel Mac, RTX 3090, H100, WSL, Strix Halo, Windows adapters), the support table, the profile round trip and rescan rules, the summary text, and that the assumed SM list matches the release build's. Cross-compiles of tensorfold-native for x86_64-linux-gnu, aarch64-linux-gnu and x86_64-windows-gnu pass. zig fmt and the lean check are clean.

Device runs (fresh profile each, at this branch):

  • GB10: bare tensorfold gives This machine: NVIDIA GB10 (DGX Spark class), sm_121, 122 GiB unified memory, Ubuntu 24.04.5 LTS. Supported: CUDA (likely). tensorfold device confirms it from the driver (GPU 0 sm_121, unified memory), reports 109.5 GiB for weights, and saves a full scan; the next bare run drops "(likely)". The saved profile holds no host or user name.
  • Apple M5 Ultra: This machine: Apple M5 Ultra, 256 GiB unified memory, macOS 27.0.1. Supported: Metal., 177.2 GiB for weights, no Llama or Gemma 4 caveat (both run here). The saved profile holds no host or user name.
  • Windows with an RTX 5090: not yet run; the DXGI and registry readers have only been compiled.

Move CUDA family-info helpers and their existing tests to a focused module without changing their bodies. Keep the device command entry under Unreleased and preserve the current serve config parsing.
@ashhart
ashhart force-pushed the lead/device-profile branch from cd5df82 to 6fa0f24 Compare November 18, 2026 03:47
@ashhart
ashhart merged commit 027e269 into main Nov 18, 2026
2 of 11 checks passed
@ashhart
ashhart deleted the lead/device-profile branch November 18, 2026 03:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant