@@ -166,15 +166,20 @@ void run_mha_fwd_splitkv_dispatch(Flash_fwd_params ¶ms, cudaStream_t stream)
166166 // TD [2023-08-28]: nvcc segfaults for headdim 96 with block size 64 x 256,
167167 // and for headdim 192 with block size 64 x 128.
168168 constexpr static int kBlockN = Headdim <= 64 ? 256 : (Headdim <= 128 ? 128 : 64 );
169- // if user specifies num_splits=1, we assume they want bitwise identical
169+ #ifndef FLASHATTENTION_DISABLE_SPLIT_ALIGNMENT
170+ // If a user specifies num_splits=1, we assume they want bitwise identical
170171 // numerics across the split KV and standard kernels so we align kBLockN to
171- // match
172+ // match.
173+ // This compiles a second splitkv kernel tree (a different kBlockN), which
174+ // could push build time to hours+. Define FLASHATTENTION_DISABLE_SPLIT_ALIGNMENT
175+ // to skip.
172176 if (params.num_splits == 1 ) {
173177 constexpr static int kBlockN_standard = Headdim <= 64 ? 128 : 64 ;
174178 run_flash_splitkv_fwd<Flash_fwd_kernel_traits<Headdim, kBlockM , kBlockN_standard , 4 , false , false , T>, Is_causal>(params, stream);
175- } else {
176- run_flash_splitkv_fwd<Flash_fwd_kernel_traits<Headdim, kBlockM , kBlockN , 4 , false , false , T>, Is_causal>(params, stream);
179+ return ;
177180 }
181+ #endif
182+ run_flash_splitkv_fwd<Flash_fwd_kernel_traits<Headdim, kBlockM , kBlockN , 4 , false , false , T>, Is_causal>(params, stream);
178183}
179184
180185template <typename T, bool Is_causal>
0 commit comments