diff --git a/CMakeLists.txt b/CMakeLists.txt index 7d05f24..9adeba8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,7 +28,7 @@ set(SOURCES add_executable(blur_generator src/blur_gen.cpp) target_link_libraries(blur_generator PRIVATE Halide::Generator) -add_halide_library(blur FROM blur_generator GENERATOR blur_generator) +add_halide_library(blur FROM blur_generator GENERATOR blur_generator TARGETS cmake AUTOSCHEDULER Halide::Adams2019 SCHEDULE blur.schedule STMT_HTML blur_schedule.html) add_library(${CMAKE_PROJECT_NAME} MODULE ${SOURCES}) @@ -97,6 +97,13 @@ if(WIN32) "${RELEASE_DIR}/obs-plugins/${ARCH_NAME}" ) + # package the DirectML runtime DLL + COMMAND if $,$>==1 ( + "${CMAKE_COMMAND}" -E copy + "${PROJECT_SOURCE_DIR}/deps/directml/bin/x64-win/DirectML.dll" + "${RELEASE_DIR}/obs-plugins/${ARCH_NAME}" + ) + # If config is RelWithDebInfo, copy the pdb file COMMAND if $==1 ( "${CMAKE_COMMAND}" -E copy diff --git a/scripts/build_win.bat b/scripts/build_win.bat index 3bddaa1..210c389 100644 --- a/scripts/build_win.bat +++ b/scripts/build_win.bat @@ -6,22 +6,31 @@ cd .. set DEPS_DIR=%CD%\deps set ONNXRUNTIME_VERSION=1.9.0 +set DIRECTML_VERSION=1.7.0 set HALIDE_VERSION=12.0.1 set ONNXRUNTIME_URL=https://github.com/microsoft/onnxruntime/releases/download/v1.9.0/Microsoft.ML.OnnxRuntime.DirectML.%ONNXRUNTIME_VERSION%.zip set ONNXRUNTIME_ZIP=%DEPS_DIR%\Microsoft.ML.OnnxRuntime.DirectML.%ONNXRUNTIME_VERSION%.zip set ONNXRUNTIME_DIR=%DEPS_DIR%\onnxruntime +set DIRECTML_URL=https://www.nuget.org/api/v2/package/Microsoft.AI.DirectML/%DIRECTML_VERSION% +set DIRECTML_ZIP=%DEPS_DIR%\Microsoft.AI.DirectML-%DIRECTML_VERSION%.zip +set DIRECTML_DIR=%DEPS_DIR%\directml + set HALIDE_URL=https://github.com/halide/Halide/releases/download/v12.0.1/Halide-12.0.1-x86-64-windows-5dabcaa9effca1067f907f6c8ea212f3d2b1d99a.zip set HALIDE_ZIP=Halide-%HALIDE_VERSION%.zip set HALIDE_DIR=%DEPS_DIR%\Halide-%HALIDE_VERSION%-x86-64-windows + IF not exist deps mkdir deps pushd %DEPS_DIR% IF not exist %ONNXRUNTIME_ZIP% curl -L -o %ONNXRUNTIME_ZIP% %ONNXRUNTIME_URL% IF not exist %ONNXRUNTIME_DIR% 7z x -o%ONNXRUNTIME_DIR% %ONNXRUNTIME_ZIP% + IF not exist %DIRECTML_ZIP% curl -L -o %DIRECTML_ZIP% %DIRECTML_URL% + IF not exist %DIRECTML_DIR% 7z x -o%DIRECTML_DIR% %DIRECTML_ZIP% + IF not exist %HALIDE_ZIP% curl -L -o %HALIDE_ZIP% %HALIDE_URL% IF not exist %HALIDE_DIR% 7z x %HALIDE_ZIP% popd diff --git a/src/blur_gen.cpp b/src/blur_gen.cpp index faeda61..8ff0bb6 100644 --- a/src/blur_gen.cpp +++ b/src/blur_gen.cpp @@ -22,8 +22,13 @@ class BlurGenerator : public Halide::Generator { } void schedule() { - output.compute_root().vectorize(x, 8).parallel(y); - blur_y.compute_at(output, y).vectorize(x, 8); + if (!auto_schedule) { + output.compute_root().vectorize(x, 8).parallel(y); + blur_y.compute_at(output, y).vectorize(x, 8); + } else { + output.set_estimates({{0, 256}, {0, 144}}); + input.set_estimates({{0, 256}, {0, 144}}); + } } };