From 8c3c641ab93ea6c264dd55af715bda958e987c56 Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner <inform@tiker.net> Date: Thu, 18 Feb 2016 19:49:21 -0600 Subject: [PATCH] Tweak ispc target for ispc 1.9 --- loopy/target/ispc.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/loopy/target/ispc.py b/loopy/target/ispc.py index 4fcccf8ab..bd84819e2 100644 --- a/loopy/target/ispc.py +++ b/loopy/target/ispc.py @@ -43,7 +43,7 @@ class LoopyISPCCodeMapper(LoopyCCodeMapper): raise ValueError("unexpected index_type") def map_group_hw_index(self, expr, enclosing_prec, type_context): - return "((%s) taskIndex%d)" % (self._get_index_ctype(), expr.axis) + return "((uniform %s) taskIndex%d)" % (self._get_index_ctype(), expr.axis) def map_local_hw_index(self, expr, enclosing_prec, type_context): if expr.axis == 0: @@ -213,6 +213,24 @@ class ISPCTarget(CTarget): from cgen.ispc import ISPCUniform return ISPCUniform(result) + def emit_sequential_loop(self, codegen_state, iname, iname_dtype, + static_lbound, static_ubound, inner): + ecm = codegen_state.expression_to_code_mapper + + from loopy.symbolic import aff_to_expr + + from loopy.codegen import wrap_in + from pymbolic.mapper.stringifier import PREC_NONE + from cgen import For + + return wrap_in(For, + "uniform %s %s = %s" + % (self.dtype_to_typename(iname_dtype), + iname, ecm(aff_to_expr(static_lbound), PREC_NONE, "i")), + "%s <= %s" % ( + iname, ecm(aff_to_expr(static_ubound), PREC_NONE, "i")), + "++%s" % iname, + inner) # }}} # TODO: Generate launch code -- GitLab