Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Understanding loop_priority #890

Open
inducer opened this issue Nov 28, 2024 Discussed in #889 · 1 comment
Open

Understanding loop_priority #890

inducer opened this issue Nov 28, 2024 Discussed in #889 · 1 comment

Comments

@inducer
Copy link
Owner

inducer commented Nov 28, 2024

Discussed in #889

Originally posted by connorjward November 28, 2024
I am trying to tackle a large number of warnings that loopy is now producing. Specifically we see a lot of:

/home/connor/Code/firedrake-dev3/src/loopy/loopy/schedule/__init__.py:2247: LoopyWarning: in kernel
 loopy_kernel: Falling back to a slow scheduler implementation due to: cannot schedule kernels with
 priority dependencies between sibling loop nests (add 'v1_scheduler_fallback' to silenced_warnings
 kernel attribute to disable)
  warn_with_kernel(

So far my attempts to address this have not worked. I was wondering if you could explain to me why the following produces the warnings:

import loopy as lp


knl = lp.make_kernel(
    [
        "{ [i]: 0 <= i < 5}",
        "{ [j]: 0 <= j < 5}",
        "{ [k]: 0 <= k < 5}",
    ],
    [
        lp.Assignment("x[i]", "x[i] + y[j]", within_inames=frozenset({"i", "j"}), id="id0"),
        lp.Assignment("x[i]", "x[i] + y[k]", within_inames=frozenset({"i", "k"}), depends_on=frozenset({"id0"})),
    ],
    [lp.GlobalArg("x", dtype=int), lp.GlobalArg("y", dtype=int)],
    loop_priority=frozenset({("i", "j"), ("i", "k")}),
    lang_version=(2018,2),
)

code = lp.generate_code_v2(knl)

AIUI the loop_priority I set here states that loop j must be inside i and that k must also be inside i. To me there is no 'priority dependency between sibling loop nests'.

Any help would be appreciated.

@connorjward
Copy link
Contributor

connorjward commented Dec 3, 2024

@inducer @kaushikcfd what are your thoughts? If the fix for this will take some time then I will temporarily remove loop priorities from Firedrake/PyOP2 as they are producing thousands of warnings during our CI. Actually I will just disable the warning. Though the improved codegen performance would be nice to have.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants