From 50fa18775ebfc5587ff757a4c11a91bbba8a4f02 Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner Date: Sun, 21 Jul 2013 15:09:39 -0400 Subject: [PATCH] Minor fixes to assignment tracing --- loopy/codegen/instruction.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/loopy/codegen/instruction.py b/loopy/codegen/instruction.py index f4d0caa05..92f8dc1b8 100644 --- a/loopy/codegen/instruction.py +++ b/loopy/codegen/instruction.py @@ -119,7 +119,10 @@ def generate_expr_instruction_code(kernel, insn, codegen_state): for i in assignee_indices) if kernel.flags.trace_assignment_values: - if target_dtype.kind == "f": + if target_dtype.kind == "i": + printf_format += " = %d" + printf_args.append(lhs_code) + elif target_dtype.kind == "f": printf_format += " = %g" printf_args.append(lhs_code) elif target_dtype.kind == "c": @@ -128,9 +131,14 @@ def generate_expr_instruction_code(kernel, insn, codegen_state): "(%s).x" % lhs_code, "(%s).y" % lhs_code]) + if printf_args: + printf_args_str = ", " + ", ".join(printf_args) + else: + printf_args_str = "" + printf_insn = GeneratedInstruction( - ast=S("printf(\"%s\\n\", %s)" % ( - printf_format, ", ".join(printf_args))), + ast=S("printf(\"%s\\n\"%s)" % ( + printf_format, printf_args_str)), implemented_domain=None) if kernel.flags.trace_assignment_values: -- GitLab