Skip to content

Commit

Permalink
Remove Python bindings from Makefiles (#6821)
Browse files Browse the repository at this point in the history
* Remove Python bindings from Makefiles

* Restore test_li2018 in Makefile (now C++-only)

* Add dummy `test_python` target for buildbots
  • Loading branch information
alexreinking committed Jun 30, 2022
1 parent ece5fb7 commit 60d2b98
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 324 deletions.
40 changes: 7 additions & 33 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,6 @@ LLVM_CXX_FLAGS = -std=c++17 $(filter-out -O% -g -fomit-frame-pointer -pedantic
OPTIMIZE ?= -O3
OPTIMIZE_FOR_BUILD_TIME ?= -O0

PYTHON ?= python3

CLANG ?= $(LLVM_BINDIR)/clang
CLANG_VERSION = $(shell $(CLANG) --version)

Expand Down Expand Up @@ -1946,8 +1944,7 @@ test_adams2019: distrib

test_li2018: distrib build_python_bindings
$(MAKE) -f $(SRC_DIR)/autoschedulers/li2018/Makefile test \
HALIDE_DISTRIB_PATH=$(CURDIR)/$(DISTRIB_DIR) \
HALIDE_PYTHON_BINDINGS_PATH=$(CURDIR)/$(BIN_DIR)/python3_bindings
HALIDE_DISTRIB_PATH=$(CURDIR)/$(DISTRIB_DIR)

time_compilation_test_%: $(BIN_DIR)/test_%
$(TIME_COMPILATION) compile_times_correctness.csv make -f $(THIS_MAKEFILE) $(@:time_compilation_test_%=test_%)
Expand Down Expand Up @@ -1982,20 +1979,18 @@ TEST_APPS=\
TEST_APPS_DEPS=$(TEST_APPS:%=%_test_app)
BUILD_APPS_DEPS=$(TEST_APPS:%=%_build_app)

$(BUILD_APPS_DEPS): distrib build_python_bindings
$(BUILD_APPS_DEPS): distrib
@echo Building app $(@:%_build_app=%) for ${HL_TARGET}...
@$(MAKE) -C $(ROOT_DIR)/apps/$(@:%_build_app=%) build \
HALIDE_DISTRIB_PATH=$(CURDIR)/$(DISTRIB_DIR) \
HALIDE_PYTHON_BINDINGS_PATH=$(CURDIR)/$(BIN_DIR)/python3_bindings \
BIN_DIR=$(CURDIR)/$(BIN_DIR)/apps/$(@:%_build_app=%)/bin \
HL_TARGET=$(HL_TARGET) \
|| exit 1 ; \

$(TEST_APPS_DEPS): distrib build_python_bindings
$(TEST_APPS_DEPS): distrib
@echo Testing app $(@:%_test_app=%) for ${HL_TARGET}...
@$(MAKE) -C $(ROOT_DIR)/apps/$(@:%_test_app=%) test \
HALIDE_DISTRIB_PATH=$(CURDIR)/$(DISTRIB_DIR) \
HALIDE_PYTHON_BINDINGS_PATH=$(CURDIR)/$(BIN_DIR)/python3_bindings \
BIN_DIR=$(CURDIR)/$(BIN_DIR)/apps/$(@:%_test_app=%)/bin \
HL_TARGET=$(HL_TARGET) \
|| exit 1 ; \
Expand All @@ -2010,7 +2005,6 @@ build_hannk: distrib
@echo Building apps/hannk for ${HL_TARGET}...
@$(MAKE) -C $(ROOT_DIR)/apps/hannk build \
HALIDE_DISTRIB_PATH=$(CURDIR)/$(DISTRIB_DIR) \
HALIDE_PYTHON_BINDINGS_PATH=$(CURDIR)/$(BIN_DIR)/python3_bindings \
BIN_DIR=$(CURDIR)/$(BIN_DIR)/apps/hannk/bin \
HL_TARGET=$(HL_TARGET) \
|| exit 1 ; \
Expand All @@ -2019,7 +2013,6 @@ test_hannk: build_hannk
@echo Testing apps/hannk for ${HL_TARGET}...
@$(MAKE) -C $(ROOT_DIR)/apps/hannk test \
HALIDE_DISTRIB_PATH=$(CURDIR)/$(DISTRIB_DIR) \
HALIDE_PYTHON_BINDINGS_PATH=$(CURDIR)/$(BIN_DIR)/python3_bindings \
BIN_DIR=$(CURDIR)/$(BIN_DIR)/apps/hannk/bin \
HL_TARGET=$(HL_TARGET) \
|| exit 1 ; \
Expand All @@ -2032,12 +2025,11 @@ BENCHMARK_APPS=\
nl_means \
stencil_chain

$(BENCHMARK_APPS): distrib build_python_bindings
$(BENCHMARK_APPS): distrib
@echo Building $@ for ${HL_TARGET}...
@$(MAKE) -C $(ROOT_DIR)/apps/$@ \
$(CURDIR)/$(BIN_DIR)/apps/$@/bin/$(HL_TARGET)/$@.rungen \
HALIDE_DISTRIB_PATH=$(CURDIR)/$(DISTRIB_DIR) \
HALIDE_PYTHON_BINDINGS_PATH=$(CURDIR)/$(BIN_DIR)/python3_bindings \
BIN_DIR=$(CURDIR)/$(BIN_DIR)/apps/$@/bin \
HL_TARGET=$(HL_TARGET) \
> /dev/null \
Expand All @@ -2051,33 +2043,15 @@ benchmark_apps: $(BENCHMARK_APPS)
make -C $(ROOT_DIR)/apps/$${APP} \
$${APP}.benchmark \
HALIDE_DISTRIB_PATH=$(CURDIR)/$(DISTRIB_DIR) \
HALIDE_PYTHON_BINDINGS_PATH=$(CURDIR)/$(BIN_DIR)/python3_bindings \
BIN_DIR=$(CURDIR)/$(BIN_DIR)/apps/$${APP}/bin \
HL_TARGET=$(HL_TARGET) \
|| exit 1 ; \
done

# TODO(srj): the python bindings need to be put into the distrib folders;
# this is a hopefully-temporary workaround (https://github.com/halide/Halide/issues/4368)
.PHONY: build_python_bindings
build_python_bindings: distrib $(BIN_DIR)/host/runtime.a
$(MAKE) -C $(ROOT_DIR)/python_bindings \
-f $(ROOT_DIR)/python_bindings/Makefile \
build_python_bindings \
HALIDE_DISTRIB_PATH=$(CURDIR)/$(DISTRIB_DIR) \
BIN=$(CURDIR)/$(BIN_DIR)/python3_bindings \
PYTHON=$(PYTHON) \
OPTIMIZE="$(OPTIMIZE)"

# TODO: remove this target after landing PR #6821
.PHONY: test_python
test_python: distrib $(BIN_DIR)/host/runtime.a build_python_bindings
$(MAKE) -C $(ROOT_DIR)/python_bindings \
-f $(ROOT_DIR)/python_bindings/Makefile \
test \
HALIDE_DISTRIB_PATH=$(CURDIR)/$(DISTRIB_DIR) \
BIN=$(CURDIR)/$(BIN_DIR)/python3_bindings \
PYTHON=$(PYTHON) \
OPTIMIZE="$(OPTIMIZE)"
test_python:
@echo "TODO: remove this target after landing PR #6821"

# It's just for compiling the runtime, so earlier clangs *might* work,
# but best to peg it to the minimum llvm version.
Expand Down
5 changes: 0 additions & 5 deletions apps/support/Makefile.inc
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@ IMAGES ?= ../images
UNAME ?= $(shell uname)
SHELL = bash
PYTHON ?= python3

# TODO(srj): the python bindings need to be put into the distrib folders;
# this is a hopefully-temporary workaround (https://github.com/halide/Halide/issues/4368)
HALIDE_PYTHON_BINDINGS_PATH ?= $(realpath ../../bin/python3_bindings)

BIN_DIR ?= bin

# Most build outputs go into $(BIN)/$(HL_TARGET)/$(HL_TARGET)/, so that you can vary the test
Expand Down
258 changes: 0 additions & 258 deletions python_bindings/Makefile

This file was deleted.

Loading

0 comments on commit 60d2b98

Please sign in to comment.