A fatal CUDA fault in the prompt path exits at once instead of hanging until the watchdog (#224); CMake warns when sm_120 is built with CUDA < 13.0 (#220, #224); iq_pack writes native_experts.txt under a temporary name, so a stop part-way leaves no partial pack (#172)

This commit is contained in:
Niko1221 committed 2026-09-30 14:01:52 +02:00
1 parent c3242f095c
commit bb628ce12f
3 files changed
+19 -1

No files matched your search

+5
View File
@@ -73,6 +73,11 @@ if(STRATA_ENABLE_CUDA)
"Strata needs an NVIDIA GPU of compute capability 7.5 or newer (RTX 20 / 30 / 40 / 50 series), but "
"CMAKE_CUDA_ARCHITECTURES is '${CMAKE_CUDA_ARCHITECTURES}'.")
endif()
# #220 / #224: RTX 50 engines built with CUDA 12.8 crashed in the prompt path on Linux (13.0 and newer did not)
if(_base GREATER_EQUAL 120 AND CMAKE_CUDA_COMPILER_VERSION VERSION_LESS 13.0)
message(WARNING "Building for sm_${_base} (RTX 50) with CUDA ${CMAKE_CUDA_COMPILER_VERSION}: engines built with "
"CUDA 12.8 crashed on long prompts on these cards (issues #220, #224). Use CUDA 13.0 or newer.")
endif()
endforeach()
message(STATUS "Strata: CUDA enabled, arch ${CMAKE_CUDA_ARCHITECTURES}")
set(_strata_gpu_runtime_target CUDA::cudart)
+7
View File
@@ -4044,6 +4044,13 @@ int main(int argc, char** argv) {
if (!stop_req.load()) {
std::fprintf(stderr, "strata serve: %s\n", err.c_str());
std::printf("ERR %s\n", err.c_str());
// #224: a CUDA fault (an illegal address) poisons the context for the whole process, and
// unwinding the destructors on it could hang until the 60 s watchdog: leave at once
if (cudaPeekAtLastError() != cudaSuccess) {
std::fflush(stdout);
std::fflush(stderr);
std::_Exit(1);
}
return 1;
}
cancelled = true; // stopped while reading the prompt: refill the lent slots below, then DONE cancel
+7 -1
View File
@@ -308,7 +308,10 @@ def main() -> int:
blob = per[0] + per[1] + per[2]
layout.append((l, ts[0].type_id, ts[2].type_id, offset, blob, ts))
offset += blob * n_expert
with open(out / "native_experts.txt", "w", encoding="utf-8", newline="\n") as fo:
# written to a temporary name and renamed only when every layer is in: a stop part-way (a layer split across
# shards, #171) left a partial native_experts.txt that the next setup run took as a finished pack (#172)
tmp = out / "native_experts.txt.tmp"
with open(tmp, "w", encoding="utf-8", newline="\n") as fo:
fo.write("# strata native experts v3: layer gu_type d_type offset blob_bytes gate_off up_off down_off [shard] "
"(n_expert %d, total %d; absolute offsets in %s, or in the named shard beside it)\n"
% (n_expert, offset, src.name))
@@ -316,10 +319,13 @@ def main() -> int:
ws = [model.where[t.name] for t in ts]
if len({w[3] for w in ws}) != 1:
print("layer %d: its gate/up/down tensors are in different shards" % l)
fo.close()
tmp.unlink()
return 1
gg, shard = ws[0][0], ws[0][3]
line = "%d %d %d %d %d %d %d %d" % (l, gt, dt, off, blob, *[gg.data_start + t.offset for t in ts])
fo.write(line + ("" if shard == src else " " + shard.name) + "\n")
tmp.replace(out / "native_experts.txt")
if a.skip_experts or not a.experts_bin:
if (out / "experts.bin").exists() and not a.experts_bin:
print("note: %s/experts.bin exists; the engine reads it instead of the GGUF" % out)