Skip to content

[Epic] Code organization, test infrastructure, and documentation #93

Description

@fabianlim

[Epic] Code organization, test infrastructure, and documentation

Umbrella for the non-feature work: restructuring the KTDP pass library, moving
structural testing onto lit/FileCheck, and putting the docs on a build-time
generator. None of it changes what the compiler lowers — it changes where the
code lives, how it is tested, and how it is documented.

Kernel/lowering features are tracked separately (#48 end-to-end scheduler
validation, #87 stick-tiled layouts). This epic is the substrate those depend on.

Why now

Three coupled problems, each blocking the next:

  1. Pass library is flat. All KTDP passes sit in one KTDPTransforms
    library, mixing dialect conversions with plain rewrites. Adding a pass means
    adding to an undifferentiated pile, and the single CMake target links
    everything everything needs.
  2. Structural coverage is split across two mechanisms. lit/FileCheck exists
    and works (Build spyre-triton-opt and add lit/FileCheck infrastructure #64 built spyre-triton-opt; test/Conversion/, test/Triton/
    carry real RUN: lines), but the older Python single-pass testers
    (test_distribute_work.py, test_lower_compute_ops.py,
    test_lower_desc_memory.py, test_lower_scalar_load.py) and the fixture
    extra_checks still assert structure through the full _make_ktir pipeline.
    Two places to look, and the pytest half still can't isolate a pass.
  3. Docs are generated from the tests. scripts/gen_patterns_docs.py reads
    @pattern-decorated Python test methods. So (2) cannot be fixed without
    also moving (3) — changing the test mechanism changes the doc source.

The ordering below reflects that coupling. The tooling step is already done
(#64), so the critical path is: finish the test migration, then the test-derived
docs, then the cleanups the new structure makes safe.

Key steps

Step 0 — lit/FileCheck infrastructure ✅ done

Landed already, no work item:

Step 1 — Restructure the pass library

  • [Cleanup] Split KTDPTransforms into Conversions and Transforms #46 — Split KTDPTransforms into Conversions/, Transforms/,
    Utils/.
    Conversions are the passes that use ConversionTarget +
    applyPartialConversion and cross dialect boundaries
    (LowerDescriptorMemory, LowerComputeOps, ConvertFunctions,
    LowerScalarLoad); Transforms/ holds LowerProgramId (renamed from
    DistributeWork); Utils/ holds cleanupDeadOps. Three CMake libraries
    replace one. No Analysis/ layer yet.
  • Simplify ConvertFunctions to remove two latent bugs #79 — Simplify ConvertFunctions. Replace the three-mechanism
    sequence (hand-rolled clone + applyPartialConversion for tt.return
    alone + manual block-arg retyping) with ordinary MLIR APIs. Removes two
    latent bugs outright: multi-block tt.func bodies currently crash, and
    the clone path assumes a single public function.

Step 2 — Move structural testing to lit/FileCheck

Step 3 — Put docs on a build-time generator

Step 4 — Fix the install/build documentation

Step 5 — Structural cleanups unlocked by the above

  • Replace ktir-mlir-frontend submodule with dataflow-scheduler #68 — [Tentative] Replace the ktir-mlir-frontend submodule with
    dataflow-scheduler.
    Consume the frontend through the scheduler, which
    already submodules it. Touches .gitmodules, third_party/spyre/CMakeLists.txt,
    and two setup.py paths. Note this moves the submodule that
    spyre-triton-opt links against, so re-verify the lit suite still builds
    after it lands.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions