Qwen3.8-Flash-Next on any consumer hardware: one-click install for Windows / Linux. Strata inference engine, OpenAI/Anthropic API on localhost, optional image input.
C++
hip gfx1151: keep the sign of Q2_0's negative zero; warn when the auto cache outgrows an APU's host memory (PR #895)
Niko1221f5ab356abd5a
diff --git a/src/kernels/cuda/iq_kernels.cu b/src/kernels/cuda/iq_kernels.cuindex 7a9e4301b..1c20986d5 100644--- a/src/kernels/cuda/iq_kernels.cu+++ b/src/kernels/cuda/iq_kernels.cu@@ -1708,9 +1708,9 @@ __device__ void dq_q2_0(const void* vx, int64_t ibs, dst_t* yy, int tid) {for (int j = 0; j < 8; ++j) {const int i = part * 8 + j;const int code = (x[b].qs[i / 4] >> ((i % 4) * 2)) & 3;-#if defined(__HIPCC__) && defined(__gfx1012__) && HIP_VERSION_MAJOR < 7- // HIP 5.7 on RDNA1 folds the half path's negative scale times +0- // to +0. Preserve the scale's sign, as the FP32/CPU paths do.+#if defined(__HIPCC__) && ((defined(__gfx1012__) && HIP_VERSION_MAJOR < 7) || defined(__gfx1151__))+ // HIP 5.7 on RDNA1 and the HIP compiler on gfx1151 (PR #895, ROCm 7.13) fold the half path's negative scale+ // times +0 to +0. Preserve the scale's sign, as the FP32/CPU paths do.if constexpr (std::is_same_v<dst_t, __half>) {if (code == 1) {yy[b * 64 + i] = __ushort_as_half(__half_as_ushort(x[b].d) & 0x8000u);diff --git a/src/program/generate.cpp b/src/program/generate.cppindex 3b551f3aa..003bf891c 100644--- a/src/program/generate.cpp+++ b/src/program/generate.cpp@@ -3841,6 +3841,26 @@ int main(int argc, char** argv) {std::fprintf(stderr, "strata generate: expert cache auto: %.2f GiB free, %d MiB reserved (+%lld MiB for the ""draft head) -> %d slots\n",(double) free_b / 1073741824.0, o.vram_reserve_mib, (long long) (mtp_bind >> 20), o.expert_cache);+#if defined(STRATA_USE_HIP) && !defined(_WIN32)+ // An APU's "VRAM" is system RAM: the device-free figure above counts the whole GPU-addressable pool and does not+ // subtract ordinary CPU allocations (the host expert arena), so a cache sized from it alone can ask the OOM killer+ // for nearly all RAM (PR #895). A warning, not a cap: the cache stays as asked, and --expert-cache N chooses.+ {+ cudaDeviceProp apu_prop{};+ int apu_dev = 0;+ strata::core::detail::HostMemory hm{};+ if (cudaGetDevice(&apu_dev) == cudaSuccess && cudaGetDeviceProperties(&apu_prop, apu_dev) == cudaSuccess &&+ apu_prop.integrated && strata::core::detail::host_available_memory(hm)) {+ const int64_t host_headroom = 4ll << 30; // the OS and request-time CPU work+ const int64_t cache_b = (int64_t) o.expert_cache * blob;+ if (cache_b > (int64_t) hm.available - host_headroom)+ std::fprintf(stderr, "strata generate: WARNING: this GPU shares system RAM, and the cache above (%.2f GiB) is "+ "more than the host memory available now (%.2f GiB) less 4 GiB for the OS: the system may "+ "run out of memory; --expert-cache N sets the cache by hand\n",+ (double) cache_b / 1073741824.0, (double) hm.available / 1073741824.0);+ }+ }+#endif// #496: the verify window cannot start without a cache (#174), and a cache too small to lend the prompt path// a 256-token chunk's buffers (plus the 128 slots a loan leaves; one slot without --prefill) makes it// allocate its own on top - more than the reserve. When the default reserve leaves less than that (a 6 GB