fla-core 0.3.2__tar.gz → 0.4.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (213) hide show
  1. {fla_core-0.3.2 → fla_core-0.4.1}/PKG-INFO +37 -14
  2. {fla_core-0.3.2 → fla_core-0.4.1}/README.md +35 -12
  3. {fla_core-0.3.2 → fla_core-0.4.1}/fla/__init__.py +1 -1
  4. {fla_core-0.3.2 → fla_core-0.4.1}/fla/modules/__init__.py +2 -3
  5. {fla_core-0.3.2 → fla_core-0.4.1}/fla/modules/activations.py +27 -20
  6. {fla_core-0.3.2 → fla_core-0.4.1}/fla/modules/convolution.py +108 -68
  7. {fla_core-0.3.2 → fla_core-0.4.1}/fla/modules/feature_map.py +14 -16
  8. {fla_core-0.3.2 → fla_core-0.4.1}/fla/modules/fused_bitlinear.py +18 -17
  9. {fla_core-0.3.2 → fla_core-0.4.1}/fla/modules/fused_cross_entropy.py +6 -7
  10. {fla_core-0.3.2 → fla_core-0.4.1}/fla/modules/fused_kl_div.py +16 -18
  11. {fla_core-0.3.2 → fla_core-0.4.1}/fla/modules/fused_linear_cross_entropy.py +14 -15
  12. {fla_core-0.3.2 → fla_core-0.4.1}/fla/modules/fused_norm_gate.py +66 -74
  13. {fla_core-0.3.2 → fla_core-0.4.1}/fla/modules/grpo.py +12 -9
  14. {fla_core-0.3.2 → fla_core-0.4.1}/fla/modules/l2norm.py +19 -18
  15. {fla_core-0.3.2 → fla_core-0.4.1}/fla/modules/l2warp.py +0 -1
  16. {fla_core-0.3.2 → fla_core-0.4.1}/fla/modules/layernorm.py +81 -60
  17. {fla_core-0.3.2 → fla_core-0.4.1}/fla/modules/layernorm_gated.py +9 -10
  18. {fla_core-0.3.2 → fla_core-0.4.1}/fla/modules/mlp.py +9 -10
  19. {fla_core-0.3.2 → fla_core-0.4.1}/fla/modules/parallel.py +4 -6
  20. {fla_core-0.3.2 → fla_core-0.4.1}/fla/modules/rotary.py +19 -21
  21. {fla_core-0.3.2 → fla_core-0.4.1}/fla/modules/token_shift.py +39 -30
  22. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/__init__.py +3 -2
  23. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/abc/__init__.py +1 -2
  24. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/abc/chunk.py +39 -41
  25. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/abc/naive.py +5 -7
  26. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/attn/__init__.py +1 -2
  27. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/attn/decoding.py +9 -10
  28. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/attn/parallel.py +14 -16
  29. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/based/__init__.py +1 -2
  30. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/based/fused_chunk.py +3 -5
  31. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/based/naive.py +2 -4
  32. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/based/parallel.py +6 -8
  33. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/comba/__init__.py +1 -1
  34. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/comba/chunk.py +9 -11
  35. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/comba/fused_recurrent.py +11 -13
  36. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/comba/utils.py +12 -10
  37. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/comba/wy_fast.py +18 -17
  38. fla_core-0.4.1/fla/ops/common/__init__.py +0 -0
  39. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/common/chunk_delta_h.py +160 -115
  40. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/common/chunk_h.py +28 -28
  41. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/common/chunk_h_parallel.py +29 -26
  42. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/common/chunk_h_split.py +19 -16
  43. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/common/chunk_o.py +72 -63
  44. fla_core-0.4.1/fla/ops/common/chunk_scaled_dot_kkt.py +124 -0
  45. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/common/fused_chunk.py +30 -24
  46. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/common/fused_recurrent.py +37 -37
  47. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/delta_rule/__init__.py +1 -2
  48. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/delta_rule/chunk.py +17 -19
  49. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/delta_rule/fused_chunk.py +1 -2
  50. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/delta_rule/fused_recurrent.py +12 -14
  51. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/delta_rule/naive.py +0 -1
  52. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/delta_rule/parallel.py +15 -15
  53. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/delta_rule/wy_fast.py +15 -16
  54. fla_core-0.4.1/fla/ops/deltaformer/__init__.py +8 -0
  55. fla_core-0.4.1/fla/ops/deltaformer/invcum.py +37 -0
  56. fla_core-0.4.1/fla/ops/deltaformer/naive.py +150 -0
  57. fla_core-0.4.1/fla/ops/deltaformer/parallel.py +991 -0
  58. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/forgetting_attn/__init__.py +1 -2
  59. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/forgetting_attn/parallel.py +5 -7
  60. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/gated_delta_product/__init__.py +1 -1
  61. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/gated_delta_product/chunk.py +9 -11
  62. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/gated_delta_product/chunk_deltaproduct_h.py +15 -16
  63. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/gated_delta_product/chunk_deltaproduct_o.py +8 -10
  64. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/gated_delta_product/chunk_ref.py +1 -3
  65. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/gated_delta_rule/__init__.py +1 -1
  66. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/gated_delta_rule/chunk.py +16 -33
  67. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/gated_delta_rule/fused_recurrent.py +26 -28
  68. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/gated_delta_rule/wy_fast.py +150 -117
  69. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/generalized_delta_rule/__init__.py +1 -1
  70. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/generalized_delta_rule/dplr/__init__.py +1 -1
  71. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/generalized_delta_rule/dplr/chunk.py +29 -34
  72. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/generalized_delta_rule/dplr/chunk_A_bwd.py +11 -12
  73. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/generalized_delta_rule/dplr/chunk_A_fwd.py +9 -11
  74. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/generalized_delta_rule/dplr/chunk_h_bwd.py +9 -11
  75. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/generalized_delta_rule/dplr/chunk_h_fwd.py +9 -11
  76. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/generalized_delta_rule/dplr/chunk_o_bwd.py +18 -18
  77. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/generalized_delta_rule/dplr/chunk_o_fwd.py +7 -9
  78. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/generalized_delta_rule/dplr/fused_recurrent.py +17 -19
  79. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/generalized_delta_rule/dplr/naive.py +0 -1
  80. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/generalized_delta_rule/dplr/wy_fast_bwd.py +8 -10
  81. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/generalized_delta_rule/dplr/wy_fast_fwd.py +20 -20
  82. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/generalized_delta_rule/iplr/__init__.py +1 -1
  83. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/generalized_delta_rule/iplr/chunk.py +38 -34
  84. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/generalized_delta_rule/iplr/fused_recurrent.py +14 -14
  85. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/generalized_delta_rule/iplr/naive.py +0 -1
  86. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/generalized_delta_rule/iplr/wy_fast.py +20 -21
  87. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/gla/__init__.py +1 -2
  88. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/gla/chunk.py +254 -205
  89. fla_core-0.4.1/fla/ops/gla/fused_chunk.py +5 -0
  90. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/gla/fused_recurrent.py +8 -10
  91. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/gla/naive.py +2 -4
  92. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/gsa/__init__.py +1 -2
  93. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/gsa/chunk.py +77 -77
  94. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/gsa/fused_recurrent.py +28 -30
  95. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/gsa/naive.py +4 -6
  96. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/hgrn/__init__.py +1 -2
  97. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/hgrn/chunk.py +15 -15
  98. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/hgrn/fused_recurrent.py +21 -21
  99. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/hgrn/naive.py +5 -7
  100. fla_core-0.4.1/fla/ops/kda/__init__.py +7 -0
  101. fla_core-0.4.1/fla/ops/kda/chunk.py +434 -0
  102. fla_core-0.4.1/fla/ops/kda/chunk_bwd.py +387 -0
  103. fla_core-0.4.1/fla/ops/kda/chunk_intra.py +694 -0
  104. fla_core-0.4.1/fla/ops/kda/chunk_intra_token_parallel.py +167 -0
  105. fla_core-0.4.1/fla/ops/kda/fused_recurrent.py +112 -0
  106. fla_core-0.4.1/fla/ops/kda/gate.py +290 -0
  107. fla_core-0.4.1/fla/ops/kda/naive.py +100 -0
  108. fla_core-0.4.1/fla/ops/kda/wy_fast.py +313 -0
  109. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/lightning_attn/__init__.py +1 -2
  110. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/lightning_attn/chunk.py +8 -10
  111. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/lightning_attn/fused_recurrent.py +8 -10
  112. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/linear_attn/__init__.py +1 -2
  113. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/linear_attn/chunk.py +7 -9
  114. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/linear_attn/fused_chunk.py +5 -7
  115. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/linear_attn/fused_recurrent.py +4 -6
  116. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/linear_attn/naive.py +8 -10
  117. fla_core-0.4.1/fla/ops/linear_attn/utils.py +9 -0
  118. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/log_linear_attn/__init__.py +0 -1
  119. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/log_linear_attn/chunk.py +62 -49
  120. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/mesa_net/chunk.py +21 -23
  121. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/mesa_net/chunk_cg_solver_bwd.py +5 -7
  122. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/mesa_net/chunk_cg_solver_fwd.py +4 -6
  123. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/mesa_net/chunk_h_fwd.py +10 -10
  124. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/mesa_net/chunk_h_kk_intra_bwd.py +6 -8
  125. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/mesa_net/chunk_h_kv_intra_bwd.py +8 -8
  126. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/mesa_net/chunk_h_kv_intra_bwd_separate.py +9 -8
  127. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/mesa_net/decoding_one_step.py +3 -4
  128. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/mesa_net/naive.py +1 -2
  129. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/nsa/__init__.py +1 -2
  130. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/nsa/compression.py +21 -20
  131. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/nsa/naive.py +6 -8
  132. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/nsa/parallel.py +40 -38
  133. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/nsa/utils.py +0 -1
  134. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/path_attn/__init__.py +1 -2
  135. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/path_attn/cumprod_householder_bwd.py +1 -2
  136. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/path_attn/cumprod_householder_fwd.py +3 -3
  137. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/path_attn/intra_chunk_preprocess_bwd.py +7 -6
  138. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/path_attn/intra_chunk_preprocess_bwd_prepare.py +18 -30
  139. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/path_attn/intra_chunk_preprocess_fwd.py +18 -16
  140. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/path_attn/parallel.py +30 -23
  141. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/path_attn/parallel_path_bwd_inter_dkv.py +9 -9
  142. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/path_attn/parallel_path_bwd_inter_dqh.py +5 -5
  143. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/path_attn/parallel_path_bwd_intra.py +3 -3
  144. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/path_attn/parallel_path_fwd.py +3 -3
  145. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/path_attn/prepare_k_cache.py +3 -3
  146. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/path_attn/transform_q.py +2 -3
  147. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/rebased/__init__.py +1 -2
  148. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/rebased/naive.py +1 -3
  149. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/rebased/parallel.py +7 -8
  150. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/retention/__init__.py +1 -2
  151. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/retention/chunk.py +8 -10
  152. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/retention/fused_chunk.py +7 -9
  153. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/retention/fused_recurrent.py +4 -6
  154. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/retention/naive.py +0 -1
  155. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/retention/parallel.py +7 -9
  156. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/rwkv4/__init__.py +1 -2
  157. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/rwkv4/fused_recurrent.py +1 -2
  158. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/rwkv6/__init__.py +1 -2
  159. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/rwkv6/chunk.py +71 -58
  160. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/rwkv6/chunk_naive.py +1 -2
  161. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/rwkv6/fused_recurrent.py +32 -30
  162. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/rwkv6/recurrent_naive.py +4 -6
  163. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/rwkv7/__init__.py +1 -2
  164. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/rwkv7/channel_mixing.py +22 -11
  165. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/rwkv7/chunk.py +3 -5
  166. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/rwkv7/fused_addcmul.py +9 -7
  167. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/rwkv7/fused_k_update.py +15 -13
  168. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/rwkv7/fused_recurrent.py +20 -21
  169. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/rwkv7/gate_output_correction.py +4 -3
  170. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/simple_gla/__init__.py +1 -2
  171. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/simple_gla/chunk.py +31 -33
  172. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/simple_gla/fused_chunk.py +7 -9
  173. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/simple_gla/fused_recurrent.py +7 -9
  174. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/simple_gla/naive.py +6 -8
  175. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/simple_gla/parallel.py +24 -23
  176. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/titans/__init__.py +1 -2
  177. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/titans/log_impl.py +4 -4
  178. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/titans/naive.py +6 -7
  179. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/ttt/__init__.py +1 -2
  180. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/ttt/chunk.py +52 -48
  181. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/ttt/fused_chunk.py +19 -18
  182. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/ttt/naive.py +1 -2
  183. fla_core-0.4.1/fla/ops/utils/__init__.py +58 -0
  184. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/utils/constant.py +0 -1
  185. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/utils/cumsum.py +53 -49
  186. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/utils/index.py +20 -17
  187. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/utils/logcumsumexp.py +6 -5
  188. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/utils/logsumexp.py +8 -8
  189. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/utils/matmul.py +8 -9
  190. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/utils/op.py +2 -8
  191. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/utils/pack.py +6 -7
  192. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/utils/pooling.py +17 -17
  193. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/utils/softmax.py +12 -13
  194. fla_core-0.4.1/fla/ops/utils/softplus.py +104 -0
  195. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/utils/solve_tril.py +35 -24
  196. {fla_core-0.3.2 → fla_core-0.4.1}/fla/utils.py +60 -29
  197. {fla_core-0.3.2 → fla_core-0.4.1}/fla_core.egg-info/PKG-INFO +37 -14
  198. {fla_core-0.3.2 → fla_core-0.4.1}/fla_core.egg-info/SOURCES.txt +14 -0
  199. fla_core-0.4.1/fla_core.egg-info/requires.txt +2 -0
  200. {fla_core-0.3.2 → fla_core-0.4.1}/pyproject.toml +2 -2
  201. fla_core-0.3.2/fla/ops/common/__init__.py +0 -1
  202. fla_core-0.3.2/fla/ops/common/chunk_scaled_dot_kkt.py +0 -305
  203. fla_core-0.3.2/fla/ops/gla/fused_chunk.py +0 -642
  204. fla_core-0.3.2/fla/ops/linear_attn/utils.py +0 -10
  205. fla_core-0.3.2/fla/ops/utils/__init__.py +0 -58
  206. fla_core-0.3.2/fla_core.egg-info/requires.txt +0 -2
  207. {fla_core-0.3.2 → fla_core-0.4.1}/LICENSE +0 -0
  208. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/gated_delta_product/naive.py +0 -0
  209. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/log_linear_attn/naive.py +0 -0
  210. {fla_core-0.3.2 → fla_core-0.4.1}/fla/ops/mesa_net/__init__.py +0 -0
  211. {fla_core-0.3.2 → fla_core-0.4.1}/fla_core.egg-info/dependency_links.txt +0 -0
  212. {fla_core-0.3.2 → fla_core-0.4.1}/fla_core.egg-info/top_level.txt +0 -0
  213. {fla_core-0.3.2 → fla_core-0.4.1}/setup.cfg +0 -0
@@ -1,13 +1,13 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fla-core
3
- Version: 0.3.2
3
+ Version: 0.4.1
4
4
  Summary: Core operations for flash-linear-attention
5
5
  Project-URL: Homepage, https://github.com/fla-org/flash-linear-attention
6
6
  Project-URL: Repository, https://github.com/fla-org/flash-linear-attention
7
7
  Requires-Python: >=3.10
8
8
  Description-Content-Type: text/markdown
9
9
  License-File: LICENSE
10
- Requires-Dist: torch>=2.5
10
+ Requires-Dist: torch
11
11
  Requires-Dist: einops
12
12
  Dynamic: license-file
13
13
 
@@ -38,12 +38,13 @@ This repo aims at providing a collection of efficient Triton-based implementatio
38
38
  * [Benchmarks](#benchmarks)
39
39
  * [Citation](#citation)
40
40
  * [Star History](#star-history)
41
- * [Acknowledgments](#acknowledgments)
41
+ * [Acknowledgements](#acknowledgements)
42
42
 
43
43
  ## News
44
44
 
45
- - **$\texttt{[2025-09]}$:** 🐻 Thrilled to announce that [GDN](fla/ops/gated_delta_rule) has been integrated into Qwen3-Next.
46
- Check out [the PR](https://github.com/huggingface/transformers/pull/40771) and [their blog post](https://qwenlm.github.io/blog/qwen3_next/) for more infos!
45
+ - **$\texttt{[2025-10]}$:** 🌑 Add Kimi Delta Attention implementation to `fla` ([paper](https://arxiv.org/abs/2510.26692)).
46
+ - **$\texttt{[2025-09]}$:** 🌲 Add DeltaFormer implementation to `fla` ([paper](https://arxiv.org/abs/2505.19488v1)).
47
+ - **$\texttt{[2025-09]}$:** 🐻 Thrilled to announce that [GDN](fla/ops/gated_delta_rule) has been integrated into Qwen3-Next. Check out their [blog post](https://qwen.ai/blog?id=4074cca80393150c248e508aa62983f9cb7d27cd&from=research.latest-advancements-list) for more infos!
47
48
  - **$\texttt{[2025-08]}$:** 🌲 Add Log-Linear Attention implementation to `fla` ([paper](https://arxiv.org/abs/2506.04761)).
48
49
  - **$\texttt{[2025-08]}$:** 🎓 Add MoM implementation to `fla` ([paper](https://arxiv.org/abs/2502.13685)).
49
50
  - **$\texttt{[2025-07]}$:** 🐳 Add MLA implementation to `fla` ([paper](https://arxiv.org/abs/2405.04434)).
@@ -99,6 +100,8 @@ Roughly sorted according to the timeline supported in `fla`. The recommended tra
99
100
  | 2025 | | PaTH | [PaTH Attention: Position Encoding via Accumulating Householder Transformations](https://arxiv.org/abs/2505.16381) | | [fla](https://github.com/fla-org/flash-linear-attention/blob/main/fla/layers/path_attn.py) |
100
101
  | 2025 | | MoM | [MoM: Linear Sequence Modeling with Mixture-of-Memories](https://arxiv.org/abs/2502.13685) | [official](https://github.com/OpenSparseLLMs/MoM) | [fla](https://github.com/fla-org/flash-linear-attention/blob/main/fla/layers/mom.py) |
101
102
  | 2025 | | Log-Linear Attention | [Log-Linear Attention](https://arxiv.org/abs/2506.04761) | [official](https://github.com/HanGuo97/log-linear-attention) | [fla](https://github.com/fla-org/flash-linear-attention/tree/main/fla/ops/log_linear_attn) |
103
+ | 2025 | | DeltaFormer | [Understanding Transformer from the Perspective of Associative Memory](https://arxiv.org/abs/2505.19488v1) | | [fla](https://github.com/fla-org/flash-linear-attention/blob/main/fla/layers/deltaformer.py) |
104
+ | 2025 | | KDA | [Kimi Linear: An Expressive, Efficient Attention Architecture](https://arxiv.org/abs/2510.26692) | | [fla](https://github.com/fla-org/flash-linear-attention/tree/main/fla/ops/kda) |
102
105
 
103
106
  ## Installation
104
107
 
@@ -110,16 +113,18 @@ The following requirements should be satisfied
110
113
  - [einops](https://einops.rocks/)
111
114
  - [transformers](https://github.com/huggingface/transformers) >=4.45.0
112
115
  - [datasets](https://github.com/huggingface/datasets) >=3.3.0
113
- - [causal-conv1d](https://github.com/Dao-AILab/causal-conv1d) >=1.4.0
116
+
117
+ Starting from v0.3.2, the packages published on PyPI are `fla-core` and `flash-linear-attention`. The former contains all our customized kernels and only depends on PyTorch, Triton, and einops. The latter is an extension package of the former, containing `fla/layers` and `fla/models`, and depends on transformers. We also provide Triton implementations for conv1d operations, so causal-conv1d is not required.
114
118
 
115
119
  You can install `fla` with pip:
116
120
  ```sh
117
121
  pip install flash-linear-attention
118
122
  ```
119
- As `fla` is actively developed now, for the latest features and updates, an alternative way is to install the package from source
123
+
124
+ As `fla` is actively developed now, for the latest features and updates, an alternative way is to install the package from source. Note that installing from git uses the default mode, so you need to uninstall both `fla-core` and `flash-linear-attention` first:
120
125
  ```sh
121
- # uninstall `fla` first to ensure a successful upgrade
122
- pip uninstall flash-linear-attention && pip install -U git+https://github.com/fla-org/flash-linear-attention
126
+ # uninstall both packages first to ensure a successful upgrade
127
+ pip uninstall fla-core flash-linear-attention -y && pip install -U git+https://github.com/fla-org/flash-linear-attention
123
128
  ```
124
129
  or manage `fla` with submodules
125
130
  ```sh
@@ -130,12 +135,15 @@ ln -s 3rdparty/flash-linear-attention/fla fla
130
135
  If you have installed `triton-nightly` and `torch` pre version, please use the following command:
131
136
  ```sh
132
137
  pip install einops ninja datasets transformers numpy
133
- pip uninstall flash-linear-attention && pip install -U --no-use-pep517 git+https://github.com/fla-org/flash-linear-attention --no-deps
138
+ # uninstall both packages first to ensure a successful upgrade
139
+ pip uninstall fla-core flash-linear-attention -y && pip install -U --no-use-pep517 git+https://github.com/fla-org/flash-linear-attention --no-deps
134
140
  ```
135
141
 
136
142
 
137
143
  ## Usage
138
144
 
145
+ [![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/fla-org/flash-linear-attention)
146
+
139
147
  ### Token Mixing
140
148
 
141
149
  We provide ``token mixing'' linear attention layers in `fla.layers` for you to use.
@@ -527,9 +535,25 @@ If you find this repository helpful, please cite our work:
527
535
  year = {2024}
528
536
  }
529
537
 
538
+ @misc{zhang2025kda,
539
+ title = {Kimi Linear: An Expressive, Efficient Attention Architecture},
540
+ author = {Zhang, Yu and Lin, Zongyu and Yao, Xingcheng and Hu, Jiaxi and Meng, Fanqing and Liu, Chengyin and Men, Xin and Yang, Songlin and Li, Zhiyuan and Li, Wentao and Lu, Enzhe and Liu, Weizhou and Chen, Yanru and Xu, Weixin and Yu, Longhui and Wang, Yejie and Fan, Yu and Zhong, Longguang and Yuan, Enming and Zhang, Dehao and Zhang, Yizhi and T. Liu, Y. and Wang, Haiming and Fang, Shengjun and He, Weiran and Liu, Shaowei and Li, Yiwei and Su, Jianlin and Qiu, Jiezhong and Pang, Bo and Yan, Junjie and Jiang, Zhejun and Huang, Weixiao and Yin, Bohong and You, Jiacheng and Wei, Chu and Wang, Zhengtao and Hong, Chao and Chen, Yutian and Chen, Guanduo and Wang, Yucheng and Zheng, Huabin and Wang, Feng and Liu, Yibo and Dong, Mengnan and Zhang, Zheng and Pan, Siyuan and Wu, Wenhao and Wu, Yuhao and Guan, Longyu and Tao, Jiawen and Fu, Guohong and Xu, Xinran and Wang, Yuzhi and Lai, Guokun and Wu, Yuxin and Zhou, Xinyu and Yang, Zhilin and Du, Yulun},
541
+ year = {2025},
542
+ eprint = {2510.26692},
543
+ archivePrefix = {arXiv},
544
+ primaryClass = {cs.CL}
545
+ }
546
+
547
+ @inproceedings{yang2025path,
548
+ title = {PaTH Attention: Position Encoding via Accumulating Householder Transformations},
549
+ author = {Yang, Songlin and Shen, Yikang and Wen, Kaiyue and Tan, Shawn and Mishra, Mayank and Ren, Liliang and Panda, Rameswar and Kim, Yoon},
550
+ booktitle = {Proceedings of NeurIPS},
551
+ year = {2025}
552
+ }
553
+
530
554
  @inproceedings{yang2024gdn,
531
555
  title = {Gated Delta Networks: Improving Mamba2 with Delta Rule},
532
- author = {Songlin Yang and Jan Kautz and Ali Hatamizadeh},
556
+ author = {Yang, Songlin and Kautz, Jan and Hatamizadeh, Ali},
533
557
  booktitle = {Proceedings of ICLR},
534
558
  year = {2025}
535
559
  }
@@ -567,9 +591,8 @@ If you find this repository helpful, please cite our work:
567
591
 
568
592
  [![Stargazers repo roster for @fla-org/flash-linear-attention](https://bytecrank.com/nastyox/reporoster/php/stargazersSVG.php?user=fla-org&repo=flash-linear-attention)](https://github.com/fla-org/flash-linear-attention/stargazers)
569
593
 
570
-
571
594
  [![Star History Chart](https://api.star-history.com/svg?repos=fla-org/flash-linear-attention&type=Date)](https://star-history.com/#fla-org/flash-linear-attention&Date)
572
595
 
573
- ## Acknowledgments
596
+ ## Acknowledgements
574
597
 
575
- We extend our gratitude to [Bitdeer](https://www.bitdeer.com/) for providing CI server resources that power our infrastructure.
598
+ We extend our gratitude to [Bitdeer](https://www.bitdeer.com/) and [Moonshot AI](https://www.moonshot.ai/) for their support in maintaining and powering our project infrastructure.
@@ -25,12 +25,13 @@ This repo aims at providing a collection of efficient Triton-based implementatio
25
25
  * [Benchmarks](#benchmarks)
26
26
  * [Citation](#citation)
27
27
  * [Star History](#star-history)
28
- * [Acknowledgments](#acknowledgments)
28
+ * [Acknowledgements](#acknowledgements)
29
29
 
30
30
  ## News
31
31
 
32
- - **$\texttt{[2025-09]}$:** 🐻 Thrilled to announce that [GDN](fla/ops/gated_delta_rule) has been integrated into Qwen3-Next.
33
- Check out [the PR](https://github.com/huggingface/transformers/pull/40771) and [their blog post](https://qwenlm.github.io/blog/qwen3_next/) for more infos!
32
+ - **$\texttt{[2025-10]}$:** 🌑 Add Kimi Delta Attention implementation to `fla` ([paper](https://arxiv.org/abs/2510.26692)).
33
+ - **$\texttt{[2025-09]}$:** 🌲 Add DeltaFormer implementation to `fla` ([paper](https://arxiv.org/abs/2505.19488v1)).
34
+ - **$\texttt{[2025-09]}$:** 🐻 Thrilled to announce that [GDN](fla/ops/gated_delta_rule) has been integrated into Qwen3-Next. Check out their [blog post](https://qwen.ai/blog?id=4074cca80393150c248e508aa62983f9cb7d27cd&from=research.latest-advancements-list) for more infos!
34
35
  - **$\texttt{[2025-08]}$:** 🌲 Add Log-Linear Attention implementation to `fla` ([paper](https://arxiv.org/abs/2506.04761)).
35
36
  - **$\texttt{[2025-08]}$:** 🎓 Add MoM implementation to `fla` ([paper](https://arxiv.org/abs/2502.13685)).
36
37
  - **$\texttt{[2025-07]}$:** 🐳 Add MLA implementation to `fla` ([paper](https://arxiv.org/abs/2405.04434)).
@@ -86,6 +87,8 @@ Roughly sorted according to the timeline supported in `fla`. The recommended tra
86
87
  | 2025 | | PaTH | [PaTH Attention: Position Encoding via Accumulating Householder Transformations](https://arxiv.org/abs/2505.16381) | | [fla](https://github.com/fla-org/flash-linear-attention/blob/main/fla/layers/path_attn.py) |
87
88
  | 2025 | | MoM | [MoM: Linear Sequence Modeling with Mixture-of-Memories](https://arxiv.org/abs/2502.13685) | [official](https://github.com/OpenSparseLLMs/MoM) | [fla](https://github.com/fla-org/flash-linear-attention/blob/main/fla/layers/mom.py) |
88
89
  | 2025 | | Log-Linear Attention | [Log-Linear Attention](https://arxiv.org/abs/2506.04761) | [official](https://github.com/HanGuo97/log-linear-attention) | [fla](https://github.com/fla-org/flash-linear-attention/tree/main/fla/ops/log_linear_attn) |
90
+ | 2025 | | DeltaFormer | [Understanding Transformer from the Perspective of Associative Memory](https://arxiv.org/abs/2505.19488v1) | | [fla](https://github.com/fla-org/flash-linear-attention/blob/main/fla/layers/deltaformer.py) |
91
+ | 2025 | | KDA | [Kimi Linear: An Expressive, Efficient Attention Architecture](https://arxiv.org/abs/2510.26692) | | [fla](https://github.com/fla-org/flash-linear-attention/tree/main/fla/ops/kda) |
89
92
 
90
93
  ## Installation
91
94
 
@@ -97,16 +100,18 @@ The following requirements should be satisfied
97
100
  - [einops](https://einops.rocks/)
98
101
  - [transformers](https://github.com/huggingface/transformers) >=4.45.0
99
102
  - [datasets](https://github.com/huggingface/datasets) >=3.3.0
100
- - [causal-conv1d](https://github.com/Dao-AILab/causal-conv1d) >=1.4.0
103
+
104
+ Starting from v0.3.2, the packages published on PyPI are `fla-core` and `flash-linear-attention`. The former contains all our customized kernels and only depends on PyTorch, Triton, and einops. The latter is an extension package of the former, containing `fla/layers` and `fla/models`, and depends on transformers. We also provide Triton implementations for conv1d operations, so causal-conv1d is not required.
101
105
 
102
106
  You can install `fla` with pip:
103
107
  ```sh
104
108
  pip install flash-linear-attention
105
109
  ```
106
- As `fla` is actively developed now, for the latest features and updates, an alternative way is to install the package from source
110
+
111
+ As `fla` is actively developed now, for the latest features and updates, an alternative way is to install the package from source. Note that installing from git uses the default mode, so you need to uninstall both `fla-core` and `flash-linear-attention` first:
107
112
  ```sh
108
- # uninstall `fla` first to ensure a successful upgrade
109
- pip uninstall flash-linear-attention && pip install -U git+https://github.com/fla-org/flash-linear-attention
113
+ # uninstall both packages first to ensure a successful upgrade
114
+ pip uninstall fla-core flash-linear-attention -y && pip install -U git+https://github.com/fla-org/flash-linear-attention
110
115
  ```
111
116
  or manage `fla` with submodules
112
117
  ```sh
@@ -117,12 +122,15 @@ ln -s 3rdparty/flash-linear-attention/fla fla
117
122
  If you have installed `triton-nightly` and `torch` pre version, please use the following command:
118
123
  ```sh
119
124
  pip install einops ninja datasets transformers numpy
120
- pip uninstall flash-linear-attention && pip install -U --no-use-pep517 git+https://github.com/fla-org/flash-linear-attention --no-deps
125
+ # uninstall both packages first to ensure a successful upgrade
126
+ pip uninstall fla-core flash-linear-attention -y && pip install -U --no-use-pep517 git+https://github.com/fla-org/flash-linear-attention --no-deps
121
127
  ```
122
128
 
123
129
 
124
130
  ## Usage
125
131
 
132
+ [![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/fla-org/flash-linear-attention)
133
+
126
134
  ### Token Mixing
127
135
 
128
136
  We provide ``token mixing'' linear attention layers in `fla.layers` for you to use.
@@ -514,9 +522,25 @@ If you find this repository helpful, please cite our work:
514
522
  year = {2024}
515
523
  }
516
524
 
525
+ @misc{zhang2025kda,
526
+ title = {Kimi Linear: An Expressive, Efficient Attention Architecture},
527
+ author = {Zhang, Yu and Lin, Zongyu and Yao, Xingcheng and Hu, Jiaxi and Meng, Fanqing and Liu, Chengyin and Men, Xin and Yang, Songlin and Li, Zhiyuan and Li, Wentao and Lu, Enzhe and Liu, Weizhou and Chen, Yanru and Xu, Weixin and Yu, Longhui and Wang, Yejie and Fan, Yu and Zhong, Longguang and Yuan, Enming and Zhang, Dehao and Zhang, Yizhi and T. Liu, Y. and Wang, Haiming and Fang, Shengjun and He, Weiran and Liu, Shaowei and Li, Yiwei and Su, Jianlin and Qiu, Jiezhong and Pang, Bo and Yan, Junjie and Jiang, Zhejun and Huang, Weixiao and Yin, Bohong and You, Jiacheng and Wei, Chu and Wang, Zhengtao and Hong, Chao and Chen, Yutian and Chen, Guanduo and Wang, Yucheng and Zheng, Huabin and Wang, Feng and Liu, Yibo and Dong, Mengnan and Zhang, Zheng and Pan, Siyuan and Wu, Wenhao and Wu, Yuhao and Guan, Longyu and Tao, Jiawen and Fu, Guohong and Xu, Xinran and Wang, Yuzhi and Lai, Guokun and Wu, Yuxin and Zhou, Xinyu and Yang, Zhilin and Du, Yulun},
528
+ year = {2025},
529
+ eprint = {2510.26692},
530
+ archivePrefix = {arXiv},
531
+ primaryClass = {cs.CL}
532
+ }
533
+
534
+ @inproceedings{yang2025path,
535
+ title = {PaTH Attention: Position Encoding via Accumulating Householder Transformations},
536
+ author = {Yang, Songlin and Shen, Yikang and Wen, Kaiyue and Tan, Shawn and Mishra, Mayank and Ren, Liliang and Panda, Rameswar and Kim, Yoon},
537
+ booktitle = {Proceedings of NeurIPS},
538
+ year = {2025}
539
+ }
540
+
517
541
  @inproceedings{yang2024gdn,
518
542
  title = {Gated Delta Networks: Improving Mamba2 with Delta Rule},
519
- author = {Songlin Yang and Jan Kautz and Ali Hatamizadeh},
543
+ author = {Yang, Songlin and Kautz, Jan and Hatamizadeh, Ali},
520
544
  booktitle = {Proceedings of ICLR},
521
545
  year = {2025}
522
546
  }
@@ -554,9 +578,8 @@ If you find this repository helpful, please cite our work:
554
578
 
555
579
  [![Stargazers repo roster for @fla-org/flash-linear-attention](https://bytecrank.com/nastyox/reporoster/php/stargazersSVG.php?user=fla-org&repo=flash-linear-attention)](https://github.com/fla-org/flash-linear-attention/stargazers)
556
580
 
557
-
558
581
  [![Star History Chart](https://api.star-history.com/svg?repos=fla-org/flash-linear-attention&type=Date)](https://star-history.com/#fla-org/flash-linear-attention&Date)
559
582
 
560
- ## Acknowledgments
583
+ ## Acknowledgements
561
584
 
562
- We extend our gratitude to [Bitdeer](https://www.bitdeer.com/) for providing CI server resources that power our infrastructure.
585
+ We extend our gratitude to [Bitdeer](https://www.bitdeer.com/) and [Moonshot AI](https://www.moonshot.ai/) for their support in maintaining and powering our project infrastructure.
@@ -1,4 +1,4 @@
1
1
  # -*- coding: utf-8 -*-
2
2
 
3
3
  __path__ = __import__('pkgutil').extend_path(__path__, __name__)
4
- __version__ = '0.3.2'
4
+ __version__ = '0.4.1'
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
 
3
2
  from fla.modules.convolution import ImplicitLongConvolution, LongConvolution, ShortConvolution
4
3
  from fla.modules.fused_bitlinear import BitLinear, FusedBitLinear
@@ -11,7 +10,7 @@ from fla.modules.fused_norm_gate import (
11
10
  FusedLayerNormSwishGateLinear,
12
11
  FusedRMSNormGated,
13
12
  FusedRMSNormSwishGate,
14
- FusedRMSNormSwishGateLinear
13
+ FusedRMSNormSwishGateLinear,
15
14
  )
16
15
  from fla.modules.l2norm import L2Norm
17
16
  from fla.modules.layernorm import GroupNorm, GroupNormLinear, LayerNorm, LayerNormLinear, RMSNorm, RMSNormLinear
@@ -29,5 +28,5 @@ __all__ = [
29
28
  'FusedRMSNormGated', 'FusedRMSNormSwishGate', 'FusedRMSNormSwishGateLinear',
30
29
  'GatedMLP',
31
30
  'RotaryEmbedding',
32
- 'TokenShift'
31
+ 'TokenShift',
33
32
  ]
@@ -1,4 +1,3 @@
1
- # -*- coding: utf-8 -*-
2
1
  # Copyright (c) 2023-2025, Tri Dao, Yu Zhang, Songlin Yang.
3
2
 
4
3
  import torch
@@ -7,14 +6,14 @@ import triton
7
6
  import triton.language as tl
8
7
 
9
8
  from fla.ops.utils.op import exp, log
10
- from fla.utils import autocast_custom_bwd, autocast_custom_fwd, input_guard, is_amd
9
+ from fla.utils import IS_AMD, autocast_custom_bwd, autocast_custom_fwd, autotune_cache_kwargs, input_guard
11
10
 
12
11
  try:
13
12
  from torch.distributed.tensor import DTensor
14
13
  except (ImportError, AttributeError):
15
14
  DTensor = None
16
15
 
17
- NUM_WARPS_AUTOTUNE = [1, 2, 4, 8, 16] if is_amd else [1, 2, 4, 8, 16, 32]
16
+ NUM_WARPS_AUTOTUNE = [1, 2, 4, 8, 16] if IS_AMD else [1, 2, 4, 8, 16, 32]
18
17
 
19
18
 
20
19
  @triton.autotune(
@@ -23,14 +22,15 @@ NUM_WARPS_AUTOTUNE = [1, 2, 4, 8, 16] if is_amd else [1, 2, 4, 8, 16, 32]
23
22
  for bs in [512, 1024, 2048, 4096, 8192]
24
23
  for num_warps in NUM_WARPS_AUTOTUNE
25
24
  ],
26
- key=['D']
25
+ key=['D'],
26
+ **autotune_cache_kwargs,
27
27
  )
28
28
  @triton.jit(do_not_specialize=['T'])
29
29
  def sigmoid_fwd_kernel(
30
30
  x, y,
31
31
  T,
32
32
  B: tl.constexpr,
33
- D: tl.constexpr
33
+ D: tl.constexpr,
34
34
  ):
35
35
  pid = tl.program_id(0)
36
36
  offs = pid * B + tl.arange(0, B)
@@ -46,14 +46,15 @@ def sigmoid_fwd_kernel(
46
46
  for bs in [512, 1024, 2048, 4096, 8192]
47
47
  for num_warps in NUM_WARPS_AUTOTUNE
48
48
  ],
49
- key=['D']
49
+ key=['D'],
50
+ **autotune_cache_kwargs,
50
51
  )
51
52
  @triton.jit(do_not_specialize=['T'])
52
53
  def sigmoid_bwd_kernel(
53
54
  x, dy, dx,
54
55
  T,
55
56
  B: tl.constexpr,
56
- D: tl.constexpr
57
+ D: tl.constexpr,
57
58
  ):
58
59
  pid = tl.program_id(0)
59
60
  offs = pid * B + tl.arange(0, B)
@@ -101,7 +102,8 @@ sigmoid = SigmoidFunction.apply
101
102
  for bs in [512, 1024, 2048, 4096, 8192]
102
103
  for num_warps in NUM_WARPS_AUTOTUNE
103
104
  ],
104
- key=['D']
105
+ key=['D'],
106
+ **autotune_cache_kwargs,
105
107
  )
106
108
  @triton.jit(do_not_specialize=['T'])
107
109
  def logsigmoid_fwd_kernel(
@@ -110,7 +112,7 @@ def logsigmoid_fwd_kernel(
110
112
  temperature,
111
113
  T,
112
114
  B: tl.constexpr,
113
- D: tl.constexpr
115
+ D: tl.constexpr,
114
116
  ):
115
117
  i = tl.program_id(0)
116
118
  o_i = i * B + tl.arange(0, B)
@@ -129,7 +131,8 @@ def logsigmoid_fwd_kernel(
129
131
  for bs in [512, 1024, 2048, 4096, 8192]
130
132
  for num_warps in NUM_WARPS_AUTOTUNE
131
133
  ],
132
- key=['D']
134
+ key=['D'],
135
+ **autotune_cache_kwargs,
133
136
  )
134
137
  @triton.jit(do_not_specialize=['T'])
135
138
  def logsigmoid_bwd_kernel(
@@ -139,7 +142,7 @@ def logsigmoid_bwd_kernel(
139
142
  temperature,
140
143
  T,
141
144
  B: tl.constexpr,
142
- D: tl.constexpr
145
+ D: tl.constexpr,
143
146
  ):
144
147
  i = tl.program_id(0)
145
148
  o_i = i * B + tl.arange(0, B)
@@ -183,7 +186,7 @@ class LogSigmoidFunction(torch.autograd.Function):
183
186
  @staticmethod
184
187
  @input_guard
185
188
  def forward(ctx, x, temperature):
186
- ctx.save_for_backward(x,)
189
+ ctx.save_for_backward(x)
187
190
  ctx.temperature = temperature
188
191
  return logsigmoid_fwd(x, temperature)
189
192
 
@@ -204,14 +207,15 @@ def logsigmoid(x: torch.Tensor, temperature: float = 1.) -> torch.Tensor:
204
207
  for bs in [512, 1024, 2048, 4096, 8192]
205
208
  for num_warps in NUM_WARPS_AUTOTUNE
206
209
  ],
207
- key=['D']
210
+ key=['D'],
211
+ **autotune_cache_kwargs,
208
212
  )
209
213
  @triton.jit(do_not_specialize=['T'])
210
214
  def swish_fwd_kernel(
211
215
  x, y,
212
216
  T,
213
217
  B: tl.constexpr,
214
- D: tl.constexpr
218
+ D: tl.constexpr,
215
219
  ):
216
220
  pid = tl.program_id(0)
217
221
  offs = pid * B + tl.arange(0, B)
@@ -228,14 +232,15 @@ def swish_fwd_kernel(
228
232
  for bs in [512, 1024, 2048, 4096, 8192]
229
233
  for num_warps in NUM_WARPS_AUTOTUNE
230
234
  ],
231
- key=['D']
235
+ key=['D'],
236
+ **autotune_cache_kwargs,
232
237
  )
233
238
  @triton.jit(do_not_specialize=['T'])
234
239
  def swish_bwd_kernel(
235
240
  x, dy, dx,
236
241
  T,
237
242
  B: tl.constexpr,
238
- D: tl.constexpr
243
+ D: tl.constexpr,
239
244
  ):
240
245
  pid = tl.program_id(0)
241
246
  offs = pid * B + tl.arange(0, B)
@@ -400,14 +405,15 @@ sqrelu = SquaredReLUFunction.apply
400
405
  for bs in [512, 1024, 2048, 4096, 8192]
401
406
  for num_warps in NUM_WARPS_AUTOTUNE
402
407
  ],
403
- key=['D']
408
+ key=['D'],
409
+ **autotune_cache_kwargs,
404
410
  )
405
411
  @triton.jit(do_not_specialize=['T'])
406
412
  def swiglu_fwd_kernel(
407
413
  x, y, z,
408
414
  T,
409
415
  B: tl.constexpr,
410
- D: tl.constexpr
416
+ D: tl.constexpr,
411
417
  ):
412
418
  pid = tl.program_id(0)
413
419
  offs = pid * B + tl.arange(0, B)
@@ -428,7 +434,8 @@ def swiglu_fwd_kernel(
428
434
  for bs in [512, 1024, 2048, 4096, 8192]
429
435
  for num_warps in NUM_WARPS_AUTOTUNE
430
436
  ],
431
- key=['D']
437
+ key=['D'],
438
+ **autotune_cache_kwargs,
432
439
  )
433
440
  @triton.jit(do_not_specialize=['T'])
434
441
  def swiglu_fwdbwd_kernel(
@@ -436,7 +443,7 @@ def swiglu_fwdbwd_kernel(
436
443
  T,
437
444
  B: tl.constexpr,
438
445
  D: tl.constexpr,
439
- HAS_WEIGHT: tl.constexpr
446
+ HAS_WEIGHT: tl.constexpr,
440
447
  ):
441
448
  pid = tl.program_id(0)
442
449
  offs = pid * B + tl.arange(0, B)