Skip to content

[Web] WebNN optimizations silently failing when using wrong argument names in freeDimensionOverrides #22300

Open

Description

Describe the issue

My WebNN model was running 100x slower due to me using wrong argument names in freeDimensionOverrides. You can see the discussion here: microsoft/webnn-developer-preview#40

In my case I mistakenly wrote freeDimensionOverrides: { batch: 1, channels: 3, height: 512, width: 512 } instead of correct freeDimensionOverrides: { batch_size: 1, num_channels: 3, height: 512, width: 512 }, these caused optimizations not to work without explicit notification, and I did not know why my model is running so slowly. In my case I got the names completely wrong, but a similar issue could be caused by a simple typo.

I suggest that using wrong argument names would throw an error (or at least a warning). Also I suggest to emphasize in the docs that WebNN runs without optimizations unless you fix all free dimensions.

To reproduce

Inserting a typo in one of the arguments here https://github.com/eyaler/webnn-developer-preview/blob/main/demos/sd-turbo/index.js#L314 will causes the model to run 100x slower

Urgency

This may hinder WebNN dev onboarding

ONNX Runtime Installation

Released Package

ONNX Runtime Version or Commit ID

1.19.0-dev.20240804-ee2fe87e2d, 1.19.2, 1.20.0-dev.20240928-1bda91fc57

Execution Provider

Other / Unknown

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

Metadata

Assignees

No one assigned

    Labels

    ep:WebNNWebNN execution providerplatform:webissues related to ONNX Runtime web; typically submitted using templatestaleissues that have not been addressed in a while; categorized by a bot

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions