-
Notifications
You must be signed in to change notification settings - Fork 36
fix: resolve scalar parameter types from graph context during inference #189
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
Open
siddiquifaras
wants to merge
5
commits into
neuromorphs:main
Choose a base branch
from
siddiquifaras:fix/scalar-type-inference
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
a2c7fa7
fix: resolve scalar parameter types from graph context during inference
siddiquifaras 0dce00d
style: apply black formatting to graph.py
siddiquifaras 7349584
test: verify port naming pattern for scalar type inference
siddiquifaras c6b7284
style: apply black formatting to test files
siddiquifaras 7d9360d
fix: resolve merge conflict with main (structural validation tests)
siddiquifaras File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
Oops, something went wrong.
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.
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.
Let me make sure I'm understanding this: you're taking the dict
pre_node.output.items(), and then replacing the "output" node with "input" copyingvas the value. Is this a good strategy? I get the idea that we want to copy the output parameter, but, in principle, one node can have multiple outputs.I'm not sure I have a great solution for this, but it's worth thinking a bit about. Would it be an option to build a new dictionary that only aligns the input? It's a bit of a headache because the ports are slightly underspecified (i. e. people can (ab)use them in whichever way), but I'd like to avoid constraining that too much if it's not necessary.
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 for the feedback. The
k.replace("output", "input")pattern is consistent with the existing implementation ininfer_types()(lines 316–318), which uses the same approach for undefined input types.1. Current NIR implementation
All nodes use single-port naming (
{"input": ...},{"output": ...}), and multi port nodes currently raiseNotImplementedErrorincheck_types()(lines 216–218). In this context, the string replacement works reliably.2. Future multi port support
When multi port nodes are introduced, NIR edges connect entire nodes (all ports to all ports), not individual ports. The type check at line 307 enforces port count consistency:
len(post_node.input_type) != len(pre_node.output_type)Copying the full
output_typedict toinput_typetherefore remains correct.3. Port naming convention
The approach also extends to indexed ports (e.g.,
output_0 → input_0,output_1 → input_1) as long as the naming convention retains the"output"/"input"substrings.i've added a test (
test_scalar_lif_port_naming) to confirm that port naming is preserved and to document this behavior for future multi port support.