NNotepad: Parse the IDL to determine argument types#308
Merged
Honry merged 1 commit intowebmachinelearning:masterfrom Mar 24, 2025
inexorabletash:parse-widl
Merged
NNotepad: Parse the IDL to determine argument types#308Honry merged 1 commit intowebmachinelearning:masterfrom inexorabletash:parse-widl
Honry merged 1 commit intowebmachinelearning:masterfrom
inexorabletash:parse-widl
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.