#486: a weight arena that does not fit says how much VRAM was free
The weight arena is the first large VRAM allocation and its size does not depend on the context, so when it fails something else holds the card (another program, an engine still exiting). The error now names the CUDA error and the card's free and total VRAM at that moment; a layer split's stage says the same for its card, with the MiB it needed. Error paths only.
This commit is contained in:
1 parent
9ae6dbd2ce
commit
0d61154360
1 file changed
+20
-5
@@ -1990,9 +1990,18 @@ int main(int argc, char** argv) {
|
||||
return 1;
|
||||
}
|
||||
void* arena = nullptr;
|
||||
if (cudaMalloc(&arena, pool_bytes) != cudaSuccess) {
|
||||
std::fprintf(stderr, "strata generate: cudaMalloc(%llu) for the weight arena failed\n",
|
||||
(unsigned long long) pool_bytes);
|
||||
if (const cudaError_t ce = cudaMalloc(&arena, pool_bytes); ce != cudaSuccess) {
|
||||
// #486: the arena is the first large allocation and its size does not depend on the context, so what is
|
||||
// missing is held by something else: say how much was free
|
||||
cudaGetLastError();
|
||||
size_t free_b = 0, total_b = 0;
|
||||
cudaMemGetInfo(&free_b, &total_b);
|
||||
std::fprintf(stderr, "strata generate: cudaMalloc(%llu) for the weight arena failed (%s): %llu MiB of %llu "
|
||||
"MiB VRAM free on this GPU. The arena is allocated first, before the KV and expert "
|
||||
"caches: another program (or an engine that is still exiting) holds the rest - "
|
||||
"nvidia-smi / rocm-smi lists them\n",
|
||||
(unsigned long long) pool_bytes, cudaGetErrorString(ce), (unsigned long long) (free_b >> 20),
|
||||
(unsigned long long) (total_b >> 20));
|
||||
return 1;
|
||||
}
|
||||
strata::core::WeightTable wt;
|
||||
@@ -2297,8 +2306,14 @@ int main(int argc, char** argv) {
|
||||
void* arena_s = nullptr;
|
||||
if (cudaMalloc(&arena_s, pool_bytes) != cudaSuccess ||
|
||||
!st.wt.load(o.pack, arena_s, pool_bytes, err, skip.empty() ? nullptr : &skip)) {
|
||||
std::fprintf(stderr, "strata generate: layer split, CUDA%d weights: %s\n", st.dev,
|
||||
err.empty() ? "the weight arena does not fit" : err.c_str());
|
||||
cudaGetLastError();
|
||||
size_t free_b = 0, total_b = 0; // #486: what that card had free
|
||||
cudaMemGetInfo(&free_b, &total_b);
|
||||
std::fprintf(stderr, "strata generate: layer split, CUDA%d weights: %s (%llu MiB needed, %llu MiB of %llu "
|
||||
"MiB free on that card)\n", st.dev,
|
||||
err.empty() ? "the weight arena does not fit" : err.c_str(),
|
||||
(unsigned long long) (pool_bytes >> 20), (unsigned long long) (free_b >> 20),
|
||||
(unsigned long long) (total_b >> 20));
|
||||
return 1;
|
||||
}
|
||||
if (!o.native_dense_gguf.empty() && !st.dense.load(o.native_dense_gguf, st.wt, err, o.native_ple_key)) {
|
||||
|
||||
Reference in new issue
Block a user