A graphblas.apply operation that optimizes this line y = 2 / N * np.exp(-tau / lmax * (a * num + a)) where num is a sparse tensor and everything else is a scalar. If we port the line to the GraphBLAS dialect naively following the PEMDAS order of operations, we'd get a ton of graphblas.apply calls. Ideally, we'd change the ordering to be y = 2 / N * np.exp((-tau / lmax * a) * (num + 1)) so that we'd only have 3 graphblas.apply calls. I'm not sure how much this matters or if it'll all get optimized away anyway via graphblas.apply_generic during lowering. This is not a contrived example as this line is used in GraphWave.
We should review all of our algorithms to see if there are any ops we need.
The minimum work that should be done for this ticket is:
we should review the explicit examples given above.
we should look at all the algorithms in algorithms.py, look at all the scf.for, scf.while, and scf.if ops (and all ops from the scf dialect) to see if we can't abstract out those ops into graphblas ops.
A lot of our algorithms in
algorithms.py
have workarounds for ops that we don't have yet.Some ops we might need include:
graphblas.concat
with anaxis
attribute that will allow us to concatenate/stack tensors (matrices and vectors). https://github.com/metagraph-dev/mlir-graphblas/issues/251 is relevant to this idea.graphblas.apply
op that doesn't create a whole new sparse matrix. https://github.com/metagraph-dev/mlir-graphblas/discussions/232#discussioncomment-1762517 is relevant to this idea. This might also apply tographblas.select
.graphblas.apply
operation that optimizes this liney = 2 / N * np.exp(-tau / lmax * (a * num + a))
wherenum
is a sparse tensor and everything else is a scalar. If we port the line to the GraphBLAS dialect naively following the PEMDAS order of operations, we'd get a ton ofgraphblas.apply
calls. Ideally, we'd change the ordering to bey = 2 / N * np.exp((-tau / lmax * a) * (num + 1))
so that we'd only have 3graphblas.apply
calls. I'm not sure how much this matters or if it'll all get optimized away anyway viagraphblas.apply_generic
during lowering. This is not a contrived example as this line is used in GraphWave.We should review all of our algorithms to see if there are any ops we need.
The minimum work that should be done for this ticket is:
algorithms.py
, look at all thescf.for
,scf.while
, andscf.if
ops (and all ops from thescf
dialect) to see if we can't abstract out those ops into graphblas ops.