Skip to content

Commit

Permalink
Remove Python bindings from Makefiles
Browse files Browse the repository at this point in the history
  • Loading branch information
alexreinking committed Jun 27, 2022
1 parent 7373eb9 commit 4308897
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 262 deletions.
43 changes: 4 additions & 39 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 @@ -1152,7 +1150,7 @@ test_warning: $(WARNING_TESTS:$(ROOT_DIR)/test/warning/%.cpp=warning_%)
test_tutorial: $(TUTORIALS:$(ROOT_DIR)/tutorial/%.cpp=tutorial_%)
test_valgrind: $(CORRECTNESS_TESTS:$(ROOT_DIR)/test/correctness/%.cpp=valgrind_%)
test_avx512: $(CORRECTNESS_TESTS:$(ROOT_DIR)/test/correctness/%.cpp=avx512_%)
test_auto_schedule: test_mullapudi2016 test_li2018 test_adams2019
test_auto_schedule: test_mullapudi2016 test_adams2019

.PHONY: test_correctness_multi_gpu
test_correctness_multi_gpu: correctness_gpu_multi_device
Expand Down Expand Up @@ -1961,11 +1959,6 @@ test_adams2019: distrib
$(MAKE) -f $(SRC_DIR)/autoschedulers/adams2019/Makefile test \
HALIDE_DISTRIB_PATH=$(CURDIR)/$(DISTRIB_DIR)

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

time_compilation_test_%: $(BIN_DIR)/test_%
$(TIME_COMPILATION) compile_times_correctness.csv make -f $(THIS_MAKEFILE) $(@:time_compilation_test_%=test_%)

Expand Down Expand Up @@ -2000,20 +1993,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 @@ -2028,7 +2019,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 @@ -2037,7 +2027,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 @@ -2050,12 +2039,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 @@ -2069,34 +2057,11 @@ 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)

.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)

# It's just for compiling the runtime, so earlier clangs *might* work,
# but best to peg it to the minimum llvm version.
ifneq (,$(findstring clang version 3.7,$(CLANG_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
190 changes: 0 additions & 190 deletions python_bindings/Makefile

This file was deleted.

Loading

0 comments on commit 4308897

Please sign in to comment.