feat(taxis): derive storage dtype from the element type [recovered; design proposal] - #115
Draft
forkwright wants to merge 1 commit into
Draft
feat(taxis): derive storage dtype from the element type [recovered; design proposal]#115forkwright wants to merge 1 commit into
forkwright wants to merge 1 commit into
Conversation
Adds BytePod, a trait pairing a host element type with the DType it represents, and derives HipStorage::from_host's stored dtype from T::DTYPE rather than taking a free DType parameter. A caller can no longer construct storage whose declared dtype disagrees with the byte layout of the data actually copied: the mismatch stops being a checked error and becomes unrepresentable. RECOVERED WORK. This was found uncommitted in the shared logismos clone, against 8b82822 rather than the current main, with no branch and no author recorded. It is committed here at its true base so it stops depending on one machine's working tree surviving. It is preserved, not verified. Nothing here has been compiled or tested, and the tree it came from may have been mid-edit. Treat the safety contract in BytePod's doc comment as an assertion needing proof rather than one already discharged, and rebase onto main before believing any build result.
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.
Draft, and now a design proposal rather than a merge candidate. Read the last section before spending time here.
Correction to this PR's original description
It said this work "adds
BytePod". That is wrong.BytePodis a pre-existinghipcoretrait. What the commit adds is:DTypedbinds a host element type to the runtimeDTypetag it represents, bounded on the existingBytePod. The branch name carries the same error and is not worth rewriting for.Where it came from
Found uncommitted in the shared
logismosclone onmetis: five modified files, 141 insertions, no branch, no author, nothing but one machine's working tree keeping it alive. Committed at its true base (8b82822) rather than force-fitted onto a tree it was never written against.What changed since: main got there first, twice
I attempted a rebase onto current main so CI could judge it. It conflicts, and the conflicts are the interesting part — main has independently solved both problems this work targets:
1. Zeroed device memory — same fix, already landed.
The branch makes the identical change with its own comment. Nothing left to take.
2. dtype/layout mismatch — same problem, different solution.
Main checks the mismatch. This branch makes it unrepresentable — no
dtypeparameter, so no way to pass one that disagrees withT's layout.What is actually being asked
Not "merge this". The question is whether
from_hostshould keep taking adtypeparameter and validate it, or derive it fromT::DTYPEand drop the parameter.That is a public API change with a real trade-off — the derived form removes a whole error class but constrains callers to types implementing
DTyped, where the validated form accepts anyBytePodand fails at runtime. It deserves a decision, not a conflict resolution.I did not resolve the conflicts. Doing so would mean choosing that API change silently, inside merge markers, on code I did not write and have never compiled. The branch stays at its original base so the proposal is legible against the tree it was written against.
If the derived form is wanted
It needs reimplementing against current main rather than rebasing — main's
validate_dtype_matches, its error variants, and its intra-doc#[expect(unused_imports)]blocks all postdate this work. The value here is the design and theDTypedimpl list, not the diff.If it is not
Close this and delete the branch. Nothing is lost that main does not already have, except the proposal above — and that is now written down here.