Repository navigation
codegen: report NVVM IR target rejections at the input stage - #483
Merged
nihalpasham merged 1 commit intoJul 27, 2026
Merged
nihalpasham merged 1 commit into
nihalpasham merged 1 commit into
Conversation
The NVVM IR resolver returned PipelineError::Export for every failure, so a target the caller requested and the compiler refused was reported as an export failure. The PTX resolver already routes the same rejections through TargetSelection, which reaches the caller as CompilationStage::Input. Classify the rejections the NVVM IR route attributes to a target the same way: an unparsable explicit target or device hint, a target below a detected feature floor, a target below a generated intrinsic floor, and the case where nothing supplied a target at all. Failures that belong to the export keep reporting as Export. select_target_with_generated fails when no target satisfies the module, which the PTX resolver also classifies away from Input, and the PTX ISA catalogue floor is a compiler capability limit decided before any target is chosen. Follow-up to NVIDIA#416. Signed-off-by: Alejandro Soto Franco <[email protected]>
Collaborator
|
Thanks, Gist: the On the open question: keeping the empty-string sentinel for the no-target case is right for now, since CompileError is Tests and clippy verified locally on the pinned nightly. Merging. |
nihalpasham
approved these changes
Jul 27, 2026
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.
Follow-up to #416, which you asked to track separately when you merged it:
Summary
resolve_nvvm_target_with_generatedreturnedPipelineError::Exportfor every failure it could produce, so a target the caller requested and the compiler refused arrived as an export failure. Passing--arch sm_9xon the NVVM IR route reports:Nothing has been exported at that point. The target is rejected before any export runs, and the caller sees a stage that points at the wrong part of the pipeline.
#416 gave the PTX resolver
PipelineError::TargetSelectionfor exactly these rejections, which reaches the caller asCompilationStage::Input. This applies the same classification on the NVVM IR route.Changes
TargetSelection: an unparsable explicit target, an unparsable device-architecture hint, a target below a detected feature floor, a target below a generated-intrinsic floor, and the case where nothing supplied a target at all.sm_XXonce it parsed, and the raw text when it did not.targetfield means onCompileError::TargetSelection, since the no-target-supplied case has none to name.Rationale
The boundary follows what the PTX resolver already does with the same helpers.
Rejections attributable to a requested or detected target become
Input: the caller chose the target and the caller can change it.Two failures keep reporting as
Export:select_target_with_generatedfails when no target satisfies the module at all. The PTX resolver classifies this away fromInputtoo, asPtxGeneration. It reports a module the compiler cannot place on any target, which is not something a caller fixes by naming a different one.generated_ptx_isa_requirementrejects a catalogue PTX floor this compiler cannot spell. It is decided before any target is chosen, so there is no target to attribute it to.The no-target-supplied case is the one judgement call here. It reports at
Inputbecause the caller has to act on their own input, and its diagnostic already tells them which knob to reach for. It carries an emptytarget, since nothing was rejected. If you prefer a dedicated variant for that case, say so and I will split it out; the other four are unaffected either way.Validation
The new test walks all five rejection paths and asserts both the variant and
CompilationStage::Input. Reverting only the classification and keeping the test reproduces the old behaviour:cargo oxide run <example>passescargo test --workspacepassesNo example added: this changes how a failure is classified for an API caller, and the paths are covered by the unit test above. No device code is affected.
Checklist
git commit -s)