mboehm7 commented on pull request #1159:
URL: https://github.com/apache/systemds/pull/1159#issuecomment-761688647


   Thanks for the initial document. The individual DAGs are delineated by 
conditional control flow and hence, there is only limited potential for doing 
CSE on sub-sequences of program blocks (and thus, DAGs). Doing CSE across 
control flow (e.g., across branches and loops) is possible but is not the first 
step for extensions. 
   
   I would recommend to focus on a single DAG with commutative operations like 
`A + 7` and `7 + A`, which are currently only indirectly eliminated (for plus 
and add, but not for `max(A,B)` vs `max(B,A)`). There are approaches: (1) 
either introduce canonicalization rewrites that systematically order inputs 
(e.g., by hop ID) or (2) extend the actual CSE rewrite for consider such 
permutations. I would recommend approach (1) which would be best added to  
`RewriteAlgebraicSimplificationDynamic` as this canonicalization rewrite would 
need to check for matrix sizes too as we only support broadcasting (e.g., 
matrix vector elementwise operations) on the right hand side. 
   
   The scope of operations could be: OpOpN - MIN, MAX, PLUS, as well as OpOp2 - 
AND, OR, XOR, COV, EQUAL, NOTEQUAL, MIN, MAX, PLUS, MULT, and potentially other 
comparisons but they additionally require modifications of the comparison 
operator on reordering. 


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to