diff --git a/loopy/codegen/__init__.py b/loopy/codegen/__init__.py index 872c0e58228ce3b12403997bcfde80985f17f94a..f2c04e2aa861d5b4d0907017b6c515824d0a7e63 100644 --- a/loopy/codegen/__init__.py +++ b/loopy/codegen/__init__.py @@ -188,7 +188,7 @@ class POD(PODBase): # {{{ main code generation entrypoint def generate_code(kernel, with_annotation=False, - allow_complex=False): + allow_complex=None): from cgen import (FunctionBody, FunctionDeclaration, Value, ArrayOf, Module, Block, Line, Const, LiteralLines, Initializer) @@ -196,6 +196,11 @@ def generate_code(kernel, with_annotation=False, from cgen.opencl import (CLKernel, CLGlobal, CLRequiredWorkGroupSize, CLLocal, CLImage, CLConstant) + allow_complex = False + for var in kernel.args + list(kernel.temporary_variables.itervalues()): + if var.dtype.kind == "c": + allow_complex = True + from loopy.codegen.expression import LoopyCCodeMapper ccm = (LoopyCCodeMapper(kernel, with_annotation=with_annotation, allow_complex=allow_complex)