Open paul-tqh-nguyen opened 2 years ago
@jim22k and I discussed this. It seems that graphblas.apply
with an inplace
attribute will solve all the use cases we've seen of this situation in GraphWave.
One other optimization worth considering is the cases where we have:
negative_a = irb.arith.mulf(a, c_negative_1_f64)
factor = irb.graphblas.apply(eye, "second", right=negative_a)
irb.graphblas.update(L, factor, "plus")
A cursory look at GraphWave brought this motivation for the original plan to my attention:
signal = eye
# ...
negative_signal = irb.graphblas.apply(signal, "ainv")
irb.graphblas.update(negative_signal, twf_cur, "plus")
This could be optimized to:
c_negative_1_f64 = irb.arith.constant(-1, "f64")
irb.graphblas.update(c_negative_1_f64, twf_cur, "plus", mask=signal)
This is found in GraphWave and is the only instance I've found.
@jim22k, got any thoughts? I'm thinking since graphblas.apply
with an inplace
attribute solves the majority of cases, we should move this example to a new issue with lower priority.
I agree with restricting this issue to graphblas.apply
with inplace
.
The other case you found with the scalar and a mask is actually part of graphblas.assign
, which we haven't written yet. We should tackle assign
sometime this quarter because it is useful.
I don't think this case is handled yet. I think we should be able to fuse the 2
graphblas.apply
ops and thegraphblas.update
op into a single op (eithergraphblas.apply_generic
or some new op).This is motivated by GraphWave.