Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion docs/design_docs/decisions/cse-cost-model.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
# CSE sharing: rule-based vs. cost-based framework (issue #237)
# Common sub-DAG sharing: rule-based vs. cost-based framework (issue #237)

> Status: accepted decision for the implementation described here.

## Context

Sub-DAG sharing means multiple consumers reference one operator and its
upstream dependencies. Common sub-DAG sharing uses CSE (common subexpression
elimination) to identify eligible, structurally identical computations. A
shared logical node records an opportunity for reuse; selecting maintained
state or independent execution is a separate planning decision.

[`asap_types::pre_asap::cse::share_common_sub_dags`](../../../crates/types/src/pre_asap/cse.rs)
(issue #223 stages 1-2, PR #235) already *detects* every structurally-identical,
legally-shareable (`Schema::unique_keys`-gated) sub-DAG and shares it
Expand Down
5 changes: 4 additions & 1 deletion docs/design_docs/proposals/planner-layering.md
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,10 @@ exploits.

#### Pass 2: ASAP-aware common-subexpression elimination

ASAP-aware CSE extends traditional CSE with summary-specific sharing rules.
**Sub-DAG sharing** means several consumers reference one operator and its
upstream dependencies. Traditional CSE provides common sub-DAG sharing for
eligible, structurally identical computations. ASAP-aware CSE extends it with
summary-specific sharing rules.
Computations can share work when they use identical expressions, when one
summary build node supports several estimates, or when one window summary can answer
their overlapping windows.
Expand Down
6 changes: 3 additions & 3 deletions docs/develop_docs/asap-aware-mapping-architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ Terminology used in the diagram:
realizes an operation as a concrete ASAP realization; **post-ASAP** means
the resulting realization form.
- A **DAG** (directed acyclic graph) represents query operators whose sub-DAGs
may be shared. **CSE** (common subexpression elimination) finds equivalent
sub-DAGs and represents legal reuse by making them the same shared node.
Rust's `Rc<T>` (reference-counted pointer) records that shared node identity.
may be shared. See [sub-DAG sharing and ASAP-aware CSE](../design_docs/proposals/planner-layering.md#pass-2-asap-aware-common-subexpression-elimination)
for the sharing rules. Rust's `Rc<T>` (reference-counted pointer) records
shared node identity.
- A **target** is one replaceable site. A **candidate** is one valid alternative
for it. `Replacement::Summary` is a constructed post-ASAP summary—maintained state
such as an exact accumulator or an approximate sketch—while
Expand Down
Loading