@@ -180,58 +180,3 @@ def test_lighting_indexer_forward(
180180
181181 # Accuracy comparison
182182 assert_close_inf (your_output , ref_output , 1e-2 )
183-
184-
185- @pytest .mark .triton_lighting_indexer_k_tiled_interface
186- @pytest .mark .parametrize ("seq_len_q" , [64 , 256 , 1024 ])
187- @pytest .mark .parametrize ("seq_len_kv" , [256 , 1024 , 2048 ])
188- @pytest .mark .parametrize ("num_heads" , [4 , 16 ])
189- @pytest .mark .parametrize ("qk_dim" , [32 , 64 ])
190- @pytest .mark .parametrize ("dtype" , [torch .bfloat16 , torch .float16 ])
191- def test_lighting_indexer_k_tiled_accuracy (
192- seq_len_q : int , seq_len_kv : int , num_heads : int , qk_dim : int , dtype : torch .dtype
193- ):
194- """Accuracy test for triton_lighting_indexer_k_tiled_interface."""
195- init_seed (42 )
196- S = seq_len_q
197- H = num_heads
198- D = qk_dim
199- SKV = seq_len_kv
200-
201- q = torch .randn ((S , H , D ), dtype = dtype , device = device )
202- kv = torch .randn ((SKV , D ), dtype = dtype , device = device )
203- weights = torch .randn ((S , H ), dtype = torch .float32 , device = device )
204-
205- ks , ke = generate_random_cu_seqlens (
206- per_cp_seqlen = S ,
207- cp_size = 3 ,
208- cp_rank = 4 ,
209- kv_stride = 1 ,
210- average_q_len = max (32 , S // 4 ),
211- )
212-
213- ref_output , _ = reference_lighting_indexer_implementation (q , kv , weights , ks , ke )
214- your_output = triton_lighting_indexer_k_tiled_interface (q , kv , weights , ks , ke )
215-
216- assert_close_inf (your_output , ref_output , 1e-2 )
217-
218-
219- @pytest .mark .triton_lighting_indexer_k_tiled_interface
220- @pytest .mark .parametrize ("kv_stride" , [1 , 2 , 4 ])
221- def test_lighting_indexer_k_tiled_kv_stride (kv_stride : int ):
222- """Test with different kv_stride values."""
223- init_seed (42 )
224- S , H , D , SKV = 128 , 8 , 64 , 512
225-
226- q = torch .randn ((S , H , D ), dtype = torch .bfloat16 , device = device )
227- kv = torch .randn ((SKV , D ), dtype = torch .bfloat16 , device = device )
228- weights = torch .randn ((S , H ), dtype = torch .float32 , device = device )
229-
230- ks , ke = generate_random_cu_seqlens (
231- per_cp_seqlen = S , cp_size = 3 , cp_rank = 4 , kv_stride = kv_stride , average_q_len = 64
232- )
233-
234- ref_output , _ = reference_lighting_indexer_implementation (q , kv , weights , ks , ke )
235- your_output = triton_lighting_indexer_k_tiled_interface (q , kv , weights , ks , ke )
236-
237- assert_close_inf (your_output , ref_output , 1e-2 )
0 commit comments