onnxruntime/cmake/external/mimalloc.cmake
kile0 f367fd921c
Use a custom allocator for temporary buffers in reduction_ops.cc (#2775)
* port the mimalloc allocator

* hook mimalloc opt into common.h and reduction ops

* repurpose USE_MIMALLOC to only denote subbing in of default allocator with mimalloc and some refactoring

* fix unintended cherry pick diffs

* polish alloctor_mimalloc

* explicitly disable mimalloc where it already had been disabled

* update mimalloc to pull in stl allocator

* switch mimalloc stl allocator to use mimalloc library version

* turn mimalloc on by default (only the stl changes are enabled, the python interacting ones are off already and shall remain so)

* move FastAllocVector into cpu specific code

* separate out defines into arena and stl changes

* the rest of the define renames

* bfc arena allocator

* some typos and rename the bfc arena allocator to fit existing class naming conventions

* adjustments in response to comments

* different template instantiations are friends
2020-02-23 16:04:30 +10:00

19 lines
698 B
CMake

set(mimalloc_root_dir ${PROJECT_SOURCE_DIR}/external/mimalloc)
if(onnxruntime_USE_MIMALLOC_STL_ALLOCATOR)
add_definitions(-DUSE_MIMALLOC_STL_ALLOCATOR) # used in ONNXRuntime
endif()
if(onnxruntime_USE_MIMALLOC_ARENA_ALLOCATOR)
add_definitions(-DUSE_MIMALLOC_ARENA_ALLOCATOR) # used in ONNXRuntime
endif()
include_directories(${mimalloc_root_dir}/include)
option(MI_OVERRIDE "" OFF)
option(MI_BUILD_TESTS "" OFF)
add_subdirectory(${mimalloc_root_dir} EXCLUDE_FROM_ALL)
set_target_properties(mimalloc-static PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
if (WIN32)
set_target_properties(mimalloc-static PROPERTIES COMPILE_FLAGS "/wd4389 /wd4201 /wd4244 /wd4565")
endif()