@@ -130,8 +130,8 @@ def wrap_in_typecast(self, actual_type: LoopyType, needed_type: LoopyType, s):
130130 if actual_type != needed_type :
131131 registry = self .codegen_state .ast_builder .target .get_dtype_registry ()
132132 cast = var ("(%s) " % registry .dtype_to_ctype (needed_type ))
133-
134133 return cast (s )
134+
135135 return s
136136
137137 def rec (self , expr , type_context = None , needed_type : LoopyType | None = None ): # type: ignore[override]
@@ -283,10 +283,12 @@ def make_var(name):
283283 if (
284284 isinstance (ary , (ConstantArg , ArrayArg )) or
285285 (isinstance (ary , TemporaryVariable ) and ary .base_storage )):
286- # unsubscripted global args are pointers if they are inputs
287- result = self .make_subscript (ary ,
288- make_var (access_info .array_name ),
289- 0 )
286+ # unsubscripted global args are pointers
287+ result = self .make_subscript (
288+ ary ,
289+ make_var (access_info .array_name ),
290+ (0 ,))
291+
290292 else :
291293 # unsubscripted temp vars are scalars
292294 # (unless they use base_storage)
@@ -412,37 +414,9 @@ def map_remainder(self, expr, type_context):
412414 def map_if (self , expr , type_context ):
413415 from loopy .types import to_loopy_type
414416 result_type = self .infer_type (expr )
415- conditional_needed_loopy_type = to_loopy_type (np .bool_ )
416- if self .codegen_state .vectorization_info :
417- from loopy .codegen import UnvectorizableError
418- from loopy .expression import VectorizabilityChecker
419- checker = VectorizabilityChecker (self .codegen_state .kernel ,
420- self .codegen_state .vectorization_info .iname ,
421- self .codegen_state .vectorization_info .length )
422-
423- try :
424- is_vector = checker (expr )
425-
426- if is_vector :
427- """
428- We could have a vector literal here.
429- So we may need to type cast the condition.
430- OpenCL specification states that for ( c ? a : b)
431- to be vectorized appropriately c must have the same
432- number of elements in the vector as that of a and b.
433- Also each element must have the same number of bits,
434- and c must be an integral type.
435- """
436- index_type = to_loopy_type (np .int64 )
437- if type_context == "f" :
438- index_type = to_loopy_type (np .int32 )
439- conditional_needed_loopy_type = to_loopy_type (self .codegen_state .target .vector_dtype (index_type ,
440- self .codegen_state .vectorization_info .length ))
441- except UnvectorizableError :
442- pass
443417 return type (expr )(
444418 self .rec (expr .condition , type_context ,
445- conditional_needed_loopy_type ),
419+ to_loopy_type ( np . bool_ ) ),
446420 self .rec (expr .then , type_context , result_type ),
447421 self .rec (expr .else_ , type_context , result_type ),
448422 )
0 commit comments