You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[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:
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.
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.
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:
Build spyre-triton-opt and add lit/FileCheck infrastructure #64 — builds spyre-triton-opt (third_party/spyre/bin/), adds test/lit.cfg.py, lit.site.cfg.py.in, test/CMakeLists.txt. Registers
both Triton and KTDP dialects/passes, so any pass can be run standalone on
raw MLIR. Usage (incl. generate-test-checks.py) documented in CLAUDE.md.
[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.
Note: two MLIR runtimes in the spyre numerical tests #10 — [Tentative] Document/resolve the two MLIR runtimes in numerical tests. libtriton.so and mlir_ktdp each statically embed their own MLIR;
co-loading segfaults. The subprocess-parse workaround is temporary and
currently only recorded in the issue.
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.
[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:
KTDPTransformslibrary, mixing dialect conversions with plain rewrites. Adding a pass means
adding to an undifferentiated pile, and the single CMake target links
everything everything needs.
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 fixtureextra_checksstill assert structure through the full_make_ktirpipeline.Two places to look, and the pytest half still can't isolate a pass.
scripts/gen_patterns_docs.pyreads@pattern-decorated Python test methods. So (2) cannot be fixed withoutalso 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:
spyre-triton-opt(third_party/spyre/bin/), addstest/lit.cfg.py,lit.site.cfg.py.in,test/CMakeLists.txt. Registersboth Triton and KTDP dialects/passes, so any pass can be run standalone on
raw MLIR. Usage (incl.
generate-test-checks.py) documented in CLAUDE.md.test/Triton/and
test/Conversion/now carryRUN:lines.Step 1 — Restructure the pass library
KTDPTransformsintoConversions/,Transforms/,Utils/. Conversions are the passes that useConversionTarget+applyPartialConversionand cross dialect boundaries(
LowerDescriptorMemory,LowerComputeOps,ConvertFunctions,LowerScalarLoad);Transforms/holdsLowerProgramId(renamed fromDistributeWork);Utils/holdscleanupDeadOps. Three CMake librariesreplace one. No
Analysis/layer yet.ConvertFunctions. Replace the three-mechanismsequence (hand-rolled clone +
applyPartialConversionfortt.returnalone + manual block-arg retyping) with ordinary MLIR APIs. Removes two
latent bugs outright: multi-block
tt.funcbodies currently crash, andthe clone path assumes a single public function.
Step 2 — Move structural testing to lit/FileCheck
infrastructure question is settled by Build spyre-triton-opt and add lit/FileCheck infrastructure #64 (Step 0); what remains is
migration. Port
test_distribute_work.py,test_lower_compute_ops.py,test_lower_desc_memory.py,test_lower_scalar_load.pyto.mlircasesrun through
spyre-triton-optwith a single--passeach, and retireSinglePassTester/utils_pattern.py. Also fixes the///doc commentheader format that replaces the
@patterndecorator — Step 3 depends onthat format. Supersedes the parts of this epic's test story that Build spyre-triton-opt and add lit/FileCheck infrastructure #64 did
not already cover; scope [Test] Adopt lit/FileCheck for Transform-level tests; migrate @pattern docs to .mlir headers #55 to migration, not infrastructure.
KTIRStructuralTesterandextra_checks. Once litcovers the structural checks, delete the pipeline-invariant tests and the
per-variant
extra_checkslambdas frommeta.py. Fixtures then assertonly two things: end-to-end compilation succeeds, and numerics match the
oracle.
Step 3 — Put docs on a build-time generator
gen_patterns_docs.pyto MkDocs +mkdocs-gen-files.Replace the manual script and its
--checkCI step with a build-time hookthat parses
///headers from.mlirfiles undertest/Transforms/andtest/Conversion/, cross-referencing fixtureVARIANTStags. CI runsmkdocs build --strict. Blocked on [Test] Adopt lit/FileCheck for Transform-level tests; migrate @pattern docs to .mlir headers #55 landing the header format.Spyre-only relaxations of upstream Triton semantics (first case:
tl.cat/tl.join). A kernel author copying such a pattern to upstream Triton hitsa failure with no warning. Needs a
spyre_onlyflag threaded through thenew generator — so it should be designed into [Docs] Migrate gen_patterns_docs.py to MkDocs + mkdocs-gen-files #70 rather than retrofitted.
Step 4 — Fix the install/build documentation
uv pip install— install guidance silently targets the wrong venv #81 —UV_PROJECT_ENVIRONMENTdoes not affectuv pip install. Bothinstall guides claim it does. Following the documented steps can build
Triton into one venv while
uv run pytestruns from another, silently.Fix
CLAUDE.mdandREADME.md.setup.pyemitsboth
install-ktdp-mlir-bindings.shandtest/_llvm_config.py, eachencoding the same build-time
MLIR_DIR. Two sources of truth for onevalue.
libtriton.soandmlir_ktdpeach statically embed their own MLIR;co-loading segfaults. The subprocess-parse workaround is temporary and
currently only recorded in the issue.
Step 5 — Structural cleanups unlocked by the above
ktir-mlir-frontendsubmodule withdataflow-scheduler. Consume the frontend through the scheduler, whichalready submodules it. Touches
.gitmodules,third_party/spyre/CMakeLists.txt,and two
setup.pypaths. Note this moves the submodule thatspyre-triton-optlinks against, so re-verify the lit suite still buildsafter it lands.