Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Fix some inferability issues in SparseArrays #41187

Merged
merged 2 commits into from
Jun 16, 2021

Conversation

martinholters
Copy link
Member

Retry #39207. That one had its tests failing on AArch64 and hence, was reverted in #40332. Redoing the same changes against master also resulted in a failing test for hvcat, so I've tweaked that a bit more. This PR includes the original tests for now to see how CI feels about them. If there are again platform-dependent inference issues, we can discuss whether we just remove the tests or try to figure out the root cause.

The helper function `_findr` would usually return a `Vector` as first
argument, but would use a `SparseMatrixCSC` in the empty case. Fix by
always using `Vector`.
This also requires making sparse `vcat` and `hcat` inferable in the
vararg case which in turn requires a different way to determine the
resulting index type, now implemented similar to `promote_eltype`.
@dkarrasch dkarrasch added compiler:inference Type inference sparse Sparse arrays labels Jun 11, 2021
@martinholters
Copy link
Member Author

CI looks good (although tester_linux32 seems to be missing). Any objections against merging?

@ViralBShah
Copy link
Member

Looks like tester_linux32 came through.

@ViralBShah ViralBShah merged commit d98fb01 into master Jun 16, 2021
@ViralBShah ViralBShah deleted the mh/sparse-type-stability branch June 16, 2021 21:05
johanmon pushed a commit to johanmon/julia that referenced this pull request Jul 5, 2021
* Fix a type-instability in sparse `findmin`/`findmax`

The helper function `_findr` would usually return a `Vector` as first
argument, but would use a `SparseMatrixCSC` in the empty case. Fix by
always using `Vector`.

* Make sparse `hvcat` inferable

This also requires making sparse `vcat` and `hcat` inferable in the
vararg case which in turn requires a different way to determine the
resulting index type, now implemented similar to `promote_eltype`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler:inference Type inference sparse Sparse arrays
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants