[SYSTEMDS-3891] Add OOC Reshape Primitive - #2619
jessicapriebe wants to merge 2 commits into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2619 +/- ##
=============================================
+ Coverage 71.41% 74.92% +3.50%
=============================================
Files 1642 436 -1206
Lines 197165 25237 -171928
Branches 38306 0 -38306
=============================================
- Hits 140815 18909 -121906
+ Misses 45279 6328 -38951
+ Partials 11071 0 -11071
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Baunsgaard
left a comment
There was a problem hiding this comment.
Just because i was curious on the OOC operator i took a look. However, it was not super decipherable from the PR for me, so I thought I would leave some hints to clean it up and make it readable.
All just suggestions.
| try(ReservationBudget budget = AllocatedOOCStream.detachBudget(callback)) { | ||
| if(budget == null) | ||
| throw new DMLRuntimeException("Missing admitted output budget"); | ||
|
|
||
| IndexedMatrixValue imv = callback.get(); | ||
| MatrixBlock blk = (MatrixBlock) imv.getValue(); | ||
| long r = imv.getIndexes().getRowIndex(); | ||
| long c = imv.getIndexes().getColumnIndex(); | ||
| long rIdx; | ||
| long cIdx; | ||
|
|
||
| int n = _byRow ? blk.getNumRows() : blk.getNumColumns(); | ||
| for(int i = 0; i < n; i++) { | ||
| MatrixBlock slice; | ||
| if(_byRow) { | ||
| slice = blk.slice(i, i); | ||
| rIdx = (r - 1) * _blen + i + 1; | ||
| cIdx = c; | ||
| } | ||
| else { | ||
| slice = blk.slice(0, blk.getNumRows() - 1, i, i); | ||
| cIdx = (c - 1) * _blen + i + 1; | ||
| rIdx = r; | ||
| } | ||
|
|
||
| long targetIdx = _byRow ? (rIdx - 1) * numColBlocks + c - 1 : (cIdx - 1) * numRowBlocks + r - 1; | ||
| IndexedMatrixValue sliceImv = new IndexedMatrixValue(new MatrixIndexes(rIdx, cIdx), slice); | ||
| budget.reserveBlocking(singleSliceBytes); | ||
| table.put((int) targetIdx, new ManagedPayload<>(sliceImv, singleSliceBytes, budget)); | ||
| } | ||
| } | ||
| catch(IllegalStateException e) { | ||
| throw new DMLRuntimeException(e); | ||
| } |
There was a problem hiding this comment.
I would suggest to try to move these lambda functions out to simplify the methods. Try to reduce them to 10-20 lines max per function.
No description provided.