Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
881ccca
cuda: a process-wide cap on DeviceBuffer and pinned HostBuffer bytes
plotarmordev Oct 16, 2026
b00dd4e
drama: the temporal codebook tower
plotarmordev Oct 16, 2026
c8af505
drama: the speech codec, with codec.pth read without Python
plotarmordev Oct 16, 2026
e192c0f
engine_api: speech requests, speech info and a submit_speech hook
plotarmordev Oct 16, 2026
ab45904
native: Drama 3 (fish_omni) on CUDA
plotarmordev Oct 16, 2026
7553d00
server: POST /v1/audio/speech
plotarmordev Oct 16, 2026
8ba4307
tests: Drama 3 backbone and tower oracles, replays and stage traces
plotarmordev Oct 16, 2026
20249e9
drama: incremental codec decode, bit-identical to the whole decode
plotarmordev Oct 16, 2026
93fcaab
tests: Drama 3 codec oracle, replays and stage trace
plotarmordev Oct 16, 2026
d84284d
engine_api: audio events, so a speech engine can publish PCM while it…
plotarmordev Oct 16, 2026
71c31a9
build: Drama 3 backbone and tower kernels, the drama module, the nati…
plotarmordev Oct 16, 2026
588f1f1
server: stream: true on /v1/audio/speech sends raw PCM chunks as they…
plotarmordev Oct 16, 2026
d8c6a47
drama: the backbone's one-row GEMM stages its weights through shared …
plotarmordev Oct 16, 2026
10796d4
build: the Drama 3 codec kernels and the codec tool steps
plotarmordev Oct 16, 2026
8bc6814
tests: tf-drama-codec-stream-oracle, whole against chunked codec decodes
plotarmordev Oct 16, 2026
40c7c87
core: a direct read the file system refuses goes through the page cache
plotarmordev Oct 16, 2026
23a7fcc
cuda: Module.holds, whether a loaded image defines a device global
plotarmordev Oct 16, 2026
6f85731
drama: the Drama 3 text backbone on CUDA
plotarmordev Oct 16, 2026
05a715f
drama: one-row backbone GEMVs stream weights through a swizzled cp.as…
plotarmordev Oct 16, 2026
9dc8202
drama: add-norm fused with the routed experts' FP8 activation quantiz…
plotarmordev Oct 16, 2026
705541c
drama: one SwiGLU launch for the routed and shared experts
plotarmordev Oct 16, 2026
08291b5
drama: MoE combine on 8-wide vectors
plotarmordev Oct 16, 2026
641b18b
drama: decode attention keeps the next keys' loads in flight
plotarmordev Oct 16, 2026
01b7f3b
drama: the tower's one decode row attends as a thread-block cluster
plotarmordev Oct 16, 2026
b89dc67
drama: checkpoint weights stream onto the GPU with direct I/O in file…
plotarmordev Oct 16, 2026
0f9345e
speech: a Drama 3 reply that reaches max_frames returns its clipped a…
plotarmordev Oct 16, 2026
9b3934c
drama: one-row attention runs its Q/K norm and RoPE prologue in the s…
plotarmordev Oct 16, 2026
ea06b8b
drama: the tower samples with a stable radix sort
plotarmordev Oct 16, 2026
68aeb3e
drama: the codec builds its weights on its own thread while the backb…
plotarmordev Oct 16, 2026
fdee05c
Merge upstream main (6ee828c2) into feat/drama3-cuda
plotarmordev Oct 17, 2026
0f81a2b
Merge align/920-merge-main (upstream main 6ee828c2) into feat/drama3-…
plotarmordev Oct 17, 2026
15bceca
Merge align/921-merge-main (upstream main 6ee828c2) into fix/drama3-c…
plotarmordev Oct 17, 2026
64e8ff8
Merge align/922-merge-main (upstream main 6ee828c2) into perf/drama3-…
plotarmordev Oct 17, 2026
2d9232a
Merge align/923-merge-main (upstream main 6ee828c2) into perf/drama3-…
plotarmordev Oct 17, 2026
42c548c
Merge align/924-merge-main (upstream main 6ee828c2) into perf/drama3-…
plotarmordev Oct 17, 2026
b56fc8c
drama: below sm_90 the tower's decode row runs drama_attention, and i…
plotarmordev Oct 17, 2026
996637c
Merge align/924-merge-main into perf/drama3-load: the tower's sm_90 c…
plotarmordev Oct 17, 2026
65cd256
engine_api and native/cuda.zig back under 600 lines: speech and visio…
plotarmordev Oct 17, 2026
f5aa7a5
Merge align/920-merge-main into feat/drama3-streaming: speech and vis…
plotarmordev Oct 17, 2026
fd87532
Merge align/921-merge-main into fix/drama3-clipped-replies: speech an…
plotarmordev Oct 17, 2026
572afe3
Merge align/922-merge-main into perf/drama3-backbone-one-row: speech …
plotarmordev Oct 17, 2026
1ecf53b
Merge align/923-merge-main into perf/drama3-tower-decode: speech and …
plotarmordev Oct 17, 2026
bd11ba4
Merge align/924-merge-main into perf/drama3-load: speech and vision t…
plotarmordev Oct 17, 2026
118086a
core: lane tests ignore the speech audio event
plotarmordev Oct 17, 2026
4d41f5a
Merge align/921-merge-main into fix/drama3-clipped-replies: lane test…
plotarmordev Oct 17, 2026
2b27b19
Merge align/922-merge-main into perf/drama3-backbone-one-row: lane te…
plotarmordev Oct 17, 2026
e45d71b
Merge align/923-merge-main into perf/drama3-tower-decode: lane tests …
plotarmordev Oct 17, 2026
809e103
Merge align/924-merge-main into perf/drama3-load: lane tests ignore t…
plotarmordev Oct 17, 2026
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
drama: the codec builds its weights on its own thread while the backb…
…one loads

The codec's host-side weight image is CPU work that the backbone and tower reads leave room for; it now runs on
its own thread with the context current there, and the host joins it before it finishes opening.
  • Loading branch information
plotarmordev committed Oct 16, 2026
commit 68aeb3e51dd21ef7355426db646b4f7a84993c0a
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Each release's page on GitHub has its notes and measurements. See [the 1.0.0 rel

- speech: `stream: true` with `response_format: pcm` streams HTTP/1.1 chunks while Drama 3 generates; incremental codec decode bit-identical to the whole decode (oracle-gated)
- speech: a Drama 3 reply that reaches `max_frames` without an end of speech returns its clipped audio with HTTP 200, as the reference returns its capped replies, instead of a 500 without audio. A whole reply carries `X-Finish-Reason: stop` or `length`; a stream declares the trailer, and only a clipped stream ends with `X-Finish-Reason: length`, a normally finished one with the plain last chunk.
- Drama 3 loads in about 6 s instead of 53 s on a GB10: weights are read with direct I/O into staging pieces that never span two device allocations, and the codec initializes on its own thread while the backbone loads.

## 1.0.11

Expand Down
25 changes: 24 additions & 1 deletion zig/src/native/drama_host.zig
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,20 @@ fn words(err: anyerror) []const u8 {
};
}

/// codec.Model.init run on its own thread (it makes the context current there); `model` is set before the thread ends.
const CodecInit = struct {
gpa: Allocator,
io: std.Io,
ctx: *cuda.Context,
checkpoint_dir: []const u8,
kernel_dir: []const u8,
model: anyerror!drama.codec.Model = undefined,

fn run(c: *CodecInit) void {
c.model = drama.codec.Model.init(c.gpa, c.io, c.ctx, c.checkpoint_dir, c.kernel_dir, .{ .max_frames = max_frames });
}
};

/// Drama 3 at `checkpoint_dir` with kernels from `kernel_dir`, served on its own worker thread; `close` joins it.
pub fn open(gpa: Allocator, io: std.Io, checkpoint_dir: []const u8, kernel_dir: []const u8, options: Options) !api.Opened {
if (options.context < min_context or options.context > max_context) return error.BadDramaContext;
Expand Down Expand Up @@ -411,11 +425,20 @@ pub fn open(gpa: Allocator, io: std.Io, checkpoint_dir: []const u8, kernel_dir:
errdefer _ = cuda.setAllocationLimit(h.previous_allocation_limit) catch unreachable;

const held0 = cuda.usage(false).device;
// The codec builds its weight image on the CPU, on its own thread, while the backbone and tower load.
var codec: CodecInit = .{ .gpa = gpa, .io = io, .ctx = &h.ctx, .checkpoint_dir = checkpoint_dir, .kernel_dir = kernel_dir };
var codec_thread: ?std.Thread = try std.Thread.spawn(.{}, CodecInit.run, .{&codec});
errdefer if (codec_thread) |t| {
t.join();
if (codec.model) |*m| m.deinit() else |_| {}
};
h.backbone = try drama.backbone.Model.init(gpa, io, &h.ctx, checkpoint_dir, kernel_dir, .{ .context = options.context, .max_rows = chunk_rows });
errdefer h.backbone.deinit();
h.tower = try drama.tower.Model.init(gpa, io, &h.ctx, checkpoint_dir, kernel_dir, .{ .context = options.context, .max_rows = chunk_rows });
errdefer h.tower.deinit();
h.codec = try drama.codec.Model.init(gpa, io, &h.ctx, checkpoint_dir, kernel_dir, .{ .max_frames = max_frames });
codec_thread.?.join();
codec_thread = null;
h.codec = try codec.model;
errdefer h.codec.deinit();
const model_bytes = cuda.usage(false).device -| held0;

Expand Down
Loading