Skip to content

docs(explanation): flexibility at every compile stage, with exact GELU as the example - #1432

Merged
michalharakal merged 2 commits into
developfrom
docs/compile-flexibility-gelu
Oct 21, 2026
Merged

michalharakal merged 2 commits into
developfrom
docs/compile-flexibility-gelu

Conversation

@michalharakal

Copy link
Copy Markdown
Contributor

What

A new Explanation page (Divio quadrant: understanding, not steps): explanation/compile-flexibility.adoc, "Flexibility at every compile stage".

It covers:

  • The four stages and their knobs: trace, DAG, StableHLO and IREE. For each stage it lists what can change and who changes it (op author, model author, core, vendor, exporter, IREE). It also shows which TargetOptimizer hooks are wired (dagPasses(), granularity()) and which are only declared (CompilePhase.TAPE, STABLE_HLO).
  • Why exact GELU needs care: the exact and tanh forms, the measured 4.73e-4 gap, and the Laya parity requirement.
  • What adding the op touched: each layer that feat(ops)!: exact (erf) GELU and erf op (#1342, part 1) #1344 and feat(compile): composite emission seam, GELU legalization pass, @Lowering (#1342, part 2) #1346 changed.
  • One op, four ways down:
    • inline chlo.erf
    • the keepFused composite with its decomposition
    • the recorded GeluApproximationLegalizationPass rewrite
    • eager A&S erf
  • Eager vs compiled: which checks exist today, and which don't yet (eager vs IREE's chlo.erf; the conformance oracles are still tanh).

Also

  • Three self-contained SVGs in images/:
    • stage knobs and hooks
    • the four lowering paths
    • the exact-vs-tanh error curve, computed from the formulas with math.erf
  • A nav entry next to "Eager execution".
  • A one-line cross-link from the HLO tutorial's composite section, so the how-to stays in the tutorial and the "why" lives here.

Checked

  • Every API name, constant and MLIR listing was checked against develop (fd0f6da): GeluLowering, GeluApproximationLegalizationPass, TargetOptimization.kt, OpGranularityPolicy.kt, and 13 converter families in createExtended.
  • The Antora site builds with the repo's skainet-antora image, with no warnings. The three images resolve under _images/.
  • my-npu and my-dsp are marked as example names, and the Status section says that no shipped target uses the pass or the fused composite yet.

🤖 Generated with Claude Code

…U as the example

New Explanation page mapping what can change at each stage of the compiled
path (trace, DAG, StableHLO, IREE), who changes it, and which TargetOptimizer
hooks are wired. It follows gelu(approximate = false) down four paths: inline
chlo.erf, a keepFused composite, the recorded tanh legalization, and eager
execution, and states which eager-vs-compiled checks exist and which do not.

Adds three SVG diagrams (stage knobs and hooks, the four lowering paths, and
the exact-vs-tanh error curve computed from the formulas), a nav entry next to
eager execution, and a cross-link from the HLO tutorial's composite section.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

📖 Documentation Preview

The documentation has been built successfully for this PR.

Generated Files:

  • Operator documentation: docs/modules/operators/_generated_/
  • JSON schema output: operators.json

Artifacts:

  • Download the documentation-preview-1432 artifact to view the complete documentation locally.

This comment will be updated automatically when the PR is updated.

… diagrams

Each diagram now ships as a -light.svg / -dark.svg pair, included with
role=only-light / role=only-dark. A small style block in the supplemental
footer partial hides the copy that does not match the UI bundle's
data-theme toggle (light shows when the attribute is missing).

Also quotes the image alt texts: they contain commas, which AsciiDoc read
as width/height positional attributes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@michalharakal

Copy link
Copy Markdown
Contributor Author

Pushed 1117a30: the three diagrams now come in light and dark versions.

  • Each diagram has a -light.svg and a -dark.svg file. Both are generated from one script, with the same layout in two palettes. The light palette uses the docs UI's own light tokens.
  • The page includes both copies with role=only-light / role=only-dark. A 3-line style block in supplemental-ui/partials/footer-scripts.hbs hides the copy that doesn't match the UI bundle's data-theme toggle. If JS is off and the attribute is missing, the light copy shows.
  • Fix: the alt texts are now quoted. They contain commas, which AsciiDoc had been reading as width/height attributes.

The Antora build passes with no warnings, and all six SVGs are published under _images/.

🤖 Generated with Claude Code

@github-actions

Copy link
Copy Markdown

📖 Documentation Preview

The documentation has been built successfully for this PR.

Generated Files:

  • Operator documentation: docs/modules/operators/_generated_/
  • JSON schema output: operators.json

Artifacts:

  • Download the documentation-preview-1432 artifact to view the complete documentation locally.

This comment will be updated automatically when the PR is updated.

@michalharakal
michalharakal merged commit 593a93f into develop Oct 21, 2026
19 checks passed
@michalharakal
michalharakal deleted the docs/compile-flexibility-gelu branch October 21, 2026 13:14
michalharakal added a commit that referenced this pull request Oct 21, 2026
CHANGELOG [0.62.1] - 2026-10-21 over everything develop holds since
0.62.0: the FFM Q8_0/Q4_0/Q5_0/Q5_1 binding fix (#1436) as the headline,
the YOLO move-out (#1437), the StableHLO softmax axis and logSoftmax fixes,
the compile-flexibility explanation (#1432) and the SKEEP-008 draft (#1434).
VERSION_NAME, CITATION, Antora version, README bom coordinate, What's New
and contributors, Android tutorial coordinates; regenerated operator and
kernel-support matrices.
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.

2 participants