Skip to content

docs(asap-aware-mapping): correct module doc on where CSE detection runs - #229

Merged
zzylol merged 1 commit into
mainfrom
docs/cse-placement-decision
Aug 22, 2026
Merged

zzylol merged 1 commit into
mainfrom
docs/cse-placement-decision

Conversation

@zzylol

@zzylol zzylol commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Summary

Records the placement decision settled in #222: common sub-expression
elimination (CSE) detection is a primary pass over the pre-ASAP
QueryExpr IR (asap-types::pre_asap), not something asap-aware-mapping
does. The algorithm itself is tracked separately in #223 (design doc,
implemented by a different workstream); this PR only corrects the
documentation to reflect the decision.

asap-aware-mapping's own module doc (crates/asap-aware-mapping/src/lib.rs)
previously claimed "which shared sub-expressions to hoist" as this crate's
job — that was aspirational text with no backing implementation, and per
#222 it's also simply the wrong layer for CSE detection to live. This PR
corrects that doc comment to say:

  • Primary CSE detection lives in asap-types::pre_asap (design in Design: pre-ASAP structural CSE via bottom-up hash-consing over Rc<QueryExpr> #223),
    running before a tree ever reaches bind::implement_tree.
  • asap-aware-mapping may eventually run a secondary, narrower CSE pass
    of its own over an already-implement_tree'd SummaryNode DAG —
    recognizing post-ASAP-only sharing such as Quantile(x, 0.99) and
    Quantile(x, 0.95) sharing one built sketch, read out twice — but that
    is downstream of, and not a substitute for, the primary pre-ASAP pass.

crates/asap-aware-mapping/src/cost_model.rs's module doc ("workload-level
CSE credit" as a planned cost-model input) was checked and left unchanged —
it only speaks to cost-model ranking, which is downstream of detection, and
doesn't claim this crate does detection itself. docs/*.md were checked
too; none currently discuss CSE placement, so there was nothing to correct
there.

I've also posted a comment on #212 (the parent "add CSE" issue) recording
this decision against its own "Where it runs." open question.

Scope

No runtime/behavior changes — module-doc comment only. cargo build --workspace --all-targets, cargo test --workspace, cargo fmt --all -- --check, and cargo clippy --workspace --all-targets --all-features -- -D warnings all pass unchanged.

Closes #222

Test plan

  • cargo build --workspace --all-targets
  • cargo test --workspace
  • cargo fmt --all -- --check
  • cargo clippy --workspace --all-targets --all-features -- -D warnings

🤖 Generated with Claude Code

Records the placement decision settled in #222: common sub-expression
elimination detection is a primary pass over the pre-ASAP QueryExpr IR
(asap-types::pre_asap, design tracked in #223), not something
asap-aware-mapping hoists after binding. This crate's module doc
previously claimed "which shared sub-expressions to hoist" as its own
job, but no such pass existed here or was ever meant to be primary.

asap-aware-mapping may still eventually run a secondary, narrower CSE
pass over already-implement_tree'd SummaryNodes, recognizing sharing
that's invisible at the pre-ASAP level (e.g. two different accuracy
targets on the same Quantile can share one built sketch) -- but that
is downstream of, not a substitute for, the primary pre-ASAP pass.

Part of #222

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@zzylol
zzylol merged commit 07c99e3 into main Aug 22, 2026
3 checks passed
@zzylol
zzylol deleted the docs/cse-placement-decision branch August 22, 2026 20:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CSE detection should run in pre-ASAP IR; post-ASAP can run a secondary pass

1 participant