Mangle a Vararg whose length is still a TypeVar - #921
Open
vchuravy wants to merge 1 commit into
Open
Conversation
`mangle_param` repeats the element type `N` times for an `NTuple`, but `N`
is a `TypeVar` rather than an integer whenever the length is still
parametric — which is exactly what the `UnionAll` branch above leaves
behind after `unwrap_unionall`. `1:t.N` then throws
`MethodError: (::Colon)(::Int64, ::TypeVar)`.
Such a type is `==` to the unbounded `Vararg{T}`, so mangle it the same
way: `NTuple{N,Int} where N` and `Tuple{Vararg{Int}}` both give
`Tuple<>`. A concrete count is unaffected.
This is reachable from any job now that `relocation_namespace` mangles
every job's signature, not just a kernel's: Enzyme.jl hits it on
GPUCompiler 2.x compiling a signature that carries such a type.
Assisted-by: Claude Code (Opus 5)
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #921 +/- ##
=======================================
Coverage 85.41% 85.42%
=======================================
Files 29 29
Lines 5582 5583 +1
=======================================
+ Hits 4768 4769 +1
Misses 814 814 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
mangle_paramrepeats the element typeNtimes for anNTuple, butNis aTypeVarrather than an integer whenever the length is still parametric — which is exactly what theUnionAllbranch just above it leaves behind afterunwrap_unionall.1:t.Nthen throws:Such a type is
==to the unboundedVararg{T}, so this mangles it the same way —NTuple{N,Int} where NandTuple{Vararg{Int}}both giveTuple<>. A concrete count is unaffected.This became reachable from any job once
relocation_namespacestarted mangling every job's signature rather than only a kernel's: Enzyme.jl hits it on GPUCompiler 2.x (EnzymeAD/Enzyme.jl#3512) while compiling a signature that carries one of these types.🤖 Generated with Claude Code
https://claude.ai/code/session_01XmMWGrDGbAaajpehN7cAhW