lakeroad icon indicating copy to clipboard operation
lakeroad copied to clipboard

Deduplicate sub-expressions/sub-circuits in design (antiunification?)

Open gussmith23 opened this issue 1 year ago • 4 comments

In my generals talk, I proposed deduplicating "instructions" from a hardware design using a set of rewrites: image

The rewrites looked like, e.g.:

(binop ?op ?bw (apply (instr ?ast0 ?canonical-args0) ?args0) (apply (instr ?ast1 ?canonical-args1) ?args1))
 => (apply (instr (binop-ast ?op ?bw ?ast0 ?ast1) (canonicalize (concat ?args0 ?args1))) 
           (concat ?args0 ?args1))

(binop ?op ?bw ?left (apply (instr ?ast1 ?canonical-args1) ?args1)) 
 => (apply (instr (binop-ast ?op ?bw (hole ?bw) ?ast1) (canonicalize (concat (list ?left) ?args1))) 
           (concat (list ?left) ?args1))

(binop ?op ?bw (apply (instr ?ast0 ?canonical-args0) ?args0) ?right) 
 => (apply (instr (binop-ast ?op ?bw ?ast0 (hole ?bw)) (canonicalize (concat ?args0 (list ?right)))) 
           (concat ?args0 (list ?right))) 

(binop ?op ?bw ?a ?b) 
 => (apply (instr (binop-ast ?op ?bw (hole ?bw) (hole ?bw)) (canonicalize (list ?a ?b))) 
           (list ?a ?b))

This was around the same time as the Babble paper, which used a very similar idea of deduplicating "instructions" -- they called it Antiunification.

This issue tracks the incorporation of this idea into Lakeroad: whether or not we should do it, how it should be done, and other questions.

gussmith23 avatar Nov 05 '23 19:11 gussmith23