Repository navigation
Conversation
The speech server holds /tmp/tensorfold-speech.lock shared while it synthesizes; the H3 tools (tf-h3-dit, tf-h3-image, the prompt encoder, the decoder and tf-h3-image-server) wait between blocks and stages while it is held, and every timed step prints timing_valid. (cherry picked from commit 980b5d5)
…rge render 72.9 s -> 9.4-9.8 s (cherry picked from commit f84c1dd)
…drain every committed buffer; the lock refuses planted paths The speech server's turn now ends with its output lane, when the engine's work ends, so a slow client no longer holds a render back. H3's forward and prompt passes keep committed command buffers in gpu_turn.Queue, which returns a failure only after every buffer committed with it has completed. The lock is opened without following symlinks and created only when absent, and speech waits at most a second behind an exclusive hold before it synthesizes without the turn.
…tall or redirect the speech turn; speech arriving as the last blocks drain goes before the output heads gpu_turn opens an existing lock or stamp nonblocking and without following links, and uses it only when it is one regular file with a single name: a FIFO no longer blocks speak() or yield(), and a hard link no longer receives the stamp's bytes. Speech only shares the lock, so a hold that also refuses a shared probe is not waited for. H3's forward yields once more after draining the last blocks, before the final norm and output heads are committed.
…sts in their own files
…eech stamping between the read and the probe no longer certifies it
…d buffer completes The yield after the output heads were waited deferred no GPU work; it only held a finished render for a whole speech request. Speech arriving then now only marks the step's timing invalid.
…o plan.hpp row_xor, wave_sum_dpp, kMaxGroup, kScoreKeys, kScoreSteps, cache_load, score_fetch, score_store and plan_score256_body move verbatim into an anonymous namespace of decode/plan.hpp, which now includes ops/common.hpp, so a second kernel source can run tf_plan_score256_*'s body. Only one comment changes, kScoreKeys' (kScoreKeysShort stays in plan.hip). Pure code motion: with ROCm 10.1's hipcc, the disassembled code objects of recurrence/gated_delta.hip, decode/decode.hip and decode/plan.hip, the sources that include plan.hpp, are identical before and after on gfx1030, gfx1100, gfx1151 and gfx1201. plan.hip falls from 599 to 486 lines. Refs #3811
…ys at d 256 decode/plan_rows.hip, a new code object group, adds two score kernels with tf_plan_score256_*'s arguments and grid, a block a plan row: - tf_plan_lone_score256_f16 and _bf16 score the rows of one-row slots with plan_score256_body, the one-row kernel's body, and its LDS (one row's queries), and leave for the other rows; - tf_plan_rows_score256_f16 and _bf16 score the multi-row slots' rows in chunks of two led from the slot's `first`: the chunk's first row's block reads the keys once, up to the further row's, and works each row's dots in the tree's operands and order, a key past a row's own scored -inf as the tree scores it; the other blocks leave, so a chunk never crosses a slot. Its LDS holds two rows' queries. One predicate (plan_shared_at) picks the rows of the chunks for both, so each row is scored by exactly one of them. planScore is planCausalAs's score step on its own. With `.shared`, at d = 256 on long spans with q fp32, it launches the two kernels on the same grid; elsewhere, and with `.one`, it launches today's kernel. planCausalAs passes `.one`, so no walk changes here. The contract runs the two launches as one operator, a replacement of tf_plan_score256_*, for both head groups (16 over 2, 24 over 4) and both cache kinds. Gate 3 requires the replaced kernel's bytes on 16 shapes a case: launches of 1 to 64 rows over slots of 3, 1, 4 and 2 rows one position apart (at the span's end, mid-span, across a block's first key, at the span's start) and over 5 and 7 one-row slots, spans of 16,384 to 262,144 keys, NaN and infinite keys that some rows of a chunk see and others do not, and NaN queries. Its controls go red at gate 3: chunks led over the whole launch (every slot's first 0, its count every row), and the chunks' launch alone. Gate 5's records are ROCm 10.1's hipcc on gfx1030, gfx1100, gfx1151 and gfx1201: tf_plan_lone_score256_* 108 VGPRs and 16 KiB of dynamic LDS, tf_plan_score256_*'s; and tf_plan_rows_score256_* 115 VGPRs and 32 KiB. Refs #3811
planCausalAs passes `.shared` to planScore when its launch holds more than one row. At d = 256 on long spans with q fp32, the Qwen checkpoints' served decode walk, a round's score step is then two launches: the one-row slots' rows at the one-row kernel's occupancy, and the multi-row slots' rows in chunks of two from one read of their keys. One-row launches keep a single tf_plan_score256_* launch; q in the cache's kind, d = 128 and spans under 16,384 keys keep their kernels; softmax, the values' walk and the tiles' sum are unchanged. The grid, the launch arguments and the replay key stay as they were. The whole score step against the tree on gfx1151 (medians of 15 alternated runs): one slot of 2 or 4 rows -14.0% to -18.5% (16 heads over 2) and -31.1% to -32.3% (24 over 4) at 131K and 262K keys; a 2-row slot with two 1-row slots -6.0% to -15.3%; 2 or 4 one-row slots +0.6% to +0.9%, the second launch's blocks leaving at once. A kernel test walks a round's slots one position apart through planCausal (slots of 3, 1, 2 and 4 rows; 1, 4 and 3; four of one row; and 2, 1, 1, 3, 1 and 4) with NaN and infinite keys and an infinite value, and requires the bits of each row walked alone in a one-row launch, in its scores and its rows. The pinned NaN digests of plan_pin.zig, whose d = 256 q fp32 case is a two-row launch, are unchanged. Refs #3811
plan_apply_body, tf_plan_apply_*'s body, moves verbatim into the anonymous namespace of decode/plan.hpp beside the d = 256 score's pieces, so a second kernel source can run it. Only that namespace's comment changes. Pure code motion: with ROCm 10.1's hipcc, the disassembled code objects and kernel notes of recurrence/gated_delta.hip, decode/decode.hip, decode/plan.hip and decode/plan_rows.hip, the sources that include plan.hpp, are identical before and after on gfx1030, gfx1100, gfx1151 and gfx1201. plan.hip falls from 486 to 421 lines. Refs #3811
…lues at d 256 decode/plan_rows.hip adds two values kernels with tf_plan_apply_*'s arguments and grid, a block a plan row: - tf_plan_lone_apply_f16 and _bf16 weigh the rows of one-row slots with plan_apply_body, the one-row kernel's body, and its LDS, and leave for the other rows; - tf_plan_rows_apply_f16 and _bf16 weigh the multi-row slots' rows in chunks of four led from the slot's `first`: the chunk's first row's block reads each value of its 128-key tile once, up to the furthest row's keys, a page at a time and eight ahead, and adds every row's and head's sum in key order with the tree's operands. A key past a row's own keys is left out of that row's sum, as the tree leaves it, not weighed 0, so a NaN or infinite value there cannot reach the row; a tile past a row's keys writes its zeros. The other blocks leave, so a chunk never crosses a slot. Its LDS holds four rows' weights of at most eight heads (16 KiB). The score's predicate (plan_shared_at) picks the chunks' rows for both, so each row is weighed by exactly one of them. planApply is planCausalAs's values step on its own. With `.shared`, at d = 256 on long spans with q fp32, where the score's blocks share, and with at most eight heads a block (the served groups are 8 for 16 heads over 2 and 6 for 24 over 4), it launches the two kernels on the same grid; elsewhere, and with `.one`, today's kernel. planCausalAs passes `.one`, so no walk changes here. The contract runs the two launches as one operator, a replacement of tf_plan_apply_*, for both head groups and both cache kinds, on fp32 scores and stats. Gate 3 requires the replaced kernel's bytes on 17 shapes a case: launches of 1 to 64 rows over slots of 3, 1, 4, 2 and 6 rows one position apart (at the span's end, mid-span, one past a tile's first key, at the span's start) and over 5 and 7 one-row slots, spans of 16,384 to 262,144 keys, NaN and infinite values at the key only a slot's last row weighs, at the key past all its rows and at scattered keys, and NaN and infinite scores. Gate 1 adds a NaN max; gate 4 weighs every key 1, 1/2 or 1/4 and sums integer values. Its controls go red at gate 3: chunks led over the whole launch (every slot's first 0, its count every row), and the chunks' launch alone. With the lab prototype's rule (every key of a chunk added, weighed 0 past a row's own) gates 1 and 3 go red on all four registrations. Gate 5's records are ROCm 10.1's hipcc on gfx1030, gfx1100, gfx1151 and gfx1201: tf_plan_lone_apply_* 42 VGPRs and 8 KiB of LDS, tf_plan_apply_*'s; and tf_plan_rows_apply_* 81 VGPRs and 16 KiB. Refs #3811
planCausalAs passes the score's `.shared` to planApply too when its launch holds more than one row. At d = 256 on long spans with q fp32, the Qwen checkpoints' served decode walk, a round's values step is then two launches: the one-row slots' rows at the one-row kernel's occupancy, and the multi-row slots' rows in chunks of four from one read of their values. One-row launches keep a single tf_plan_apply_* launch; q in the cache's kind, d = 128, spans under 16,384 keys and apply groups of more than eight heads keep their kernels; softmax and the tiles' sum are unchanged. The grid, the launch arguments and the replay key stay as they were. The whole values step against the tree on gfx1151 (medians of 15 alternated runs, three runs): one slot of 2 or 4 rows -22.0% to -30.4% (16 heads over 2) and -30.2% to -38.1% (24 over 4) at 131K and 262K keys; a 2-row slot with two 1-row slots -10.2% to -15.2%; 2 or 4 one-row slots +0.4% to +1.0%, the second launch's blocks leaving at once. The score and values steps together, one slot of 2 or 4 rows: -20.7% to -26.7% (16 over 2) and -31.8% to -37.1% (24 over 4). The kernel test of a round's slots in one walk adds a NaN value only a slot's last row weighs and an infinite one past all its rows, and slots of 6, 1 and 5 rows, and requires each row's bits walked alone, in its scores and its rows; with the lab prototype's weight-0 rule it fails at the first slots. Refs #3811
Owner
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CI for a landing train: #4650 #4754 stacked on main in that order. Nothing merges from this PR: each PR above lands on its own once this tip is green, and this PR is then closed.