Repository navigation
Closed
Description
Part of #932. The remaining part of SKEEP-003 as written; whether and how far to do it is decided after a measured spike.
- Spike. Move one packed format (Q4_K) of the heap matmul selection to a
KernelKeylookup overview.format, and measure against the baseline. The bar from decision 6: matmul within noise, elementwise at most 3 % slower. Result: no regression; the work below follows its pattern - Dispatch on
Format/KernelKeyfor matmul, dense fast paths, conv, elementwise, layout and index ops, on every backend; the downcast allowlist shrinks. Closed with 18 sites left of 162, each with a reason (config/tensor-data-downcast-allowlist.txt); the SKEEP records the criterion as met with these exceptions (docs(skeep-003): acceptance criteria checked, status Implemented (#1507) #1548)- Matmul, common code (refactor(cpu): choose the common packed matmul by KernelKey, not by class (#1507) #1518)
- Matmul, JVM: heap block formats (refactor(cpu): JVM packed matmul by KernelKey; view kernels run under the caller's schedule (#1507) #1519)
- Dense fast paths (refactor(cpu): dense fast paths read what the data says about itself, not its class (#1507) #1520)
- Conv, Accelerate ops, JVM
mean(refactor(cpu): conv, Accelerate ops and JVM mean take their arrays without a class check (#1507) #1521) - Layout and index ops:
transpose,permute,gather,indexSelect,convert(refactor(cpu): layout and index ops read dense data through its window (#1507) #1529) -
WasmCpuOps.kt(refactor(wasm): the ops take heap operands by what the data says (#1507) #1535) - Sites outside the backends: index tensors, GGUF writer, streaming loaders,
QuantizeCli, dense constants inTraceToGraphBuilder, test and CLI helpers (refactor: code outside the backends reads tensor data by what it says (#1507) #1536) - Stays, with its reason: sites in
skainet-compilethat the SKEEP-003a rule keeps (no view types there) or that dispatch on a typed packed weight:QuantizedMatmul.kt(8),TernaryMatmul.kt(2),TraceToGraphBuilder.kt(2), five converter and trace files (1 each) - Stays, with its reason:
gatherinDefaultCpuOps.ktasks forRowDequantSource(1): a public capability that classes outside this repository implement for tables without a view. It stays, with that reason
- The streaming loaders return
sk.ainet.lang.memory.TensorView;TensorStorageandBufferHandleare removed- The compiler's export path has its own carrier,
ConstantSource(refactor: externalized constants travel as ConstantSource, not BufferHandle (#1507) #1537) - The readers return views:
loadTensorView,loadTensorViewMapped;loadTensorStorage*removed (feat: the streaming readers return views; loadTensorStorage is removed (#1507) #1538) - Delete
TensorStorage,BufferHandle,BufferAccessor,JvmFileBackedResolver; move the KV cache stores andMemoryTrackeroff them (refactor!: remove TensorStorage and BufferHandle; one storage model (#1507) #1539)
- The compiler's export path has its own carrier,
-
TensorDataimplementations hold aStorageand delegate to it, instead of wrapping their own array on eachviewread- The Q4_0 / Q8_0
MemorySegmentweights and the input-major narrow floats have a view;DefaultCpuOpsJvm.kthas no downcast left (refactor: JVM ops choose segment and narrow-float kernels from the view (#1507) #1540) - A sidecar-resident tensor on wasm has a view over the sidecar storage;
WasmCpuOps.kthas no downcast left (refactor: a sidecar-resident tensor's view is the sidecar bytes (#1507) #1541) -
TensorData.transposeOfreplaces the marker check; narrow-float transpose and packedgatherread the view;DefaultCpuOps.kt4 → 1 (refactor: common matmul, transpose and gather read the data, not its class (#1507) #1542) - Every heap data class has one storage handle and one view for its life (refactor: one storage handle and one view per data object (#1507) #1543)
- Int8 byte data and the unsqueeze wrapper have a view (refactor: Int8 byte data and the unsqueeze wrapper have a view (#1507) #1544)
- The public packed block types are
TensorData<FP32, Float>andgetdecodes (Packed block types are TensorData<FP32, Float>; get decodes (#1507) #1545) - The two packed
MemorySegmentweight classes and their kernels are removed (Remove the two packed MemorySegment weight classes and their kernels (#1507) #1546; downstream fixtures: Tests: build the Q8_0 fixture as heap block data SKaiNET-transformers#548) - Decided not to do: constructors that take a
Storage, packed decode that reads the storage without the data object, 2-byte FP16 / BF16 fromDenseTensorDataFactory(it keeps widening toFloatArray)
- The Q4_0 / Q8_0
Known costs accepted so far, with numbers in the PRs: one-row matmul at 256 inputs +18 % (#1520, a JIT threshold that moved; other sizes equal or faster), 64×16 transpose +4 % and one-row gather +10 % (#1529).
- Teaching material: low-bit weights tutorial, custom-encoding how-to, "What the model replaced" (Docs: low-bit weights tutorial, custom-encoding how-to, before/after (#1507) #1547)
- Acceptance criteria checked one by one,
Status: Implemented,PackedOpsMatmulBenchrun recorded (docs(skeep-003): acceptance criteria checked, status Implemented (#1507) #1548)
Activity
fix(api): keep PackedViewMatmulKernel's constructor source-compatible (…
Merge pull request #1518 from SKaiNET-developers/feature/1507-matmul-…
Merge pull request #1519 from SKaiNET-developers/feature/1507-jvm-mat…
Merge pull request #1520 from SKaiNET-developers/feature/1507-dense-f…
Merge pull request #1521 from SKaiNET-developers/feature/1507-conv-el…
Merge pull request #1529 from SKaiNET-developers/feature/1507-layout-…
Merge pull request #1535 from SKaiNET-developers/feature/1507-wasm-op…
refactor: no avoidable copies in the GGUF writer and the grayscale CLI (
2 remaining items
Merge pull request #1537 from SKaiNET-developers/feature/1507-constan…
Merge pull request #1538 from SKaiNET-developers/feature/1507-readers…
Merge pull request #1539 from SKaiNET-developers/feature/1507-delete-…
Merge pull request #1540 from SKaiNET-developers/feature/1507-segment…
Merge pull request #1541 from SKaiNET-developers/feature/1507-wasm-ze…
Merge pull request #1542 from SKaiNET-developers/feature/1507-common-…
Merge pull request #1543 from SKaiNET-developers/feature/1507-data-ho…
Merge pull request #1544 from SKaiNET-developers/feature/1507-views-f…
Merge pull request #1545 from SKaiNET-developers/feature/1507-packed-…
Merge pull request #1546 from SKaiNET-developers/feature/1507-remove-…
Merge pull request #1547 from SKaiNET-developers/feature/1507-low-bit…
Merge pull request #1548 from SKaiNET-developers/feature/1507-skeep-0…
Merge pull request #1549 from SKaiNET-developers/feature/1507-depreca…
feat(io): ConstantSource.readBytes and writeTo, the reader BufferAcce…