Skip to content

Commit

Permalink
Remove deprecated versions of Func::prefetch() (#6698)
Browse files Browse the repository at this point in the history
  • Loading branch information
steven-johnson authored Apr 12, 2022
1 parent 3944fb0 commit 009d86f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 85 deletions.
20 changes: 0 additions & 20 deletions python_bindings/src/PyScheduleMethods.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,26 +88,6 @@ HALIDE_NEVER_INLINE void add_schedule_methods(PythonClass &class_instance) {

.def("hexagon", &T::hexagon, py::arg("x") = Var::outermost())

.def(
"prefetch", [](T &t, const Func &f, const VarOrRVar &var, int offset, PrefetchBoundStrategy strategy) -> T & {
// HALIDE_ATTRIBUTE_DEPRECATED("Call prefetch() with the two-var form instead.")
PyErr_WarnEx(PyExc_DeprecationWarning,
"Call prefetch() with the two-var form instead.",
1);
return t.prefetch(f, var, var, offset, strategy);
},
py::arg("image"), py::arg("var"), py::arg("offset") = 1, py::arg("strategy") = PrefetchBoundStrategy::GuardWithIf)
.def(
"prefetch", [](T &t, const ImageParam &image, const VarOrRVar &var, int offset, PrefetchBoundStrategy strategy) -> T & {
// HALIDE_ATTRIBUTE_DEPRECATED("Call prefetch() with the two-var form instead.")
PyErr_WarnEx(PyExc_DeprecationWarning,
"Call prefetch() with the two-var form instead.",
1);
// Templated function; specializing only on ImageParam for now
return t.template prefetch<ImageParam>(image, var, var, offset, strategy);
},
py::arg("image"), py::arg("var"), py::arg("offset") = 1, py::arg("strategy") = PrefetchBoundStrategy::GuardWithIf)

.def("prefetch", (T & (T::*)(const Func &, const VarOrRVar &, const VarOrRVar &, Expr, PrefetchBoundStrategy)) & T::prefetch, py::arg("func"), py::arg("at"), py::arg("from"), py::arg("offset") = 1, py::arg("strategy") = PrefetchBoundStrategy::GuardWithIf)
.def(
"prefetch", [](T &t, const ImageParam &image, const VarOrRVar &at, const VarOrRVar &from, const Expr &offset, PrefetchBoundStrategy strategy) -> T & {
Expand Down
69 changes: 4 additions & 65 deletions src/Func.h
Original file line number Diff line number Diff line change
Expand Up @@ -441,22 +441,6 @@ class Stage {

Stage &hexagon(const VarOrRVar &x = Var::outermost());

HALIDE_ATTRIBUTE_DEPRECATED("Call prefetch() with the two-var form instead.")
Stage &prefetch(const Func &f, const VarOrRVar &var, int offset = 1,
PrefetchBoundStrategy strategy = PrefetchBoundStrategy::GuardWithIf) {
return prefetch(f, var, var, offset, strategy);
}
HALIDE_ATTRIBUTE_DEPRECATED("Call prefetch() with the two-var form instead.")
Stage &prefetch(const Internal::Parameter &param, const VarOrRVar &var, int offset = 1,
PrefetchBoundStrategy strategy = PrefetchBoundStrategy::GuardWithIf) {
return prefetch(param, var, var, offset, strategy);
}
template<typename T>
HALIDE_ATTRIBUTE_DEPRECATED("Call prefetch() with the two-var form instead.")
Stage &prefetch(const T &image, VarOrRVar var, int offset = 1,
PrefetchBoundStrategy strategy = PrefetchBoundStrategy::GuardWithIf) {
return prefetch(image.parameter(), var, var, offset, strategy);
}
Stage &prefetch(const Func &f, const VarOrRVar &at, const VarOrRVar &from, Expr offset = 1,
PrefetchBoundStrategy strategy = PrefetchBoundStrategy::GuardWithIf);
Stage &prefetch(const Internal::Parameter &param, const VarOrRVar &at, const VarOrRVar &from, Expr offset = 1,
Expand Down Expand Up @@ -1941,55 +1925,7 @@ class Func {
Func &hexagon(const VarOrRVar &x = Var::outermost());

/** Prefetch data written to or read from a Func or an ImageParam by a
* subsequent loop iteration, at an optionally specified iteration offset.
* 'var' specifies at which loop level the prefetch calls should be inserted.
* The final argument specifies how prefetch of region outside bounds
* should be handled.
*
* For example, consider this pipeline:
\code
Func f, g;
Var x, y;
f(x, y) = x + y;
g(x, y) = 2 * f(x, y);
\endcode
*
* The following schedule:
\code
f.compute_root();
g.prefetch(f, x, 2, PrefetchBoundStrategy::NonFaulting);
\endcode
*
* will inject prefetch call at the innermost loop of 'g' and generate
* the following loop nest:
* for y = ...
* for x = ...
* f(x, y) = x + y
* for y = ..
* for x = ...
* prefetch(&f[x + 2, y], 1, 16);
* g(x, y) = 2 * f(x, y)
*/
// @{
HALIDE_ATTRIBUTE_DEPRECATED("Call prefetch() with the two-var form instead.")
Func &prefetch(const Func &f, const VarOrRVar &var, int offset = 1,
PrefetchBoundStrategy strategy = PrefetchBoundStrategy::GuardWithIf) {
return prefetch(f, var, var, offset, strategy);
}
HALIDE_ATTRIBUTE_DEPRECATED("Call prefetch() with the two-var form instead.")
Func &prefetch(const Internal::Parameter &param, const VarOrRVar &var, int offset = 1,
PrefetchBoundStrategy strategy = PrefetchBoundStrategy::GuardWithIf) {
return prefetch(param, var, var, offset, strategy);
}
template<typename T>
HALIDE_ATTRIBUTE_DEPRECATED("Call prefetch() with the two-var form instead.")
Func &prefetch(const T &image, VarOrRVar var, int offset = 1,
PrefetchBoundStrategy strategy = PrefetchBoundStrategy::GuardWithIf) {
return prefetch<T>(image, var, var, offset, strategy);
}
// @}

/** prefetch() is a more fine-grained version of prefetch(), which allows
* subsequent loop iteration, at an optionally specified iteration offset. You may specify
* specification of different vars for the location of the prefetch() instruction
* vs. the location that is being prefetched:
*
Expand All @@ -2000,6 +1936,9 @@ class Func {
* If 'at' and 'from' are distinct vars, then 'from' must be at a nesting level outside 'at.'
* Note that the value for 'offset' applies only to 'from', not 'at'.
*
* The final argument specifies how prefetch of region outside bounds
* should be handled.
*
* For example, consider this pipeline:
\code
Func f, g;
Expand Down

0 comments on commit 009d86f

Please sign in to comment.