@@ -2634,3 +2634,39 @@ def test_get_num_warps():
26342634 print_num_warps ()
26352635 ttgl .warp_specialize ((), print_num_warps , (), [print_num_warps , print_num_warps , print_num_warps ], [1 , 2 , 8 ],
26362636 [24 , 24 , 24 ])
2637+
2638+
2639+ def test_non_scalar_loop_bounds ():
2640+
2641+ @gluon .jit
2642+ def kernel ():
2643+ x = ttgl .full ([32 ], 0 , ttgl .int32 , layout = ttgl .BlockedLayout ([1 ], [32 ], [1 ], [0 ]))
2644+ for _ in range (x , 10 , 1 ):
2645+ pass
2646+
2647+ with pytest .raises (CompilationError ) as e :
2648+ run_parser (kernel )
2649+
2650+ assert "For lower bound must be a scalar, got" in str (e .value )
2651+
2652+ @gluon .jit
2653+ def kernel ():
2654+ x = ttgl .full ([32 ], 0 , ttgl .int32 , layout = ttgl .BlockedLayout ([1 ], [32 ], [1 ], [0 ]))
2655+ for _ in range (1 , x , 1 ):
2656+ pass
2657+
2658+ with pytest .raises (CompilationError ) as e :
2659+ run_parser (kernel )
2660+
2661+ assert "For upper bound must be a scalar, got" in str (e .value )
2662+
2663+ @gluon .jit
2664+ def kernel ():
2665+ x = ttgl .full ([32 ], 0 , ttgl .int32 , layout = ttgl .BlockedLayout ([1 ], [32 ], [1 ], [0 ]))
2666+ for _ in range (1 , 10 , x ):
2667+ pass
2668+
2669+ with pytest .raises (CompilationError ) as e :
2670+ run_parser (kernel )
2671+
2672+ assert "For step must be a scalar, got" in str (e .value )
0 commit comments