forked from ccf-ai-infra/TileOPs-Metax
6 Commits
| Author | SHA1 | Message | Date |
|---|---|---|---|
|
|
6e0b507b42
|
[Refactor][Workloads] Align workloads/ops/ naming with tileops/ops/ layout (#939)
## Summary
Align `workloads/ops/` file naming and directory structure 1:1 with the
post-#928 `tileops/ops/` layout. Pure file-move/rename refactor — no
workload logic changes.
- Drop `_fwd` suffix from mamba, attention, deltanet, and gated_deltanet
workloads
- Rename `mean_pooling_ops.py` to `mean_pooling.py`
- Move attention workloads into `workloads/ops/attention/` subpackage
- Update all imports across the repo
Closes #931
## Test plan
- [x] **AC-1**: All `from workloads.ops.<name>` imports updated for
moved/renamed files — verified by importing all 20 renamed/moved
workload classes and grep confirming zero old import paths remain
- [x] **AC-2**: `python -c "from workloads.ops.attention import ..."`
resolves for all 15 moved attention workload classes
- [x] **AC-3**: Full test suite passes — 2361 passed, 22 skipped, 0
failed (233.76s at commit
|
|
|
|
b77f40c762
|
[Refactor][Benchmark] Upgrade benchmark workload interface to capability protocols (#923)
## Summary Upgrade the benchmark workload interface from hard-coded `WorkloadBase` composition to capability-based protocols. Closes #918 ### Changes - **Capability protocols**: `ShapeDtypeWorkload`, `InputGeneratingWorkload`, `BenchmarkWorkload` — structural types for workload capabilities - **Generic `BenchmarkBase[W]`**: base class parameterized by workload type, replacing the hard-coded `WorkloadBase` constructor - **`ManifestBenchmark(BenchmarkBase[ShapeDtypeWorkload])`**: aligned contracts, zero `type: ignore` in `benchmarks/benchmark.py` - **`WorkloadBase` preserved**: default in-repo implementation, not the public contract - **Docs updated**: `docs/testing.md`, `docs/trust-model.md`, `docs/architecture.md` - **7 tests**: duck-typed protocols, ManifestBenchmark contract, WorkloadBase compatibility ## Test plan - [x] **AC-1**: `roofline_vars` parameter typed to require `shape` and `dtype` via `ShapeDtypeWorkload` protocol - [x] **AC-2**: 1056 benchmarks collect, 103 benchmark ops pass (1 pre-existing failure in bench_argreduce, unmodified on this branch), 7 protocol tests pass - [x] **AC-3**: No new type errors — zero `type: ignore[arg-type]` in `benchmarks/benchmark.py` ## Verification evidence All acceptance criteria verified by automated reviewer (two-pass code review complete). Design direction confirmed by Ibuki-wind (Option B: full benchmark interface refactor). ## Follow-up - #936 — Add benchmarks/tests/ to pytest testpaths for CI coverage - #937 — Migrate 97 BenchmarkBase subclasses to explicit generic parameterization (depends on #936) - #938 — Archive benchmark-workload-interface.md plan document Suggestions: Update RooflineWorkload backward-compat alias removal once confirmed no external consumers depend on it --------- Co-authored-by: Ibuki 🍃 — a wind born from Claude Opus <Ibuki-wind@users.noreply.github.com> |
|
|
|
8a74fd26e0
|
[Doc][Manifest] Design kernel_map dispatch and update design docs (#878)
## Summary - **kernel_map design** (`docs/ops-design.md`, `docs/manifest.md`): Define kernel_map as the Op→Kernel dispatch registration table. The manifest declares which Kernels an Op uses so agents know what to implement; dispatch strategy is a runtime concern not described in the manifest. - **trust-model update** (`docs/trust-model.md`): Add kernel_map to manifest OWNS, clarify MUST NOT boundary (kernel internals + dispatch strategy, not class-name registrations). - **manifest.md restructuring**: Move `ref_api` under Entry Structure, make `status` required, define `family` as closed set of 12 operator families, rename `norm`→`normalization` and `conv`→`convolution`. - **manifest + test sync**: Rename family values in `ops_manifest.yaml` and `test_validate_manifest.py`. - **testing.md fixes**: Update stale class names (`MultiHeadAttentionFwdOp` → `MhaFwdOp`, `MhaFwdWorkload` → `MhaFwdTest`), add missing imports. - **ops-design.md cleanup**: Remove verbose Reduction-specific note, add Kernel Dispatch section. ## Changed files - `docs/ops-design.md` — new Kernel Dispatch section, note removal - `docs/manifest.md` — `kernel_map` field, `ref_api` moved, `status` required, `family` closed set - `docs/testing.md` — stale class names and missing imports - `docs/trust-model.md` — kernel_map in manifest OWNS, clarify MUST NOT - `tileops/ops_manifest.yaml` — family renames (norm→normalization, conv→convolution) - `tests/test_validate_manifest.py` — family rename in fixtures - `.claude/domain-rules/ops-design.md` — kernel_map rule - `.claude/domain-rules/manifest-spec.md` — kernel_map rule, status required ## Test plan - [x] Pre-commit hooks pass (mdformat, codespell, ruff) - [x] `pytest tests/test_validate_manifest.py tests/test_ops_manifest.py` — 99 passed, 1 xfailed - [x] No stale class names remain in design docs Closes #876 ## Follow-up - #885 — Rewrite ops-design.md (class hierarchy doesn't match reality) - #886 — Enforce status required and add kernel_map validator support - #887 — Populate kernel_map for all implemented ops (depends on #886) Suggestions: - testing.md examples use `MhaFwdOp` — rename to `MultiHeadAttentionFwdOp` when the code rename PR for #880 lands - PascalCase dispatch keys in GLA/DeltaNet ops — migrate to snake_case in a future cleanup --------- Co-authored-by: Ibuki 🍃 — a wind born from Claude Opus <Ibuki-wind@users.noreply.github.com> |
|
|
|
e27988318f
|
[Doc][TrustModel] Update design docs and domain rules for workloads/ layer and trust boundaries (#791)
## Summary - New `docs/trust-model.md` — four-stage pipeline trust boundaries (manifest → implementation → test → benchmark) and workloads layer contract - Added `## Boundary` sections (OWNS / MUST NOT modify / MAY READ) to all 4 domain rule files - Added "Writing a Test" and "Writing a Benchmark" operation guides to `docs/testing.md` - Rewrote top-level Test/Benchmark Pattern example to match post-PR#787 three-file architecture - Fixed outdated class descriptions, directory structure, aspirational claims, and internal contradictions Resolves #790. Related: #787, #789. ## Key design decisions 1. **workloads/ is not a development stage** — shared input-definition layer. Test stage OWNS it (QA creates workload classes first from manifest). 2. **Implementation MAY READ tests/, MUST NOT MODIFY** — developer reads ref_program for behavior understanding; modifying the correctness oracle is the unacceptable cheat. 3. **Benchmark-local baselines allowed** — benchmarks must not import oracle/ref from tests/ or workloads/, but may define local baseline functions. 4. **Operation guides in testing.md, principles in trust-model.md** — explicit bidirectional cross-references between all documents. ## Changes (10 files, +216 / -40) | File | Change | |------|--------| | `docs/trust-model.md` (new) | Pipeline boundaries, per-stage OWNS/MUST NOT/MAY READ, workloads contract | | `docs/testing.md` | Rewrote example to three-file pattern, added Writing a Test/Benchmark guides, fixed class table | | `docs/architecture.md` | Added `workloads/` to directory tree + module table (labeled "shared layer, not a module") | | `docs/ops-design.md` | Trust boundary cross-ref, removed aspirational "target architecture" label | | `docs/workflow.md` | Fixed Step 2 to not claim implementer writes tests, added trust-model back-link | | `.claude/domain-rules/benchmark.md` | Boundary header with file-path MUST NOT, fixed record()/calculate rules | | `.claude/domain-rules/testing-budget.md` | Boundary header, OWNS tests/ + workloads/ | | `.claude/domain-rules/ops-design.md` | Boundary header, MAY READ tests/ with rationale | | `.claude/domain-rules/manifest-spec.md` | Boundary header | | `CLAUDE.md` | Added `workloads/` row to domain rules table | ## Test plan - [x] All cross-references bidirectional (every forward ref has matching back ref) - [x] Top-level example matches "Writing a Benchmark" checklist (one consistent pattern) - [x] No internal contradictions between trust-model.md, testing.md, domain rules, and workflow.md - [x] All API descriptions verified against actual code - [x] No aspirational claims in modified documents - [x] `pre-commit run --all-files` passes - [x] Documentation-only PR — no code changes 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
|
|
|
20170a617d
|
[Chore][Testing] Add unit-test policy and test node growth detection script (#761)
## Summary Define a unit-test policy for operator tests and provide a local script (`scripts/test_node_delta.py`) that reports test node count delta for touched files in a PR, making growth visible and justifiable. Closes #760 ## Changes **M1 — Unit-test policy** - Added Unit-Test Policy section to `docs/testing.md` covering: allowed UT purposes, dtype risk class rule, shape coverage rule, manifest separation, growth justification - Added `.claude/rules/testing-budget.md` with concise agent-enforceable version - Verified policy is consistent with existing smoke/full tier system in `tests/conftest.py` **M2 — Growth-detection script** - Created `scripts/test_node_delta.py` that compares test node counts between current branch and main - Added usage instructions to `docs/testing.md` - Added note in `.claude/rules/testing-budget.md` about running script and justifying growth ## Test plan - [x] **AC-1-1**: docs/testing.md contains a Unit-Test Policy section with dtype risk class, shape coverage, manifest separation, and growth justification rules - [x] **AC-1-2**: .claude/rules/testing-budget.md exists and is loadable by Claude Code - [x] **AC-1-3**: Policy does not contradict existing tier enforcement in tests/conftest.py - [x] **AC-2-1**: Script runs successfully on the current repo and reports node counts for at least 3 existing test files - [x] **AC-2-2**: Script correctly detects delta when a test file has more nodes than its main branch version - [x] **AC-2-3**: Script exits 0 regardless of delta (non-blocking) - [x] **AC-2-4**: Script handles new test files (no main branch version) without error - [x] **AC-2-5**: docs/testing.md documents how to run the script 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
|
|
|
14f3ee90b7
|
[Doc] Split DEVELOPMENT.md into 6 orthogonal agent-readable design docs (#651)
## Summary - Replace monolithic `DEVELOPMENT.md` and `CONTRIBUTING.md` with 6 focused, orthogonal documents: `architecture.md`, `ops-design.md`, `manifest.md`, `roofline.md`, `testing.md`, `workflow.md` - Convert review-oriented prose from `tileops-platform-design.md` into declarative agent-reference style - Merge `CONTRIBUTING.md` branch/commit conventions into `workflow.md`; delete `CONTRIBUTING.md` - Replace ASCII art diagrams with Mermaid (GitHub-rendered) - Update `CLAUDE.md` references and fix stale `DEVELOPMENT.md` mentions in issue templates and test files ## Test plan - [x] pre-commit passed - [x] No broken internal references (`grep -r DEVELOPMENT.md` / `CONTRIBUTING.md` returns zero hits) ## Additional context Content sources: `docs/DEVELOPMENT.md` (operational details, tolerances, test patterns) + `TileOpsGov/docs/tileops-platform-design.md` (platform design, manifest spec, roofline methodology, interface principles). The split ensures each document covers exactly one concern with no content overlap. --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |