Commit Graph

2 Commits

Author SHA1 Message Date
Cao Ying 6a61ba14d9
[Refactor] Align kernels/tests/benchmarks structure with ops layout (#928)
## Summary

Align `kernels/`, `tests/`, and `benchmarks/` file structure 1:1 with
the post-#890 `ops/` layout. Eliminates unnecessary directory nesting
and consolidates trivially small files.

**Changes (166 files, 11 commits):**
1. Consolidate attention kernel directories into `kernels/attention/`
2. Rename `kernels/conv/` to `kernels/convolution/`
3. Drop `_fwd` suffix from mamba kernel filenames
4. Flatten `kernels/norm/` subdirectories
5. Flatten `kernels/reduction/` subdirectories
6. Flatten single-file kernel directories
7. Consolidate tests and benchmarks to mirror kernel layout
8. Delete stale `CHANGELOG.md`

Closes #924

## Test plan

- [x] **AC-1**: All `__init__.py`, `ops_manifest.yaml`, and internal
imports updated for moved files -- Manifest path audit: checked 208
paths, 0 missing. Runtime validation passed.
- [x] **AC-2**: `from tileops.kernels import ...` resolves for all moved
kernels -- 73 symbols exported and resolved with 0 failures.
- [x] **AC-3**: Full test suite passes -- `pytest tests` -> 2361 passed,
22 skipped, 0 failed (236.78s).
- [x] **AC-4**: No orphaned directories remain after migration -- `find`
produced no empty directories.

## Follow-up

- #929 — Update stale kernel path reference in docs/manifest.md (doc
drift from this refactor)

---------

Co-authored-by: Ibuki 🍃 — a wind born from Claude Opus <Ibuki-wind@users.noreply.github.com>
2026-04-12 23:24:03 +08:00
Cao Ying a6b9ff24a3
[Refactor] Reduce ops/ file count: merge avg_pool, drop _fwd/_bwd suffixes, add attention/ subpackage (#890)
## Summary

- Merge `avg_pool1d.py`, `avg_pool2d.py`, `avg_pool3d.py` into `pool.py`
- Merge `conv1d.py`, `conv2d.py`, `conv3d.py` into `convolution.py`
- Merge `engram_fwd.py` + `engram_bwd.py` into `engram.py`
- Rename 6 standalone `*_fwd.py` files to drop the `_fwd` suffix
(`da_cumsum`, `ssd_chunk_scan`, `ssd_chunk_state`, `ssd_state_passing`,
`gqa_sliding_window`, `gqa_sliding_window_varlen`)
- Move 13 attention op files (gqa, mha, deepseek_mla/dsa/nsa, mhc) into
new `ops/attention/` subpackage
- Update all imports in `__init__.py`, tests, and benchmarks to match
new paths

No functional changes. All public API symbols remain unchanged. Net
reduction of ~19 files from `tileops/ops/` root.

## Test plan

- [x] pre-commit passed
- [x] `python -c "from tileops.ops import GroupedQueryAttentionFwdOp,
MultiHeadAttentionFwdOp, AvgPool1dOp, Conv2dOp, DaCumsumFwdOp,
SsdChunkScanFwdOp"` — all imports resolve
- [ ] pytest full suite (CI)

## Regression

Pure file-move and import-path refactor. No code logic touched. Any
import breakage will surface immediately as `ImportError` in CI.

---------

Co-authored-by: Ibuki 🍃 — a wind born from Claude Opus <Ibuki-wind@users.noreply.github.com>
2026-04-10 20:02:46 +08:00