diff --git a/python_bindings/Makefile b/python_bindings/Makefile index 6c22e816304b..bc96a636646d 100644 --- a/python_bindings/Makefile +++ b/python_bindings/Makefile @@ -164,7 +164,7 @@ $(BIN)/ext/%.so: $(BIN)/%.py.o $(BIN)/%.a $(BIN)/runtime.a $(BIN)/ext/%.ldscript test_correctness_addconstant_test: $(BIN)/ext/addconstant.so test_correctness_bit_test: $(BIN)/ext/bit.so test_correctness_user_context_test: $(BIN)/ext/user_context.so -test_correctness_pystub: $(BIN)/generators/simplestub.so $(BIN)/generators/complexstub.so $(BIN)/generators/partialbuildmethod.so $(BIN)/generators/nobuildmethod.so +test_correctness_pystub: $(BIN)/generators/simplestub.so $(BIN)/generators/complexstub.so APPS = $(shell ls $(ROOT_DIR)/apps/*.py) CORRECTNESS = $(shell ls $(ROOT_DIR)/correctness/*.py) diff --git a/python_bindings/correctness/CMakeLists.txt b/python_bindings/correctness/CMakeLists.txt index 8c760705f3b0..e3085cca887e 100644 --- a/python_bindings/correctness/CMakeLists.txt +++ b/python_bindings/correctness/CMakeLists.txt @@ -1,7 +1,5 @@ set(GENERATORS complexstub_generator.cpp - nobuildmethod_generator.cpp - partialbuildmethod_generator.cpp simplestub_generator.cpp ) diff --git a/python_bindings/correctness/nobuildmethod_generator.cpp b/python_bindings/correctness/nobuildmethod_generator.cpp deleted file mode 100644 index 2d515e5a761b..000000000000 --- a/python_bindings/correctness/nobuildmethod_generator.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include "Halide.h" - -namespace { - -// This Generator exists solely to compare the output with BuildMethod and PartialBuildMethod. -class NoBuildMethod : public Halide::Generator { -public: - GeneratorParam compiletime_factor{"compiletime_factor", 1, 0, 100}; - - Input> input{"input"}; - Input runtime_factor{"runtime_factor", 1.0}; - Output> output{"output"}; - - void generate() { - Var x, y; - - output(x, y) = - cast(input(x, y) * compiletime_factor * runtime_factor); - } -}; - -} // namespace - -HALIDE_REGISTER_GENERATOR(NoBuildMethod, nobuildmethod) diff --git a/python_bindings/correctness/partialbuildmethod_generator.cpp b/python_bindings/correctness/partialbuildmethod_generator.cpp deleted file mode 100644 index cc5f7cf2516e..000000000000 --- a/python_bindings/correctness/partialbuildmethod_generator.cpp +++ /dev/null @@ -1,49 +0,0 @@ -#include "Halide.h" - -namespace { - -#ifdef HALIDE_ALLOW_GENERATOR_BUILD_METHOD -// This Generator exists solely to test converted old-style -// generators -- which use Input<> rather than Param/ImageParam, but *don't* use -// Output<>/generate(). -// -// Do not convert it to new-style until/unless we decide to entirely remove -// support for those Generators. -class PartialBuildMethod : public Halide::Generator { -public: - GeneratorParam compiletime_factor{"compiletime_factor", 1, 0, 100}; - - Input> input{"input"}; - Input runtime_factor{"runtime_factor", 1.0}; - - Func build() { - Var x, y; - - Func g; - g(x, y) = - cast(input(x, y) * compiletime_factor * runtime_factor); - return g; - } -}; -#else -// Provide a placeholder here that uses generate(), just to allow this test to -// succeed even if build() is disabled. -class PartialBuildMethod : public Halide::Generator { -public: - GeneratorParam compiletime_factor{"compiletime_factor", 1, 0, 100}; - - Input> input{"input"}; - Input runtime_factor{"runtime_factor", 1.0}; - Output> output{"output"}; - - void generate() { - Var x, y; - - output(x, y) = cast(input(x, y) * compiletime_factor * runtime_factor); - } -}; -#endif - -} // namespace - -HALIDE_REGISTER_GENERATOR(PartialBuildMethod, partialbuildmethod) diff --git a/python_bindings/correctness/pystub.py b/python_bindings/correctness/pystub.py index ed284c9cf5b8..280de4a5359c 100644 --- a/python_bindings/correctness/pystub.py +++ b/python_bindings/correctness/pystub.py @@ -5,9 +5,6 @@ # test alternate-but-legal syntax from complexstub import generate as complexstub -import partialbuildmethod -import nobuildmethod - def _realize_and_check(f, offset = 0): b = hl.Buffer(hl.Float(32), [2, 2]) f.realize(b) @@ -260,41 +257,7 @@ def test_complexstub(): actual = b[x, y] assert expected == actual, "Expected %s Actual %s" % (expected, actual) -# disabled because HALIDE_ALLOW_GENERATOR_BUILD_METHOD is off by default -def test_partialbuildmethod(): - x, y, c = hl.Var(), hl.Var(), hl.Var() - target = hl.get_jit_target_from_environment() - - b_in = hl.Buffer(hl.Float(32), [2, 2]) - b_in.fill(123) - - b_out = hl.Buffer(hl.Int(32), [2, 2]) - - try: - f = partialbuildmethod.generate(target, b_in, 1.0) - except RuntimeError as e: - assert "Generators that use build() (instead of generate()+Output<>) are not supported in the Python bindings." in str(e) - else: - assert False, 'Did not see expected exception!' - -def test_nobuildmethod(): - x, y, c = hl.Var(), hl.Var(), hl.Var() - target = hl.get_jit_target_from_environment() - - b_in = hl.Buffer(hl.Float(32), [2, 2]) - b_in.fill(123) - - b_out = hl.Buffer(hl.Int(32), [2, 2]) - - f = nobuildmethod.generate(target, b_in, 1.0) - f.realize(b_out) - - assert b_out.all_equal(123) - if __name__ == "__main__": test_simplestub() test_looplevel() test_complexstub() - # disabled because HALIDE_ALLOW_GENERATOR_BUILD_METHOD is off by default - # test_partialbuildmethod() - test_nobuildmethod()