FlashKDA icon indicating copy to clipboard operation
FlashKDA copied to clipboard

Test failed

Open mccatec opened this issue 7 months ago • 5 comments

CUDA: 12.8 torch: 2.8.0 python: 3.12.0

python test_fwd.py

W0422 16:42:13.527000 1553879 site-packages/torch/utils/cpp_extension.py:2425] TORCH_CUDA_ARCH_LIST is not set, all archs for visible cards are included for compilation. W0422 16:42:13.527000 1553879 site-packages/torch/utils/cpp_extension.py:2425] If this is not desired, please set os.environ['TORCH_CUDA_ARCH_LIST'] to specific architectures. Testing shape: [1, 8192, 96, 128] 48128.0 48128.0 output | avg_rtol: 0.0, max_rtol: 0.0 output | avg_atol: 0.0, max_atol: 0.0 Success: kernel == torch ref (exact match)

test_fwd_varlen: seq_lens=[1300, 547, 2048, 963, 271, 3063], T_total=8192, N=6, H=96, D=128 356352.0 356352.0 output | avg_rtol: 0.0, max_rtol: 0.0 output | avg_atol: 0.0, max_atol: 0.0 Success: varlen kernel == torch ref (exact match)

================================================================================ Case: g=-8_bias=0 chunk_kda | Output err_ratio: nan, State err_ratio: nan flash_kda | Output err_ratio: 2.311719e-01, State err_ratio: 1.295053e+00

================================================================================ Case: g=-4_bias=0 chunk_kda | Output err_ratio: 1.032738e+01, State err_ratio: 2.940461e+00 flash_kda | Output err_ratio: 5.134759e-02, State err_ratio: 6.519420e-01

================================================================================ Case: g=0_bias=0 chunk_kda | Output err_ratio: 1.710585e+00, State err_ratio: 7.569270e+00 flash_kda | Output err_ratio: 6.652401e-03, State err_ratio: 8.494292e-01

================================================================================ Case: g=8_bias=0 chunk_kda | Output err_ratio: 1.725805e+00, State err_ratio: 8.255929e+00 flash_kda | Output err_ratio: 4.240198e-03, State err_ratio: 9.346220e-01

================================================================================ Case: g=U(-8,8)_bias=0 chunk_kda | Output err_ratio: 1.775575e+00, State err_ratio: 4.813610e+00 flash_kda | Output err_ratio: 3.642615e-02, State err_ratio: 1.033500e+00

================================================================================ Case: g=N(0,8)_bias=0 chunk_kda | Output err_ratio: 1.785749e+00, State err_ratio: 4.979090e+00 flash_kda | Output err_ratio: 3.393850e-02, State err_ratio: 1.049645e+00

================================================================================ Case: g=0_bias={-4,4} chunk_kda | Output err_ratio: 2.170030e+00, State err_ratio: 2.150356e+00 flash_kda | Output err_ratio: 3.689558e-02, State err_ratio: 1.026579e+00

================================================================================ Case: g=0_bias={-8,8} chunk_kda | Output err_ratio: 1.558622e+04, State err_ratio: 3.335116e+04 flash_kda | Output err_ratio: 1.564902e-01, State err_ratio: 1.233586e+00

================================================================================ Case: g=0_bias=U(-8,8) chunk_kda | Output err_ratio: 2.705113e+00, State err_ratio: 1.382501e+00 flash_kda | Output err_ratio: 7.613135e-02, State err_ratio: 1.296081e+00

================================================================================ Case: g=0_bias=N(0,8) chunk_kda | Output err_ratio: 1.394620e+01, State err_ratio: 3.806905e+01 flash_kda | Output err_ratio: 1.358991e-01, State err_ratio: 1.320740e+00

Plot saved to: plot.png

================================================================================ Traceback (most recent call last): File "/home/flash-kda/tests/test_fwd.py", line 430, in test_fwd_vs_fla() File "/home/conda/envs/train/lib/python3.12/site-packages/torch/utils/_contextlib.py", line 120, in decorate_context return func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "/home/flash-kda/tests/test_fwd.py", line 360, in test_fwd_vs_fla assert_close(f"{r['name']} o", r["tri"], r["out"], 0.005) File "/home/conda/envs/train/lib/python3.12/site-packages/fla/utils.py", line 106, in assert_close assert error_rate < ratio, msg ^^^^^^^^^^^^^^^^^^ AssertionError: g=-8_bias=0 o diff: 0.328258 ratio: 0.231172

mccatec avatar Apr 22 '26 08:04 mccatec

please provide:

  • your gpu version
  • flash-linear-attention version

esp0r avatar Apr 22 '26 09:04 esp0r

This may relates to the use_beta_sigmoid_in_kernel option. upstream flash-linear-attention hasn't implemented this feature, causing mismatch between flash_kda and chunk_kda. Try againt using the lastest master branch: https://github.com/MoonshotAI/FlashKDA/commit/1c7787237c54427da9d202a2c1588537a8939d8c

esp0r avatar Apr 22 '26 10:04 esp0r

I will add it to upstream FLA https://github.com/fla-org/flash-linear-attention/pull/858

zhiyuan1i avatar Apr 22 '26 10:04 zhiyuan1i

please provide:

  • your gpu version
  • flash-linear-attention version

GPU: H20 141G x 8 flash-linear-attention 0.4.2 causal-conv1d 1.6.0

mccatec avatar Apr 23 '26 02:04 mccatec

This may relates to the use_beta_sigmoid_in_kernel option. upstream flash-linear-attention hasn't implemented this feature, causing mismatch between flash_kda and chunk_kda. Try againt using the lastest master branch: 1c77872

upgrade fla to 0.5.0 solved the problem.

mccatec avatar Apr 23 '26 12:04 mccatec