Summary
multiply_subspace forwards the VRAM budget only to a basis() that declares
frac:
# Pass frac only if the transform accepts it, so custom transforms with the
# older basis(...) signature keep working.
if "frac" in inspect.signature(transform.basis).parameters:
Q = transform.basis(n, m, backend, cdt, A=A, B=B, frac=frac)
else:
Q = transform.basis(n, m, backend, cdt, A=A, B=B)
That else is a compatibility shim for legacy transforms. Any snippet a
contributor copies that omits frac therefore produces a transform which lands in
the legacy branch and silently streams its basis at _DEFAULT_ROW_BLOCK_FRACTION
(0.3) instead of Config.vram_fraction — the bug #211 fixed for rsvd,
re-introduced once per contribution.
Three copies a contributor actually reads are currently on the pre-#211 signature:
| copy |
state |
CONTRIBUTING.md:73 — "What you actually change" |
❌ no frac |
strategy/README.md:54 — "Register your own (the updatable hook)" |
❌ no frac — never covered |
strategy/examples/run_example.py:45 — FirstAxes |
❌ no frac |
while the authoritative surfaces all declare it: Transform.basis,
transforms.py's module-docstring template, RandomizedSVDTransform.basis
(#211), and examples/transform_template.py (#251, still on main).
Why they regressed
Two of the three were fixed by #253, but that PR was rolled back with the entire
9058d49..f35482a merge window — 1dc8fce..e42c525 reverted all seven PRs of
that batch, LIFO, across five authors (#235, #232, #253, #266, #267, #268, #255).
The rollback restored the stale snippets.
strategy/README.md's hook was never covered by #253 — it is a genuinely
uncovered third copy, and the most likely one to be copied, since it sits directly
under "The transform is the pluggable core tech".
Fix
Declare frac=None in all three and say what it's for (FirstAxes is a fixed
basis that streams nothing, so it notes the parameter is unused but must stay for
the signature-based forwarding gate), plus a CPU test that regex-checks both
markdown snippets and AST-parses the example (run_example.py runs a real
subspace_matmul at module scope, so it can't be imported without a GPU). None of
these paths are protected.
Summary
multiply_subspaceforwards the VRAM budget only to abasis()that declaresfrac:That
elseis a compatibility shim for legacy transforms. Any snippet acontributor copies that omits
fractherefore produces a transform which lands inthe legacy branch and silently streams its basis at
_DEFAULT_ROW_BLOCK_FRACTION(0.3) instead of
Config.vram_fraction— the bug #211 fixed forrsvd,re-introduced once per contribution.
Three copies a contributor actually reads are currently on the pre-#211 signature:
CONTRIBUTING.md:73— "What you actually change"fracstrategy/README.md:54— "Register your own (the updatable hook)"frac— never coveredstrategy/examples/run_example.py:45—FirstAxesfracwhile the authoritative surfaces all declare it:
Transform.basis,transforms.py's module-docstring template,RandomizedSVDTransform.basis(#211), and
examples/transform_template.py(#251, still onmain).Why they regressed
Two of the three were fixed by #253, but that PR was rolled back with the entire
9058d49..f35482amerge window —1dc8fce..e42c525reverted all seven PRs ofthat batch, LIFO, across five authors (#235, #232, #253, #266, #267, #268, #255).
The rollback restored the stale snippets.
strategy/README.md's hook was never covered by #253 — it is a genuinelyuncovered third copy, and the most likely one to be copied, since it sits directly
under "The transform is the pluggable core tech".
Fix
Declare
frac=Nonein all three and say what it's for (FirstAxesis a fixedbasis that streams nothing, so it notes the parameter is unused but must stay for
the signature-based forwarding gate), plus a CPU test that regex-checks both
markdown snippets and AST-parses the example (
run_example.pyruns a realsubspace_matmulat module scope, so it can't be imported without a GPU). None ofthese paths are protected.