Groundwork for number type separation#3034
Open
oschulz wants to merge 2 commits into
Open
Conversation
1430173 to
069a07c
Compare
Loosen invariant `TracedRNumber{T}`/`TracedRArray{T,N}` type parameters to
covariant `<:` bounds in method signatures and type aliases. These are
no-ops today (the types are concrete) but make the signatures robust to
element types that subtype the traced numbers.
Deliberately left invariant:
- the `AnyTracedRArray` alias: a covariant bound would match
`Vector{Union{}}` (the type of empty array literals), which must not be
routed into the traced-array machinery (EnzymeAD#1290);
- the `promote_rule` methods against `Missing`/`Nothing` and the
`LinRange`/`StepRangeLen` `getindex` resolver: these are exact-shape
disambiguators, and loosening them makes their specificity against
their Base counterparts undecidable (method ambiguities).
Created by generative AI.
…ed array
`similar(::ConcreteArray, ::Type{S}, dims)` passed `S` straight to the device
buffer, whose `primitive_type(S)` is undefined for wrapped Reactant number
types. This surfaced as a `MethodError` from LinearAlgebra's generic `\`
(and other `similar`-based allocations) when a concrete array meets a traced
result element type during tracing, e.g. `UpperTriangular(m) \ b` with a
captured concrete `b`. A concrete buffer cannot hold traced values, so route
such requests to a `TracedRArray` of the unwrapped element type.
Created by generative AI.
069a07c to
25f12ff
Compare
Contributor
Author
|
Test failures are unrelated, I think. |
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.
Basis for #2170 .