-
Notifications
You must be signed in to change notification settings - Fork 173
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[thirdparty] Add mimalloc third-party dependency.
Co-authored-by: EllisLambda <[email protected]>
- Loading branch information
1 parent
ba241c1
commit efcacbd
Showing
4 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Third-Party Dependencies | ||
|
||
## The `mimalloc` Allocator | ||
|
||
### Build `mimalloc` | ||
|
||
``` | ||
$ cd buddy-mlir/thirdparty/mimalloc | ||
$ mkdir -p out/release | ||
$ cd out/release | ||
$ cmake -G Ninja ../.. -DCMAKE_INSTALL_PREFIX=$PWD | ||
$ ninja install | ||
``` | ||
|
||
### Use `mimalloc` in buddy-mlir | ||
|
||
Assign the `mimalloc` installation address to the `BUDDY_MLIR_USE_MIMALLOC` CMake variable. | ||
|
||
For example: | ||
|
||
``` | ||
$ cd buddy-mlir/build | ||
$ cmake -G Ninja .. \ | ||
-DMLIR_DIR=$PWD/../llvm/build/lib/cmake/mlir \ | ||
-DLLVM_DIR=$PWD/../llvm/build/lib/cmake/llvm \ | ||
-DLLVM_ENABLE_ASSERTIONS=ON \ | ||
-DCMAKE_BUILD_TYPE=RELEASE \ | ||
-DBUDDY_MLIR_USE_MIMALLOC=ON \ | ||
-DMIMALLOC_BUILD_DIR=$PWD/../thirdparty/mimalloc/out/release | ||
``` | ||
|
||
In the `CMakeLists.txt` file, link shared or static library by using: | ||
|
||
``` | ||
target_link_libraries(myapp PUBLIC mimalloc) | ||
target_link_libraries(myapp PUBLIC mimalloc-static) | ||
``` |