fix(kyojin): Stop direct expert reads at unaligned EOF

Bead: nix-overlay-qy9
This commit is contained in:
2026-11-18 18:34:42 +03:00
parent 6156a0d904
commit 2b8eddf7d2
3 changed files with 19 additions and 3 deletions
File diff suppressed because one or more lines are too long
@@ -0,0 +1,12 @@
--- a/exllamav3/modules/expert_store.py
+++ b/exllamav3/modules/expert_store.py
@@ -1182,6 +1182,9 @@
if r <= 0:
break # EOF inside the last block: the copies only touch real tensor bytes
got += r
+ # An unaligned EOF cannot be used as the offset for another O_DIRECT read.
+ if got < n and off + got == os.fstat(fd).st_size:
+ break
return got
def _publish(self, lt: LayerTier, item, e: int, s: int):
+6 -3
View File
@@ -6,9 +6,12 @@
cpuCheck,
}:
let
admissionPatch = ./prefix-disk-admission.patch;
enginePatches = [
./prefix-disk-admission.patch
./expert-direct-read-eof.patch
];
engine = exllamav3.overrideAttrs (old: {
patches = (old.patches or [ ]) ++ [ admissionPatch ];
patches = (old.patches or [ ]) ++ enginePatches;
});
# Both the upstream serve wrappers and the CPU check prepend the wheel to PYTHONPATH.
withEngine =
@@ -36,7 +39,7 @@ kyojin.overrideAttrs (old: {
tests = (old.passthru.tests or { }) // {
jit = jitCheck;
cpu = cpuCheck.overrideAttrs (check: {
patches = (check.patches or [ ]) ++ [ admissionPatch ];
patches = (check.patches or [ ]) ++ enginePatches;
checkPhase = withEngine check.checkPhase;
});
};