Repository navigation
Conversation
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.
Restores #1294 after the October 15 repository-history incident. Original contribution by taking-lying-flat; earlier review and discussion remain in #1294. This recovery draft uses the existing source branch at
ccea6748and preserves its commits. Validation details below are retained from the original PR and have not been rerun for this recovery. Current-main integration and readiness need confirmation before review resumes.Summary
With
use_gate_in_kernel=Trueand noA_log, unbounded recurrent and fused-gate KDA paths usedexp(1)as the decay scale, while chunk KDA rejected the call. Use a unit scale consistently across chunk, recurrent, fused-gate, and Triton-Ascend paths, equivalent to passing an explicit zeroA_log.The PyTorch reference and existing parameterized tests cover this optional-argument contract. Explicit
A_log, bounded-gate formulas, parameter shapes, and checkpoint layouts retain their existing behavior. This is a correctness fix for callers that omitA_log; it does not claim a training-throughput improvement.Test plan
107 passed, 8 deselected on an RTX A1000 Laptop GPU (4 GiB), PyTorch 2.12.1+cu130, and Triton 3.7.1. Backend dispatch is disabled to exercise the changed Triton kernels directly. The original tolerances and NaN-memory-poisoning fixture are retained. All pre-commit hooks and
git diff --checkpassed.FLA_CI_ENV=0 FLA_DISABLE_BACKEND_DISPATCH=1 python -m pytest \ tests/ops/test_kda.py::test_chunk \ tests/ops/test_kda.py::test_fused_recurrent_gate_in_kernel \ tests/ops/test_kda.py::test_gate \ -k 'not (test_chunk and (D100 or D128 or T2048 or HV8))' \ -q --tb=short -o log_cli=false pre-commit run --all-files git diff --checkThe selection includes the omitted-
A_logregressions, explicit-parameter controls, bounded and unbounded gates, FP32/FP16/BF16, output and final-state comparisons, and supported gradients. Large chunk cases are excluded to fit local GPU memory. Two explicit-A_logBF16 chunk cases emitteddAwarnings under the existingwarning=Truechecks (relative RMS errors 0.006700 and 0.003616); no tolerances were changed. Full-model, context-parallel, and local NPU tests were not run.The prior Ascend CI run at
f85ebbbcstopped on three activation stride failures (sigmoid,swiglu, andpowglu), before completing KDA coverage. This branch now includes the upstream fix from #1374. The refreshed Ascend run remains the NPU validation gate.Benchmark / NCU (kernel changes only)
Previously recorded same-machine measurements compare CUDA fix
039ba807with baseline0259f80con an RTX A1000 Laptop GPU, PyTorch 2.13.0+cu130, and Triton 3.7.1. The CUDA formulas are unchanged by the subsequent test consolidation and mainline merges.Workload:
B=1, T=73, H=1, HV=2, K=V=64, FP32, explicit zeroA_log, nonzero initial state, final-state output enabled, and varlen boundaries[0, 3, 73]. Median latency usestriton.testing.do_bench(fn, warmup=100, rep=300, quantiles=[0.5, 0.2, 0.8]).Performance is neutral within the measurement spread. Nsight Compute
--set fullcould not collect counters because the driver returnedERR_NVGPUCTRPERM. The table records the original CUDA-fix validation; current-branch correctness is checked separately above.Breaking changes
No parameter shapes or checkpoint layouts change. Previously rejected chunk calls now work. Unbounded recurrent and fused-gate calls that omit
A_logchange from the unintendedexp(1)scale to unit scale. Pass an explicit ones tensor asA_logto reproduce the former recurrent scaling.Checklist