Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Python bindings from Makefiles #6821

Merged
merged 5 commits into from
Jun 30, 2022
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
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think some of the apps may require the python bindings... maybe onnx? Not sure

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I said in the PR description that apps/onnx and apps/HelloPyTorch might break. Was going to wait and see.

$(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