-
Notifications
You must be signed in to change notification settings - Fork 23
Open
Description
Problem
gemv and gemm are implemented and tested as separate operator stacks, even though GEMV is a shape-specialized GEMM case.
Affected files/functions:
tileops/ops/gemv.py(GemvOp) duplicates operator dispatch and lifecycle already present intileops/ops/gemm.py(GemmOp).tileops/ops/__init__.pyexports bothGemmOpandGemvOp, keeping two public APIs for one conceptual op family.tests/ops/test_gemv.pyandtests/ops/test_gemm.pyare split, so GEMV coverage is disconnected from GEMM regression checks.
Problematic pattern today:
# tileops/ops/__init__.py
from .gemm import GemmOp
from .gemv import GemvOp
__all__ = [
...,
"GemmOp",
"GemvOp",
...,
]And separate op entrypoints:
# tileops/ops/gemv.py
class GemvOp(Op):
...
self.kernel = self.kernel_map["gemv_kernel"](n, k, self.dtype, tune=tune)
# tileops/ops/gemm.py
class GemmOp(Op):
...
self.kernel = self.kernel_map["gemm_kernel"](
m, n, k, self.dtype, tune=tune, trans_a=trans_a, trans_b=trans_b
)Proposed Fix
Unify GEMV into GEMM as a shape-specialized path and remove standalone GEMV ops/test entry.
Implementation plan:
- Remove standalone GEMV op exports and entrypoints (
GemvOp, and related imports). - Route GEMV workloads through
GemmOpby expressing GEMV as GEMM shape mapping (e.g.,M=1/ equivalent shape transform in the operator wrapper). - Migrate all
tests/ops/test_gemv.pycoverage intotests/ops/test_gemm.py(or GEMM test matrix), preserving dtype/tuning/shape scenarios from current GEMV tests.
Target end-state sketch:
# only GEMM-facing public API
from .gemm import GemmOp
# GEMV cases executed through GEMM-compatible shapes
op = GemmOp(m=1, n=n, k=k, ...)
out = op(a_2d, b)Next Steps
A follow-up PR will implement the refactor with:
- API cleanup (remove standalone GEMV surface).
- Kernel dispatch unification under GEMM.
- Test migration table (
old GEMV case -> new GEMM case) included in PR description. - Correctness verification for migrated cases and a brief performance sanity check on representative GEMV-shaped inputs.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels