mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #632] [CLOSED] expert profile: refuse a header version other than 1, naming both numbers and the file #2729
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#2729
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/632
Author: @Avicennasis
Created: 10/3/2026
Status: ❌ Closed
Base:
main← Head:fix/expert-profile-version📝 Commits (10+)
b0dda4bAMD: gfx1101 (RX 7800 XT, #254 by jhohertz) and gfx1200 (RX 9060 XT, #256 by Efeisot) as community-validated cardscc97fcdsetup: AMD layer splits with --gpus (every chosen card a supported AMD arch; the engine compiled for each)e9e2ba3pinned (#243 follow-up): the shared-memory-budget cap on the sliced pin is opt-in (STRATA_ARENA_PIN_GIB=auto) - by default the arena pins as in 0.1.30; on this 64 GB PC the cap pinned 26 instead of 30 GiB and cost ~20% prompt speed and 2-4% IQ3_S decodecacffa9CS-T speed: the file tier fetched in parallel, PCIe planning without file reads, a partial pin of the RAM tier, bit-exact AVX2 multi-token kernels for Q4_K / Q5_1 / Q8_0 experts, decode-only tier statsa348c7aMerge branch 'f-131-srv' into r131-q4b93a00cMerge branch 'f-q4-on242' into r131-q48f5148cCS-T: the partial pin at most 24 GiB (STRATA_PARTIAL_PIN_GIB), the Q4_K/Q5_1/Q8_0 multi-token kernels from two tokens on5ffda19CS-T: the GGUF-in-place prefetch asks Windows for all of a layer's missed slices at once (PrefetchVirtualMemory)ed6c124#253: the 8 GiB arena pin cap only under WDDM; STRATA_ARENA_PIN_GIB; the split's prompt chunk steps down450149d--split-skip-if-fits (opt-in): an auto split runs on the main card alone when it holds every profiled expert + KV📊 Changes
3 files changed (+93 additions, -1 deletions)
View changed files
📝
CMakeLists.txt(+8 -0)📝
src/core/expert_cache.cpp(+12 -1)➕
tests/core/expert_profile_version_test.cpp(+73 -0)📄 Description
One fail-closed change on the expert-profile reader, with a test that runs without a model or a GPU. Reader side only:
tools/make_profile.pyand the cache policy are untouched (#589 / #587 are on the writer).expert_cache.cpp: a profile whose header version is not 1 is refused, naming both numbers and the fileread_expert_profile(src/core/expert_cache.cpp:33) reads the header'sversionfield and then discards it ((void) version;at:68, "a future format bumps it; the layout check above is what protects this reader today"). The layout check comparesn_layers x n_expert, but those fields are only known to sit where they do in a version 1 file: a later format that moves or widens anything after the version would be read as version 1 and either pass the geometry check with the wrong numbers or fail it with a message about the wrong thing ("is 0x2 but this model is 48x512"). Two writers now produce these files -tools/make_profile.pyand--expert-profile-save(#477) - so a version bump is a real possibility rather than a note.The reader now refuses any version other than 1 right after the magic, before the geometry check, naming the version it found, the version it reads, and the file:
Same error shape as the file's other refusals (
read_expert_profile: ...prefix, the path in the message,falsewitherrset). A version 1 file is read exactly as before. 12 lines in the reader, 8 inCMakeLists.txt.Test:
tests/core/expert_profile_version_test.cpp(registered besideexpert_profile_save_test, sameEXISTSguard, linksstrata_engine, CPU only). It writes a version 1 profile withwrite_expert_profileand reads it back, then rewrites the 4-byte version field in place:11 checks. On
mainthe version 2 file loads as if it were version 1 (read_expert_profilereturns true,errempty) and 5 of the 11 fail; with the change all 11 pass.What I ran, and where
Linux x86_64 (Ubuntu 24.04, AMD Ryzen 7 5800X - no AVX-512, no NVIDIA GPU, no CUDA or HIP toolkit), gcc 13.3.0, CMake 3.28.3. This is a claim about my machine, not yours.
strata_engine(and soexpert_profile_save_testand this test's ctest target) is only configured withSTRATA_ENABLE_CUDAorSTRATA_ENABLE_HIP, andexpert_cache.cppincludescuda_runtime.h, so I could not run the new target through ctest here. Instead I compiled the same two files directly -g++ -std=c++20 -Wall -Wextra src/core/expert_cache.cpp tests/core/expert_profile_version_test.cppagainst a declarations-onlycuda_runtime.hstub (its functions abort if called; the profile tests call none) - with no warnings:expert_profile_version_test: OK(exit 0). The same harness onmain'sexpert_cache.cppprints the 5FAIL:lines above and exits 1.expert_profile_save_testthrough the same harness:OKon both. The CMake registration is a copy of the save test's block, so it should configure wherever that one does; please run it through ctest on a GPU build, I have not.cmake -B build-cpu -DSTRATA_ENABLE_CUDA=OFF -DSTRATA_BUILD_TESTS=ON -G Ninjaconfigures cleanly on this tree (the #93 items are fixed),cmake --build build-cpu: 72 of 72 targets.ctest: 13 tests, 12 passed;expert_multi_testfails with the kernel's own refusal (missing AVX512F ... AVX512-VBMI), which is this CPU, not the branch - nothing undersrc/kernelsis touched.git diff --checkclean.Branch is on
99f3dbd(0.1.38); happy to rebase if it has moved by the time you look.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.