Skip to content

NNotepad: Parse the IDL to determine argument types#308

Merged
Honry merged 1 commit intowebmachinelearning:masterfrom
inexorabletash:parse-widl
Mar 24, 2025
Merged

NNotepad: Parse the IDL to determine argument types#308
Honry merged 1 commit intowebmachinelearning:masterfrom
inexorabletash:parse-widl

Conversation

@inexorabletash
Copy link
Copy Markdown
Contributor

To know how to parse argument and dictionary members - are they tensors or simple types? - the parser asks a WebNNUtil function. This function did the job by hardcoding a list of the special cases. This requires careful maintenance.

Update the code to bundle a copy of the WebIDL and parse it, instead. This uses webidl2.js, which is the same library used by Web Platform Tests for validating the IDL.

This will require updating the snapshot IDL as the spec evolves, but that's less specialized than tweaking the special JSON data and can potentially be automated.

Future work includes:

  • Fetch the IDL from the Web Platform Tests repository, or some other CORS-friendly canonical resource.

  • Use the parsed IDL to drive the Monaco editor, for better autocomplete.

@inexorabletash inexorabletash requested a review from Honry March 21, 2025 20:13
@inexorabletash
Copy link
Copy Markdown
Contributor Author

@Honry can you take a look?

To know how to parse argument and dictionary members - are they
tensors or simple types? - the parser asks a WebNNUtil function. This
function did the job by hardcoding a list of the special cases. This
requires careful maintenance.

Update the code to bundle a copy of the WebIDL and parse it, instead.
This uses webidl2.js, which is the same library used by Web Platform
Tests for validating the IDL.

This will require updating the snapshot IDL as the spec evolves, but
that's less specialized than tweaking the special JSON data and can
potentially be automated.

Future work includes:

- Fetch the IDL from the Web Platform Tests repository, or some other
  CORS-friendly canonical resource.

- Use the parsed IDL to drive the Monaco editor, for better
  autocomplete.
Copy link
Copy Markdown
Collaborator

@Honry Honry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

πŸ‘πŸ‘πŸ‘

@Honry Honry merged commit d510706 into webmachinelearning:master Mar 24, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants