Skip to content

[SYSTEMDS-3948] Row-wise Sparsity Estimator#2466

Open
ywcb00 wants to merge 6 commits intoapache:mainfrom
ywcb00:feat/sparsity/estim/rs
Open

[SYSTEMDS-3948] Row-wise Sparsity Estimator#2466
ywcb00 wants to merge 6 commits intoapache:mainfrom
ywcb00:feat/sparsity/estim/rs

Conversation

@ywcb00
Copy link
Copy Markdown
Contributor

@ywcb00 ywcb00 commented May 6, 2026

Hi,
this PR adds the row-wise sparsity estimator from:
Lin, Chunxu, Wensheng Luo, Yixiang Fang, Chenhao Ma, Xilin Liu and Yuchi Ma;
On Efficient Large Sparse Matrix Chain Multiplication;
Proceedings of the ACM on Management of Data 2 (2024): 1 - 27.

Note that the row sparsity propagation, as described in the publication, applies to MM chains only. Other operations use fallback methods for sparsity estimation w/ row sparsity vectors, which create a cut in the sparsity estimation DAG.

ywcb00 added 6 commits April 30, 2026 09:43
…ise sparsity estimator

	works for the matrix multiplication and bind test cases for now
…ontainer for row wise sparsity vectors to simplify access and allow storing it with chain nodes
…mator with element-wise and single operations
…wise and single operations

	NOTE: using average case estimation per row
Copy link
Copy Markdown
Contributor

@Baunsgaard Baunsgaard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some comments. hope it helps.

}


// Row Wise Sparsity Estimator
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can optionally have all of these classes extend another class where you add these tests. Instead of copying the code on all of them.

private final static int k = 300;
private final static double sparsity = 0.2;
// private final static OpCode eqzero = OpCode.EQZERO;
// private final static OpCode eqzero = OpCode.EQZERO;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion remove this edit, or do a followup PR that cleans it up.

Comment on lines +242 to +251
// Row Wise Sparsity Estimator
// @Test
// public void testRowWiseEqzero() {
// runSparsityEstimateTest(new EstimatorRowWise(), m, k, sparsity, eqzero);
// }

// @Test
// public void testRowWiseDiag() {
// runSparsityEstimateTest(new EstimatorRowWise(), m, m, sparsity, diag);
// }
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are these removed?

case PLUS:
case NEQZERO:
case EQZERO:
return new MatrixCharacteristics(nodeLeft.getRows(), nodeLeft.getCols(),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consider calling the getters above the switch case, to avoid all these repeated calls.

}
}

public static class RSVector {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrapping the double[] primitive is not really good practice. This adds an indication that the JIT compiler have to resolve, and slows you down. I would suggest not adding this to the code. and instead on the individual functions code up the solution without this functional indirection.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

2 participants