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

Use warn_with_kernel for V1-scheduler fallback #867

Merged
merged 2 commits into from
Sep 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions doc/tutorial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,8 @@ with identical bounds, for the use of the transpose:
... out[ii,jj] = 2*out[ii,jj] {dep=transpose}
... """,
... [lp.GlobalArg("out", shape=lp.auto, is_input=False), ...])
>>> knl = lp.prioritize_loops(knl, "i,j,ii,jj")
>>> knl = lp.prioritize_loops(knl, "i,j")
>>> knl = lp.prioritize_loops(knl, "ii,jj")

:func:`loopy.duplicate_inames` can be used to achieve the same goal.
Now the intended code is generated and our test passes.
Expand Down Expand Up @@ -957,7 +958,7 @@ Consider the following example:
... "{ [i_outer,i_inner, k]: "
... "0<= 16*i_outer + i_inner <n and 0<= i_inner,k <16}",
... """
... <> a_temp[i_inner] = a[16*i_outer + i_inner] {priority=10}
... <> a_temp[i_inner] = a[16*i_outer + i_inner]
... out[16*i_outer + i_inner] = sum(k, a_temp[k])
... """)
>>> knl = lp.tag_inames(knl, dict(i_outer="g.0", i_inner="l.0"))
Expand Down Expand Up @@ -1208,6 +1209,12 @@ Let us start with an example. Consider the kernel from above with a
... assumptions="n mod 16 = 0")
>>> prog = lp.split_iname(prog, "i", 16, inner_tag="l.0", outer_tag="g.0")

.. testsetup::

>>> prog = prog.with_kernel(
... prog.default_entrypoint.copy(
... silenced_warnings=["v1_scheduler_fallback"]))

Here is what happens when we try to generate code for the kernel:

>>> cgr = lp.generate_code_v2(prog)
Expand Down
6 changes: 4 additions & 2 deletions loopy/schedule/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2252,8 +2252,10 @@ def _generate_loop_schedules_inner(
return

except V2SchedulerNotImplementedError as e:
from warnings import warn
warn(f"Falling back to a slow scheduler implementation due to: {e}",
warn_with_kernel(
kernel,
"v1_scheduler_fallback",
f"Falling back to a slow scheduler implementation due to: {e}",
stacklevel=1)

schedule_count = 0
Expand Down
Loading