-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Expose knobs to create and share (CPU) allocators across sessions in C# and Python #5634
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
Changes from 8 commits
91206eb
0e01c2b
8cc4ca1
9b6d0e5
b7d88a2
555328a
6e49685
5b52f4b
daa5df5
74972f6
355dc66
3a948e5
6d16d92
95a7e54
11baa33
8a79299
05cfe16
6df325f
1776a4f
e0e075d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1103,6 +1103,20 @@ struct OrtApi { | |
| * and that's recommended because turning this option on may hurt model accuracy. | ||
| */ | ||
| ORT_API2_STATUS(SetGlobalDenormalAsZero, _Inout_ OrtThreadingOptions* tp_options); | ||
|
|
||
| /** | ||
| * Use this API to create the configuration of an arena that can eventually be used to define | ||
| * an arena based allocator's behavior | ||
| * max_mem : use 0 to allow ORT to choose the default | ||
| * arena_extend_strategy : use -1 to allow ORT to choose the default, 0 = kNextPowerOfTwo, 1 = kSameAsRequested | ||
|
hariharans29 marked this conversation as resolved.
Outdated
|
||
| * initial_chunk_size_bytes : use -1 to allow ORT to choose the default | ||
| * max_dead_bytes_per_chunk : use -1 to allow ORT to choose the default | ||
| * See ONNX_Runtime_Perf_Tuning.md for details on what these mean and how to choose these values | ||
| */ | ||
| ORT_API2_STATUS(CreateArenaCfg, _In_ size_t max_mem, int arena_extend_strategy, int initial_chunk_size_bytes, | ||
|
pranavsharma marked this conversation as resolved.
|
||
| int max_dead_bytes_per_chunk, _Outptr_ OrtArenaCfg** out); | ||
|
|
||
| ORT_CLASS_RELEASE(ArenaCfg); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Normally, this would be declared automatically
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How so ? |
||
| }; | ||
|
|
||
| /* | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -98,6 +98,7 @@ ORT_DEFINE_RELEASE(Value); | |
| ORT_DEFINE_RELEASE(ModelMetadata); | ||
| ORT_DEFINE_RELEASE(ThreadingOptions); | ||
| ORT_DEFINE_RELEASE(IoBinding); | ||
| ORT_DEFINE_RELEASE(ArenaCfg); | ||
|
|
||
| // This is used internally by the C++ API. This is the common base class used by the wrapper objects. | ||
| template <typename T> | ||
|
|
@@ -252,7 +253,6 @@ struct SessionOptions : Base<OrtSessionOptions> { | |
| SessionOptions& AddConfigEntry(const char* config_key, const char* config_value); | ||
| SessionOptions& AddInitializer(const char* name, const OrtValue* ort_val); | ||
| OrtStatus* OrtSessionOptionsAppendExecutionProvider_CUDA(OrtSessionOptions* options, OrtCUDAProviderOptions* cuda_options); | ||
|
|
||
| }; | ||
|
|
||
| struct ModelMetadata : Base<OrtModelMetadata> { | ||
|
|
@@ -479,6 +479,11 @@ struct IoBinding : public Base<OrtIoBinding> { | |
| void ClearBoundOutputs(); | ||
| }; | ||
|
|
||
| struct ArenaCfg : Base<OrtArenaCfg> { | ||
|
hariharans29 marked this conversation as resolved.
|
||
| 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); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
perhaps a factory method would be a good idea?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 ? |
||
| }; | ||
|
|
||
| // | ||
| // Custom OPs (only needed to implement custom OPs) | ||
| // | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.