Skip to content

Split iname fails if instructions diverge under `within` argument

For reference, the following test fails --

import loopy as lp

knl = lp.make_kernel(
        "{[i]: 0<=i<16}",
        """
        c[i] = 3*d[i] {id=to_split}
        a[i] = 2*b[i] {id=not_to_split}
        """,
        lang_version=(2018, 2))

knl = lp.split_iname(knl, "i", 4, within='id:to_split')

for insn in knl.instructions:
    if insn.id == 'to_split':
        assert insn.within_inames == frozenset({'i_outer', 'i_inner'})
    if insn.id == 'not_to_split':
        assert insn.within_inames == frozenset({'i'})