-
Notifications
You must be signed in to change notification settings - Fork 49
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
How to handle a failing compilation #50
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @wchao1115 for the PR. Left my comments. Please take a look.
I am fine with the proposal. My main concern was to avoid mixing potentially different concerns/options into one. It is fine to add more options later on as and when appropriate. |
To allow adding more options later, I propose to change the argument into a dictionary, it also aligns to the WebGL WebGLContextAttributes that contains For example: enum PowerPreference {
"low-power",
"high-performance"
};
dictionary CompilationOptions {
PowerPreference powerPreference;
};
interface Model {
Promise<Compilation> createCompilation(optional CompilationOptions options = {});
}; |
Another question is in the latest commit, I failed to find the sample code that handles a failing compilation. Are there any reasons to drop it? |
As stated in the commit's comment, with this change the browser is expected to handle failing case due to unsupported data type, most likely by falling back to the default option. |
I think the dictionary has merit if we believe we need something similar to I pushed out a new commit that addresses this feedback. Please have a look. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks good. Thanks @wchao1115 !
@wchao1115 , please help resolve the conflicts due to merging PR #49 . Thanks. |
…reation. Update the code sample to show how a certain compilation could fail such as when the model uses data type not supported by the hardware, and how to recover from the failure.
We now call on the browser to properly fallback to a different compute device if the targeted device e.g. GPU is unable to support compilation of model with unsupported data type e.g. float16. Hence, we eliminate the need to define error code in such event. The browser is required to handle this failure internally and fallback as appropriate. We also like to scope the current CompilationPreference to just the power options aka PowerPreference with two options available { 'low-power', 'speed' }. These are the same two options available in WebGLPowerPreference enum. The fact that we make the power preference option optional means we do not need to explicit define the 'default' option.
…ion instead of just passing an enum value.
21568b0
to
af16a69
Compare
The change is reviewed and merged. I believe we can now close this issue. In summary, we decided that it's the UA responsibility to handle compilation failure for a given power preference. If an unrecoverable failure is triggered, fatal exception will then be thrown. |
@wchao1115 , thanks for rebasing and merging. |
Update CompilationPreference to follow WebGL convention for context creation. Update the code sample to show how a certain compilation could fail such as when the model uses data type not supported by the hardware, and how to recover from the failure. #36
Preview | Diff