Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

add DirectML DLL into zip #43

Merged
merged 5 commits into from
Oct 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand Down Expand Up @@ -97,6 +97,13 @@ if(WIN32)
"${RELEASE_DIR}/obs-plugins/${ARCH_NAME}"
)

# package the DirectML runtime DLL
COMMAND if $<OR:$<CONFIG:Release>,$<CONFIG:RelWithDebInfo>>==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 $<CONFIG:RelWithDebInfo>==1 (
"${CMAKE_COMMAND}" -E copy
Expand Down
9 changes: 9 additions & 0 deletions scripts/build_win.bat
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 7 additions & 2 deletions src/blur_gen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,13 @@ class BlurGenerator : public Halide::Generator<BlurGenerator> {
}

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}});
}
}
};

Expand Down