ALIR Graph Optimization
alkaid.trace.passes.optimize() applies general graph rewrites after tracing. Note that these does not include the CMVM optimization itself as it is applied during tracing.
Currently, the main optimization loop does the following:
canonicalization
dead-code elimination
common-subexpression elimination
no-op quantization op elimination
code retracing
surrogate model (cost/latency estimation)
topological live range minimization (for fast ALIR interpretation)
Ternary Adder Fusion
Ternary adder fusion is applied after pipelining/before code emission as it is very hardware dependent. RTLModel and HLSModel apply ternary fusion by default. Pass ternary_fuse=False to either constructor, or use alkaid convert --no-ternary, to retain binary adders.