[native] linalg implementations deep copy input arrays
- Dominant language
- Kotlin
- Stars
- 734
- Forks
- 51
- Avg merge
- 9h 52m
- Merged PRs (30d)
- 6
Description
Hi guys,
I saw functions in NativeLinAlgEx in multi-openblas deep copy the input arrays. Some of the examples are shown below.
```
override fun solve(a: MultiArray, b: MultiArray): NDArray =
solveCommon(a.toType(CopyStrategy.MEANINGFUL), b.toType(CopyStrategy.MEANINGFUL))`
override fun solveF(a: MultiArray, b: MultiArray): NDArray =
solveCommon(a.deepCopy(), b.deepCopy())`
override fun solveC(a: MultiArray, b: MultiArray): NDArray =
solveCommon(a.deepCopy(), b.deepCopy())
```
I wonder whether deep copy is in fact needed. In our use cases, we slice a matrix many times and pass the sub-matrices to the solver. Deep copying them is suboptimal.
Thanks in advance for your help!
Best,
Max
Contributor guide
Research direction
Start by reviewing the NativeLinAlgEx implementations in multi-openblas, especially solve, solveF, and solveC, and trace how their input arrays are passed to solveCommon. Determine whether sliced inputs remain safe without deep copies; done means the copying behavior is resolved and the affected implementations are covered by appropriate validation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- kotlin
- Domain
- performance
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100