Skip to content
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
5 changes: 0 additions & 5 deletions python_bindings/src/PyFunc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -306,9 +306,6 @@ void define_func(py::module &m) {

.def("fold_storage", &Func::fold_storage, py::arg("dim"), py::arg("extent"), py::arg("fold_forward") = true)

.def("compute_with", (Func & (Func::*)(LoopLevel, const std::vector<std::pair<VarOrRVar, LoopAlignStrategy>> &)) & Func::compute_with, py::arg("loop_level"), py::arg("align"))
.def("compute_with", (Func & (Func::*)(LoopLevel, LoopAlignStrategy)) & Func::compute_with, py::arg("loop_level"), py::arg("align") = LoopAlignStrategy::Auto)

.def("infer_arguments", &Func::infer_arguments)

.def("__repr__", [](const Func &func) -> std::string {
Expand Down Expand Up @@ -359,8 +356,6 @@ void define_func(py::module &m) {

add_schedule_methods(func_class);

py::implicitly_convertible<ImageParam, Func>();

define_stage(m);
}

Expand Down
4 changes: 4 additions & 0 deletions python_bindings/src/PyScheduleMethods.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ HALIDE_NEVER_INLINE void add_schedule_methods(PythonClass &class_instance) {
py::arg("stage"), py::arg("var"), py::arg("align"))
.def("compute_with", (T & (T::*)(const Stage &, const VarOrRVar &, LoopAlignStrategy)) & T::compute_with,
py::arg("stage"), py::arg("var"), py::arg("align") = LoopAlignStrategy::Auto)
.def("compute_with", (T & (T::*)(LoopLevel, const std::vector<std::pair<VarOrRVar, LoopAlignStrategy>> &)) & T::compute_with,
py::arg("loop_level"), py::arg("align"))
.def("compute_with", (T & (T::*)(LoopLevel, LoopAlignStrategy)) & T::compute_with,
py::arg("loop_level"), py::arg("align") = LoopAlignStrategy::Auto)

.def("unroll", (T & (T::*)(const VarOrRVar &)) & T::unroll,
py::arg("var"))
Expand Down
12 changes: 6 additions & 6 deletions python_bindings/src/PyStage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@ namespace PythonBindings {
void define_stage(py::module &m) {
auto stage_class =
py::class_<Stage>(m, "Stage")
// for implicitly_convertible
.def(py::init([](const Func &f) -> Stage { return f; }))

.def("dump_argument_list", &Stage::dump_argument_list)
.def("name", &Stage::name)

.def("rfactor", (Func(Stage::*)(std::vector<std::pair<RVar, Var>>)) & Stage::rfactor,
py::arg("preserved"))
.def("rfactor", (Func(Stage::*)(const RVar &, const Var &)) & Stage::rfactor,
py::arg("r"), py::arg("v"))
py::arg("r"), py::arg("v"));

py::implicitly_convertible<Func, Stage>();

// These two variants of compute_with are specific to Stage
.def("compute_with", (Stage & (Stage::*)(LoopLevel, const std::vector<std::pair<VarOrRVar, LoopAlignStrategy>> &)) & Stage::compute_with,
py::arg("loop_level"), py::arg("align"))
.def("compute_with", (Stage & (Stage::*)(LoopLevel, LoopAlignStrategy)) & Stage::compute_with,
py::arg("loop_level"), py::arg("align") = LoopAlignStrategy::Auto);
add_schedule_methods(stage_class);
}

Expand Down