Fix alias output naming and improve Spike I/O diagnostics#51
Open
hgt312 wants to merge 1 commit intoaws-neuron:mainfrom
Open
Fix alias output naming and improve Spike I/O diagnostics#51hgt312 wants to merge 1 commit intoaws-neuron:mainfrom
hgt312 wants to merge 1 commit intoaws-neuron:mainfrom
Conversation
Non-aliased outputs that already had a name from tracing kept that name
instead of the canonical "output{idx}", breaking NEFF I/O name matching.
Also adds alias input auto-resolution and better _validate_io errors
in Spike, plus tests for all alias naming patterns.
vgene
requested changes
Apr 3, 2026
| f"got {actual_dtype}" | ||
| ) | ||
|
|
||
| _ALIAS_SUFFIX = ".must_alias_input" |
Contributor
There was a problem hiding this comment.
I don't want to complicate the handling of alias naming in spike.
Spike is a wrapper on runtime, it should not need to know how we lower the function into NEFFs. It should only deal with what's available in the NEFFs.
This specific problem can be addressed at the user level? The caller can pass .must_alias_input in the input tensor list.
A proper solution can be in the NEFF lowering in NKIPy (but we want to make sure we are aligned with NKI)
vgene
reviewed
Apr 3, 2026
| model_core_id = self.model_ref.core_id | ||
|
|
||
| unknown_inputs = set(inputs) - set(self.input_tensors_info) | ||
| if unknown_inputs: |
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.
Fix alias output naming and improve Spike I/O diagnostics
Problem
The tracer's output naming step (Step 3 in NKIPyKernel._build_code) used a truthiness check (if not r.backend_tensor.name) to decide whether to assign the canonical
output{idx} name. This failed when a non-aliased output tensor already carried a name from tracing (e.g. "intermediate0" from an np.add result). The tensor kept
its intermediate name, causing a mismatch between the NEFF I/O table and what callers pass to kernel(inputs={...}, outputs={...}).
This was discovered during sglang-nkipy integration with the stable neuronx-cc 2.23.6484.0 compiler, where three kernel call patterns broke:
output
Debugging these required extracting NEFF I/O names from HLO protobuf binaries because Spike's _validate_io only produced a bare KeyError.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.