Inclui possibilidade de desativar instruções AVX #19
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Controle de suporte a instruções AVX
Descrição
Permite ao usuário, via build, desativar o suporte a AVX (Advanced Vector Extensions), que é um conjunto de instruções de CPU que acelera cálculos matemáticos pesados, muito usados em processamento vetorial e aprendizado de máquina. No Dockerfile, por padrão, essas instruções estão ativadas, o que pode causar
core dumpedem CPUs antigas (como algumas do Kubernetes). Neste projeto, essa instrução é importante para a bibliotecallama-cpp-python.Como isso afeta o llama-cpp-python
O
llama-cpp-pythonusa código otimizado que, por padrão, ativa AVX/AVX2 para acelerar a inferência do modelo. Se a CPU não suporta AVX, tentar rodar esse código gera erro Illegal instruction. Desabilitar AVX no build faz o código usar versões menos otimizadas, mas compatíveis com CPUs mais antigas.Configuração
No ambiente de build, crie a variável de ambiente DISABLE_AVX=True, para suportar CPUs mais antigas.
Como identificar se a CPU possui suporte a instruções AVX
lscpu | grep avx Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb ssbd ibrs ibpb stibp ibrs_enhanced tpr_shadow flexpriority ept vpid ept_ad fsgsbase tsc_adjust sgx bmi1 avx2 smep bmi2 erms invpcid avx512f avx512dq rdseed adx smap avx512ifma clflushopt intel_pt avx512cd sha_ni avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves split_lock_detect dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp hwp_pkg_req vnmi avx512vbmi umip pku ospke avx512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx512_bitalg avx512_vpopcntdq rdpid sgx_lc fsrm md_clear flush_l1d arch_capabilitiesCaso o grep acima não retorne informações, não há suporte ao AVX.
Resumo