Exemple #1
0
def test_join_inames(ctx_factory):
    ctx = ctx_factory()

    knl = lp.make_kernel(
        "{[i,j]: 0<=i,j<16}",
        ["b[i,j] = 2*a[i,j]"],
        [
            lp.GlobalArg("a", np.float32, shape=(
                16,
                16,
            )),
            lp.GlobalArg("b", np.float32, shape=(
                16,
                16,
            ))
        ],
    )

    ref_knl = knl

    knl = lp.add_prefetch(knl,
                          "a",
                          sweep_inames=["i", "j"],
                          default_tag="l.auto")
    knl = lp.join_inames(knl, ["a_dim_0", "a_dim_1"])

    lp.auto_test_vs_ref(ref_knl, ctx, knl, print_ref_code=True)
Exemple #2
0
def test_join_inames(ctx_factory):
    ctx = ctx_factory()

    knl = lp.make_kernel(
            "{[i,j]: 0<=i,j<16}",
            [
                "b[i,j] = 2*a[i,j]"
                ],
            [
                lp.GlobalArg("a", np.float32, shape=(16, 16,)),
                lp.GlobalArg("b", np.float32, shape=(16, 16,))
                ],
            )

    ref_knl = knl

    knl = lp.add_prefetch(knl, "a", sweep_inames=["i", "j"])
    knl = lp.join_inames(knl, ["a_dim_0", "a_dim_1"])

    lp.auto_test_vs_ref(ref_knl, ctx, knl, print_ref_code=True)