-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Make session configuration options available to kernels via OpKernelInfo #18897
Conversation
…ptionsToOpKernelInfo
Given the fact that there is not an apparent use case for EPs to make use of the options, the current approach seems right. |
…ptionsToOpKernelInfo
Update name of macro that checks message in error status to make it a little more intuitive. Simplify some existing code by using it.
@skottmckay , thanks for extending the framework to allow opkernels receive the config options. this will make the platform specific custom opkernel implementations more cleaner. |
orttraining/orttraining/core/optimizer/graph_transformer_utils.cc
Outdated
Show resolved
Hide resolved
…ptionsToOpKernelInfo
+@HectorSVC , @chilo-ms |
FWIW most EPs don't care. It's also a little tricky as the EP instance is created prior to the config options being available/finalized so the EP author needs to know about such restrictions. Also complicated by some EPs being behind the provider bridge. One option is to update on a case-by-case basis to do something like what the XNNPACK EP does. Another would be to look at adding something generic to the EP interface like 'GetSessionConfiguration' that returns a struct with relevant things (config values + things like thread info) if set. The struct allows more things to be added in the future and minimizes what the provider bridge needs to support (vs. trying to support everything in SessionOptions). Throws if not set (premature usage). In InferenceSession::Initialize we could set this struct for all EPs as the values should be final at that point. |
…nfo (#18897) ### Description <!-- Describe your changes. --> Pass through the ConfigOptions from the session via OpKernelInfo so that kernel behavior can be configured. Initial usage would be to optionally enable a fast path for ARM64 bloat16 GEMM - see #17031 Other usages could be things like selected the exact implementations of the activation functions for RNN operators instead of the default approximations (e.g. use [sigmoid_exact instead of sigmoid](https://github.com/microsoft/onnxruntime/blob/2d6e2e243d1a1ab0486f4f191b61ac979c5b978e/onnxruntime/core/providers/cpu/rnn/rnn_helpers.h#L379-L382)) OpKernelInfo is already passing through things from the session state, and adding a new member of ConfigOptions is the simpler update. It's also a more natural fit given it's providing state/info to the kernel. ### Motivation and Context <!-- - Why is this change required? What problem does it solve? - If it fixes an open issue, please link to the issue here. -->
Description
Pass through the ConfigOptions from the session via OpKernelInfo so that kernel behavior can be configured.
Initial usage would be to optionally enable a fast path for ARM64 bloat16 GEMM - see #17031
Other usages could be things like selected the exact implementations of the activation functions for RNN operators instead of the default approximations (e.g. use sigmoid_exact instead of sigmoid)
At least one alternative would be to add the ConfigOptions to the execution provider interface
I think either is possible. OpKernelInfo is already passing through things from the session state, and adding a new member of ConfigOptions is the simpler update. It's also a more natural fit given it's providing state/info to the kernel.
However, if we think EP code in general would benefit from being able to use the config options (e.g. the XNNPACK EP reads info on number of threads from config options currently) it may be worth the added complexity/weirdness of updating IExecutionProvider with delayed insertion of ConfigOptions into the instance.
Motivation and Context