DivergentHF: fix off-by-one in sequence selector (0-based kernel) - #2
Merged
Merged
Conversation
The 3 failing DivergentHF tests were an off-by-one: plane 0 always ran the wrong sequence. DivergentBatchTransformDPP is 0-BASED — exec() calls divergent_operate<0>(z, seqs...) and runs the sequence whose 0-based position equals at(z) (data_parallel_patterns.h; the upstream regression test selector returns index==0?0u:1u, i.e. 0 picks the FIRST sequence). _selector_cpp was emitting the 1-based plane_map verbatim, so at(0)=1 selected the SECOND sequence for plane 0. compose_divergent keeps the readable 1-based plane_map at the API; the selector now emits (s-1). The stale comment citing circular_tensor.h's SequenceSelectorType as '1-based convention' was wrong for this kernel (that is a different selector contract) — corrected. Added sv=2 to the divergent cache signature so stale .so files from the previous (buggy) selector are not reused. test_batch_divergent_hf now 12/12 (was 9/12). circular/HF/e2e still green.
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.
Qué arregla
Las 3 fallas de
test_batch_divergent_hf(DivergentHF: …) que existían enmain. En los tres casos el plano 0 ejecutaba la secuencia equivocada.Causa raíz — off-by-one en el selector
DivergentBatchTransformDPPes 0-based:exec()llama adivergent_operate<0>(z, seqs...)y ejecuta la secuencia cuya posición 0-based coincide conat(z)(data_parallel_patterns.h). El selector del test de regresión upstream lo confirma:MySelector::atdevuelveindex==0?0u:1u, es decir,at=0elige la PRIMERA secuencia.DivergentKernel._selector_cpp(jit.py) emitía elplane_map1-based tal cual, así queat(0)=1seleccionaba la SEGUNDA secuencia para el plano 0 → de ahí el desfase en los 3 tests.Fix
compose_divergentmantiene elplane_map1-based en la API (legible); el selector ahora emite(s-1).circular_tensor.h::SequenceSelectorTypecomo "1-based convention" — es otro contrato de selector, no aplica a este kernel.sv=2a la firma de caché del divergente para no reusar.soobsoletas del selector buggeado.Verificación (RTX PRO 6000 sm_120, nvcc 13.3)
test_batch_divergent_hf: 12/12 (antes 9/12).SequenceSelectorType), horizontal_fusion y e2e siguen verdes.