mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #2627] [CLOSED] native dense: count the STRATA_Q8_PACKED copies and allocate them after the required weights #4175
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#4175
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/2627
Author: @justincinmd
Created: 10/15/2026
Status: ❌ Closed
Base:
main← Head:pr/q8-packed-alloc📝 Commits (1)
17968b6native dense: price the STRATA_Q8_PACKED copies and place them after the required allocations📊 Changes
5 files changed (+351 additions, -41 deletions)
View changed files
📝
CMakeLists.txt(+5 -0)📝
include/strata/core/native_dense.hpp(+4 -2)➕
include/strata/core/optional_alloc.hpp(+78 -0)📝
src/core/native_dense.cpp(+105 -39)➕
tests/core/optional_alloc_test.cpp(+159 -0)📄 Description
Summary
STRATA_Q8_PACKED=1(on by default on gfx1151) keeps a second, packed copy of each eligible Q8_0 dense matrix in VRAM. The layer split search did not count that copy. A copy that did not fit also aborted the load. This PR counts the copies and makes them optional.What changed
NativeDense::weight_bytes_forprices each packed copy with the same test thatloaduses. The split search no longer under-prices a stage with such matrices.NativeDense::loadmakes every required allocation first (the matrices, theSTRATA_HC_Q8copies, the q8_1 scratch) and the packed copies after them. Before, it made each copy right after its matrix.include/strata/core/optional_alloc.hpp(new, header-only): the required-then-optional sequencer thatloaduses.tests/core/optional_alloc_test.cpp(new, CPU only).Runs with Q8 packing off keep the same allocations in the same order. On gfx1151 the default path changes: a stage with eligible Q8_0 matrices is priced higher, so an automatic split can place layers differently, and a copy that does not fit no longer stops the load.
Testing
optional_alloc_testdrives the sequencer inload's call order against a fake VRAM budget. Cases: 13 MiB free with three 4 MiB matrices (fails in the old order, loads now), room for some or all copies, a required allocation out of memory, a copy upload failure, and a required allocation afterfinish().Extra Notes
Not run on a GPU with an eligible matrix: no pack I have contains a Q8_0 dense matrix wide enough to pack. I found the problem while testing the gfx1151 decode switches on gfx12 (a separate PR). A gfx1151 run with a Q8_0 pack would confirm it.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.