]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commit
cuda: Don't crash when querying memory on device with no free memory. (#25157)
authorcphlipot <redacted>
Sat, 11 Jul 2026 17:13:43 +0000 (10:13 -0700)
committerGitHub <redacted>
Sat, 11 Jul 2026 17:13:43 +0000 (19:13 +0200)
commit3cec3bcd162a410171ded45c11d44725678f0880
tree95eded79cfbf00b853a533e20b9577e0c1d46d69
parent13f2b28b098623391b1aacfd27995e1c8b7de9a9
cuda: Don't crash when querying memory on device with no free memory. (#25157)

If a Cuda device has no or limited available memory, the actual call
to cudaMemGetInfo() itself can cause a fatal crash due to a cuda out
of memory error (there is not enough memory to actually query memory)

This causes an issue because we query memory for all devices at
startup even if the user isn't trying to use the device for inference.

Fix this by making the error non-fatal and assigning zero total/free
memory to the device. This will have the downstream effect of the fit
algorithm not trying to put any layers on it, which is desired outcome
vs hard crashing.

this also prevents crashes in cuda enabled builds when user explicitly
passes '-dev none'
ggml/src/ggml-cuda/ggml-cuda.cu