llama.cpp
llama.cpp copied to clipboard
Use VLAs when possible
Regarding https://github.com/ggerganov/llama.cpp/pull/918#issuecomment-1505633286 , and https://github.com/ggerganov/llama.cpp/pull/918#issuecomment-1505599905 and #881, here is another way: use VLAs instead of alloca, when possible.
It uses __STDC_NO_VLA__
to detect if VLAs are unavailable, in which case it falls back to alloca. In that case the program is still not a strictly conforming C program, and the -std=c11
argument to gcc
may evoke warnings, but on the other hand, gcc is quite likely to support VLAs in practice.
Well, like I mentioned before: another option is to stop claiming the program is Standard C (as expressed by -std=c11
and -std=c++11
) and instead admit it isn't: -std=gnu11
and -std=gnu++11
. Whichever is more important to you.