Skip to content

Packed matrix storage#2052

Open
kali wants to merge 4 commits intomainfrom
packed-matrix-storage
Open

Packed matrix storage#2052
kali wants to merge 4 commits intomainfrom
packed-matrix-storage

Conversation

@kali
Copy link
Collaborator

@kali kali commented Mar 20, 2026

No description provided.

kali added 4 commits March 20, 2026 14:18
Add Downcast bound to TensorStorage trait (via downcast-rs) so
downstream crates can downcast `dyn TensorStorage` to concrete types.

New trait methods: dyn_hash, eq_storage.
New Tensor methods: storage_as<T>, try_storage_as<T>, from_storage.
Fix Hash, Drop, deep_clone, PartialEq to branch on dense vs non-dense
instead of panicking on StorageKind::Other.
PackedMatrixStorage implements TensorStorage and holds Vec<Box<dyn MMMInputValue>>
with batch shape/strides. Supports scalar and batched packed matrices.

MapOutputAxisToInput::flat_index computes a flat index into PackedMatrixStorage
from output coordinates and batch strides, replacing the translate_view pattern
for non-dense storage.
Replace all creation sites (6) and access sites (6) to use
PackedMatrixStorage instead of Tensor<Opaque> + double-downcast:

Creation: PackedFormat::prepare_tensor, OptMatMulPack::do_eval,
OptSimpleMatMulPack::eval, LazyIm2Col::eval, Im2Col::eval

Access: ProtoFusedSpec::resolve (a+b), resolve_trivial (a+b),
QSumB::eval, Gather::eval, panel_extract test

Also handle non-dense storage in Tensor::dump and Tensor::is_uniform
to prevent panics when formatting or checking uniformity of
PackedMatrixStorage-backed tensors.
… impl

These impls are no longer needed now that packed matrices use
PackedMatrixStorage instead of Opaque wrapping. Also migrate the
remaining creation site in PackedBlockQuantFormat::prepare_tensor.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant