File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -478,6 +478,17 @@ llama_model_loader::llama_model_loader(
478478 trace = atoi (getenv (" LLAMA_TRACE" ));
479479 }
480480
481+ #ifdef _WIN32
482+ // Cap at MSVC's hard limit of 8192 - https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/setmaxstdio?view=msvc-160
483+ #define _GGML_STDIO_TARGET 2048
484+ int _setmaxstdio_ret = _setmaxstdio (_GGML_STDIO_TARGET);
485+ if (_setmaxstdio_ret == -1 ) {
486+ LLAMA_LOG_INFO (" %s: failed to set max stdio to %d. (setmaxstdio returned -1)\n " , __func__, _GGML_STDIO_TARGET);
487+ } else {
488+ LLAMA_LOG_INFO (" %s: max stdio successfully set to %d\n " , __func__, _setmaxstdio_ret);
489+ }
490+ #endif // _WIN32
491+
481492 if (param_overrides_p != nullptr ) {
482493 for (const struct llama_model_kv_override * p = param_overrides_p; p->key [0 ] != 0 ; p++) {
483494 kv_overrides.insert ({std::string (p->key ), *p});
You can’t perform that action at this time.
0 commit comments