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

Expose knobs to create and share (CPU) allocators across sessions in C# and Python #5634

Merged
merged 20 commits into from
Nov 21, 2020

Conversation

hariharans29
Copy link
Member

@hariharans29 hariharans29 commented Oct 29, 2020

Description:
The C# and Python API follow-up for the feature added in #4813
The motivation is to allow C# and Python users to create multiple sessions that are backed by the same arena based allocator should they choose to

Motivation and Context
C# <-> C/C++ <-> Python API parity

@hariharans29 hariharans29 requested a review from a team as a code owner October 29, 2020 22:46
@@ -479,6 +479,11 @@ struct IoBinding : public Base<OrtIoBinding> {
void ClearBoundOutputs();
};

struct ArenaCfg : Base<OrtArenaCfg> {
explicit ArenaCfg(std::nullptr_t) {}
ArenaCfg(size_t max_mem, int arena_extend_strategy, int initial_chunk_size_bytes, int max_dead_bytes_per_chunk);
Copy link
Member

Choose a reason for hiding this comment

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

ArenaCfg [](start = 2, length = 8)

perhaps a factory method would be a good idea?

Copy link
Member Author

Choose a reason for hiding this comment

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

But why though ? Why move from an established pattern ? Can you please elaborate on why it will be a good idea for this ?

@hariharans29 hariharans29 changed the title WIP: Expose knobs to create and share (CPU) allocators across sessions in C# and Python Expose knobs to create and share (CPU) allocators across sessions in C# and Python Nov 17, 2020
ORT_API2_STATUS(CreateArenaCfg, _In_ size_t max_mem, int arena_extend_strategy, int initial_chunk_size_bytes,
int max_dead_bytes_per_chunk, _Outptr_ OrtArenaCfg** out);

ORT_CLASS_RELEASE(ArenaCfg);
Copy link
Member

Choose a reason for hiding this comment

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

ORT_CLASS_RELEASE(ArenaCfg); [](start = 2, length = 28)

Normally, this would be declared automatically

Copy link
Member Author

Choose a reason for hiding this comment

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

How so ?

onnxruntime/core/session/ort_apis.h Outdated Show resolved Hide resolved
csharp/src/Microsoft.ML.OnnxRuntime/OnnxRuntime.cs Outdated Show resolved Hide resolved
include/onnxruntime/core/session/environment.h Outdated Show resolved Hide resolved
onnxruntime/core/session/ort_env.h Outdated Show resolved Hide resolved
@hariharans29 hariharans29 merged commit d46dbea into master Nov 21, 2020
@hariharans29 hariharans29 deleted the hari/ApiParity2 branch November 21, 2020 22:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants