Skip to content

Commit d36cd04

Browse files
Change stub module names in Python to be _pystub rather than _stub (#6830)
This is a bit finicky, but making this the default nomenclature will make some downstream usages less ambiguous and a bit easier to manage. (Yes, I realize that #6821 removes the Makefile entirely, but until it lands, it needs fixing there too.)
1 parent 3e142cf commit d36cd04

3 files changed

Lines changed: 12 additions & 12 deletions

File tree

python_bindings/Makefile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ $(BIN)/%_generator.o: $(ROOT_DIR)/correctness/generators/%_generator.cpp $(HALID
9595
# In our build files here, we build both kinds of extension for every Generator in the generators/
9696
# directory (even though not all are used). As a simplistic way to distinguish between the two
9797
# sorts of extensions, we use the unadorned Generator name for AOT extensions, and the Generator name
98-
# suffixed with "_stub" for Stub extensions. (TODO: this is unsatisfyingly hackish; better suggestions
98+
# suffixed with "_pystub" for Stub extensions. (TODO: this is unsatisfyingly hackish; better suggestions
9999
# would be welcome.)
100100

101101
$(BIN)/PyStubImpl.o: $(ROOT_DIR)/stub/PyStubImpl.cpp $(HALIDE_DISTRIB_PATH)/include/Halide.h
@@ -186,21 +186,21 @@ $(BIN)/aot/%.so: $(BIN)/%.py.o $(BIN)/%.a $(BIN)/runtime.a $(BIN)/%.ldscript
186186
# Compiling PyStub.cpp, then linking with the generator's .o file, PyStubImpl.o, plus the same libHalide
187187
# being used by halide.so.
188188
#
189-
# Note that we set HALIDE_PYSTUB_MODULE_NAME to $*_stub (e.g. foo_stub) but
189+
# Note that we set HALIDE_PYSTUB_MODULE_NAME to $*_pystub (e.g. foo_pystub) but
190190
# set HALIDE_PYSTUB_GENERATOR_NAME to the unadorned name of the Generator.
191191
$(BIN)/%_PyStub.o: $(ROOT_DIR)/stub/PyStub.cpp
192192
@echo Building $@...
193193
@mkdir -p $(@D)
194-
@$(CXX) $(CCFLAGS) -DHALIDE_PYSTUB_MODULE_NAME=$*_stub -DHALIDE_PYSTUB_GENERATOR_NAME=$* -c $< -o $@
194+
@$(CXX) $(CCFLAGS) -DHALIDE_PYSTUB_MODULE_NAME=$*_pystub -DHALIDE_PYSTUB_GENERATOR_NAME=$* -c $< -o $@
195195

196-
$(BIN)/stub/%_stub.so: $(BIN)/%_PyStub.o $(BIN)/PyStubImpl.o $(BIN)/%_generator.o $(BIN)/%_stub.ldscript $(LIBHALIDE)
196+
$(BIN)/stub/%_pystub.so: $(BIN)/%_PyStub.o $(BIN)/PyStubImpl.o $(BIN)/%_generator.o $(BIN)/%_pystub.ldscript $(LIBHALIDE)
197197
@echo Building $@...
198198
@mkdir -p $(@D)
199-
@$(CXX) $(LDFLAGS) $(filter-out %.ldscript,$^) -shared $(subst %LDSCRIPT%,$(BIN)/$*_stub.ldscript,$(PYEXT_LDSCRIPT_FLAG)) -o $@
199+
@$(CXX) $(LDFLAGS) $(filter-out %.ldscript,$^) -shared $(subst %LDSCRIPT%,$(BIN)/$*_pystub.ldscript,$(PYEXT_LDSCRIPT_FLAG)) -o $@
200200

201201
GENERATOR_SRCS=$(shell ls $(ROOT_DIR)/correctness/generators/*_generator.cpp)
202202
GENERATOR_AOT_EXTENSIONS=$(GENERATOR_SRCS:$(ROOT_DIR)/correctness/generators/%_generator.cpp=$(BIN)/aot/%.so)
203-
GENERATOR_STUB_EXTENSIONS=$(GENERATOR_SRCS:$(ROOT_DIR)/correctness/generators/%_generator.cpp=$(BIN)/stub/%_stub.so)
203+
GENERATOR_STUB_EXTENSIONS=$(GENERATOR_SRCS:$(ROOT_DIR)/correctness/generators/%_generator.cpp=$(BIN)/stub/%_pystub.so)
204204

205205
APPS = $(shell ls $(ROOT_DIR)/apps/*.py)
206206
CORRECTNESS = $(shell ls $(ROOT_DIR)/correctness/*.py)

python_bindings/correctness/generators/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,5 @@ foreach (GEN IN LISTS GENERATORS)
3636
add_python_stub_extension(py_stub_${GEN}
3737
SOURCES ${GEN}_generator.cpp
3838
GENERATOR ${GEN}
39-
MODULE ${GEN}_stub)
39+
MODULE ${GEN}_pystub)
4040
endforeach ()

python_bindings/correctness/pystub.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11

22
import halide as hl
33

4-
import simple_stub
5-
import complex_stub
4+
import simple_pystub
5+
import complex_pystub
66

77
def _realize_and_check(f, offset = 0):
88
b = hl.Buffer(hl.Float(32), [2, 2])
@@ -284,6 +284,6 @@ def test_complex(gen):
284284
assert expected == actual, "Expected %s Actual %s" % (expected, actual)
285285

286286
if __name__ == "__main__":
287-
test_simple(simple_stub.generate)
288-
test_looplevel(simple_stub.generate)
289-
test_complex(complex_stub.generate)
287+
test_simple(simple_pystub.generate)
288+
test_looplevel(simple_pystub.generate)
289+
test_complex(complex_pystub.generate)

0 commit comments

Comments
 (0)