Repository navigation
Conversation
|
Hi Ash, before I open anything: my fork has the same piece, the CUDA host loop around the block library ( |
|
Thank you @plotarmordev for asking before opening a competing change. This PR carries the CUDA tool only: A CUDA run with the real MiniMax H3 weights is still needed. We were unable to run it here because the weights are not available. Please run
|
baaa44e to
520e86a
Compare
…lock library The CUDA library runs MiniMax H3's blocks (tf_h3_forward / tf_h3_forward_host) and leaves the rest to its host. For a case file of the shape tf-h3-dit reads, tf-h3-dit-cuda (h3/cuda_loop.zig, zig/tests/h3_dit_cuda.zig) does that rest: - reads and checks the case with the Metal tool's geometry.read, and copies the block tables into the library's (blocks, lines, 6, hidden) float layout from the case's (6, lines, hidden) bf16; - each step: the text rows, then the first frame's, audio and video latent rows into the bf16 stream (Metal's h3_rows_in), every block through the library with the step's lines, the final modulated RMSNorm with the step's times (h3_final_norm, rounding where h3_mod rounds) and the output heads (h3_rows_out), all on the host; - the reference's Euler step of the video rows and of the audio rows not held, now one function (h3/euler.zig) that tf-h3-dit calls too, unchanged; - writes .first-video/.first-audio and .video/.audio float32 files as tf-h3-dit does (options dense, from=K, once; the Metal tool's GPU rescheduling is not offered). compile-h3-dit-cuda cross-compiles it for x86_64-linux-gnu without NVCC; tf-h3-dit-cuda builds it beside tf-h3 with -Dnvcc. test-h3-dit-cuda runs the loop over a synthetic 2-block case on the runtime fake, whose kernels do nothing: two steps equal a float64 reference of the same host arithmetic within one bf16 ulp (4.4e-5 relative seen), and one step equals one forward plus one Euler update exactly.
520e86a to
f5702fe
Compare
|
Rebased the branch onto current main (9fa8863). The h3_dit.zig conflict is resolved keeping for audio (shared euler module) together with main's timing print ().\n\nLocal checks all pass on the rebased commit: , , , , , (linux cross).\n\nThe rebased head is , pushed to branch , so the PR head can be fast-forwarded from there. |
Adds
tf-h3-dit-cuda, the CUDA counterpart of the Metaltf-h3-dittool for MiniMax H3 / FastH3. On CUDA the bf16 block library has only one forward entry, and the host was expected to do the rest. This tool is that host.From the same case file the Metal tool reads, it:
tf_h3_forward_hosteach step, with that step's AdaLN lines;The Euler step moves from
zig/tests/h3_dit.zigintozig/src/families/h3/euler.zigand is shared by both tools, so the Metal tool's arithmetic is unchanged.zig build compile-h3-dit-cudacross-compiles it for x86_64 Linux without NVCC.zig build test-h3-dit-cudaruns a synthetic 2-block case on the CUDA runtime fake against a float64 reference of the same steps. A single step equals one forward plus one Euler update exactly.No MiniMax H3 weights are included or were used. The CUDA numbers still need a GPU run once the weights can be used.
Checked on this head:
test-h3-dit-cudaandcompile-h3-dit-cudaon Linux,zig build check-release-paths,zig fmt --check, and the lean check (no new problems). On macOS, an existing h3 ownership test on main hangs in Zig's debug stack capture; that is tracked separately.