Skip to content

[Model] Cosmos3: skip text-length synchronization on full cache hits - #5669

Open
EchoHayate wants to merge 3 commits into
vllm-project:mainfrom
EchoHayate:perf/cosmos3-cache-hit-text-length
Open

EchoHayate wants to merge 3 commits into
vllm-project:mainfrom
EchoHayate:perf/cosmos3-cache-hit-text-length

Conversation

@EchoHayate

@EchoHayate EchoHayate commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor

Purpose

Avoid redundant text-length reductions and two Python scalar reads on Cosmos3
full text-cache hits. The optimization now lives in _gen_preprocess(), the
shared preprocessing used by normal forward and the SeaCache extractor after
the upstream refactor.

Fix and boundaries

Run the existing identical-text-length validation inside
if need_kv or self.cached_freqs_gen is None, before RoPE reconstruction:

  • A K/V miss still validates the mask and computes the real-text trim length.
  • K/V present but frequencies absent also validates. The session adapter can
    restore this state, and RoPE reconstruction consumes the current mask.
  • A full hit, with both K/V and frequencies present, skips this validation
    and its two .item() reads.
  • K/V trimming, cache ownership, branch keys, reset and offload behavior are
    unchanged. This is not a new cache-identity or invalidation mechanism.

This corrects the previous description's claim that frequency-only restoration
should skip validation. Preserving that behavior would silently accept
nonuniform text lengths where the base implementation raised ValueError.
The new tests cover that error through both entry paths, actual session-adapter
restoration, and unchanged K/V identity.

The scope is the existing Cosmos3 text-cache contract, not all synchronization
in preprocessing, full SeaCache skip-policy qualification, new modality support,
or distributed execution qualification.

October 12 refresh and validation

Base: 198c2105930bd1bac0b0966ffd0997cdd84d4790

Head: 25e0b25c545d06ce8ed228b395a79f40cd059f37

The merge preserves both parents' existing test functions, including upstream
GEN residual/sequence-parallel tests. Only the transformer and its test file
differ from the pinned main.

Focused regressions plus the entire session-adapter test file:

PYTHONDONTWRITEBYTECODE=1 HF_HUB_OFFLINE=1 python -m pytest \
  -p no:cacheprovider -o 'addopts=--strict-markers --strict-config' \
  tests/diffusion/models/cosmos3/test_cosmos3_transformer.py \
  tests/diffusion/models/cosmos3/test_session_memory_equivalence.py \
  -k 'text_cache or text_length or forward_returns_video_prediction or test_session_memory_equivalence' \
  -q --disable-warnings

Result: 29 passed, 106 deselected, 17 warnings, no skips.
The new tests use deterministic synthetic one-layer UND/GEN weights and the
existing SDPA PyTorch implementation on CPU, with real preprocessing, RoPE,
extractor block/postprocessing closures and session restoration. These are not
checkpoint, GPU synchronization, or quality measurements.

The pre-fix reconstruction guard produced 4 failed / 8 passed in the new
cases: two missing ValueErrors and two missing pre-RoPE validation-read pairs.
Earlier attention/linear fixture setup failures were not counted as regression
RED.

Running the same command without -k on both complete source trees gives:

Tree Passed Failed Skipped
Pristine pinned main 106 14 1
This head 120 14 1

The failure identifiers match exactly. All 14 fail during
UnspecifiedOmniPlatform.get_diffusion_attn_backend_cls construction, before
the changed preprocessing. The identical skip needs an accelerator. This is
a baseline comparison, not a passing full-suite result.

Changed-file pre-commit passes applicable checks except mypy-3.10, which
reports missing annotations for full_refs and full_pointers in the unchanged
upstream SP test. Running mypy 1.11.1 against the pristine pinned-main test file
reproduces exactly those two diagnostics. No suppressions or unrelated fixes
were added. The repository wrapper excludes production model trees from mypy;
this is not production-model type-check evidence. The scoped diff passes
git diff 198c2105930bd1bac0b0966ffd0997cdd84d4790 HEAD --check.

Local environment: macOS CPU, Python 3.12, PyTorch 2.11.0, vLLM 0.31.0 source
overlay, transformers 5.14.1, diffusers 0.39.0, cache-dit 1.5.0 and pytest 9.1.1.
Pinned main requires diffusers 0.40.0; no dependencies were installed for this
refresh. These are scoped CPU results, not fully provisioned current-main CI.

Historical A100 E2E A/B — not this head

The following real-checkpoint evidence belongs to historical head bea9437d
on base 94b1546c. It predates the shared-preprocessing integration and the
frequency-only guard correction, and is not a measurement of 25e0b25c.

Environment:

  • commit-pinned Buildkite image
    public.ecr.aws/q9t5s3a7/vllm-ci-test-repo:94b1546c...
  • vLLM 0.28.0, PyTorch 2.13.0+cu130, CUDA 13.0
  • NVIDIA A100 80GB PCIe
  • nvidia/Cosmos3-Nano revision 411f42a8...

Fixed workload:

  • prompt: A red cube on a white table, studio lighting.
  • negative prompt: blurry, distorted
  • 256x256 T2I, 10 denoise steps, guidance scale 7.0, seed 42
  • eager mode, guardrails disabled
  • one warmup plus seven measured requests per process
  • process order: base -> head -> head -> base
Run Median E2E latency
base-r1 801.51 ms
head-r1 767.49 ms
head-r2 788.72 ms
base-r2 807.70 ms
combined base (14 samples) 804.42 ms
combined head (14 samples) 770.50 ms

The historical combined median moved by -33.92 ms (-4.22%). Both
process-level comparisons favored the patch (-4.24% and -2.35%). All four
generated output PNGs were bitwise identical, and reported peak GPU memory
was identical at 32,302 MiB.

This remains directional evidence from two process-level rounds on one A100,
not a stable throughput claim. A current-head A100 rerun and official hardware
CI are still outstanding; no new E2E speedup or quality claim is made here.

AI assistance

Codex/TraeCode assisted with upstream inspection, conflict resolution,
regression tests, diff review, baseline comparisons and this write-up.
The evidence above distinguishes executed CPU checks from historical hardware
results and validation still outstanding.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

@hsliuustc0106 hsliuustc0106 added diffusion codes related to diffusion models Kernel optimization Codes related to optimize kernel execution to improve hardware utilization labels Aug 2, 2026
@EchoHayate

Copy link
Copy Markdown
Contributor Author

Updated validation with the actual dependency and a real Cosmos3-Nano run.

  • cache-dit==1.3.0; committed transformer module now collects and passes: 33 passed, 18 warnings
  • downloaded and integrity-checked nvidia/Cosmos3-Nano revision 411f42a8... (32.6 GiB)
  • ran identical base/head 256x256, 2-step CFG T2I; step 1 builds cond/uncond UND K/V and step 2 exercises both cache-hit paths
  • base/head PNGs are bitwise identical and non-degenerate
  • reported peak GPU memory is identical at 32,742 MiB
  • single-pair latency delta is documented as directional only, not a stable throughput claim

The PR description now replaces the stale “cache_dit is not installed” limitation with the full environment and real-model evidence.

@EchoHayate
EchoHayate force-pushed the perf/cosmos3-cache-hit-text-length branch from 230da28 to 2970d4e Compare August 27, 2026 05:56
@EchoHayate
EchoHayate requested a review from NickCao as a code owner August 27, 2026 05:56
Signed-off-by: Allen Wu <allenwu2795@gmail.com>
Co-authored-by: TRAE CLI <traecli@bytedance.com>
@EchoHayate
EchoHayate force-pushed the perf/cosmos3-cache-hit-text-length branch from 2970d4e to bea9437 Compare August 27, 2026 09:08
@EchoHayate

Copy link
Copy Markdown
Contributor Author

Refreshed on the vLLM 0.28 mainline and completed a fresh real-checkpoint A100 A/B.

  • tested base main@94b1546c; head bea9437d
  • vLLM 0.28.0 / PyTorch 2.13.0+cu130 / A100 80GB PCIe
  • nvidia/Cosmos3-Nano@411f42a8..., fixed 256x256 T2I, 10 steps, seed 42
  • B→H→H→B, each process 1 warmup + 7 measured requests
  • combined median: 804.42 ms → 770.50 ms (-4.22%); per-process comparisons were -4.24% and -2.35%
  • all four PNGs are bitwise identical; peak memory is identical at 32,302 MiB
  • v0.28 local Cosmos3 set: 29 passed, 1 skipped, 4 platform-only constructor tests deselected
  • DCO, pre-commit, Python 3.11/3.12 build, and docs are green

I am treating the E2E latency result as directional rather than a stable throughput claim because this is two process-level rounds on one GPU. The PR body now contains the full workload and evidence boundary. main advanced afterward only via MiniCPM-o DuplexEval files, with no Cosmos3/diffusion runtime changes.

@MaciejBalaNV @linzhenpl07 PTAL when convenient.

@vllm-omni-review-bot

Copy link
Copy Markdown

Omni ReviewBot: no human activity for 12 days

@EchoHayate this pull request has had no human commit, comment or review since 2026-08-27. Per repository policy it may be closed if it stays inactive.

To keep it moving, any one of these is enough: push an update, reply to the open blocker, or post the current plan and timeline.

Signed-off-by: Allen Wu <allenwu2795@gmail.com>
Co-authored-by: TRAE CLI <traecli@bytedance.com>
@EchoHayate

Copy link
Copy Markdown
Contributor Author

Author self-review

  • Scope/invariants checked: the production diff only moves the existing
    identical-text-length validation into the need_kv branch. Cache misses
    still validate and compute the trim length; cache hits preserve existing
    K/V and frequency ownership while avoiding the two Python scalar reads.
  • Current-main compatibility: refreshed through
    main@f67cc52f7449d5f5dbb9d7790c7a049fa6aa2ba1; recent Cosmos3 Ulysses and
    model changes did not replace the synchronization or conflict with the
    patch.
  • Tests and static checks: the two focused regressions pass. The locally
    runnable Cosmos3 transformer set is 33 passed, 1 skipped, 4 deselected;
    the four deselected constructors require a concrete platform attention
    backend on this macOS host. Changed-file pre-commit, compileall, and
    git diff origin/main...HEAD --check pass.
  • Runtime evidence: the A100 Cosmos3-Nano E2E result in the PR body belongs to
    the identical patch at historical head bea9437d, not this refreshed head.
    A current-head A100 rerun remains pending GPU access.
  • Evidence and claim boundaries: current-head evidence proves the branch
    still removes two scalar D2H reads on cache hits and preserves cache-miss
    validation. The historical -4.22% E2E result remains directional and is
    not claimed as a fresh or stable throughput result.
  • AI assistance: Codex assisted with current-main inspection, branch refresh,
    validation, and drafting this update. I reviewed the complete two-file diff
    and take responsibility for the code and claims.

Current head reviewed: 40815a48a6bc0ff6b525578c570888bac4805bea.

@MaciejBalaNV @linzhenpl07 PTAL when convenient. A current-head A100 rerun can
follow once the GPU environment is available.

@vllm-omni-review-bot

Copy link
Copy Markdown

Omni ReviewBot: no human activity for 14 days

@EchoHayate this pull request has had no human commit, comment or review since 2026-09-09. Please consider marking this PR as draft until work can resume. The author or a maintainer decides whether to change the PR state.

To keep it moving, any one of these is enough: push an update, reply to the open blocker, or post the current plan and timeline.

@EchoHayate

Copy link
Copy Markdown
Contributor Author

September 30 lifecycle follow-up

I intend to continue this optimization, with its integration point updated
for current main.

The read-only audit of main 4af28f33bd9c07e7e4fc862ac6ccb72834512995
found that #6922 moved the affected logic into _gen_preprocess().
Both text-length scalar reads remain unconditional there, while the trim
length is consumed only when K/V is constructed. The refactor therefore did
not remove this gap.

Current PR head: 40815a48a6bc0ff6b525578c570888bac4805bea.

The next bounded step is to adapt and revalidate the guard in shared
preprocessing, preserving cache-miss validation and frequency-only
reconstruction, and checking normal and SeaCache entry paths.

No new tests, benchmarks, or CI runs were performed. The previous A100 result
predates this integration change and is not evidence of current-main
performance or merge readiness.

@vllm-omni-review-bot

Copy link
Copy Markdown
Omni ReviewBot routing record

Assigned Strict on zcode (GLM-5.3-Flash) under experiment fleet-strict-cursor-grok46-zcode-glm53flash-5050-c5-z10-20261002.

@vllm-omni-review-bot vllm-omni-review-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Omni ReviewBot review

3 actionable finding(s).

CI at 40815a48a6bc (2026-10-09T08:47:42.736076+00:00): required check(s) blocking: buildkite/vllm-omni (missing).

Full review analysis

Scan:

Category Result
Tests / verification 3 finding(s) below
Security no finding reported
Docs / comments no finding reported
Behavior / compatibility no finding reported
Correctness no finding reported

Validated:

  • [resolved] SPDX flip on both :1 headers is hook-mandated at this head: tools/pre_commit/check_spdx_header.py:18-19 'Treat it as stale and rewrite it to the Omni line', :20 LEGACY_COPYRIGHT_TEXT = 'SPDX-FileCopyrightText: Copyright contributors to the vLLM project', :42 COPYRIGHT_TEXT = '...vLLM-Omni project'; residual: 9 untouched cosmos3 siblings keep the old line until next touched — no ask (round-1 no_issue stands).
  • [claim-verified] 'Cosmos3 cache ownership, reset behavior, and branch keys remain unchanged' — reset_cache (transformer_cosmos3.py:1606-1608) untouched, branch-cache keys in pipeline_cosmos3.py:1301/2866-2896 untouched by the diff.
  • [claim-verified] PR's own numbers internally consistent: 804.42-770.50=33.92 ms; 33.92/804.42=4.22%; per-process (801.51-767.49)/801.51=4.24%, (807.70-788.72)/807.70=2.35% — all match the description table; directional-only framing is honestly scoped.
  • [claim-verified] Focused-regression claim ('2 passed') corresponds to exactly the 2 added tests; no other test file touched.
  • [claim-verified] PR's own numbers check out: 804.42-770.50 = -33.92 ms = -4.22%; r1 801.51->767.49 = -4.24%; r2 807.70->788.72 = -2.35%; evidence is explicitly labeled historical (bea9437) and directional, not claimed as a current-head rerun — honest framing.
  • [claim-verified] PR claim 'Focused regressions: 2 passed' maps to exactly the two added tests; consistent with their structure (autouse single-rank TP fixture :18-34, _get_ulysses_state monkeypatched to (1,0,None)); not rerun in this read-only review — static reachability analysis only.

3 actionable finding(s).

Verdict: REQUEST CHANGES

See inline comments below.


🤖 This review was generated by InferMatrix Copilot, an open-source repo-maintenance agent for PR review, CI debugging and issue triage. Try it on your own repo, and ⭐ star it if it helped!

# cached alongside UND K/V by both the bespoke and session-state paths.
need_kv = self.cached_kv is None
if need_kv or self.cached_freqs_gen is None:
if need_kv:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P0] This diff moves the identical-text-length validation out of the top of `Cosmos3…

Evidence and suggested fix

This diff moves the identical-text-length validation out of the top of Cosmos3VFMTransformer.forward (removed hunk at :1685) into the new if need_kv: branch at :1779-1787, but it cannot merge as-is: the merge gate reports DIRTY/CONFLICTING against base, and main's #6922 has since moved this exact logic into _gen_preprocess() (repo-wide grep for _gen_preprocess at 40815a4 returns 0 matches), with both text-length scalar reads still unconditional there. Rebase onto current main and re-home the guard in the shared _gen_preprocess() preprocessing, preserving (a) validation on every cache-miss/build path, (b) freqs-only reconstruction without re-validation, and coverage of both the normal and SeaCache/session entry paths; then re-run tests/diffusion/models/cosmos3/test_cosmos3_transformer.py against the moved site. The guard's behavior itself checked out on this head — full cache hits never consume text_mask (:1780/:1789 are the only forward-body uses, both in the miss/freqs branch) and every generation resets the cache (pipeline_cosmos3.py:2680-2681, :3112-3113) — so the optimization is sound once it lands at main's current location.

Evidence: Unmet requirement: the PR must apply onto its base, but main has restructured the exact code region this PR edits. PR-time tree (head 40815a4, changed by this diff): vllm_omni/diffusion/models/cosmos3/transformer_cosmos3.py:1777-1779 need_kv = self.cached_kv is None / if need_kv or self.cached_freqs_gen is None: / if need_kv: with the guard raise at :1783-1787 now miss-branch-only, and repo-wide grep for _gen_preprocess at this head: 0 matches (verified). Decisive main-side code lies OUTSIDE this PR tree, present in the PR-time checkout of refs/heads/main (verified by grep, unchanged by this diff): vllm_omni/diffusion/models/cosmos3/transformer_cosmos3.py:1856 prep = self._gen_preprocess(, :1901 def _gen_preprocess(, :1955 f"Cosmos3 requires identical real text lengths within a batch " — i.e. main #6922 moved this exact validation into _gen_preprocess(), which is why the gate step reports MERGE STATE: DIRTY/CONFLICTING and the PR cannot merge as-is. Supporting in-tree soundness facts (unchanged-context checks): transformer_cosmos3.py:1780 text_lengths = text_mask.sum(dim=1) and :1789 text_mask, are the only forward-body text_mask uses, both inside the miss/freqs branch (full cache hits never consume it); pipeline_cosmos3.py:2681 self._kv_reset_und(kv_state) and :3112-3113 self.transformer.reset_cache() / self._cosmos3_branch_caches = {} reset the cache every generation.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refreshed in 25e0b25c545d06ce8ed228b395a79f40cd059f37 against main
198c2105930bd1bac0b0966ffd0997cdd84d4790. The guard is now in shared
_gen_preprocess(), with regression coverage through normal forward and the
production SeaCache extractor plus actual session-adapter restoration.

One detail differs from the suggested fix: frequency-only reconstruction
must still validate. The session adapter can restore K/V without
frequencies, and RoPE then consumes the current mask. The companion finding
in thread 4228321394 identified this correctly; the new tests reproduce the
missing rejection with the inner need_kv guard. The final guard is in the
outer reconstruction branch, so full hits still avoid scalar reads.

The focused/session suite passes 29 cases. Full two-file runs retain the same
14 platform-construction failures and one accelerator skip on main and head;
the description includes the baseline comparison and static-check limitations.
AI assistance: Codex/TraeCode assisted with verification and this reply.

# cached alongside UND K/V by both the bespoke and session-state paths.
need_kv = self.cached_kv is None
if need_kv or self.cached_freqs_gen is None:
if need_kv:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] The moved guard runs only under if need_kv: (1779), but the enclosing branch…

Evidence and suggested fix

The moved guard runs only under if need_kv: (1779), but the enclosing branch (1778) also fires for freq-only reconstruction — cached_kv present with cached_freqs_gen None — a state this repo's own adapter restores and pins as expected behavior, not just hand-assembly: state_cosmos3_adapter.py:150-151 assigns kv and freqs_gen independently, get_branch_freqs_gen returns None when absent (:142-146), and tests/diffusion/models/cosmos3/test_session_memory_equivalence.py:107-114 asserts that exact end state on the transformer. In that cell _compute_rope_freqs still consumes the current text_mask per item (transformer_cosmos3.py:1529) while the cached K/V were trimmed to a previous batch's max_real_len (:1810), so a nonuniform mask now silently builds text positions against a differently-trimmed cache where the base tree raised. Hoist the guard to the outer branch: it then runs exactly when the mask is consumed (miss or freq-only, once per reconstruction) while the full cache-hit path — the actual optimization target, pinned by the .item() tripwire test — never enters this branch and stays sync-free. Add a test pinning the freq-only state with a nonuniform mask.

Evidence: Trigger: transformer in kv-present/freqs-None state, forward with a nonuniform text_mask. PR head: transformer_cosmos3.py:1778 if need_kv or self.cached_freqs_gen is None: with :1779 if need_kv: — guard skipped in the freq-only cell, then :1788 freqs_und, freqs_gen = self._compute_rope_freqs( consumes the current mask per item at :1529 real_len = int(text_lengths[b].item()) while :1810 self.cached_kv = [(k[:, :max_real_len], v[:, :max_real_len]) for k, v in cached_kv_full] shows the cache was trimmed to a previous batch's length; the base tree raised here before any cache logic (removed hunk: raise ValueError(f"Cosmos3 requires identical real text lengths within a batch ...")). The state is repo-supported, unchanged by this diff: state_cosmos3_adapter.py:150-151 transformer.cached_kv = self.get_branch_kv(is_negative)/transformer.cached_freqs_gen = self.get_branch_freqs_gen(is_negative)with :142-146 returning None when freqs are absent, and tests/diffusion/models/cosmos3/test_session_memory_equivalence.py:107-114test_load_into_transformer_without_freqs_sets_kvassertingassert tr.cached_freqs_gen is None` with kv set — the exact cell where base protection is lost. Full-hit path unaffected: with cached_freqs_gen present the outer branch is not entered, so the tripwire test remains green.

Suggestion: text_lengths = text_mask.sum(dim=1)
min_real_len = int(text_lengths.min().item())
max_real_len = int(text_lengths.max().item())
if min_real_len != max_real_len:
raise ValueError(
f"Cosmos3 requires identical real text lengths within a batch "
f"(got min={min_real_len}, max={max_real_len})."
)
freqs_und, freqs_gen = self._compute_rope_freqs(

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 25e0b25c545d06ce8ed228b395a79f40cd059f37: identical-length
validation now runs under if need_kv or self.cached_freqs_gen is None,
before RoPE reconstruction in shared _gen_preprocess().

The new tests restore K/V without frequencies via Cosmos3StateAdapter,
then verify that a nonuniform mask raises the original ValueError, does
not call RoPE or publish frequencies, and preserves K/V identity. Uniform
frequency-only reconstruction preserves K/V and matches the reference
output/frequencies exactly; full-hit tripwires reject any .item() or cache
rebuild. Both normal forward and the SeaCache extractor are exercised.

Before the guard correction, the new cases had four genuine failures:
two missing exceptions and two missing pre-RoPE validation-read pairs.
The final focused/session suite passes 29 cases. The earlier statement
that frequency-only reconstruction could skip validation was incorrect and
has been corrected in the PR description.
AI assistance: Codex/TraeCode assisted with the fix, tests and this reply.

# cached alongside UND K/V by both the bespoke and session-state paths.
need_kv = self.cached_kv is None
if need_kv or self.cached_freqs_gen is None:
if need_kv:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P3] The headline perf number has no current-head evidence: the A100 medians in the…

Evidence and suggested fix

The headline perf number has no current-head evidence: the A100 medians in the description (-33.92 ms / -4.22%, and the per-process -4.24% / -2.35%) come from historical commit bea9437 and the author explicitly labels them directional, not a rerun at this head — the review notes 'current-head evidence stays open.' The kept blocker's rerun ask covers only the focused transformer regressions, not the benchmark, so this gap is not closed by the blocker as filed. Since the required rebase onto main (re-homing the guard into _gen_preprocess()) changes the code the measurement was taken against, rerun the same A100 benchmark at the rebased head and update the description's numbers; until that rerun lands, keep the table explicitly labeled historical/directional so it is not read as a measurement of the merged code.

Evidence: [claim] Historical A100 medians are self-consistent (-33.92ms / 804.42ms = -4.22%); the author explicitly labels them directional and not a current-head rerun — current-head evidence stays open and is folded into the blocker's rerun ask. Corroborated by [claim-verified]: 'evidence is explicitly labeled historical (bea9437) and directional, not claimed as a current-head rerun — honest framing.'

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The description now explicitly binds the A100 table to historical head
bea9437d / base 94b1546c, before both the shared-preprocessing integration
and the frequency-only guard correction. It is not evidence for current head
25e0b25c545d06ce8ed228b395a79f40cd059f37.

This refresh adds CPU regression evidence, not new performance measurements.
The current-head A100 benchmark and official hardware CI remain outstanding;
the historical -4.22% stays directional, with no fresh E2E speedup claim.
AI assistance: Codex/TraeCode assisted with evidence review and this reply.

@vllm-omni-review-bot

Copy link
Copy Markdown

Omni ReviewBot: finding feedback

**[p0] This diff moves the identical-text-length validation out of the top of Cosmos3…** — vllm_omni/diffusion/models/cosmos3/transformer_cosmos3.py:1779`

See the review for details. If you are the PR author and disagree, react 👎 here; the maintainer will see your disagreement.

Merge main at 198c210. Validate text lengths for both K/V misses and frequency-only reconstruction, while full cache hits avoid scalar reads.

Preserve both parents' regression coverage and exercise real forward, SeaCache extractor, and session restoration paths.

Signed-off-by: Allen Wu <allenwu2795@gmail.com>
Co-authored-by: TRAE CLI <traecli@bytedance.com>
@EchoHayate EchoHayate changed the title [Perf][Cosmos3] Skip text length synchronization on KV-cache hits [Model] Cosmos3: skip text-length synchronization on full cache hits Oct 12, 2026
@EchoHayate

Copy link
Copy Markdown
Contributor Author

Author self-review — October 12 refresh

Current head reviewed: 25e0b25c545d06ce8ed228b395a79f40cd059f37.
Merged main at 198c2105930bd1bac0b0966ffd0997cdd84d4790.

  • Scope/invariants: validation now lives in shared _gen_preprocess() and
    precedes RoPE for both a K/V miss and frequency-only restoration. Full hits
    avoid the two validation scalar reads. K/V trimming, ownership, reset and
    branch keys are unchanged; both parents' existing tests are retained.
  • Fail-closed behavior: nonuniform masks still raise on either reconstruction
    path. Tests use actual session-adapter restore and both normal forward and
    the production SeaCache extractor/block/postprocessing path.
  • Fresh tests: 29 passed in the focused/session suite, zero skips.
    Complete two-file comparison: main 106 passed / 14 failed / 1 skipped;
    head 120 passed / 14 failed / 1 skipped. The same 14 constructor failures
    require a concrete platform attention backend; all extra cases pass.
  • Static checks: applicable changed-file hooks pass except two unchanged
    upstream mypy annotation errors (full_refs, full_pointers), reproduced
    against pristine main. No suppressions were added; scoped diff check passes.
  • Evidence boundaries: synthetic one-layer CPU validation only. Local
    diffusers is 0.39.0 versus main's 0.40.0 requirement. Full-suite green,
    distributed/multimodal qualification, official hardware CI and a current-head
    A100 rerun remain outstanding. The PR body preserves the old A100 results
    as historical/directional, not a measurement of this head.

The three inline review items are answered in their original threads. AI
assistance: Codex/TraeCode helped with the code/test refresh, review, validation
and this summary. No review-bot rerun is requested by this comment.

@vllm-omni-review-bot

Copy link
Copy Markdown

Omni ReviewBot triage note

Automated triage of commit 25e0b25c545d produced:

  • Priority: high. Prompt maintainer attention is suggested.

These are automated triage suggestions only — the final decision belongs to the maintainers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

diffusion codes related to diffusion models Kernel optimization Codes related to optimize kernel execution to improve hardware utilization

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants