Skip to content

Instantly share code, notes, and snippets.

@jetnet
jetnet / sync_probe.cu
Created November 6, 2026 21:47
Throwaway (campaign bsync, 2026-11-04). Host wake overhead after a GPU kernel of D us, per CUDA
// Throwaway (campaign bsync, 2026-11-04). Host wake overhead after a GPU kernel of D us, per CUDA
// scheduling mode (process-wide, set before context creation) or our flag+WFET wait.
// usage: sync_probe <spin|yield|blocking|wfe> ; prints one JSON line per D.
#include <cuda/atomic>
#include <cuda_runtime.h>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cstdint>
@jetnet
jetnet / wfe_probe.cu
Last active November 6, 2026 21:45
Throwaway probe (campaign wfe-probe, 2026-11-04). Not part of any product. Revision 3 (review 1+2 fixes).
// Throwaway probe (campaign wfe-probe, 2026-11-04). Not part of any product. Revision 3 (review 1+2 fixes).
//
// Question: on GB10 (CPU and GPU cache-coherent over NVLink-C2C), does a GPU store to a host cache line
// wake a CPU core parked in ARM WFE/WFET on that line (LDXR exclusive monitor armed), the way a store
// from another CPU core does? If yes, an engine could wait for the GPU with LDXR+WFE (near-zero power)
// instead of a hot spin.
//
// Method: ping-pong over flags on separate 4 KiB pages. The waiter (main thread, pinned to X925 cpu15)
// stores ping=i, then waits until pong>=i. The responder (one GPU thread; positive control: a CPU thread
// on cpu16) waits for ping>=i, busy-delays D_i = D + jitter(i) (jitter uniform 0..127 us from a hash of
@jetnet
jetnet / wfe-wait-howto.md
Last active November 4, 2026 17:00
Stop spinning: wait for the GPU with WFE on DGX Spark (GB10)

Stop spinning: wait for the GPU with WFE on DGX Spark (GB10)

Most inference engines keep 1–3 CPU threads at 100% while serving. Those threads mostly wait: for a GPU kernel, a doorbell or the next step. They wait by polling a flag in a tight loop (spin-wait), because sleeping in the kernel costs tens of microseconds per wake-up.

On GB10 there is a cheaper way to wait. CPU and GPU are cache-coherent over NVLink-C2C, and on the tested configuration a core parked in the ARM WFE/WFET instruction, with the exclusive monitor armed on the flag's cache line, was woken by the GPU's store to that line with near-spin latency at much lower power. That GPU-triggered wake-up is a measured property of this platform, not an architectural guarantee: validate it on

@jetnet
jetnet / roce_proxy-wfe.patch
Last active November 4, 2026 16:11
WFE patch (2026-11-04): instead of a hot spin on the doorbell - GB10, driver 580.178.04, TensorFold v0.6.0
--- roce_proxy.orig.c 2026-11-04 13:34:29.768088494 +0100
+++ roce_proxy.c 2026-11-04 13:39:42.444122678 +0100
@@ -42,6 +42,12 @@
#include <stdlib.h>
#include <string.h>
#include <time.h>
+#if defined(__aarch64__)
+#include <sys/auxv.h>
+#ifndef HWCAP2_WFXT
+#define HWCAP2_WFXT (1UL << 31)
@jetnet
jetnet / Prioritizing Compute on the GB10.md
Created October 5, 2026 19:58
Prioritizing Compute on the GB10

Deployable solution

A single priority header is not enough for your workload. You need two layers:

  1. Request-level QoS inside vLLM for realtime, normal-agent, and batch LLM requests.
  2. GPU-level admission control outside vLLM that pauses or stops Immich, OCR, and TTS containers before LiteLLM forwards a realtime request.

That gives you:

@jetnet
jetnet / system-prompt-general.txt
Created September 13, 2026 22:02
tool eval bench custom system prompt (general)
Your behaviour is measured against strict contracts. The user's instructions, the tool schemas, and any output format you are given are binding: satisfy them exactly rather than approximately. The rules below take precedence over any general habit of being maximally helpful.
USING TOOLS
1. Use a tool only when the task needs data or an action you cannot supply yourself. When you can determine the answer yourself — simple arithmetic, comparisons, unit identities, or reasoning over information already present in the conversation — answer directly. Never call a tool to double-check, confirm, or reassure yourself about work you have already done, and do not go looking for data that the required output cannot contain or that only the user can provide.
2. Never call a tool with a missing, empty, placeholder, or invented argument. If a value a tool requires was genuinely not provided, stop and ask for it. A value the user already stated in their own words is not missing: reuse it exactly as they gave it.
3. Advance
@jetnet
jetnet / veloGB10 - FP8 performance analysis.md
Created September 6, 2026 17:48
veloGB10 - FP8 performance analysis

Verdict

veloGB10 currently treats Qwen FP8 mainly as a compressed storage format, not as native FP8 arithmetic.

For Qwen/Qwen3.8-27B-FP8:

  • Weights remain packed as E4M3.
  • Decode/verify converts FP8 weights to BF16 in registers and executes BF16 MMA.
  • Prefill materializes each weight as BF16 and calls BF16 cuBLAS.
@jetnet
jetnet / horizontal-tetris-qlm-5.3-flash-nvfp4-max-LibertAIDAI.html
Created August 27, 2026 20:12
GLM-5.3 Flash - a self-contained sideways Tetris
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>HORIZON TETRIS</title>
<style>
:root{
--bg0:#070b14; --bg1:#0d1322;
--panel:rgba(255,255,255,.045);
@jetnet
jetnet / HOWTO.md
Created August 18, 2026 21:09
Pi agent extension - prune old images from the context

Issue

  • Your LLM is configured to process no more than N images from the context
  • Your agent does not care and simply sends the whole context with all previous images to LLM
  • LLM cannot process such requests, e.g.:
{
  "error": {
 "message": "At most 4 image(s) may be provided in one prompt. (parameter=image)",
@jetnet
jetnet / horizontal-tetris-qwen-3.8-nvfp4-xhigh.html
Created August 16, 2026 11:51
Horizontal Double Tetris - Qwen 3.8 NVFP4 (xhigh)
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>MIDLINE — horizontal tetris</title>
<style>
:root {
--bg: #05070f;
--panel: rgba(255, 255, 255, 0.045);