2024-02-07 21:22:54 +03:00
|
|
|
cmake_minimum_required(VERSION 3.19)
|
2024-07-10 18:02:51 +03:00
|
|
|
project(dxdispatch VERSION 0.18.1 LANGUAGES CXX)
|
2022-01-28 08:39:53 +03:00
|
|
|
|
|
|
|
# ==============================================================================
|
2022-02-01 22:50:35 +03:00
|
|
|
# External Libraries/Helpers
|
2022-01-28 08:39:53 +03:00
|
|
|
# ==============================================================================
|
2022-02-01 22:50:35 +03:00
|
|
|
|
2024-08-20 04:35:15 +03:00
|
|
|
if(POLICY CMP0135)
|
|
|
|
cmake_policy(SET CMP0135 NEW)
|
|
|
|
endif()
|
|
|
|
|
2022-01-28 08:39:53 +03:00
|
|
|
include(FetchContent)
|
2022-02-01 22:50:35 +03:00
|
|
|
include(cmake/helper_platform.cmake)
|
|
|
|
|
|
|
|
if(NOT TARGET_XBOX)
|
|
|
|
# Statically link runtime library to avoid runtime dependency on Visual C++ redistributable.
|
|
|
|
# On Xbox we deploy these dependencies for now.
|
|
|
|
set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreaded$<$<CONFIG:Debug>:Debug>)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(TARGET_WSL)
|
|
|
|
set(CMAKE_SKIP_BUILD_RPATH FALSE)
|
|
|
|
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
|
|
|
|
set(CMAKE_INSTALL_RPATH "$\{ORIGIN\}")
|
|
|
|
endif()
|
|
|
|
|
2022-01-28 08:39:53 +03:00
|
|
|
include(cmake/gsl.cmake)
|
|
|
|
include(cmake/rapidjson.cmake)
|
2024-08-20 17:51:22 +03:00
|
|
|
include(cmake/flatbuffer.cmake)
|
2022-01-28 08:39:53 +03:00
|
|
|
include(cmake/fmt.cmake)
|
|
|
|
include(cmake/wil.cmake)
|
|
|
|
include(cmake/cxxopts.cmake)
|
|
|
|
|
2022-02-01 22:50:35 +03:00
|
|
|
if(NOT TARGET_XBOX)
|
|
|
|
include(cmake/gtest.cmake)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
include(cmake/wil.cmake)
|
|
|
|
add_wil_target(wil CACHE_PREFIX DXD)
|
|
|
|
|
|
|
|
include(cmake/gdk.cmake)
|
|
|
|
add_gdk_target(gdk CACHE_PREFIX DXD)
|
|
|
|
get_target_property(gdk_dxcompiler_path gdk DX_COMPILER_PATH)
|
|
|
|
|
|
|
|
include(cmake/pix.cmake)
|
|
|
|
add_pix_target(pix CACHE_PREFIX DXD)
|
|
|
|
|
|
|
|
include(cmake/dxcompiler.cmake)
|
|
|
|
add_dxcompiler_target(dxcompiler CACHE_PREFIX DXD GDK_DXCOMPILER_PATH ${gdk_dxcompiler_path})
|
|
|
|
get_target_property(dxcompiler_type dxcompiler DX_COMPONENT_CONFIG)
|
|
|
|
|
|
|
|
include(cmake/d3d12.cmake)
|
|
|
|
add_d3d12_target(d3d12 CACHE_PREFIX DXD)
|
|
|
|
|
|
|
|
include(cmake/directml.cmake)
|
|
|
|
add_directml_target(directml CACHE_PREFIX DXD)
|
|
|
|
|
2022-07-01 00:10:26 +03:00
|
|
|
include(cmake/onnxruntime.cmake)
|
|
|
|
add_onnxruntime_target(onnxruntime CACHE_PREFIX DXD)
|
|
|
|
get_target_property(onnxruntime_type onnxruntime DX_COMPONENT_CONFIG)
|
|
|
|
|
2023-06-27 20:55:16 +03:00
|
|
|
include(cmake/onnxruntime_extensions.cmake)
|
|
|
|
add_onnxruntime_extensions_target(onnxruntime_extensions CACHE_PREFIX DXD)
|
|
|
|
|
2024-02-07 21:22:54 +03:00
|
|
|
# ==============================================================================
|
|
|
|
# Global Defines for CMAKE
|
|
|
|
# ==============================================================================
|
|
|
|
if(MSVC)
|
2024-03-08 00:46:41 +03:00
|
|
|
add_compile_options(/guard:cf /Qspectre /GS /sdl /W3 )
|
|
|
|
if( TARGET_ARCH STREQUAL ARM64 OR
|
|
|
|
TARGET_ARCH STREQUAL ARM)
|
|
|
|
add_link_options(/GUARD:CF /DYNAMICBASE)
|
|
|
|
else()
|
|
|
|
add_link_options(/GUARD:CF /DYNAMICBASE /CETCOMPAT)
|
|
|
|
endif()
|
2024-02-07 21:22:54 +03:00
|
|
|
endif()
|
|
|
|
|
2022-01-28 08:39:53 +03:00
|
|
|
# ==============================================================================
|
|
|
|
# Model Library
|
|
|
|
# ==============================================================================
|
|
|
|
add_library(
|
|
|
|
model STATIC
|
|
|
|
src/model/JsonParsers.cpp
|
2022-11-17 00:33:01 +03:00
|
|
|
src/model/JsonParsers.h
|
2022-01-28 08:39:53 +03:00
|
|
|
src/model/Model.cpp
|
2022-11-17 00:33:01 +03:00
|
|
|
src/model/Model.h
|
|
|
|
src/model/NpyReaderWriter.cpp
|
|
|
|
src/model/NpyReaderWriter.h
|
2022-01-28 08:39:53 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
target_link_libraries(
|
|
|
|
model
|
|
|
|
PRIVATE
|
|
|
|
fmt::fmt-header-only
|
|
|
|
PUBLIC
|
|
|
|
Microsoft.GSL::GSL
|
2022-02-01 22:50:35 +03:00
|
|
|
rapidjson::rapidjson
|
|
|
|
wil
|
|
|
|
d3d12
|
|
|
|
directml
|
2022-01-28 08:39:53 +03:00
|
|
|
)
|
|
|
|
|
2023-10-26 20:57:03 +03:00
|
|
|
if(TARGET_WSL)
|
|
|
|
set_target_properties(model PROPERTIES POSITION_INDEPENDENT_CODE ON)
|
|
|
|
endif()
|
|
|
|
|
2022-01-28 08:39:53 +03:00
|
|
|
target_compile_features(model PRIVATE cxx_std_17)
|
|
|
|
target_precompile_headers(model PRIVATE src/model/pch.h)
|
|
|
|
target_include_directories(model INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/src/model)
|
2024-08-20 04:35:15 +03:00
|
|
|
target_include_directories(model PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src/external)
|
2022-01-28 08:39:53 +03:00
|
|
|
|
|
|
|
# ==============================================================================
|
2023-10-26 20:57:03 +03:00
|
|
|
# Dll
|
2022-01-28 08:39:53 +03:00
|
|
|
# ==============================================================================
|
2022-02-01 22:50:35 +03:00
|
|
|
get_target_property(directml_config directml DX_COMPONENT_CONFIG)
|
|
|
|
get_target_property(d3d12_config d3d12 DX_COMPONENT_CONFIG)
|
|
|
|
get_target_property(dxcompiler_config dxcompiler DX_COMPONENT_CONFIG)
|
|
|
|
get_target_property(pix_config pix DX_COMPONENT_CONFIG)
|
|
|
|
get_target_property(gdk_config gdk DX_COMPONENT_CONFIG)
|
2022-07-01 00:10:26 +03:00
|
|
|
get_target_property(ort_config onnxruntime DX_COMPONENT_CONFIG)
|
2023-06-27 20:55:16 +03:00
|
|
|
get_target_property(ort_extensions_config onnxruntime_extensions DX_COMPONENT_CONFIG)
|
2022-01-28 08:39:53 +03:00
|
|
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/dxdispatch/config.h.in config.h)
|
|
|
|
|
2023-10-26 20:57:03 +03:00
|
|
|
add_library(
|
|
|
|
dxdispatchImpl SHARED
|
|
|
|
src/dxdispatch/DxDispatchInterface.h
|
|
|
|
src/dxdispatch/dllMain.cpp
|
|
|
|
src/dxdispatch/dxDispatchWrapper.cpp
|
|
|
|
src/dxdispatch/dxDispatchWrapper.h
|
2022-01-28 08:39:53 +03:00
|
|
|
src/dxdispatch/Adapter.cpp
|
2022-11-17 00:33:01 +03:00
|
|
|
src/dxdispatch/Adapter.h
|
2022-01-28 08:39:53 +03:00
|
|
|
src/dxdispatch/Device.cpp
|
2022-11-17 00:33:01 +03:00
|
|
|
src/dxdispatch/Device.h
|
2022-01-28 08:39:53 +03:00
|
|
|
src/dxdispatch/DmlDispatchable.cpp
|
2022-11-17 00:33:01 +03:00
|
|
|
src/dxdispatch/DmlDispatchable.h
|
2024-08-20 17:51:22 +03:00
|
|
|
src/dxdispatch/DirectMLHelpers/DmlGraphDeserialization.cpp
|
|
|
|
src/dxdispatch/DirectMLHelpers/ApiTraits.cpp
|
2022-01-28 08:39:53 +03:00
|
|
|
src/dxdispatch/Executor.cpp
|
2022-11-17 00:33:01 +03:00
|
|
|
src/dxdispatch/Executor.h
|
2022-01-28 08:39:53 +03:00
|
|
|
src/dxdispatch/CommandLineArgs.cpp
|
2022-11-17 00:33:01 +03:00
|
|
|
src/dxdispatch/CommandLineArgs.h
|
2022-02-01 22:50:35 +03:00
|
|
|
src/dxdispatch/Logging.cpp
|
2022-11-17 00:33:01 +03:00
|
|
|
src/dxdispatch/Logging.h
|
2022-07-01 00:10:26 +03:00
|
|
|
src/dxdispatch/PixCaptureHelper.cpp
|
2022-11-17 00:33:01 +03:00
|
|
|
src/dxdispatch/PixCaptureHelper.h
|
2022-09-03 03:07:24 +03:00
|
|
|
src/dxdispatch/DxModules.cpp
|
2022-11-17 00:33:01 +03:00
|
|
|
src/dxdispatch/DxModules.h
|
2022-10-25 00:04:52 +03:00
|
|
|
src/dxdispatch/ModuleInfo.cpp
|
2022-01-28 08:39:53 +03:00
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/config.h
|
|
|
|
)
|
2023-10-26 20:57:03 +03:00
|
|
|
target_include_directories(dxdispatchImpl INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/src/dxdispatch)
|
2022-01-28 08:39:53 +03:00
|
|
|
|
2022-02-01 22:50:35 +03:00
|
|
|
if(NOT dxcompiler_type STREQUAL None)
|
2023-10-26 20:57:03 +03:00
|
|
|
target_sources(dxdispatchImpl PRIVATE src/dxdispatch/HlslDispatchable.cpp)
|
2022-02-01 22:50:35 +03:00
|
|
|
endif()
|
|
|
|
|
2022-07-01 00:10:26 +03:00
|
|
|
if(NOT onnxruntime_type STREQUAL None)
|
2023-10-26 20:57:03 +03:00
|
|
|
target_sources(dxdispatchImpl PRIVATE src/dxdispatch/OnnxDispatchable.cpp)
|
2022-07-01 00:10:26 +03:00
|
|
|
endif()
|
|
|
|
|
2022-02-01 22:50:35 +03:00
|
|
|
set_property(DIRECTORY PROPERTY VS_STARTUP_PROJECT dxdispatch)
|
|
|
|
|
|
|
|
if(WIN32)
|
2024-05-16 06:35:28 +03:00
|
|
|
if(TARGET_WINDOWS)
|
2024-05-16 21:06:01 +03:00
|
|
|
target_compile_definitions(dxdispatchImpl PRIVATE INCLUDE_DXGI=1)
|
|
|
|
target_link_libraries(dxdispatchImpl PRIVATE dxgi)
|
2024-05-16 06:35:28 +03:00
|
|
|
endif()
|
2023-10-26 20:57:03 +03:00
|
|
|
target_sources(dxdispatchImpl PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/dxdispatchImpl.rc)
|
|
|
|
target_link_libraries(dxdispatchImpl PRIVATE version.lib)
|
|
|
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/dxdispatch/dxdispatchImpl.rc.in dxdispatchImpl.rc)
|
2022-02-01 22:50:35 +03:00
|
|
|
endif()
|
|
|
|
|
2022-09-03 03:07:24 +03:00
|
|
|
if(TARGET_WSL)
|
2023-10-26 20:57:03 +03:00
|
|
|
target_link_libraries(dxdispatchImpl PRIVATE -ldl)
|
2022-09-03 03:07:24 +03:00
|
|
|
endif()
|
|
|
|
|
2023-10-26 20:57:03 +03:00
|
|
|
target_include_directories(dxdispatchImpl PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
|
2022-01-28 08:39:53 +03:00
|
|
|
|
|
|
|
target_link_libraries(
|
2023-10-26 20:57:03 +03:00
|
|
|
dxdispatchImpl
|
2022-01-28 08:39:53 +03:00
|
|
|
PRIVATE
|
|
|
|
Microsoft.GSL::GSL
|
|
|
|
fmt::fmt-header-only
|
|
|
|
model
|
|
|
|
cxxopts
|
2022-02-01 22:50:35 +03:00
|
|
|
directml
|
|
|
|
d3d12
|
|
|
|
dxcompiler
|
|
|
|
pix
|
|
|
|
gdk
|
|
|
|
wil
|
2022-07-01 00:10:26 +03:00
|
|
|
onnxruntime
|
2023-06-27 20:55:16 +03:00
|
|
|
onnxruntime_extensions
|
2024-08-20 17:51:22 +03:00
|
|
|
flatbuffer
|
2022-01-28 08:39:53 +03:00
|
|
|
)
|
|
|
|
|
2023-10-26 20:57:03 +03:00
|
|
|
target_compile_features(dxdispatchImpl PRIVATE cxx_std_17)
|
|
|
|
target_precompile_headers(dxdispatchImpl PRIVATE src/dxdispatch/pch.h)
|
|
|
|
target_copy_redist_dependencies(dxdispatchImpl)
|
|
|
|
|
|
|
|
if(MSVC)
|
|
|
|
# Include the import definition, add VS debugger visualizations, remove unused functions, and fold identical code segments.
|
2023-10-27 23:14:28 +03:00
|
|
|
set_target_properties(dxdispatchImpl PROPERTIES LINK_FLAGS "/DEF:${PROJECT_SOURCE_DIR}/src/dxdispatch/dxdispatch.def ")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
set_target_properties(dxdispatchImpl PROPERTIES PUBLIC_HEADER ${CMAKE_CURRENT_SOURCE_DIR}/src/dxdispatch/DxDispatchInterface.h)
|
|
|
|
|
|
|
|
install(TARGETS dxdispatchImpl
|
|
|
|
RUNTIME DESTINATION bin
|
|
|
|
LIBRARY DESTINATION bin
|
|
|
|
PUBLIC_HEADER DESTINATION bin)
|
|
|
|
install(FILES $<TARGET_LINKER_FILE:dxdispatchImpl>
|
|
|
|
DESTINATION bin
|
|
|
|
OPTIONAL)
|
|
|
|
if(WIN32)
|
|
|
|
install(FILES $<TARGET_PDB_FILE:dxdispatchImpl>
|
|
|
|
DESTINATION bin
|
|
|
|
OPTIONAL)
|
2023-10-26 20:57:03 +03:00
|
|
|
endif()
|
2022-01-28 08:39:53 +03:00
|
|
|
|
2022-02-01 22:50:35 +03:00
|
|
|
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/models DESTINATION bin)
|
2022-01-28 08:39:53 +03:00
|
|
|
install(
|
|
|
|
FILES
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/ThirdPartyNotices.txt
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/doc/Guide.md
|
|
|
|
DESTINATION bin
|
|
|
|
)
|
|
|
|
|
2022-11-02 01:32:45 +03:00
|
|
|
if(WIN32)
|
|
|
|
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/tools/AnalyzePixGpuCapture.ps1 DESTINATION bin/tools)
|
|
|
|
endif()
|
|
|
|
|
2022-02-01 22:50:35 +03:00
|
|
|
if(TARGET_XBOX)
|
|
|
|
# Deploy to the console instead of running on local machine.
|
2023-10-26 20:57:03 +03:00
|
|
|
set_property(TARGET dxdispatchImpl PROPERTY VS_SOLUTION_DEPLOY ON)
|
2022-02-01 22:50:35 +03:00
|
|
|
|
|
|
|
# No need for logos/assets; this is a developer-only app.
|
2023-10-26 20:57:03 +03:00
|
|
|
target_sources(dxdispatchImpl PRIVATE ${CMAKE_BINARY_DIR}/MicrosoftGame.config )
|
2022-02-01 22:50:35 +03:00
|
|
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/dxdispatch/dxdispatch.config.in MicrosoftGame.config)
|
|
|
|
set_source_files_properties(${CMAKE_BINARY_DIR}/MicrosoftGame.config PROPERTIES VS_TOOL_OVERRIDE "MGCCompile")
|
|
|
|
|
|
|
|
# Copy MSVC/UCRT redist files matching the current toolset to the build output directory. Not all of the DLLs
|
|
|
|
# are necessary but this approach is simple and should avoid missing dependencies.
|
|
|
|
set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP TRUE)
|
2022-07-09 05:28:27 +03:00
|
|
|
# set(CMAKE_INSTALL_DEBUG_LIBRARIES TRUE)
|
|
|
|
# set(CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY TRUE)
|
|
|
|
# set(CMAKE_INSTALL_UCRT_LIBRARIES TRUE)
|
2022-02-01 22:50:35 +03:00
|
|
|
include(InstallRequiredSystemLibraries)
|
|
|
|
add_custom_command(
|
2023-10-26 20:57:03 +03:00
|
|
|
TARGET dxdispatchImpl
|
2022-02-01 22:50:35 +03:00
|
|
|
POST_BUILD
|
2023-10-26 20:57:03 +03:00
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS} $<TARGET_FILE_DIR:dxdispatchImpl>
|
2022-02-01 22:50:35 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
# For Copy models to the deployment directory even if other targets don't need to be built.
|
|
|
|
add_custom_target(
|
|
|
|
copy_models ALL
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_CURRENT_SOURCE_DIR}/models" "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_VS_PLATFORM_NAME}/Layout/Image/Loose/models"
|
|
|
|
)
|
|
|
|
endif()
|
2022-01-28 08:39:53 +03:00
|
|
|
|
2023-10-26 20:57:03 +03:00
|
|
|
# ==============================================================================
|
|
|
|
# Main Executable
|
|
|
|
# ==============================================================================
|
|
|
|
add_executable(
|
2023-10-28 01:12:26 +03:00
|
|
|
dxdispatch
|
2023-10-26 20:57:03 +03:00
|
|
|
src/exe/main.cpp
|
|
|
|
)
|
|
|
|
|
|
|
|
target_include_directories(
|
2023-10-28 01:12:26 +03:00
|
|
|
dxdispatch
|
2023-10-26 20:57:03 +03:00
|
|
|
PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
|
|
|
|
|
|
|
|
target_link_libraries(
|
2023-10-28 01:12:26 +03:00
|
|
|
dxdispatch
|
2023-10-26 20:57:03 +03:00
|
|
|
PRIVATE
|
|
|
|
wil
|
|
|
|
dxdispatchImpl
|
|
|
|
d3d12
|
|
|
|
directml
|
|
|
|
)
|
|
|
|
|
2023-10-28 01:12:26 +03:00
|
|
|
target_compile_features(dxdispatch PRIVATE cxx_std_17)
|
2023-10-26 20:57:03 +03:00
|
|
|
|
|
|
|
if(WIN32)
|
2023-10-28 01:12:26 +03:00
|
|
|
target_sources(dxdispatch PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/dxdispatch.rc)
|
|
|
|
target_link_libraries(dxdispatch PRIVATE version.lib)
|
2023-10-26 20:57:03 +03:00
|
|
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/exe/dxdispatch.rc.in dxdispatch.rc)
|
|
|
|
endif()
|
|
|
|
|
2023-10-28 01:12:26 +03:00
|
|
|
target_copy_redist_dependencies(dxdispatch)
|
2023-10-26 20:57:03 +03:00
|
|
|
install(
|
|
|
|
FILES
|
2023-10-28 01:12:26 +03:00
|
|
|
$<TARGET_FILE:dxdispatch>
|
2023-10-26 20:57:03 +03:00
|
|
|
DESTINATION bin
|
|
|
|
)
|
2023-10-27 23:14:28 +03:00
|
|
|
if(WIN32)
|
2023-10-28 01:12:26 +03:00
|
|
|
install(FILES $<TARGET_PDB_FILE:dxdispatch>
|
2023-10-27 23:14:28 +03:00
|
|
|
DESTINATION bin
|
|
|
|
OPTIONAL)
|
|
|
|
endif()
|
2023-10-26 20:57:03 +03:00
|
|
|
|
2022-01-28 08:39:53 +03:00
|
|
|
# ==============================================================================
|
|
|
|
# Tests
|
|
|
|
# ==============================================================================
|
2022-07-01 00:10:26 +03:00
|
|
|
if((TARGET_WINDOWS OR TARGET_WSL) AND (TARGET_ARCH MATCHES "^X64|X86$"))
|
2022-02-01 22:50:35 +03:00
|
|
|
option(DXD_TESTS "Build DxDispatch tests" ON)
|
|
|
|
else()
|
|
|
|
option(DXD_TESTS "Build DxDispatch tests" OFF)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(DXD_TESTS)
|
|
|
|
enable_testing()
|
|
|
|
include(GoogleTest)
|
|
|
|
|
|
|
|
add_executable(
|
|
|
|
jsontests
|
|
|
|
src/test/JsonParserTests.cpp
|
|
|
|
)
|
|
|
|
|
|
|
|
target_compile_features(jsontests PRIVATE cxx_std_17)
|
|
|
|
target_link_libraries(
|
|
|
|
jsontests
|
|
|
|
PRIVATE
|
|
|
|
gtest_main
|
|
|
|
fmt::fmt-header-only
|
|
|
|
directml
|
|
|
|
d3d12
|
|
|
|
wil
|
|
|
|
model
|
|
|
|
)
|
|
|
|
target_include_directories(jsontests PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src/dxdispatch)
|
2024-08-20 17:51:22 +03:00
|
|
|
gtest_discover_tests(jsontests DISCOVERY_MODE PRE_TEST)
|
2022-02-01 22:50:35 +03:00
|
|
|
|
|
|
|
# Hacky. Needed for silly reasons related to defining GUIDs in winadapter. This should
|
|
|
|
# ideally be cleaned up at some point.
|
|
|
|
if(NOT WIN32)
|
2023-10-28 01:12:26 +03:00
|
|
|
add_dependencies(jsontests dxdispatch)
|
2022-02-01 22:50:35 +03:00
|
|
|
endif()
|
|
|
|
|
2022-08-17 06:46:05 +03:00
|
|
|
function(model_test model_name expected_output)
|
2023-10-28 01:12:26 +03:00
|
|
|
add_test(NAME test_${model_name} COMMAND dxdispatch models/${model_name}.json WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
2022-08-17 06:46:05 +03:00
|
|
|
set_tests_properties(test_${model_name} PROPERTIES PASS_REGULAR_EXPRESSION ${expected_output})
|
|
|
|
endfunction()
|
|
|
|
|
2023-09-22 22:08:14 +03:00
|
|
|
model_test(dml_convolution_2d "Resource 'output': 6, 8, 12, 14")
|
|
|
|
model_test(dml_convolution_3d "Resource 'output': 4, 4, 4, 4, 4, 4, 4, 4")
|
2022-08-17 06:46:05 +03:00
|
|
|
model_test(dml_cumulative_product "Resource 'Out': 2, 8, 64, 192")
|
|
|
|
model_test(dml_element_wise_add "Resource 'Out': 6, 10, -2")
|
2022-11-17 00:33:01 +03:00
|
|
|
model_test(dml_element_wise_add_npy "Resource 'Out': 2, 4, 6, 8, 10, 12")
|
2022-08-17 06:46:05 +03:00
|
|
|
model_test(dml_element_wise_add1 "Resource 'Out': 6, 10, -0.432332")
|
|
|
|
model_test(dml_element_wise_clip "Resource 'A': -2.5, -2.5, -2, -1, 0, 1, 2, 2.5, 2.5")
|
|
|
|
model_test(dml_element_wise_identity "Resource 'Out': 12, 14, 16")
|
|
|
|
model_test(dml_fill_value_sequence "Resource 'Out': 3.2, 4.7, 6.2, 7.7, 9.2")
|
|
|
|
model_test(dml_join "Resource 'Out': 1, 2, 3, 100, 115, 5, 6, 7, 8, 9")
|
|
|
|
model_test(dml_reduce "Resource 'output': 6, 15, 24")
|
|
|
|
model_test(dml_slice "Resource 'output': 7, 9, 12, 14, 17, 19")
|
|
|
|
model_test(dml_split "Resource 'Out1': 1, 2\nResource 'Out2': 3, 4\nResource 'Out3': 5, 6")
|
|
|
|
model_test(dml_upsample_2d "Resource 'output': 1, 1.25, 1.75, 2, 1.5, 1.75, 2.25, 2.5, 2.5, 2.75, 3.25, 3.5, 3, 3.25, 3.75, 4")
|
|
|
|
model_test(dml_owned_tensors "Resource 'Out': 6, 10, -2")
|
2024-04-09 03:04:44 +03:00
|
|
|
model_test(dml_scalar_union_fp16 "Resource 'output': 2, 2, 3, 4, 4")
|
2022-09-03 03:07:24 +03:00
|
|
|
if(NOT dxcompiler_type STREQUAL None)
|
|
|
|
model_test(hlsl_add_fp32 "Resource 'Out': 2, 7, 6, 11, 2, 7")
|
|
|
|
endif()
|
|
|
|
if(NOT onnxruntime_type STREQUAL None)
|
|
|
|
model_test(onnx_gemm "Resource 'Out': 22, 28, 34, 40, 46, 60, 74, 88, 70, 92, 114, 136")
|
2023-10-19 21:25:13 +03:00
|
|
|
model_test(onnx_dynamic_shapes "Resource 'deferredY': 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12")
|
2022-09-03 03:07:24 +03:00
|
|
|
endif()
|
2023-09-15 03:35:36 +03:00
|
|
|
endif()
|
|
|
|
|
|
|
|
# Packaging - these commands allow CPack to bundle up the installed files of this project.
|
|
|
|
if(PROJECT_IS_TOP_LEVEL)
|
|
|
|
set(CPACK_PACKAGE_NAME Microsoft.AI.DirectML.DxDispatch.${TARGET_PLATFORM}.${TARGET_ARCH})
|
|
|
|
set(CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
|
|
|
|
set(CPACK_PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR})
|
|
|
|
set(CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH})
|
|
|
|
set(CPACK_PACKAGE_FILE_NAME ${CPACK_PACKAGE_NAME}-${PROJECT_VERSION})
|
|
|
|
set(CPACK_PACKAGE_VENDOR DirectML)
|
|
|
|
include(CPack)
|
2022-02-01 22:50:35 +03:00
|
|
|
endif()
|