FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

api: let host() copy sparse arrays as dense by melonakos · Pull Request #3723 · arrayfire/arrayfire · GitHub

Repository navigation

api: let host() copy sparse arrays as dense - #3723

Draft
melonakos wants to merge 2 commits into
masterfrom
fix/3703-sparse-host
Draft

melonakos wants to merge 2 commits into
masterfrom
fix/3703-sparse-host

Conversation

melonakos commented Sep 10, 2026 •
edited
Loading

Copy link
Copy Markdown
Member

Calling host() on a sparse array threw:

Invalid argument at index 0
Expected: info->isSparse() == false

host() sizes its buffer from elements(), which already reports the dense shape for a sparse array, so af_get_data_ptr now converts CSR and COO arrays to dense and copies that. CSC to dense is not implemented anywhere, so a CSC array fails with AF_ERR_NOT_SUPPORTED and a message saying to convert to CSR or COO first; the C++ and C docs say the same. Callers who relied on the old error to detect sparse arrays now get data instead, which is worth a line in the release notes. Tests cover the reported case and compare host() against the dense source for CSR and COO; the sparse suite passes on the CPU backend (88 tests). Fixes #3703.

host() sizes its buffer from elements(), which reports the dense shape for a sparse array, but af_get_data_ptr then rejected the array with "Expected: info->isSparse() == false". Convert to dense first and copy that, and say so in the docs. Fixes #3703.
CSC to dense is not implemented, so host() on a CSC array now fails with AF_ERR_NOT_SUPPORTED and a message instead of an argument error from deep inside the conversion. The docs say CSR and COO. The test gains an fp64 guard and a case that compares host() against the dense source for CSR and COO and expects the CSC rejection.
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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Sparse host call throws

1 participant


Back | FazBrowse Home | New Git URL