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

MLOpSupportLimits should be opt-in with base functionality #759

Open
mwyrzykowski opened this issue Sep 11, 2024 · 0 comments
Open

MLOpSupportLimits should be opt-in with base functionality #759

mwyrzykowski opened this issue Sep 11, 2024 · 0 comments

Comments

@mwyrzykowski
Copy link

ML.createContext as currently specified takes an optional MLContextOptions:

dictionary MLContextOptions {
  MLDeviceType deviceType = "cpu";
  MLPowerPreference powerPreference = "default";
};

The MLContext has a dictionary of MLOpSupportedLimits which correspond to the device capabilities the user is running on:

dictionary MLOpSupportLimits {
  MLInputOperandLayout preferredInputLayout;
  MLSupportLimits input;
  MLSupportLimits constant;
  MLSupportLimits output;
};

This could lead to portability issues as it allows a website author to test on their desktop computer which may have different capabilities than a mobile phone or tablet. Or perhaps they test on a Windows or Linux computer and don't realize their models are not compatible with macOS until they receive bug reports.

Compare this to the design of WebGPU, where the call to GPUAdapter.requestDevice takes an optional GPUDeviceDescriptor.

If a GPUDeviceDescriptor is not passed, a default set of capabilities are available with the goal to ensure the website runs on any device where WebGPU is supported.

It would seem reasonable to have a similar design as WebGPU in WebNN, where the ML interface could report which capabilities are available, but fall back to a common set of supported limits and features so that websites which use the defaults will run everywhere WebNN is supported.

There are various ways to achieve this, one being as simply as adding an optional MLOpSupportLimits parameter to ML.createContext, if one is not passed, a common set of defaults which are supported everywhere WebNN is supported would be used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants