New Issue: Handling array views correctly in the LinearAlgebra module

18159, "e-kayrakli", "Handling array views correctly in the LinearAlgebra module", "2021-08-04T17:48:13Z"

We became aware of this issue with Incorrect result with dot(mat, mat[.., 1]) when using BLAS · Issue #18118 · chapel-lang/chapel · GitHub, which will be worked around via Avoid Passing Array View to C_BLAS by ShreyasKhandekar · Pull Request #18134 · chapel-lang/chapel · GitHub.

We should probably audit the uses of arrays in linear algebra module while keeping in mind that in fact they could be array views. Most likely, all native uses of them should be fine, however passing them to extern functions like those that are in BLAS and LAPACK needs adjusting. That's because our interop is currently not aware of array views and some views could correspond to non-contiguous memory. Passing ArrayViews to extern procs should protected · Issue #18135 · chapel-lang/chapel · GitHub captures the general issue with interoperability and the array views.

As a detail, Avoid Passing Array View to C_BLAS by ShreyasKhandekar · Pull Request #18134 · chapel-lang/chapel · GitHub "fixes" this by copying the argument if it is an array view into an array before passing it to a BLAS function. While we're making such changes, we could probably be more surgical and somehow check if the view is not contiguous.