Skip to content

inference: apply tmerge limit elementwise to the Union (#50927) #214

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
wants to merge 1 commit into
base: v1.10.2+RAI
Choose a base branch
from

Conversation

kpamnany
Copy link
Collaborator

@kpamnany kpamnany commented Feb 10, 2025

PR Description

This allows forming larger unions, as long as each element in the Union is both relatively distinct and relatively simple. For example:

tmerge(Base.BitSigned, Nothing) == Union{Nothing, Int128, Int16, Int32, Int64, Int8}
tmerge(Tuple{Base.BitSigned, Int}, Nothing) == Union{Nothing, Tuple{Any, Int64}}
tmerge(AbstractVector{Int}, Vector) == AbstractVector

Disables a test from dc8d885, which does not seem possible to handle currently.

This makes somewhat drastic changes to make this algorithm more commutative and simpler, since we dropped the final widening to Any.

Checklist

Requirements for merging:

@kpamnany
Copy link
Collaborator Author

Doesn't fix the failure.

@kpamnany kpamnany closed this Feb 10, 2025
@kpamnany kpamnany deleted the kp-backport-50927 branch February 10, 2025 16:52
@kpamnany kpamnany restored the kp-backport-50927 branch April 15, 2025 18:51
@kpamnany kpamnany reopened this Apr 15, 2025
This allows forming larger unions, as long as each element in the Union
is both relatively distinct and relatively simple. For example:

    tmerge(Base.BitSigned, Nothing) == Union{Nothing, Int128, Int16, Int32, Int64, Int8}
    tmerge(Tuple{Base.BitSigned, Int}, Nothing) == Union{Nothing, Tuple{Any, Int64}}
    tmerge(AbstractVector{Int}, Vector) == AbstractVector

Disables a test from dc8d885, which does not seem possible to handle currently.

This makes somewhat drastic changes to make this algorithm more
commutative and simpler, since we dropped the final widening to `Any`.

Co-authored-by: pchintalapudi <34727397+pchintalapudi@users.noreply.github.com>
Co-authored-by: Oscar Smith <oscardssmith@gmail.com>
@kpamnany kpamnany force-pushed the kp-backport-50927 branch from 541e83b to f098f5c Compare April 15, 2025 18:53
@kpamnany kpamnany requested a review from Drvi April 15, 2025 18:56
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants