ashhart 6ae7ef88b7 EXLR8: record each Metal launch's M1 and M2 thread limits
The kernel contract's limits check needs every non-adapting Metal launch
to carry the thread count an M1 and an M2 pipeline take, so the EXLR8
launches failed it with "no compiled thread limit recorded". These are
the limits Xcode's metal-tt compiled for both families
(tf-kernel-contract --offline on an M5): the same value on M1 and M2,
and 448 threads or more for every 256-thread launch.

Three launches needed more than a number:
- tf_exlr8_project_16: a plain M1/M2 build matched no thread count, so
  the kernel now reserves its 256 threads with
  max_total_threads_per_threadgroup(256), and the record says so.
  The arithmetic is unchanged; only the register budget is fixed.
- tf_exlr8_prompt and tf_exlr8_dense_prompt use the tensor units, which
  Xcode cannot build for M1/M2 ahead of time; they are marked
  offline = false like the other tensor-unit kernels.

The split kernels already size their groups to the pipeline (adapts).
A new test checks that every record fits M1 and M2 one of these ways.
2026-12-06 12:29:14 +00:00
2026-12-06 10:26:32 +00:00
2026-12-04 23:56:13 +00:00
2026-12-04 23:56:13 +00:00
2026-09-30 22:18:42 +01:00
2026-09-30 22:18:42 +01:00
2026-12-04 23:56:13 +00:00
2026-12-04 23:56:13 +00:00

Help Support TensorFold · @tensorfold_dev on X

TensorFold logo

TensorFold

TensorFold serves language models from a Zig binary on Apple Silicon and NVIDIA GPUs. The engine reads checkpoints, tokenizes requests and runs Metal or CUDA kernels directly. Serving needs no Python or MLX installation.

Building with a coding agent? Have it load the contributor skill and follow CONTRIBUTING.md.

Quick start

Each platform block is one invocation. It installs TensorFold, chooses a catalog model that fits the machine, downloads its pinned checkpoint after confirmation, serves it and sends one test prompt. Model weights have their own licenses. --check prints one reply and stops the server. To serve until Ctrl-C instead, use the same block without --check and set a nonempty TENSORFOLD_API_KEY; send that value as the bearer credential.

Mac with Apple Silicon

brew install ashhart/tensorfold/tensorfold && tensorfold start --check

Linux with an NVIDIA GPU

Needs glibc 2.28 or newer and NVIDIA driver R580 or newer (CUDA 13.0). The run guide lists the archive's requirements.

sh -c 'set -e
V=1.3.10
case "$(uname -m)" in
  aarch64|arm64) PLATFORM=linux-aarch64 ;;
  x86_64) PLATFORM=linux-x86_64 ;;
  *) echo "No release archive for this CPU" >&2; exit 1 ;;
esac
curl -fLO "https://github.com/ashhart/TensorFold/releases/download/v$V/tensorfold-$V-$PLATFORM.tar.gz"
curl -fLO "https://github.com/ashhart/TensorFold/releases/download/v$V/tensorfold-$V-$PLATFORM.tar.gz.sha256"
sha256sum -c "tensorfold-$V-$PLATFORM.tar.gz.sha256"
tar -xzf "tensorfold-$V-$PLATFORM.tar.gz"
"$PWD/tensorfold-$V-$PLATFORM/bin/tensorfold-native" start --check'

Windows with an NVIDIA GPU

From the x64 Native Tools Command Prompt with Zig 0.17.0 and CUDA 13.0 installed, pick -Dsm for the GPU as the Windows guide explains, then run this one cmd.exe invocation:

zig build native install -Dsm=89 -Dstrip=true ^
  -Dnvcc="%CUDA_PATH%\bin\nvcc.exe" && zig-out\native\bin\tensorfold-native.exe start --check

Send a request

With the persistent server running, replace <served-name> with its name from /v1/models and run this from a POSIX shell:

curl -fsS http://127.0.0.1:8080/v1/chat/completions \
  -H 'Content-Type: application/json' \
  -H "Authorization: Bearer $TENSORFOLD_API_KEY" \
  -d '{"model":"<served-name>","messages":[{"role":"user","content":"Say hello in one sentence."}],"max_tokens":128,"temperature":0}'

The API also serves completions, Responses and Anthropic Messages. /v1/models lists the served name.

To talk to a model in the terminal in one command, tensorfold chat MODEL starts the server itself, streams each reply and stops the server when the chat ends; /help lists the chat's commands, and /bye or Ctrl-D ends it:

tensorfold chat mlx-community/Qwen3.5-2B-MLX-4bit

With the server above still running, tensorfold chat --url http://127.0.0.1:8080 chats with it instead, and echo "Say hello." | tensorfold chat --url http://127.0.0.1:8080 prints one reply for a script. See the chat command for its flags and the serve flags it passes on.

Docs

Contributors

Thank you to everyone who has sent TensorFold a pull request, a measurement or a bug report:

@0mao0, @321sssrt-bit, @AbrahamCete, @aditya1503, @AdrianBinDC, @ajensenwaud, @akol1, @alenperic, @Alexbob0, @alexderz, @anvilsong, @Arminova, @b-ostrov, @BadAd84, @barelyworkingcode, @Benjamin-Wegener, @benthecarman, @benwilson, @BHCC2025, @Bizuayeu, @BlivionIaG, @BobClawblaw, @borodach23, @Boscoeuk, @boxabirds, @brandonmmusic-max, @bunnyfu, @CanadaApollo6, @CerebralCoding, @cesarswong, @chadhurley25075-png, @chaog992, @Charlie-Louis, @Chedrian07, @chris247474, @christrade215, @crescit, @cshintov, @cwschroeder, @DakotaTexas, @danyo1399, @Deesha08, @Defilan, @DevRico003, @di37, @diwakergupta, @drowzeys, @easthambuilds, @ecohash-co, @edurdias, @eleqtrizit, @ericlsimplifi, @EugeneClaw, @fche, @feni6, @florianbrede-ayet, @gbgbgbg, @GDACONSULT, @gecobattya, @gilby, @Gogo6969, @gprot42, @GraithSecurity, @grantoverton, @grearjake-star, @greatyingzi, @GustavBlack, @harrisonfriia, @haxudev, @heitke, @hichaiuse, @ivanfioravanti, @jasontitus, @javierbits, @jayleaton, @jeffpeng3, @jeidbugs404, @Jenpo, @jerryfane, @jetnet, @jishnuvenugopal, @jkuepker, @joeynyc, @johnymoo, @JordiPosthumus, @joshuaswarren, @JRaxworthy, @jrb-ai, @jschmied, @juliankang4, @justincasey, @kelchm, @kieranscotney, @kingjamez, @kky42, @laudney, @lcgutierrez, @LECYWZA, @lijian1999, @liumorrisclaw, @LXD-8, @m-naoki-m, @mapamalu, @mcclanahanaman, @MESevenJourney, @mgoldwasser, @MiaAI-Lab, @mikolaj92, @millaguie, @Mirrdhyn, @Moutonc, @MovieMaker93, @mrpmorris, @mrv777, @MV10, @NeoAiLabs, @Nipale-ai, @nmcbride, @nood-co1, @nullburn, @olexale, @omar16100, @optimisme, @otarkhan, @outcastofmusic, @paragontasx, @peacockesq, @philip-pentatonic, @plotarmordev, @pmeenan, @ppardus, @pulseandthread, @quigles1977, @rafafortes, @raymondkpwong, @robertpitt, @rootsbymenda, @RoscoeTT, @RS91Dev, @russellmm, @salmanarshad321, @samwang0041-star, @sanjaibalajee, @satindergrewal, @scottleimroth, @sethforprivacy, @sfxnz, @shantanugoel, @simon-lin88, @simonmd, @spenchey, @squarrier, @ss-cong, @Stephane-Eden, @styles01, @SvangenStudios, @swbiggart, @SxMShaDoW, @sxuff, @taussoe, @tfolkman, @ThinkOffApp, @ThomasHalwax, @Thotheris, @tinyapps, @tolewis, @tomByrer, @tonydehnke, @tournierjc, @tovereast, @tpischke, @urtho, @valacroix, @vcruz305, @vinicius-symetrix, @wojo, @xjqx2z, @yguanrong, @Yuepixel, @YvesLaRose, @ZackSample, @zweck.

docs/credits.md names whose Python engine work each part of the native engine carries.

S
Description
GitHub Trending: ashhart/TensorFold
Readme Apache-2.0
1.8 GiB
Languages
Zig 71.9%
TypeScript 13.6%
Metal 4.6%
Python 4.6%
Cuda 3.2%
Other 1.8%