engine: load every CUDA kernel at start (CUDA_MODULE_LOADING=EAGER)
With lazy loading, a kernel first used mid-prompt found no VRAM left for its code once the expert cache and the prompt path had taken it: IQ3_XXS at 64K and 128K on a 12 GB card ended with 'out of memory: cudaFuncSetAttribute' in the MMQ launch. Loaded at start the kernels cost ~30 MB, accounted before the cache is sized (~23 fewer slots). A user's own CUDA_MODULE_LOADING is kept.
This commit is contained in:
1 parent
dcb0c24422
commit
bef32ed6c3
1 file changed
+10
@@ -759,6 +759,16 @@ int main(int argc, char** argv) {
|
||||
// pipe or a file is block-buffered, so a program that dies loses every line it had already printed - which
|
||||
// turns "it crashed at step 7" into "it crashed somewhere", and the difference is a debugging session.
|
||||
std::setvbuf(stdout, nullptr, _IONBF, 0);
|
||||
// Load every CUDA kernel when the context is created, before the expert cache takes the free VRAM. With the
|
||||
// default lazy loading, a kernel first used mid-prompt (MMQ for IQ3_XXS at 64K+ on a 12 GB card) found no VRAM
|
||||
// left for its code and the engine ended ("out of memory: cudaFuncSetAttribute"). Costs ~30 MB of VRAM.
|
||||
if (std::getenv("CUDA_MODULE_LOADING") == nullptr) {
|
||||
#if defined(_WIN32)
|
||||
_putenv_s("CUDA_MODULE_LOADING", "EAGER");
|
||||
#else
|
||||
setenv("CUDA_MODULE_LOADING", "EAGER", 0);
|
||||
#endif
|
||||
}
|
||||
Options o;
|
||||
bool have_tokens = false;
|
||||
bool have_logits_stride = false;
|
||||
|
||||
Reference in new issue
Block a user