@@ -366,7 +366,7 @@ def rand_kernel_tiled_1d(x: torch.Tensor, seed: int) -> torch.Tensor:
366366 "Different seeds should produce different outputs" ,
367367 )
368368
369- _ , output3 = code_and_output (rand_kernel_tiled_1d , (x_small , 42 ))
369+ code3 , output3 = code_and_output (rand_kernel_tiled_1d , (x_small , 42 ))
370370 self .assertTrue (
371371 torch .allclose (output , output3 ),
372372 "Same seed should produce identical outputs" ,
@@ -376,6 +376,8 @@ def rand_kernel_tiled_1d(x: torch.Tensor, seed: int) -> torch.Tensor:
376376 self .assertTrue (torch .all (output >= 0.0 ), "All values should be >= 0" )
377377 self .assertTrue (torch .all (output < 1.0 ), "All values should be < 1" )
378378
379+ self .assertIn ("tl.rand(seed, indices_0" , code3 )
380+
379381 def test_hl_rand_2d (self ):
380382 @helion .kernel
381383 def rand_kernel_tiled_2d (x : torch .Tensor , seed : int ) -> torch .Tensor :
@@ -394,14 +396,15 @@ def rand_kernel_tiled_2d(x: torch.Tensor, seed: int) -> torch.Tensor:
394396 "Different seeds should produce different outputs" ,
395397 )
396398
397- _ , output3 = code_and_output (rand_kernel_tiled_2d , (x_small , 42 ))
399+ code3 , output3 = code_and_output (rand_kernel_tiled_2d , (x_small , 42 ))
398400 self .assertTrue (
399401 torch .allclose (output , output3 ),
400402 "Same seed should produce identical outputs" ,
401403 )
402404
403405 self .assertTrue (torch .all (output >= 0.0 ), "All values should be >= 0" )
404406 self .assertTrue (torch .all (output < 1.0 ), "All values should be < 1" )
407+ self .assertIn ("tl.rand(seed, (offset_0 + tl.arange(0," , code3 )
405408
406409 def test_hl_rand_3d (self ):
407410 @helion .kernel
@@ -423,7 +426,7 @@ def rand_kernel_tiled_3d(x: torch.Tensor, seed: int) -> torch.Tensor:
423426 "Different seeds should produce different outputs" ,
424427 )
425428
426- _ , output3 = code_and_output (rand_kernel_tiled_3d , (x_small , 42 ))
429+ code3 , output3 = code_and_output (rand_kernel_tiled_3d , (x_small , 42 ))
427430 self .assertTrue (
428431 torch .allclose (output , output3 ),
429432 "Same seed should produce identical outputs" ,
@@ -438,6 +441,7 @@ def rand_kernel_tiled_3d(x: torch.Tensor, seed: int) -> torch.Tensor:
438441 0.4 < mean_val < 0.6 ,
439442 f"Mean { mean_val :.3f} should be around 0.5 for uniform distribution" ,
440443 )
444+ self .assertIn ("tl.rand(seed, (offset_0 + tl.arange(0," , code3 )
441445
442446
443447if __name__ == "__main__" :
0 commit comments