Make the env var controlling which SIMD level to use more capable
This commit is contained in:
parent
73342411bc
commit
66341aa28e
2 changed files with 10 additions and 5 deletions
|
|
@ -231,7 +231,10 @@ Variables that kitty sets when running child programs
|
|||
Set to ``1`` when kitty is running a shell because of the ``--hold`` flag. Can
|
||||
be used to specialize shell behavior in the shell rc files as desired.
|
||||
|
||||
.. envvar:: KITTY_NO_SIMD
|
||||
.. envvar:: KITTY_SIMD
|
||||
|
||||
Set it to any value to prevent kitty from using SIMD CPU vector
|
||||
instructions.
|
||||
Set it to ``128`` to use 128 bit vector registers, ``256`` to use 256 bit
|
||||
vector registers or any other value to prevent kitty from using SIMD CPU
|
||||
vector instructions. Warning, this overrides CPU capability detection so
|
||||
will cause kitty to crash with SIGILL if your CPU does not support the
|
||||
necessary SIMD extensions.
|
||||
|
|
|
|||
|
|
@ -139,8 +139,10 @@ init_simd(void *x) {
|
|||
do_check();
|
||||
#endif
|
||||
#endif
|
||||
if (getenv("KITTY_NO_SIMD")) {
|
||||
has_avx2 = false; has_sse4_2 = false;
|
||||
const char *simd_env = getenv("KITTY_SIMD");
|
||||
if (simd_env) {
|
||||
has_sse4_2 = strcmp(simd_env, "128") == 0;
|
||||
has_avx2 = strcmp(simd_env, "256") == 0;
|
||||
}
|
||||
|
||||
#undef do_check
|
||||
|
|
|
|||
Loading…
Reference in a new issue