@@ -330,7 +330,7 @@ def arg_to_str(self, x, lowerer, struct_lower=False, var_table=None, gen_copy=Fa
330
330
elif isinstance (arg_str , lir .instructions .AllocaInstr ):
331
331
decl = arg_str .get_decl ()
332
332
else :
333
- breakpoint ()
333
+ assert False , f"Don't know how to get decl string for variable { arg_str } of type { type ( arg_str ) } "
334
334
335
335
if struct_lower and isinstance (xtyp , types .npytypes .Array ):
336
336
dm = lowerer .context .data_model_manager .lookup (xtyp )
@@ -3550,9 +3550,7 @@ def _get_loop_kind(func_var, call_table):
3550
3550
if len (call ) == 0 :
3551
3551
return False
3552
3552
3553
- return call [0 ] # or call[0] == prange
3554
- #or call[0] == 'internal_prange' or call[0] == internal_prange
3555
- #$or call[0] == 'pndindex' or call[0] == pndindex)
3553
+ return call [0 ]
3556
3554
3557
3555
loop = loops [0 ]
3558
3556
entry = list (loop .entries )[0 ]
@@ -3744,19 +3742,18 @@ def _get_loop_kind(func_var, call_table):
3744
3742
size_var = range_args [1 ]
3745
3743
try :
3746
3744
step = self .func_ir .get_definition (range_args [2 ])
3745
+ # Only use get_definition to get a const if
3746
+ # available. Otherwise use the variable.
3747
+ if not isinstance (step , (int , ir .Const )):
3748
+ step = range_args [2 ]
3747
3749
except KeyError :
3748
- raise NotImplementedError (
3749
- "Only known step size is supported for prange" )
3750
- if not isinstance (step , ir .Const ):
3751
- raise NotImplementedError (
3752
- "Only constant step size is supported for prange" )
3753
- step = step .value
3754
- # if step != 1:
3755
- # print("unsupported step:", step, type(step))
3756
- # raise NotImplementedError(
3757
- # "Only constant step size of 1 is supported for prange")
3758
-
3759
- #assert(start == 0 or (isinstance(start, ir.Const) and start.value == 0))
3750
+ # If there is more than one definition possible for the
3751
+ # step variable then just use the variable and don't try
3752
+ # to convert to a const.
3753
+ step = range_args [2 ]
3754
+ if isinstance (step , ir .Const ):
3755
+ step = step .value
3756
+
3760
3757
if config .DEBUG_OPENMP >= 1 :
3761
3758
print ("size_var:" , size_var , type (size_var ))
3762
3759
@@ -3848,7 +3845,15 @@ def _get_loop_kind(func_var, call_table):
3848
3845
detect_step_assign = ir .Assign (ir .Const (0 , inst .loc ), step_var , inst .loc )
3849
3846
after_start .append (detect_step_assign )
3850
3847
3851
- step_assign = ir .Assign (ir .Const (step , inst .loc ), step_var , inst .loc )
3848
+ if isinstance (step , int ):
3849
+ step_assign = ir .Assign (ir .Const (step , inst .loc ), step_var , inst .loc )
3850
+ elif isinstance (step , ir .Var ):
3851
+ step_assign = ir .Assign (step , step_var , inst .loc )
3852
+ start_tags .append (openmp_tag ("QUAL.OMP.FIRSTPRIVATE" , step .name ))
3853
+ else :
3854
+ print ("Unsupported step:" , step , type (step ))
3855
+ raise NotImplementedError (
3856
+ f"Unknown step type that isn't a constant or variable but { type (step )} instead." )
3852
3857
scale_var = loop_index .scope .redefine ("$scale" , inst .loc )
3853
3858
fake_iternext = ir .Assign (ir .Const (0 , inst .loc ), iternext_inst .target , inst .loc )
3854
3859
fake_second = ir .Assign (ir .Const (0 , inst .loc ), pair_second_inst .target , inst .loc )
@@ -4606,9 +4611,7 @@ def some_data_clause_directive(self, args, start_tags, end_tags, lexer_count, ha
4606
4611
end_tags ,
4607
4612
scope )
4608
4613
vars_in_explicit_clauses , explicit_privates , non_user_explicits = self .get_explicit_vars (clauses )
4609
-
4610
4614
found_loop , blocks_for_io , blocks_in_region , entry_pred , exit_block , inst , size_var , step_var , latest_index , loop_index = prepare_out
4611
-
4612
4615
assert (found_loop )
4613
4616
else :
4614
4617
blocks_for_io = self .body_blocks
@@ -6363,15 +6366,13 @@ def omp_shared_array(size, dtype):
6363
6366
6364
6367
@overload (omp_shared_array , target = 'cpu' , inline = 'always' , prefer_literal = True )
6365
6368
def omp_shared_array_overload (size , dtype ):
6366
- breakpoint ()
6367
6369
assert isinstance (size , types .IntegerLiteral )
6368
6370
def impl (size , dtype ):
6369
6371
return np .empty (size , dtype = dtype )
6370
6372
return impl
6371
6373
6372
6374
@overload (omp_shared_array , target = 'cuda' , inline = 'always' , prefer_literal = True )
6373
6375
def omp_shared_array_overload (size , dtype ):
6374
- breakpoint ()
6375
6376
assert isinstance (size , types .IntegerLiteral )
6376
6377
def impl (size , dtype ):
6377
6378
return numba_cuda .shared .array (size , dtype )
0 commit comments