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
263 changes: 97 additions & 166 deletions docs/spec/analysis.md

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions docs/spec/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -388,10 +388,10 @@ explicit analysis; there is no ordinary `--target` option.
- `--topology LEVEL` MUST be optional, passed through as the public analysis
operation's `topology_level`, and name the unit for per-unit figures. Its help MUST
state the default and, for every family, which figure changes with the level
and when to pass it, together with the global-traffic and observed-peak
assumptions. Compute cost MUST name `flops_per_unit` and `service_per_unit`
as its projected figures while keeping `flops` and `service` explicitly
global; movement MUST name `TrafficMetadata.per_unit` against `whole`.
and when to pass it, together with the logical/total traffic distinction and
the observed-peak assumption. Compute cost MUST distinguish `logical`,
`total`, and each topology level's per-unit share; movement MUST name the
`MemoryMetadata.traffic.storage` per-unit account against `total`.
With no analysis flag it MUST be accepted and inert.
- `--dim NAME=EXTENT` MUST bind one dimension the selection leaves open, and
MUST be repeatable to bind several. One dimension MUST receive one extent;
Expand Down
6 changes: 3 additions & 3 deletions docs/spec/code-organization.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,16 @@ truth for the directory's structure and invariants.
| `analysis/errors.py` | [analysis](./analysis.md) | `AnalysisError`, the one diagnostic the whole analysis layer raises, so catching an analysis failure catches every analysis failure rather than the subset the caller happened to import. |
| `analysis/visitor.py` | [analysis](./analysis.md) | The per-call `AnalyzeContext`, carrying the shared root/current `IterationScope` while a family traverses its work. |
| `analysis/iteration_scope.py` | [analysis](./analysis.md) | The shared `IterationScope` tree built once from normalized HIR; families query it instead of constructing parallel structure. |
| `analysis/access.py` | [analysis](./analysis.md) | Access relations resolved against the authored iteration scopes. |
| `analysis/access.py` | [analysis](./analysis.md) | Access relations resolved against authored iteration scopes, retaining each input's original boundary index. |
| `analysis/loop_domain.py` | [analysis](./analysis.md) | isl iteration domains built from authored loop bounds. |
| `analysis/loop_terms.py` | [analysis](./analysis.md) | IR-only resolution of constants, authored loop axes, strides, and bounded invariant offsets into `LoopTerm`; it has no isl dependency. |
| `analysis/footprint.py` | [analysis](./analysis.md) | Reserved for future target-independent authored-loop footprint policy; access-relation construction stays in `analysis/access.py`. |
| `analysis/report.py` | [analysis](./analysis.md) | Structured analysis report data, including record-family registration, field serialization, and target-aware report-only projections. It depends only on analysis/core modules; inspection consumes it to produce text and source annotations. |
| `analysis/report.py` | [analysis](./analysis.md) | Structured analysis report data, including record-family registration and field serialization. It depends only on analysis/core modules; inspection consumes it to produce text and source annotations. |
| `analysis/check.py` | [analysis](./analysis.md) | The shared authored-program gate for analysis: authored-type re-derivation, authored validation, call-context validation, and checker-specific input checks. Established once per public call rather than per family. |
| `analysis/facts.py` | [analysis](./analysis.md) | The narrow Facts aggregates the analysis families declare — the memory hierarchy graph, the throughput rates, and the parallel capacity. It is the record of how much hardware each measurement rests on, and names no backend; a Fact shared across consumer families belongs in `target/facts.py`. |
| `analysis/metadata.py` | [analysis](./analysis.md) | The typed records the families leave on the IR, split by what each number depends on rather than by convenience. |
| `analysis/compute_cost.py` | [analysis](./analysis.md) | The `compute-cost` family: logical flops per DType and bytes per storage level, from the authored program alone. |
| `analysis/memory.py` | [analysis](./analysis.md) | The `memory` family: value lifetimes, per-level peaks, and the capacity comparisons against a target's hierarchy — failing on an over-full addressable level and advising on an over-full cache. |
| `analysis/memory.py` | [analysis](./analysis.md) | The `memory` family: per-Call movement plus Function-wide movement, value lifetimes, per-level peaks, and non-fatal capacity errors for over-full addressable levels. |
| `analysis/roofline.py` | [analysis](./analysis.md) | The `roofline` family: the recorded work divided by the target's published rates, per Call and aggregated per Function. Adds no count of its own. |
| `analysis/performance.py` | [analysis](./analysis.md) | The `performance` family: occurrences projected from the shared `IterationScope` tree into flat timeline records and one function envelope, scaled by parallel capacity. It introduces no second scope tree. |
| `visitor_registry/` | [visitor-registry](./visitor-registry.md) | Shared registry instances and derived visitors: access-relation construction, contexts, ISL helpers, relation building, shard propagation, type inference, verification, code generation, and cost evaluation. |
Expand Down
5 changes: 3 additions & 2 deletions docs/spec/inspection.md
Original file line number Diff line number Diff line change
Expand Up @@ -551,5 +551,6 @@ class DumpScope:
A non-master worker appends `__<worker-id>` to the test-name leaf rather
than adding a worker directory. `pytest.mark.no_dump` disables it.
- A completed `analyze(...)` call MUST dump its complete report data as
`analysis.json` when `DumpFlags.ANALYSIS` is enabled. This includes
target-aware report-only projections such as authored-loop cache pressure.
`analysis.json` when `DumpFlags.ANALYSIS` is enabled. Every conclusion in
that dump MUST come from the selected typed records; the report layer MUST
NOT reconstruct target-aware findings that no record carries.
8 changes: 4 additions & 4 deletions docs/tutorial/optimize.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@
{
"name": "stdout",
"output_type": "stream",
"text": "# traffic traffic=gmem:r71680/w43456@total,r71680/w43456@cta,r336/w224@thread;rmem:r603496/w488344@total,r603496/w488344@cta,r2604/w2084@thread\n# roofline ideal-ns=24 bound-by=memory\n"
"text": "# memory traffic=gmem:r71680/w43456@logical,r71680/w43456@total,r71680/w43456@cta,r336/w224@thread;rmem:r603496/w488344@logical,r603496/w488344@total,r603496/w488344@cta,r2604/w2084@thread peak=gmem:71680;rmem:57344 persistent=43008\n# roofline ideal-ns=24 bound-by=memory\n"
}
],
"source": [
"%%bash\nset -euo pipefail\ntilefoundry analyze rms_norm_quant.py:Naive Naive.txt --compute-cost --memory --roofline\ngrep -E '^# (traffic|roofline) ' Naive.txt\n"
"%%bash\nset -euo pipefail\ntilefoundry analyze rms_norm_quant.py:Naive Naive.txt --compute-cost --memory --roofline\ngrep -E '^# (memory|roofline) ' Naive.txt\n"
]
},
{
Expand Down Expand Up @@ -94,11 +94,11 @@
{
"name": "stdout",
"output_type": "stream",
"text": "# traffic traffic=gmem:r43008/w14784@total,r43008/w14784@cta,r224/w112@thread;rmem:r574824/w459672@total,r574824/w459672@cta,r2492/w1972@thread\n# roofline ideal-ns=13 bound-by=memory\n"
"text": "# memory traffic=gmem:r43008/w14784@logical,r43008/w14784@total,r43008/w14784@cta,r224/w112@thread;rmem:r574824/w459672@logical,r574824/w459672@total,r574824/w459672@cta,r2492/w1972@thread peak=gmem:57792;rmem:57344 persistent=43008\n# roofline ideal-ns=13 bound-by=memory\n"
}
],
"source": [
"%%bash\nset -euo pipefail\ntilefoundry analyze rms_norm_quant.py:Fused Fused.txt --compute-cost --memory --roofline\ngrep -E '^# (traffic|roofline) ' Fused.txt\n"
"%%bash\nset -euo pipefail\ntilefoundry analyze rms_norm_quant.py:Fused Fused.txt --compute-cost --memory --roofline\ngrep -E '^# (memory|roofline) ' Fused.txt\n"
]
},
{
Expand Down
8 changes: 4 additions & 4 deletions docs/tutorial/optimize.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,11 @@ class Naive:
```bash
set -euo pipefail
tilefoundry analyze rms_norm_quant.py:Naive Naive.txt --compute-cost --memory --roofline
grep -E '^# (traffic|roofline) ' Naive.txt
grep -E '^# (memory|roofline) ' Naive.txt
```

```text
# traffic traffic=gmem:r71680/w43456@total,r71680/w43456@cta,r336/w224@thread;rmem:r603496/w488344@total,r603496/w488344@cta,r2604/w2084@thread
# memory traffic=gmem:r71680/w43456@logical,r71680/w43456@total,r71680/w43456@cta,r336/w224@thread;rmem:r603496/w488344@logical,r603496/w488344@total,r603496/w488344@cta,r2604/w2084@thread peak=gmem:71680;rmem:57344 persistent=43008
# roofline ideal-ns=24 bound-by=memory
```

Expand Down Expand Up @@ -128,11 +128,11 @@ class Fused:
```bash
set -euo pipefail
tilefoundry analyze rms_norm_quant.py:Fused Fused.txt --compute-cost --memory --roofline
grep -E '^# (traffic|roofline) ' Fused.txt
grep -E '^# (memory|roofline) ' Fused.txt
```

```text
# traffic traffic=gmem:r43008/w14784@total,r43008/w14784@cta,r224/w112@thread;rmem:r574824/w459672@total,r574824/w459672@cta,r2492/w1972@thread
# memory traffic=gmem:r43008/w14784@logical,r43008/w14784@total,r43008/w14784@cta,r224/w112@thread;rmem:r574824/w459672@logical,r574824/w459672@total,r574824/w459672@cta,r2492/w1972@thread peak=gmem:57792;rmem:57344 persistent=43008
# roofline ideal-ns=13 bound-by=memory
```

Expand Down
Loading
Loading