hip gfx1151: keep the sign of Q2_0's negative zero; warn when the auto cache outgrows an APU's host memory (PR #895)
Two pieces of PR #895 that 0.1.40 did not have; the rest of it is in 0.1.40 (gfx1151 in the arch gate, sudot4, setup and the Strix Halo defaults) or is not taken (the ROCm pin bump for every AMD arch). - dq_q2_0: the compiler on gfx1151 (ROCm 7.13) folds the half path's negative scale times +0 to +0, as HIP 5.7 did on gfx1012. The sign-preserving path now covers gfx1151 too. Changes bits on gfx1151 only (the same value the FP32 and CPU paths give); nothing else is touched. - Linux HIP, --expert-cache auto: an APU's "VRAM" is system RAM, and the device-free figure counts the whole GPU-addressable pool, so a cache sized from it can ask the OOM killer for nearly all RAM. The PR capped the cache at the host's free memory less 4 GiB; here it only prints a warning with both numbers and leaves the cache as asked (recommend, never force). --expert-cache N sets it by hand. Compile check only on HIP; the run needs a gfx1151 box. Co-authored-by: mini <dtu@live.de>
This commit is contained in:
1 parent
10f44a98d5
commit
f5ab356abd
2 files changed
+23
-3
No files matched your search
@@ -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
|
||||
|
||||
Reference in new issue
Block a user