diff --git a/loopy/codegen/bounds.py b/loopy/codegen/bounds.py index 7b90feb08b46c6c0103d241bb308d6f40f405417..c9e79f6bcc17f3ed3166dfc18cc012721410af6c 100644 --- a/loopy/codegen/bounds.py +++ b/loopy/codegen/bounds.py @@ -25,6 +25,7 @@ THE SOFTWARE. import islpy as isl from islpy import dim_type +from pymbolic.mapper.stringifier import PREC_NONE def constraint_to_code(ccm, cns): @@ -34,7 +35,7 @@ def constraint_to_code(ccm, cns): comp_op = ">=" from loopy.symbolic import constraint_to_expr - return "%s %s 0" % (ccm(constraint_to_expr(cns), 'i'), comp_op) + return "%s %s 0" % (ccm(constraint_to_expr(cns), PREC_NONE, "i"), comp_op) # {{{ bounds check generator diff --git a/loopy/codegen/instruction.py b/loopy/codegen/instruction.py index f6b103210ac9f5dcf0f615a8e3d9432ad51082fd..6ce16944230f42a25f4beecc21351e002ca21d53 100644 --- a/loopy/codegen/instruction.py +++ b/loopy/codegen/instruction.py @@ -1,7 +1,6 @@ """Code generation for Instruction objects.""" -from __future__ import division -from __future__ import absolute_import -from six.moves import range + +from __future__ import division, absolute_import __copyright__ = "Copyright (C) 2012 Andreas Kloeckner" @@ -26,8 +25,10 @@ THE SOFTWARE. """ +from six.moves import range import islpy as isl from loopy.codegen import GeneratedInstruction +from pymbolic.mapper.stringifier import PREC_NONE def wrap_in_conditionals(codegen_state, domain, check_inames, required_preds, stmt): @@ -92,7 +93,6 @@ def generate_expr_instruction_code(kernel, insn, codegen_state): (assignee_var_name, assignee_indices), = insn.assignees_and_indices() target_dtype = kernel.get_var_descriptor(assignee_var_name).dtype - from pymbolic.mapper.stringifier import PREC_NONE from cgen import Assign from loopy.codegen.expression import dtype_to_type_context lhs_code = ccm(insn.assignee, prec=PREC_NONE, type_context=None) @@ -123,7 +123,7 @@ def generate_expr_instruction_code(kernel, insn, codegen_state): if assignee_indices: printf_format += "[%s]" % ",".join(len(assignee_indices) * ["%d"]) printf_args.extend( - ccm(i, prec=None, type_context="i") + ccm(i, prec=PREC_NONE, type_context="i") for i in assignee_indices) if kernel.options.trace_assignment_values: @@ -186,5 +186,4 @@ def generate_c_instruction_code(kernel, insn, codegen_state): return Block(body) - # vim: foldmethod=marker diff --git a/loopy/codegen/loop.py b/loopy/codegen/loop.py index 70e52eb37d277aee457963e013aee793f8b86db4..f5e9c9f7fc87e24b47e193e6740a928f695cd3e2 100644 --- a/loopy/codegen/loop.py +++ b/loopy/codegen/loop.py @@ -29,6 +29,7 @@ from loopy.codegen import gen_code_block import islpy as isl from islpy import dim_type from loopy.codegen.control import build_loop_nest +from pymbolic.mapper.stringifier import PREC_NONE # {{{ conditional-reducing slab decomposition @@ -361,7 +362,7 @@ def generate_sequential_loop_dim_code(kernel, sched_index, codegen_state): # single-trip, generate just a variable assignment, not a loop result.append(gen_code_block([ Initializer(Const(POD(kernel.index_dtype, loop_iname)), - ccm(aff_to_expr(static_lbound), "i")), + ccm(aff_to_expr(static_lbound), PREC_NONE, "i")), Line(), inner, ])) @@ -373,8 +374,9 @@ def generate_sequential_loop_dim_code(kernel, sched_index, codegen_state): result.append(wrap_in(For, "%s %s = %s" % (dtype_to_ctype(kernel.index_dtype), - loop_iname, ccm(aff_to_expr(static_lbound), "i")), - "%s <= %s" % (loop_iname, ccm(aff_to_expr(static_ubound), "i")), + loop_iname, ccm(aff_to_expr(static_lbound), PREC_NONE, "i")), + "%s <= %s" % ( + loop_iname, ccm(aff_to_expr(static_ubound), PREC_NONE, "i")), "++%s" % loop_iname, inner))