Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
a8f7acf
Move autoscheduler sources into dedicated folders
alexreinking Aug 30, 2020
5101b9d
Convert plugins to named-entry-point
alexreinking Aug 31, 2020
de65a60
Setting an autoscheduler now implies you want to use it.
alexreinking Aug 31, 2020
3c1f62a
Replace unset(v) with set(v "")
alexreinking Sep 9, 2020
8142c79
Use static initializers again; drop static plugin support
alexreinking Sep 2, 2020
163d954
Fix autoscheduler packaging.
alexreinking Sep 7, 2020
8ec729e
Fix auto schedule tests.
alexreinking Sep 7, 2020
2b9090c
Merge branch 'master' into refactor/autoschedulers
steven-johnson Sep 11, 2020
9ab8106
Use (and fix) export macros in Util.h
alexreinking Sep 11, 2020
646b049
Keep HALIDE_EXPORT defined.
alexreinking Sep 11, 2020
a0972ab
Add argc error messages to autoscheduler loads.
alexreinking Sep 11, 2020
cb7e36c
Flatten src/plugins/autoschedulers -> src/autoschedulers
alexreinking Sep 12, 2020
39c2082
Autoscheduler Makefile improvements
abadams Sep 12, 2020
c38582a
Merge branch 'refactor/autoschedulers' of https://github.com/halide/H…
abadams Sep 12, 2020
a4bc526
Makefile test and path fixes for the autoschedulers
abadams Sep 12, 2020
60676ea
Add autotuning utils to package
alexreinking Sep 12, 2020
fba7850
autoscheduler Makefile fixes for os x
abadams Sep 12, 2020
9df8fc8
autoscheduler Makefile fixes for os x
abadams Sep 12, 2020
f2c73e7
Don't run install_name_tool on not-osx
abadams Sep 12, 2020
0511f61
Fix RPATH on macOS/Linux
alexreinking Sep 13, 2020
7854b52
Enable introspection when compiling with gcc/clang.
alexreinking Sep 13, 2020
18197a0
Move libHalide from bin to lib in distros
abadams Sep 13, 2020
26bf23e
bin -> lib in tutorials
abadams Sep 13, 2020
3b45381
Merge branch 'refactor/autoschedulers' of https://github.com/halide/H…
abadams Sep 13, 2020
a6a560d
Make distrib folder moveable on OS X
abadams Sep 13, 2020
284b845
Make autoscheduler distro libs moveable
abadams Sep 13, 2020
482ab08
fix perms
alexreinking Sep 13, 2020
29e3a58
Correct permissions on installed autotune_loop.sh
alexreinking Sep 13, 2020
75be398
Merge remote-tracking branch 'origin/refactor/autoschedulers' into re…
alexreinking Sep 13, 2020
3b3a218
Disable autograd test on wasm, like before.
alexreinking Sep 13, 2020
0b4773d
Set correct rpath to begin with instead of patching it
abadams Sep 14, 2020
f97c423
Add autoschedulers to the tests that need them
abadams Sep 14, 2020
b871071
Merge branch 'refactor/autoschedulers' of https://github.com/halide/H…
abadams Sep 14, 2020
a3c0f0b
package share/Halide path. fix wasm by marking certain libraries to n…
alexreinking Sep 14, 2020
b90afd0
Fix comments in tutorials.
alexreinking Sep 14, 2020
5ceeffb
Makefile rpath fixes for os x
abadams Sep 14, 2020
40c9dc6
Merge
abadams Sep 14, 2020
2ed3e14
More expedient hackery to handle rpath on OS X issues
abadams Sep 15, 2020
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
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
message(STATUS "Building Python bindings disabled")
endif ()

option(WITH_APPS "Build apps" ON)
cmake_dependent_option(WITH_APPS "Build apps" ON "BUILD_SHARED_LIBS" OFF)
if (WITH_APPS)
message(STATUS "Building apps enabled")
add_subdirectory(apps)
Expand Down
84 changes: 66 additions & 18 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,6 @@ SOURCE_FILES = \
AssociativeOpsTable.cpp \
Associativity.cpp \
AsyncProducers.cpp \
AutoSchedule.cpp \
AutoScheduleUtils.cpp \
BoundaryConditions.cpp \
Bounds.cpp \
Expand Down Expand Up @@ -573,7 +572,6 @@ HEADER_FILES = \
AssociativeOpsTable.h \
Associativity.h \
AsyncProducers.h \
AutoSchedule.h \
AutoScheduleUtils.h \
BoundaryConditions.h \
Bounds.h \
Expand Down Expand Up @@ -1081,7 +1079,7 @@ 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_opengl: $(OPENGL_TESTS:$(ROOT_DIR)/test/opengl/%.cpp=opengl_%)
test_auto_schedule: $(AUTO_SCHEDULE_TESTS:$(ROOT_DIR)/test/auto_schedule/%.cpp=auto_schedule_%)
test_auto_schedule: test_mullapudi2016 test_li2018 test_adams2019

.PHONY: test_correctness_multi_gpu
test_correctness_multi_gpu: correctness_gpu_multi_device
Expand Down Expand Up @@ -1500,9 +1498,15 @@ $(FILTERS_DIR)/external_code.halide_generated.cpp: $(BIN_DIR)/external_code.gene
@mkdir -p $(@D)
$(CURDIR)/$< -g external_code -e c_source -o $(CURDIR)/$(FILTERS_DIR) target=$(TARGET)-no_runtime external_code_is_bitcode=false

$(FILTERS_DIR)/autograd_grad.a: $(BIN_DIR)/autograd.generator
$(FILTERS_DIR)/autograd_grad.a: $(BIN_DIR)/autograd.generator $(DISTRIB_DIR)/lib/libautoschedule_mullapudi2016.$(SHARED_EXT)
@mkdir -p $(@D)
$(CURDIR)/$< -g autograd $(GEN_AOT_OUTPUTS) -o $(CURDIR)/$(FILTERS_DIR) -f autograd_grad -d 1 target=$(TARGET)-no_runtime auto_schedule=true
# FIXME: The autoscheduler looks for libHalide in the same
# directory, which is normally a distro. But the generator
# tests use bin/libHalide.so instead of a distro. For now,
# just copy the autoscheduler to a place where it won't
# confuse the linker.
cp $(DISTRIB_DIR)/lib/libautoschedule_mullapudi2016.$(SHARED_EXT) $(BIN_DIR)
$(CURDIR)/$< -g autograd $(GEN_AOT_OUTPUTS) -o $(CURDIR)/$(FILTERS_DIR) -f autograd_grad target=$(TARGET)-no_runtime auto_schedule=true -d 1 -p $(BIN_DIR)/libautoschedule_mullapudi2016.$(SHARED_EXT) -s Mullapudi2016

# Usually, it's considered best practice to have one Generator per
# .cpp file, with the generator-name and filename matching;
Expand Down Expand Up @@ -1755,11 +1759,13 @@ $(BIN_DIR)/tutorial_lesson_21_auto_scheduler_generate: $(ROOT_DIR)/tutorial/less
# ...in that order.
LESSON_21_MACHINE_PARAMS = 32,16777216,40

$(BIN_DIR)/tutorial_lesson_21_auto_scheduler_run: $(ROOT_DIR)/tutorial/lesson_21_auto_scheduler_run.cpp $(BIN_DIR)/tutorial_lesson_21_auto_scheduler_generate
$(BIN_DIR)/tutorial_lesson_21_auto_scheduler_run: $(ROOT_DIR)/tutorial/lesson_21_auto_scheduler_run.cpp $(BIN_DIR)/tutorial_lesson_21_auto_scheduler_generate $(DISTRIB_DIR)/lib/libautoschedule_mullapudi2016.$(SHARED_EXT)
@-mkdir -p $(TMP_DIR)
# Run the generator
$(BIN_DIR)/tutorial_lesson_21_auto_scheduler_generate -g auto_schedule_gen -o $(TMP_DIR) -e static_library,c_header,schedule -f auto_schedule_false target=host auto_schedule=false
$(BIN_DIR)/tutorial_lesson_21_auto_scheduler_generate -g auto_schedule_gen -o $(TMP_DIR) -e static_library,c_header,schedule -f auto_schedule_true target=host-no_runtime auto_schedule=true machine_params=$(LESSON_21_MACHINE_PARAMS)
# FIXME: The relative path of the autoscheduler and libHalide must be preserved on OS X, or it tries to load the wrong libHalide.dylib
cp $(DISTRIB_DIR)/lib/libautoschedule_mullapudi2016.$(SHARED_EXT) $(BIN_DIR)
$(BIN_DIR)/tutorial_lesson_21_auto_scheduler_generate -g auto_schedule_gen -o $(TMP_DIR) -e static_library,c_header,schedule -f auto_schedule_true target=host-no_runtime auto_schedule=true machine_params=$(LESSON_21_MACHINE_PARAMS) -p $(BIN_DIR)/libautoschedule_mullapudi2016.$(SHARED_EXT) -s Mullapudi2016
# Compile the runner
$(CXX) $(TUTORIAL_CXX_FLAGS) $(IMAGE_IO_CXX_FLAGS) $(OPTIMIZE_FOR_BUILD_TIME) $< \
-I$(INCLUDE_DIR) -L$(BIN_DIR) -I $(TMP_DIR) $(TMP_DIR)/auto_schedule_*.a \
Expand Down Expand Up @@ -1847,11 +1853,25 @@ tutorial_%: $(BIN_DIR)/tutorial_% $(TMP_DIR)/images/rgb.png $(TMP_DIR)/images/gr
cd $(TMP_DIR) ; $(CURDIR)/$<
@-echo

auto_schedule_%: $(BIN_DIR)/auto_schedule_%
test_mullapudi2016: $(AUTO_SCHEDULE_TESTS:$(ROOT_DIR)/test/auto_schedule/%.cpp=auto_schedule_%)

# These tests were written for the Mullapudi2016 autoscheduler.
# TODO: either make them work with all autoschedulers or move them under src/autoschedulers/mullapudi2016
auto_schedule_%: $(BIN_DIR)/auto_schedule_% $(BIN_DIR)/libautoschedule_mullapudi2016.$(SHARED_EXT)
@-mkdir -p $(TMP_DIR)
cd $(TMP_DIR) ; $(CURDIR)/$<
cd $(TMP_DIR) ; $(CURDIR)/$< $(realpath $(BIN_DIR))/libautoschedule_mullapudi2016.$(SHARED_EXT)
@-echo

# The other autoschedulers contain their own tests
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 All @@ -1866,15 +1886,13 @@ time_compilation_generator_%: $(BIN_DIR)/%.generator

TEST_APPS=\
HelloMatlab \
autoscheduler \
bilateral_grid \
bgu \
blur \
c_backend \
camera_pipe \
conv_layer \
fft \
gradient_autoscheduler \
hist \
interpolate \
lens_blur \
Expand Down Expand Up @@ -2128,8 +2146,9 @@ $(BUILD_DIR)/halide_config.%: $(ROOT_DIR)/tools/halide_config.%.tpl
| sed -e 's;@HALIDE_LLVM_CXX_FLAGS_RAW@;${LLVM_CXX_FLAGS};g' > $@


$(DISTRIB_DIR)/halide.tgz: $(LIB_DIR)/libHalide.a \
$(BIN_DIR)/libHalide.$(SHARED_EXT) \
$(DISTRIB_DIR)/lib/libHalide.$(SHARED_EXT): \
$(LIB_DIR)/libHalide.a \
$(BIN_DIR)/libHalide.$(SHARED_EXT) \
$(INCLUDE_DIR)/Halide.h \
$(RUNTIME_EXPORTED_INCLUDES) \
$(ROOT_DIR)/README*.md \
Expand All @@ -2143,7 +2162,7 @@ $(DISTRIB_DIR)/halide.tgz: $(LIB_DIR)/libHalide.a \
$(DISTRIB_DIR)/tutorial/images \
$(DISTRIB_DIR)/tools \
$(DISTRIB_DIR)/tutorial/figures
cp $(BIN_DIR)/libHalide.$(SHARED_EXT) $(DISTRIB_DIR)/bin
cp $(BIN_DIR)/libHalide.$(SHARED_EXT) $(DISTRIB_DIR)/lib
cp $(LIB_DIR)/libHalide.a $(DISTRIB_DIR)/lib
cp $(INCLUDE_DIR)/Halide.h $(DISTRIB_DIR)/include
cp $(INCLUDE_DIR)/HalideBuffer.h $(DISTRIB_DIR)/include
Expand All @@ -2168,6 +2187,39 @@ $(DISTRIB_DIR)/halide.tgz: $(LIB_DIR)/libHalide.a \
cp $(ROOT_DIR)/tools/halide_trace_config.h $(DISTRIB_DIR)/tools
cp $(ROOT_DIR)/README*.md $(DISTRIB_DIR)
cp $(BUILD_DIR)/halide_config.* $(DISTRIB_DIR)
ifeq ($(UNAME), Darwin)
install_name_tool -id @rpath/libHalide.$(SHARED_EXT) $(DISTRIB_DIR)/lib/libHalide.$(SHARED_EXT)
endif

$(DISTRIB_DIR)/lib/libautoschedule_%.$(SHARED_EXT): $(DISTRIB_DIR)/lib/libHalide.$(SHARED_EXT)
$(MAKE) -f $(SRC_DIR)/autoschedulers/$*/Makefile bin/libautoschedule_$*.$(SHARED_EXT) HALIDE_DISTRIB_PATH=$(CURDIR)/$(DISTRIB_DIR)
cp $(BIN_DIR)/libautoschedule_$*.$(SHARED_EXT) $(DISTRIB_DIR)/lib
ifeq ($(UNAME), Darwin)
install_name_tool -id @rpath/$(@F) $(CURDIR)/$@
endif

# Adams2019 also includes autotuning tools
$(DISTRIB_DIR)/lib/libautoschedule_adams2019.$(SHARED_EXT): $(DISTRIB_DIR)/lib/libHalide.$(SHARED_EXT)
$(MAKE) -f $(SRC_DIR)/autoschedulers/adams2019/Makefile bin/libautoschedule_adams2019.$(SHARED_EXT) HALIDE_DISTRIB_PATH=$(CURDIR)/$(DISTRIB_DIR) bin/retrain_cost_model bin/featurization_to_sample bin/get_host_target
cp $(BIN_DIR)/libautoschedule_adams2019.$(SHARED_EXT) $(DISTRIB_DIR)/lib/
for TOOL in retrain_cost_model featurization_to_sample get_host_target; do \
cp $(BIN_DIR)/$${TOOL} $(DISTRIB_DIR)/bin/; \
done
cp $(SRC_DIR)/autoschedulers/adams2019/autotune_loop.sh $(DISTRIB_DIR)/tools/
ifeq ($(UNAME), Darwin)
install_name_tool -id @rpath/$(@F) $(CURDIR)/$@
endif

.PHONY: autoschedulers
autoschedulers: \
$(DISTRIB_DIR)/lib/libautoschedule_mullapudi2016.$(SHARED_EXT) \
$(DISTRIB_DIR)/lib/libautoschedule_li2018.$(SHARED_EXT) \
$(DISTRIB_DIR)/lib/libautoschedule_adams2019.$(SHARED_EXT)

.PHONY: distrib
distrib: $(DISTRIB_DIR)/lib/libHalide.$(SHARED_EXT) autoschedulers

$(DISTRIB_DIR)/halide.tgz: distrib
ln -sf $(DISTRIB_DIR) halide
tar -czf $(BUILD_DIR)/halide.tgz \
halide/bin \
Expand All @@ -2180,10 +2232,6 @@ $(DISTRIB_DIR)/halide.tgz: $(LIB_DIR)/libHalide.a \
rm -rf halide
mv $(BUILD_DIR)/halide.tgz $(DISTRIB_DIR)/halide.tgz


.PHONY: distrib
distrib: $(DISTRIB_DIR)/halide.tgz

$(BIN_DIR)/HalideTraceViz: $(ROOT_DIR)/util/HalideTraceViz.cpp $(INCLUDE_DIR)/HalideRuntime.h $(ROOT_DIR)/tools/halide_image_io.h $(ROOT_DIR)/tools/halide_trace_config.h
$(CXX) $(OPTIMIZE) -std=c++11 $(filter %.cpp,$^) -I$(INCLUDE_DIR) -I$(ROOT_DIR)/tools -L$(BIN_DIR) -o $@

Expand Down
13 changes: 2 additions & 11 deletions apps/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ function(add_app_test NAME)
return()
endif ()

unset(cmakeToolchainOpts)
set(cmakeToolchainOpts "")
if (NOT "${CMAKE_TOOLCHAIN_FILE}" STREQUAL "")
list(APPEND cmakeToolchainOpts "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}")
if (NOT "${VCPKG_CHAINLOAD_TOOLCHAIN_FILE}" STREQUAL "")
list(APPEND cmakeToolchainOpts "-DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=${VCPKG_CHAINLOAD_TOOLCHAIN_FILE}")
endif ()
endif ()

unset(cmakeGenOpts)
set(cmakeGenOpts "")
if (NOT "${CMAKE_GENERATOR_TOOLSET}" STREQUAL "")
list(APPEND cmakeGenOpts --build-generator-toolset "${CMAKE_GENERATOR_TOOLSET}")
endif ()
Expand Down Expand Up @@ -89,12 +89,3 @@ add_app_test(resize)
add_app_test(stencil_chain)
add_app_test(unsharp)
add_app_test(wavelet)

# Add the autoschedulers.
# TODO(#4053): refactor into separate modules
if (TARGET_WEBASSEMBLY AND Halide_TARGET MATCHES "wasm")
# Don't attempt to build these for wasm yet.
else ()
add_subdirectory(autoscheduler)
add_subdirectory(gradient_autoscheduler)
endif ()
130 changes: 0 additions & 130 deletions apps/autoscheduler/Makefile

This file was deleted.

2 changes: 1 addition & 1 deletion apps/bgu/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ target_link_libraries(bgu.generator PRIVATE Halide::Generator Halide::Tools)
add_halide_library(bgu FROM bgu.generator)
add_halide_library(bgu_auto_schedule FROM bgu.generator
GENERATOR bgu
PARAMS auto_schedule=true)
AUTOSCHEDULER Halide::Mullapudi2016)

# Main executable
add_executable(bgu_filter filter.cpp)
Expand Down
2 changes: 1 addition & 1 deletion apps/bilateral_grid/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ add_halide_library(bilateral_grid_auto_schedule FROM bilateral_grid.generator
GENERATOR bilateral_grid
STMT bilateral_grid_auto_schedule_STMT
SCHEDULE bilateral_grid_auto_schedule_SCHEDULE
PARAMS auto_schedule=true)
AUTOSCHEDULER Halide::Mullapudi2016)

# Main executable
add_executable(bilateral_grid_process filter.cpp)
Expand Down
2 changes: 1 addition & 1 deletion apps/camera_pipe/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ target_link_libraries(camera_pipe.generator
add_halide_library(camera_pipe FROM camera_pipe.generator)
add_halide_library(camera_pipe_auto_schedule FROM camera_pipe.generator
GENERATOR camera_pipe
PARAMS auto_schedule=true)
AUTOSCHEDULER Halide::Mullapudi2016)

# Main executable
add_executable(camera_pipe_process process.cpp)
Expand Down
2 changes: 1 addition & 1 deletion apps/conv_layer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ target_link_libraries(conv_layer.generator
add_halide_library(conv_layer FROM conv_layer.generator)
add_halide_library(conv_layer_auto_schedule FROM conv_layer.generator
GENERATOR conv_layer
PARAMS auto_schedule=true)
AUTOSCHEDULER Halide::Mullapudi2016)

# Main executable
add_executable(conv_layer_process process.cpp)
Expand Down
2 changes: 1 addition & 1 deletion apps/depthwise_separable_conv/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ target_link_libraries(depthwise_separable_conv.generator
add_halide_library(depthwise_separable_conv FROM depthwise_separable_conv.generator)
add_halide_library(depthwise_separable_conv_auto_schedule FROM depthwise_separable_conv.generator
GENERATOR depthwise_separable_conv
PARAMS auto_schedule=true)
AUTOSCHEDULER Halide::Mullapudi2016)

# Main executable
add_executable(depthwise_separable_conv_process process.cpp)
Expand Down
Loading