Ejemplo n.º 1
0
    def emit_sequential_loop(self, codegen_state, iname, iname_dtype, lbound,
                             ubound, inner):
        ecm = codegen_state.expression_to_code_mapper

        from pymbolic import var
        from pymbolic.primitives import Comparison
        from pymbolic.mapper.stringifier import PREC_NONE
        from cgen import For, InlineInitializer

        return For(
            InlineInitializer(POD(self, iname_dtype, iname),
                              ecm(lbound, PREC_NONE, "i")),
            ecm(Comparison(var(iname), "<=", ubound), PREC_NONE, "i"),
            "++%s" % iname, inner)
Ejemplo n.º 2
0
    def emit_sequential_loop(self, codegen_state, iname, iname_dtype, lbound,
                             ubound, inner):
        ecm = codegen_state.expression_to_code_mapper

        from loopy.target.c import POD

        from pymbolic.mapper.stringifier import PREC_NONE
        from cgen import For, InlineInitializer

        from cgen.ispc import ISPCUniform

        return For(
            InlineInitializer(ISPCUniform(POD(self, iname_dtype, iname)),
                              ecm(lbound, PREC_NONE, "i")),
            ecm(p.Comparison(var(iname), "<=", ubound), PREC_NONE, "i"),
            "++%s" % iname, inner)