Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Benchmark: a HIP or Metal server's manifest names the receipt's backend
The gfx1151 run showed it: a HIP server's /v1/benchmark/manifest said
backend "hip", the engine's name, while a receipt and the board say "rocm".
The client refuses a manifest for another backend, so an attached rocm run
stayed unranked with unknown hardware, and the server probed no GPU, because
the rocminfo probe is keyed to "rocm". Metal's "metal" against "mlx" was the
same. The manifest now names the receipt's backend (hip -> rocm, metal -> mlx,
others unchanged) and probes the hardware for it, as a managed run does.
  • Loading branch information
ThinkOffApp committed Oct 18, 2026
commit 7c5b309965a2faad7097d60b495ac2e6afebd6c2
2 changes: 1 addition & 1 deletion docs/community-benchmarks.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ tensorfold serve example-org/public-checkpoint --name local-model
tensorfold benchmark example-org/public-checkpoint --server http://127.0.0.1:8080 --model-id local-model --backend mlx
```

Attached-server results do not claim the client's hardware is the server's hardware. The client reads `GET /v1/benchmark/manifest` from the server it attached to. A manifest that passes the receipt checks fills the version, hardware (GPU cores included), checkpoint hashes, revision and rank count (1 or 2). The server attests the revision a managed run records: the name of the Hugging Face cache snapshot it loaded. `TF_CHECKPOINT_REVISION` stands in only when the server's checkpoint directory is not a snapshot; when it names another commit than the loaded snapshot, the manifest attests no revision. Without that document, or if any field fails those checks, the receipt keeps unknown hardware and an unknown revision and remains unranked. An attached run records the backend, model and context you declare, unchecked against the server. The runner does not clear or restart an attached server's caches.
Attached-server results do not claim the client's hardware is the server's hardware. The client reads `GET /v1/benchmark/manifest` from the server it attached to. A manifest that passes the receipt checks fills the version, hardware (GPU cores included), checkpoint hashes, revision and rank count (1 or 2). The manifest names the backend as the receipt does (`rocm` for the HIP engine, `mlx` for Metal) and probes the hardware as a managed run of that backend would. The server attests the revision a managed run records: the name of the Hugging Face cache snapshot it loaded. `TF_CHECKPOINT_REVISION` stands in only when the server's checkpoint directory is not a snapshot; when it names another commit than the loaded snapshot, the manifest attests no revision. Without that document, or if any field fails those checks, the receipt keeps unknown hardware and an unknown revision and remains unranked. An attached run records the backend, model and context you declare, unchecked against the server. The runner does not clear or restart an attached server's caches.

The runner records failures, incomplete streams, missing usage, early EOS and cancellations. Exit code 0 means every measured attempt completed its requested output with a delivery interval; 1 means an error, and with `--publish` the receipt is still saved when the run finished; 2 means incomplete attempts remain in the saved receipt; 130 means the run was cancelled with Ctrl-C: an attempt in flight is kept in the receipt, and a cancel during server startup saves nothing. SIGTERM and SIGHUP exit 143 and 129 without a receipt. Errors never silently disappear from an average.

Expand Down
18 changes: 18 additions & 0 deletions zig/src/server/benchmark_facts_test.zig
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,24 @@ test "a server's manifest names the checkpoint a managed run records: the snapsh
}
}

test "a HIP or Metal server's manifest names the receipt's backend, so an attached rocm or mlx run reads it" {
var arena: std.heap.ArenaAllocator = .init(std.testing.allocator);
defer arena.deinit();
const a = arena.allocator();
var env: std.process.Environ.Map = .init(a);
for ([_][2][]const u8{ .{ "hip", "rocm" }, .{ "metal", "mlx" }, .{ "cuda", "cuda" } }) |pair| {
try std.testing.expectEqualStrings(pair[1], manifest.receiptBackend(pair[0]));
const doc = try manifest.serveDocument(a, std.testing.io, &env, "9.8.7", pair[0], "");
try std.testing.expectEqualStrings(pair[1], doc.get("runtime").?.get("backend").?.string);
const facts = (try manifest.parse(a, try json.stringify(a, doc, .{}), pair[1])).?;
try std.testing.expectEqualStrings(pair[1], facts.runtime.backend);
// the probe runs for the receipt's backend: on a rocm server it is rocminfo, as a managed rocm run reads it
const probe = host.detect(a, std.testing.io, &env, pair[1]);
try std.testing.expectEqual(probe.hardware.gpus.len, facts.hardware.gpus.len);
}
try std.testing.expectEqualStrings("", manifest.receiptBackend(""));
}

test "the attested revision: the loaded snapshot's; the environment's only where the directory names none; never a disagreeing one" {
var arena: std.heap.ArenaAllocator = .init(std.testing.allocator);
defer arena.deinit();
Expand Down
12 changes: 10 additions & 2 deletions zig/src/server/benchmark_manifest.zig
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,16 @@ pub fn attestedRevision(env: *const std.process.Environ.Map, model_dir: []const
return loaded;
}

/// The document a running server can attest. Hardware is this process's own probe.
pub fn serveDocument(a: Allocator, io: std.Io, env: *const std.process.Environ.Map, version: []const u8, backend: []const u8, model_dir: []const u8) !Value {
/// The receipt's name for an engine backend: the HIP engine's runs are ``rocm`` and Metal's ``mlx``, as the board names them.
pub fn receiptBackend(engine: []const u8) []const u8 {
if (std.mem.eql(u8, engine, "hip")) return "rocm";
if (std.mem.eql(u8, engine, "metal")) return "mlx";
return engine;
}

/// The document a running server can attest, under the receipt's backend name. Hardware is this process's own probe.
pub fn serveDocument(a: Allocator, io: std.Io, env: *const std.process.Environ.Map, version: []const u8, engine: []const u8, model_dir: []const u8) !Value {
const backend = receiptBackend(engine);
const probe = host.detect(a, io, env, backend);
const top = try json.newObject(a);
try top.put(a, "schema_version", try json.intValue(a, @as(u8, 1)));
Expand Down