Repository navigation
[WS1][Qwen-Image][CUDA] Add stride-aware multi-axis RoPE with compile support - #623
dandan20031031 wants to merge 5 commits into
Conversation
Provide stride-aware native CUDA and FlashAttention-derived Triton paths with fixed FP32 arithmetic, dispatcher/fake/autograd registration, standard operator validation, package build checks, and mature-baseline benchmark evidence. Refs RL-Align#386. Signed-off-by: dandan20031031 <2425926169@qq.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
Add an explicit full-extension GPU gate and CPU CI for test-qwenimage. Record WSL2 wheel/import, WS1, layout, compiler, CPU-only, memory-check and mature-baseline evidence; expose the loaded full native library in the installation probe. Refs RL-Align#386. Signed-off-by: dandan20031031 <2425926169@qq.com>
Signed-off-by: dandan20031031 <2425926169@qq.com>
Signed-off-by: dandan20031031 <2425926169@qq.com>
|
🔍 OpenCodeReview found 9 issue(s) in this PR.
📄
|
|
@dandan20031031 The automated OCR review has completed. Please review and address all automated review bot findings, then push your updates. Maintainers will begin manual review after the bot findings have been addressed. |
Signed-off-by: dandan20031031 <2425926169@qq.com>
|
OCR review follow-up in 9e2e50f. The CLI and WS1 adapters now share canonical centered image-grid prefixes keyed by complete logical sample/token identity. New regressions cover physical layouts, non-CUDA routing, load failures and head-dimension strides. The validation summary records the new runs separately from the initial benchmark measurements.
Disposition of the nine findings routed to the summary:
The two inline findings have separate replies with implementation/test references. Hosted CPU CI still awaits upstream workflow authorization; the local CPU runs above are not presented as passing hosted CI. Bare-metal Linux, A100/H100, two-GPU execution and model/trajectory integration remain unqualified. |
|
Follow-up on OCR run The inline VJP finding has a separate reply with source references and 12 additional independent FP64-oracle output/VJP checks. The eight summary findings were checked as follows; no further implementation change was indicated by these reproductions.
These follow-up probes used the same validated source snapshot published as 9e2e50f. The committed validation report distinguishes the initial measurements from the new local qualification results; hosted CPU CI is still awaiting upstream authorization. |
Qwen-Image rotates adjacent channel pairs using centered three-axis positions; the existing GPT-NeoX half-split RoPE cannot implement that contract. This adds the unfused CUDA
multi_axis_roperow of #386, with FP32/FP16/BF16 BSHD inputs, fixed FP32 multiply/add order, input gradients, per-sample tables and actual-backend traces.The Triton backend adapts FlashAttention's rotary kernel, preserving its BSD license and attribution. The adaptation reads independent table/input strides and disables contraction. Native CUDA supplies the same arithmetic without a Triton dependency. Position semantics are pinned to Diffusers@40f63690.
Both GPU paths support packed-QKV views without materialization, fake/autograd registration, higher input VJPs, CUDA Graph replay and fullgraph forward/backward. OP_SPECS, the standard input builder and a gradient adapter expose the operator to existing accuracy/invariance APIs.
The ordinary CLI and WS1 forward/gradient adapters share a centered image-grid prefix derived from
qwen_image_positions. Full logical sample length and(sample_id, token_position)select coordinates consistently across packing, permutation, chunks and padding. Regressions cover those layouts, non-CUDA reference routing, load-error propagation and arbitrary head-dimension strides. Backward telemetry documents its CUDA Graph replay limit.Validation
Two separately recorded environments use the same RTX 5080/SM120 and PyTorch 2.9.1+cu128:
Latest WSL2 results:
rl_engine._Cwheel, all 10 configured translation units, and importThe complete WSL2 build used the normal wheel path with
RL_KERNEL_ROPE_ONLYunset. The installed-package probe records the actual loaded full_Cpath and its fingerprint. The existing optional operator-only wheel profile remains available. Both wheel paths retain the third-party license.Acceptance entry points and CI
ci/scripts/run_qwenimage_rope_ws1.shrequires a real NVIDIA GPU, Triton and the complete_CRoPE registration. It records binary/backend identity and allows only the two-device guard to skip.The new
Qwen-Image RoPEworkflow covers PRs targetingtest-qwenimage, with CPU contracts on Python 3.10/3.12, changed-file checks and strict documentation build. Hosted CI is awaiting upstream authorization (action_required). Both Python versions were checked locally with actual CPU-only PyTorch wheels, including installed-package reference forward/backward. These are not recorded as passing hosted CI results. GPU qualification uses the explicit gate.Standalone benchmark
BF16 [1,4096,24,128], packed QKV, CUDA Graph forward/forward+backward medians in ms/call:
The benchmark includes default FlashAttention, all three reference image grids plus a short case, both layouts, eager wall/graph timings and extra peak allocation. All 40 pre-timing comparisons passed; strict CUDA/Triton/no-FMA output and input-gradient bytes agree exactly. Forward extra peak at 4096 tokens is 24 MiB, the returned output size. These one-process measurements establish no advantage over FlashAttention or model-throughput speedup.
Scope
This qualifies Linux userspace/compiler/package behavior on WSL2/SM120. Bare-metal Linux, A100/H100, multi-GPU guards, QK-norm fusion, model/block assembly and trajectories remain unqualified. Building the complete library does not certify every native operator or the Dense Qwen3 chain.
Related Ascend work is #411. Its audited head
285c4dccab7e9048956584caf431946d82405c09uses a different half-split/uncentered reference, so a shared interface requires semantic alignment.Validation summary and reproduction: SM120 validation report. Detailed per-case logs, benchmark data and source/binary SHA256 manifests remain at immutable commit
84751473006401c19c1c8c17844e8ef8b1c44375: WSL2 full-extension archive, historical Windows archive. The final diff retains one summary instead of the raw run files. This addresses one platform row, not all of #386.