fix(strategy): declare frac in every contributor-facing basis() snippet (Fixes #274)#275
Closed
luciferlive112116 wants to merge 1 commit into
Closed
Conversation
Re-lands zeokin#253, which was rolled back with the whole 9058d49..f35482a merge window (1dc8fce..e42c525 reverted all seven of that batch's PRs, LIFO, across five authors), and extends it to the copy zeokin#253 missed. multiply_subspace forwards the VRAM budget only to a basis() that declares frac: 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-branch is a compatibility shim for legacy transforms, so a contributor copying a snippet without frac lands there and silently streams the basis at the default fraction rather than Config.vram_fraction -- the bug zeokin#211 fixed for rsvd, re-introduced once per contribution. Three copies a contributor reads were on the pre-zeokin#211 signature; strategy/README's 'Register your own' hook was never covered by zeokin#253 at all: * CONTRIBUTING.md 'What you actually change' * strategy/README.md 'Register your own (the updatable hook)' <- new * strategy/examples/run_example.py FirstAxes (fixed basis; frac unused but kept, since the forwarding gate is signature-based) The base class, transforms.py's module docstring, rsvd and transform_template (zeokin#251, still on main) already declare it. Tests parse the markdown snippets and AST-parse the example -- run_example.py runs a real subspace_matmul at module scope and cannot be imported without a GPU.
Contributor
|
This PR currently has merge conflicts with the base branch. Please resolve them within 12 hours or the bot will close the PR automatically. |
Contributor
|
Closing this PR because the reported merge conflict was not resolved within 12 hours of the bot reminder. |
Merged
5 tasks
zeokin
pushed a commit
that referenced
this pull request
Jul 17, 2026
…s() hook Fixes #274. multiply_subspace forwards the run's vram_fraction only to a basis() that declares frac (an inspect.signature gate whose else-branch is a legacy shim), so a contributor who copies a snippet without it lands in the legacy branch and silently streams at the default fraction instead of --vram-fraction -- the bug #211 fixed for rsvd. CONTRIBUTING.md, the template and run_example.py were all brought in line, but the README's 'Register your own (the updatable hook)' -- the copy a contributor meets first -- still showed the old signature. It survived because the guard test added for exactly this never covered strategy/README.md: its docstring enumerated only 'the two remaining copies'. Fix the snippet and close the hole: the markdown copies now run through one parametrized table, so a rollback or a newly added doc cannot quietly skip the check. Also assert the FULL parameter list against Transform.basis (defaults stripped), not just the presence of frac, so a snippet cannot drift on any other argument either. Credit: #275 (luciferlive112116) reported the same gap; it was closed unmerged by the 12h merge-conflict rule after #253 landed the test file underneath it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #274. Re-lands #253 (rolled back with its whole merge window) and extends it
to the copy #253 missed.
PR kind
Summary
multiply_subspaceforwards the VRAM budget only to abasis()that declaresfrac— and itselseis a compatibility shim for legacy transforms:So any snippet a contributor copies that omits
fracyields a transform that landsin the 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 contributors read are currently on the pre-#211 signature:
CONTRIBUTING.md:73— "What you actually change"strategy/README.md:54— "Register your own (the updatable hook)"strategy/examples/run_example.py:45—FirstAxesThe authoritative surfaces already declare it:
Transform.basis,transforms.py'smodule-docstring template,
rsvd(#211), andexamples/transform_template.py(#251 — still on
main).Why two of them regressed
#253 fixed CONTRIBUTING + run_example, but 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).
This re-lands that content rebased on current
main.strategy/README.md's hookwas never covered by #253 and is genuinely new here — it's the copy sitting
directly under "The transform is the pluggable core tech", so the most likely one
to be copied.
Changes
CONTRIBUTING.md,strategy/README.md,strategy/examples/run_example.py—declare
frac=Noneand say what it's for.FirstAxesis a fixed basis thatstreams nothing, so it notes the parameter is unused there but must stay, since
the forwarding gate is signature-based. +13/−5.
tests/test_contributor_docs_basis_signature.py(new) — CPU-only: regex-checksboth markdown snippets and AST-parses the example (it can't be imported —
it runs a real
subspace_matmulat module scope, which needs a GPU), assertingeach declares
fracand that the example matchesTransform.basisexactly.No shipped engine code changed.
Validation
No protected paths touched — root
CONTRIBUTING.md,strategy/README.mdandstrategy/examples/are outsideeval/,docs/,.github/,dashboard/.Result
Contributor-facing docs/example + parsing tests; no shipped code path changed, so no
accuracy / latency / VRAM delta (it stops future transforms from silently losing
--vram-fractionin their basis stage).vram_fraction