From b6ddbc15375587def064b60dcdf685fb5cd523d3 Mon Sep 17 00:00:00 2001 From: Steven Johnson Date: Thu, 24 Sep 2020 12:17:00 -0700 Subject: [PATCH 01/53] parent a23995175f0d3f253bd26dd58a9b2df5efa6bf45 author Steven Johnson 1600463221 -0700 committer Steven Johnson 1600973808 -0700 Require C++17 for Halide. (We previously required C++11, although Make builds typically ended up using C++14 due to `llvm-config --cxxflags` specifying it.) --- CMakeLists.txt | 11 ++-- Makefile | 28 +++++----- README_cmake.md | 4 +- apps/HelloAndroid/build.gradle | 4 +- apps/HelloAndroid/build.sh | 2 +- apps/HelloAndroid/jni/Application.mk | 2 +- apps/HelloAndroidCamera2/build.gradle | 4 +- apps/HelloAndroidCamera2/build.sh | 4 +- apps/HelloAndroidCamera2/jni/Application.mk | 2 +- apps/HelloAndroidGL/build.sh | 2 +- apps/HelloPyTorch/setup.py | 9 +-- .../HelloiOS.xcodeproj/project.pbxproj | 2 +- apps/bgu/CMakeLists.txt | 5 +- apps/bilateral_grid/CMakeLists.txt | 5 +- apps/blur/CMakeLists.txt | 5 +- apps/c_backend/CMakeLists.txt | 5 +- apps/camera_pipe/CMakeLists.txt | 5 +- apps/conv_layer/CMakeLists.txt | 5 +- apps/cuda_mat_mul/CMakeLists.txt | 5 +- apps/depthwise_separable_conv/CMakeLists.txt | 5 +- apps/fft/Makefile | 4 +- apps/glsl/CMakeLists.txt | 5 +- apps/harris/CMakeLists.txt | 5 +- apps/hist/CMakeLists.txt | 5 +- apps/iir_blur/CMakeLists.txt | 5 +- apps/interpolate/CMakeLists.txt | 5 +- apps/lens_blur/CMakeLists.txt | 5 +- apps/linear_algebra/CMakeLists.txt | 5 +- apps/local_laplacian/CMakeLists.txt | 5 +- apps/max_filter/CMakeLists.txt | 5 +- apps/nl_means/CMakeLists.txt | 5 +- apps/opengl_demo/Makefile | 2 +- apps/openglcompute/Makefile | 2 +- apps/openglcompute/jni/Android.mk | 8 +-- apps/resize/CMakeLists.txt | 5 +- apps/stencil_chain/CMakeLists.txt | 5 +- apps/support/Makefile.inc | 6 +- apps/unsharp/CMakeLists.txt | 5 +- apps/wavelet/CMakeLists.txt | 5 +- dependencies/wasm/CMakeLists.txt | 2 +- python_bindings/Makefile | 2 +- python_bindings/tutorial/lesson_13_tuples.py | 2 +- src/CodeGen_LLVM.cpp | 8 +-- src/Error.cpp | 2 +- src/Error.h | 4 -- src/Generator.h | 6 +- src/ObjectInstanceRegistry.h | 3 +- src/ThreadPool.h | 2 +- src/Type.h | 8 +-- src/Util.h | 55 ------------------- src/autoschedulers/adams2019/autotune_loop.sh | 2 +- src/runtime/hexagon_remote/Makefile | 2 +- tools/mex_halide.m | 4 +- tutorial/lesson_01_basics.cpp | 4 +- tutorial/lesson_02_input_image.cpp | 4 +- tutorial/lesson_03_debugging_1.cpp | 4 +- tutorial/lesson_04_debugging_2.cpp | 4 +- tutorial/lesson_05_scheduling_1.cpp | 4 +- ...sson_06_realizing_over_shifted_domains.cpp | 4 +- tutorial/lesson_07_multi_stage_pipelines.cpp | 4 +- tutorial/lesson_08_scheduling_2.cpp | 4 +- tutorial/lesson_09_update_definitions.cpp | 4 +- .../lesson_10_aot_compilation_generate.cpp | 6 +- tutorial/lesson_11_cross_compilation.cpp | 4 +- tutorial/lesson_12_using_the_gpu.cpp | 4 +- tutorial/lesson_13_tuples.cpp | 4 +- tutorial/lesson_14_types.cpp | 4 +- tutorial/lesson_15_generators.cpp | 4 +- tutorial/lesson_16_rgb_generate.cpp | 2 +- tutorial/lesson_17_predicated_rdom.cpp | 4 +- ...son_18_parallel_associative_reductions.cpp | 4 +- tutorial/lesson_19_wrapper_funcs.cpp | 4 +- tutorial/lesson_20_cloning_funcs.cpp | 4 +- .../lesson_21_auto_scheduler_generate.cpp | 4 +- 74 files changed, 196 insertions(+), 196 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 794c000e7b94..bf39273488b8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -42,10 +42,13 @@ endif () # Export all symbols on Windows to match GCC/Clang behavior on Linux/macOS set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) -# Require standard C++14 -set(CMAKE_CXX_STANDARD 14) -set(CMAKE_CXX_STANDARD_REQUIRED ON) -set(CMAKE_CXX_EXTENSIONS OFF) +# Require standard C++17 +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED YES) +set(CMAKE_CXX_EXTENSIONS NO) + +# MSVC won't set __cplusplus correctly unless this flag is also set +add_compile_options($<$:-Zc:__cplusplus>) ## # Import dependencies diff --git a/Makefile b/Makefile index e68ca8a8f55c..b847e441d169 100644 --- a/Makefile +++ b/Makefile @@ -63,7 +63,7 @@ LLVM_GIT_LLD_INCLUDE_DIR = $(shell $(LLVM_CONFIG) --src-root | sed -e 's/\\/\//g LLVM_SYSTEM_LIBS=$(shell ${LLVM_CONFIG} --system-libs --link-static | sed -e 's/[\/&]/\\&/g') LLVM_AS = $(LLVM_BINDIR)/llvm-as LLVM_NM = $(LLVM_BINDIR)/llvm-nm -LLVM_CXX_FLAGS = -std=c++11 $(filter-out -O% -g -fomit-frame-pointer -pedantic -W% -W, $(shell $(LLVM_CONFIG) --cxxflags | sed -e 's/\\/\//g' -e 's/\([a-zA-Z]\):/\/\1/g;s/-D/ -D/g;s/-O/ -O/g')) -I$(LLVM_GIT_LLD_INCLUDE_DIR) +LLVM_CXX_FLAGS = -std=c++17 $(filter-out -O% -g -fomit-frame-pointer -pedantic -W% -W, $(shell $(LLVM_CONFIG) --cxxflags | sed -e 's/\\/\//g' -e 's/\([a-zA-Z]\):/\/\1/g;s/-D/ -D/g;s/-O/ -O/;s/c++14/c++17/g')) -I$(LLVM_GIT_LLD_INCLUDE_DIR) OPTIMIZE ?= -O3 OPTIMIZE_FOR_BUILD_TIME ?= -O0 @@ -246,7 +246,7 @@ LLVM_SHARED_LIBS = -Wl,-rpath=$(LLVM_LIBDIR) -L $(LLVM_LIBDIR) -lLLVM LLVM_LIBS_FOR_SHARED_LIBHALIDE=$(if $(WITH_LLVM_INSIDE_SHARED_LIBHALIDE),$(LLVM_STATIC_LIBS),$(LLVM_SHARED_LIBS)) -TUTORIAL_CXX_FLAGS ?= -std=c++11 -g -fno-omit-frame-pointer $(RTTI_CXX_FLAGS) -I $(ROOT_DIR)/tools $(SANITIZER_FLAGS) $(LLVM_CXX_FLAGS_LIBCPP) +TUTORIAL_CXX_FLAGS ?= -std=c++17 -g -fno-omit-frame-pointer $(RTTI_CXX_FLAGS) -I $(ROOT_DIR)/tools $(SANITIZER_FLAGS) $(LLVM_CXX_FLAGS_LIBCPP) # The tutorials contain example code with warnings that we don't want # to be flagged as errors, so the test flags are the tutorial flags # plus our warning flags. @@ -934,8 +934,8 @@ $(INCLUDE_DIR)/Halide.h: $(SRC_DIR)/../LICENSE.txt $(HEADERS) $(BIN_DIR)/build_h $(BIN_DIR)/build_halide_h $(SRC_DIR)/../LICENSE.txt $(HEADERS) > $(INCLUDE_DIR)/Halide.h # Also generate a precompiled version in the same folder so that anything compiled with a compatible set of flags can use it @mkdir -p $(INCLUDE_DIR)/Halide.h.gch - $(CXX) -std=c++11 $(TEST_CXX_FLAGS) -I$(ROOT_DIR) $(OPTIMIZE) -x c++-header $(INCLUDE_DIR)/Halide.h -o $(INCLUDE_DIR)/Halide.h.gch/Halide.default.gch - $(CXX) -std=c++11 $(TEST_CXX_FLAGS) -I$(ROOT_DIR) $(OPTIMIZE_FOR_BUILD_TIME) -x c++-header $(INCLUDE_DIR)/Halide.h -o $(INCLUDE_DIR)/Halide.h.gch/Halide.test.gch + $(CXX) -std=c++17 $(TEST_CXX_FLAGS) -I$(ROOT_DIR) $(OPTIMIZE) -x c++-header $(INCLUDE_DIR)/Halide.h -o $(INCLUDE_DIR)/Halide.h.gch/Halide.default.gch + $(CXX) -std=c++17 $(TEST_CXX_FLAGS) -I$(ROOT_DIR) $(OPTIMIZE_FOR_BUILD_TIME) -x c++-header $(INCLUDE_DIR)/Halide.h -o $(INCLUDE_DIR)/Halide.h.gch/Halide.test.gch $(INCLUDE_DIR)/HalideRuntime%: $(SRC_DIR)/runtime/HalideRuntime% echo Copying $< @@ -959,7 +959,7 @@ $(INCLUDE_DIR)/HalidePyTorchCudaHelpers.h: $(SRC_DIR)/runtime/HalidePyTorchCudaH $(BIN_DIR)/build_halide_h: $(ROOT_DIR)/tools/build_halide_h.cpp @-mkdir -p $(@D) - $(CXX) -std=c++11 $< -o $@ + $(CXX) -std=c++17 $< -o $@ -include $(OBJECTS:.o=.d) -include $(INITIAL_MODULES:.o=.d) @@ -973,7 +973,7 @@ RUNTIME_TRIPLE_64 = "le64-unknown-unknown-unknown" RUNTIME_TRIPLE_WIN_32 = "i386-unknown-unknown-unknown" RUNTIME_TRIPLE_WIN_64 = "x86_64-unknown-windows-unknown" -# -std=gnu++98 is deliberate; we do NOT want c++11 here, +# -std=gnu++98 is deliberate; we do NOT want c++17 here, # as we don't want static locals to get thread synchronization stuff. RUNTIME_CXX_FLAGS = -O3 -fno-vectorize -ffreestanding -fno-blocks -fno-exceptions -fno-unwind-tables -std=gnu++98 @@ -1500,7 +1500,7 @@ $(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 $(DISTRIB_DIR)/lib/libautoschedule_mullapudi2016.$(SHARED_EXT) +$(FILTERS_DIR)/autograd_grad.a: $(BIN_DIR)/autograd.generator $(DISTRIB_DIR)/lib/libautoschedule_mullapudi2016.$(SHARED_EXT) @mkdir -p $(@D) # FIXME: The autoscheduler looks for libHalide in the same # directory, which is normally a distro. But the generator @@ -1630,7 +1630,7 @@ $(FILTERS_DIR)/%.registration.o: $(FILTERS_DIR)/%.registration.cpp $(FILTERS_DIR)/%.rungen: $(BUILD_DIR)/RunGenMain.o $(BIN_DIR)/$(TARGET)/runtime.a $(FILTERS_DIR)/%.registration.o $(FILTERS_DIR)/%.a @mkdir -p $(@D) - $(CXX) -std=c++11 -I$(FILTERS_DIR) \ + $(CXX) -std=c++17 -I$(FILTERS_DIR) \ $(BUILD_DIR)/RunGenMain.o \ $(BIN_DIR)/$(TARGET)/runtime.a \ $(call alwayslink,$(FILTERS_DIR)/$*.registration.o) \ @@ -1686,7 +1686,7 @@ $(FILTERS_DIR)/multi_rungen: $(BUILD_DIR)/RunGenMain.o $(BIN_DIR)/$(TARGET)/runt $(FILTERS_DIR)/cxx_mangling.registration.o $(FILTERS_DIR)/cxx_mangling.a \ $(FILTERS_DIR)/pyramid.registration.o $(FILTERS_DIR)/pyramid.a @mkdir -p $(@D) - $(CXX) -std=c++11 -I$(FILTERS_DIR) \ + $(CXX) -std=c++17 -I$(FILTERS_DIR) \ $(BUILD_DIR)/RunGenMain.o \ $(BIN_DIR)/$(TARGET)/runtime.a \ $(call alwayslink,$(FILTERS_DIR)/blur2x2.registration.o) \ @@ -1707,7 +1707,7 @@ $(FILTERS_DIR)/multi_rungen2: $(BUILD_DIR)/RunGenMain.o $(BIN_DIR)/$(TARGET)/run $(FILTERS_DIR)/cxx_mangling.a \ $(FILTERS_DIR)/pyramid.a @mkdir -p $(@D) - $(CXX) -std=c++11 -I$(FILTERS_DIR) $^ $(GEN_AOT_LD_FLAGS) $(IMAGE_IO_LIBS) -o $@ + $(CXX) -std=c++17 -I$(FILTERS_DIR) $^ $(GEN_AOT_LD_FLAGS) $(IMAGE_IO_LIBS) -o $@ $(BIN_DIR)/tutorial_%: $(ROOT_DIR)/tutorial/%.cpp $(BIN_DIR)/libHalide.$(SHARED_EXT) $(INCLUDE_DIR)/Halide.h $(INCLUDE_DIR)/HalideRuntime.h @ if [[ $@ == *_run ]]; then \ @@ -1761,7 +1761,7 @@ $(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 $(DISTRIB_DIR)/lib/libautoschedule_mullapudi2016.$(SHARED_EXT) +$(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 @@ -1872,7 +1872,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_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_%) @@ -2235,10 +2235,10 @@ $(DISTRIB_DIR)/halide.tgz: distrib mv $(BUILD_DIR)/halide.tgz $(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 $@ + $(CXX) $(OPTIMIZE) -std=c++17 $(filter %.cpp,$^) -I$(INCLUDE_DIR) -I$(ROOT_DIR)/tools -L$(BIN_DIR) -o $@ $(BIN_DIR)/HalideTraceDump: $(ROOT_DIR)/util/HalideTraceDump.cpp $(ROOT_DIR)/util/HalideTraceUtils.cpp $(INCLUDE_DIR)/HalideRuntime.h $(ROOT_DIR)/tools/halide_image_io.h - $(CXX) $(OPTIMIZE) -std=c++11 $(filter %.cpp,$^) -I$(INCLUDE_DIR) -I$(ROOT_DIR)/tools -I$(ROOT_DIR)/src/runtime -L$(BIN_DIR) $(IMAGE_IO_CXX_FLAGS) $(IMAGE_IO_LIBS) -o $@ + $(CXX) $(OPTIMIZE) -std=c++17 $(filter %.cpp,$^) -I$(INCLUDE_DIR) -I$(ROOT_DIR)/tools -I$(ROOT_DIR)/src/runtime -L$(BIN_DIR) $(IMAGE_IO_CXX_FLAGS) $(IMAGE_IO_LIBS) -o $@ # Run clang-format on most of the source. The tutorials directory is # explicitly skipped, as those files are manually formatted to diff --git a/README_cmake.md b/README_cmake.md index b6752d1196f9..111d9a9ffe41 100644 --- a/README_cmake.md +++ b/README_cmake.md @@ -514,7 +514,7 @@ boilerplate. cmake_minimum_required(VERSION 3.16) project(HalideExample) -set(CMAKE_CXX_STANDARD 11) # or newer +set(CMAKE_CXX_STANDARD 17) # or newer set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) @@ -530,7 +530,7 @@ immediately after setting the minimum version. The next three variables set the project-wide C++ standard. The first, [`CMAKE_CXX_STANDARD`][cmake_cxx_standard], simply sets the standard version. -Halide requires at least C++11. The second, +Halide requires at least c++17. The second, [`CMAKE_CXX_STANDARD_REQUIRED`][cmake_cxx_standard_required], tells CMake to fail if the compiler cannot provide the requested standard version. Lastly, [`CMAKE_CXX_EXTENSIONS`][cmake_cxx_extensions] tells CMake to disable diff --git a/apps/HelloAndroid/build.gradle b/apps/HelloAndroid/build.gradle index 658fbd1a8711..b2e3bf381505 100644 --- a/apps/HelloAndroid/build.gradle +++ b/apps/HelloAndroid/build.gradle @@ -1,7 +1,7 @@ import org.apache.tools.ant.taskdefs.condition.Os // Avoid conflicts with Bazel on case-insensitive filesystems -buildDir = 'gradle_build' +buildDir = 'gradle_build' repositories { jcenter() @@ -51,7 +51,7 @@ sources { executables { hello_generator { binaries.all { - cppCompiler.args "-std=c++11", "-g", "-Wall", "-fno-rtti", "-I", "${projectDir}/../../include", "-I", "${projectDir}/../../build/include" + cppCompiler.args "-std=c++17", "-g", "-Wall", "-fno-rtti", "-I", "${projectDir}/../../include", "-I", "${projectDir}/../../build/include" // "/bin" assumes Makefile build for Halide; "/build/lib" assumes CMake build linker.args "-lHalide", "-ldl", "-lpthread", "-lz", "-L", "${projectDir}/../../bin", "-L", "${projectDir}/../../build/lib" } diff --git a/apps/HelloAndroid/build.sh b/apps/HelloAndroid/build.sh index 285e17bfa086..7b87613ca4fa 100755 --- a/apps/HelloAndroid/build.sh +++ b/apps/HelloAndroid/build.sh @@ -3,7 +3,7 @@ set -e android update project -p . --target android-17 mkdir -p bin c++ jni/hello_generator.cpp ../../tools/GenGen.cpp \ - -g -fno-rtti -Wall -std=c++11 \ + -g -fno-rtti -Wall -std=c++17 \ -I ../../include -I ../../build/include \ -L ../../bin -lHalide -ldl -lpthread -lz \ -o bin/hello_generator diff --git a/apps/HelloAndroid/jni/Application.mk b/apps/HelloAndroid/jni/Application.mk index ed84d4a528cc..8d2ba9c04231 100644 --- a/apps/HelloAndroid/jni/Application.mk +++ b/apps/HelloAndroid/jni/Application.mk @@ -5,4 +5,4 @@ APP_ABI := armeabi armeabi-v7a arm64-v8a mips x86_64 x86 APP_PLATFORM := android-17 APP_STL := gnustl_static -APP_CPPFLAGS := -std=c++11 +APP_CPPFLAGS := -std=c++17 diff --git a/apps/HelloAndroidCamera2/build.gradle b/apps/HelloAndroidCamera2/build.gradle index 8184293b966f..5cc2283112d8 100644 --- a/apps/HelloAndroidCamera2/build.gradle +++ b/apps/HelloAndroidCamera2/build.gradle @@ -1,7 +1,7 @@ import org.apache.tools.ant.taskdefs.condition.Os // Avoid conflicts with Bazel on case-insensitive filesystems -buildDir = 'gradle_build' +buildDir = 'gradle_build' repositories { jcenter() @@ -56,7 +56,7 @@ sources { executables { halide_generator { binaries.all { - cppCompiler.args "-std=c++11", "-g", "-Wall", "-fno-rtti", "-I", "${projectDir}/../../include", "-I", "${projectDir}/../../build/include" + cppCompiler.args "-std=c++17", "-g", "-Wall", "-fno-rtti", "-I", "${projectDir}/../../include", "-I", "${projectDir}/../../build/include" // "/bin" assumes Makefile build for Halide; "/build/lib" assumes CMake build linker.args "-lHalide", "-ldl", "-lpthread", "-lz", "-L", "${projectDir}/../../bin", "-L", "${projectDir}/../../build/lib" } diff --git a/apps/HelloAndroidCamera2/build.sh b/apps/HelloAndroidCamera2/build.sh index 4ff95f95da51..96b604275e5e 100755 --- a/apps/HelloAndroidCamera2/build.sh +++ b/apps/HelloAndroidCamera2/build.sh @@ -9,13 +9,13 @@ fi mkdir -p bin c++ jni/edge_detect_generator.cpp ../../tools/GenGen.cpp \ - -g -fno-rtti -Wall -std=c++11 \ + -g -fno-rtti -Wall -std=c++17 \ -I ../../include -I ../../build/include \ -L ../../bin -lHalide -ldl -lpthread -lz \ -o bin/edge_detect_generator c++ jni/deinterleave_generator.cpp ../../tools/GenGen.cpp \ - -g -fno-rtti -Wall -std=c++11 \ + -g -fno-rtti -Wall -std=c++17 \ -I ../../include -I ../../build/include \ -L ../../bin -lHalide -ldl -lpthread -lz \ -o bin/deinterleave_generator diff --git a/apps/HelloAndroidCamera2/jni/Application.mk b/apps/HelloAndroidCamera2/jni/Application.mk index 68340ea94260..4a1171874c29 100644 --- a/apps/HelloAndroidCamera2/jni/Application.mk +++ b/apps/HelloAndroidCamera2/jni/Application.mk @@ -5,4 +5,4 @@ APP_ABI := armeabi armeabi-v7a arm64-v8a mips x86_64 x86 APP_PLATFORM := android-21 APP_STL := c++_static -APP_CPPFLAGS := -std=c++11 -fno-rtti -fexceptions +APP_CPPFLAGS := -std=c++17 -fno-rtti -fexceptions diff --git a/apps/HelloAndroidGL/build.sh b/apps/HelloAndroidGL/build.sh index d9b1f395dc12..4b8555eb1cab 100755 --- a/apps/HelloAndroidGL/build.sh +++ b/apps/HelloAndroidGL/build.sh @@ -2,7 +2,7 @@ set -e android update project -p . --target android-17 cd jni -c++ -std=c++11 halide_gl_filter.cpp -L ../../../bin -lHalide -I ../../../include -ldl -lpthread -lz +c++ -std=c++17 halide_gl_filter.cpp -L ../../../bin -lHalide -I ../../../include -ldl -lpthread -lz HL_TARGET=arm-32-android-opengl-debug DYLD_LIBRARY_PATH=../../../bin LD_LIBRARY_PATH=../../../bin ./a.out cd .. pwd diff --git a/apps/HelloPyTorch/setup.py b/apps/HelloPyTorch/setup.py index f272cccce73e..b6fccbd4d1e5 100644 --- a/apps/HelloPyTorch/setup.py +++ b/apps/HelloPyTorch/setup.py @@ -14,7 +14,7 @@ def generate_pybind_wrapper(path, headers, has_cuda): s += "#define HL_PT_CUDA\n" s += "#include \"HalidePyTorchHelpers.h\"\n" for h in headers: - s += "#include \"{}\"\n".format(os.path.splitext(h)[0]+".pytorch.h") + s += "#include \"{}\"\n".format(os.path.splitext(h)[0] + ".pytorch.h") if has_cuda: s += "#undef HL_PT_CUDA\n" @@ -22,7 +22,7 @@ def generate_pybind_wrapper(path, headers, has_cuda): for h in headers: name = os.path.splitext(h)[0] s += " m.def(\"{}\", &{}_th_, \"PyTorch wrapper of the Halide pipeline {}\");\n".format( - name, name, name) + name, name, name) s += "}\n" with open(path, 'w') as fid: fid.write(s) @@ -46,7 +46,7 @@ def generate_pybind_wrapper(path, headers, has_cuda): has_cuda = True include_dirs = [build_dir, os.path.join(halide_dir, "include")] - compile_args = ["-std=c++11", "-g"] + compile_args = ["-std=c++17", "-g"] if platform.system() == "Darwin": # on osx libstdc++ causes trouble compile_args += ["-stdlib=libc++"] @@ -79,7 +79,8 @@ def generate_pybind_wrapper(path, headers, has_cuda): extension = CUDAExtension(ext_name, sources, include_dirs=include_dirs, extra_objects=hl_libs, - libraries=["cuda"], # Halide ops need the full cuda lib, not just the RT library + # Halide ops need the full cuda lib, not just the RT library + libraries=["cuda"], extra_compile_args=compile_args) else: print("Generating CPU wrapper") diff --git a/apps/HelloiOS/HelloiOS.xcodeproj/project.pbxproj b/apps/HelloiOS/HelloiOS.xcodeproj/project.pbxproj index 460a44f6e8b5..0e2206cf010b 100644 --- a/apps/HelloiOS/HelloiOS.xcodeproj/project.pbxproj +++ b/apps/HelloiOS/HelloiOS.xcodeproj/project.pbxproj @@ -244,7 +244,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/bash; - shellScript = "echo \"${SRCROOT}\"\ncd \"${SRCROOT}/HelloiOS\"\n\n# Echoing commands to output makes it easier to debug XCode failures.\n# Failure on undefined vars is always a good idea.\nset -ex\n\n# xcode puts all sorts of junk in the environment which\n# prevents building a binary for osx (instead of ios).\n# sudo'ing to yourself gives a fresh environment.\nsudo -u ${USER} \\\nc++ reaction_diffusion_2_generator.cpp ${SRCROOT}/../../tools/GenGen.cpp \\\n-std=c++11 \\\n-fno-rtti \\\n-I ${SRCROOT}/../../include \\\n-I ${SRCROOT}/../../build/include \\\n-I ${SRCROOT}/../../tools \\\n-arch x86_64 \\\n-L ${SRCROOT}/../../bin \\\n-lHalide \\\n-o ${DERIVED_FILE_DIR}/reaction_diffusion_2_generator\n\n\nif [ \"${arch}\" == \"x86_64\" ]\nthen\n# assume simulator, which requires osx rather than ios\nTARGET=x86-64-osx\nelse\n# TODO: sniff arm-32 builds here; for now, just assume arm-64 only\nTARGET=arm-64-ios\nfi\n\nfor GEN in init update render; do\n(cd ${DERIVED_FILE_DIR}; \\\nDYLD_LIBRARY_PATH=${SRCROOT}/../../bin:${SRCROOT}/../../build/lib \\\n./reaction_diffusion_2_generator -g reaction_diffusion_2_${GEN} -f reaction_diffusion_2_${GEN} -n reaction_diffusion_2_${GEN} -o ${DERIVED_FILE_DIR} target=${TARGET}-user_context)\ndone\n\nfor GEN in init update render; do\n(cd ${DERIVED_FILE_DIR}; \\\nDYLD_LIBRARY_PATH=${SRCROOT}/../../bin:${SRCROOT}/../../build/lib \\\n./reaction_diffusion_2_generator -g reaction_diffusion_2_${GEN} -f reaction_diffusion_2_metal_${GEN} -n reaction_diffusion_2_metal_${GEN} -o ${DERIVED_FILE_DIR} target=${TARGET}-metal-user_context)\ndone\n"; + shellScript = "echo \"${SRCROOT}\"\ncd \"${SRCROOT}/HelloiOS\"\n\n# Echoing commands to output makes it easier to debug XCode failures.\n# Failure on undefined vars is always a good idea.\nset -ex\n\n# xcode puts all sorts of junk in the environment which\n# prevents building a binary for osx (instead of ios).\n# sudo'ing to yourself gives a fresh environment.\nsudo -u ${USER} \\\nc++ reaction_diffusion_2_generator.cpp ${SRCROOT}/../../tools/GenGen.cpp \\\n-std=c++17 \\\n-fno-rtti \\\n-I ${SRCROOT}/../../include \\\n-I ${SRCROOT}/../../build/include \\\n-I ${SRCROOT}/../../tools \\\n-arch x86_64 \\\n-L ${SRCROOT}/../../bin \\\n-lHalide \\\n-o ${DERIVED_FILE_DIR}/reaction_diffusion_2_generator\n\n\nif [ \"${arch}\" == \"x86_64\" ]\nthen\n# assume simulator, which requires osx rather than ios\nTARGET=x86-64-osx\nelse\n# TODO: sniff arm-32 builds here; for now, just assume arm-64 only\nTARGET=arm-64-ios\nfi\n\nfor GEN in init update render; do\n(cd ${DERIVED_FILE_DIR}; \\\nDYLD_LIBRARY_PATH=${SRCROOT}/../../bin:${SRCROOT}/../../build/lib \\\n./reaction_diffusion_2_generator -g reaction_diffusion_2_${GEN} -f reaction_diffusion_2_${GEN} -n reaction_diffusion_2_${GEN} -o ${DERIVED_FILE_DIR} target=${TARGET}-user_context)\ndone\n\nfor GEN in init update render; do\n(cd ${DERIVED_FILE_DIR}; \\\nDYLD_LIBRARY_PATH=${SRCROOT}/../../bin:${SRCROOT}/../../build/lib \\\n./reaction_diffusion_2_generator -g reaction_diffusion_2_${GEN} -f reaction_diffusion_2_metal_${GEN} -n reaction_diffusion_2_metal_${GEN} -o ${DERIVED_FILE_DIR} target=${TARGET}-metal-user_context)\ndone\n"; }; /* End PBXShellScriptBuildPhase section */ diff --git a/apps/bgu/CMakeLists.txt b/apps/bgu/CMakeLists.txt index ffba5714d889..7c74fa16b38a 100644 --- a/apps/bgu/CMakeLists.txt +++ b/apps/bgu/CMakeLists.txt @@ -4,10 +4,13 @@ project(bgu) enable_testing() # Set up language settings -set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) +# MSVC won't set __cplusplus correctly unless this flag is also set +add_compile_options($<$:-Zc:__cplusplus>) + # Find Halide find_package(Halide REQUIRED) diff --git a/apps/bilateral_grid/CMakeLists.txt b/apps/bilateral_grid/CMakeLists.txt index ffab600382da..487d86a12e7d 100644 --- a/apps/bilateral_grid/CMakeLists.txt +++ b/apps/bilateral_grid/CMakeLists.txt @@ -4,10 +4,13 @@ project(bilateral_grid) enable_testing() # Set up language settings -set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) +# MSVC won't set __cplusplus correctly unless this flag is also set +add_compile_options($<$:-Zc:__cplusplus>) + # Find Halide find_package(Halide REQUIRED) diff --git a/apps/blur/CMakeLists.txt b/apps/blur/CMakeLists.txt index ace573ae55ec..e1f52ed35042 100644 --- a/apps/blur/CMakeLists.txt +++ b/apps/blur/CMakeLists.txt @@ -4,10 +4,13 @@ project(blur) enable_testing() # Set up language settings -set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) +# MSVC won't set __cplusplus correctly unless this flag is also set +add_compile_options($<$:-Zc:__cplusplus>) + # Find Halide find_package(Halide REQUIRED) find_package(OpenMP) diff --git a/apps/c_backend/CMakeLists.txt b/apps/c_backend/CMakeLists.txt index 393516939aaa..6325a61efd11 100644 --- a/apps/c_backend/CMakeLists.txt +++ b/apps/c_backend/CMakeLists.txt @@ -4,10 +4,13 @@ project(c_backend) enable_testing() # Set up language settings -set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) +# MSVC won't set __cplusplus correctly unless this flag is also set +add_compile_options($<$:-Zc:__cplusplus>) + # Find Halide find_package(Halide REQUIRED) diff --git a/apps/camera_pipe/CMakeLists.txt b/apps/camera_pipe/CMakeLists.txt index 35f6de32dfbe..ea5656ac5be5 100644 --- a/apps/camera_pipe/CMakeLists.txt +++ b/apps/camera_pipe/CMakeLists.txt @@ -4,10 +4,13 @@ project(camera_pipe) enable_testing() # Set up language settings -set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) +# MSVC won't set __cplusplus correctly unless this flag is also set +add_compile_options($<$:-Zc:__cplusplus>) + # Find Halide find_package(Halide REQUIRED) diff --git a/apps/conv_layer/CMakeLists.txt b/apps/conv_layer/CMakeLists.txt index fbc70d5494b1..664261ba3154 100644 --- a/apps/conv_layer/CMakeLists.txt +++ b/apps/conv_layer/CMakeLists.txt @@ -4,10 +4,13 @@ project(conv_layer) enable_testing() # Set up language settings -set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) +# MSVC won't set __cplusplus correctly unless this flag is also set +add_compile_options($<$:-Zc:__cplusplus>) + # Find Halide find_package(Halide REQUIRED) diff --git a/apps/cuda_mat_mul/CMakeLists.txt b/apps/cuda_mat_mul/CMakeLists.txt index ef3c03680bf6..4ab7b45d1d64 100644 --- a/apps/cuda_mat_mul/CMakeLists.txt +++ b/apps/cuda_mat_mul/CMakeLists.txt @@ -15,10 +15,13 @@ endif () enable_testing() # Set up language settings -set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) +# MSVC won't set __cplusplus correctly unless this flag is also set +add_compile_options($<$:-Zc:__cplusplus>) + # Find Halide find_package(Halide REQUIRED) diff --git a/apps/depthwise_separable_conv/CMakeLists.txt b/apps/depthwise_separable_conv/CMakeLists.txt index 8907777cb0fa..643364ba3de6 100644 --- a/apps/depthwise_separable_conv/CMakeLists.txt +++ b/apps/depthwise_separable_conv/CMakeLists.txt @@ -4,10 +4,13 @@ project(depthwise_separable_conv) enable_testing() # Set up language settings -set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) +# MSVC won't set __cplusplus correctly unless this flag is also set +add_compile_options($<$:-Zc:__cplusplus>) + # Find Halide find_package(Halide REQUIRED) diff --git a/apps/fft/Makefile b/apps/fft/Makefile index 85f56aa8d7bb..44b9a8c293a9 100644 --- a/apps/fft/Makefile +++ b/apps/fft/Makefile @@ -46,7 +46,7 @@ bench_64x64: $(BIN)/$(HL_TARGET)/bench_fft $(GENERATOR_BIN)/fft.generator: fft_generator.cpp fft.cpp fft.h $(GENERATOR_DEPS) @mkdir -p $(@D) - $(CXX) $(CXXFLAGS) $(filter %.cpp,$^) -o $@ $(LIBHALIDE_LDFLAGS) + $(CXX) $(CXXFLAGS) $(filter %.cpp,$^) -o $@ $(LIBHALIDE_LDFLAGS) # Generate four AOT compiled FFT variants. Forward versions have gain set to 1 / 256.0 $(BIN)/%/fft_forward_r2c.a: $(GENERATOR_BIN)/fft.generator @@ -67,7 +67,7 @@ $(BIN)/%/fft_inverse_c2c.a: $(GENERATOR_BIN)/fft.generator $(BIN)/%/fft_aot_test: fft_aot_test.cpp $(BIN)/%/fft_forward_r2c.a $(BIN)/%/fft_inverse_c2r.a $(BIN)/%/fft_forward_c2c.a $(BIN)/%/fft_inverse_c2c.a @mkdir -p $(@D) - $(CXX) -I$(BIN)/$* -I$(HALIDE_DISTRIB_PATH)/include/ -std=c++11 $^ -o $@ $(LDFLAGS) $(HALIDE_SYSTEM_LIBS) + $(CXX) -I$(BIN)/$* -I$(HALIDE_DISTRIB_PATH)/include/ -std=c++17 $^ -o $@ $(LDFLAGS) $(HALIDE_SYSTEM_LIBS) clean: rm -rf $(BIN) diff --git a/apps/glsl/CMakeLists.txt b/apps/glsl/CMakeLists.txt index 5db30f5e3fd6..4906f380aa00 100644 --- a/apps/glsl/CMakeLists.txt +++ b/apps/glsl/CMakeLists.txt @@ -9,10 +9,13 @@ project(glsl) enable_testing() # Set up language settings -set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) +# MSVC won't set __cplusplus correctly unless this flag is also set +add_compile_options($<$:-Zc:__cplusplus>) + # Find Halide find_package(Halide REQUIRED) diff --git a/apps/harris/CMakeLists.txt b/apps/harris/CMakeLists.txt index a61a0c0fcd67..811a0c6afb4b 100644 --- a/apps/harris/CMakeLists.txt +++ b/apps/harris/CMakeLists.txt @@ -4,10 +4,13 @@ project(harris) enable_testing() # Set up language settings -set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) +# MSVC won't set __cplusplus correctly unless this flag is also set +add_compile_options($<$:-Zc:__cplusplus>) + # Find Halide find_package(Halide REQUIRED) diff --git a/apps/hist/CMakeLists.txt b/apps/hist/CMakeLists.txt index 94db41663980..4a8656d0ba72 100644 --- a/apps/hist/CMakeLists.txt +++ b/apps/hist/CMakeLists.txt @@ -4,10 +4,13 @@ project(hist) enable_testing() # Set up language settings -set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) +# MSVC won't set __cplusplus correctly unless this flag is also set +add_compile_options($<$:-Zc:__cplusplus>) + # Find Halide find_package(Halide REQUIRED) diff --git a/apps/iir_blur/CMakeLists.txt b/apps/iir_blur/CMakeLists.txt index a2c39634c058..6ee2ce8a16a3 100644 --- a/apps/iir_blur/CMakeLists.txt +++ b/apps/iir_blur/CMakeLists.txt @@ -4,10 +4,13 @@ project(iir_blur) enable_testing() # Set up language settings -set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) +# MSVC won't set __cplusplus correctly unless this flag is also set +add_compile_options($<$:-Zc:__cplusplus>) + # Find Halide find_package(Halide REQUIRED) diff --git a/apps/interpolate/CMakeLists.txt b/apps/interpolate/CMakeLists.txt index 207597384e5b..6130cb890fb6 100644 --- a/apps/interpolate/CMakeLists.txt +++ b/apps/interpolate/CMakeLists.txt @@ -4,10 +4,13 @@ project(interpolate) enable_testing() # Set up language settings -set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) +# MSVC won't set __cplusplus correctly unless this flag is also set +add_compile_options($<$:-Zc:__cplusplus>) + # Find Halide find_package(Halide REQUIRED) diff --git a/apps/lens_blur/CMakeLists.txt b/apps/lens_blur/CMakeLists.txt index 8515d77f40b7..698a9d2a9a8a 100644 --- a/apps/lens_blur/CMakeLists.txt +++ b/apps/lens_blur/CMakeLists.txt @@ -4,10 +4,13 @@ project(lens_blur) enable_testing() # Set up language settings -set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) +# MSVC won't set __cplusplus correctly unless this flag is also set +add_compile_options($<$:-Zc:__cplusplus>) + # Find Halide find_package(Halide REQUIRED) diff --git a/apps/linear_algebra/CMakeLists.txt b/apps/linear_algebra/CMakeLists.txt index 2d649e0ec684..8c5b873a5255 100644 --- a/apps/linear_algebra/CMakeLists.txt +++ b/apps/linear_algebra/CMakeLists.txt @@ -4,10 +4,13 @@ project(linear_algebra) enable_testing() # Set up language settings -set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) +# MSVC won't set __cplusplus correctly unless this flag is also set +add_compile_options($<$:-Zc:__cplusplus>) + # Find Halide find_package(Halide REQUIRED COMPONENTS Halide) diff --git a/apps/local_laplacian/CMakeLists.txt b/apps/local_laplacian/CMakeLists.txt index 4b6ab9384e6b..276b42341862 100644 --- a/apps/local_laplacian/CMakeLists.txt +++ b/apps/local_laplacian/CMakeLists.txt @@ -4,10 +4,13 @@ project(local_laplacian) enable_testing() # Set up language settings -set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) +# MSVC won't set __cplusplus correctly unless this flag is also set +add_compile_options($<$:-Zc:__cplusplus>) + # Find Halide find_package(Halide REQUIRED) diff --git a/apps/max_filter/CMakeLists.txt b/apps/max_filter/CMakeLists.txt index 35aabf94e9a3..68bdc7a55161 100644 --- a/apps/max_filter/CMakeLists.txt +++ b/apps/max_filter/CMakeLists.txt @@ -4,10 +4,13 @@ project(max_filter) enable_testing() # Set up language settings -set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) +# MSVC won't set __cplusplus correctly unless this flag is also set +add_compile_options($<$:-Zc:__cplusplus>) + # Find Halide find_package(Halide REQUIRED) diff --git a/apps/nl_means/CMakeLists.txt b/apps/nl_means/CMakeLists.txt index 274bb1d2abd7..c430ef03a385 100644 --- a/apps/nl_means/CMakeLists.txt +++ b/apps/nl_means/CMakeLists.txt @@ -4,10 +4,13 @@ project(nl_means) enable_testing() # Set up language settings -set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) +# MSVC won't set __cplusplus correctly unless this flag is also set +add_compile_options($<$:-Zc:__cplusplus>) + # Find Halide find_package(Halide REQUIRED) diff --git a/apps/opengl_demo/Makefile b/apps/opengl_demo/Makefile index 5d6bc2bb23e7..30a44a6af783 100644 --- a/apps/opengl_demo/Makefile +++ b/apps/opengl_demo/Makefile @@ -43,7 +43,7 @@ endif # MAIN_LIBS = -lpng -ldrawtext $(OPENGL_LIBS) GENERATOR_LIBS = -lHalide -lz -lcurses -CXXFLAGS = -std=c++11 -g -DDTX_FONT=\"$(DTX_FONT)\" $(HALIDE_INC_PATH) +CXXFLAGS = -std=c++17 -g -DDTX_FONT=\"$(DTX_FONT)\" $(HALIDE_INC_PATH) # Output directory. BIN ?= bin diff --git a/apps/openglcompute/Makefile b/apps/openglcompute/Makefile index 120b6ae8d290..4bda85258364 100644 --- a/apps/openglcompute/Makefile +++ b/apps/openglcompute/Makefile @@ -10,7 +10,7 @@ $(HALIDE_LIB): $(TOP) $(MAKE) -C $(TOP) test_%: test_%.cpp - $(CXX) -std=c++11 -I ../../include/ $< -L ../../bin/ -lHalide $(HALIDE_SYSTEM_LIBS) -o $@ -g + $(CXX) -std=c++17 -I ../../include/ $< -L ../../bin/ -lHalide $(HALIDE_SYSTEM_LIBS) -o $@ -g avg_filter_uint32t.o avg_filter_uint32t.h avg_filter_float.o avg_filter_float.h: test_oglc_avg LD_LIBRARY_PATH=../../bin DYLD_LIBRARY_PATH=../../bin HL_TARGET=arm-32-android-armv7s-openglcompute ./$< diff --git a/apps/openglcompute/jni/Android.mk b/apps/openglcompute/jni/Android.mk index 04f9b01918db..232e91e208cc 100644 --- a/apps/openglcompute/jni/Android.mk +++ b/apps/openglcompute/jni/Android.mk @@ -11,7 +11,7 @@ LOCAL_STATIC_LIBRARIES += libOpengl LOCAL_LDLIBS := -lm -llog -landroid -lEGL -lGLESv2 avg_filter_uint32t.o avg_filter_uint32t_arm.o avg_filter_float.o avg_filter_float_arm.o LOCAL_ARM_MODE := arm -LOCAL_CPPFLAGS += -std=c++11 -I../support -I../../include +LOCAL_CPPFLAGS += -std=c++17 -I../support -I../../include LOCAL_C_INCLUDES += ./ @@ -27,7 +27,7 @@ LOCAL_STATIC_LIBRARIES += libOpengl LOCAL_LDLIBS := -lm -llog -landroid -lEGL -lGLESv2 avg_filter_uint32t.o avg_filter_uint32t_arm.o avg_filter_float.o avg_filter_float_arm.o LOCAL_ARM_MODE := arm -LOCAL_CPPFLAGS += -std=c++11 -I../support -I../../include +LOCAL_CPPFLAGS += -std=c++17 -I../support -I../../include LOCAL_C_INCLUDES += ./ @@ -44,7 +44,7 @@ LOCAL_STATIC_LIBRARIES += libOpengl LOCAL_LDLIBS := -lm -llog -landroid -lEGL -lGLESv2 two_kernels_filter.o LOCAL_ARM_MODE := arm -LOCAL_CPPFLAGS += -std=c++11 -I../support -I../../include +LOCAL_CPPFLAGS += -std=c++17 -I../support -I../../include LOCAL_C_INCLUDES += ./ @@ -60,7 +60,7 @@ LOCAL_STATIC_LIBRARIES += libOpengl LOCAL_LDLIBS := -lm -llog -landroid -lEGL -lGLESv2 two_kernels_filter.o LOCAL_ARM_MODE := arm -LOCAL_CPPFLAGS += -std=c++11 -I../support -I../../include +LOCAL_CPPFLAGS += -std=c++17 -I../support -I../../include LOCAL_C_INCLUDES += ./ diff --git a/apps/resize/CMakeLists.txt b/apps/resize/CMakeLists.txt index 33debc77727e..16a016af8204 100644 --- a/apps/resize/CMakeLists.txt +++ b/apps/resize/CMakeLists.txt @@ -4,10 +4,13 @@ project(resize) enable_testing() # Set up language settings -set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) +# MSVC won't set __cplusplus correctly unless this flag is also set +add_compile_options($<$:-Zc:__cplusplus>) + # Find Halide find_package(Halide REQUIRED) diff --git a/apps/stencil_chain/CMakeLists.txt b/apps/stencil_chain/CMakeLists.txt index 4dbcd508d89a..e354d0db9c2f 100644 --- a/apps/stencil_chain/CMakeLists.txt +++ b/apps/stencil_chain/CMakeLists.txt @@ -4,10 +4,13 @@ project(stencil_chain) enable_testing() # Set up language settings -set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) +# MSVC won't set __cplusplus correctly unless this flag is also set +add_compile_options($<$:-Zc:__cplusplus>) + # Find Halide find_package(Halide REQUIRED) diff --git a/apps/support/Makefile.inc b/apps/support/Makefile.inc index cf8203da1011..df3e7093fd78 100644 --- a/apps/support/Makefile.inc +++ b/apps/support/Makefile.inc @@ -54,7 +54,7 @@ GXX ?= g++ OPTIMIZE ?= -O3 CFLAGS += $(OPTIMIZE) -I $(HALIDE_DISTRIB_PATH)/include/ -I $(HALIDE_DISTRIB_PATH)/tools/ -I $(HALIDE_DISTRIB_PATH)/apps/support/ -CXXFLAGS += $(OPTIMIZE) -std=c++11 -I $(HALIDE_DISTRIB_PATH)/include/ -I $(HALIDE_DISTRIB_PATH)/tools/ $(SANITIZER_FLAGS) -Wall -Werror -Wno-unused-function -Wcast-qual -Wignored-qualifiers -Wno-comment -Wsign-compare -Wno-unknown-warning-option -Wno-psabi +CXXFLAGS += $(OPTIMIZE) -std=c++17 -I $(HALIDE_DISTRIB_PATH)/include/ -I $(HALIDE_DISTRIB_PATH)/tools/ $(SANITIZER_FLAGS) -Wall -Werror -Wno-unused-function -Wcast-qual -Wignored-qualifiers -Wno-comment -Wsign-compare -Wno-unknown-warning-option -Wno-psabi CXX_VERSION = $(shell $(CXX) --version | head -n1) ifneq (,$(findstring clang,$(CXX_VERSION))) @@ -133,10 +133,10 @@ GENERATOR_DEPS_STATIC ?= $(LIB_HALIDE_STATIC) $(HALIDE_DISTRIB_PATH)/include/Hal LIBHALIDE_LDFLAGS ?= -Wl,-rpath,$(dir $(LIB_HALIDE)) -L $(dir $(LIB_HALIDE)) -lHalide $(LDFLAGS) LIBHALIDE_LDFLAGS_STATIC ?= $(LIB_HALIDE_STATIC) $(LDFLAGS) -# Autoschedulers. Mullapudi2016 is currently the default, because it's fast. +# Autoschedulers. Mullapudi2016 is currently the default, because it's fast. AUTOSCHEDULER ?= mullapudi2016 ifneq ($(AUTOSCHEDULER),) -LIB_AUTOSCHEDULER ?= $(HALIDE_DISTRIB_PATH)/lib/libautoschedule_$(AUTOSCHEDULER).$(SHARED_EXT) +LIB_AUTOSCHEDULER ?= $(HALIDE_DISTRIB_PATH)/lib/libautoschedule_$(AUTOSCHEDULER).$(SHARED_EXT) ifeq ($(UNAME), Darwin) LIBHALIDE_LDFLAGS += -Wl,-force_load $(HALIDE_DISTRIB_PATH)/lib/libautoschedule_$(AUTOSCHEDULER).$(SHARED_EXT) else diff --git a/apps/unsharp/CMakeLists.txt b/apps/unsharp/CMakeLists.txt index 4221f1fa24eb..e824f08169a0 100644 --- a/apps/unsharp/CMakeLists.txt +++ b/apps/unsharp/CMakeLists.txt @@ -4,10 +4,13 @@ project(unsharp) enable_testing() # Set up language settings -set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) +# MSVC won't set __cplusplus correctly unless this flag is also set +add_compile_options($<$:-Zc:__cplusplus>) + # Find Halide find_package(Halide REQUIRED) diff --git a/apps/wavelet/CMakeLists.txt b/apps/wavelet/CMakeLists.txt index 91996859943d..81be2d8807f4 100644 --- a/apps/wavelet/CMakeLists.txt +++ b/apps/wavelet/CMakeLists.txt @@ -4,10 +4,13 @@ project(wavelet) enable_testing() # Set up language settings -set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) +# MSVC won't set __cplusplus correctly unless this flag is also set +add_compile_options($<$:-Zc:__cplusplus>) + # Find Halide find_package(Halide REQUIRED COMPONENTS PNG) diff --git a/dependencies/wasm/CMakeLists.txt b/dependencies/wasm/CMakeLists.txt index 1f2a33c958a2..614f9b982e76 100644 --- a/dependencies/wasm/CMakeLists.txt +++ b/dependencies/wasm/CMakeLists.txt @@ -109,7 +109,7 @@ function(add_wasm_executable TARGET) set(EMCC_FLAGS -O3 -g - -std=c++11 + -std=c++17 -Wall -Wcast-qual -Werror diff --git a/python_bindings/Makefile b/python_bindings/Makefile index 590ac613eda8..07e725f5efa9 100644 --- a/python_bindings/Makefile +++ b/python_bindings/Makefile @@ -39,7 +39,7 @@ OPTIMIZE ?= -O3 # OPTIMIZE ?= -g -DDEBUG=1 -UNDEBUG # Compiling with -fvisibility=hidden saves ~80k on optimized x64 builds -CCFLAGS=$(shell $(PYTHON)-config --cflags) $(PYBIND11_CFLAGS) -I $(HALIDE_DISTRIB_PATH)/include -I $(ROOT_DIR) -std=c++11 $(FPIC) -fvisibility=hidden -fvisibility-inlines-hidden $(OPTIMIZE) $(CXXFLAGS) +CCFLAGS=$(shell $(PYTHON)-config --cflags) $(PYBIND11_CFLAGS) -I $(HALIDE_DISTRIB_PATH)/include -I $(ROOT_DIR) -std=c++17 $(FPIC) -fvisibility=hidden -fvisibility-inlines-hidden $(OPTIMIZE) $(CXXFLAGS) # Filter out a pointless warning present in some Python installs CCFLAGS := $(filter-out -Wstrict-prototypes,$(CCFLAGS)) diff --git a/python_bindings/tutorial/lesson_13_tuples.py b/python_bindings/tutorial/lesson_13_tuples.py index 9a963f894b8d..cc25e943dad3 100644 --- a/python_bindings/tutorial/lesson_13_tuples.py +++ b/python_bindings/tutorial/lesson_13_tuples.py @@ -119,7 +119,7 @@ def main(): # You can construct a Tuple by passing multiple Exprs to the # Tuple constructor as we did above. Perhaps more elegantly, you - # can also take advantage of C++11 initializer lists and just + # can also take advantage of initializer lists and just # enclose your Exprs in braces: multi_valued_2 = hl.Func("multi_valued_2") multi_valued_2[x, y] = (x + y, hl.sin(x * y)) diff --git a/src/CodeGen_LLVM.cpp b/src/CodeGen_LLVM.cpp index 96360d475402..ce80da5ec57e 100644 --- a/src/CodeGen_LLVM.cpp +++ b/src/CodeGen_LLVM.cpp @@ -32,13 +32,7 @@ #include "Simplify.h" #include "Util.h" -#if !(__cplusplus > 199711L || _MSC_VER >= 1800) - -// VS2013 isn't fully C++11 compatible, but it supports enough of what Halide -// needs for now to be an acceptable minimum for Windows. -#error "Halide requires C++11 or VS2013+; please upgrade your compiler." - -#endif +static_assert(__cplusplus >= 201703L, "Halide requires C++17; please upgrade your compiler."); namespace Halide { diff --git a/src/Error.cpp b/src/Error.cpp index 18efdd8d08d8..0f84ed6ea5d0 100644 --- a/src/Error.cpp +++ b/src/Error.cpp @@ -142,7 +142,7 @@ ErrorReport::~ErrorReport() } #ifdef HALIDE_WITH_EXCEPTIONS - if (std::uncaught_exception()) { + if (std::uncaught_exceptions() > 0) { // This should never happen - evaluating one of the arguments // to the error message would have to throw an // exception. Nonetheless, in case it does, preserve the diff --git a/src/Error.h b/src/Error.h index 93411d1dfac7..1e37c48f0431 100644 --- a/src/Error.h +++ b/src/Error.h @@ -93,11 +93,7 @@ struct ErrorReport { * this by only actually throwing if there isn't an exception in * flight already. */ -#if __cplusplus >= 201100 || _MSC_VER >= 1900 ~ErrorReport() noexcept(false); -#else - ~ErrorReport(); -#endif }; // This uses operator precedence as a trick to avoid argument evaluation if diff --git a/src/Generator.h b/src/Generator.h index 19a02cf0ebb5..bda4d5757584 100644 --- a/src/Generator.h +++ b/src/Generator.h @@ -1363,7 +1363,7 @@ class StubOutputBuffer : public StubOutputBufferBase { }; // This is a union-like class that allows for convenient initialization of Stub Inputs -// via C++11 initializer-list syntax; it is only used in situations where the +// via initializer-list syntax; it is only used in situations where the // downstream consumer will be able to explicitly check that each value is // of the expected/required kind. class StubInput { @@ -3110,7 +3110,7 @@ class GeneratorBase : public NamesInterface, public GeneratorContext { user_assert(sizeof...(args) == pi.inputs().size()) << "Expected exactly " << pi.inputs().size() << " inputs but got " << sizeof...(args) << "\n"; - set_inputs_vector(build_inputs(std::forward_as_tuple(args...), make_index_sequence{})); + set_inputs_vector(build_inputs(std::forward_as_tuple(args...), std::make_index_sequence{})); } Realization realize(std::vector sizes) { @@ -3446,7 +3446,7 @@ class GeneratorBase : public NamesInterface, public GeneratorContext { } template - std::vector> build_inputs(const std::tuple &t, index_sequence) { + std::vector> build_inputs(const std::tuple &t, std::index_sequence) { return {build_input(Indices, std::get(t))...}; } diff --git a/src/ObjectInstanceRegistry.h b/src/ObjectInstanceRegistry.h index 2678e997b7da..f4a0d74a1848 100644 --- a/src/ObjectInstanceRegistry.h +++ b/src/ObjectInstanceRegistry.h @@ -5,8 +5,7 @@ * * Provides a single global registry of Generators, GeneratorParams, * and Params indexed by this pointer. This is used for finding the - * parameters inside of a Generator. NOTE: this is threadsafe only - * if you are compiling with C++11 enabled. + * parameters inside of a Generator. */ #include diff --git a/src/ThreadPool.h b/src/ThreadPool.h index 7e43ba8f4b5e..287acf29d88b 100644 --- a/src/ThreadPool.h +++ b/src/ThreadPool.h @@ -15,7 +15,7 @@ /** \file * Define a simple thread pool utility that is modeled on the api of - * C++11 std::async(); since implementation details of std::async + * std::async(); since implementation details of std::async * can vary considerably, with no control over thread spawning, this class * allows us to use the same model but with precise control over thread usage. * diff --git a/src/Type.h b/src/Type.h index d7ee59d4a81f..356732c9c03e 100644 --- a/src/Type.h +++ b/src/Type.h @@ -18,9 +18,7 @@ * time type checking for both Halide generated functions and calls * from Halide to external functions. * - * These are intended to be constexpr producable, but we don't depend - * on C++11 yet. In C++14, it is possible these will be replaced with - * introspection/reflection facilities. + * These are intended to be constexpr producable. * * halide_handle_traits has to go outside the Halide namespace due to template * resolution rules. TODO(zalman): Do all types need to be in global namespace? @@ -73,9 +71,7 @@ struct halide_cplusplus_type_name { /** A structure to represent the fully scoped name of a C++ composite * type for use in generating function signatures that use that type. * - * This is intended to be a constexpr usable type, but we don't depend - * on C++11 yet. In C++14, it is possible this will be replaced with - * introspection/reflection facilities. + * This is intended to be a constexpr usable type. * * Although this is in the global namespace, it should be considered "Halide Internal" * and subject to change; code outside Halide should avoid referencing it. diff --git a/src/Util.h b/src/Util.h index fb8791df4687..3ef06b250c58 100644 --- a/src/Util.h +++ b/src/Util.h @@ -345,61 +345,6 @@ struct ScopedValue { ScopedValue(ScopedValue &&that) noexcept = default; }; -// Wrappers for some C++14-isms that are useful and trivially implementable -// in C++11; these are defined in the Halide::Internal namespace. If we -// are compiling under C++14 or later, we just use the standard implementations -// rather than our own. -#if __cplusplus >= 201402L - -// C++14: Use the standard implementations -using std::index_sequence; -using std::integer_sequence; -using std::make_index_sequence; -using std::make_integer_sequence; - -#else - -// C++11: std::integer_sequence (etc) is standard in C++14 but not C++11, but -// is easily written in C++11. This is a simple version that could -// probably be improved. - -template -struct integer_sequence { - static constexpr size_t size() { - return sizeof...(Ints); - } -}; - -template -struct next_integer_sequence; - -template -struct next_integer_sequence> { - using type = integer_sequence; -}; - -template -struct make_integer_sequence_helper { - using type = typename next_integer_sequence< - typename make_integer_sequence_helper::type>::type; -}; - -template -struct make_integer_sequence_helper { - using type = integer_sequence; -}; - -template -using make_integer_sequence = typename make_integer_sequence_helper::type; - -template -using index_sequence = integer_sequence; - -template -using make_index_sequence = make_integer_sequence; - -#endif - // Helpers for timing blocks of code. Put 'TIC;' at the start and // 'TOC;' at the end. Timing is reported at the toc via // debug(0). The calls can be nested and will pretty-print diff --git a/src/autoschedulers/adams2019/autotune_loop.sh b/src/autoschedulers/adams2019/autotune_loop.sh index 7f99692402fc..311b6c16dee8 100755 --- a/src/autoschedulers/adams2019/autotune_loop.sh +++ b/src/autoschedulers/adams2019/autotune_loop.sh @@ -125,7 +125,7 @@ make_featurization() { # We don't need image I/O for this purpose, # so leave out libpng and libjpeg c++ \ - -std=c++11 \ + -std=c++17 \ -I ${HALIDE_DISTRIB_PATH}/include \ ${HALIDE_DISTRIB_PATH}/tools/RunGenMain.cpp \ ${D}/*.registration.cpp \ diff --git a/src/runtime/hexagon_remote/Makefile b/src/runtime/hexagon_remote/Makefile index 8e1e02a2a8c6..b49d00351e0e 100644 --- a/src/runtime/hexagon_remote/Makefile +++ b/src/runtime/hexagon_remote/Makefile @@ -153,7 +153,7 @@ $(BIN)/%/sim_remote.o: sim_remote.cpp sim_protocol.h known_symbols.h $(BIN)/src/ $(BIN)/%/sim_host.o: sim_host.cpp sim_protocol.h mkdir -p $(@D) - $(CXX-$*) -std=c++11 $(CCFLAGS-$*) -c sim_host.cpp -o $@ + $(CXX-$*) -std=c++17 $(CCFLAGS-$*) -c sim_host.cpp -o $@ $(BIN)/%/sim_qurt.o: sim_qurt.cpp mkdir -p $(@D) diff --git a/tools/mex_halide.m b/tools/mex_halide.m index b1dba967c5a0..63db5b16a82e 100644 --- a/tools/mex_halide.m +++ b/tools/mex_halide.m @@ -59,7 +59,7 @@ function mex_halide( generator_filename, varargin ) setenv('HALIDE_DISTRIB_PATH', halide_distrib_path); end halide_distrib_path = getenv('HALIDE_DISTRIB_PATH'); - + if ismac libhalide = fullfile(halide_distrib_path, 'lib', 'libHalide.dylib'); else @@ -79,7 +79,7 @@ function mex_halide( generator_filename, varargin ) gen_bin = fullfile(temp, [function_name, '.generator']); build_generator = ... [halide_cxx, ... - ' -g -Wall -std=c++11 -fno-rtti -I', halide_include, ' ', ... + ' -g -Wall -std=c++17 -fno-rtti -I', halide_include, ' ', ... gengen_filename, ' ', ... generator_filename, ' ', ... libhalide, ' ', ... diff --git a/tutorial/lesson_01_basics.cpp b/tutorial/lesson_01_basics.cpp index 38d949c4cd62..c9159c131c6a 100644 --- a/tutorial/lesson_01_basics.cpp +++ b/tutorial/lesson_01_basics.cpp @@ -3,11 +3,11 @@ // This lesson demonstrates basic usage of Halide as a JIT compiler for imaging. // On linux, you can compile and run it like so: -// g++ lesson_01*.cpp -g -I -L -lHalide -lpthread -ldl -o lesson_01 -std=c++11 +// g++ lesson_01*.cpp -g -I -L -lHalide -lpthread -ldl -o lesson_01 -std=c++17 // LD_LIBRARY_PATH= ./lesson_01 // On os x: -// g++ lesson_01*.cpp -g -I -L -lHalide -o lesson_01 -std=c++11 +// g++ lesson_01*.cpp -g -I -L -lHalide -o lesson_01 -std=c++17 // DYLD_LIBRARY_PATH= ./lesson_01 // If you have the entire Halide source tree, you can also build it by diff --git a/tutorial/lesson_02_input_image.cpp b/tutorial/lesson_02_input_image.cpp index 20f9485cfc63..824752fd3cd1 100644 --- a/tutorial/lesson_02_input_image.cpp +++ b/tutorial/lesson_02_input_image.cpp @@ -4,11 +4,11 @@ // them. // On linux, you can compile and run it like so: -// g++ lesson_02*.cpp -g -I -I -L -lHalide `libpng-config --cflags --ldflags` -ljpeg -lpthread -ldl -o lesson_02 -std=c++11 +// g++ lesson_02*.cpp -g -I -I -L -lHalide `libpng-config --cflags --ldflags` -ljpeg -lpthread -ldl -o lesson_02 -std=c++17 // LD_LIBRARY_PATH= ./lesson_02 // On os x: -// g++ lesson_02*.cpp -g -I -I -L -lHalide `libpng-config --cflags --ldflags` -ljpeg -o lesson_02 -std=c++11 +// g++ lesson_02*.cpp -g -I -I -L -lHalide `libpng-config --cflags --ldflags` -ljpeg -o lesson_02 -std=c++17 // DYLD_LIBRARY_PATH= ./lesson_02 // If you have the entire Halide source tree, you can also build it by diff --git a/tutorial/lesson_03_debugging_1.cpp b/tutorial/lesson_03_debugging_1.cpp index 11f7a4211ecc..02cb65217985 100644 --- a/tutorial/lesson_03_debugging_1.cpp +++ b/tutorial/lesson_03_debugging_1.cpp @@ -3,11 +3,11 @@ // This lesson demonstrates how to inspect what the Halide compiler is producing. // On linux, you can compile and run it like so: -// g++ lesson_03*.cpp -g -I -L -lHalide -lpthread -ldl -o lesson_03 -std=c++11 +// g++ lesson_03*.cpp -g -I -L -lHalide -lpthread -ldl -o lesson_03 -std=c++17 // LD_LIBRARY_PATH= ./lesson_03 // On os x: -// g++ lesson_03*.cpp -g -I -L -lHalide -o lesson_03 -std=c++11 +// g++ lesson_03*.cpp -g -I -L -lHalide -o lesson_03 -std=c++17 // DYLD_LIBRARY_PATH= ./lesson_03 // If you have the entire Halide source tree, you can also build it by diff --git a/tutorial/lesson_04_debugging_2.cpp b/tutorial/lesson_04_debugging_2.cpp index 49cd17df0a9b..b4090f6a00f9 100644 --- a/tutorial/lesson_04_debugging_2.cpp +++ b/tutorial/lesson_04_debugging_2.cpp @@ -3,11 +3,11 @@ // This lesson demonstrates how to follow what Halide is doing at runtime. // On linux, you can compile and run it like so: -// g++ lesson_04*.cpp -g -I -L -lHalide -lpthread -ldl -o lesson_04 -std=c++11 +// g++ lesson_04*.cpp -g -I -L -lHalide -lpthread -ldl -o lesson_04 -std=c++17 // LD_LIBRARY_PATH= ./lesson_04 // On os x: -// g++ lesson_04*.cpp -g -I -L -lHalide -o lesson_04 -std=c++11 +// g++ lesson_04*.cpp -g -I -L -lHalide -o lesson_04 -std=c++17 // DYLD_LIBRARY_PATH= ./lesson_04 // If you have the entire Halide source tree, you can also build it by diff --git a/tutorial/lesson_05_scheduling_1.cpp b/tutorial/lesson_05_scheduling_1.cpp index 2ac3930a1306..212159e27447 100644 --- a/tutorial/lesson_05_scheduling_1.cpp +++ b/tutorial/lesson_05_scheduling_1.cpp @@ -5,11 +5,11 @@ // parallelization, unrolling, and tiling. // On linux, you can compile and run it like so: -// g++ lesson_05*.cpp -g -I -L -lHalide -lpthread -ldl -o lesson_05 -std=c++11 +// g++ lesson_05*.cpp -g -I -L -lHalide -lpthread -ldl -o lesson_05 -std=c++17 // LD_LIBRARY_PATH= ./lesson_05 // On os x: -// g++ lesson_05*.cpp -g -I -L -lHalide -o lesson_05 -std=c++11 +// g++ lesson_05*.cpp -g -I -L -lHalide -o lesson_05 -std=c++17 // DYLD_LIBRARY_PATH= ./lesson_05 // If you have the entire Halide source tree, you can also build it by diff --git a/tutorial/lesson_06_realizing_over_shifted_domains.cpp b/tutorial/lesson_06_realizing_over_shifted_domains.cpp index 283df77365ab..7281e5b385cd 100644 --- a/tutorial/lesson_06_realizing_over_shifted_domains.cpp +++ b/tutorial/lesson_06_realizing_over_shifted_domains.cpp @@ -4,11 +4,11 @@ // does not start at (0, 0). // On linux, you can compile and run it like so: -// g++ lesson_06*.cpp -g -I -L -lHalide -lpthread -ldl -o lesson_06 -std=c++11 +// g++ lesson_06*.cpp -g -I -L -lHalide -lpthread -ldl -o lesson_06 -std=c++17 // LD_LIBRARY_PATH= ./lesson_06 // On os x: -// g++ lesson_06*.cpp -g -I -L -lHalide -o lesson_06 -std=c++11 +// g++ lesson_06*.cpp -g -I -L -lHalide -o lesson_06 -std=c++17 // DYLD_LIBRARY_PATH= ./lesson_06 // If you have the entire Halide source tree, you can also build it by diff --git a/tutorial/lesson_07_multi_stage_pipelines.cpp b/tutorial/lesson_07_multi_stage_pipelines.cpp index 49df7a804675..b862537b2867 100644 --- a/tutorial/lesson_07_multi_stage_pipelines.cpp +++ b/tutorial/lesson_07_multi_stage_pipelines.cpp @@ -1,11 +1,11 @@ // Halide tutorial lesson 7: Multi-stage pipelines // On linux, you can compile and run it like so: -// g++ lesson_07*.cpp -g -std=c++11 -I -I -L -lHalide `libpng-config --cflags --ldflags` -ljpeg -lpthread -ldl -o lesson_07 +// g++ lesson_07*.cpp -g -std=c++17 -I -I -L -lHalide `libpng-config --cflags --ldflags` -ljpeg -lpthread -ldl -o lesson_07 // LD_LIBRARY_PATH= ./lesson_07 // On os x: -// g++ lesson_07*.cpp -g -std=c++11 -I -I -L -lHalide `libpng-config --cflags --ldflags` -ljpeg -o lesson_07 +// g++ lesson_07*.cpp -g -std=c++17 -I -I -L -lHalide `libpng-config --cflags --ldflags` -ljpeg -o lesson_07 // DYLD_LIBRARY_PATH= ./lesson_07 // If you have the entire Halide source tree, you can also build it by diff --git a/tutorial/lesson_08_scheduling_2.cpp b/tutorial/lesson_08_scheduling_2.cpp index 80db19489b7e..73bdf2c7e5ed 100644 --- a/tutorial/lesson_08_scheduling_2.cpp +++ b/tutorial/lesson_08_scheduling_2.cpp @@ -1,11 +1,11 @@ // Halide tutorial lesson 8: Scheduling multi-stage pipelines // On linux, you can compile and run it like so: -// g++ lesson_08*.cpp -g -std=c++11 -I -L -lHalide -lpthread -ldl -o lesson_08 +// g++ lesson_08*.cpp -g -std=c++17 -I -L -lHalide -lpthread -ldl -o lesson_08 // LD_LIBRARY_PATH= ./lesson_08 // On os x: -// g++ lesson_08*.cpp -g -std=c++11 -I -L -lHalide -o lesson_08 +// g++ lesson_08*.cpp -g -std=c++17 -I -L -lHalide -o lesson_08 // DYLD_LIBRARY_PATH= ./lesson_08 // If you have the entire Halide source tree, you can also build it by diff --git a/tutorial/lesson_09_update_definitions.cpp b/tutorial/lesson_09_update_definitions.cpp index f48480b3c2fc..ac7cee108d61 100644 --- a/tutorial/lesson_09_update_definitions.cpp +++ b/tutorial/lesson_09_update_definitions.cpp @@ -1,11 +1,11 @@ // Halide tutorial lesson 9: Multi-pass Funcs, update definitions, and reductions // On linux, you can compile and run it like so: -// g++ lesson_09*.cpp -g -std=c++11 -I -I -L -lHalide `libpng-config --cflags --ldflags` -ljpeg -lpthread -ldl -fopenmp -o lesson_09 +// g++ lesson_09*.cpp -g -std=c++17 -I -I -L -lHalide `libpng-config --cflags --ldflags` -ljpeg -lpthread -ldl -fopenmp -o lesson_09 // LD_LIBRARY_PATH= ./lesson_09 // On os x (will only work if you actually have g++, not Apple's pretend g++ which is actually clang): -// g++ lesson_09*.cpp -g -std=c++11 -I -I -L -lHalide `libpng-config --cflags --ldflags` -ljpeg -fopenmp -o lesson_09 +// g++ lesson_09*.cpp -g -std=c++17 -I -I -L -lHalide `libpng-config --cflags --ldflags` -ljpeg -fopenmp -o lesson_09 // DYLD_LIBRARY_PATH= ./lesson_09 // If you have the entire Halide source tree, you can also build it by diff --git a/tutorial/lesson_10_aot_compilation_generate.cpp b/tutorial/lesson_10_aot_compilation_generate.cpp index 989dff124bfa..a30032f10b9d 100644 --- a/tutorial/lesson_10_aot_compilation_generate.cpp +++ b/tutorial/lesson_10_aot_compilation_generate.cpp @@ -10,13 +10,13 @@ // compiling this code is a multi-step process. // On linux, you can compile and run it like so: -// g++ lesson_10*generate.cpp -g -std=c++11 -I -L -lHalide -lpthread -ldl -o lesson_10_generate +// g++ lesson_10*generate.cpp -g -std=c++17 -I -L -lHalide -lpthread -ldl -o lesson_10_generate // LD_LIBRARY_PATH= ./lesson_10_generate -// g++ lesson_10*run.cpp lesson_10_halide.a -std=c++11 -I -lpthread -ldl -o lesson_10_run +// g++ lesson_10*run.cpp lesson_10_halide.a -std=c++17 -I -lpthread -ldl -o lesson_10_run // ./lesson_10_run // On os x: -// g++ lesson_10*generate.cpp -g -std=c++11 -I -L -lHalide -o lesson_10_generate +// g++ lesson_10*generate.cpp -g -std=c++17 -I -L -lHalide -o lesson_10_generate // DYLD_LIBRARY_PATH= ./lesson_10_generate // g++ lesson_10*run.cpp lesson_10_halide.a -o lesson_10_run -I // ./lesson_10_run diff --git a/tutorial/lesson_11_cross_compilation.cpp b/tutorial/lesson_11_cross_compilation.cpp index 617dbeb5a210..63652f7078fc 100644 --- a/tutorial/lesson_11_cross_compilation.cpp +++ b/tutorial/lesson_11_cross_compilation.cpp @@ -4,11 +4,11 @@ // generate code for any platform from any platform. // On linux, you can compile and run it like so: -// g++ lesson_11*.cpp -g -std=c++11 -I -L -lHalide -lpthread -ldl -o lesson_11 +// g++ lesson_11*.cpp -g -std=c++17 -I -L -lHalide -lpthread -ldl -o lesson_11 // LD_LIBRARY_PATH= ./lesson_11 // On os x: -// g++ lesson_11*.cpp -g -std=c++11 -I -L -lHalide -o lesson_11 +// g++ lesson_11*.cpp -g -std=c++17 -I -L -lHalide -o lesson_11 // DYLD_LIBRARY_PATH= ./lesson_11 // If you have the entire Halide source tree, you can also build it by diff --git a/tutorial/lesson_12_using_the_gpu.cpp b/tutorial/lesson_12_using_the_gpu.cpp index 682a7ff81410..a8d530e37280 100644 --- a/tutorial/lesson_12_using_the_gpu.cpp +++ b/tutorial/lesson_12_using_the_gpu.cpp @@ -3,11 +3,11 @@ // This lesson demonstrates how to use Halide to run code on a GPU using OpenCL. // On linux, you can compile and run it like so: -// g++ lesson_12*.cpp -g -std=c++11 -I -I -L -lHalide `libpng-config --cflags --ldflags` -ljpeg -lpthread -ldl -o lesson_12 +// g++ lesson_12*.cpp -g -std=c++17 -I -I -L -lHalide `libpng-config --cflags --ldflags` -ljpeg -lpthread -ldl -o lesson_12 // LD_LIBRARY_PATH= ./lesson_12 // On os x: -// g++ lesson_12*.cpp -g -std=c++11 -I -I -L -lHalide `libpng-config --cflags --ldflags` -ljpeg -o lesson_12 +// g++ lesson_12*.cpp -g -std=c++17 -I -I -L -lHalide `libpng-config --cflags --ldflags` -ljpeg -o lesson_12 // DYLD_LIBRARY_PATH= ./lesson_12 // If you have the entire Halide source tree, you can also build it by diff --git a/tutorial/lesson_13_tuples.cpp b/tutorial/lesson_13_tuples.cpp index 5218cb01e652..b5b3e6ded16e 100644 --- a/tutorial/lesson_13_tuples.cpp +++ b/tutorial/lesson_13_tuples.cpp @@ -4,11 +4,11 @@ // values. // On linux, you can compile and run it like so: -// g++ lesson_13*.cpp -g -I -L -lHalide -lpthread -ldl -o lesson_13 -std=c++11 +// g++ lesson_13*.cpp -g -I -L -lHalide -lpthread -ldl -o lesson_13 -std=c++17 // LD_LIBRARY_PATH= ./lesson_13 // On os x: -// g++ lesson_13*.cpp -g -I -L -lHalide -o lesson_13 -std=c++11 +// g++ lesson_13*.cpp -g -I -L -lHalide -o lesson_13 -std=c++17 // DYLD_LIBRARY_PATH= ./lesson_13 // If you have the entire Halide source tree, you can also build it by diff --git a/tutorial/lesson_14_types.cpp b/tutorial/lesson_14_types.cpp index 8a370c1084f2..b43d13bf5e9d 100644 --- a/tutorial/lesson_14_types.cpp +++ b/tutorial/lesson_14_types.cpp @@ -3,11 +3,11 @@ // This lesson more precisely describes Halide's type system. // On linux, you can compile and run it like so: -// g++ lesson_14*.cpp -g -I -L -lHalide -lpthread -ldl -o lesson_14 -std=c++11 +// g++ lesson_14*.cpp -g -I -L -lHalide -lpthread -ldl -o lesson_14 -std=c++17 // LD_LIBRARY_PATH= ./lesson_14 // On os x: -// g++ lesson_14*.cpp -g -I -L -lHalide -o lesson_14 -std=c++11 +// g++ lesson_14*.cpp -g -I -L -lHalide -o lesson_14 -std=c++17 // DYLD_LIBRARY_PATH= ./lesson_14 // If you have the entire Halide source tree, you can also build it by diff --git a/tutorial/lesson_15_generators.cpp b/tutorial/lesson_15_generators.cpp index 2f194248f79d..831e7924d464 100644 --- a/tutorial/lesson_15_generators.cpp +++ b/tutorial/lesson_15_generators.cpp @@ -4,11 +4,11 @@ // reusable components called generators. // On linux, you can compile and run it like so: -// g++ lesson_15*.cpp /GenGen.cpp -g -std=c++11 -fno-rtti -I -L -lHalide -lpthread -ldl -o lesson_15_generate +// g++ lesson_15*.cpp /GenGen.cpp -g -std=c++17 -fno-rtti -I -L -lHalide -lpthread -ldl -o lesson_15_generate // bash lesson_15_generators_usage.sh // On os x: -// g++ lesson_15*.cpp /GenGen.cpp -g -std=c++11 -fno-rtti -I -L -lHalide -o lesson_15_generate +// g++ lesson_15*.cpp /GenGen.cpp -g -std=c++17 -fno-rtti -I -L -lHalide -o lesson_15_generate // bash lesson_15_generators_usage.sh // If you have the entire Halide source tree, you can also build it by diff --git a/tutorial/lesson_16_rgb_generate.cpp b/tutorial/lesson_16_rgb_generate.cpp index 5b57548994f3..3621a6f9f2ef 100644 --- a/tutorial/lesson_16_rgb_generate.cpp +++ b/tutorial/lesson_16_rgb_generate.cpp @@ -6,7 +6,7 @@ // On linux or os x, you can compile and run it like so: -// g++ lesson_16_rgb_generate.cpp /GenGen.cpp -g -std=c++11 -fno-rtti -I -L -lHalide -lpthread -ldl -o lesson_16_generate +// g++ lesson_16_rgb_generate.cpp /GenGen.cpp -g -std=c++17 -fno-rtti -I -L -lHalide -lpthread -ldl -o lesson_16_generate // export LD_LIBRARY_PATH= # For linux // export DYLD_LIBRARY_PATH= # For OS X // ./lesson_16_generate -g brighten -o . -f brighten_planar target=host layout=planar diff --git a/tutorial/lesson_17_predicated_rdom.cpp b/tutorial/lesson_17_predicated_rdom.cpp index a781fe2bc038..164e64cdd1a0 100644 --- a/tutorial/lesson_17_predicated_rdom.cpp +++ b/tutorial/lesson_17_predicated_rdom.cpp @@ -4,11 +4,11 @@ // subsets of a reduction domain using predicates. // On linux, you can compile and run it like so: -// g++ lesson_17*.cpp -g -I -L -lHalide -lpthread -ldl -o lesson_17 -std=c++11 +// g++ lesson_17*.cpp -g -I -L -lHalide -lpthread -ldl -o lesson_17 -std=c++17 // LD_LIBRARY_PATH= ./lesson_17 // On os x: -// g++ lesson_17*.cpp -g -I -L -lHalide -o lesson_17 -std=c++11 +// g++ lesson_17*.cpp -g -I -L -lHalide -o lesson_17 -std=c++17 // DYLD_LIBRARY_PATH= ./lesson_17 // If you have the entire Halide source tree, you can also build it by diff --git a/tutorial/lesson_18_parallel_associative_reductions.cpp b/tutorial/lesson_18_parallel_associative_reductions.cpp index db628a662f90..18e3aa010f4d 100644 --- a/tutorial/lesson_18_parallel_associative_reductions.cpp +++ b/tutorial/lesson_18_parallel_associative_reductions.cpp @@ -4,11 +4,11 @@ // reduction using the scheduling directive 'rfactor'. // On linux, you can compile and run it like so: -// g++ lesson_18*.cpp -g -I -L -lHalide -lpthread -ldl -o lesson_18 -std=c++11 +// g++ lesson_18*.cpp -g -I -L -lHalide -lpthread -ldl -o lesson_18 -std=c++17 // LD_LIBRARY_PATH= ./lesson_18 // On os x: -// g++ lesson_18*.cpp -g -I -L -lHalide -o lesson_18 -std=c++11 +// g++ lesson_18*.cpp -g -I -L -lHalide -o lesson_18 -std=c++17 // DYLD_LIBRARY_PATH= ./lesson_18 // If you have the entire Halide source tree, you can also build it by diff --git a/tutorial/lesson_19_wrapper_funcs.cpp b/tutorial/lesson_19_wrapper_funcs.cpp index 47daa4831968..308d1d64e545 100644 --- a/tutorial/lesson_19_wrapper_funcs.cpp +++ b/tutorial/lesson_19_wrapper_funcs.cpp @@ -5,11 +5,11 @@ // from a Func or an ImageParam. // On linux, you can compile and run it like so: -// g++ lesson_19*.cpp -g -I -L -lHalide -lpthread -ldl -o lesson_19 -std=c++11 +// g++ lesson_19*.cpp -g -I -L -lHalide -lpthread -ldl -o lesson_19 -std=c++17 // LD_LIBRARY_PATH= ./lesson_19 // On os x: -// g++ lesson_19*.cpp -g -I -L -lHalide -o lesson_19 -std=c++11 +// g++ lesson_19*.cpp -g -I -L -lHalide -o lesson_19 -std=c++17 // DYLD_LIBRARY_PATH= ./lesson_19 // If you have the entire Halide source tree, you can also build it by diff --git a/tutorial/lesson_20_cloning_funcs.cpp b/tutorial/lesson_20_cloning_funcs.cpp index 452977272762..d8ed6ddf1e2d 100644 --- a/tutorial/lesson_20_cloning_funcs.cpp +++ b/tutorial/lesson_20_cloning_funcs.cpp @@ -4,11 +4,11 @@ // a Func. // On linux, you can compile and run it like so: -// g++ lesson_20*.cpp -g -I -L -lHalide -lpthread -ldl -o lesson_20 -std=c++11 +// g++ lesson_20*.cpp -g -I -L -lHalide -lpthread -ldl -o lesson_20 -std=c++17 // LD_LIBRARY_PATH= ./lesson_20 // On os x: -// g++ lesson_20*.cpp -g -I -L -lHalide -o lesson_20 -std=c++11 +// g++ lesson_20*.cpp -g -I -L -lHalide -o lesson_20 -std=c++17 // DYLD_LIBRARY_PATH= ./lesson_20 // If you have the entire Halide source tree, you can also build it by diff --git a/tutorial/lesson_21_auto_scheduler_generate.cpp b/tutorial/lesson_21_auto_scheduler_generate.cpp index 7acd0f4fe35e..14803799c7b4 100644 --- a/tutorial/lesson_21_auto_scheduler_generate.cpp +++ b/tutorial/lesson_21_auto_scheduler_generate.cpp @@ -7,12 +7,12 @@ // On linux or os x, you can compile and run it like so: -// g++ lesson_21_auto_scheduler_generate.cpp /GenGen.cpp -g -std=c++11 -fno-rtti -I -L -lHalide -lpthread -ldl -o lesson_21_generate +// g++ lesson_21_auto_scheduler_generate.cpp /GenGen.cpp -g -std=c++17 -fno-rtti -I -L -lHalide -lpthread -ldl -o lesson_21_generate // export LD_LIBRARY_PATH= # For linux // export DYLD_LIBRARY_PATH= # For OS X // ./lesson_21_generate -o . -g auto_schedule_gen -f auto_schedule_false -e static_library,h,schedule target=host auto_schedule=false // ./lesson_21_generate -o . -g auto_schedule_gen -f auto_schedule_true -e static_library,h,schedule -p -S Mullapudi2016 target=host auto_schedule=true machine_params=32,16777216,40 -// g++ lesson_21_auto_scheduler_run.cpp -std=c++11 -I -I auto_schedule_false.a auto_schedule_true.a -ldl -lpthread -o lesson_21_run +// g++ lesson_21_auto_scheduler_run.cpp -std=c++17 -I -I auto_schedule_false.a auto_schedule_true.a -ldl -lpthread -o lesson_21_run // ./lesson_21_run // If you have the entire Halide source tree, you can also build it by From 461c7d58dd215e5b1400ab66b50f069c64dedab6 Mon Sep 17 00:00:00 2001 From: Steven Johnson Date: Thu, 24 Sep 2020 14:45:55 -0700 Subject: [PATCH 02/53] Check _MSVC_LANG --- CMakeLists.txt | 3 --- apps/bgu/CMakeLists.txt | 3 --- apps/bilateral_grid/CMakeLists.txt | 3 --- apps/blur/CMakeLists.txt | 3 --- apps/c_backend/CMakeLists.txt | 3 --- apps/camera_pipe/CMakeLists.txt | 3 --- apps/conv_layer/CMakeLists.txt | 3 --- apps/cuda_mat_mul/CMakeLists.txt | 3 --- apps/depthwise_separable_conv/CMakeLists.txt | 3 --- apps/glsl/CMakeLists.txt | 3 --- apps/harris/CMakeLists.txt | 3 --- apps/hist/CMakeLists.txt | 3 --- apps/iir_blur/CMakeLists.txt | 3 --- apps/interpolate/CMakeLists.txt | 3 --- apps/lens_blur/CMakeLists.txt | 3 --- apps/linear_algebra/CMakeLists.txt | 3 --- apps/local_laplacian/CMakeLists.txt | 3 --- apps/max_filter/CMakeLists.txt | 3 --- apps/nl_means/CMakeLists.txt | 3 --- apps/resize/CMakeLists.txt | 3 --- apps/stencil_chain/CMakeLists.txt | 3 --- apps/unsharp/CMakeLists.txt | 3 --- apps/wavelet/CMakeLists.txt | 3 --- src/CodeGen_LLVM.cpp | 7 ++++++- 24 files changed, 6 insertions(+), 70 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bf39273488b8..3758c9f715aa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -47,9 +47,6 @@ set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) -# MSVC won't set __cplusplus correctly unless this flag is also set -add_compile_options($<$:-Zc:__cplusplus>) - ## # Import dependencies ## diff --git a/apps/bgu/CMakeLists.txt b/apps/bgu/CMakeLists.txt index 7c74fa16b38a..8348e8595057 100644 --- a/apps/bgu/CMakeLists.txt +++ b/apps/bgu/CMakeLists.txt @@ -8,9 +8,6 @@ set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) -# MSVC won't set __cplusplus correctly unless this flag is also set -add_compile_options($<$:-Zc:__cplusplus>) - # Find Halide find_package(Halide REQUIRED) diff --git a/apps/bilateral_grid/CMakeLists.txt b/apps/bilateral_grid/CMakeLists.txt index 487d86a12e7d..c84eaa4d2035 100644 --- a/apps/bilateral_grid/CMakeLists.txt +++ b/apps/bilateral_grid/CMakeLists.txt @@ -8,9 +8,6 @@ set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) -# MSVC won't set __cplusplus correctly unless this flag is also set -add_compile_options($<$:-Zc:__cplusplus>) - # Find Halide find_package(Halide REQUIRED) diff --git a/apps/blur/CMakeLists.txt b/apps/blur/CMakeLists.txt index e1f52ed35042..20447cd6f5c7 100644 --- a/apps/blur/CMakeLists.txt +++ b/apps/blur/CMakeLists.txt @@ -8,9 +8,6 @@ set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) -# MSVC won't set __cplusplus correctly unless this flag is also set -add_compile_options($<$:-Zc:__cplusplus>) - # Find Halide find_package(Halide REQUIRED) find_package(OpenMP) diff --git a/apps/c_backend/CMakeLists.txt b/apps/c_backend/CMakeLists.txt index 6325a61efd11..7818f6e7a245 100644 --- a/apps/c_backend/CMakeLists.txt +++ b/apps/c_backend/CMakeLists.txt @@ -8,9 +8,6 @@ set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) -# MSVC won't set __cplusplus correctly unless this flag is also set -add_compile_options($<$:-Zc:__cplusplus>) - # Find Halide find_package(Halide REQUIRED) diff --git a/apps/camera_pipe/CMakeLists.txt b/apps/camera_pipe/CMakeLists.txt index ea5656ac5be5..5b8cba2ed5e6 100644 --- a/apps/camera_pipe/CMakeLists.txt +++ b/apps/camera_pipe/CMakeLists.txt @@ -8,9 +8,6 @@ set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) -# MSVC won't set __cplusplus correctly unless this flag is also set -add_compile_options($<$:-Zc:__cplusplus>) - # Find Halide find_package(Halide REQUIRED) diff --git a/apps/conv_layer/CMakeLists.txt b/apps/conv_layer/CMakeLists.txt index 664261ba3154..430e053c525e 100644 --- a/apps/conv_layer/CMakeLists.txt +++ b/apps/conv_layer/CMakeLists.txt @@ -8,9 +8,6 @@ set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) -# MSVC won't set __cplusplus correctly unless this flag is also set -add_compile_options($<$:-Zc:__cplusplus>) - # Find Halide find_package(Halide REQUIRED) diff --git a/apps/cuda_mat_mul/CMakeLists.txt b/apps/cuda_mat_mul/CMakeLists.txt index 4ab7b45d1d64..335669ff9721 100644 --- a/apps/cuda_mat_mul/CMakeLists.txt +++ b/apps/cuda_mat_mul/CMakeLists.txt @@ -19,9 +19,6 @@ set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) -# MSVC won't set __cplusplus correctly unless this flag is also set -add_compile_options($<$:-Zc:__cplusplus>) - # Find Halide find_package(Halide REQUIRED) diff --git a/apps/depthwise_separable_conv/CMakeLists.txt b/apps/depthwise_separable_conv/CMakeLists.txt index 643364ba3de6..3668b0590743 100644 --- a/apps/depthwise_separable_conv/CMakeLists.txt +++ b/apps/depthwise_separable_conv/CMakeLists.txt @@ -8,9 +8,6 @@ set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) -# MSVC won't set __cplusplus correctly unless this flag is also set -add_compile_options($<$:-Zc:__cplusplus>) - # Find Halide find_package(Halide REQUIRED) diff --git a/apps/glsl/CMakeLists.txt b/apps/glsl/CMakeLists.txt index 4906f380aa00..a1e57937abd1 100644 --- a/apps/glsl/CMakeLists.txt +++ b/apps/glsl/CMakeLists.txt @@ -13,9 +13,6 @@ set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) -# MSVC won't set __cplusplus correctly unless this flag is also set -add_compile_options($<$:-Zc:__cplusplus>) - # Find Halide find_package(Halide REQUIRED) diff --git a/apps/harris/CMakeLists.txt b/apps/harris/CMakeLists.txt index 811a0c6afb4b..e309a0b8e63d 100644 --- a/apps/harris/CMakeLists.txt +++ b/apps/harris/CMakeLists.txt @@ -8,9 +8,6 @@ set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) -# MSVC won't set __cplusplus correctly unless this flag is also set -add_compile_options($<$:-Zc:__cplusplus>) - # Find Halide find_package(Halide REQUIRED) diff --git a/apps/hist/CMakeLists.txt b/apps/hist/CMakeLists.txt index 4a8656d0ba72..b0d97032a403 100644 --- a/apps/hist/CMakeLists.txt +++ b/apps/hist/CMakeLists.txt @@ -8,9 +8,6 @@ set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) -# MSVC won't set __cplusplus correctly unless this flag is also set -add_compile_options($<$:-Zc:__cplusplus>) - # Find Halide find_package(Halide REQUIRED) diff --git a/apps/iir_blur/CMakeLists.txt b/apps/iir_blur/CMakeLists.txt index 6ee2ce8a16a3..17df04ba3c65 100644 --- a/apps/iir_blur/CMakeLists.txt +++ b/apps/iir_blur/CMakeLists.txt @@ -8,9 +8,6 @@ set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) -# MSVC won't set __cplusplus correctly unless this flag is also set -add_compile_options($<$:-Zc:__cplusplus>) - # Find Halide find_package(Halide REQUIRED) diff --git a/apps/interpolate/CMakeLists.txt b/apps/interpolate/CMakeLists.txt index 6130cb890fb6..ce7e5b667126 100644 --- a/apps/interpolate/CMakeLists.txt +++ b/apps/interpolate/CMakeLists.txt @@ -8,9 +8,6 @@ set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) -# MSVC won't set __cplusplus correctly unless this flag is also set -add_compile_options($<$:-Zc:__cplusplus>) - # Find Halide find_package(Halide REQUIRED) diff --git a/apps/lens_blur/CMakeLists.txt b/apps/lens_blur/CMakeLists.txt index 698a9d2a9a8a..b7f86bee2c76 100644 --- a/apps/lens_blur/CMakeLists.txt +++ b/apps/lens_blur/CMakeLists.txt @@ -8,9 +8,6 @@ set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) -# MSVC won't set __cplusplus correctly unless this flag is also set -add_compile_options($<$:-Zc:__cplusplus>) - # Find Halide find_package(Halide REQUIRED) diff --git a/apps/linear_algebra/CMakeLists.txt b/apps/linear_algebra/CMakeLists.txt index 8c5b873a5255..7237489f225f 100644 --- a/apps/linear_algebra/CMakeLists.txt +++ b/apps/linear_algebra/CMakeLists.txt @@ -8,9 +8,6 @@ set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) -# MSVC won't set __cplusplus correctly unless this flag is also set -add_compile_options($<$:-Zc:__cplusplus>) - # Find Halide find_package(Halide REQUIRED COMPONENTS Halide) diff --git a/apps/local_laplacian/CMakeLists.txt b/apps/local_laplacian/CMakeLists.txt index 276b42341862..b15b51a4c91e 100644 --- a/apps/local_laplacian/CMakeLists.txt +++ b/apps/local_laplacian/CMakeLists.txt @@ -8,9 +8,6 @@ set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) -# MSVC won't set __cplusplus correctly unless this flag is also set -add_compile_options($<$:-Zc:__cplusplus>) - # Find Halide find_package(Halide REQUIRED) diff --git a/apps/max_filter/CMakeLists.txt b/apps/max_filter/CMakeLists.txt index 68bdc7a55161..b558d0da1209 100644 --- a/apps/max_filter/CMakeLists.txt +++ b/apps/max_filter/CMakeLists.txt @@ -8,9 +8,6 @@ set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) -# MSVC won't set __cplusplus correctly unless this flag is also set -add_compile_options($<$:-Zc:__cplusplus>) - # Find Halide find_package(Halide REQUIRED) diff --git a/apps/nl_means/CMakeLists.txt b/apps/nl_means/CMakeLists.txt index c430ef03a385..f41f55b40ed8 100644 --- a/apps/nl_means/CMakeLists.txt +++ b/apps/nl_means/CMakeLists.txt @@ -8,9 +8,6 @@ set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) -# MSVC won't set __cplusplus correctly unless this flag is also set -add_compile_options($<$:-Zc:__cplusplus>) - # Find Halide find_package(Halide REQUIRED) diff --git a/apps/resize/CMakeLists.txt b/apps/resize/CMakeLists.txt index 16a016af8204..d16733057cb3 100644 --- a/apps/resize/CMakeLists.txt +++ b/apps/resize/CMakeLists.txt @@ -8,9 +8,6 @@ set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) -# MSVC won't set __cplusplus correctly unless this flag is also set -add_compile_options($<$:-Zc:__cplusplus>) - # Find Halide find_package(Halide REQUIRED) diff --git a/apps/stencil_chain/CMakeLists.txt b/apps/stencil_chain/CMakeLists.txt index e354d0db9c2f..e9b23f69e12f 100644 --- a/apps/stencil_chain/CMakeLists.txt +++ b/apps/stencil_chain/CMakeLists.txt @@ -8,9 +8,6 @@ set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) -# MSVC won't set __cplusplus correctly unless this flag is also set -add_compile_options($<$:-Zc:__cplusplus>) - # Find Halide find_package(Halide REQUIRED) diff --git a/apps/unsharp/CMakeLists.txt b/apps/unsharp/CMakeLists.txt index e824f08169a0..81fb1ff898e0 100644 --- a/apps/unsharp/CMakeLists.txt +++ b/apps/unsharp/CMakeLists.txt @@ -8,9 +8,6 @@ set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) -# MSVC won't set __cplusplus correctly unless this flag is also set -add_compile_options($<$:-Zc:__cplusplus>) - # Find Halide find_package(Halide REQUIRED) diff --git a/apps/wavelet/CMakeLists.txt b/apps/wavelet/CMakeLists.txt index 81be2d8807f4..58297fd8a523 100644 --- a/apps/wavelet/CMakeLists.txt +++ b/apps/wavelet/CMakeLists.txt @@ -8,9 +8,6 @@ set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) -# MSVC won't set __cplusplus correctly unless this flag is also set -add_compile_options($<$:-Zc:__cplusplus>) - # Find Halide find_package(Halide REQUIRED COMPONENTS PNG) diff --git a/src/CodeGen_LLVM.cpp b/src/CodeGen_LLVM.cpp index ce80da5ec57e..5d7c27525796 100644 --- a/src/CodeGen_LLVM.cpp +++ b/src/CodeGen_LLVM.cpp @@ -32,7 +32,12 @@ #include "Simplify.h" #include "Util.h" -static_assert(__cplusplus >= 201703L, "Halide requires C++17; please upgrade your compiler."); +// MSVC won't set __cplusplus correctly unless certain compiler flags are set +// (and CMake doesn't set those flags for you even if you specify C++17), +// so we need to check against _MSVC_LANG as well, for completeness. +#if !(__cplusplus >= 201703L || _MSVC_LANG >= 201703L) +#error "Halide requires C++17 or later; please upgrade your compiler." +#endif namespace Halide { From fd4a18ecdf5b18faac6850696d197058eceae4fd Mon Sep 17 00:00:00 2001 From: Steven Johnson Date: Mon, 2 Nov 2020 10:34:39 -0800 Subject: [PATCH 03/53] Fix for trunk LLVM --- src/CodeGen_LLVM.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/CodeGen_LLVM.cpp b/src/CodeGen_LLVM.cpp index a2014e9f4999..e7b4d7954fbd 100644 --- a/src/CodeGen_LLVM.cpp +++ b/src/CodeGen_LLVM.cpp @@ -1245,7 +1245,11 @@ void CodeGen_LLVM::optimize_module() { // 21.04 -> 14.78 using current ToT release build. (See also https://reviews.llvm.org/rL358304) pto.ForgetAllSCEVInLoopUnroll = true; +#if LLVM_VERSION >= 120 + llvm::PassBuilder pb(/*DebugLogging*/ false, tm.get(), pto); +#else llvm::PassBuilder pb(tm.get(), pto); +#endif bool debug_pass_manager = false; // These analysis managers have to be declared in this order. From 83bd7795be7969a33e7eec1c7a1c2da768abe82b Mon Sep 17 00:00:00 2001 From: Steven Johnson Date: Mon, 2 Nov 2020 10:37:35 -0800 Subject: [PATCH 04/53] fixes --- src/FindCalls.cpp | 2 +- src/Profiling.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/FindCalls.cpp b/src/FindCalls.cpp index 1adf6f8a600b..9a320519f4d2 100644 --- a/src/FindCalls.cpp +++ b/src/FindCalls.cpp @@ -74,7 +74,7 @@ void populate_environment_helper(Function f, map &env, } else { env[f.name()] = f; - for (pair i : calls.calls) { + for (pair &i : calls.calls) { populate_environment_helper(i.second, env, recursive, include_wrappers); } } diff --git a/src/Profiling.cpp b/src/Profiling.cpp index c5a9fa6839b2..aad4213eb50b 100644 --- a/src/Profiling.cpp +++ b/src/Profiling.cpp @@ -351,7 +351,7 @@ Stmt inject_profiling(Stmt s, const string &pipeline_name) { MemoryType::Auto, {num_funcs}, const_true(), s); } - for (std::pair p : profiling.indices) { + for (std::pair &p : profiling.indices) { s = Block::make(Store::make("profiling_func_names", p.first, p.second, Parameter(), const_true(), ModulusRemainder()), s); } From 8be3b6a2597c6e418aa218d77de75dbb17fc09df Mon Sep 17 00:00:00 2001 From: Steven Johnson Date: Mon, 2 Nov 2020 11:10:49 -0800 Subject: [PATCH 05/53] Fix various clang-tidy issues For some reason, these are only getting flagged under C++17 builds, but they are legit (minor) issues we want to fix. --- python_bindings/stub/PyStubImpl.cpp | 2 +- src/FindCalls.cpp | 2 +- src/Profiling.cpp | 2 +- util/HalideTraceViz.cpp | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/python_bindings/stub/PyStubImpl.cpp b/python_bindings/stub/PyStubImpl.cpp index ca5720697661..ca7bb746a423 100644 --- a/python_bindings/stub/PyStubImpl.cpp +++ b/python_bindings/stub/PyStubImpl.cpp @@ -86,7 +86,7 @@ StubInput to_stub_input(const py::object &o) { void append_input(const py::object &value, std::vector &v) { if (is_real_sequence(value)) { - for (auto o : py::reinterpret_borrow(value)) { + for (const auto &o : py::reinterpret_borrow(value)) { v.push_back(to_stub_input(o)); } } else { diff --git a/src/FindCalls.cpp b/src/FindCalls.cpp index 1adf6f8a600b..e793fb0b68d3 100644 --- a/src/FindCalls.cpp +++ b/src/FindCalls.cpp @@ -74,7 +74,7 @@ void populate_environment_helper(Function f, map &env, } else { env[f.name()] = f; - for (pair i : calls.calls) { + for (const pair &i : calls.calls) { populate_environment_helper(i.second, env, recursive, include_wrappers); } } diff --git a/src/Profiling.cpp b/src/Profiling.cpp index c5a9fa6839b2..f850f21264dc 100644 --- a/src/Profiling.cpp +++ b/src/Profiling.cpp @@ -351,7 +351,7 @@ Stmt inject_profiling(Stmt s, const string &pipeline_name) { MemoryType::Auto, {num_funcs}, const_true(), s); } - for (std::pair p : profiling.indices) { + for (const std::pair &p : profiling.indices) { s = Block::make(Store::make("profiling_func_names", p.first, p.second, Parameter(), const_true(), ModulusRemainder()), s); } diff --git a/util/HalideTraceViz.cpp b/util/HalideTraceViz.cpp index 1310f7f4ac34..56d737cad975 100644 --- a/util/HalideTraceViz.cpp +++ b/util/HalideTraceViz.cpp @@ -1415,7 +1415,7 @@ int run(bool ignore_trace_tags, FlagProcessor flag_processor) { // Print stats about the Func gleaned from the trace. std::vector> funcs; - for (std::pair p : state.funcs) { + for (const std::pair &p : state.funcs) { funcs.push_back(p); } struct by_first_packet_idx { From 6b6282f9dcc9a7756ad53432fdc2d1ac74ea1fc8 Mon Sep 17 00:00:00 2001 From: Steven Johnson Date: Mon, 2 Nov 2020 11:21:39 -0800 Subject: [PATCH 06/53] Update HalideTraceViz.cpp --- util/HalideTraceViz.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/HalideTraceViz.cpp b/util/HalideTraceViz.cpp index 56d737cad975..d97accab69a9 100644 --- a/util/HalideTraceViz.cpp +++ b/util/HalideTraceViz.cpp @@ -1415,7 +1415,7 @@ int run(bool ignore_trace_tags, FlagProcessor flag_processor) { // Print stats about the Func gleaned from the trace. std::vector> funcs; - for (const std::pair &p : state.funcs) { + for (const auto &p : state.funcs) { funcs.push_back(p); } struct by_first_packet_idx { From f3b33f29da5cd826c7b90124f3173e6e658ad2cd Mon Sep 17 00:00:00 2001 From: Steven Johnson Date: Mon, 2 Nov 2020 11:21:57 -0800 Subject: [PATCH 07/53] Update HalideTraceViz.cpp --- util/HalideTraceViz.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/HalideTraceViz.cpp b/util/HalideTraceViz.cpp index 56d737cad975..d97accab69a9 100644 --- a/util/HalideTraceViz.cpp +++ b/util/HalideTraceViz.cpp @@ -1415,7 +1415,7 @@ int run(bool ignore_trace_tags, FlagProcessor flag_processor) { // Print stats about the Func gleaned from the trace. std::vector> funcs; - for (const std::pair &p : state.funcs) { + for (const auto &p : state.funcs) { funcs.push_back(p); } struct by_first_packet_idx { From a88c088b0957214e7ca67f4868c173128df9614a Mon Sep 17 00:00:00 2001 From: Steven Johnson Date: Mon, 2 Nov 2020 11:25:35 -0800 Subject: [PATCH 08/53] more fixes --- src/FindCalls.cpp | 2 +- src/Profiling.cpp | 2 +- util/HalideTraceViz.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/FindCalls.cpp b/src/FindCalls.cpp index e793fb0b68d3..02f1550c5bb8 100644 --- a/src/FindCalls.cpp +++ b/src/FindCalls.cpp @@ -74,7 +74,7 @@ void populate_environment_helper(Function f, map &env, } else { env[f.name()] = f; - for (const pair &i : calls.calls) { + for (const auto &i : calls.calls) { populate_environment_helper(i.second, env, recursive, include_wrappers); } } diff --git a/src/Profiling.cpp b/src/Profiling.cpp index f850f21264dc..cd38616e4971 100644 --- a/src/Profiling.cpp +++ b/src/Profiling.cpp @@ -351,7 +351,7 @@ Stmt inject_profiling(Stmt s, const string &pipeline_name) { MemoryType::Auto, {num_funcs}, const_true(), s); } - for (const std::pair &p : profiling.indices) { + for (const auto &p : profiling.indices) { s = Block::make(Store::make("profiling_func_names", p.first, p.second, Parameter(), const_true(), ModulusRemainder()), s); } diff --git a/util/HalideTraceViz.cpp b/util/HalideTraceViz.cpp index d97accab69a9..6db0ba664e0d 100644 --- a/util/HalideTraceViz.cpp +++ b/util/HalideTraceViz.cpp @@ -1416,7 +1416,7 @@ int run(bool ignore_trace_tags, FlagProcessor flag_processor) { // Print stats about the Func gleaned from the trace. std::vector> funcs; for (const auto &p : state.funcs) { - funcs.push_back(p); + funcs.emplace_back(p); } struct by_first_packet_idx { bool operator()(const std::pair &a, From 6cf73b64403de3004d6062b09b06cd54583ea88a Mon Sep 17 00:00:00 2001 From: Steven Johnson Date: Mon, 2 Nov 2020 11:27:49 -0800 Subject: [PATCH 09/53] Update FindCalls.cpp --- src/FindCalls.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/FindCalls.cpp b/src/FindCalls.cpp index 02f1550c5bb8..72e550054d64 100644 --- a/src/FindCalls.cpp +++ b/src/FindCalls.cpp @@ -9,7 +9,6 @@ namespace Halide { namespace Internal { using std::map; -using std::pair; using std::string; namespace { From 0563c8b12b99daf23392dcc7fe45bf3964ed17a6 Mon Sep 17 00:00:00 2001 From: Steven Johnson Date: Mon, 2 Nov 2020 11:33:08 -0800 Subject: [PATCH 10/53] Upgrade PyBind11 version in CMake to 2.5 v2.4.3 can generate a lot of compiler warnings under C++17; v2.5 fixes there. Note 1: I am unsure about the issues with keeping in sync with Ubuntu 20.04; tagging @alexreinking for comments Note 2: the current version of PyBind11 is actually v2.6, but it has many more changes and upgrading looks nontrivial; deliberately holding off on that upgrade for now. --- python_bindings/CMakeLists.txt | 2 +- python_bindings/requirements.txt | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/python_bindings/CMakeLists.txt b/python_bindings/CMakeLists.txt index be887e63634f..f095db7cc88f 100644 --- a/python_bindings/CMakeLists.txt +++ b/python_bindings/CMakeLists.txt @@ -12,7 +12,7 @@ message(STATUS "Directing pybind11 to Python3 executable ${Python3_EXECUTABLE}") set(PYTHON_EXECUTABLE ${Python3_EXECUTABLE}) # Keep the version in sync with requirements.txt and the Ubuntu 20.04 LTS package (python3-pybind11) -set(PYBIND11_VER 2.4.3) +set(PYBIND11_VER 2.5.0) find_package(pybind11 ${PYBIND11_VER} QUIET) if (NOT pybind11_FOUND) include(FetchContent) diff --git a/python_bindings/requirements.txt b/python_bindings/requirements.txt index dfb498171af0..998ae5fcbf78 100644 --- a/python_bindings/requirements.txt +++ b/python_bindings/requirements.txt @@ -1,7 +1,7 @@ -# This file lists the python dependencies, +# This file lists the python dependencies, # it is meant to be used with pip (and/or possibly virtualenv, pbundler, etc) # See http://pip.readthedocs.org/en/latest/user_guide.html#requirements-files -# You will probably want to run +# You will probably want to run # something similar to `pip3 install --user -r requirements.txt` # science packages @@ -12,4 +12,4 @@ pillow # Keep versions of these requirements equal to the versions in Ubuntu 20.04 LTS # because newer versions fix bugs we work around. imageio==2.4.1 -pybind11==2.4.3 +pybind11==2.5.0 From e45027d8bdef7d1acc9dd19b2374960fdf766835 Mon Sep 17 00:00:00 2001 From: Steven Johnson Date: Mon, 11 Jan 2021 12:30:36 -0800 Subject: [PATCH 11/53] Update Generator.h --- src/Generator.h | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/Generator.h b/src/Generator.h index cb984e6dce19..fb8e46afb256 100644 --- a/src/Generator.h +++ b/src/Generator.h @@ -3109,7 +3109,11 @@ class GeneratorBase : public NamesInterface, public GeneratorContext { user_assert(sizeof...(args) == pi.inputs().size()) << "Expected exactly " << pi.inputs().size() << " inputs but got " << sizeof...(args) << "\n"; - set_inputs_vector(build_inputs(std::forward_as_tuple(args...), std::make_index_sequence{})); + // Deliberately avoiding make_index_sequence and friends here so that we don't have to provide + // our own implementations for clients that are using C++11 (which didn't provide them). + std::vector> inputs(sizeof...(args)); + build_inputs(inputs, 0, args...); + set_inputs_vector(inputs); } Realization realize(std::vector sizes) { @@ -3444,9 +3448,15 @@ class GeneratorBase : public NamesInterface, public GeneratorContext { return siv; } - template - std::vector> build_inputs(const std::tuple &t, std::index_sequence) { - return {build_input(Indices, std::get(t))...}; + template + inline void build_inputs(std::vector> &inputs, int idx, Last last) { + inputs[idx] = build_input(idx, last); + } + + template + inline void build_inputs(std::vector> &inputs, int idx, First first, Second second, Rest &&... rest) { + build_inputs(inputs, idx, first); + build_inputs(inputs, idx + 1, second, rest...); } public: From 9bc62353b250a3d23bbae91b3727b1e48aadbd4e Mon Sep 17 00:00:00 2001 From: Steven Johnson Date: Mon, 11 Jan 2021 13:36:14 -0800 Subject: [PATCH 12/53] Update Generator.h --- src/Generator.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Generator.h b/src/Generator.h index fb8e46afb256..2599241750c5 100644 --- a/src/Generator.h +++ b/src/Generator.h @@ -3448,13 +3448,17 @@ class GeneratorBase : public NamesInterface, public GeneratorContext { return siv; } + inline void build_inputs(std::vector> &inputs, int idx) { + internal_assert(idx == (int)inputs.size()); + } + template - inline void build_inputs(std::vector> &inputs, int idx, Last last) { + inline void build_inputs(std::vector> &inputs, int idx, const Last &last) { inputs[idx] = build_input(idx, last); } template - inline void build_inputs(std::vector> &inputs, int idx, First first, Second second, Rest &&... rest) { + inline void build_inputs(std::vector> &inputs, int idx, const First &first, const Second &second, const Rest &... rest) { build_inputs(inputs, idx, first); build_inputs(inputs, idx + 1, second, rest...); } From bba60130b5b8732ac7dea5d3c1d02024a12a285d Mon Sep 17 00:00:00 2001 From: Steven Johnson Date: Tue, 12 Jan 2021 10:15:16 -0800 Subject: [PATCH 13/53] Update Generator.cpp --- src/Generator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Generator.cpp b/src/Generator.cpp index e973885ee53d..e732fca13889 100644 --- a/src/Generator.cpp +++ b/src/Generator.cpp @@ -757,7 +757,7 @@ std::string halide_type_to_c_type(const Type &t) { int generate_filter_main_inner(int argc, char **argv, std::ostream &cerr) { const char kUsage[] = - "gengen\n" + "gengen \n" " [-g GENERATOR_NAME] [-f FUNCTION_NAME] [-o OUTPUT_DIR] [-r RUNTIME_NAME] [-d 1|0]\n" " [-e EMIT_OPTIONS] [-n FILE_BASE_NAME] [-p PLUGIN_NAME] [-s AUTOSCHEDULER_NAME]\n" " target=target-string[,target-string...] [generator_arg=value [...]]\n" From d5fee91f83dfb3f1be080f20752201274f3ff028 Mon Sep 17 00:00:00 2001 From: Steven Johnson Date: Thu, 14 Jan 2021 10:59:14 -0800 Subject: [PATCH 14/53] Update README.md --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index b80441df5535..432ab1a9c866 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,9 @@ to an object file, or JIT-compile it and run it in the same process. Halide also provides a Python binding that provides full support for writing Halide embedded in Python without C++. +(Note that *using* Halide requires C++11 or later, but *building* Halide +requires C++17.) + For more detail about what Halide is, see http://halide-lang.org. For API documentation see http://halide-lang.org/docs From 536bd98bb9c112f963730e07cc936a0a2923dded Mon Sep 17 00:00:00 2001 From: Steven Johnson Date: Thu, 14 Jan 2021 14:09:46 -0800 Subject: [PATCH 15/53] Fix typo --- README_cmake.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README_cmake.md b/README_cmake.md index bd93a627d853..5d91bd004aa3 100644 --- a/README_cmake.md +++ b/README_cmake.md @@ -558,7 +558,7 @@ immediately after setting the minimum version. The next three variables set the project-wide C++ standard. The first, [`CMAKE_CXX_STANDARD`][cmake_cxx_standard], simply sets the standard version. -Halide requires at least c++17. The second, +Halide requires at least C++17. The second, [`CMAKE_CXX_STANDARD_REQUIRED`][cmake_cxx_standard_required], tells CMake to fail if the compiler cannot provide the requested standard version. Lastly, [`CMAKE_CXX_EXTENSIONS`][cmake_cxx_extensions] tells CMake to disable From d099320cf22521cce1bc9116c5c0c1b4527f75a2 Mon Sep 17 00:00:00 2001 From: Steven Johnson Date: Thu, 14 Jan 2021 14:18:30 -0800 Subject: [PATCH 16/53] Revert apps, tests, tutorials to C++11 --- Makefile | 7 ++++--- README_cmake.md | 4 ++-- apps/HelloAndroid/build.gradle | 2 +- apps/HelloAndroid/build.sh | 2 +- apps/HelloAndroid/jni/Application.mk | 2 +- apps/HelloAndroidCamera2/build.gradle | 2 +- apps/HelloAndroidCamera2/build.sh | 4 ++-- apps/HelloAndroidCamera2/jni/Application.mk | 2 +- apps/HelloPyTorch/setup.py | 2 +- apps/HelloiOS/HelloiOS.xcodeproj/project.pbxproj | 2 +- apps/bgu/CMakeLists.txt | 2 +- apps/bilateral_grid/CMakeLists.txt | 2 +- apps/blur/CMakeLists.txt | 2 +- apps/c_backend/CMakeLists.txt | 2 +- apps/camera_pipe/CMakeLists.txt | 2 +- apps/conv_layer/CMakeLists.txt | 2 +- apps/cuda_mat_mul/CMakeLists.txt | 2 +- apps/depthwise_separable_conv/CMakeLists.txt | 2 +- apps/fft/Makefile | 2 +- apps/harris/CMakeLists.txt | 2 +- apps/hist/CMakeLists.txt | 2 +- apps/iir_blur/CMakeLists.txt | 2 +- apps/interpolate/CMakeLists.txt | 2 +- apps/lens_blur/CMakeLists.txt | 2 +- apps/linear_algebra/CMakeLists.txt | 2 +- apps/local_laplacian/CMakeLists.txt | 2 +- apps/max_filter/CMakeLists.txt | 2 +- apps/nl_means/CMakeLists.txt | 2 +- apps/openglcompute/Makefile | 2 +- apps/openglcompute/jni/Android.mk | 8 ++++---- apps/resize/CMakeLists.txt | 2 +- apps/stencil_chain/CMakeLists.txt | 2 +- apps/support/Makefile.inc | 2 +- apps/unsharp/CMakeLists.txt | 2 +- apps/wavelet/CMakeLists.txt | 2 +- 35 files changed, 43 insertions(+), 42 deletions(-) diff --git a/Makefile b/Makefile index ce0b147274b7..83e946a64134 100644 --- a/Makefile +++ b/Makefile @@ -252,7 +252,7 @@ LLVM_SHARED_LIBS = -Wl,-rpath=$(LLVM_LIBDIR) -L $(LLVM_LIBDIR) -lLLVM LLVM_LIBS_FOR_SHARED_LIBHALIDE=$(if $(WITH_LLVM_INSIDE_SHARED_LIBHALIDE),$(LLVM_STATIC_LIBS),$(LLVM_SHARED_LIBS)) -TUTORIAL_CXX_FLAGS ?= -std=c++17 -g -fno-omit-frame-pointer $(RTTI_CXX_FLAGS) -I $(ROOT_DIR)/tools $(SANITIZER_FLAGS) $(LLVM_CXX_FLAGS_LIBCPP) +TUTORIAL_CXX_FLAGS ?= -std=c++11 -g -fno-omit-frame-pointer $(RTTI_CXX_FLAGS) -I $(ROOT_DIR)/tools $(SANITIZER_FLAGS) $(LLVM_CXX_FLAGS_LIBCPP) # The tutorials contain example code with warnings that we don't want # to be flagged as errors, so the test flags are the tutorial flags # plus our warning flags. @@ -927,13 +927,14 @@ ifeq ($(UNAME), Darwin) install_name_tool -id $(CURDIR)/$(BIN_DIR)/libHalide.$(SHARED_EXT) $(BIN_DIR)/libHalide.$(SHARED_EXT) endif +# Since Halide.h is included by client code, it should only be compiled vs C++11 (not C++17) $(INCLUDE_DIR)/Halide.h: $(SRC_DIR)/../LICENSE.txt $(HEADERS) $(BIN_DIR)/build_halide_h @mkdir -p $(@D) $(BIN_DIR)/build_halide_h $(SRC_DIR)/../LICENSE.txt $(HEADERS) > $(INCLUDE_DIR)/Halide.h # Also generate a precompiled version in the same folder so that anything compiled with a compatible set of flags can use it @mkdir -p $(INCLUDE_DIR)/Halide.h.gch - $(CXX) -std=c++17 $(TEST_CXX_FLAGS) -I$(ROOT_DIR) $(OPTIMIZE) -x c++-header $(INCLUDE_DIR)/Halide.h -o $(INCLUDE_DIR)/Halide.h.gch/Halide.default.gch - $(CXX) -std=c++17 $(TEST_CXX_FLAGS) -I$(ROOT_DIR) $(OPTIMIZE_FOR_BUILD_TIME) -x c++-header $(INCLUDE_DIR)/Halide.h -o $(INCLUDE_DIR)/Halide.h.gch/Halide.test.gch + $(CXX) -std=c++11 $(TEST_CXX_FLAGS) -I$(ROOT_DIR) $(OPTIMIZE) -x c++-header $(INCLUDE_DIR)/Halide.h -o $(INCLUDE_DIR)/Halide.h.gch/Halide.default.gch + $(CXX) -std=c++11 $(TEST_CXX_FLAGS) -I$(ROOT_DIR) $(OPTIMIZE_FOR_BUILD_TIME) -x c++-header $(INCLUDE_DIR)/Halide.h -o $(INCLUDE_DIR)/Halide.h.gch/Halide.test.gch $(INCLUDE_DIR)/HalideRuntime%: $(SRC_DIR)/runtime/HalideRuntime% echo Copying $< diff --git a/README_cmake.md b/README_cmake.md index 5d91bd004aa3..421d93007bee 100644 --- a/README_cmake.md +++ b/README_cmake.md @@ -542,7 +542,7 @@ boilerplate. cmake_minimum_required(VERSION 3.16) project(HalideExample) -set(CMAKE_CXX_STANDARD 17) # or newer +set(CMAKE_CXX_STANDARD 11) # or newer set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) @@ -558,7 +558,7 @@ immediately after setting the minimum version. The next three variables set the project-wide C++ standard. The first, [`CMAKE_CXX_STANDARD`][cmake_cxx_standard], simply sets the standard version. -Halide requires at least C++17. The second, +Halide requires at least C++11. The second, [`CMAKE_CXX_STANDARD_REQUIRED`][cmake_cxx_standard_required], tells CMake to fail if the compiler cannot provide the requested standard version. Lastly, [`CMAKE_CXX_EXTENSIONS`][cmake_cxx_extensions] tells CMake to disable diff --git a/apps/HelloAndroid/build.gradle b/apps/HelloAndroid/build.gradle index b2e3bf381505..9b18dad18623 100644 --- a/apps/HelloAndroid/build.gradle +++ b/apps/HelloAndroid/build.gradle @@ -51,7 +51,7 @@ sources { executables { hello_generator { binaries.all { - cppCompiler.args "-std=c++17", "-g", "-Wall", "-fno-rtti", "-I", "${projectDir}/../../include", "-I", "${projectDir}/../../build/include" + cppCompiler.args "-std=c++11", "-g", "-Wall", "-fno-rtti", "-I", "${projectDir}/../../include", "-I", "${projectDir}/../../build/include" // "/bin" assumes Makefile build for Halide; "/build/lib" assumes CMake build linker.args "-lHalide", "-ldl", "-lpthread", "-lz", "-L", "${projectDir}/../../bin", "-L", "${projectDir}/../../build/lib" } diff --git a/apps/HelloAndroid/build.sh b/apps/HelloAndroid/build.sh index 7b87613ca4fa..285e17bfa086 100755 --- a/apps/HelloAndroid/build.sh +++ b/apps/HelloAndroid/build.sh @@ -3,7 +3,7 @@ set -e android update project -p . --target android-17 mkdir -p bin c++ jni/hello_generator.cpp ../../tools/GenGen.cpp \ - -g -fno-rtti -Wall -std=c++17 \ + -g -fno-rtti -Wall -std=c++11 \ -I ../../include -I ../../build/include \ -L ../../bin -lHalide -ldl -lpthread -lz \ -o bin/hello_generator diff --git a/apps/HelloAndroid/jni/Application.mk b/apps/HelloAndroid/jni/Application.mk index 8d2ba9c04231..ed84d4a528cc 100644 --- a/apps/HelloAndroid/jni/Application.mk +++ b/apps/HelloAndroid/jni/Application.mk @@ -5,4 +5,4 @@ APP_ABI := armeabi armeabi-v7a arm64-v8a mips x86_64 x86 APP_PLATFORM := android-17 APP_STL := gnustl_static -APP_CPPFLAGS := -std=c++17 +APP_CPPFLAGS := -std=c++11 diff --git a/apps/HelloAndroidCamera2/build.gradle b/apps/HelloAndroidCamera2/build.gradle index 5cc2283112d8..7a0bc468fd06 100644 --- a/apps/HelloAndroidCamera2/build.gradle +++ b/apps/HelloAndroidCamera2/build.gradle @@ -56,7 +56,7 @@ sources { executables { halide_generator { binaries.all { - cppCompiler.args "-std=c++17", "-g", "-Wall", "-fno-rtti", "-I", "${projectDir}/../../include", "-I", "${projectDir}/../../build/include" + cppCompiler.args "-std=c++11", "-g", "-Wall", "-fno-rtti", "-I", "${projectDir}/../../include", "-I", "${projectDir}/../../build/include" // "/bin" assumes Makefile build for Halide; "/build/lib" assumes CMake build linker.args "-lHalide", "-ldl", "-lpthread", "-lz", "-L", "${projectDir}/../../bin", "-L", "${projectDir}/../../build/lib" } diff --git a/apps/HelloAndroidCamera2/build.sh b/apps/HelloAndroidCamera2/build.sh index 96b604275e5e..4ff95f95da51 100755 --- a/apps/HelloAndroidCamera2/build.sh +++ b/apps/HelloAndroidCamera2/build.sh @@ -9,13 +9,13 @@ fi mkdir -p bin c++ jni/edge_detect_generator.cpp ../../tools/GenGen.cpp \ - -g -fno-rtti -Wall -std=c++17 \ + -g -fno-rtti -Wall -std=c++11 \ -I ../../include -I ../../build/include \ -L ../../bin -lHalide -ldl -lpthread -lz \ -o bin/edge_detect_generator c++ jni/deinterleave_generator.cpp ../../tools/GenGen.cpp \ - -g -fno-rtti -Wall -std=c++17 \ + -g -fno-rtti -Wall -std=c++11 \ -I ../../include -I ../../build/include \ -L ../../bin -lHalide -ldl -lpthread -lz \ -o bin/deinterleave_generator diff --git a/apps/HelloAndroidCamera2/jni/Application.mk b/apps/HelloAndroidCamera2/jni/Application.mk index 4a1171874c29..68340ea94260 100644 --- a/apps/HelloAndroidCamera2/jni/Application.mk +++ b/apps/HelloAndroidCamera2/jni/Application.mk @@ -5,4 +5,4 @@ APP_ABI := armeabi armeabi-v7a arm64-v8a mips x86_64 x86 APP_PLATFORM := android-21 APP_STL := c++_static -APP_CPPFLAGS := -std=c++17 -fno-rtti -fexceptions +APP_CPPFLAGS := -std=c++11 -fno-rtti -fexceptions diff --git a/apps/HelloPyTorch/setup.py b/apps/HelloPyTorch/setup.py index b6fccbd4d1e5..de9683482a82 100644 --- a/apps/HelloPyTorch/setup.py +++ b/apps/HelloPyTorch/setup.py @@ -46,7 +46,7 @@ def generate_pybind_wrapper(path, headers, has_cuda): has_cuda = True include_dirs = [build_dir, os.path.join(halide_dir, "include")] - compile_args = ["-std=c++17", "-g"] + compile_args = ["-std=c++11", "-g"] if platform.system() == "Darwin": # on osx libstdc++ causes trouble compile_args += ["-stdlib=libc++"] diff --git a/apps/HelloiOS/HelloiOS.xcodeproj/project.pbxproj b/apps/HelloiOS/HelloiOS.xcodeproj/project.pbxproj index 0e2206cf010b..460a44f6e8b5 100644 --- a/apps/HelloiOS/HelloiOS.xcodeproj/project.pbxproj +++ b/apps/HelloiOS/HelloiOS.xcodeproj/project.pbxproj @@ -244,7 +244,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/bash; - shellScript = "echo \"${SRCROOT}\"\ncd \"${SRCROOT}/HelloiOS\"\n\n# Echoing commands to output makes it easier to debug XCode failures.\n# Failure on undefined vars is always a good idea.\nset -ex\n\n# xcode puts all sorts of junk in the environment which\n# prevents building a binary for osx (instead of ios).\n# sudo'ing to yourself gives a fresh environment.\nsudo -u ${USER} \\\nc++ reaction_diffusion_2_generator.cpp ${SRCROOT}/../../tools/GenGen.cpp \\\n-std=c++17 \\\n-fno-rtti \\\n-I ${SRCROOT}/../../include \\\n-I ${SRCROOT}/../../build/include \\\n-I ${SRCROOT}/../../tools \\\n-arch x86_64 \\\n-L ${SRCROOT}/../../bin \\\n-lHalide \\\n-o ${DERIVED_FILE_DIR}/reaction_diffusion_2_generator\n\n\nif [ \"${arch}\" == \"x86_64\" ]\nthen\n# assume simulator, which requires osx rather than ios\nTARGET=x86-64-osx\nelse\n# TODO: sniff arm-32 builds here; for now, just assume arm-64 only\nTARGET=arm-64-ios\nfi\n\nfor GEN in init update render; do\n(cd ${DERIVED_FILE_DIR}; \\\nDYLD_LIBRARY_PATH=${SRCROOT}/../../bin:${SRCROOT}/../../build/lib \\\n./reaction_diffusion_2_generator -g reaction_diffusion_2_${GEN} -f reaction_diffusion_2_${GEN} -n reaction_diffusion_2_${GEN} -o ${DERIVED_FILE_DIR} target=${TARGET}-user_context)\ndone\n\nfor GEN in init update render; do\n(cd ${DERIVED_FILE_DIR}; \\\nDYLD_LIBRARY_PATH=${SRCROOT}/../../bin:${SRCROOT}/../../build/lib \\\n./reaction_diffusion_2_generator -g reaction_diffusion_2_${GEN} -f reaction_diffusion_2_metal_${GEN} -n reaction_diffusion_2_metal_${GEN} -o ${DERIVED_FILE_DIR} target=${TARGET}-metal-user_context)\ndone\n"; + shellScript = "echo \"${SRCROOT}\"\ncd \"${SRCROOT}/HelloiOS\"\n\n# Echoing commands to output makes it easier to debug XCode failures.\n# Failure on undefined vars is always a good idea.\nset -ex\n\n# xcode puts all sorts of junk in the environment which\n# prevents building a binary for osx (instead of ios).\n# sudo'ing to yourself gives a fresh environment.\nsudo -u ${USER} \\\nc++ reaction_diffusion_2_generator.cpp ${SRCROOT}/../../tools/GenGen.cpp \\\n-std=c++11 \\\n-fno-rtti \\\n-I ${SRCROOT}/../../include \\\n-I ${SRCROOT}/../../build/include \\\n-I ${SRCROOT}/../../tools \\\n-arch x86_64 \\\n-L ${SRCROOT}/../../bin \\\n-lHalide \\\n-o ${DERIVED_FILE_DIR}/reaction_diffusion_2_generator\n\n\nif [ \"${arch}\" == \"x86_64\" ]\nthen\n# assume simulator, which requires osx rather than ios\nTARGET=x86-64-osx\nelse\n# TODO: sniff arm-32 builds here; for now, just assume arm-64 only\nTARGET=arm-64-ios\nfi\n\nfor GEN in init update render; do\n(cd ${DERIVED_FILE_DIR}; \\\nDYLD_LIBRARY_PATH=${SRCROOT}/../../bin:${SRCROOT}/../../build/lib \\\n./reaction_diffusion_2_generator -g reaction_diffusion_2_${GEN} -f reaction_diffusion_2_${GEN} -n reaction_diffusion_2_${GEN} -o ${DERIVED_FILE_DIR} target=${TARGET}-user_context)\ndone\n\nfor GEN in init update render; do\n(cd ${DERIVED_FILE_DIR}; \\\nDYLD_LIBRARY_PATH=${SRCROOT}/../../bin:${SRCROOT}/../../build/lib \\\n./reaction_diffusion_2_generator -g reaction_diffusion_2_${GEN} -f reaction_diffusion_2_metal_${GEN} -n reaction_diffusion_2_metal_${GEN} -o ${DERIVED_FILE_DIR} target=${TARGET}-metal-user_context)\ndone\n"; }; /* End PBXShellScriptBuildPhase section */ diff --git a/apps/bgu/CMakeLists.txt b/apps/bgu/CMakeLists.txt index 35851bfb1ae5..20aace8c84d7 100644 --- a/apps/bgu/CMakeLists.txt +++ b/apps/bgu/CMakeLists.txt @@ -4,7 +4,7 @@ project(bgu) enable_testing() # Set up language settings -set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) diff --git a/apps/bilateral_grid/CMakeLists.txt b/apps/bilateral_grid/CMakeLists.txt index f46b63d53cec..0b0c4fda7702 100644 --- a/apps/bilateral_grid/CMakeLists.txt +++ b/apps/bilateral_grid/CMakeLists.txt @@ -4,7 +4,7 @@ project(bilateral_grid) enable_testing() # Set up language settings -set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) diff --git a/apps/blur/CMakeLists.txt b/apps/blur/CMakeLists.txt index 85b45d965179..953e85d22201 100644 --- a/apps/blur/CMakeLists.txt +++ b/apps/blur/CMakeLists.txt @@ -4,7 +4,7 @@ project(blur) enable_testing() # Set up language settings -set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) diff --git a/apps/c_backend/CMakeLists.txt b/apps/c_backend/CMakeLists.txt index e22251802c4f..505ac5bf5ee2 100644 --- a/apps/c_backend/CMakeLists.txt +++ b/apps/c_backend/CMakeLists.txt @@ -4,7 +4,7 @@ project(c_backend) enable_testing() # Set up language settings -set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) diff --git a/apps/camera_pipe/CMakeLists.txt b/apps/camera_pipe/CMakeLists.txt index 170712dfc3ba..a621e8a7e3c7 100644 --- a/apps/camera_pipe/CMakeLists.txt +++ b/apps/camera_pipe/CMakeLists.txt @@ -4,7 +4,7 @@ project(camera_pipe) enable_testing() # Set up language settings -set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) diff --git a/apps/conv_layer/CMakeLists.txt b/apps/conv_layer/CMakeLists.txt index 0d7779dd093a..9edb2bdf59c5 100644 --- a/apps/conv_layer/CMakeLists.txt +++ b/apps/conv_layer/CMakeLists.txt @@ -4,7 +4,7 @@ project(conv_layer) enable_testing() # Set up language settings -set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) diff --git a/apps/cuda_mat_mul/CMakeLists.txt b/apps/cuda_mat_mul/CMakeLists.txt index b54f2562eead..376a08f0103b 100644 --- a/apps/cuda_mat_mul/CMakeLists.txt +++ b/apps/cuda_mat_mul/CMakeLists.txt @@ -17,7 +17,7 @@ endif () enable_testing() # Set up language settings -set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) diff --git a/apps/depthwise_separable_conv/CMakeLists.txt b/apps/depthwise_separable_conv/CMakeLists.txt index 178da107f850..b525a887932c 100644 --- a/apps/depthwise_separable_conv/CMakeLists.txt +++ b/apps/depthwise_separable_conv/CMakeLists.txt @@ -4,7 +4,7 @@ project(depthwise_separable_conv) enable_testing() # Set up language settings -set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) diff --git a/apps/fft/Makefile b/apps/fft/Makefile index 44b9a8c293a9..8fad9abf0164 100644 --- a/apps/fft/Makefile +++ b/apps/fft/Makefile @@ -67,7 +67,7 @@ $(BIN)/%/fft_inverse_c2c.a: $(GENERATOR_BIN)/fft.generator $(BIN)/%/fft_aot_test: fft_aot_test.cpp $(BIN)/%/fft_forward_r2c.a $(BIN)/%/fft_inverse_c2r.a $(BIN)/%/fft_forward_c2c.a $(BIN)/%/fft_inverse_c2c.a @mkdir -p $(@D) - $(CXX) -I$(BIN)/$* -I$(HALIDE_DISTRIB_PATH)/include/ -std=c++17 $^ -o $@ $(LDFLAGS) $(HALIDE_SYSTEM_LIBS) + $(CXX) -I$(BIN)/$* -I$(HALIDE_DISTRIB_PATH)/include/ -std=c++11 $^ -o $@ $(LDFLAGS) $(HALIDE_SYSTEM_LIBS) clean: rm -rf $(BIN) diff --git a/apps/harris/CMakeLists.txt b/apps/harris/CMakeLists.txt index fe9cee1f4a4d..ec5dbc7c703b 100644 --- a/apps/harris/CMakeLists.txt +++ b/apps/harris/CMakeLists.txt @@ -4,7 +4,7 @@ project(harris) enable_testing() # Set up language settings -set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) diff --git a/apps/hist/CMakeLists.txt b/apps/hist/CMakeLists.txt index 3db1953853e1..7c106f70f37a 100644 --- a/apps/hist/CMakeLists.txt +++ b/apps/hist/CMakeLists.txt @@ -4,7 +4,7 @@ project(hist) enable_testing() # Set up language settings -set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) diff --git a/apps/iir_blur/CMakeLists.txt b/apps/iir_blur/CMakeLists.txt index d34bfba6e08c..b26169652249 100644 --- a/apps/iir_blur/CMakeLists.txt +++ b/apps/iir_blur/CMakeLists.txt @@ -4,7 +4,7 @@ project(iir_blur) enable_testing() # Set up language settings -set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) diff --git a/apps/interpolate/CMakeLists.txt b/apps/interpolate/CMakeLists.txt index 66061891af74..a29dd47ee0b4 100644 --- a/apps/interpolate/CMakeLists.txt +++ b/apps/interpolate/CMakeLists.txt @@ -4,7 +4,7 @@ project(interpolate) enable_testing() # Set up language settings -set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) diff --git a/apps/lens_blur/CMakeLists.txt b/apps/lens_blur/CMakeLists.txt index 383356609946..8b35839692dc 100644 --- a/apps/lens_blur/CMakeLists.txt +++ b/apps/lens_blur/CMakeLists.txt @@ -4,7 +4,7 @@ project(lens_blur) enable_testing() # Set up language settings -set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) diff --git a/apps/linear_algebra/CMakeLists.txt b/apps/linear_algebra/CMakeLists.txt index a9def55c6667..1cdcbc3be108 100644 --- a/apps/linear_algebra/CMakeLists.txt +++ b/apps/linear_algebra/CMakeLists.txt @@ -4,7 +4,7 @@ project(linear_algebra) enable_testing() # Set up language settings -set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) diff --git a/apps/local_laplacian/CMakeLists.txt b/apps/local_laplacian/CMakeLists.txt index 936625d760a0..9df3fd3458e6 100644 --- a/apps/local_laplacian/CMakeLists.txt +++ b/apps/local_laplacian/CMakeLists.txt @@ -4,7 +4,7 @@ project(local_laplacian) enable_testing() # Set up language settings -set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) diff --git a/apps/max_filter/CMakeLists.txt b/apps/max_filter/CMakeLists.txt index 712affcfcbda..c4b1e9711164 100644 --- a/apps/max_filter/CMakeLists.txt +++ b/apps/max_filter/CMakeLists.txt @@ -4,7 +4,7 @@ project(max_filter) enable_testing() # Set up language settings -set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) diff --git a/apps/nl_means/CMakeLists.txt b/apps/nl_means/CMakeLists.txt index 615dbd7ac62c..3ebdd6256ea4 100644 --- a/apps/nl_means/CMakeLists.txt +++ b/apps/nl_means/CMakeLists.txt @@ -4,7 +4,7 @@ project(nl_means) enable_testing() # Set up language settings -set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) diff --git a/apps/openglcompute/Makefile b/apps/openglcompute/Makefile index 4bda85258364..120b6ae8d290 100644 --- a/apps/openglcompute/Makefile +++ b/apps/openglcompute/Makefile @@ -10,7 +10,7 @@ $(HALIDE_LIB): $(TOP) $(MAKE) -C $(TOP) test_%: test_%.cpp - $(CXX) -std=c++17 -I ../../include/ $< -L ../../bin/ -lHalide $(HALIDE_SYSTEM_LIBS) -o $@ -g + $(CXX) -std=c++11 -I ../../include/ $< -L ../../bin/ -lHalide $(HALIDE_SYSTEM_LIBS) -o $@ -g avg_filter_uint32t.o avg_filter_uint32t.h avg_filter_float.o avg_filter_float.h: test_oglc_avg LD_LIBRARY_PATH=../../bin DYLD_LIBRARY_PATH=../../bin HL_TARGET=arm-32-android-armv7s-openglcompute ./$< diff --git a/apps/openglcompute/jni/Android.mk b/apps/openglcompute/jni/Android.mk index 232e91e208cc..04f9b01918db 100644 --- a/apps/openglcompute/jni/Android.mk +++ b/apps/openglcompute/jni/Android.mk @@ -11,7 +11,7 @@ LOCAL_STATIC_LIBRARIES += libOpengl LOCAL_LDLIBS := -lm -llog -landroid -lEGL -lGLESv2 avg_filter_uint32t.o avg_filter_uint32t_arm.o avg_filter_float.o avg_filter_float_arm.o LOCAL_ARM_MODE := arm -LOCAL_CPPFLAGS += -std=c++17 -I../support -I../../include +LOCAL_CPPFLAGS += -std=c++11 -I../support -I../../include LOCAL_C_INCLUDES += ./ @@ -27,7 +27,7 @@ LOCAL_STATIC_LIBRARIES += libOpengl LOCAL_LDLIBS := -lm -llog -landroid -lEGL -lGLESv2 avg_filter_uint32t.o avg_filter_uint32t_arm.o avg_filter_float.o avg_filter_float_arm.o LOCAL_ARM_MODE := arm -LOCAL_CPPFLAGS += -std=c++17 -I../support -I../../include +LOCAL_CPPFLAGS += -std=c++11 -I../support -I../../include LOCAL_C_INCLUDES += ./ @@ -44,7 +44,7 @@ LOCAL_STATIC_LIBRARIES += libOpengl LOCAL_LDLIBS := -lm -llog -landroid -lEGL -lGLESv2 two_kernels_filter.o LOCAL_ARM_MODE := arm -LOCAL_CPPFLAGS += -std=c++17 -I../support -I../../include +LOCAL_CPPFLAGS += -std=c++11 -I../support -I../../include LOCAL_C_INCLUDES += ./ @@ -60,7 +60,7 @@ LOCAL_STATIC_LIBRARIES += libOpengl LOCAL_LDLIBS := -lm -llog -landroid -lEGL -lGLESv2 two_kernels_filter.o LOCAL_ARM_MODE := arm -LOCAL_CPPFLAGS += -std=c++17 -I../support -I../../include +LOCAL_CPPFLAGS += -std=c++11 -I../support -I../../include LOCAL_C_INCLUDES += ./ diff --git a/apps/resize/CMakeLists.txt b/apps/resize/CMakeLists.txt index d5e7513591a7..88bd05e4017c 100644 --- a/apps/resize/CMakeLists.txt +++ b/apps/resize/CMakeLists.txt @@ -4,7 +4,7 @@ project(resize) enable_testing() # Set up language settings -set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) diff --git a/apps/stencil_chain/CMakeLists.txt b/apps/stencil_chain/CMakeLists.txt index 335c5325bf28..74b29dc721a4 100644 --- a/apps/stencil_chain/CMakeLists.txt +++ b/apps/stencil_chain/CMakeLists.txt @@ -4,7 +4,7 @@ project(stencil_chain) enable_testing() # Set up language settings -set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) diff --git a/apps/support/Makefile.inc b/apps/support/Makefile.inc index 280cc9a0620e..8f647457dd9f 100644 --- a/apps/support/Makefile.inc +++ b/apps/support/Makefile.inc @@ -54,7 +54,7 @@ GXX ?= g++ OPTIMIZE ?= -O3 CFLAGS += $(OPTIMIZE) -I $(HALIDE_DISTRIB_PATH)/include/ -I $(HALIDE_DISTRIB_PATH)/tools/ -I $(HALIDE_DISTRIB_PATH)/apps/support/ -CXXFLAGS += $(OPTIMIZE) -std=c++17 -I $(HALIDE_DISTRIB_PATH)/include/ -I $(HALIDE_DISTRIB_PATH)/tools/ $(SANITIZER_FLAGS) -Wall -Werror -Wno-unused-function -Wcast-qual -Wignored-qualifiers -Wno-comment -Wsign-compare -Wno-unknown-warning-option -Wno-psabi +CXXFLAGS += $(OPTIMIZE) -std=c++11 -I $(HALIDE_DISTRIB_PATH)/include/ -I $(HALIDE_DISTRIB_PATH)/tools/ $(SANITIZER_FLAGS) -Wall -Werror -Wno-unused-function -Wcast-qual -Wignored-qualifiers -Wno-comment -Wsign-compare -Wno-unknown-warning-option -Wno-psabi CXX_VERSION = $(shell $(CXX) --version | head -n1) ifneq (,$(findstring clang,$(CXX_VERSION))) diff --git a/apps/unsharp/CMakeLists.txt b/apps/unsharp/CMakeLists.txt index c5d264f361fe..00d5cb387483 100644 --- a/apps/unsharp/CMakeLists.txt +++ b/apps/unsharp/CMakeLists.txt @@ -4,7 +4,7 @@ project(unsharp) enable_testing() # Set up language settings -set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) diff --git a/apps/wavelet/CMakeLists.txt b/apps/wavelet/CMakeLists.txt index f67f43c1917c..216b3f7e607e 100644 --- a/apps/wavelet/CMakeLists.txt +++ b/apps/wavelet/CMakeLists.txt @@ -4,7 +4,7 @@ project(wavelet) enable_testing() # Set up language settings -set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) From f8415436453e380df83d6790dd7dd1eb2dbf38ab Mon Sep 17 00:00:00 2001 From: Steven Johnson Date: Thu, 14 Jan 2021 14:20:08 -0800 Subject: [PATCH 17/53] Update build.gradle --- apps/HelloAndroid/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/HelloAndroid/build.gradle b/apps/HelloAndroid/build.gradle index 9b18dad18623..658fbd1a8711 100644 --- a/apps/HelloAndroid/build.gradle +++ b/apps/HelloAndroid/build.gradle @@ -1,7 +1,7 @@ import org.apache.tools.ant.taskdefs.condition.Os // Avoid conflicts with Bazel on case-insensitive filesystems -buildDir = 'gradle_build' +buildDir = 'gradle_build' repositories { jcenter() From b4264935f810dd81312144d59cd92f18e6e290e0 Mon Sep 17 00:00:00 2001 From: Steven Johnson Date: Thu, 14 Jan 2021 14:20:25 -0800 Subject: [PATCH 18/53] Update build.gradle --- apps/HelloAndroidCamera2/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/HelloAndroidCamera2/build.gradle b/apps/HelloAndroidCamera2/build.gradle index 7a0bc468fd06..8184293b966f 100644 --- a/apps/HelloAndroidCamera2/build.gradle +++ b/apps/HelloAndroidCamera2/build.gradle @@ -1,7 +1,7 @@ import org.apache.tools.ant.taskdefs.condition.Os // Avoid conflicts with Bazel on case-insensitive filesystems -buildDir = 'gradle_build' +buildDir = 'gradle_build' repositories { jcenter() From 6bfc31bd5678a17a4318adfec410f5505fcc786a Mon Sep 17 00:00:00 2001 From: Steven Johnson Date: Thu, 14 Jan 2021 14:21:33 -0800 Subject: [PATCH 19/53] Update setup.py --- apps/HelloPyTorch/setup.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/apps/HelloPyTorch/setup.py b/apps/HelloPyTorch/setup.py index de9683482a82..57a48b517f59 100644 --- a/apps/HelloPyTorch/setup.py +++ b/apps/HelloPyTorch/setup.py @@ -14,7 +14,7 @@ def generate_pybind_wrapper(path, headers, has_cuda): s += "#define HL_PT_CUDA\n" s += "#include \"HalidePyTorchHelpers.h\"\n" for h in headers: - s += "#include \"{}\"\n".format(os.path.splitext(h)[0] + ".pytorch.h") + s += "#include \"{}\"\n".format(os.path.splitext(h)[0]+".pytorch.h") if has_cuda: s += "#undef HL_PT_CUDA\n" @@ -22,7 +22,7 @@ def generate_pybind_wrapper(path, headers, has_cuda): for h in headers: name = os.path.splitext(h)[0] s += " m.def(\"{}\", &{}_th_, \"PyTorch wrapper of the Halide pipeline {}\");\n".format( - name, name, name) + name, name, name) s += "}\n" with open(path, 'w') as fid: fid.write(s) @@ -79,8 +79,7 @@ def generate_pybind_wrapper(path, headers, has_cuda): extension = CUDAExtension(ext_name, sources, include_dirs=include_dirs, extra_objects=hl_libs, - # Halide ops need the full cuda lib, not just the RT library - libraries=["cuda"], + libraries=["cuda"], # Halide ops need the full cuda lib, not just the RT library extra_compile_args=compile_args) else: print("Generating CPU wrapper") From d78b147106f0a99cfc2ebb2555266190899a2248 Mon Sep 17 00:00:00 2001 From: Steven Johnson Date: Thu, 14 Jan 2021 14:21:55 -0800 Subject: [PATCH 20/53] Update Makefile --- apps/fft/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/fft/Makefile b/apps/fft/Makefile index 8fad9abf0164..85f56aa8d7bb 100644 --- a/apps/fft/Makefile +++ b/apps/fft/Makefile @@ -46,7 +46,7 @@ bench_64x64: $(BIN)/$(HL_TARGET)/bench_fft $(GENERATOR_BIN)/fft.generator: fft_generator.cpp fft.cpp fft.h $(GENERATOR_DEPS) @mkdir -p $(@D) - $(CXX) $(CXXFLAGS) $(filter %.cpp,$^) -o $@ $(LIBHALIDE_LDFLAGS) + $(CXX) $(CXXFLAGS) $(filter %.cpp,$^) -o $@ $(LIBHALIDE_LDFLAGS) # Generate four AOT compiled FFT variants. Forward versions have gain set to 1 / 256.0 $(BIN)/%/fft_forward_r2c.a: $(GENERATOR_BIN)/fft.generator From 0d6864083fe80780e6abe3c578379c561485cfe6 Mon Sep 17 00:00:00 2001 From: Steven Johnson Date: Thu, 14 Jan 2021 14:22:34 -0800 Subject: [PATCH 21/53] Update Generator.cpp --- src/Generator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Generator.cpp b/src/Generator.cpp index e732fca13889..e973885ee53d 100644 --- a/src/Generator.cpp +++ b/src/Generator.cpp @@ -757,7 +757,7 @@ std::string halide_type_to_c_type(const Type &t) { int generate_filter_main_inner(int argc, char **argv, std::ostream &cerr) { const char kUsage[] = - "gengen \n" + "gengen\n" " [-g GENERATOR_NAME] [-f FUNCTION_NAME] [-o OUTPUT_DIR] [-r RUNTIME_NAME] [-d 1|0]\n" " [-e EMIT_OPTIONS] [-n FILE_BASE_NAME] [-p PLUGIN_NAME] [-s AUTOSCHEDULER_NAME]\n" " target=target-string[,target-string...] [generator_arg=value [...]]\n" From 0fb5c60b0abba42ecf547f934ff0952aeb74b747 Mon Sep 17 00:00:00 2001 From: Steven Johnson Date: Thu, 14 Jan 2021 14:24:56 -0800 Subject: [PATCH 22/53] Tutorials back to C++11 --- src/autoschedulers/adams2019/autotune_loop.sh | 2 +- tools/mex_halide.m | 4 ++-- tutorial/lesson_01_basics.cpp | 4 ++-- tutorial/lesson_02_input_image.cpp | 4 ++-- tutorial/lesson_03_debugging_1.cpp | 4 ++-- tutorial/lesson_04_debugging_2.cpp | 4 ++-- tutorial/lesson_05_scheduling_1.cpp | 4 ++-- tutorial/lesson_06_realizing_over_shifted_domains.cpp | 4 ++-- tutorial/lesson_07_multi_stage_pipelines.cpp | 4 ++-- tutorial/lesson_08_scheduling_2.cpp | 4 ++-- tutorial/lesson_09_update_definitions.cpp | 4 ++-- tutorial/lesson_10_aot_compilation_generate.cpp | 6 +++--- tutorial/lesson_11_cross_compilation.cpp | 4 ++-- tutorial/lesson_12_using_the_gpu.cpp | 4 ++-- tutorial/lesson_13_tuples.cpp | 4 ++-- tutorial/lesson_14_types.cpp | 4 ++-- tutorial/lesson_15_generators.cpp | 4 ++-- tutorial/lesson_16_rgb_generate.cpp | 2 +- tutorial/lesson_17_predicated_rdom.cpp | 4 ++-- tutorial/lesson_18_parallel_associative_reductions.cpp | 4 ++-- tutorial/lesson_19_wrapper_funcs.cpp | 4 ++-- tutorial/lesson_20_cloning_funcs.cpp | 4 ++-- tutorial/lesson_21_auto_scheduler_generate.cpp | 4 ++-- 23 files changed, 45 insertions(+), 45 deletions(-) diff --git a/src/autoschedulers/adams2019/autotune_loop.sh b/src/autoschedulers/adams2019/autotune_loop.sh index 311b6c16dee8..7f99692402fc 100755 --- a/src/autoschedulers/adams2019/autotune_loop.sh +++ b/src/autoschedulers/adams2019/autotune_loop.sh @@ -125,7 +125,7 @@ make_featurization() { # We don't need image I/O for this purpose, # so leave out libpng and libjpeg c++ \ - -std=c++17 \ + -std=c++11 \ -I ${HALIDE_DISTRIB_PATH}/include \ ${HALIDE_DISTRIB_PATH}/tools/RunGenMain.cpp \ ${D}/*.registration.cpp \ diff --git a/tools/mex_halide.m b/tools/mex_halide.m index 63db5b16a82e..b1dba967c5a0 100644 --- a/tools/mex_halide.m +++ b/tools/mex_halide.m @@ -59,7 +59,7 @@ function mex_halide( generator_filename, varargin ) setenv('HALIDE_DISTRIB_PATH', halide_distrib_path); end halide_distrib_path = getenv('HALIDE_DISTRIB_PATH'); - + if ismac libhalide = fullfile(halide_distrib_path, 'lib', 'libHalide.dylib'); else @@ -79,7 +79,7 @@ function mex_halide( generator_filename, varargin ) gen_bin = fullfile(temp, [function_name, '.generator']); build_generator = ... [halide_cxx, ... - ' -g -Wall -std=c++17 -fno-rtti -I', halide_include, ' ', ... + ' -g -Wall -std=c++11 -fno-rtti -I', halide_include, ' ', ... gengen_filename, ' ', ... generator_filename, ' ', ... libhalide, ' ', ... diff --git a/tutorial/lesson_01_basics.cpp b/tutorial/lesson_01_basics.cpp index c9159c131c6a..38d949c4cd62 100644 --- a/tutorial/lesson_01_basics.cpp +++ b/tutorial/lesson_01_basics.cpp @@ -3,11 +3,11 @@ // This lesson demonstrates basic usage of Halide as a JIT compiler for imaging. // On linux, you can compile and run it like so: -// g++ lesson_01*.cpp -g -I -L -lHalide -lpthread -ldl -o lesson_01 -std=c++17 +// g++ lesson_01*.cpp -g -I -L -lHalide -lpthread -ldl -o lesson_01 -std=c++11 // LD_LIBRARY_PATH= ./lesson_01 // On os x: -// g++ lesson_01*.cpp -g -I -L -lHalide -o lesson_01 -std=c++17 +// g++ lesson_01*.cpp -g -I -L -lHalide -o lesson_01 -std=c++11 // DYLD_LIBRARY_PATH= ./lesson_01 // If you have the entire Halide source tree, you can also build it by diff --git a/tutorial/lesson_02_input_image.cpp b/tutorial/lesson_02_input_image.cpp index 824752fd3cd1..20f9485cfc63 100644 --- a/tutorial/lesson_02_input_image.cpp +++ b/tutorial/lesson_02_input_image.cpp @@ -4,11 +4,11 @@ // them. // On linux, you can compile and run it like so: -// g++ lesson_02*.cpp -g -I -I -L -lHalide `libpng-config --cflags --ldflags` -ljpeg -lpthread -ldl -o lesson_02 -std=c++17 +// g++ lesson_02*.cpp -g -I -I -L -lHalide `libpng-config --cflags --ldflags` -ljpeg -lpthread -ldl -o lesson_02 -std=c++11 // LD_LIBRARY_PATH= ./lesson_02 // On os x: -// g++ lesson_02*.cpp -g -I -I -L -lHalide `libpng-config --cflags --ldflags` -ljpeg -o lesson_02 -std=c++17 +// g++ lesson_02*.cpp -g -I -I -L -lHalide `libpng-config --cflags --ldflags` -ljpeg -o lesson_02 -std=c++11 // DYLD_LIBRARY_PATH= ./lesson_02 // If you have the entire Halide source tree, you can also build it by diff --git a/tutorial/lesson_03_debugging_1.cpp b/tutorial/lesson_03_debugging_1.cpp index 02cb65217985..11f7a4211ecc 100644 --- a/tutorial/lesson_03_debugging_1.cpp +++ b/tutorial/lesson_03_debugging_1.cpp @@ -3,11 +3,11 @@ // This lesson demonstrates how to inspect what the Halide compiler is producing. // On linux, you can compile and run it like so: -// g++ lesson_03*.cpp -g -I -L -lHalide -lpthread -ldl -o lesson_03 -std=c++17 +// g++ lesson_03*.cpp -g -I -L -lHalide -lpthread -ldl -o lesson_03 -std=c++11 // LD_LIBRARY_PATH= ./lesson_03 // On os x: -// g++ lesson_03*.cpp -g -I -L -lHalide -o lesson_03 -std=c++17 +// g++ lesson_03*.cpp -g -I -L -lHalide -o lesson_03 -std=c++11 // DYLD_LIBRARY_PATH= ./lesson_03 // If you have the entire Halide source tree, you can also build it by diff --git a/tutorial/lesson_04_debugging_2.cpp b/tutorial/lesson_04_debugging_2.cpp index b4090f6a00f9..49cd17df0a9b 100644 --- a/tutorial/lesson_04_debugging_2.cpp +++ b/tutorial/lesson_04_debugging_2.cpp @@ -3,11 +3,11 @@ // This lesson demonstrates how to follow what Halide is doing at runtime. // On linux, you can compile and run it like so: -// g++ lesson_04*.cpp -g -I -L -lHalide -lpthread -ldl -o lesson_04 -std=c++17 +// g++ lesson_04*.cpp -g -I -L -lHalide -lpthread -ldl -o lesson_04 -std=c++11 // LD_LIBRARY_PATH= ./lesson_04 // On os x: -// g++ lesson_04*.cpp -g -I -L -lHalide -o lesson_04 -std=c++17 +// g++ lesson_04*.cpp -g -I -L -lHalide -o lesson_04 -std=c++11 // DYLD_LIBRARY_PATH= ./lesson_04 // If you have the entire Halide source tree, you can also build it by diff --git a/tutorial/lesson_05_scheduling_1.cpp b/tutorial/lesson_05_scheduling_1.cpp index 212159e27447..2ac3930a1306 100644 --- a/tutorial/lesson_05_scheduling_1.cpp +++ b/tutorial/lesson_05_scheduling_1.cpp @@ -5,11 +5,11 @@ // parallelization, unrolling, and tiling. // On linux, you can compile and run it like so: -// g++ lesson_05*.cpp -g -I -L -lHalide -lpthread -ldl -o lesson_05 -std=c++17 +// g++ lesson_05*.cpp -g -I -L -lHalide -lpthread -ldl -o lesson_05 -std=c++11 // LD_LIBRARY_PATH= ./lesson_05 // On os x: -// g++ lesson_05*.cpp -g -I -L -lHalide -o lesson_05 -std=c++17 +// g++ lesson_05*.cpp -g -I -L -lHalide -o lesson_05 -std=c++11 // DYLD_LIBRARY_PATH= ./lesson_05 // If you have the entire Halide source tree, you can also build it by diff --git a/tutorial/lesson_06_realizing_over_shifted_domains.cpp b/tutorial/lesson_06_realizing_over_shifted_domains.cpp index 7281e5b385cd..283df77365ab 100644 --- a/tutorial/lesson_06_realizing_over_shifted_domains.cpp +++ b/tutorial/lesson_06_realizing_over_shifted_domains.cpp @@ -4,11 +4,11 @@ // does not start at (0, 0). // On linux, you can compile and run it like so: -// g++ lesson_06*.cpp -g -I -L -lHalide -lpthread -ldl -o lesson_06 -std=c++17 +// g++ lesson_06*.cpp -g -I -L -lHalide -lpthread -ldl -o lesson_06 -std=c++11 // LD_LIBRARY_PATH= ./lesson_06 // On os x: -// g++ lesson_06*.cpp -g -I -L -lHalide -o lesson_06 -std=c++17 +// g++ lesson_06*.cpp -g -I -L -lHalide -o lesson_06 -std=c++11 // DYLD_LIBRARY_PATH= ./lesson_06 // If you have the entire Halide source tree, you can also build it by diff --git a/tutorial/lesson_07_multi_stage_pipelines.cpp b/tutorial/lesson_07_multi_stage_pipelines.cpp index b862537b2867..49df7a804675 100644 --- a/tutorial/lesson_07_multi_stage_pipelines.cpp +++ b/tutorial/lesson_07_multi_stage_pipelines.cpp @@ -1,11 +1,11 @@ // Halide tutorial lesson 7: Multi-stage pipelines // On linux, you can compile and run it like so: -// g++ lesson_07*.cpp -g -std=c++17 -I -I -L -lHalide `libpng-config --cflags --ldflags` -ljpeg -lpthread -ldl -o lesson_07 +// g++ lesson_07*.cpp -g -std=c++11 -I -I -L -lHalide `libpng-config --cflags --ldflags` -ljpeg -lpthread -ldl -o lesson_07 // LD_LIBRARY_PATH= ./lesson_07 // On os x: -// g++ lesson_07*.cpp -g -std=c++17 -I -I -L -lHalide `libpng-config --cflags --ldflags` -ljpeg -o lesson_07 +// g++ lesson_07*.cpp -g -std=c++11 -I -I -L -lHalide `libpng-config --cflags --ldflags` -ljpeg -o lesson_07 // DYLD_LIBRARY_PATH= ./lesson_07 // If you have the entire Halide source tree, you can also build it by diff --git a/tutorial/lesson_08_scheduling_2.cpp b/tutorial/lesson_08_scheduling_2.cpp index 73bdf2c7e5ed..80db19489b7e 100644 --- a/tutorial/lesson_08_scheduling_2.cpp +++ b/tutorial/lesson_08_scheduling_2.cpp @@ -1,11 +1,11 @@ // Halide tutorial lesson 8: Scheduling multi-stage pipelines // On linux, you can compile and run it like so: -// g++ lesson_08*.cpp -g -std=c++17 -I -L -lHalide -lpthread -ldl -o lesson_08 +// g++ lesson_08*.cpp -g -std=c++11 -I -L -lHalide -lpthread -ldl -o lesson_08 // LD_LIBRARY_PATH= ./lesson_08 // On os x: -// g++ lesson_08*.cpp -g -std=c++17 -I -L -lHalide -o lesson_08 +// g++ lesson_08*.cpp -g -std=c++11 -I -L -lHalide -o lesson_08 // DYLD_LIBRARY_PATH= ./lesson_08 // If you have the entire Halide source tree, you can also build it by diff --git a/tutorial/lesson_09_update_definitions.cpp b/tutorial/lesson_09_update_definitions.cpp index ac7cee108d61..f48480b3c2fc 100644 --- a/tutorial/lesson_09_update_definitions.cpp +++ b/tutorial/lesson_09_update_definitions.cpp @@ -1,11 +1,11 @@ // Halide tutorial lesson 9: Multi-pass Funcs, update definitions, and reductions // On linux, you can compile and run it like so: -// g++ lesson_09*.cpp -g -std=c++17 -I -I -L -lHalide `libpng-config --cflags --ldflags` -ljpeg -lpthread -ldl -fopenmp -o lesson_09 +// g++ lesson_09*.cpp -g -std=c++11 -I -I -L -lHalide `libpng-config --cflags --ldflags` -ljpeg -lpthread -ldl -fopenmp -o lesson_09 // LD_LIBRARY_PATH= ./lesson_09 // On os x (will only work if you actually have g++, not Apple's pretend g++ which is actually clang): -// g++ lesson_09*.cpp -g -std=c++17 -I -I -L -lHalide `libpng-config --cflags --ldflags` -ljpeg -fopenmp -o lesson_09 +// g++ lesson_09*.cpp -g -std=c++11 -I -I -L -lHalide `libpng-config --cflags --ldflags` -ljpeg -fopenmp -o lesson_09 // DYLD_LIBRARY_PATH= ./lesson_09 // If you have the entire Halide source tree, you can also build it by diff --git a/tutorial/lesson_10_aot_compilation_generate.cpp b/tutorial/lesson_10_aot_compilation_generate.cpp index a30032f10b9d..989dff124bfa 100644 --- a/tutorial/lesson_10_aot_compilation_generate.cpp +++ b/tutorial/lesson_10_aot_compilation_generate.cpp @@ -10,13 +10,13 @@ // compiling this code is a multi-step process. // On linux, you can compile and run it like so: -// g++ lesson_10*generate.cpp -g -std=c++17 -I -L -lHalide -lpthread -ldl -o lesson_10_generate +// g++ lesson_10*generate.cpp -g -std=c++11 -I -L -lHalide -lpthread -ldl -o lesson_10_generate // LD_LIBRARY_PATH= ./lesson_10_generate -// g++ lesson_10*run.cpp lesson_10_halide.a -std=c++17 -I -lpthread -ldl -o lesson_10_run +// g++ lesson_10*run.cpp lesson_10_halide.a -std=c++11 -I -lpthread -ldl -o lesson_10_run // ./lesson_10_run // On os x: -// g++ lesson_10*generate.cpp -g -std=c++17 -I -L -lHalide -o lesson_10_generate +// g++ lesson_10*generate.cpp -g -std=c++11 -I -L -lHalide -o lesson_10_generate // DYLD_LIBRARY_PATH= ./lesson_10_generate // g++ lesson_10*run.cpp lesson_10_halide.a -o lesson_10_run -I // ./lesson_10_run diff --git a/tutorial/lesson_11_cross_compilation.cpp b/tutorial/lesson_11_cross_compilation.cpp index 63652f7078fc..617dbeb5a210 100644 --- a/tutorial/lesson_11_cross_compilation.cpp +++ b/tutorial/lesson_11_cross_compilation.cpp @@ -4,11 +4,11 @@ // generate code for any platform from any platform. // On linux, you can compile and run it like so: -// g++ lesson_11*.cpp -g -std=c++17 -I -L -lHalide -lpthread -ldl -o lesson_11 +// g++ lesson_11*.cpp -g -std=c++11 -I -L -lHalide -lpthread -ldl -o lesson_11 // LD_LIBRARY_PATH= ./lesson_11 // On os x: -// g++ lesson_11*.cpp -g -std=c++17 -I -L -lHalide -o lesson_11 +// g++ lesson_11*.cpp -g -std=c++11 -I -L -lHalide -o lesson_11 // DYLD_LIBRARY_PATH= ./lesson_11 // If you have the entire Halide source tree, you can also build it by diff --git a/tutorial/lesson_12_using_the_gpu.cpp b/tutorial/lesson_12_using_the_gpu.cpp index a8d530e37280..682a7ff81410 100644 --- a/tutorial/lesson_12_using_the_gpu.cpp +++ b/tutorial/lesson_12_using_the_gpu.cpp @@ -3,11 +3,11 @@ // This lesson demonstrates how to use Halide to run code on a GPU using OpenCL. // On linux, you can compile and run it like so: -// g++ lesson_12*.cpp -g -std=c++17 -I -I -L -lHalide `libpng-config --cflags --ldflags` -ljpeg -lpthread -ldl -o lesson_12 +// g++ lesson_12*.cpp -g -std=c++11 -I -I -L -lHalide `libpng-config --cflags --ldflags` -ljpeg -lpthread -ldl -o lesson_12 // LD_LIBRARY_PATH= ./lesson_12 // On os x: -// g++ lesson_12*.cpp -g -std=c++17 -I -I -L -lHalide `libpng-config --cflags --ldflags` -ljpeg -o lesson_12 +// g++ lesson_12*.cpp -g -std=c++11 -I -I -L -lHalide `libpng-config --cflags --ldflags` -ljpeg -o lesson_12 // DYLD_LIBRARY_PATH= ./lesson_12 // If you have the entire Halide source tree, you can also build it by diff --git a/tutorial/lesson_13_tuples.cpp b/tutorial/lesson_13_tuples.cpp index b5b3e6ded16e..5218cb01e652 100644 --- a/tutorial/lesson_13_tuples.cpp +++ b/tutorial/lesson_13_tuples.cpp @@ -4,11 +4,11 @@ // values. // On linux, you can compile and run it like so: -// g++ lesson_13*.cpp -g -I -L -lHalide -lpthread -ldl -o lesson_13 -std=c++17 +// g++ lesson_13*.cpp -g -I -L -lHalide -lpthread -ldl -o lesson_13 -std=c++11 // LD_LIBRARY_PATH= ./lesson_13 // On os x: -// g++ lesson_13*.cpp -g -I -L -lHalide -o lesson_13 -std=c++17 +// g++ lesson_13*.cpp -g -I -L -lHalide -o lesson_13 -std=c++11 // DYLD_LIBRARY_PATH= ./lesson_13 // If you have the entire Halide source tree, you can also build it by diff --git a/tutorial/lesson_14_types.cpp b/tutorial/lesson_14_types.cpp index b43d13bf5e9d..8a370c1084f2 100644 --- a/tutorial/lesson_14_types.cpp +++ b/tutorial/lesson_14_types.cpp @@ -3,11 +3,11 @@ // This lesson more precisely describes Halide's type system. // On linux, you can compile and run it like so: -// g++ lesson_14*.cpp -g -I -L -lHalide -lpthread -ldl -o lesson_14 -std=c++17 +// g++ lesson_14*.cpp -g -I -L -lHalide -lpthread -ldl -o lesson_14 -std=c++11 // LD_LIBRARY_PATH= ./lesson_14 // On os x: -// g++ lesson_14*.cpp -g -I -L -lHalide -o lesson_14 -std=c++17 +// g++ lesson_14*.cpp -g -I -L -lHalide -o lesson_14 -std=c++11 // DYLD_LIBRARY_PATH= ./lesson_14 // If you have the entire Halide source tree, you can also build it by diff --git a/tutorial/lesson_15_generators.cpp b/tutorial/lesson_15_generators.cpp index 831e7924d464..2f194248f79d 100644 --- a/tutorial/lesson_15_generators.cpp +++ b/tutorial/lesson_15_generators.cpp @@ -4,11 +4,11 @@ // reusable components called generators. // On linux, you can compile and run it like so: -// g++ lesson_15*.cpp /GenGen.cpp -g -std=c++17 -fno-rtti -I -L -lHalide -lpthread -ldl -o lesson_15_generate +// g++ lesson_15*.cpp /GenGen.cpp -g -std=c++11 -fno-rtti -I -L -lHalide -lpthread -ldl -o lesson_15_generate // bash lesson_15_generators_usage.sh // On os x: -// g++ lesson_15*.cpp /GenGen.cpp -g -std=c++17 -fno-rtti -I -L -lHalide -o lesson_15_generate +// g++ lesson_15*.cpp /GenGen.cpp -g -std=c++11 -fno-rtti -I -L -lHalide -o lesson_15_generate // bash lesson_15_generators_usage.sh // If you have the entire Halide source tree, you can also build it by diff --git a/tutorial/lesson_16_rgb_generate.cpp b/tutorial/lesson_16_rgb_generate.cpp index 3621a6f9f2ef..5b57548994f3 100644 --- a/tutorial/lesson_16_rgb_generate.cpp +++ b/tutorial/lesson_16_rgb_generate.cpp @@ -6,7 +6,7 @@ // On linux or os x, you can compile and run it like so: -// g++ lesson_16_rgb_generate.cpp /GenGen.cpp -g -std=c++17 -fno-rtti -I -L -lHalide -lpthread -ldl -o lesson_16_generate +// g++ lesson_16_rgb_generate.cpp /GenGen.cpp -g -std=c++11 -fno-rtti -I -L -lHalide -lpthread -ldl -o lesson_16_generate // export LD_LIBRARY_PATH= # For linux // export DYLD_LIBRARY_PATH= # For OS X // ./lesson_16_generate -g brighten -o . -f brighten_planar target=host layout=planar diff --git a/tutorial/lesson_17_predicated_rdom.cpp b/tutorial/lesson_17_predicated_rdom.cpp index 164e64cdd1a0..a781fe2bc038 100644 --- a/tutorial/lesson_17_predicated_rdom.cpp +++ b/tutorial/lesson_17_predicated_rdom.cpp @@ -4,11 +4,11 @@ // subsets of a reduction domain using predicates. // On linux, you can compile and run it like so: -// g++ lesson_17*.cpp -g -I -L -lHalide -lpthread -ldl -o lesson_17 -std=c++17 +// g++ lesson_17*.cpp -g -I -L -lHalide -lpthread -ldl -o lesson_17 -std=c++11 // LD_LIBRARY_PATH= ./lesson_17 // On os x: -// g++ lesson_17*.cpp -g -I -L -lHalide -o lesson_17 -std=c++17 +// g++ lesson_17*.cpp -g -I -L -lHalide -o lesson_17 -std=c++11 // DYLD_LIBRARY_PATH= ./lesson_17 // If you have the entire Halide source tree, you can also build it by diff --git a/tutorial/lesson_18_parallel_associative_reductions.cpp b/tutorial/lesson_18_parallel_associative_reductions.cpp index 18e3aa010f4d..db628a662f90 100644 --- a/tutorial/lesson_18_parallel_associative_reductions.cpp +++ b/tutorial/lesson_18_parallel_associative_reductions.cpp @@ -4,11 +4,11 @@ // reduction using the scheduling directive 'rfactor'. // On linux, you can compile and run it like so: -// g++ lesson_18*.cpp -g -I -L -lHalide -lpthread -ldl -o lesson_18 -std=c++17 +// g++ lesson_18*.cpp -g -I -L -lHalide -lpthread -ldl -o lesson_18 -std=c++11 // LD_LIBRARY_PATH= ./lesson_18 // On os x: -// g++ lesson_18*.cpp -g -I -L -lHalide -o lesson_18 -std=c++17 +// g++ lesson_18*.cpp -g -I -L -lHalide -o lesson_18 -std=c++11 // DYLD_LIBRARY_PATH= ./lesson_18 // If you have the entire Halide source tree, you can also build it by diff --git a/tutorial/lesson_19_wrapper_funcs.cpp b/tutorial/lesson_19_wrapper_funcs.cpp index 308d1d64e545..47daa4831968 100644 --- a/tutorial/lesson_19_wrapper_funcs.cpp +++ b/tutorial/lesson_19_wrapper_funcs.cpp @@ -5,11 +5,11 @@ // from a Func or an ImageParam. // On linux, you can compile and run it like so: -// g++ lesson_19*.cpp -g -I -L -lHalide -lpthread -ldl -o lesson_19 -std=c++17 +// g++ lesson_19*.cpp -g -I -L -lHalide -lpthread -ldl -o lesson_19 -std=c++11 // LD_LIBRARY_PATH= ./lesson_19 // On os x: -// g++ lesson_19*.cpp -g -I -L -lHalide -o lesson_19 -std=c++17 +// g++ lesson_19*.cpp -g -I -L -lHalide -o lesson_19 -std=c++11 // DYLD_LIBRARY_PATH= ./lesson_19 // If you have the entire Halide source tree, you can also build it by diff --git a/tutorial/lesson_20_cloning_funcs.cpp b/tutorial/lesson_20_cloning_funcs.cpp index d8ed6ddf1e2d..452977272762 100644 --- a/tutorial/lesson_20_cloning_funcs.cpp +++ b/tutorial/lesson_20_cloning_funcs.cpp @@ -4,11 +4,11 @@ // a Func. // On linux, you can compile and run it like so: -// g++ lesson_20*.cpp -g -I -L -lHalide -lpthread -ldl -o lesson_20 -std=c++17 +// g++ lesson_20*.cpp -g -I -L -lHalide -lpthread -ldl -o lesson_20 -std=c++11 // LD_LIBRARY_PATH= ./lesson_20 // On os x: -// g++ lesson_20*.cpp -g -I -L -lHalide -o lesson_20 -std=c++17 +// g++ lesson_20*.cpp -g -I -L -lHalide -o lesson_20 -std=c++11 // DYLD_LIBRARY_PATH= ./lesson_20 // If you have the entire Halide source tree, you can also build it by diff --git a/tutorial/lesson_21_auto_scheduler_generate.cpp b/tutorial/lesson_21_auto_scheduler_generate.cpp index 14803799c7b4..7acd0f4fe35e 100644 --- a/tutorial/lesson_21_auto_scheduler_generate.cpp +++ b/tutorial/lesson_21_auto_scheduler_generate.cpp @@ -7,12 +7,12 @@ // On linux or os x, you can compile and run it like so: -// g++ lesson_21_auto_scheduler_generate.cpp /GenGen.cpp -g -std=c++17 -fno-rtti -I -L -lHalide -lpthread -ldl -o lesson_21_generate +// g++ lesson_21_auto_scheduler_generate.cpp /GenGen.cpp -g -std=c++11 -fno-rtti -I -L -lHalide -lpthread -ldl -o lesson_21_generate // export LD_LIBRARY_PATH= # For linux // export DYLD_LIBRARY_PATH= # For OS X // ./lesson_21_generate -o . -g auto_schedule_gen -f auto_schedule_false -e static_library,h,schedule target=host auto_schedule=false // ./lesson_21_generate -o . -g auto_schedule_gen -f auto_schedule_true -e static_library,h,schedule -p -S Mullapudi2016 target=host auto_schedule=true machine_params=32,16777216,40 -// g++ lesson_21_auto_scheduler_run.cpp -std=c++17 -I -I auto_schedule_false.a auto_schedule_true.a -ldl -lpthread -o lesson_21_run +// g++ lesson_21_auto_scheduler_run.cpp -std=c++11 -I -I auto_schedule_false.a auto_schedule_true.a -ldl -lpthread -o lesson_21_run // ./lesson_21_run // If you have the entire Halide source tree, you can also build it by From e9bdcddda39a31e10ad44393441639f6bdb76f69 Mon Sep 17 00:00:00 2001 From: Steven Johnson Date: Thu, 14 Jan 2021 14:25:50 -0800 Subject: [PATCH 23/53] Update setup.py --- apps/HelloPyTorch/setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/HelloPyTorch/setup.py b/apps/HelloPyTorch/setup.py index 57a48b517f59..f272cccce73e 100644 --- a/apps/HelloPyTorch/setup.py +++ b/apps/HelloPyTorch/setup.py @@ -79,7 +79,7 @@ def generate_pybind_wrapper(path, headers, has_cuda): extension = CUDAExtension(ext_name, sources, include_dirs=include_dirs, extra_objects=hl_libs, - libraries=["cuda"], # Halide ops need the full cuda lib, not just the RT library + libraries=["cuda"], # Halide ops need the full cuda lib, not just the RT library extra_compile_args=compile_args) else: print("Generating CPU wrapper") From 1652a4bce2b3ee9aae0a7537bfba972bc58ef10f Mon Sep 17 00:00:00 2001 From: Steven Johnson Date: Fri, 15 Jan 2021 11:49:07 -0800 Subject: [PATCH 24/53] Update Generator.cpp --- src/Generator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Generator.cpp b/src/Generator.cpp index e973885ee53d..e732fca13889 100644 --- a/src/Generator.cpp +++ b/src/Generator.cpp @@ -757,7 +757,7 @@ std::string halide_type_to_c_type(const Type &t) { int generate_filter_main_inner(int argc, char **argv, std::ostream &cerr) { const char kUsage[] = - "gengen\n" + "gengen \n" " [-g GENERATOR_NAME] [-f FUNCTION_NAME] [-o OUTPUT_DIR] [-r RUNTIME_NAME] [-d 1|0]\n" " [-e EMIT_OPTIONS] [-n FILE_BASE_NAME] [-p PLUGIN_NAME] [-s AUTOSCHEDULER_NAME]\n" " target=target-string[,target-string...] [generator_arg=value [...]]\n" From 6491f29ec3bc6ad859602b4de188e045d5c8a3fb Mon Sep 17 00:00:00 2001 From: Steven Johnson Date: Fri, 15 Jan 2021 11:49:12 -0800 Subject: [PATCH 25/53] Update Generator.cpp --- src/Generator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Generator.cpp b/src/Generator.cpp index e732fca13889..e973885ee53d 100644 --- a/src/Generator.cpp +++ b/src/Generator.cpp @@ -757,7 +757,7 @@ std::string halide_type_to_c_type(const Type &t) { int generate_filter_main_inner(int argc, char **argv, std::ostream &cerr) { const char kUsage[] = - "gengen \n" + "gengen\n" " [-g GENERATOR_NAME] [-f FUNCTION_NAME] [-o OUTPUT_DIR] [-r RUNTIME_NAME] [-d 1|0]\n" " [-e EMIT_OPTIONS] [-n FILE_BASE_NAME] [-p PLUGIN_NAME] [-s AUTOSCHEDULER_NAME]\n" " target=target-string[,target-string...] [generator_arg=value [...]]\n" From df73068df0b7728a3d05bac70915bd49c63972e6 Mon Sep 17 00:00:00 2001 From: Steven Johnson Date: Fri, 15 Jan 2021 12:32:28 -0800 Subject: [PATCH 26/53] Update Generator.cpp --- src/Generator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Generator.cpp b/src/Generator.cpp index e973885ee53d..e732fca13889 100644 --- a/src/Generator.cpp +++ b/src/Generator.cpp @@ -757,7 +757,7 @@ std::string halide_type_to_c_type(const Type &t) { int generate_filter_main_inner(int argc, char **argv, std::ostream &cerr) { const char kUsage[] = - "gengen\n" + "gengen \n" " [-g GENERATOR_NAME] [-f FUNCTION_NAME] [-o OUTPUT_DIR] [-r RUNTIME_NAME] [-d 1|0]\n" " [-e EMIT_OPTIONS] [-n FILE_BASE_NAME] [-p PLUGIN_NAME] [-s AUTOSCHEDULER_NAME]\n" " target=target-string[,target-string...] [generator_arg=value [...]]\n" From 7b5e7cdd55e50e3b7272849b9d51d11331fc651d Mon Sep 17 00:00:00 2001 From: Steven Johnson Date: Fri, 15 Jan 2021 12:32:31 -0800 Subject: [PATCH 27/53] Update Generator.cpp --- src/Generator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Generator.cpp b/src/Generator.cpp index e732fca13889..e973885ee53d 100644 --- a/src/Generator.cpp +++ b/src/Generator.cpp @@ -757,7 +757,7 @@ std::string halide_type_to_c_type(const Type &t) { int generate_filter_main_inner(int argc, char **argv, std::ostream &cerr) { const char kUsage[] = - "gengen \n" + "gengen\n" " [-g GENERATOR_NAME] [-f FUNCTION_NAME] [-o OUTPUT_DIR] [-r RUNTIME_NAME] [-d 1|0]\n" " [-e EMIT_OPTIONS] [-n FILE_BASE_NAME] [-p PLUGIN_NAME] [-s AUTOSCHEDULER_NAME]\n" " target=target-string[,target-string...] [generator_arg=value [...]]\n" From 8e16be5d1d087591126ab0c8c4538533a7f13796 Mon Sep 17 00:00:00 2001 From: Steven Johnson Date: Fri, 15 Jan 2021 13:23:37 -0800 Subject: [PATCH 28/53] Update Generator.cpp --- src/Generator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Generator.cpp b/src/Generator.cpp index e973885ee53d..e732fca13889 100644 --- a/src/Generator.cpp +++ b/src/Generator.cpp @@ -757,7 +757,7 @@ std::string halide_type_to_c_type(const Type &t) { int generate_filter_main_inner(int argc, char **argv, std::ostream &cerr) { const char kUsage[] = - "gengen\n" + "gengen \n" " [-g GENERATOR_NAME] [-f FUNCTION_NAME] [-o OUTPUT_DIR] [-r RUNTIME_NAME] [-d 1|0]\n" " [-e EMIT_OPTIONS] [-n FILE_BASE_NAME] [-p PLUGIN_NAME] [-s AUTOSCHEDULER_NAME]\n" " target=target-string[,target-string...] [generator_arg=value [...]]\n" From 799e9a6f84189c76c13fa506a6ca8a0e7dd6c1b4 Mon Sep 17 00:00:00 2001 From: Steven Johnson Date: Fri, 15 Jan 2021 13:31:59 -0800 Subject: [PATCH 29/53] Update Generator.cpp --- src/Generator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Generator.cpp b/src/Generator.cpp index e732fca13889..e973885ee53d 100644 --- a/src/Generator.cpp +++ b/src/Generator.cpp @@ -757,7 +757,7 @@ std::string halide_type_to_c_type(const Type &t) { int generate_filter_main_inner(int argc, char **argv, std::ostream &cerr) { const char kUsage[] = - "gengen \n" + "gengen\n" " [-g GENERATOR_NAME] [-f FUNCTION_NAME] [-o OUTPUT_DIR] [-r RUNTIME_NAME] [-d 1|0]\n" " [-e EMIT_OPTIONS] [-n FILE_BASE_NAME] [-p PLUGIN_NAME] [-s AUTOSCHEDULER_NAME]\n" " target=target-string[,target-string...] [generator_arg=value [...]]\n" From e18328a7dcd3c23b7aa48222a8ccb15408a1a41d Mon Sep 17 00:00:00 2001 From: Steven Johnson Date: Wed, 20 Jan 2021 12:47:39 -0800 Subject: [PATCH 30/53] Update Generator.cpp --- src/Generator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Generator.cpp b/src/Generator.cpp index e973885ee53d..e732fca13889 100644 --- a/src/Generator.cpp +++ b/src/Generator.cpp @@ -757,7 +757,7 @@ std::string halide_type_to_c_type(const Type &t) { int generate_filter_main_inner(int argc, char **argv, std::ostream &cerr) { const char kUsage[] = - "gengen\n" + "gengen \n" " [-g GENERATOR_NAME] [-f FUNCTION_NAME] [-o OUTPUT_DIR] [-r RUNTIME_NAME] [-d 1|0]\n" " [-e EMIT_OPTIONS] [-n FILE_BASE_NAME] [-p PLUGIN_NAME] [-s AUTOSCHEDULER_NAME]\n" " target=target-string[,target-string...] [generator_arg=value [...]]\n" From d4fecdfcddec22d2c738dd671629e62eba552ab3 Mon Sep 17 00:00:00 2001 From: Steven Johnson Date: Wed, 20 Jan 2021 12:47:44 -0800 Subject: [PATCH 31/53] Update Generator.cpp --- src/Generator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Generator.cpp b/src/Generator.cpp index e732fca13889..e973885ee53d 100644 --- a/src/Generator.cpp +++ b/src/Generator.cpp @@ -757,7 +757,7 @@ std::string halide_type_to_c_type(const Type &t) { int generate_filter_main_inner(int argc, char **argv, std::ostream &cerr) { const char kUsage[] = - "gengen \n" + "gengen\n" " [-g GENERATOR_NAME] [-f FUNCTION_NAME] [-o OUTPUT_DIR] [-r RUNTIME_NAME] [-d 1|0]\n" " [-e EMIT_OPTIONS] [-n FILE_BASE_NAME] [-p PLUGIN_NAME] [-s AUTOSCHEDULER_NAME]\n" " target=target-string[,target-string...] [generator_arg=value [...]]\n" From b53c015a107eafc5bb7ee0927515ce0cd6182a44 Mon Sep 17 00:00:00 2001 From: Steven Johnson Date: Fri, 22 Jan 2021 09:10:23 -0800 Subject: [PATCH 32/53] trigger buildbots From 6052d7085743584a01dbebe8145f1bd32b8481f0 Mon Sep 17 00:00:00 2001 From: Steven Johnson Date: Mon, 25 Jan 2021 12:09:28 -0800 Subject: [PATCH 33/53] trigger buildbots From 02dfc432454e6c35b0a530fd94673a94a5f883dd Mon Sep 17 00:00:00 2001 From: Steven Johnson Date: Mon, 25 Jan 2021 14:18:57 -0800 Subject: [PATCH 34/53] trigger buildbots From 70387fed182891d4a67995b0187df75242505f8e Mon Sep 17 00:00:00 2001 From: Steven Johnson Date: Mon, 25 Jan 2021 17:21:33 -0800 Subject: [PATCH 35/53] Update interpreter.cpp --- test/correctness/interpreter.cpp | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/test/correctness/interpreter.cpp b/test/correctness/interpreter.cpp index 0d2cbbd1a2d5..4b9e91749817 100644 --- a/test/correctness/interpreter.cpp +++ b/test/correctness/interpreter.cpp @@ -127,6 +127,7 @@ int main(int argc, char **argv) { Buffer out_buf(W, H); + int result = 0; { // (in(x + 1, y) - in(x - 1, y)) / 2; int program_src[3][4] = {{Sub, 5, 3, 0}, @@ -142,10 +143,15 @@ int main(int argc, char **argv) { for (int y = 0; y < H; y++) { for (int x = 0; x < W; x++) { + int a = in_buf(x + 1, y); + int b = in_buf(x - 1, y); + int r0 = (a - b); + int r1 = r0 >> 1; + int r2 = (uint8_t) r1; uint8_t correct = (uint8_t)(((int)in_buf(x + 1, y) - in_buf(x - 1, y)) >> 1); if (out_buf(x, y) != correct) { - printf("out_buf(%d, %d) = %d instead of %d\n", x, y, out_buf(x, y), correct); - return -1; + printf("out_buf1(%d, %d) = %d instead of %d (%d %d %d)\n", x, y, out_buf(x, y), correct, r0, r1, r2); + result = -1; } } } @@ -171,14 +177,23 @@ int main(int argc, char **argv) { for (int x = 0; x < W; x++) { int a = in_buf(x - 1, y - 1); int b = in_buf(x + 1, y + 1); + int r0 = a * a + b * b; + float r1 = std::sqrt(r0); + float r2 = std::floor(r1); + int r3 = (int) r2; + int r4 = (uint8_t) r3; uint8_t correct = (uint8_t)((int)std::floor(std::sqrt(a * a + b * b))); if (out_buf(x, y) != correct) { - printf("out_buf(%d, %d) = %d instead of %d\n", x, y, out_buf(x, y), correct); - return -1; + printf("out_buf2(%d, %d) = %d instead of %d (%d %d %d %f %f %d %d\n", x, y, out_buf(x, y), correct, + a, b, r0, r1, r2, r3, r4); + result = -1; } } } } - printf("Success!\n"); - return 0; + + if (!result) { + printf("Success!\n"); + } + return result; } From c9ca274c3962a06ed7d32fc18d154796cb71fef8 Mon Sep 17 00:00:00 2001 From: Steven Johnson Date: Mon, 25 Jan 2021 17:25:43 -0800 Subject: [PATCH 36/53] Update interpreter.cpp --- test/correctness/interpreter.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/correctness/interpreter.cpp b/test/correctness/interpreter.cpp index 4b9e91749817..6c9de64c722e 100644 --- a/test/correctness/interpreter.cpp +++ b/test/correctness/interpreter.cpp @@ -147,7 +147,7 @@ int main(int argc, char **argv) { int b = in_buf(x - 1, y); int r0 = (a - b); int r1 = r0 >> 1; - int r2 = (uint8_t) r1; + int r2 = (uint8_t)r1; uint8_t correct = (uint8_t)(((int)in_buf(x + 1, y) - in_buf(x - 1, y)) >> 1); if (out_buf(x, y) != correct) { printf("out_buf1(%d, %d) = %d instead of %d (%d %d %d)\n", x, y, out_buf(x, y), correct, r0, r1, r2); @@ -180,12 +180,12 @@ int main(int argc, char **argv) { int r0 = a * a + b * b; float r1 = std::sqrt(r0); float r2 = std::floor(r1); - int r3 = (int) r2; - int r4 = (uint8_t) r3; + int r3 = (int)r2; + int r4 = (uint8_t)r3; uint8_t correct = (uint8_t)((int)std::floor(std::sqrt(a * a + b * b))); if (out_buf(x, y) != correct) { printf("out_buf2(%d, %d) = %d instead of %d (%d %d %d %f %f %d %d\n", x, y, out_buf(x, y), correct, - a, b, r0, r1, r2, r3, r4); + a, b, r0, r1, r2, r3, r4); result = -1; } } From 3853ddd936740546e95482754dafef686ec68f3d Mon Sep 17 00:00:00 2001 From: Steven Johnson Date: Tue, 2 Feb 2021 16:55:49 -0800 Subject: [PATCH 37/53] Update Timer.h --- src/autoschedulers/adams2019/Timer.h | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/autoschedulers/adams2019/Timer.h b/src/autoschedulers/adams2019/Timer.h index 13685711dc04..a4b885445fdd 100644 --- a/src/autoschedulers/adams2019/Timer.h +++ b/src/autoschedulers/adams2019/Timer.h @@ -12,11 +12,11 @@ namespace Autoscheduler { using Clock = std::chrono::high_resolution_clock; struct ScopedTimer { - std::chrono::time_point start; + std::chrono::time_point start = Clock::now(); std::string msg; ScopedTimer(const std::string &msg) - : start{Clock::now()}, msg{msg} { + : msg{msg} { aslog(0) << "Start: " << msg << "\n"; } @@ -28,11 +28,9 @@ struct ScopedTimer { }; struct Timer { - std::chrono::time_point start; + std::chrono::time_point start = Clock::now(); - Timer() - : start{Clock::now()} { - } + Timer() = default; void restart() { start = Clock::now(); From 161b385fcd84407bba22dbabb52c2b96a55f1f34 Mon Sep 17 00:00:00 2001 From: Steven Johnson Date: Mon, 1 Mar 2021 10:04:20 -0800 Subject: [PATCH 38/53] clang-format --- src/Generator.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Generator.h b/src/Generator.h index d65e0019208a..69b214785905 100644 --- a/src/Generator.h +++ b/src/Generator.h @@ -3429,7 +3429,7 @@ class GeneratorBase : public NamesInterface, public GeneratorContext { } template - inline void build_inputs(std::vector> &inputs, int idx, const First &first, const Second &second, const Rest &... rest) { + inline void build_inputs(std::vector> &inputs, int idx, const First &first, const Second &second, const Rest &...rest) { build_inputs(inputs, idx, first); build_inputs(inputs, idx + 1, second, rest...); } From b0c64269a12441162172ba6a48531d4a2e8450a2 Mon Sep 17 00:00:00 2001 From: Alex Reinking Date: Mon, 24 May 2021 15:17:28 -0700 Subject: [PATCH 39/53] add a hint to Clang package search --- dependencies/llvm/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/llvm/CMakeLists.txt b/dependencies/llvm/CMakeLists.txt index b09e3c0160ca..3674bf1043a1 100644 --- a/dependencies/llvm/CMakeLists.txt +++ b/dependencies/llvm/CMakeLists.txt @@ -11,7 +11,7 @@ set(CMAKE_MAP_IMPORTED_CONFIG_RELWITHDEBINFO RelWithDebInfo Release MinSizeRel " set(CMAKE_MAP_IMPORTED_CONFIG_RELEASE Release MinSizeRel RelWithDebInfo "") find_package(LLVM ${Halide_REQUIRE_LLVM_VERSION} REQUIRED) -find_package(Clang REQUIRED CONFIG HINTS "${LLVM_DIR}/../clang") +find_package(Clang REQUIRED CONFIG HINTS "${LLVM_DIR}/../clang" "${LLVM_DIR}/../lib/cmake/clang") set(LLVM_PACKAGE_VERSION "${LLVM_PACKAGE_VERSION}" CACHE INTERNAL "LLVM version") From bb12849705691d3ee6248a9db1e25d43176d4123 Mon Sep 17 00:00:00 2001 From: Alex Reinking Date: Mon, 24 May 2021 15:42:10 -0700 Subject: [PATCH 40/53] Compile runtime with -std=c++17 --- src/runtime/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/src/runtime/CMakeLists.txt b/src/runtime/CMakeLists.txt index 76fb71188b78..4cc19de8013d 100644 --- a/src/runtime/CMakeLists.txt +++ b/src/runtime/CMakeLists.txt @@ -146,6 +146,7 @@ add_library(Halide_initmod OBJECT) # Note: this always uses Clang-from-LLVM for compilation, so none of these flags should need conditionalization. set(RUNTIME_CXX_FLAGS -O3 + -std=c++17 -ffreestanding -fno-blocks -fno-exceptions From da9b81236a7b731f12c2a40b5365bdb1ec7c3a9c Mon Sep 17 00:00:00 2001 From: Alex Reinking Date: Mon, 24 May 2021 15:50:10 -0700 Subject: [PATCH 41/53] Use simpler method to set default BUILD_SHARED_LIBS --- CMakeLists.txt | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 955d5e86baab..8347654173ce 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,9 +17,7 @@ include(MakeShellPath) include(CMakeDependentOption) # Build Halide as a shared lib by default, but still honor command-line settings. -if (NOT DEFINED BUILD_SHARED_LIBS) - set(BUILD_SHARED_LIBS YES) -endif () +option(BUILD_SHARED_LIBS "Build shared libraries" ON) # Warn if the user did not set a build type and is using a single-configuration generator. get_property(IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) From 232aead48fde1d084bc3da60a79cd669a7d8fefa Mon Sep 17 00:00:00 2001 From: Alex Reinking Date: Mon, 24 May 2021 22:13:42 -0700 Subject: [PATCH 42/53] make sure C++17 requirement propagates to libHalide consumers --- src/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 27d2f84191f1..8b3be6a070b1 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -369,7 +369,7 @@ add_library(Halide::Halide ALIAS Halide) target_link_libraries(Halide PRIVATE Halide::LLVM) target_link_libraries(Halide PUBLIC Halide::LanguageOptions) target_compile_definitions(Halide PRIVATE $<$,STATIC_LIBRARY>:Halide_STATIC_DEFINE>) -target_compile_features(Halide PUBLIC cxx_std_11) +target_compile_features(Halide PUBLIC cxx_std_17) include(TargetExportScript) ## TODO: implement something similar for Windows/link.exe From b50bedc4a3dbf8b46dc2a77377b4d8d05499f0ec Mon Sep 17 00:00:00 2001 From: Steven Johnson Date: Thu, 3 Jun 2021 09:52:51 -0700 Subject: [PATCH 43/53] Fixes --- README.md | 3 +-- src/Generator.h | 22 ++++------------------ 2 files changed, 5 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 00bafd9f6052..fc184a78fdd1 100644 --- a/README.md +++ b/README.md @@ -16,8 +16,7 @@ to an object file, or JIT-compile it and run it in the same process. Halide also provides a Python binding that provides full support for writing Halide embedded in Python without C++. -(Note that *using* Halide requires C++11 or later, but *building* Halide -requires C++17.) +Halide requires C++17 (or later) to use. For more detail about what Halide is, see http://halide-lang.org. diff --git a/src/Generator.h b/src/Generator.h index bcb3e3a4744e..8be307212ef4 100644 --- a/src/Generator.h +++ b/src/Generator.h @@ -3130,11 +3130,7 @@ class GeneratorBase : public NamesInterface, public GeneratorContext { user_assert(sizeof...(args) == pi.inputs().size()) << "Expected exactly " << pi.inputs().size() << " inputs but got " << sizeof...(args) << "\n"; - // Deliberately avoiding make_index_sequence and friends here so that we don't have to provide - // our own implementations for clients that are using C++11 (which didn't provide them). - std::vector> inputs(sizeof...(args)); - build_inputs(inputs, 0, args...); - set_inputs_vector(inputs); + set_inputs_vector(build_inputs(std::forward_as_tuple(args...), std::make_index_sequence{})); } Realization realize(std::vector sizes) { @@ -3479,19 +3475,9 @@ class GeneratorBase : public NamesInterface, public GeneratorContext { return siv; } - inline void build_inputs(std::vector> &inputs, int idx) { - internal_assert(idx == (int)inputs.size()); - } - - template - inline void build_inputs(std::vector> &inputs, int idx, const Last &last) { - inputs[idx] = build_input(idx, last); - } - - template - inline void build_inputs(std::vector> &inputs, int idx, const First &first, const Second &second, const Rest &...rest) { - build_inputs(inputs, idx, first); - build_inputs(inputs, idx + 1, second, rest...); + template + std::vector> build_inputs(const std::tuple &t, std::index_sequence) { + return {build_input(Indices, std::get(t))...}; } public: From 377c2b64408486741c1c045489d473689bb089fc Mon Sep 17 00:00:00 2001 From: Steven Johnson Date: Thu, 3 Jun 2021 10:19:16 -0700 Subject: [PATCH 44/53] Update apps, tutorials, etc --- .clang-format | 2 +- Makefile | 7 +++---- README.md | 2 +- README_cmake.md | 4 ++-- apps/HelloAndroid/build.gradle | 2 +- apps/HelloAndroid/build.sh | 2 +- apps/HelloAndroid/jni/Application.mk | 2 +- apps/HelloAndroidCamera2/build.gradle | 2 +- apps/HelloAndroidCamera2/build.sh | 4 ++-- apps/HelloAndroidCamera2/jni/Application.mk | 2 +- apps/HelloWasm/CMakeLists.txt | 2 +- apps/HelloiOS/HelloiOS.xcodeproj/project.pbxproj | 2 +- apps/bgu/CMakeLists.txt | 2 +- apps/bilateral_grid/CMakeLists.txt | 2 +- apps/blur/CMakeLists.txt | 2 +- apps/c_backend/CMakeLists.txt | 2 +- apps/camera_pipe/CMakeLists.txt | 2 +- apps/conv_layer/CMakeLists.txt | 2 +- apps/cuda_mat_mul/CMakeLists.txt | 2 +- apps/depthwise_separable_conv/CMakeLists.txt | 2 +- apps/fft/CMakeLists.txt | 2 +- apps/fft/Makefile | 2 +- apps/hannk/CMakeLists.txt | 2 +- apps/harris/CMakeLists.txt | 2 +- apps/hist/CMakeLists.txt | 2 +- apps/iir_blur/CMakeLists.txt | 2 +- apps/interpolate/CMakeLists.txt | 2 +- apps/lens_blur/CMakeLists.txt | 2 +- apps/linear_algebra/CMakeLists.txt | 2 +- apps/local_laplacian/CMakeLists.txt | 2 +- apps/max_filter/CMakeLists.txt | 2 +- apps/nl_means/CMakeLists.txt | 2 +- apps/openglcompute/Makefile | 2 +- apps/openglcompute/jni/Android.mk | 8 ++++---- apps/resize/CMakeLists.txt | 2 +- apps/stencil_chain/CMakeLists.txt | 2 +- apps/support/Makefile.inc | 2 +- apps/unsharp/CMakeLists.txt | 2 +- apps/wavelet/CMakeLists.txt | 2 +- src/autoschedulers/adams2019/autotune_loop.sh | 2 +- src/runtime/can_use_target.cpp | 8 +------- src/runtime/cpu_features.h | 2 -- src/runtime/hexagon_remote/Makefile | 2 +- test/correctness/named_updates.cpp | 3 +-- test/generator/stubuser_generator.cpp | 2 +- tools/mex_halide.m | 2 +- tutorial/lesson_01_basics.cpp | 4 ++-- tutorial/lesson_02_input_image.cpp | 4 ++-- tutorial/lesson_03_debugging_1.cpp | 4 ++-- tutorial/lesson_04_debugging_2.cpp | 4 ++-- tutorial/lesson_05_scheduling_1.cpp | 4 ++-- tutorial/lesson_06_realizing_over_shifted_domains.cpp | 4 ++-- tutorial/lesson_07_multi_stage_pipelines.cpp | 4 ++-- tutorial/lesson_08_scheduling_2.cpp | 4 ++-- tutorial/lesson_09_update_definitions.cpp | 4 ++-- tutorial/lesson_10_aot_compilation_generate.cpp | 6 +++--- tutorial/lesson_11_cross_compilation.cpp | 4 ++-- tutorial/lesson_12_using_the_gpu.cpp | 4 ++-- tutorial/lesson_13_tuples.cpp | 6 +++--- tutorial/lesson_14_types.cpp | 4 ++-- tutorial/lesson_15_generators.cpp | 4 ++-- tutorial/lesson_16_rgb_generate.cpp | 2 +- tutorial/lesson_17_predicated_rdom.cpp | 4 ++-- tutorial/lesson_18_parallel_associative_reductions.cpp | 4 ++-- tutorial/lesson_19_wrapper_funcs.cpp | 4 ++-- tutorial/lesson_20_cloning_funcs.cpp | 4 ++-- tutorial/lesson_21_auto_scheduler_generate.cpp | 4 ++-- 67 files changed, 95 insertions(+), 105 deletions(-) diff --git a/.clang-format b/.clang-format index f500f7c564ab..1022bb0407e6 100644 --- a/.clang-format +++ b/.clang-format @@ -43,7 +43,7 @@ SpacesBeforeTrailingComments: 2 SpacesInAngles: false SpacesInCStyleCastParentheses: false SpacesInParentheses: false -Standard: c++11 +Standard: c++17 TabWidth: 8 UseTab: Never ... diff --git a/Makefile b/Makefile index c6d0b8b63b90..8575a0c8fad2 100644 --- a/Makefile +++ b/Makefile @@ -252,7 +252,7 @@ LLVM_SHARED_LIBS = -Wl,-rpath=$(LLVM_LIBDIR) -L $(LLVM_LIBDIR) -lLLVM LLVM_LIBS_FOR_SHARED_LIBHALIDE=$(if $(WITH_LLVM_INSIDE_SHARED_LIBHALIDE),$(LLVM_STATIC_LIBS),$(LLVM_SHARED_LIBS)) -TUTORIAL_CXX_FLAGS ?= -std=c++11 -g -fno-omit-frame-pointer $(RTTI_CXX_FLAGS) -I $(ROOT_DIR)/tools $(SANITIZER_FLAGS) $(LLVM_CXX_FLAGS_LIBCPP) +TUTORIAL_CXX_FLAGS ?= -std=c++17 -g -fno-omit-frame-pointer $(RTTI_CXX_FLAGS) -I $(ROOT_DIR)/tools $(SANITIZER_FLAGS) $(LLVM_CXX_FLAGS_LIBCPP) # The tutorials contain example code with warnings that we don't want # to be flagged as errors, so the test flags are the tutorial flags # plus our warning flags. @@ -936,14 +936,13 @@ ifeq ($(UNAME), Darwin) install_name_tool -id $(CURDIR)/$(BIN_DIR)/libHalide.$(SHARED_EXT) $(BIN_DIR)/libHalide.$(SHARED_EXT) endif -# Since Halide.h is included by client code, it should only be compiled vs C++11 (not C++17) $(INCLUDE_DIR)/Halide.h: $(SRC_DIR)/../LICENSE.txt $(HEADERS) $(BIN_DIR)/build_halide_h @mkdir -p $(@D) $(BIN_DIR)/build_halide_h $(SRC_DIR)/../LICENSE.txt $(HEADERS) > $(INCLUDE_DIR)/Halide.h # Also generate a precompiled version in the same folder so that anything compiled with a compatible set of flags can use it @mkdir -p $(INCLUDE_DIR)/Halide.h.gch - $(CXX) -std=c++11 $(TEST_CXX_FLAGS) -I$(ROOT_DIR) $(OPTIMIZE) -x c++-header $(INCLUDE_DIR)/Halide.h -o $(INCLUDE_DIR)/Halide.h.gch/Halide.default.gch - $(CXX) -std=c++11 $(TEST_CXX_FLAGS) -I$(ROOT_DIR) $(OPTIMIZE_FOR_BUILD_TIME) -x c++-header $(INCLUDE_DIR)/Halide.h -o $(INCLUDE_DIR)/Halide.h.gch/Halide.test.gch + $(CXX) -std=c++17 $(TEST_CXX_FLAGS) -I$(ROOT_DIR) $(OPTIMIZE) -x c++-header $(INCLUDE_DIR)/Halide.h -o $(INCLUDE_DIR)/Halide.h.gch/Halide.default.gch + $(CXX) -std=c++17 $(TEST_CXX_FLAGS) -I$(ROOT_DIR) $(OPTIMIZE_FOR_BUILD_TIME) -x c++-header $(INCLUDE_DIR)/Halide.h -o $(INCLUDE_DIR)/Halide.h.gch/Halide.test.gch $(INCLUDE_DIR)/HalideRuntime%: $(SRC_DIR)/runtime/HalideRuntime% echo Copying $< diff --git a/README.md b/README.md index fc184a78fdd1..a608d5e9e289 100644 --- a/README.md +++ b/README.md @@ -99,7 +99,7 @@ Windows 7 and includes Ubuntu 18.04 LTS. Compiled AOT pipelines are expected to have much broader platform support. The binaries use the C ABI, and we expect any compliant C compiler to be able to use -the generated headers correctly. The C++ bindings currently require C++11. If +the generated headers correctly. The C++ bindings currently require C++17. If you discover a compatibility problem with a generated pipeline, please open an issue. diff --git a/README_cmake.md b/README_cmake.md index b15989d4baeb..1dd05453ee8a 100644 --- a/README_cmake.md +++ b/README_cmake.md @@ -542,7 +542,7 @@ boilerplate. cmake_minimum_required(VERSION 3.16) project(HalideExample) -set(CMAKE_CXX_STANDARD 11) # or newer +set(CMAKE_CXX_STANDARD 17) # or newer set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) @@ -558,7 +558,7 @@ immediately after setting the minimum version. The next three variables set the project-wide C++ standard. The first, [`CMAKE_CXX_STANDARD`][cmake_cxx_standard], simply sets the standard version. -Halide requires at least C++11. The second, +Halide requires at least c++17. The second, [`CMAKE_CXX_STANDARD_REQUIRED`][cmake_cxx_standard_required], tells CMake to fail if the compiler cannot provide the requested standard version. Lastly, [`CMAKE_CXX_EXTENSIONS`][cmake_cxx_extensions] tells CMake to disable diff --git a/apps/HelloAndroid/build.gradle b/apps/HelloAndroid/build.gradle index 658fbd1a8711..f199cc8e0746 100644 --- a/apps/HelloAndroid/build.gradle +++ b/apps/HelloAndroid/build.gradle @@ -51,7 +51,7 @@ sources { executables { hello_generator { binaries.all { - cppCompiler.args "-std=c++11", "-g", "-Wall", "-fno-rtti", "-I", "${projectDir}/../../include", "-I", "${projectDir}/../../build/include" + cppCompiler.args "-std=c++17", "-g", "-Wall", "-fno-rtti", "-I", "${projectDir}/../../include", "-I", "${projectDir}/../../build/include" // "/bin" assumes Makefile build for Halide; "/build/lib" assumes CMake build linker.args "-lHalide", "-ldl", "-lpthread", "-lz", "-L", "${projectDir}/../../bin", "-L", "${projectDir}/../../build/lib" } diff --git a/apps/HelloAndroid/build.sh b/apps/HelloAndroid/build.sh index 285e17bfa086..7b87613ca4fa 100755 --- a/apps/HelloAndroid/build.sh +++ b/apps/HelloAndroid/build.sh @@ -3,7 +3,7 @@ set -e android update project -p . --target android-17 mkdir -p bin c++ jni/hello_generator.cpp ../../tools/GenGen.cpp \ - -g -fno-rtti -Wall -std=c++11 \ + -g -fno-rtti -Wall -std=c++17 \ -I ../../include -I ../../build/include \ -L ../../bin -lHalide -ldl -lpthread -lz \ -o bin/hello_generator diff --git a/apps/HelloAndroid/jni/Application.mk b/apps/HelloAndroid/jni/Application.mk index ed84d4a528cc..8d2ba9c04231 100644 --- a/apps/HelloAndroid/jni/Application.mk +++ b/apps/HelloAndroid/jni/Application.mk @@ -5,4 +5,4 @@ APP_ABI := armeabi armeabi-v7a arm64-v8a mips x86_64 x86 APP_PLATFORM := android-17 APP_STL := gnustl_static -APP_CPPFLAGS := -std=c++11 +APP_CPPFLAGS := -std=c++17 diff --git a/apps/HelloAndroidCamera2/build.gradle b/apps/HelloAndroidCamera2/build.gradle index 8184293b966f..74cfe479aa62 100644 --- a/apps/HelloAndroidCamera2/build.gradle +++ b/apps/HelloAndroidCamera2/build.gradle @@ -56,7 +56,7 @@ sources { executables { halide_generator { binaries.all { - cppCompiler.args "-std=c++11", "-g", "-Wall", "-fno-rtti", "-I", "${projectDir}/../../include", "-I", "${projectDir}/../../build/include" + cppCompiler.args "-std=c++17", "-g", "-Wall", "-fno-rtti", "-I", "${projectDir}/../../include", "-I", "${projectDir}/../../build/include" // "/bin" assumes Makefile build for Halide; "/build/lib" assumes CMake build linker.args "-lHalide", "-ldl", "-lpthread", "-lz", "-L", "${projectDir}/../../bin", "-L", "${projectDir}/../../build/lib" } diff --git a/apps/HelloAndroidCamera2/build.sh b/apps/HelloAndroidCamera2/build.sh index 4ff95f95da51..96b604275e5e 100755 --- a/apps/HelloAndroidCamera2/build.sh +++ b/apps/HelloAndroidCamera2/build.sh @@ -9,13 +9,13 @@ fi mkdir -p bin c++ jni/edge_detect_generator.cpp ../../tools/GenGen.cpp \ - -g -fno-rtti -Wall -std=c++11 \ + -g -fno-rtti -Wall -std=c++17 \ -I ../../include -I ../../build/include \ -L ../../bin -lHalide -ldl -lpthread -lz \ -o bin/edge_detect_generator c++ jni/deinterleave_generator.cpp ../../tools/GenGen.cpp \ - -g -fno-rtti -Wall -std=c++11 \ + -g -fno-rtti -Wall -std=c++17 \ -I ../../include -I ../../build/include \ -L ../../bin -lHalide -ldl -lpthread -lz \ -o bin/deinterleave_generator diff --git a/apps/HelloAndroidCamera2/jni/Application.mk b/apps/HelloAndroidCamera2/jni/Application.mk index 68340ea94260..4a1171874c29 100644 --- a/apps/HelloAndroidCamera2/jni/Application.mk +++ b/apps/HelloAndroidCamera2/jni/Application.mk @@ -5,4 +5,4 @@ APP_ABI := armeabi armeabi-v7a arm64-v8a mips x86_64 x86 APP_PLATFORM := android-21 APP_STL := c++_static -APP_CPPFLAGS := -std=c++11 -fno-rtti -fexceptions +APP_CPPFLAGS := -std=c++17 -fno-rtti -fexceptions diff --git a/apps/HelloWasm/CMakeLists.txt b/apps/HelloWasm/CMakeLists.txt index 770f18920b6b..4f2401388822 100644 --- a/apps/HelloWasm/CMakeLists.txt +++ b/apps/HelloWasm/CMakeLists.txt @@ -3,7 +3,7 @@ project(HelloWasm) enable_testing() -set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) diff --git a/apps/HelloiOS/HelloiOS.xcodeproj/project.pbxproj b/apps/HelloiOS/HelloiOS.xcodeproj/project.pbxproj index 460a44f6e8b5..0e2206cf010b 100644 --- a/apps/HelloiOS/HelloiOS.xcodeproj/project.pbxproj +++ b/apps/HelloiOS/HelloiOS.xcodeproj/project.pbxproj @@ -244,7 +244,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/bash; - shellScript = "echo \"${SRCROOT}\"\ncd \"${SRCROOT}/HelloiOS\"\n\n# Echoing commands to output makes it easier to debug XCode failures.\n# Failure on undefined vars is always a good idea.\nset -ex\n\n# xcode puts all sorts of junk in the environment which\n# prevents building a binary for osx (instead of ios).\n# sudo'ing to yourself gives a fresh environment.\nsudo -u ${USER} \\\nc++ reaction_diffusion_2_generator.cpp ${SRCROOT}/../../tools/GenGen.cpp \\\n-std=c++11 \\\n-fno-rtti \\\n-I ${SRCROOT}/../../include \\\n-I ${SRCROOT}/../../build/include \\\n-I ${SRCROOT}/../../tools \\\n-arch x86_64 \\\n-L ${SRCROOT}/../../bin \\\n-lHalide \\\n-o ${DERIVED_FILE_DIR}/reaction_diffusion_2_generator\n\n\nif [ \"${arch}\" == \"x86_64\" ]\nthen\n# assume simulator, which requires osx rather than ios\nTARGET=x86-64-osx\nelse\n# TODO: sniff arm-32 builds here; for now, just assume arm-64 only\nTARGET=arm-64-ios\nfi\n\nfor GEN in init update render; do\n(cd ${DERIVED_FILE_DIR}; \\\nDYLD_LIBRARY_PATH=${SRCROOT}/../../bin:${SRCROOT}/../../build/lib \\\n./reaction_diffusion_2_generator -g reaction_diffusion_2_${GEN} -f reaction_diffusion_2_${GEN} -n reaction_diffusion_2_${GEN} -o ${DERIVED_FILE_DIR} target=${TARGET}-user_context)\ndone\n\nfor GEN in init update render; do\n(cd ${DERIVED_FILE_DIR}; \\\nDYLD_LIBRARY_PATH=${SRCROOT}/../../bin:${SRCROOT}/../../build/lib \\\n./reaction_diffusion_2_generator -g reaction_diffusion_2_${GEN} -f reaction_diffusion_2_metal_${GEN} -n reaction_diffusion_2_metal_${GEN} -o ${DERIVED_FILE_DIR} target=${TARGET}-metal-user_context)\ndone\n"; + shellScript = "echo \"${SRCROOT}\"\ncd \"${SRCROOT}/HelloiOS\"\n\n# Echoing commands to output makes it easier to debug XCode failures.\n# Failure on undefined vars is always a good idea.\nset -ex\n\n# xcode puts all sorts of junk in the environment which\n# prevents building a binary for osx (instead of ios).\n# sudo'ing to yourself gives a fresh environment.\nsudo -u ${USER} \\\nc++ reaction_diffusion_2_generator.cpp ${SRCROOT}/../../tools/GenGen.cpp \\\n-std=c++17 \\\n-fno-rtti \\\n-I ${SRCROOT}/../../include \\\n-I ${SRCROOT}/../../build/include \\\n-I ${SRCROOT}/../../tools \\\n-arch x86_64 \\\n-L ${SRCROOT}/../../bin \\\n-lHalide \\\n-o ${DERIVED_FILE_DIR}/reaction_diffusion_2_generator\n\n\nif [ \"${arch}\" == \"x86_64\" ]\nthen\n# assume simulator, which requires osx rather than ios\nTARGET=x86-64-osx\nelse\n# TODO: sniff arm-32 builds here; for now, just assume arm-64 only\nTARGET=arm-64-ios\nfi\n\nfor GEN in init update render; do\n(cd ${DERIVED_FILE_DIR}; \\\nDYLD_LIBRARY_PATH=${SRCROOT}/../../bin:${SRCROOT}/../../build/lib \\\n./reaction_diffusion_2_generator -g reaction_diffusion_2_${GEN} -f reaction_diffusion_2_${GEN} -n reaction_diffusion_2_${GEN} -o ${DERIVED_FILE_DIR} target=${TARGET}-user_context)\ndone\n\nfor GEN in init update render; do\n(cd ${DERIVED_FILE_DIR}; \\\nDYLD_LIBRARY_PATH=${SRCROOT}/../../bin:${SRCROOT}/../../build/lib \\\n./reaction_diffusion_2_generator -g reaction_diffusion_2_${GEN} -f reaction_diffusion_2_metal_${GEN} -n reaction_diffusion_2_metal_${GEN} -o ${DERIVED_FILE_DIR} target=${TARGET}-metal-user_context)\ndone\n"; }; /* End PBXShellScriptBuildPhase section */ diff --git a/apps/bgu/CMakeLists.txt b/apps/bgu/CMakeLists.txt index 20aace8c84d7..35851bfb1ae5 100644 --- a/apps/bgu/CMakeLists.txt +++ b/apps/bgu/CMakeLists.txt @@ -4,7 +4,7 @@ project(bgu) enable_testing() # Set up language settings -set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) diff --git a/apps/bilateral_grid/CMakeLists.txt b/apps/bilateral_grid/CMakeLists.txt index 0b0c4fda7702..f46b63d53cec 100644 --- a/apps/bilateral_grid/CMakeLists.txt +++ b/apps/bilateral_grid/CMakeLists.txt @@ -4,7 +4,7 @@ project(bilateral_grid) enable_testing() # Set up language settings -set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) diff --git a/apps/blur/CMakeLists.txt b/apps/blur/CMakeLists.txt index 953e85d22201..85b45d965179 100644 --- a/apps/blur/CMakeLists.txt +++ b/apps/blur/CMakeLists.txt @@ -4,7 +4,7 @@ project(blur) enable_testing() # Set up language settings -set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) diff --git a/apps/c_backend/CMakeLists.txt b/apps/c_backend/CMakeLists.txt index 505ac5bf5ee2..e22251802c4f 100644 --- a/apps/c_backend/CMakeLists.txt +++ b/apps/c_backend/CMakeLists.txt @@ -4,7 +4,7 @@ project(c_backend) enable_testing() # Set up language settings -set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) diff --git a/apps/camera_pipe/CMakeLists.txt b/apps/camera_pipe/CMakeLists.txt index a621e8a7e3c7..170712dfc3ba 100644 --- a/apps/camera_pipe/CMakeLists.txt +++ b/apps/camera_pipe/CMakeLists.txt @@ -4,7 +4,7 @@ project(camera_pipe) enable_testing() # Set up language settings -set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) diff --git a/apps/conv_layer/CMakeLists.txt b/apps/conv_layer/CMakeLists.txt index 9edb2bdf59c5..0d7779dd093a 100644 --- a/apps/conv_layer/CMakeLists.txt +++ b/apps/conv_layer/CMakeLists.txt @@ -4,7 +4,7 @@ project(conv_layer) enable_testing() # Set up language settings -set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) diff --git a/apps/cuda_mat_mul/CMakeLists.txt b/apps/cuda_mat_mul/CMakeLists.txt index 376a08f0103b..b54f2562eead 100644 --- a/apps/cuda_mat_mul/CMakeLists.txt +++ b/apps/cuda_mat_mul/CMakeLists.txt @@ -17,7 +17,7 @@ endif () enable_testing() # Set up language settings -set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) diff --git a/apps/depthwise_separable_conv/CMakeLists.txt b/apps/depthwise_separable_conv/CMakeLists.txt index b525a887932c..178da107f850 100644 --- a/apps/depthwise_separable_conv/CMakeLists.txt +++ b/apps/depthwise_separable_conv/CMakeLists.txt @@ -4,7 +4,7 @@ project(depthwise_separable_conv) enable_testing() # Set up language settings -set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) diff --git a/apps/fft/CMakeLists.txt b/apps/fft/CMakeLists.txt index 09711d4fe82d..5ead13485665 100644 --- a/apps/fft/CMakeLists.txt +++ b/apps/fft/CMakeLists.txt @@ -4,7 +4,7 @@ project(fft) enable_testing() # Set up language settings -set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) diff --git a/apps/fft/Makefile b/apps/fft/Makefile index 85f56aa8d7bb..99a9547125aa 100644 --- a/apps/fft/Makefile +++ b/apps/fft/Makefile @@ -67,7 +67,7 @@ $(BIN)/%/fft_inverse_c2c.a: $(GENERATOR_BIN)/fft.generator $(BIN)/%/fft_aot_test: fft_aot_test.cpp $(BIN)/%/fft_forward_r2c.a $(BIN)/%/fft_inverse_c2r.a $(BIN)/%/fft_forward_c2c.a $(BIN)/%/fft_inverse_c2c.a @mkdir -p $(@D) - $(CXX) -I$(BIN)/$* -I$(HALIDE_DISTRIB_PATH)/include/ -std=c++11 $^ -o $@ $(LDFLAGS) $(HALIDE_SYSTEM_LIBS) + $(CXX) -I$(BIN)/$* -I$(HALIDE_DISTRIB_PATH)/include/ -std=c++17 $^ -o $@ $(LDFLAGS) $(HALIDE_SYSTEM_LIBS) clean: rm -rf $(BIN) diff --git a/apps/hannk/CMakeLists.txt b/apps/hannk/CMakeLists.txt index b8547c644733..3da240d395d1 100644 --- a/apps/hannk/CMakeLists.txt +++ b/apps/hannk/CMakeLists.txt @@ -11,7 +11,7 @@ enable_testing() set(CMAKE_POSITION_INDEPENDENT_CODE ON) # Set up language settings -set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) diff --git a/apps/harris/CMakeLists.txt b/apps/harris/CMakeLists.txt index ec5dbc7c703b..fe9cee1f4a4d 100644 --- a/apps/harris/CMakeLists.txt +++ b/apps/harris/CMakeLists.txt @@ -4,7 +4,7 @@ project(harris) enable_testing() # Set up language settings -set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) diff --git a/apps/hist/CMakeLists.txt b/apps/hist/CMakeLists.txt index 7c106f70f37a..3db1953853e1 100644 --- a/apps/hist/CMakeLists.txt +++ b/apps/hist/CMakeLists.txt @@ -4,7 +4,7 @@ project(hist) enable_testing() # Set up language settings -set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) diff --git a/apps/iir_blur/CMakeLists.txt b/apps/iir_blur/CMakeLists.txt index b26169652249..d34bfba6e08c 100644 --- a/apps/iir_blur/CMakeLists.txt +++ b/apps/iir_blur/CMakeLists.txt @@ -4,7 +4,7 @@ project(iir_blur) enable_testing() # Set up language settings -set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) diff --git a/apps/interpolate/CMakeLists.txt b/apps/interpolate/CMakeLists.txt index a29dd47ee0b4..66061891af74 100644 --- a/apps/interpolate/CMakeLists.txt +++ b/apps/interpolate/CMakeLists.txt @@ -4,7 +4,7 @@ project(interpolate) enable_testing() # Set up language settings -set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) diff --git a/apps/lens_blur/CMakeLists.txt b/apps/lens_blur/CMakeLists.txt index 8b35839692dc..383356609946 100644 --- a/apps/lens_blur/CMakeLists.txt +++ b/apps/lens_blur/CMakeLists.txt @@ -4,7 +4,7 @@ project(lens_blur) enable_testing() # Set up language settings -set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) diff --git a/apps/linear_algebra/CMakeLists.txt b/apps/linear_algebra/CMakeLists.txt index 1cdcbc3be108..a9def55c6667 100644 --- a/apps/linear_algebra/CMakeLists.txt +++ b/apps/linear_algebra/CMakeLists.txt @@ -4,7 +4,7 @@ project(linear_algebra) enable_testing() # Set up language settings -set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) diff --git a/apps/local_laplacian/CMakeLists.txt b/apps/local_laplacian/CMakeLists.txt index 9df3fd3458e6..936625d760a0 100644 --- a/apps/local_laplacian/CMakeLists.txt +++ b/apps/local_laplacian/CMakeLists.txt @@ -4,7 +4,7 @@ project(local_laplacian) enable_testing() # Set up language settings -set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) diff --git a/apps/max_filter/CMakeLists.txt b/apps/max_filter/CMakeLists.txt index c4b1e9711164..712affcfcbda 100644 --- a/apps/max_filter/CMakeLists.txt +++ b/apps/max_filter/CMakeLists.txt @@ -4,7 +4,7 @@ project(max_filter) enable_testing() # Set up language settings -set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) diff --git a/apps/nl_means/CMakeLists.txt b/apps/nl_means/CMakeLists.txt index 3ebdd6256ea4..615dbd7ac62c 100644 --- a/apps/nl_means/CMakeLists.txt +++ b/apps/nl_means/CMakeLists.txt @@ -4,7 +4,7 @@ project(nl_means) enable_testing() # Set up language settings -set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) diff --git a/apps/openglcompute/Makefile b/apps/openglcompute/Makefile index 120b6ae8d290..4bda85258364 100644 --- a/apps/openglcompute/Makefile +++ b/apps/openglcompute/Makefile @@ -10,7 +10,7 @@ $(HALIDE_LIB): $(TOP) $(MAKE) -C $(TOP) test_%: test_%.cpp - $(CXX) -std=c++11 -I ../../include/ $< -L ../../bin/ -lHalide $(HALIDE_SYSTEM_LIBS) -o $@ -g + $(CXX) -std=c++17 -I ../../include/ $< -L ../../bin/ -lHalide $(HALIDE_SYSTEM_LIBS) -o $@ -g avg_filter_uint32t.o avg_filter_uint32t.h avg_filter_float.o avg_filter_float.h: test_oglc_avg LD_LIBRARY_PATH=../../bin DYLD_LIBRARY_PATH=../../bin HL_TARGET=arm-32-android-armv7s-openglcompute ./$< diff --git a/apps/openglcompute/jni/Android.mk b/apps/openglcompute/jni/Android.mk index 04f9b01918db..232e91e208cc 100644 --- a/apps/openglcompute/jni/Android.mk +++ b/apps/openglcompute/jni/Android.mk @@ -11,7 +11,7 @@ LOCAL_STATIC_LIBRARIES += libOpengl LOCAL_LDLIBS := -lm -llog -landroid -lEGL -lGLESv2 avg_filter_uint32t.o avg_filter_uint32t_arm.o avg_filter_float.o avg_filter_float_arm.o LOCAL_ARM_MODE := arm -LOCAL_CPPFLAGS += -std=c++11 -I../support -I../../include +LOCAL_CPPFLAGS += -std=c++17 -I../support -I../../include LOCAL_C_INCLUDES += ./ @@ -27,7 +27,7 @@ LOCAL_STATIC_LIBRARIES += libOpengl LOCAL_LDLIBS := -lm -llog -landroid -lEGL -lGLESv2 avg_filter_uint32t.o avg_filter_uint32t_arm.o avg_filter_float.o avg_filter_float_arm.o LOCAL_ARM_MODE := arm -LOCAL_CPPFLAGS += -std=c++11 -I../support -I../../include +LOCAL_CPPFLAGS += -std=c++17 -I../support -I../../include LOCAL_C_INCLUDES += ./ @@ -44,7 +44,7 @@ LOCAL_STATIC_LIBRARIES += libOpengl LOCAL_LDLIBS := -lm -llog -landroid -lEGL -lGLESv2 two_kernels_filter.o LOCAL_ARM_MODE := arm -LOCAL_CPPFLAGS += -std=c++11 -I../support -I../../include +LOCAL_CPPFLAGS += -std=c++17 -I../support -I../../include LOCAL_C_INCLUDES += ./ @@ -60,7 +60,7 @@ LOCAL_STATIC_LIBRARIES += libOpengl LOCAL_LDLIBS := -lm -llog -landroid -lEGL -lGLESv2 two_kernels_filter.o LOCAL_ARM_MODE := arm -LOCAL_CPPFLAGS += -std=c++11 -I../support -I../../include +LOCAL_CPPFLAGS += -std=c++17 -I../support -I../../include LOCAL_C_INCLUDES += ./ diff --git a/apps/resize/CMakeLists.txt b/apps/resize/CMakeLists.txt index 88bd05e4017c..d5e7513591a7 100644 --- a/apps/resize/CMakeLists.txt +++ b/apps/resize/CMakeLists.txt @@ -4,7 +4,7 @@ project(resize) enable_testing() # Set up language settings -set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) diff --git a/apps/stencil_chain/CMakeLists.txt b/apps/stencil_chain/CMakeLists.txt index 74b29dc721a4..335c5325bf28 100644 --- a/apps/stencil_chain/CMakeLists.txt +++ b/apps/stencil_chain/CMakeLists.txt @@ -4,7 +4,7 @@ project(stencil_chain) enable_testing() # Set up language settings -set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) diff --git a/apps/support/Makefile.inc b/apps/support/Makefile.inc index 8f647457dd9f..280cc9a0620e 100644 --- a/apps/support/Makefile.inc +++ b/apps/support/Makefile.inc @@ -54,7 +54,7 @@ GXX ?= g++ OPTIMIZE ?= -O3 CFLAGS += $(OPTIMIZE) -I $(HALIDE_DISTRIB_PATH)/include/ -I $(HALIDE_DISTRIB_PATH)/tools/ -I $(HALIDE_DISTRIB_PATH)/apps/support/ -CXXFLAGS += $(OPTIMIZE) -std=c++11 -I $(HALIDE_DISTRIB_PATH)/include/ -I $(HALIDE_DISTRIB_PATH)/tools/ $(SANITIZER_FLAGS) -Wall -Werror -Wno-unused-function -Wcast-qual -Wignored-qualifiers -Wno-comment -Wsign-compare -Wno-unknown-warning-option -Wno-psabi +CXXFLAGS += $(OPTIMIZE) -std=c++17 -I $(HALIDE_DISTRIB_PATH)/include/ -I $(HALIDE_DISTRIB_PATH)/tools/ $(SANITIZER_FLAGS) -Wall -Werror -Wno-unused-function -Wcast-qual -Wignored-qualifiers -Wno-comment -Wsign-compare -Wno-unknown-warning-option -Wno-psabi CXX_VERSION = $(shell $(CXX) --version | head -n1) ifneq (,$(findstring clang,$(CXX_VERSION))) diff --git a/apps/unsharp/CMakeLists.txt b/apps/unsharp/CMakeLists.txt index 00d5cb387483..c5d264f361fe 100644 --- a/apps/unsharp/CMakeLists.txt +++ b/apps/unsharp/CMakeLists.txt @@ -4,7 +4,7 @@ project(unsharp) enable_testing() # Set up language settings -set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) diff --git a/apps/wavelet/CMakeLists.txt b/apps/wavelet/CMakeLists.txt index 216b3f7e607e..f67f43c1917c 100644 --- a/apps/wavelet/CMakeLists.txt +++ b/apps/wavelet/CMakeLists.txt @@ -4,7 +4,7 @@ project(wavelet) enable_testing() # Set up language settings -set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_EXTENSIONS NO) diff --git a/src/autoschedulers/adams2019/autotune_loop.sh b/src/autoschedulers/adams2019/autotune_loop.sh index 3de57185aeca..d36830f71249 100755 --- a/src/autoschedulers/adams2019/autotune_loop.sh +++ b/src/autoschedulers/adams2019/autotune_loop.sh @@ -127,7 +127,7 @@ make_featurization() { # We don't need image I/O for this purpose, # so leave out libpng and libjpeg c++ \ - -std=c++11 \ + -std=c++17 \ -I ${HALIDE_DISTRIB_PATH}/include \ ${HALIDE_DISTRIB_PATH}/tools/RunGenMain.cpp \ ${D}/*.registration.cpp \ diff --git a/src/runtime/can_use_target.cpp b/src/runtime/can_use_target.cpp index e689287b3ff4..fed577e9978b 100644 --- a/src/runtime/can_use_target.cpp +++ b/src/runtime/can_use_target.cpp @@ -28,12 +28,6 @@ WEAK int halide_can_use_target_features(int count, const uint64_t *features) { return (*custom_can_use_target_features)(count, features); } -// C++11 (and thus, static_assert) aren't available here. Use this old standby: -#define fake_static_assert(VALUE) \ - do { \ - enum { __some_value = 1 / (!!(VALUE)) }; \ - } while (0) - WEAK int halide_default_can_use_target_features(int count, const uint64_t *features) { // cpu features should never change, so call once and cache. // Note that since CpuFeatures has a (trivial) ctor, compilers may insert guards @@ -44,7 +38,7 @@ WEAK int halide_default_can_use_target_features(int count, const uint64_t *featu { ScopedMutexLock lock(&halide_cpu_features_initialized_lock); - fake_static_assert(sizeof(halide_cpu_features_storage) == sizeof(CpuFeatures)); + static_assert(sizeof(halide_cpu_features_storage) == sizeof(CpuFeatures), "CpuFeatures Mismatch"); if (!halide_cpu_features_initialized) { CpuFeatures tmp = halide_get_cpu_features(); memcpy(&halide_cpu_features_storage, &tmp, sizeof(tmp)); diff --git a/src/runtime/cpu_features.h b/src/runtime/cpu_features.h index f13b64385dc0..07653b155b56 100644 --- a/src/runtime/cpu_features.h +++ b/src/runtime/cpu_features.h @@ -32,8 +32,6 @@ struct CpuFeatures { ALWAYS_INLINE CpuFeatures() { - // Can't use in-class initing of these without C++11 enabled, - // which isn't the case for all runtime builds for (int i = 0; i < kWordCount; ++i) { known[i] = 0; available[i] = 0; diff --git a/src/runtime/hexagon_remote/Makefile b/src/runtime/hexagon_remote/Makefile index 9c17bd7e6566..ead33d5b7848 100644 --- a/src/runtime/hexagon_remote/Makefile +++ b/src/runtime/hexagon_remote/Makefile @@ -153,7 +153,7 @@ $(BIN)/%/sim_remote.o: sim_remote.cpp sim_protocol.h known_symbols.h $(BIN)/src/ $(BIN)/%/sim_host.o: sim_host.cpp sim_protocol.h mkdir -p $(@D) - $(CXX-$*) -std=c++11 $(CCFLAGS-$*) -c sim_host.cpp -o $@ + $(CXX-$*) -std=c++17 $(CCFLAGS-$*) -c sim_host.cpp -o $@ $(BIN)/%/sim_qurt.o: sim_qurt.cpp mkdir -p $(@D) diff --git a/test/correctness/named_updates.cpp b/test/correctness/named_updates.cpp index d770b747ed7d..6f50ff0cd514 100644 --- a/test/correctness/named_updates.cpp +++ b/test/correctness/named_updates.cpp @@ -7,8 +7,7 @@ int main(int argc, char **argv) { // Test various possible pieces of syntax for tracking the various // definitions of a Func. Mostly we just want to make sure they - // compile. We restrict ourselves to not using C++11 for now, - // though uniform initializer syntax opens some new possibilities. + // compile. RDom r(0, 16); Func f; diff --git a/test/generator/stubuser_generator.cpp b/test/generator/stubuser_generator.cpp index a172a01cf94c..9366cdfff5a6 100644 --- a/test/generator/stubuser_generator.cpp +++ b/test/generator/stubuser_generator.cpp @@ -42,7 +42,7 @@ class StubUser : public Halide::Generator { // We'll explicitly fill in the struct fields by name, just to show // it as an option. (Alternately, we could fill it in by using - // C++11 aggregate-initialization syntax.) + // aggregate-initialization syntax.) StubTest::Inputs inputs; inputs.typed_buffer_input = constant_image; inputs.untyped_buffer_input = input; diff --git a/tools/mex_halide.m b/tools/mex_halide.m index b1dba967c5a0..4c6f342e2729 100644 --- a/tools/mex_halide.m +++ b/tools/mex_halide.m @@ -79,7 +79,7 @@ function mex_halide( generator_filename, varargin ) gen_bin = fullfile(temp, [function_name, '.generator']); build_generator = ... [halide_cxx, ... - ' -g -Wall -std=c++11 -fno-rtti -I', halide_include, ' ', ... + ' -g -Wall -std=c++17 -fno-rtti -I', halide_include, ' ', ... gengen_filename, ' ', ... generator_filename, ' ', ... libhalide, ' ', ... diff --git a/tutorial/lesson_01_basics.cpp b/tutorial/lesson_01_basics.cpp index 3202381887d1..03aeeb34056d 100644 --- a/tutorial/lesson_01_basics.cpp +++ b/tutorial/lesson_01_basics.cpp @@ -3,11 +3,11 @@ // This lesson demonstrates basic usage of Halide as a JIT compiler for imaging. // On linux, you can compile and run it like so: -// g++ lesson_01*.cpp -g -I -L -lHalide -lpthread -ldl -o lesson_01 -std=c++11 +// g++ lesson_01*.cpp -g -I -L -lHalide -lpthread -ldl -o lesson_01 -std=c++17 // LD_LIBRARY_PATH= ./lesson_01 // On os x: -// g++ lesson_01*.cpp -g -I -L -lHalide -o lesson_01 -std=c++11 +// g++ lesson_01*.cpp -g -I -L -lHalide -o lesson_01 -std=c++17 // DYLD_LIBRARY_PATH= ./lesson_01 // If you have the entire Halide source tree, you can also build it by diff --git a/tutorial/lesson_02_input_image.cpp b/tutorial/lesson_02_input_image.cpp index 5be51c587075..e1f2f3a0e7f0 100644 --- a/tutorial/lesson_02_input_image.cpp +++ b/tutorial/lesson_02_input_image.cpp @@ -4,11 +4,11 @@ // them. // On linux, you can compile and run it like so: -// g++ lesson_02*.cpp -g -I -I -L -lHalide `libpng-config --cflags --ldflags` -ljpeg -lpthread -ldl -o lesson_02 -std=c++11 +// g++ lesson_02*.cpp -g -I -I -L -lHalide `libpng-config --cflags --ldflags` -ljpeg -lpthread -ldl -o lesson_02 -std=c++17 // LD_LIBRARY_PATH= ./lesson_02 // On os x: -// g++ lesson_02*.cpp -g -I -I -L -lHalide `libpng-config --cflags --ldflags` -ljpeg -o lesson_02 -std=c++11 +// g++ lesson_02*.cpp -g -I -I -L -lHalide `libpng-config --cflags --ldflags` -ljpeg -o lesson_02 -std=c++17 // DYLD_LIBRARY_PATH= ./lesson_02 // If you have the entire Halide source tree, you can also build it by diff --git a/tutorial/lesson_03_debugging_1.cpp b/tutorial/lesson_03_debugging_1.cpp index f6675868896d..4321dc1a23dc 100644 --- a/tutorial/lesson_03_debugging_1.cpp +++ b/tutorial/lesson_03_debugging_1.cpp @@ -3,11 +3,11 @@ // This lesson demonstrates how to inspect what the Halide compiler is producing. // On linux, you can compile and run it like so: -// g++ lesson_03*.cpp -g -I -L -lHalide -lpthread -ldl -o lesson_03 -std=c++11 +// g++ lesson_03*.cpp -g -I -L -lHalide -lpthread -ldl -o lesson_03 -std=c++17 // LD_LIBRARY_PATH= ./lesson_03 // On os x: -// g++ lesson_03*.cpp -g -I -L -lHalide -o lesson_03 -std=c++11 +// g++ lesson_03*.cpp -g -I -L -lHalide -o lesson_03 -std=c++17 // DYLD_LIBRARY_PATH= ./lesson_03 // If you have the entire Halide source tree, you can also build it by diff --git a/tutorial/lesson_04_debugging_2.cpp b/tutorial/lesson_04_debugging_2.cpp index 1ae77b41d93b..4c36e6cbd5de 100644 --- a/tutorial/lesson_04_debugging_2.cpp +++ b/tutorial/lesson_04_debugging_2.cpp @@ -3,11 +3,11 @@ // This lesson demonstrates how to follow what Halide is doing at runtime. // On linux, you can compile and run it like so: -// g++ lesson_04*.cpp -g -I -L -lHalide -lpthread -ldl -o lesson_04 -std=c++11 +// g++ lesson_04*.cpp -g -I -L -lHalide -lpthread -ldl -o lesson_04 -std=c++17 // LD_LIBRARY_PATH= ./lesson_04 // On os x: -// g++ lesson_04*.cpp -g -I -L -lHalide -o lesson_04 -std=c++11 +// g++ lesson_04*.cpp -g -I -L -lHalide -o lesson_04 -std=c++17 // DYLD_LIBRARY_PATH= ./lesson_04 // If you have the entire Halide source tree, you can also build it by diff --git a/tutorial/lesson_05_scheduling_1.cpp b/tutorial/lesson_05_scheduling_1.cpp index 9325aa7f61dc..d2942e97626b 100644 --- a/tutorial/lesson_05_scheduling_1.cpp +++ b/tutorial/lesson_05_scheduling_1.cpp @@ -5,11 +5,11 @@ // parallelization, unrolling, and tiling. // On linux, you can compile and run it like so: -// g++ lesson_05*.cpp -g -I -L -lHalide -lpthread -ldl -o lesson_05 -std=c++11 +// g++ lesson_05*.cpp -g -I -L -lHalide -lpthread -ldl -o lesson_05 -std=c++17 // LD_LIBRARY_PATH= ./lesson_05 // On os x: -// g++ lesson_05*.cpp -g -I -L -lHalide -o lesson_05 -std=c++11 +// g++ lesson_05*.cpp -g -I -L -lHalide -o lesson_05 -std=c++17 // DYLD_LIBRARY_PATH= ./lesson_05 // If you have the entire Halide source tree, you can also build it by diff --git a/tutorial/lesson_06_realizing_over_shifted_domains.cpp b/tutorial/lesson_06_realizing_over_shifted_domains.cpp index 72a36cbc94a2..4ca32db50370 100644 --- a/tutorial/lesson_06_realizing_over_shifted_domains.cpp +++ b/tutorial/lesson_06_realizing_over_shifted_domains.cpp @@ -4,11 +4,11 @@ // does not start at (0, 0). // On linux, you can compile and run it like so: -// g++ lesson_06*.cpp -g -I -L -lHalide -lpthread -ldl -o lesson_06 -std=c++11 +// g++ lesson_06*.cpp -g -I -L -lHalide -lpthread -ldl -o lesson_06 -std=c++17 // LD_LIBRARY_PATH= ./lesson_06 // On os x: -// g++ lesson_06*.cpp -g -I -L -lHalide -o lesson_06 -std=c++11 +// g++ lesson_06*.cpp -g -I -L -lHalide -o lesson_06 -std=c++17 // DYLD_LIBRARY_PATH= ./lesson_06 // If you have the entire Halide source tree, you can also build it by diff --git a/tutorial/lesson_07_multi_stage_pipelines.cpp b/tutorial/lesson_07_multi_stage_pipelines.cpp index 1570a3cb1484..4886ff0905e2 100644 --- a/tutorial/lesson_07_multi_stage_pipelines.cpp +++ b/tutorial/lesson_07_multi_stage_pipelines.cpp @@ -1,11 +1,11 @@ // Halide tutorial lesson 7: Multi-stage pipelines // On linux, you can compile and run it like so: -// g++ lesson_07*.cpp -g -std=c++11 -I -I -L -lHalide `libpng-config --cflags --ldflags` -ljpeg -lpthread -ldl -o lesson_07 +// g++ lesson_07*.cpp -g -std=c++17 -I -I -L -lHalide `libpng-config --cflags --ldflags` -ljpeg -lpthread -ldl -o lesson_07 // LD_LIBRARY_PATH= ./lesson_07 // On os x: -// g++ lesson_07*.cpp -g -std=c++11 -I -I -L -lHalide `libpng-config --cflags --ldflags` -ljpeg -o lesson_07 +// g++ lesson_07*.cpp -g -std=c++17 -I -I -L -lHalide `libpng-config --cflags --ldflags` -ljpeg -o lesson_07 // DYLD_LIBRARY_PATH= ./lesson_07 // If you have the entire Halide source tree, you can also build it by diff --git a/tutorial/lesson_08_scheduling_2.cpp b/tutorial/lesson_08_scheduling_2.cpp index dfc5fe951611..45a13e6c31ea 100644 --- a/tutorial/lesson_08_scheduling_2.cpp +++ b/tutorial/lesson_08_scheduling_2.cpp @@ -1,11 +1,11 @@ // Halide tutorial lesson 8: Scheduling multi-stage pipelines // On linux, you can compile and run it like so: -// g++ lesson_08*.cpp -g -std=c++11 -I -L -lHalide -lpthread -ldl -o lesson_08 +// g++ lesson_08*.cpp -g -std=c++17 -I -L -lHalide -lpthread -ldl -o lesson_08 // LD_LIBRARY_PATH= ./lesson_08 // On os x: -// g++ lesson_08*.cpp -g -std=c++11 -I -L -lHalide -o lesson_08 +// g++ lesson_08*.cpp -g -std=c++17 -I -L -lHalide -o lesson_08 // DYLD_LIBRARY_PATH= ./lesson_08 // If you have the entire Halide source tree, you can also build it by diff --git a/tutorial/lesson_09_update_definitions.cpp b/tutorial/lesson_09_update_definitions.cpp index febf37292f69..e72d568962a7 100644 --- a/tutorial/lesson_09_update_definitions.cpp +++ b/tutorial/lesson_09_update_definitions.cpp @@ -1,11 +1,11 @@ // Halide tutorial lesson 9: Multi-pass Funcs, update definitions, and reductions // On linux, you can compile and run it like so: -// g++ lesson_09*.cpp -g -std=c++11 -I -I -L -lHalide `libpng-config --cflags --ldflags` -ljpeg -lpthread -ldl -fopenmp -o lesson_09 +// g++ lesson_09*.cpp -g -std=c++17 -I -I -L -lHalide `libpng-config --cflags --ldflags` -ljpeg -lpthread -ldl -fopenmp -o lesson_09 // LD_LIBRARY_PATH= ./lesson_09 // On os x (will only work if you actually have g++, not Apple's pretend g++ which is actually clang): -// g++ lesson_09*.cpp -g -std=c++11 -I -I -L -lHalide `libpng-config --cflags --ldflags` -ljpeg -fopenmp -o lesson_09 +// g++ lesson_09*.cpp -g -std=c++17 -I -I -L -lHalide `libpng-config --cflags --ldflags` -ljpeg -fopenmp -o lesson_09 // DYLD_LIBRARY_PATH= ./lesson_09 // If you have the entire Halide source tree, you can also build it by diff --git a/tutorial/lesson_10_aot_compilation_generate.cpp b/tutorial/lesson_10_aot_compilation_generate.cpp index 989dff124bfa..a30032f10b9d 100644 --- a/tutorial/lesson_10_aot_compilation_generate.cpp +++ b/tutorial/lesson_10_aot_compilation_generate.cpp @@ -10,13 +10,13 @@ // compiling this code is a multi-step process. // On linux, you can compile and run it like so: -// g++ lesson_10*generate.cpp -g -std=c++11 -I -L -lHalide -lpthread -ldl -o lesson_10_generate +// g++ lesson_10*generate.cpp -g -std=c++17 -I -L -lHalide -lpthread -ldl -o lesson_10_generate // LD_LIBRARY_PATH= ./lesson_10_generate -// g++ lesson_10*run.cpp lesson_10_halide.a -std=c++11 -I -lpthread -ldl -o lesson_10_run +// g++ lesson_10*run.cpp lesson_10_halide.a -std=c++17 -I -lpthread -ldl -o lesson_10_run // ./lesson_10_run // On os x: -// g++ lesson_10*generate.cpp -g -std=c++11 -I -L -lHalide -o lesson_10_generate +// g++ lesson_10*generate.cpp -g -std=c++17 -I -L -lHalide -o lesson_10_generate // DYLD_LIBRARY_PATH= ./lesson_10_generate // g++ lesson_10*run.cpp lesson_10_halide.a -o lesson_10_run -I // ./lesson_10_run diff --git a/tutorial/lesson_11_cross_compilation.cpp b/tutorial/lesson_11_cross_compilation.cpp index 617dbeb5a210..63652f7078fc 100644 --- a/tutorial/lesson_11_cross_compilation.cpp +++ b/tutorial/lesson_11_cross_compilation.cpp @@ -4,11 +4,11 @@ // generate code for any platform from any platform. // On linux, you can compile and run it like so: -// g++ lesson_11*.cpp -g -std=c++11 -I -L -lHalide -lpthread -ldl -o lesson_11 +// g++ lesson_11*.cpp -g -std=c++17 -I -L -lHalide -lpthread -ldl -o lesson_11 // LD_LIBRARY_PATH= ./lesson_11 // On os x: -// g++ lesson_11*.cpp -g -std=c++11 -I -L -lHalide -o lesson_11 +// g++ lesson_11*.cpp -g -std=c++17 -I -L -lHalide -o lesson_11 // DYLD_LIBRARY_PATH= ./lesson_11 // If you have the entire Halide source tree, you can also build it by diff --git a/tutorial/lesson_12_using_the_gpu.cpp b/tutorial/lesson_12_using_the_gpu.cpp index c4574a34bbfe..8280690fa8a1 100644 --- a/tutorial/lesson_12_using_the_gpu.cpp +++ b/tutorial/lesson_12_using_the_gpu.cpp @@ -3,11 +3,11 @@ // This lesson demonstrates how to use Halide to run code on a GPU using OpenCL. // On linux, you can compile and run it like so: -// g++ lesson_12*.cpp -g -std=c++11 -I -I -L -lHalide `libpng-config --cflags --ldflags` -ljpeg -lpthread -ldl -o lesson_12 +// g++ lesson_12*.cpp -g -std=c++17 -I -I -L -lHalide `libpng-config --cflags --ldflags` -ljpeg -lpthread -ldl -o lesson_12 // LD_LIBRARY_PATH= ./lesson_12 // On os x: -// g++ lesson_12*.cpp -g -std=c++11 -I -I -L -lHalide `libpng-config --cflags --ldflags` -ljpeg -o lesson_12 +// g++ lesson_12*.cpp -g -std=c++17 -I -I -L -lHalide `libpng-config --cflags --ldflags` -ljpeg -o lesson_12 // DYLD_LIBRARY_PATH= ./lesson_12 // If you have the entire Halide source tree, you can also build it by diff --git a/tutorial/lesson_13_tuples.cpp b/tutorial/lesson_13_tuples.cpp index eeae77a238ae..a13842ce67bd 100644 --- a/tutorial/lesson_13_tuples.cpp +++ b/tutorial/lesson_13_tuples.cpp @@ -4,11 +4,11 @@ // values. // On linux, you can compile and run it like so: -// g++ lesson_13*.cpp -g -I -L -lHalide -lpthread -ldl -o lesson_13 -std=c++11 +// g++ lesson_13*.cpp -g -I -L -lHalide -lpthread -ldl -o lesson_13 -std=c++17 // LD_LIBRARY_PATH= ./lesson_13 // On os x: -// g++ lesson_13*.cpp -g -I -L -lHalide -o lesson_13 -std=c++11 +// g++ lesson_13*.cpp -g -I -L -lHalide -o lesson_13 -std=c++17 // DYLD_LIBRARY_PATH= ./lesson_13 // If you have the entire Halide source tree, you can also build it by @@ -121,7 +121,7 @@ int main(int argc, char **argv) { // You can construct a Tuple by passing multiple Exprs to the // Tuple constructor as we did above. Perhaps more elegantly, you - // can also take advantage of C++11 initializer lists and just + // can also take advantage of initializer lists and just // enclose your Exprs in braces: Func multi_valued_2; multi_valued_2(x, y) = {x + y, sin(x * y)}; diff --git a/tutorial/lesson_14_types.cpp b/tutorial/lesson_14_types.cpp index 8a370c1084f2..b43d13bf5e9d 100644 --- a/tutorial/lesson_14_types.cpp +++ b/tutorial/lesson_14_types.cpp @@ -3,11 +3,11 @@ // This lesson more precisely describes Halide's type system. // On linux, you can compile and run it like so: -// g++ lesson_14*.cpp -g -I -L -lHalide -lpthread -ldl -o lesson_14 -std=c++11 +// g++ lesson_14*.cpp -g -I -L -lHalide -lpthread -ldl -o lesson_14 -std=c++17 // LD_LIBRARY_PATH= ./lesson_14 // On os x: -// g++ lesson_14*.cpp -g -I -L -lHalide -o lesson_14 -std=c++11 +// g++ lesson_14*.cpp -g -I -L -lHalide -o lesson_14 -std=c++17 // DYLD_LIBRARY_PATH= ./lesson_14 // If you have the entire Halide source tree, you can also build it by diff --git a/tutorial/lesson_15_generators.cpp b/tutorial/lesson_15_generators.cpp index 2f194248f79d..831e7924d464 100644 --- a/tutorial/lesson_15_generators.cpp +++ b/tutorial/lesson_15_generators.cpp @@ -4,11 +4,11 @@ // reusable components called generators. // On linux, you can compile and run it like so: -// g++ lesson_15*.cpp /GenGen.cpp -g -std=c++11 -fno-rtti -I -L -lHalide -lpthread -ldl -o lesson_15_generate +// g++ lesson_15*.cpp /GenGen.cpp -g -std=c++17 -fno-rtti -I -L -lHalide -lpthread -ldl -o lesson_15_generate // bash lesson_15_generators_usage.sh // On os x: -// g++ lesson_15*.cpp /GenGen.cpp -g -std=c++11 -fno-rtti -I -L -lHalide -o lesson_15_generate +// g++ lesson_15*.cpp /GenGen.cpp -g -std=c++17 -fno-rtti -I -L -lHalide -o lesson_15_generate // bash lesson_15_generators_usage.sh // If you have the entire Halide source tree, you can also build it by diff --git a/tutorial/lesson_16_rgb_generate.cpp b/tutorial/lesson_16_rgb_generate.cpp index 5b57548994f3..3621a6f9f2ef 100644 --- a/tutorial/lesson_16_rgb_generate.cpp +++ b/tutorial/lesson_16_rgb_generate.cpp @@ -6,7 +6,7 @@ // On linux or os x, you can compile and run it like so: -// g++ lesson_16_rgb_generate.cpp /GenGen.cpp -g -std=c++11 -fno-rtti -I -L -lHalide -lpthread -ldl -o lesson_16_generate +// g++ lesson_16_rgb_generate.cpp /GenGen.cpp -g -std=c++17 -fno-rtti -I -L -lHalide -lpthread -ldl -o lesson_16_generate // export LD_LIBRARY_PATH= # For linux // export DYLD_LIBRARY_PATH= # For OS X // ./lesson_16_generate -g brighten -o . -f brighten_planar target=host layout=planar diff --git a/tutorial/lesson_17_predicated_rdom.cpp b/tutorial/lesson_17_predicated_rdom.cpp index 974269dd8922..77c43bdb55c2 100644 --- a/tutorial/lesson_17_predicated_rdom.cpp +++ b/tutorial/lesson_17_predicated_rdom.cpp @@ -4,11 +4,11 @@ // subsets of a reduction domain using predicates. // On linux, you can compile and run it like so: -// g++ lesson_17*.cpp -g -I -L -lHalide -lpthread -ldl -o lesson_17 -std=c++11 +// g++ lesson_17*.cpp -g -I -L -lHalide -lpthread -ldl -o lesson_17 -std=c++17 // LD_LIBRARY_PATH= ./lesson_17 // On os x: -// g++ lesson_17*.cpp -g -I -L -lHalide -o lesson_17 -std=c++11 +// g++ lesson_17*.cpp -g -I -L -lHalide -o lesson_17 -std=c++17 // DYLD_LIBRARY_PATH= ./lesson_17 // If you have the entire Halide source tree, you can also build it by diff --git a/tutorial/lesson_18_parallel_associative_reductions.cpp b/tutorial/lesson_18_parallel_associative_reductions.cpp index 6a4d33d0f9b9..4d53e6c4f49f 100644 --- a/tutorial/lesson_18_parallel_associative_reductions.cpp +++ b/tutorial/lesson_18_parallel_associative_reductions.cpp @@ -4,11 +4,11 @@ // reduction using the scheduling directive 'rfactor'. // On linux, you can compile and run it like so: -// g++ lesson_18*.cpp -g -I -L -lHalide -lpthread -ldl -o lesson_18 -std=c++11 +// g++ lesson_18*.cpp -g -I -L -lHalide -lpthread -ldl -o lesson_18 -std=c++17 // LD_LIBRARY_PATH= ./lesson_18 // On os x: -// g++ lesson_18*.cpp -g -I -L -lHalide -o lesson_18 -std=c++11 +// g++ lesson_18*.cpp -g -I -L -lHalide -o lesson_18 -std=c++17 // DYLD_LIBRARY_PATH= ./lesson_18 // If you have the entire Halide source tree, you can also build it by diff --git a/tutorial/lesson_19_wrapper_funcs.cpp b/tutorial/lesson_19_wrapper_funcs.cpp index 5903e8ee4d14..99897037b52b 100644 --- a/tutorial/lesson_19_wrapper_funcs.cpp +++ b/tutorial/lesson_19_wrapper_funcs.cpp @@ -5,11 +5,11 @@ // from a Func or an ImageParam. // On linux, you can compile and run it like so: -// g++ lesson_19*.cpp -g -I -L -lHalide -lpthread -ldl -o lesson_19 -std=c++11 +// g++ lesson_19*.cpp -g -I -L -lHalide -lpthread -ldl -o lesson_19 -std=c++17 // LD_LIBRARY_PATH= ./lesson_19 // On os x: -// g++ lesson_19*.cpp -g -I -L -lHalide -o lesson_19 -std=c++11 +// g++ lesson_19*.cpp -g -I -L -lHalide -o lesson_19 -std=c++17 // DYLD_LIBRARY_PATH= ./lesson_19 // If you have the entire Halide source tree, you can also build it by diff --git a/tutorial/lesson_20_cloning_funcs.cpp b/tutorial/lesson_20_cloning_funcs.cpp index fa0395dea3a3..42fca386d203 100644 --- a/tutorial/lesson_20_cloning_funcs.cpp +++ b/tutorial/lesson_20_cloning_funcs.cpp @@ -4,11 +4,11 @@ // a Func. // On linux, you can compile and run it like so: -// g++ lesson_20*.cpp -g -I -L -lHalide -lpthread -ldl -o lesson_20 -std=c++11 +// g++ lesson_20*.cpp -g -I -L -lHalide -lpthread -ldl -o lesson_20 -std=c++17 // LD_LIBRARY_PATH= ./lesson_20 // On os x: -// g++ lesson_20*.cpp -g -I -L -lHalide -o lesson_20 -std=c++11 +// g++ lesson_20*.cpp -g -I -L -lHalide -o lesson_20 -std=c++17 // DYLD_LIBRARY_PATH= ./lesson_20 // If you have the entire Halide source tree, you can also build it by diff --git a/tutorial/lesson_21_auto_scheduler_generate.cpp b/tutorial/lesson_21_auto_scheduler_generate.cpp index 7acd0f4fe35e..14803799c7b4 100644 --- a/tutorial/lesson_21_auto_scheduler_generate.cpp +++ b/tutorial/lesson_21_auto_scheduler_generate.cpp @@ -7,12 +7,12 @@ // On linux or os x, you can compile and run it like so: -// g++ lesson_21_auto_scheduler_generate.cpp /GenGen.cpp -g -std=c++11 -fno-rtti -I -L -lHalide -lpthread -ldl -o lesson_21_generate +// g++ lesson_21_auto_scheduler_generate.cpp /GenGen.cpp -g -std=c++17 -fno-rtti -I -L -lHalide -lpthread -ldl -o lesson_21_generate // export LD_LIBRARY_PATH= # For linux // export DYLD_LIBRARY_PATH= # For OS X // ./lesson_21_generate -o . -g auto_schedule_gen -f auto_schedule_false -e static_library,h,schedule target=host auto_schedule=false // ./lesson_21_generate -o . -g auto_schedule_gen -f auto_schedule_true -e static_library,h,schedule -p -S Mullapudi2016 target=host auto_schedule=true machine_params=32,16777216,40 -// g++ lesson_21_auto_scheduler_run.cpp -std=c++11 -I -I auto_schedule_false.a auto_schedule_true.a -ldl -lpthread -o lesson_21_run +// g++ lesson_21_auto_scheduler_run.cpp -std=c++17 -I -I auto_schedule_false.a auto_schedule_true.a -ldl -lpthread -o lesson_21_run // ./lesson_21_run // If you have the entire Halide source tree, you can also build it by From 1eb8b18caa51ebdd7dbe63602907ae4323bbd175 Mon Sep 17 00:00:00 2001 From: Steven Johnson Date: Thu, 3 Jun 2021 10:21:58 -0700 Subject: [PATCH 45/53] Add user-facing C++ version check --- src/Generator.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Generator.h b/src/Generator.h index 8be307212ef4..27d65f4c052c 100644 --- a/src/Generator.h +++ b/src/Generator.h @@ -278,6 +278,10 @@ #include "ObjectInstanceRegistry.h" #include "Target.h" +#if !(__cplusplus >= 201703L || _MSVC_LANG >= 201703L) +#error "Halide requires C++17 or later; please upgrade your compiler." +#endif + namespace Halide { template From 4b5091f73e5fdd0af6168b3a8c68913a134503a0 Mon Sep 17 00:00:00 2001 From: Steven Johnson Date: Fri, 4 Jun 2021 10:53:46 -0700 Subject: [PATCH 46/53] Force tflite to build in C++17 mode. --- apps/hannk/tflite/CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/apps/hannk/tflite/CMakeLists.txt b/apps/hannk/tflite/CMakeLists.txt index d56d5db37f34..84c0c75227d2 100644 --- a/apps/hannk/tflite/CMakeLists.txt +++ b/apps/hannk/tflite/CMakeLists.txt @@ -59,6 +59,10 @@ target_compile_options(tensorflow-lite $<$:-Wno-gnu-inline-cpp-without-extern> $<$:-Wno-ignored-attributes>) +# TFLite 2.5 specifies set(CMAKE_CXX_STANDARD 11), which can cause link errors in gcc-7.x; +# override CXX_STANDARD for it to ensure we compile everything the same way. +set_property(TARGET tflite PROPERTY CXX_STANDARD 17) + # Make an interface library that is just to get the tflite headers, # without any implied linkage add_library(tensorflowlite_headers INTERFACE) From f0d717a656e7df03d97cafeaccc97afd71fc92ff Mon Sep 17 00:00:00 2001 From: Steven Johnson Date: Fri, 4 Jun 2021 11:06:10 -0700 Subject: [PATCH 47/53] Oops --- apps/hannk/tflite/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/hannk/tflite/CMakeLists.txt b/apps/hannk/tflite/CMakeLists.txt index 84c0c75227d2..ad1d70700a72 100644 --- a/apps/hannk/tflite/CMakeLists.txt +++ b/apps/hannk/tflite/CMakeLists.txt @@ -61,7 +61,7 @@ target_compile_options(tensorflow-lite # TFLite 2.5 specifies set(CMAKE_CXX_STANDARD 11), which can cause link errors in gcc-7.x; # override CXX_STANDARD for it to ensure we compile everything the same way. -set_property(TARGET tflite PROPERTY CXX_STANDARD 17) +set_property(TARGET tensorflowlite_c PROPERTY CXX_STANDARD 17) # Make an interface library that is just to get the tflite headers, # without any implied linkage From 354eff32596f0a9925ec0feb45eb5211901a2f3e Mon Sep 17 00:00:00 2001 From: Steven Johnson Date: Fri, 4 Jun 2021 15:06:44 -0700 Subject: [PATCH 48/53] Experimental fix for hannk --- apps/hannk/delegate/CMakeLists.txt | 18 ++++++++++++++---- apps/hannk/tflite/CMakeLists.txt | 2 +- apps/hannk/util/CMakeLists.txt | 2 +- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/apps/hannk/delegate/CMakeLists.txt b/apps/hannk/delegate/CMakeLists.txt index 24e8a30dc57f..ae2786c07119 100644 --- a/apps/hannk/delegate/CMakeLists.txt +++ b/apps/hannk/delegate/CMakeLists.txt @@ -1,11 +1,21 @@ # --------------- registrar (static-library) delegate -add_library(hannk_delegate_registrar STATIC - hannk_delegate_provider.cpp +add_library(hannk_delegate STATIC hannk_delegate.cpp) +target_link_libraries(hannk_delegate PRIVATE + tensorflowlite_headers + Halide::Runtime) +target_include_directories(hannk_delegate PRIVATE + $) + +# --------------- registrar (static-library) delegate + +add_library(hannk_delegate_registrar STATIC + hannk_delegate_provider.cpp) target_link_libraries(hannk_delegate_registrar PRIVATE interpreter error_util + hannk_delegate hannk_log_tflite tensorflowlite_headers Halide::Runtime) @@ -19,11 +29,11 @@ target_include_directories(hannk_delegate_registrar PRIVATE # on Mac we must declare the library to be MODULE rather than SHARED to get this. # Apparently on Linux they are basically the same, so, use it everywhere for now. add_library(hannk_delegate_external MODULE - hannk_delegate_adaptor.cpp - hannk_delegate.cpp) + hannk_delegate_adaptor.cpp) target_link_libraries(hannk_delegate_external PRIVATE interpreter error_util + hannk_delegate hannk_log_tflite tensorflowlite_headers Halide::Runtime) diff --git a/apps/hannk/tflite/CMakeLists.txt b/apps/hannk/tflite/CMakeLists.txt index ad1d70700a72..e8e2a8d4d369 100644 --- a/apps/hannk/tflite/CMakeLists.txt +++ b/apps/hannk/tflite/CMakeLists.txt @@ -61,7 +61,7 @@ target_compile_options(tensorflow-lite # TFLite 2.5 specifies set(CMAKE_CXX_STANDARD 11), which can cause link errors in gcc-7.x; # override CXX_STANDARD for it to ensure we compile everything the same way. -set_property(TARGET tensorflowlite_c PROPERTY CXX_STANDARD 17) +# set_property(TARGET tensorflowlite_c PROPERTY CXX_STANDARD 17) # Make an interface library that is just to get the tflite headers, # without any implied linkage diff --git a/apps/hannk/util/CMakeLists.txt b/apps/hannk/util/CMakeLists.txt index da79bd0a5a05..d46a24b4116a 100644 --- a/apps/hannk/util/CMakeLists.txt +++ b/apps/hannk/util/CMakeLists.txt @@ -41,7 +41,7 @@ target_link_libraries(model_runner PRIVATE interpreter error_util file_util - hannk_delegate_registrar + hannk_delegate tflite_parser Halide::Tools # for halide_benchmark.h Halide::Runtime From ff1e67c3b0e3cb1c9c35099543f1b9519725d869 Mon Sep 17 00:00:00 2001 From: Steven Johnson Date: Fri, 4 Jun 2021 15:14:37 -0700 Subject: [PATCH 49/53] More fix attempts --- apps/hannk/delegate/CMakeLists.txt | 1 + apps/hannk/interpreter/CMakeLists.txt | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/apps/hannk/delegate/CMakeLists.txt b/apps/hannk/delegate/CMakeLists.txt index ae2786c07119..0a18b32aa6d1 100644 --- a/apps/hannk/delegate/CMakeLists.txt +++ b/apps/hannk/delegate/CMakeLists.txt @@ -3,6 +3,7 @@ add_library(hannk_delegate STATIC hannk_delegate.cpp) target_link_libraries(hannk_delegate PRIVATE + interpreter_lower tensorflowlite_headers Halide::Runtime) target_include_directories(hannk_delegate PRIVATE diff --git a/apps/hannk/interpreter/CMakeLists.txt b/apps/hannk/interpreter/CMakeLists.txt index 3139a7826535..b9e659136a98 100644 --- a/apps/hannk/interpreter/CMakeLists.txt +++ b/apps/hannk/interpreter/CMakeLists.txt @@ -4,13 +4,17 @@ add_library(elementwise_program STATIC target_include_directories(elementwise_program PUBLIC $) target_link_libraries(elementwise_program PRIVATE Halide::Runtime) +add_library(interpreter_lower STATIC + lower.cpp) +target_include_directories(interpreter_lower PUBLIC $) +target_link_libraries(interpreter_lower PRIVATE Halide::Runtime) + add_library(interpreter STATIC interpreter.cpp interval.cpp - lower.cpp model.cpp ops.cpp transforms.cpp) target_include_directories(interpreter PUBLIC $) -target_link_libraries(interpreter PRIVATE elementwise_program op_impls Halide::Runtime) +target_link_libraries(interpreter PRIVATE elementwise_program op_impls interpreter_lower Halide::Runtime) From c8fd4016549a166eee3339cc61f7fecb08c061fa Mon Sep 17 00:00:00 2001 From: Steven Johnson Date: Fri, 4 Jun 2021 15:16:22 -0700 Subject: [PATCH 50/53] Still more --- apps/hannk/delegate/CMakeLists.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/hannk/delegate/CMakeLists.txt b/apps/hannk/delegate/CMakeLists.txt index 0a18b32aa6d1..e53f022bf426 100644 --- a/apps/hannk/delegate/CMakeLists.txt +++ b/apps/hannk/delegate/CMakeLists.txt @@ -3,6 +3,7 @@ add_library(hannk_delegate STATIC hannk_delegate.cpp) target_link_libraries(hannk_delegate PRIVATE + hannk_log_tflite interpreter_lower tensorflowlite_headers Halide::Runtime) @@ -14,8 +15,8 @@ target_include_directories(hannk_delegate PRIVATE add_library(hannk_delegate_registrar STATIC hannk_delegate_provider.cpp) target_link_libraries(hannk_delegate_registrar PRIVATE - interpreter error_util + interpreter hannk_delegate hannk_log_tflite tensorflowlite_headers @@ -32,8 +33,8 @@ target_include_directories(hannk_delegate_registrar PRIVATE add_library(hannk_delegate_external MODULE hannk_delegate_adaptor.cpp) target_link_libraries(hannk_delegate_external PRIVATE - interpreter error_util + interpreter hannk_delegate hannk_log_tflite tensorflowlite_headers From abce80a54673f6590c109bfed1b3270c4cecc4ad Mon Sep 17 00:00:00 2001 From: Steven Johnson Date: Fri, 4 Jun 2021 15:17:05 -0700 Subject: [PATCH 51/53] Update CMakeLists.txt --- apps/hannk/tflite/CMakeLists.txt | 4 ---- 1 file changed, 4 deletions(-) diff --git a/apps/hannk/tflite/CMakeLists.txt b/apps/hannk/tflite/CMakeLists.txt index e8e2a8d4d369..d56d5db37f34 100644 --- a/apps/hannk/tflite/CMakeLists.txt +++ b/apps/hannk/tflite/CMakeLists.txt @@ -59,10 +59,6 @@ target_compile_options(tensorflow-lite $<$:-Wno-gnu-inline-cpp-without-extern> $<$:-Wno-ignored-attributes>) -# TFLite 2.5 specifies set(CMAKE_CXX_STANDARD 11), which can cause link errors in gcc-7.x; -# override CXX_STANDARD for it to ensure we compile everything the same way. -# set_property(TARGET tensorflowlite_c PROPERTY CXX_STANDARD 17) - # Make an interface library that is just to get the tflite headers, # without any implied linkage add_library(tensorflowlite_headers INTERFACE) From f1a84b855f8fbed95f84b8807242c9cc5170ef13 Mon Sep 17 00:00:00 2001 From: Steven Johnson Date: Mon, 7 Jun 2021 12:36:38 -0700 Subject: [PATCH 52/53] Update README_cmake.md --- README_cmake.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README_cmake.md b/README_cmake.md index 1dd05453ee8a..44321860667d 100644 --- a/README_cmake.md +++ b/README_cmake.md @@ -558,7 +558,7 @@ immediately after setting the minimum version. The next three variables set the project-wide C++ standard. The first, [`CMAKE_CXX_STANDARD`][cmake_cxx_standard], simply sets the standard version. -Halide requires at least c++17. The second, +Halide requires at least C++17. The second, [`CMAKE_CXX_STANDARD_REQUIRED`][cmake_cxx_standard_required], tells CMake to fail if the compiler cannot provide the requested standard version. Lastly, [`CMAKE_CXX_EXTENSIONS`][cmake_cxx_extensions] tells CMake to disable From 64d1cda6de4797a5e52d19ecdf52b697c736797b Mon Sep 17 00:00:00 2001 From: Steven Johnson Date: Mon, 7 Jun 2021 12:39:10 -0700 Subject: [PATCH 53/53] Revert unrelated change --- test/correctness/interpreter.cpp | 27 ++++++--------------------- 1 file changed, 6 insertions(+), 21 deletions(-) diff --git a/test/correctness/interpreter.cpp b/test/correctness/interpreter.cpp index fdd82d3976e8..d230616b87e0 100644 --- a/test/correctness/interpreter.cpp +++ b/test/correctness/interpreter.cpp @@ -136,7 +136,6 @@ int main(int argc, char **argv) { Buffer out_buf(W, H); - int result = 0; { // (in(x + 1, y) - in(x - 1, y)) / 2; int program_src[3][4] = {{Sub, 5, 3, 0}, @@ -152,15 +151,10 @@ int main(int argc, char **argv) { for (int y = 0; y < H; y++) { for (int x = 0; x < W; x++) { - int a = in_buf(x + 1, y); - int b = in_buf(x - 1, y); - int r0 = (a - b); - int r1 = r0 >> 1; - int r2 = (uint8_t)r1; uint8_t correct = (uint8_t)(((int)in_buf(x + 1, y) - in_buf(x - 1, y)) >> 1); if (out_buf(x, y) != correct) { - printf("out_buf1(%d, %d) = %d instead of %d (%d %d %d)\n", x, y, out_buf(x, y), correct, r0, r1, r2); - result = -1; + printf("out_buf(%d, %d) = %d instead of %d\n", x, y, out_buf(x, y), correct); + return -1; } } } @@ -186,23 +180,14 @@ int main(int argc, char **argv) { for (int x = 0; x < W; x++) { int a = in_buf(x - 1, y - 1); int b = in_buf(x + 1, y + 1); - int r0 = a * a + b * b; - float r1 = std::sqrt(r0); - float r2 = std::floor(r1); - int r3 = (int)r2; - int r4 = (uint8_t)r3; uint8_t correct = (uint8_t)((int)std::floor(std::sqrt(a * a + b * b))); if (out_buf(x, y) != correct) { - printf("out_buf2(%d, %d) = %d instead of %d (%d %d %d %f %f %d %d\n", x, y, out_buf(x, y), correct, - a, b, r0, r1, r2, r3, r4); - result = -1; + printf("out_buf(%d, %d) = %d instead of %d\n", x, y, out_buf(x, y), correct); + return -1; } } } } - - if (!result) { - printf("Success!\n"); - } - return result; + printf("Success!\n"); + return 0; }