Skip to content

Onnx runtime set allocator #619

New issue

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

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

Already on GitHub? # to your account

Merged
merged 50 commits into from
Mar 11, 2021
Merged

Onnx runtime set allocator #619

merged 50 commits into from
Mar 11, 2021

Conversation

alonre24
Copy link
Collaborator

Introduce an API that allows setting a custom allocator for onnxruntime backend. We register RedisModule Alloc and Free functions as onnx allocator, so that onnx is now using them in model create, delete and run.
The memory usage of onnx (via redis allocator) and the number of accesses to the allocator is saved as part of the module info (defined in redisai.c), under a new section named "ai_memory_info". These are exported to RedisAI as new fields in the RAI_LoadedBackend struct.

chayim and others added 11 commits February 16, 2021 10:01
…me backend. We register RedisModule Alloc and Free functions as onnx allocator, so that onnx is now using them in model create, delete and run.

- The memory usage of onnx (via redis allocator) and the number of accesses to the allocator is saved as part of the module info (defined in redisai.c), under a new section named "ai_memory_info". These are exported to RedisAI as new fields in the RAI_LoadedBackend struct.
chayim
chayim previously approved these changes Feb 25, 2021
…t since onnx memory info is saved in redis' INFO report, that can be produced by calling the INFO MODULES command)
@alonre24 alonre24 force-pushed the OnnxRuntime_set_allocator branch from 2d6cde9 to 6626672 Compare February 25, 2021 12:43
@alonre24 alonre24 force-pushed the OnnxRuntime_set_allocator branch from 6626672 to e404178 Compare February 25, 2021 12:46
Copy link
Contributor

@rafie rafie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tests/module/Makefile should be replaced by a corresponding CMakeLists.txt.

@alonre24 alonre24 force-pushed the OnnxRuntime_set_allocator branch 2 times, most recently from 2285c68 to 5e4af41 Compare March 5, 2021 13:54
@codecov
Copy link

codecov bot commented Mar 5, 2021

Codecov Report

Merging #619 (f27405b) into master (110030e) will increase coverage by 0.36%.
The diff coverage is 75.80%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #619      +/-   ##
==========================================
+ Coverage   76.35%   76.71%   +0.36%     
==========================================
  Files          41       41              
  Lines        6517     6519       +2     
==========================================
+ Hits         4976     5001      +25     
+ Misses       1541     1518      -23     
Impacted Files Coverage Δ
src/backends.c 62.89% <63.63%> (-0.11%) ⬇️
src/backends/onnxruntime.c 67.41% <75.23%> (+6.39%) ⬆️
src/redisai.c 85.14% <100.00%> (+0.16%) ⬆️
src/model.c 77.14% <0.00%> (-1.15%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 110030e...f27405b. Read the comment docs.

@alonre24 alonre24 force-pushed the OnnxRuntime_set_allocator branch from 3db8a1b to f9e45ff Compare March 5, 2021 16:15
@alonre24 alonre24 force-pushed the OnnxRuntime_set_allocator branch from 89fd4a3 to 049417e Compare March 8, 2021 21:32
@alonre24 alonre24 force-pushed the OnnxRuntime_set_allocator branch from cd7c9d1 to 5972370 Compare March 11, 2021 16:01
Extend tests to make a more precise check of the allocator usage.
@alonre24 alonre24 force-pushed the OnnxRuntime_set_allocator branch from 5972370 to f27405b Compare March 11, 2021 16:33
@alonre24 alonre24 merged commit 52ce7bd into master Mar 11, 2021
@alonre24 alonre24 deleted the OnnxRuntime_set_allocator branch March 11, 2021 21:29
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants