Copy disabled (too large)
Download .txt
Showing preview only (18,463K chars total). Download the full file to get everything.
Repository: mozilla-ai/llamafile
Branch: main
Commit: b02f2e0c540f
Files: 621
Total size: 17.6 MB
Directory structure:
gitextract_8bcuz138/
├── .github/
│ ├── ISSUE_TEMPLATE/
│ │ ├── 01-bug-low.yml
│ │ ├── 02-bug-medium.yml
│ │ ├── 03-bug-high.yml
│ │ ├── 04-bug-critical.yml
│ │ ├── 05-enhancement.yml
│ │ ├── 06-refactor.yml
│ │ ├── 07-refactor.yml
│ │ └── config.yml
│ ├── labeler.yml
│ └── workflows/
│ ├── ci.yml
│ ├── docs.yml
│ ├── editorconfig.yml
│ ├── labeler.yml
│ └── update-llama-cpp.yml
├── .gitignore
├── .gitmodules
├── .llamafile_plugin/
│ └── .claude-plugin/
│ ├── marketplace.json
│ └── plugin.json
├── LICENSE
├── Makefile
├── README.md
├── README_0.10.0.md
├── RELEASE.md
├── build/
│ ├── config.mk
│ ├── cudacc
│ ├── deps.mk
│ ├── download-cosmocc.sh
│ ├── gperf
│ ├── htags
│ ├── llamafile-convert
│ ├── llamafile-upgrade-engine
│ ├── objdump
│ ├── rules.mk
│ ├── run
│ ├── sha256sum.c
│ └── tags.mk
├── cosmocc-override.cmake
├── docs/
│ ├── AGENTS.md
│ ├── commands/
│ │ ├── build.md
│ │ ├── check.md
│ │ └── clean.md
│ ├── creating_llamafiles.md
│ ├── example_llamafiles.md
│ ├── index.md
│ ├── quickstart.md
│ ├── running_llamafile.md
│ ├── skills/
│ │ └── llamafile/
│ │ ├── SKILL.md
│ │ ├── architecture.md
│ │ ├── building.md
│ │ ├── development.md
│ │ ├── testing.md
│ │ └── update_llamacpp.md
│ ├── source_installation.md
│ ├── support.md
│ ├── technical_details.md
│ ├── troubleshooting.md
│ └── whisperfile/
│ ├── getting-started.md
│ ├── gpu.md
│ ├── index.md
│ ├── packaging.md
│ ├── server.md
│ └── translate.md
├── llama.cpp.patches/
│ ├── README.md
│ ├── apply-patches.sh
│ ├── llamafile-files/
│ │ ├── BUILD.mk
│ │ ├── README.llamafile
│ │ └── common/
│ │ └── license.cpp
│ ├── patches/
│ │ ├── common_arg.cpp.patch
│ │ ├── common_chat.cpp.patch
│ │ ├── common_common.cpp.patch
│ │ ├── common_download.cpp.patch
│ │ ├── common_log.cpp.patch
│ │ ├── common_ngram-mod.cpp.patch
│ │ ├── ggml_src_ggml-backend-impl.h.patch
│ │ ├── ggml_src_ggml-backend-reg.cpp.patch
│ │ ├── ggml_src_ggml-backend.cpp.patch
│ │ ├── ggml_src_ggml-cuda_common.cuh.patch
│ │ ├── ggml_src_ggml-cuda_ggml-cuda.cu.patch
│ │ ├── ggml_src_ggml-cuda_solve_tri.cu.patch
│ │ ├── ggml_src_ggml-cuda_vendors_cuda.h.patch
│ │ ├── ggml_src_ggml-metal_ggml-metal.cpp.patch
│ │ ├── ggml_src_gguf.cpp.patch
│ │ ├── src_llama-mmap.cpp.patch
│ │ ├── src_llama-mmap.h.patch
│ │ ├── tools_server_server-queue.cpp.patch
│ │ ├── tools_server_server.cpp.patch
│ │ └── vendor_cpp-httplib_httplib.cpp.patch
│ └── renames.sh
├── llamafile/
│ ├── BUILD.mk
│ ├── args.cpp
│ ├── args.h
│ ├── bestline.c
│ ├── bestline.h
│ ├── build-functions.sh
│ ├── chatbot.h
│ ├── chatbot_api.cpp
│ ├── chatbot_backend.h
│ ├── chatbot_cli.cpp
│ ├── chatbot_comm.cpp
│ ├── chatbot_comp.cpp
│ ├── chatbot_direct.cpp
│ ├── chatbot_eval.cpp
│ ├── chatbot_file.cpp
│ ├── chatbot_help.cpp
│ ├── chatbot_hint.cpp
│ ├── chatbot_hist.cpp
│ ├── chatbot_logo.cpp
│ ├── chatbot_main.cpp
│ ├── chatbot_repl.cpp
│ ├── check_cpu.c
│ ├── color.h
│ ├── compute.cpp
│ ├── compute.h
│ ├── cuda.c
│ ├── cuda.sh
│ ├── datauri.cpp
│ ├── datauri.h
│ ├── extract_data_uris.cpp
│ ├── highlight/
│ │ ├── BUILD.mk
│ │ ├── color_bleeder.cpp
│ │ ├── highlight.cpp
│ │ ├── highlight.h
│ │ ├── highlight_ada.cpp
│ │ ├── highlight_asm.cpp
│ │ ├── highlight_basic.cpp
│ │ ├── highlight_bnf.cpp
│ │ ├── highlight_c.cpp
│ │ ├── highlight_c_test.cpp
│ │ ├── highlight_cmake.cpp
│ │ ├── highlight_cobol.cpp
│ │ ├── highlight_create.gperf
│ │ ├── highlight_csharp.cpp
│ │ ├── highlight_css.cpp
│ │ ├── highlight_d.cpp
│ │ ├── highlight_forth.cpp
│ │ ├── highlight_fortran.cpp
│ │ ├── highlight_go.cpp
│ │ ├── highlight_haskell.cpp
│ │ ├── highlight_html.cpp
│ │ ├── highlight_java.cpp
│ │ ├── highlight_js.cpp
│ │ ├── highlight_julia.cpp
│ │ ├── highlight_kotlin.cpp
│ │ ├── highlight_ld.cpp
│ │ ├── highlight_lisp.cpp
│ │ ├── highlight_lua.cpp
│ │ ├── highlight_m4.cpp
│ │ ├── highlight_make.cpp
│ │ ├── highlight_markdown.cpp
│ │ ├── highlight_matlab.cpp
│ │ ├── highlight_ocaml.cpp
│ │ ├── highlight_pascal.cpp
│ │ ├── highlight_perl.cpp
│ │ ├── highlight_php.cpp
│ │ ├── highlight_python.cpp
│ │ ├── highlight_python_test.cpp
│ │ ├── highlight_r.cpp
│ │ ├── highlight_ruby.cpp
│ │ ├── highlight_rust.cpp
│ │ ├── highlight_scala.cpp
│ │ ├── highlight_shell.cpp
│ │ ├── highlight_sql.cpp
│ │ ├── highlight_swift.cpp
│ │ ├── highlight_tcl.cpp
│ │ ├── highlight_test.cpp
│ │ ├── highlight_tex.cpp
│ │ ├── highlight_txt.cpp
│ │ ├── highlight_typescript.cpp
│ │ ├── highlight_zig.cpp
│ │ ├── is_keyword_ada.gperf
│ │ ├── is_keyword_ada_constant.gperf
│ │ ├── is_keyword_asm_prefix.gperf
│ │ ├── is_keyword_asm_qualifier.gperf
│ │ ├── is_keyword_basic.gperf
│ │ ├── is_keyword_basic_builtin.gperf
│ │ ├── is_keyword_basic_constant.gperf
│ │ ├── is_keyword_basic_type.gperf
│ │ ├── is_keyword_c.gperf
│ │ ├── is_keyword_c_builtin.gperf
│ │ ├── is_keyword_c_constant.gperf
│ │ ├── is_keyword_c_pod.gperf
│ │ ├── is_keyword_c_type.gperf
│ │ ├── is_keyword_cmake.gperf
│ │ ├── is_keyword_cobol.gperf
│ │ ├── is_keyword_cpp.gperf
│ │ ├── is_keyword_csharp.gperf
│ │ ├── is_keyword_csharp_constant.gperf
│ │ ├── is_keyword_css_at.gperf
│ │ ├── is_keyword_css_bang.gperf
│ │ ├── is_keyword_cxx.gperf
│ │ ├── is_keyword_d.gperf
│ │ ├── is_keyword_d_constant.gperf
│ │ ├── is_keyword_forth.gperf
│ │ ├── is_keyword_forth_def.gperf
│ │ ├── is_keyword_fortran.gperf
│ │ ├── is_keyword_fortran_builtin.gperf
│ │ ├── is_keyword_fortran_type.gperf
│ │ ├── is_keyword_go.gperf
│ │ ├── is_keyword_go_type.gperf
│ │ ├── is_keyword_haskell.gperf
│ │ ├── is_keyword_java.gperf
│ │ ├── is_keyword_java_constant.gperf
│ │ ├── is_keyword_js.gperf
│ │ ├── is_keyword_js_builtin.gperf
│ │ ├── is_keyword_js_constant.gperf
│ │ ├── is_keyword_julia.gperf
│ │ ├── is_keyword_kotlin.gperf
│ │ ├── is_keyword_ld.gperf
│ │ ├── is_keyword_ld_builtin.gperf
│ │ ├── is_keyword_ld_warning.gperf
│ │ ├── is_keyword_lisp.gperf
│ │ ├── is_keyword_lua.gperf
│ │ ├── is_keyword_lua_builtin.gperf
│ │ ├── is_keyword_lua_constant.gperf
│ │ ├── is_keyword_m4.gperf
│ │ ├── is_keyword_make.gperf
│ │ ├── is_keyword_make_builtin.gperf
│ │ ├── is_keyword_matlab.gperf
│ │ ├── is_keyword_matlab_builtin.gperf
│ │ ├── is_keyword_matlab_constant.gperf
│ │ ├── is_keyword_ocaml.gperf
│ │ ├── is_keyword_ocaml_builtin.gperf
│ │ ├── is_keyword_ocaml_constant.gperf
│ │ ├── is_keyword_pascal.gperf
│ │ ├── is_keyword_pascal_builtin.gperf
│ │ ├── is_keyword_pascal_type.gperf
│ │ ├── is_keyword_perl.gperf
│ │ ├── is_keyword_php.gperf
│ │ ├── is_keyword_php_constant.gperf
│ │ ├── is_keyword_python.gperf
│ │ ├── is_keyword_python_builtin.gperf
│ │ ├── is_keyword_python_constant.gperf
│ │ ├── is_keyword_r.gperf
│ │ ├── is_keyword_r_builtin.gperf
│ │ ├── is_keyword_r_constant.gperf
│ │ ├── is_keyword_ruby.gperf
│ │ ├── is_keyword_ruby_builtin.gperf
│ │ ├── is_keyword_ruby_constant.gperf
│ │ ├── is_keyword_rust.gperf
│ │ ├── is_keyword_rust_constant.gperf
│ │ ├── is_keyword_rust_type.gperf
│ │ ├── is_keyword_scala.gperf
│ │ ├── is_keyword_shell.gperf
│ │ ├── is_keyword_shell_builtin.gperf
│ │ ├── is_keyword_sql.gperf
│ │ ├── is_keyword_sql_type.gperf
│ │ ├── is_keyword_swift.gperf
│ │ ├── is_keyword_swift_builtin.gperf
│ │ ├── is_keyword_swift_constant.gperf
│ │ ├── is_keyword_swift_type.gperf
│ │ ├── is_keyword_tcl.gperf
│ │ ├── is_keyword_tcl_builtin.gperf
│ │ ├── is_keyword_tcl_type.gperf
│ │ ├── is_keyword_typescript.gperf
│ │ ├── is_keyword_typescript_type.gperf
│ │ ├── is_keyword_zig.gperf
│ │ ├── is_keyword_zig_builtin.gperf
│ │ ├── is_keyword_zig_constant.gperf
│ │ ├── is_keyword_zig_type.gperf
│ │ ├── util.cpp
│ │ └── util.h
│ ├── image.cpp
│ ├── image.h
│ ├── iqk_mul_mat.inc
│ ├── iqk_mul_mat_amd_avx2.cpp
│ ├── iqk_mul_mat_amd_zen4.cpp
│ ├── iqk_mul_mat_arm82.cpp
│ ├── llama.cpp
│ ├── llama.h
│ ├── llamafile.c
│ ├── llamafile.h
│ ├── macros.h
│ ├── main.cpp
│ ├── metal.c
│ ├── rocm.sh
│ ├── sgemm.cpp
│ ├── sgemm.h
│ ├── string.cpp
│ ├── string.h
│ ├── tinyblas-compat.h
│ ├── tinyblas.cu
│ ├── tinyblas.h
│ ├── tinyblas_cpu.h
│ ├── tinyblas_cpu_mixmul.inc
│ ├── tinyblas_cpu_mixmul_amd_avx.cpp
│ ├── tinyblas_cpu_mixmul_amd_avx2.cpp
│ ├── tinyblas_cpu_mixmul_amd_avx512f.cpp
│ ├── tinyblas_cpu_mixmul_amd_avxvnni.cpp
│ ├── tinyblas_cpu_mixmul_amd_fma.cpp
│ ├── tinyblas_cpu_mixmul_amd_zen4.cpp
│ ├── tinyblas_cpu_mixmul_arm80.cpp
│ ├── tinyblas_cpu_mixmul_arm82.cpp
│ ├── tinyblas_cpu_sgemm.inc
│ ├── tinyblas_cpu_sgemm_amd_avx.cpp
│ ├── tinyblas_cpu_sgemm_amd_avx2.cpp
│ ├── tinyblas_cpu_sgemm_amd_avx512f.cpp
│ ├── tinyblas_cpu_sgemm_amd_avxvnni.cpp
│ ├── tinyblas_cpu_sgemm_amd_fma.cpp
│ ├── tinyblas_cpu_sgemm_amd_zen4.cpp
│ ├── tinyblas_cpu_sgemm_arm80.cpp
│ ├── tinyblas_cpu_sgemm_arm82.cpp
│ ├── tinyblas_cpu_unsupported.cpp
│ ├── version.h
│ ├── xterm.cpp
│ ├── xterm.h
│ ├── zip.c
│ └── zip.h
├── localscore/
│ ├── BUILD.mk
│ ├── README.md
│ ├── apple.cpp
│ ├── apple.h
│ ├── ascii_digits.h
│ ├── benchmark.cpp
│ ├── benchmark.h
│ ├── cmd.cpp
│ ├── cmd.h
│ ├── cuda.bat
│ ├── cuda.sh
│ ├── doc/
│ │ └── troubleshooting.md
│ ├── http.cpp
│ ├── http.h
│ ├── localscore.cpp
│ ├── localscore.h
│ ├── main.cpp
│ ├── net.h
│ ├── nvml.cpp
│ ├── nvml.h
│ ├── powersampler.cpp
│ ├── powersampler.h
│ ├── printer.cpp
│ ├── printer.h
│ ├── rsmi.cpp
│ ├── rsmi.h
│ ├── system.cpp
│ ├── system.h
│ └── utils.h
├── mkdocs.yml
├── models/
│ └── TinyLLama-v0.1-5M-F16.gguf
├── stable-diffusion.cpp.patches/
│ ├── apply-patches.sh
│ ├── llamafile-files/
│ │ ├── BUILD.mk
│ │ ├── README.llamafile
│ │ ├── darts.h
│ │ ├── main.cpp
│ │ ├── miniz.h
│ │ ├── zip.c
│ │ └── zip.h
│ └── patches/
│ └── save.patch
├── tests/
│ ├── BUILD.mk
│ ├── extract_data_uris_test.cpp
│ ├── integration/
│ │ ├── README.md
│ │ ├── conftest.py
│ │ ├── pyproject.toml
│ │ ├── run_tests.sh
│ │ ├── tests/
│ │ │ ├── test_cli.py
│ │ │ ├── test_combined.py
│ │ │ ├── test_gpu.py
│ │ │ ├── test_multimodal.py
│ │ │ ├── test_server.py
│ │ │ ├── test_tool_calling.py
│ │ │ └── test_tui.py
│ │ └── utils/
│ │ └── llamafile.py
│ └── sgemm/
│ ├── BUILD.mk
│ ├── iqk_test.cpp
│ ├── q8_0_layout_test.cpp
│ ├── sgemm_matmul_test.cpp
│ ├── sgemm_sss_test.cpp
│ ├── sgemm_test_utils.h
│ └── sgemm_vecdot_test.cpp
├── third_party/
│ ├── BUILD.mk
│ ├── double-conversion/
│ │ ├── .gitignore
│ │ ├── AUTHORS
│ │ ├── BUILD.mk
│ │ ├── LICENSE
│ │ ├── README.llamafile
│ │ ├── SConscript
│ │ ├── bignum-dtoa.cc
│ │ ├── bignum-dtoa.h
│ │ ├── bignum.cc
│ │ ├── bignum.h
│ │ ├── cached-powers.cc
│ │ ├── cached-powers.h
│ │ ├── diy-fp.h
│ │ ├── double-conversion.h
│ │ ├── double-to-string.cc
│ │ ├── double-to-string.h
│ │ ├── fast-dtoa.cc
│ │ ├── fast-dtoa.h
│ │ ├── fixed-dtoa.cc
│ │ ├── fixed-dtoa.h
│ │ ├── ieee.h
│ │ ├── string-to-double.cc
│ │ ├── string-to-double.h
│ │ ├── strtod.cc
│ │ ├── strtod.h
│ │ └── utils.h
│ ├── mbedtls/
│ │ ├── BUILD.mk
│ │ ├── LICENSE
│ │ ├── README.cosmo
│ │ ├── README.llamafile
│ │ ├── aes.c
│ │ ├── aes.h
│ │ ├── aesce.c
│ │ ├── aesce.h
│ │ ├── aesni.c
│ │ ├── aesni.h
│ │ ├── asn1.h
│ │ ├── asn1parse.c
│ │ ├── asn1write.c
│ │ ├── asn1write.h
│ │ ├── base64.c
│ │ ├── base64.h
│ │ ├── bigmul.c
│ │ ├── bigmul4.c
│ │ ├── bignum.c
│ │ ├── bignum.h
│ │ ├── bignum_internal.h
│ │ ├── bigshift.c
│ │ ├── blake2b256.c
│ │ ├── ccm.c
│ │ ├── ccm.h
│ │ ├── certs.c
│ │ ├── certs.h
│ │ ├── chacha20.c
│ │ ├── chacha20.h
│ │ ├── chachapoly.c
│ │ ├── chachapoly.h
│ │ ├── check.inc
│ │ ├── chk.h
│ │ ├── cipher.c
│ │ ├── cipher.h
│ │ ├── cipher_internal.h
│ │ ├── cipher_wrap.c
│ │ ├── common.h
│ │ ├── config.h
│ │ ├── ctr_drbg.c
│ │ ├── ctr_drbg.h
│ │ ├── debug.c
│ │ ├── debug.h
│ │ ├── des.c
│ │ ├── des.h
│ │ ├── describecode.c
│ │ ├── dhm.c
│ │ ├── dhm.h
│ │ ├── ecdh.c
│ │ ├── ecdh.h
│ │ ├── ecdh_everest.c
│ │ ├── ecdh_everest.h
│ │ ├── ecdsa.c
│ │ ├── ecdsa.h
│ │ ├── ecp.c
│ │ ├── ecp.h
│ │ ├── ecp256.c
│ │ ├── ecp384.c
│ │ ├── ecp_curves.c
│ │ ├── ecp_internal.h
│ │ ├── ecpshl.c
│ │ ├── endian.h
│ │ ├── entropy.c
│ │ ├── entropy.h
│ │ ├── entropy_poll.c
│ │ ├── entropy_poll.h
│ │ ├── error.c
│ │ ├── error.h
│ │ ├── everest.c
│ │ ├── everest.h
│ │ ├── fastdiv.h
│ │ ├── formatclientciphers.c
│ │ ├── gcm.c
│ │ ├── gcm.h
│ │ ├── getalertdescription.c
│ │ ├── getciphersuite.c
│ │ ├── getciphersuitename.c
│ │ ├── getsslstatename.c
│ │ ├── hkdf.c
│ │ ├── hkdf.h
│ │ ├── hmac_drbg.c
│ │ ├── hmac_drbg.h
│ │ ├── iana.h
│ │ ├── isciphersuitegood.c
│ │ ├── karatsuba.c
│ │ ├── math.h
│ │ ├── md.c
│ │ ├── md.h
│ │ ├── md5.c
│ │ ├── md5.h
│ │ ├── md5t.c
│ │ ├── mdtype.c
│ │ ├── memory_buffer_alloc.c
│ │ ├── memory_buffer_alloc.h
│ │ ├── net_sockets.c
│ │ ├── net_sockets.h
│ │ ├── nist_kw.c
│ │ ├── nist_kw.h
│ │ ├── notice.c
│ │ ├── oid.c
│ │ ├── oid.h
│ │ ├── param.c
│ │ ├── pem.c
│ │ ├── pem.h
│ │ ├── pk.c
│ │ ├── pk.h
│ │ ├── pk_internal.h
│ │ ├── pk_wrap.c
│ │ ├── pkcs5.c
│ │ ├── pkcs5.h
│ │ ├── pkparse.c
│ │ ├── pktype.c
│ │ ├── pkwrite.c
│ │ ├── platform.c
│ │ ├── platform.h
│ │ ├── poly1305.c
│ │ ├── poly1305.h
│ │ ├── profile.h
│ │ ├── rando.c
│ │ ├── rsa.c
│ │ ├── rsa.h
│ │ ├── rsa_internal.c
│ │ ├── rsa_internal.h
│ │ ├── san.c
│ │ ├── san.h
│ │ ├── secp256r1.c
│ │ ├── secp384r1.c
│ │ ├── select.h
│ │ ├── sha1.c
│ │ ├── sha1.h
│ │ ├── sha1t.c
│ │ ├── sha256.c
│ │ ├── sha256.h
│ │ ├── sha256t.c
│ │ ├── sha512.c
│ │ ├── sha512.h
│ │ ├── sha512t.c
│ │ ├── shakedescription.c
│ │ ├── shiftright-avx.c
│ │ ├── shiftright.c
│ │ ├── sigalg.c
│ │ ├── speed.sh
│ │ ├── srtp.c
│ │ ├── ssl.h
│ │ ├── ssl_cache.c
│ │ ├── ssl_cache.h
│ │ ├── ssl_ciphersuites.c
│ │ ├── ssl_ciphersuites.h
│ │ ├── ssl_cli.c
│ │ ├── ssl_cookie.c
│ │ ├── ssl_cookie.h
│ │ ├── ssl_internal.h
│ │ ├── ssl_invasive.h
│ │ ├── ssl_msg.c
│ │ ├── ssl_srv.c
│ │ ├── ssl_ticket.c
│ │ ├── ssl_ticket.h
│ │ ├── ssl_tls.c
│ │ ├── ssl_tls13_keys.c
│ │ ├── ssl_tls13_keys.h
│ │ ├── sslroot/
│ │ │ ├── amazon.pem
│ │ │ ├── certum.pem
│ │ │ ├── comodo.pem
│ │ │ ├── digicert.pem
│ │ │ ├── geotrust.pem
│ │ │ ├── globalsign.pem
│ │ │ ├── godaddy.pem
│ │ │ ├── google.pem
│ │ │ ├── isrg.pem
│ │ │ ├── quovadis.pem
│ │ │ ├── redbean.pem
│ │ │ ├── show.sh
│ │ │ ├── starfield.pem
│ │ │ └── verisign.pem
│ │ ├── sslroots.c
│ │ ├── version.h
│ │ ├── x509.c
│ │ ├── x509.h
│ │ ├── x509_create.c
│ │ ├── x509_crl.c
│ │ ├── x509_crl.h
│ │ ├── x509_crt.c
│ │ ├── x509_crt.h
│ │ ├── x509_csr.c
│ │ ├── x509_csr.h
│ │ ├── x509write_crt.c
│ │ ├── x509write_csr.c
│ │ └── zeroize.c
│ ├── sqlite/
│ │ ├── BUILD.mk
│ │ ├── README.llamafile
│ │ ├── shell.c
│ │ ├── sqlite3.c
│ │ ├── sqlite3.h
│ │ └── sqlite3ext.h
│ └── stb/
│ ├── BUILD.mk
│ ├── README.llamafile
│ ├── stb_image.c
│ ├── stb_image.h
│ ├── stb_image_resize2.c
│ ├── stb_image_resize2.h
│ ├── stb_image_write.c
│ ├── stb_image_write.h
│ ├── stb_vorbis.c
│ └── stb_vorbis.h
├── tools/
│ ├── check_patches.sh
│ └── generate_patches.sh
├── whisper.cpp.patches/
│ ├── apply-patches.sh
│ ├── llamafile-files/
│ │ └── BUILD.mk
│ ├── patches/
│ │ ├── examples_cli_cli.cpp.patch
│ │ ├── examples_common.cpp.patch
│ │ ├── examples_miniaudio.h.patch
│ │ ├── examples_server_server.cpp.patch
│ │ └── ggml_src_ggml-backend-reg.cpp.patch
│ └── renames.sh
└── whisperfile/
├── BUILD.mk
├── color.cpp
├── color.h
├── mic2raw.cpp
├── mic2txt.cpp
├── slurp.cpp
├── slurp.h
├── stream.cpp
├── whisper-server.1
├── whisper-server.cpp
├── whisperfile.1
└── whisperfile.cpp
================================================
FILE CONTENTS
================================================
================================================
FILE: .github/ISSUE_TEMPLATE/01-bug-low.yml
================================================
name: Low Severity Bugs
description: Used to report low severity bugs in llamafiles (e.g. cosmetic issues, non critical UI glitches)
title: "Bug: "
labels: ["bug", "low severity"]
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this bug report!
Please include information about your system, the steps to reproduce the bug,
and the version of llamafiles that you are using.
If possible, please provide a minimal code example that reproduces the bug.
You may also consider using function call tracing `--ftrace` or the lighter system call tracing `--strace`
for additional technical logging that may allow us to narrow down where the fault occurred.
- type: input
id: contact
attributes:
label: Contact Details
description: How can we get in touch with you if we need more info?
placeholder: ex. email@example.com
validations:
required: false
- type: textarea
id: what-happened
attributes:
label: What happened?
description: Also tell us, what did you expect to happen?
placeholder: Tell us what you see!
validations:
required: true
- type: textarea
id: version
attributes:
label: Version
description: What version of our software are you running? (use `--version` to get a version string)
placeholder: "llamafile v0.8.4"
validations:
required: true
- type: dropdown
id: operating-system
attributes:
label: What operating system are you seeing the problem on?
multiple: true
options:
- Linux
- Mac
- Windows
- FreeBSD
- OpenBSD
- NetBSD
- BIOS
validations:
required: false
- type: textarea
id: logs
attributes:
label: Relevant log output
description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks.
render: shell
================================================
FILE: .github/ISSUE_TEMPLATE/02-bug-medium.yml
================================================
name: Medium Severity Bug
description: Used to report medium severity bugs in llamafiles (e.g. Malfunctioning Features but generally still useable)
title: "Bug: "
labels: ["bug", "medium severity"]
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this bug report!
Please include information about your system, the steps to reproduce the bug,
and the version of llamafiles that you are using.
If possible, please provide a minimal code example that reproduces the bug.
You may also consider using function call tracing `--ftrace` or the lighter system call tracing `--strace`
for additional technical logging that may allow us to narrow down where the fault occurred.
- type: input
id: contact
attributes:
label: Contact Details
description: How can we get in touch with you if we need more info?
placeholder: ex. email@example.com
validations:
required: false
- type: textarea
id: what-happened
attributes:
label: What happened?
description: Also tell us, what did you expect to happen?
placeholder: Tell us what you see!
validations:
required: true
- type: textarea
id: version
attributes:
label: Version
description: What version of our software are you running? (use `--version` to get a version string)
placeholder: "llamafile v0.8.4"
validations:
required: true
- type: dropdown
id: operating-system
attributes:
label: What operating system are you seeing the problem on?
multiple: true
options:
- Linux
- Mac
- Windows
- FreeBSD
- OpenBSD
- NetBSD
- BIOS
validations:
required: false
- type: textarea
id: logs
attributes:
label: Relevant log output
description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks.
render: shell
================================================
FILE: .github/ISSUE_TEMPLATE/03-bug-high.yml
================================================
name: High Severity Bug
description: Used to report high severity bugs in llamafiles (e.g. Malfunctioning features hindering important common workflow)
title: "Bug: "
labels: ["bug", "high severity"]
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this bug report!
Please include information about your system, the steps to reproduce the bug,
and the version of llamafiles that you are using.
If possible, please provide a minimal code example that reproduces the bug.
You may also consider using function call tracing `--ftrace` or the lighter system call tracing `--strace`
for additional technical logging that may allow us to narrow down where the fault occurred.
- type: input
id: contact
attributes:
label: Contact Details
description: How can we get in touch with you if we need more info?
placeholder: ex. email@example.com
validations:
required: false
- type: textarea
id: what-happened
attributes:
label: What happened?
description: Also tell us, what did you expect to happen?
placeholder: Tell us what you see!
validations:
required: true
- type: textarea
id: version
attributes:
label: Version
description: What version of our software are you running? (use `--version` to get a version string)
placeholder: "llamafile v0.8.4"
validations:
required: true
- type: dropdown
id: operating-system
attributes:
label: What operating system are you seeing the problem on?
multiple: true
options:
- Linux
- Mac
- Windows
- FreeBSD
- OpenBSD
- NetBSD
- BIOS
validations:
required: false
- type: textarea
id: logs
attributes:
label: Relevant log output
description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks.
render: shell
================================================
FILE: .github/ISSUE_TEMPLATE/04-bug-critical.yml
================================================
name: Critical Severity Bug
description: Used to report critical severity bugs in llamafiles (e.g. Crashing, Corrupted, Dataloss)
title: "Bug: "
labels: ["bug", "critical severity"]
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this bug report!
Please include information about your system, the steps to reproduce the bug,
and the version of llamafiles that you are using.
If possible, please provide a minimal code example that reproduces the bug.
You may also consider using function call tracing `--ftrace` or the lighter system call tracing `--strace`
for additional technical logging that may allow us to narrow down where the fault occurred.
- type: input
id: contact
attributes:
label: Contact Details
description: How can we get in touch with you if we need more info?
placeholder: ex. email@example.com
validations:
required: false
- type: textarea
id: what-happened
attributes:
label: What happened?
description: Also tell us, what did you expect to happen?
placeholder: Tell us what you see!
validations:
required: true
- type: textarea
id: version
attributes:
label: Version
description: What version of our software are you running? (use `--version` to get a version string)
placeholder: "llamafile v0.8.4"
validations:
required: true
- type: dropdown
id: operating-system
attributes:
label: What operating system are you seeing the problem on?
multiple: true
options:
- Linux
- Mac
- Windows
- FreeBSD
- OpenBSD
- NetBSD
- BIOS
validations:
required: false
- type: textarea
id: logs
attributes:
label: Relevant log output
description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks.
render: shell
================================================
FILE: .github/ISSUE_TEMPLATE/05-enhancement.yml
================================================
name: Enhancement template
description: Used to request enhancements for llamafiles
title: "Feature Request: "
labels: ["enhancement"]
body:
- type: markdown
attributes:
value: |
[Please post your idea first in Discussion if there is not yet a consensus for this enhancement request. This will help to keep this issue tracker focused on enhancements that the community has agreed needs to be implemented.](https://github.com/Mozilla-Ocho/llamafile/discussions/categories/ideas)
- type: checkboxes
id: prerequisites
attributes:
label: Prerequisites
description: Please confirm the following before submitting your enhancement request.
options:
- label: I am running the latest code. Mention the version if possible as well.
required: true
- label: I carefully followed the [README.md](https://github.com/Mozilla-Ocho/llamafile/blob/master/README.md).
required: true
- label: I searched using keywords relevant to my issue to make sure that I am creating a new issue that is not already open (or closed).
required: true
- label: I reviewed the [Discussions](https://github.com/Mozilla-Ocho/llamafile/discussions), and have a new and useful enhancement to share.
required: true
- type: textarea
id: feature-description
attributes:
label: Feature Description
description: Please provide a detailed written description of what you were trying to do, and what you expected `llamafiles` to do as an enhancement.
placeholder: Detailed description of the enhancement
validations:
required: true
- type: textarea
id: motivation
attributes:
label: Motivation
description: Please provide a detailed written description of reasons why this feature is necessary and how it is useful to `llamafiles` users.
placeholder: Explanation of why this feature is needed and its benefits
validations:
required: true
- type: textarea
id: possible-implementation
attributes:
label: Possible Implementation
description: If you have an idea as to how it can be implemented, please write a detailed description. Feel free to give links to external sources or share visuals that might be helpful to understand the details better.
placeholder: Detailed description of potential implementation
validations:
required: false
================================================
FILE: .github/ISSUE_TEMPLATE/06-refactor.yml
================================================
name: Refactor (Maintainers)
description: Used to track refactoring opportunities
title: "Refactor: "
labels: ["refactor"]
body:
- type: markdown
attributes:
value: |
Don't forget to [check for existing refactor issue tickets](https://github.com/Mozilla-Ocho/llamafile/issues?q=is%3Aopen+is%3Aissue+label%3Arefactoring) in case it's already covered.
Also you may want to check [Pull request refactor label as well](https://github.com/Mozilla-Ocho/llamafile/pulls?q=is%3Aopen+is%3Apr+label%3Arefactoring) for duplicates too.
- type: textarea
id: background-description
attributes:
label: Background Description
description: Please provide a detailed written description of the pain points you are trying to solve.
placeholder: Detailed description behind your motivation to request refactor
validations:
required: true
- type: textarea
id: possible-approaches
attributes:
label: Possible Refactor Approaches
description: If you have some idea of possible approaches to solve this problem. You may want to make it a todo list.
placeholder: Your idea of possible refactoring opportunity/approaches
validations:
required: false
================================================
FILE: .github/ISSUE_TEMPLATE/07-refactor.yml
================================================
name: Refactor (Maintainers)
description: Used to track refactoring opportunities
title: "Refactor: "
labels: ["refactor"]
body:
- type: markdown
attributes:
value: |
Don't forget to [check for existing refactor issue tickets](https://github.com/Mozilla-Ocho/llamafile/issues?q=is%3Aopen+is%3Aissue+label%3Arefactoring) in case it's already covered.
Also you may want to check [Pull request refactor label as well](https://github.com/Mozilla-Ocho/llamafile/pulls?q=is%3Aopen+is%3Apr+label%3Arefactoring) for duplicates too.
- type: textarea
id: background-description
attributes:
label: Background Description
description: Please provide a detailed written description of the pain points you are trying to solve.
placeholder: Detailed description behind your motivation to request refactor
validations:
required: true
- type: textarea
id: possible-approaches
attributes:
label: Possible Refactor Approaches
description: If you have some idea of possible approaches to solve this problem. You may want to make it a todo list.
placeholder: Your idea of possible refactoring opportunity/approaches
validations:
required: false
================================================
FILE: .github/ISSUE_TEMPLATE/config.yml
================================================
blank_issues_enabled: true
contact_links:
- name: Got an idea?
url: https://github.com/Mozilla-Ocho/llamafile/discussions/categories/ideas
about: Pop it there. It may then become an enhancement ticket.
- name: Got a question?
url: https://github.com/Mozilla-Ocho/llamafile/discussions/categories/q-a
about: Ask a question there!
- name: Is your problem more about the underlying llama.cpp engine?
url: https://github.com/ggerganov/llama.cpp/issues/new/choose
about: Head to the llama.cpp reporting page instead
================================================
FILE: .github/labeler.yml
================================================
# https://github.com/actions/labeler
documentation:
- changed-files:
- any-glob-to-any-file:
- README.md
- LICENSE
- docs/**
testing:
- changed-files:
- any-glob-to-any-file:
- tests/**
build:
- changed-files:
- any-glob-to-any-file:
- cmake/**
- CMakeLists.txt
- CMakePresets.json
- codecov.yml
llama.cpp:
- changed-files:
- any-glob-to-any-file: llama.cpp/**
llamafile:
- changed-files:
- any-glob-to-any-file: llamafile/**
devops:
- changed-files:
- any-glob-to-any-file:
- .devops/**
- .github/**
================================================
FILE: .github/workflows/ci.yml
================================================
name: CI
on:
workflow_dispatch:
push:
branches: [ master, main, fix ]
pull_request:
branches: [ master, main, fix ]
jobs:
ubuntu-focal-make:
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- name: Clone
id: checkout
uses: actions/checkout@v4
- name: Dependencies
id: depends
run: |
sudo apt-get update
sudo apt-get install make patch
- name: Setup dependencies and patch dependencies
run: |
make setup
- name: Cache cosmocc toolchain
id: cache-cosmocc-toolchain
uses: actions/cache@v4
env:
cache-name: cache-cosmocc-toolchain
with:
path: |
.cosmocc
o/depend
o/depend.test
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/config.mk') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}
- name: Setup cosmocc and ape loader
run: |
sudo make cosmocc-ci PREFIX=/usr
- name: Build
run: |
sudo make -j $(nproc)
- name: Make Llamafile
run: |
cp ./models/TinyLLama-v0.1-5M-F16.gguf tinyllama.gguf
cat << EoF > .args
-m
tinyllama.gguf
...
EoF
cp o//llamafile/llamafile \
tinyllama.llamafile
o//third_party/zipalign/zipalign -j0 \
tinyllama.llamafile \
tinyllama.gguf \
.args
- name: Execute LLM CLI CPU
run: |
./tinyllama.llamafile --cli -p '## Famous Speech\n\nFour score and seven'
================================================
FILE: .github/workflows/docs.yml
================================================
name: Documentation
on:
push:
branches: [main]
paths:
- mkdocs.yml
- 'docs/**'
- '.github/workflows/docs.yml'
pull_request:
paths:
- mkdocs.yml
- 'docs/**'
- '.github/workflows/docs.yml'
workflow_dispatch:
jobs:
docs:
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- name: Check out the repository
uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Configure git
run: |
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
- name: Install dependencies
run: |
pip install mkdocs-material
- name: Build docs
if: github.event_name == 'pull_request'
run: mkdocs build -s
- name: Publish docs
if: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }}
run: mkdocs gh-deploy --force
================================================
FILE: .github/workflows/editorconfig.yml
================================================
name: EditorConfig Checker
on:
workflow_dispatch: # allows manual triggering
inputs:
create_release:
description: 'Create new release'
required: true
type: boolean
push:
branches:
- master
pull_request:
branches:
- master
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref && github.ref || github.run_id }}
cancel-in-progress: true
jobs:
editorconfig:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: editorconfig-checker/action-editorconfig-checker@main
- run: editorconfig-checker
================================================
FILE: .github/workflows/labeler.yml
================================================
name: "Pull Request Labeler"
on:
- pull_request_target
jobs:
labeler:
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
repository: "Mozilla-Ocho/llamafile"
- uses: actions/labeler@v5
with:
configuration-path: '.github/labeler.yml'
================================================
FILE: .github/workflows/update-llama-cpp.yml
================================================
name: Update llama.cpp submodule
on:
schedule:
- cron: '0 0 * * 1'
workflow_dispatch:
jobs:
update-submodule:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- name: Configure git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Check for submodule updates
id: check
run: |
cd llama.cpp
CURRENT_COMMIT=$(git rev-parse HEAD)
echo "Current commit: $CURRENT_COMMIT"
git fetch origin master
LATEST_COMMIT=$(git rev-parse origin/master)
echo "Latest commit: $LATEST_COMMIT"
if [ "$CURRENT_COMMIT" != "$LATEST_COMMIT" ]; then
echo "needs_update=true" >> "$GITHUB_OUTPUT"
echo "current_commit=$CURRENT_COMMIT" >> "$GITHUB_OUTPUT"
echo "latest_commit=$LATEST_COMMIT" >> "$GITHUB_OUTPUT"
echo "current_short=$(echo $CURRENT_COMMIT | cut -c1-7)" >> "$GITHUB_OUTPUT"
echo "latest_short=$(echo $LATEST_COMMIT | cut -c1-7)" >> "$GITHUB_OUTPUT"
else
echo "needs_update=false" >> "$GITHUB_OUTPUT"
echo "Submodule is up to date"
fi
- name: Update submodule and create PR
if: steps.check.outputs.needs_update == 'true'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
BRANCH_NAME="update-llama-cpp-${{ steps.check.outputs.latest_short }}"
if git ls-remote --heads origin "$BRANCH_NAME" | grep -q "$BRANCH_NAME"; then
echo "Branch $BRANCH_NAME already exists, skipping"
exit 0
fi
EXISTING_PR=$(gh pr list --search "Update llama.cpp submodule" --state open --json number --jq '.[0].number')
if [ -n "$EXISTING_PR" ]; then
echo "PR #$EXISTING_PR already exists for updating llama.cpp, skipping"
exit 0
fi
git checkout -b "$BRANCH_NAME"
cd llama.cpp
git checkout origin/master
cd ..
git add llama.cpp
git commit -m "Update llama.cpp submodule to ${{ steps.check.outputs.latest_short }}"
git push origin "$BRANCH_NAME"
gh pr create \
--title "Update llama.cpp submodule to ${{ steps.check.outputs.latest_short }}" \
--body "This PR updates the llama.cpp submodule from \`${{ steps.check.outputs.current_short }}\` to \`${{ steps.check.outputs.latest_short }}\`.
**Changes:** https://github.com/ggerganov/llama.cpp/compare/${{ steps.check.outputs.current_commit }}...${{ steps.check.outputs.latest_commit }}
---
*This PR was automatically created by the update-llama-cpp workflow.*" \
--head "$BRANCH_NAME"
================================================
FILE: .gitignore
================================================
# -*- conf -*-
/o
/.cosmocc
/TAGS
/HTAGS
/cosmocc
/perf.data
/perf.data.old
/trace.json
/*.log
/*.bin
/*.mp3
.claude
CLAUDE.md
# python
*.pyc
__init__.py
uv.lock
================================================
FILE: .gitmodules
================================================
[submodule "whisper.cpp"]
path = whisper.cpp
url = https://github.com/ggerganov/whisper.cpp.git
[submodule "stable-diffusion.cpp"]
path = stable-diffusion.cpp
url = https://github.com/leejet/stable-diffusion.cpp.git
[submodule "llama.cpp"]
path = llama.cpp
url = https://github.com/ggerganov/llama.cpp.git
[submodule "third_party/zipalign"]
path = third_party/zipalign
url = https://github.com/jart/zipalign.git
================================================
FILE: .llamafile_plugin/.claude-plugin/marketplace.json
================================================
{
"name": "llamafile-local",
"description": "Local llamafile plugin marketplace",
"owner": {
"name": "Mozilla AI",
"email": "davide@mozilla.ai"
},
"plugins": [
{
"name": "llamafile",
"description": "Build guidance and commands for the llamafile project",
"version": "0.1.1",
"author": {
"name": "Mozilla AI",
"email": "davide@mozilla.ai"
},
"source": "./"
}
]
}
================================================
FILE: .llamafile_plugin/.claude-plugin/plugin.json
================================================
{
"name": "llamafile",
"version": "0.1.1",
"description": "Build guidance and commands for the llamafile project"
}
================================================
FILE: LICENSE
================================================
The Apache 2.0 License
Copyright 2023 Mozilla Foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
================================================
FILE: Makefile
================================================
#-*-mode:makefile-gmake;indent-tabs-mode:t;tab-width:8;coding:utf-8-*-┐
#── vi: set noet ft=make ts=8 sw=8 fenc=utf-8 :vi ────────────────────┘
SHELL = /bin/sh
MAKEFLAGS += --no-builtin-rules
.SUFFIXES:
.DELETE_ON_ERROR:
.FEATURES: output-sync
# setup and reset-repo targets need to run before build/config.mk checks make version
ifeq ($(filter $(MAKECMDGOALS),setup reset-repo claude),)
include build/config.mk
include build/rules.mk
include third_party/BUILD.mk
include llama.cpp/BUILD.mk
include whisper.cpp/BUILD.mk
include llamafile/BUILD.mk
include whisperfile/BUILD.mk
include tests/BUILD.mk
endif
# the root package is `o//` by default
# building a package also builds its sub-packages
.PHONY: o/$(MODE)/
o/$(MODE)/: o/$(MODE)/llamafile \
o/$(MODE)/llama.cpp \
o/$(MODE)/whisper.cpp \
o/$(MODE)/whisperfile \
o/$(MODE)/third_party/zipalign
.PHONY: install
install: o/$(MODE)/llamafile/llamafile
mkdir -p $(PREFIX)/bin
$(INSTALL) o/$(MODE)/llamafile/llamafile $(PREFIX)/bin/llamafile
$(INSTALL) o/$(MODE)/whisperfile/whisperfile $(PREFIX)/bin/whisperfile
$(INSTALL) o/$(MODE)/third_party/zipalign/zipalign $(PREFIX)/bin/zipalign
.PHONY: check
check: o/$(MODE)/tests
# ==============================================================================
# GPU Backend Targets
# ==============================================================================
# These targets build GPU backend shared libraries that can be loaded at runtime.
# They pass GGML_VERSION and GGML_COMMIT from build/config.mk to the build scripts.
.PHONY: cuda
cuda: # Build CUDA backend with TinyBLAS (NVIDIA GPUs)
GGML_VERSION=$(GGML_VERSION) GGML_COMMIT=$(GGML_COMMIT) llamafile/cuda.sh
.PHONY: cublas
cublas: # Build CUDA backend with cuBLAS (NVIDIA GPUs, requires cuBLAS at runtime)
GGML_VERSION=$(GGML_VERSION) GGML_COMMIT=$(GGML_COMMIT) llamafile/cuda.sh --cublas
.PHONY: rocm
rocm: # Build ROCm backend with TinyBLAS (AMD GPUs)
GGML_VERSION=$(GGML_VERSION) GGML_COMMIT=$(GGML_COMMIT) llamafile/rocm.sh
.PHONY: cosmocc
cosmocc: $(COSMOCC) # cosmocc toolchain setup
.PHONY: cosmocc-ci
cosmocc-ci: $(COSMOCC) $(PREFIX)/bin/ape # cosmocc toolchain setup in ci context
.PHONY: setup
setup: # Initialize and configure all dependencies (submodules, patches, etc.)
@echo "Setting up dependencies..."
@mkdir -p o/tmp
@if [ ! -f whisper.cpp/.git ]; then \
echo "Initializing whisper.cpp submodule..."; \
git submodule update --init whisper.cpp; \
fi
@echo "Applying whisper.cpp patches..."
@export TMPDIR=$$(pwd)/o/tmp && ./whisper.cpp.patches/apply-patches.sh
@if [ ! -f stable-diffusion.cpp/.git ]; then \
echo "Initializing stable-diffusion.cpp submodule..."; \
git submodule update --init stable-diffusion.cpp; \
fi
@echo "Applying stable-diffusion.cpp patches..."
@export TMPDIR=$$(pwd)/o/tmp && ./stable-diffusion.cpp.patches/apply-patches.sh
@if [ ! -f llama.cpp/.git ]; then \
echo "Initializing llama.cpp submodule..."; \
git submodule update --init llama.cpp; \
fi
@echo "Initializing llama.cpp dependencies (nested submodules)..."
@cd llama.cpp && git submodule update --init
@echo "Applying llama.cpp patches..."
@export TMPDIR=$$(pwd)/o/tmp && ./llama.cpp.patches/apply-patches.sh
@if [ ! -f third_party/zipalign/.git ]; then \
echo "Initializing zipalign submodule..."; \
git submodule update --init third_party/zipalign; \
fi
@echo "Setup complete!"
@$(MAKE) cosmocc
.PHONY: reset-repo
reset-repo: # Reset all submodules to their original state (removes patches or any other change)
@echo "Resetting submodules to original state..."
@for dir in llama.cpp whisper.cpp stable-diffusion.cpp third_party/zipalign; do \
if [ -e "$$dir" ]; then \
echo "Removing $$dir..."; \
rm -rf "$$dir"; \
fi; \
echo "Restoring $$dir..."; \
git checkout "$$dir"; \
done
@echo "Reset complete. Run 'make setup' to reinitialize and apply patches."
.PHONY: claude
claude: # Set up CLAUDE.md symlink for Claude Code, show how to install the plugin
@if [ -e CLAUDE.md ] && [ ! -L CLAUDE.md ]; then \
echo "Error: CLAUDE.md exists and is not a symlink"; \
exit 1; \
fi
@rm -f CLAUDE.md
@ln -s docs/AGENTS.md CLAUDE.md
@echo "CLAUDE.md -> docs/AGENTS.md"
@echo ""
@echo "To install the llamafile plugin, run in Claude Code:"
@echo " /plugin marketplace add ./.llamafile_plugin"
@echo " /plugin install llamafile"
ifeq ($(filter $(MAKECMDGOALS),setup reset-repo claude),)
include build/deps.mk
include build/tags.mk
endif
================================================
FILE: README.md
================================================
# llamafile
<img src="docs/images/llamafile-640x640.png" width="320" height="320"
alt="[line drawing of llama animal head in front of slightly open manilla folder filled with files]">
[](https://github.com/mozilla-ai/llamafile/blob/main/LICENSE)
[](https://github.com/mozilla-ai/llamafile/actions/workflows/ci.yml)
[](https://github.com/ggml-org/llama.cpp/commit/7f5ee54)
[](https://github.com/ggml-org/whisper.cpp/commit/2eeeba5)
[](https://discord.gg/YuMNeuKStr)
[](https://builders.mozilla.org/)
**llamafile lets you distribute and run LLMs with a single file.**
llamafile is a [Mozilla Builders](https://builders.mozilla.org/) project (see its [announcement blog post](https://hacks.mozilla.org/2023/11/introducing-llamafile/)), now revamped by [Mozilla.ai](https://www.mozilla.ai/open-tools/llamafile).
Our goal is to make open LLMs much more
accessible to both developers and end users. We're doing that by
combining [llama.cpp](https://github.com/ggerganov/llama.cpp) with [Cosmopolitan Libc](https://github.com/jart/cosmopolitan) into one
framework that collapses all the complexity of LLMs down to
a single-file executable (called a "llamafile") that runs
locally on most operating systems and CPU archiectures, with no installation.
llamafile also includes **[whisperfile](whisperfile/index.md)**, a single-file speech-to-text tool built on [whisper.cpp](https://github.com/ggerganov/whisper.cpp) and the same Cosmopolitan packaging. It supports transcription and translation of audio files across all the same platforms, with no installation required.
## v0.10.0
**llamafile versions starting from 0.10.0 use a new build system**, aimed at keeping our code more easily
aligned with the latest versions of llama.cpp. This means they support more recent models and functionalities,
but at the same time they might be missing some of
the features you were accustomed to (check out [this doc](README_0.10.0.md) for a high-level description of what has been done). If you liked
the "classic experience" more, you will always be able to access the previous versions from our
[releases](https://github.com/mozilla-ai/llamafile/releases) page. Our pre-built llamafiles always
show which version of the server they have been bundled with ([0.9.* example](https://huggingface.co/mozilla-ai/llava-v1.5-7b-llamafile), [0.10.* example](https://huggingface.co/mozilla-ai/llamafile_0.10.0)), so you will always know
which version of the software you are downloading.
> **We want to hear from you!**
Whether you are a new user or a long-time fan, please share what you find most valuable about llamafile and what would make it more useful for you.
[Read more via the blog](https://blog.mozilla.ai/llamafile-returns/) and add your voice to the discussion [here](https://github.com/mozilla-ai/llamafile/discussions/809).
## Quick Start
Download and run your first llamafile in minutes:
```sh
# Download an example model (Qwen3.5 0.8B)
curl -LO https://huggingface.co/mozilla-ai/llamafile_0.10.0/resolve/main/Qwen3.5-0.8B-Q8_0.llamafile
# Make it executable (macOS/Linux/BSD)
chmod +x Qwen3.5-0.8B-Q8_0.llamafile
# Run it
./Qwen3.5-0.8B-Q8_0.llamafile
```
We chose this model because that's the smallest one we have
built a llamafile for, so most likely to work out-of-the-box for you.
If you have powerful hardware and/or GPUs, [feel free to choose](example_llamafiles.md)
larger and more expressive models which should provide more accurate
responses.
**Windows users:** Rename the file to add `.exe` extension before running.
## Documentation
Check the full documentation in the [docs/](docs/) folder or online at [mozilla-ai.github.io/llamafile](https://mozilla-ai.github.io/llamafile/), or directly jump into one of the following subsections:
- [Quickstart](https://mozilla-ai.github.io/llamafile/quickstart/)
- [Example llamafiles](https://mozilla-ai.github.io/llamafile/example_llamafiles/)
- [Running a llamafile](https://mozilla-ai.github.io/llamafile/running_llamafile/)
- [Creating llamafiles](https://mozilla-ai.github.io/llamafile/creating_llamafiles/)
- [Source installation](https://mozilla-ai.github.io/llamafile/source_installation/)
- [Technical details](https://mozilla-ai.github.io/llamafile/technical_details/)
- [Supported Systems](https://mozilla-ai.github.io/llamafile/support/)
- [Troubleshooting](https://mozilla-ai.github.io/llamafile/troubleshooting/)
- [Whisperfile](https://mozilla-ai.github.io/llamafile/whisperfile/)
## Licensing
While the llamafile project is Apache 2.0-licensed, our changes
to llama.cpp and whisper.cpp are licensed under MIT (just like the projects
themselves) so as to remain compatible and upstreamable in the future,
should that be desired.
The llamafile logo on this page was generated with the assistance of DALL·E 3.
[](https://star-history.com/#Mozilla-Ocho/llamafile&Date)
================================================
FILE: README_0.10.0.md
================================================
llamafile 0.10.0 has been a work in progress for a while. Now that we are merging
its code with main, we want to leave this document available to document both the
reasons and the process behind it.
Everything started with the goal of replicating a cosmopolitan llama.cpp build from scratch,
so we could get the best of two worlds. On the one hand, some of the characteristic
features of llamafiles, that is portability across different systems and architectures
and the possibility of bundling model weights within llamafile executables. On the
other hand, the features and the model support made available by the most recent
versions of llama.cpp.
We realise that what makes a llamafile is not just an APE executable, so before
merging this code with main we wanted to bring back other of its features into the
new build. We believe there's still work to do, but now that the main features are
there we can let you play with a more modern llamafile and directly ask you what
you'd like to see the most in its future versions.
Older builds (and llamafiles built on them) will still be available, check out our
[releases](https://github.com/mozilla-ai/llamafile/releases) and our
[Example Llamafiles](/docs/example_llamafiles.md) page.
# Updates
Here are the features we brought into our development branch before merging with main.
Most of them were brought in from previous versions of llamafile, and all credit goes
to their original authors <3. Some (including new build for easier sync with upstream
llama.cpp, mtmd API support, intregration tests, skill docs, HTTP chat client for combined
mode) are new.
20260317
- Updates to [skill documents](https://github.com/mozilla-ai/llamafile/pull/886)
- Added [whisper](https://github.com/mozilla-ai/llamafile/pull/880)
- Added support for [chat, cli, server](https://github.com/mozilla-ai/llamafile/pull/896) modalities
- [Updated llama.cpp](https://github.com/mozilla-ai/llamafile/pull/901) to 7f5ee54 (with support for qwen3.5 models)
- Added [integration tests](https://github.com/mozilla-ai/llamafile/pull/906)
- Added [`--image` support to CLI](https://github.com/mozilla-ai/llamafile/pull/912)
20260219
- Added [CPU optimizations](https://github.com/mozilla-ai/llamafile/pull/868)
- Fixed misc issues
- server [timing out](https://github.com/mozilla-ai/llamafile/pull/876)
- [mmap errors](https://github.com/mozilla-ai/llamafile/pull/882) when loading bundled models
- [think mode in TUI](https://github.com/mozilla-ai/llamafile/pull/885)
- [Added "skill docs"](https://github.com/mozilla-ai/llamafile/pull/886) to be used with AI assistants
[20260202](https://github.com/mozilla-ai/llamafile/discussions/871)
- Added zipalign as a GitHub [submodule](https://github.com/mozilla-ai/llamafile/pull/848) (so we can get the latest updates from Justine’s repo)
- Brought back [cuda support](https://github.com/mozilla-ai/llamafile/pull/859) on Linux
- Added support for the [mtmd API](https://github.com/mozilla-ai/llamafile/pull/852) in the TUI (so you can now directly access modern multimodal models from the llamafile chat)
- Tested new llamafiles running models trained for tool calling (e.g. Qwen3, gpt-oss-20b) and multimodal models such as llava 1.6, Qwen3-VL and Ministral 3
[20251218](https://github.com/mozilla-ai/llamafile/discussions/845)
- added Metal support: GPU on MacOS ARM64 is supported by compiling a small module
using the Xcode Command Line Tools, which need to be installed. Check our docs at
https://mozilla-ai.github.io/llamafile/support/#gpu-support for more info.
- Metal works both in llamafile (called either as TUI or with the --server flag)
and in llama-server.
20251215
- added TUI support: you can now directly chat with the chosen LLM from
the terminal, or run the llama.cpp server using the `--server` parameter
- simplified build by removing all tools/deps except those required by
the new llamafile code (they will be added back in as soon as we reintroduce
functionalities)
20251209
- added BUILD.mk so we can do without cmake
- build works with cosmocc 4.0.2
- dependencies are all taken from llama.cpp/vendor directory
- building now works both on linux and mac
20251208
- updated to llama.cpp commit dbc15a79672e72e0b9c1832adddf3334f5c9229c
20251124
- first version, relying on cmake for the build
# What's missing
- GPU support for Windows (and for whisperfile)
- stable diffusion (the code is there, but has not been ported to the new build format yet)
- some features triggered by extra arguments in CLI mode
- pledge() SECCOMP sandboxing
- localscore
- llamafiler for embeddings (we rolled back to llama.cpp's embeddings endpoint instead)
- ... please help us track if there's anything missing you wish to see in the new build!
================================================
FILE: RELEASE.md
================================================
# Making a llamafile Release
There are a few steps in making a llamafile release which will be detailed in this document.
The two primary artifacts of the release are the `llamafile-<version>.zip` and the binaries for the GitHub release.
## Release Process
Note: Step 2 is only needed if you are making a new release of the ggml-cuda.so and ggml-rocm.so shared libraries.
You only need to do this when you are making changes to the CUDA code or the APIs surrounding it.
Otherwise you can use the previous release of the shared libraries.
### Preparing the Build Environment
Before building, ensure all dependencies are initialized and configured:
```sh
make setup
```
This initializes git submodules (e.g., llama.cpp) and applies llamafile patches.
The patches integrate dependencies with llamafile's build system and add llamafile-specific functionality.
### Release Steps
1. Update the version number in `version.h`
2. Build the ggml-cuda.so and ggml-rocm.so shared libraries on Linux. llamafile uses TINYBLAS as a default, even if some model families (e.g. Qwen3.5) use CUBLAS as a default for CUDA.
- You can do this by running the script `./llamafile/cuda.sh` and `./llamafile/rocm.sh` respectively.
- The files will be built and placed your home directory.
3. Build the project with `make -j8`
4. Install the built project to your /usr/local/bin directory with `sudo make install PREFIX=/usr/local`
### llamafile Release Zip
The easiest way to create the release zip is to:
`make install PREFIX=<preferred_dir>/llamafile-<version>`
After the directory is created, you will want to bundle the built shared libraries into the release binaries (at the moment, llamafile only).
You can do this for each binary with a command like the following:
`zipalign -j0 llamafile ggml-cuda.so ggml-rocm.so`
The zip is structured as follows.
```
llamafile-<version>
|-- README.md
|-- bin
| |-- llamafile
| |-- whisperfile
| `-- zipalign
`-- share
`-- man
`-- man1
|-- whisperfile.1
`-- zipalign.1
```
Before you zip the directory, you will want to remove the shared libraries from the directory (if present).
`rm *.so *.dll`
You can zip the directory with the following command:
`zip -r llamafile-<version>.zip llamafile-<version>`
### llamafile Release Binaries
After you have built the zip it is quite easy to create the release binaries.
The following binaries are part of the release:
- `llamafile`
- `whisperfile`
- `zipalign`
You can use the script to create the appropriately named binaries:
`./llamafile/release.sh -v <version> -s <source_dir> -d <dest_dir>`
Make sure to move the llamafile-<version>.zip file to the <dest_dir> as well, and you are good to release after you've tested.
================================================
FILE: build/config.mk
================================================
#-*-mode:makefile-gmake;indent-tabs-mode:t;tab-width:8;coding:utf-8-*-┐
#── vi: set noet ft=make ts=8 sw=8 fenc=utf-8 :vi ────────────────────┘
# ==============================================================================
# GGML Version (extracted from llama.cpp/ggml/CMakeLists.txt)
# ==============================================================================
GGML_VERSION_MAJOR := $(shell grep -E 'GGML_VERSION_MAJOR [0-9]+' llama.cpp/ggml/CMakeLists.txt | sed 's/[^0-9]*//g')
GGML_VERSION_MINOR := $(shell grep -E 'GGML_VERSION_MINOR [0-9]+' llama.cpp/ggml/CMakeLists.txt | sed 's/[^0-9]*//g')
GGML_VERSION_PATCH := $(shell grep -E 'GGML_VERSION_PATCH [0-9]+' llama.cpp/ggml/CMakeLists.txt | sed 's/[^0-9]*//g')
GGML_VERSION := $(GGML_VERSION_MAJOR).$(GGML_VERSION_MINOR).$(GGML_VERSION_PATCH)
GGML_COMMIT := $(shell cd llama.cpp/ggml 2>/dev/null && git rev-parse --short HEAD 2>/dev/null || echo "unknown")
# ==============================================================================
# Build Configuration
# ==============================================================================
PREFIX = /usr/local
COSMOCC = .cosmocc/4.0.2
TOOLCHAIN = $(COSMOCC)/bin/cosmo
CC = $(TOOLCHAIN)cc
CXX = $(TOOLCHAIN)c++
AR = $(COSMOCC)/bin/ar.ape
ZIPOBJ = $(COSMOCC)/bin/zipobj
MKDEPS = $(COSMOCC)/bin/mkdeps
INSTALL = install
ARFLAGS = rcsD
CXXFLAGS = -frtti -std=gnu++23
CCFLAGS = -O2 -g -fexceptions -ffunction-sections -fdata-sections -mclang
CPPFLAGS_ = -iquote. -mcosmo -DGGML_MULTIPLATFORM -Wno-attributes -DLLAMAFILE_DEBUG
TARGET_ARCH = -Xx86_64-mtune=znver4
TMPDIR = o//tmp
IGNORE := $(shell mkdir -p $(TMPDIR))
ARCH := $(shell uname -m)
# apple still distributes a 17 year old version of gnu make
ifeq ($(MAKE_VERSION), 3.81)
ifneq ($(MAKECMDGOALS),cosmocc)
# show the following message unless someone's trying to install cosmocc
$(error please use bin/make from cosmocc.zip rather than old xcode make)
endif
endif
# let `make m=foo` be shorthand for `make MODE=foo`
ifneq ($(m),)
ifeq ($(MODE),)
MODE := $(m)
endif
endif
# make build more deterministic
LC_ALL = C.UTF-8
SOURCE_DATE_EPOCH = 0
export MODE
export TMPDIR
export LC_ALL
export SOURCE_DATE_EPOCH
# `make` runs `make all` by default
.PHONY: all
all: o/$(MODE)/
.PHONY: clean
clean:; rm -rf o
.PHONY: distclean
distclean:; rm -rf o .cosmocc
.cosmocc/3.9.7:
build/download-cosmocc.sh $@ 3.9.7 3f559555d08ece35bab1a66293a2101f359ac9841d563419756efa9c79f7a150
.cosmocc/4.0.2:
build/download-cosmocc.sh $@ 4.0.2 85b8c37a406d862e656ad4ec14be9f6ce474c1b436b9615e91a55208aced3f44
================================================
FILE: build/cudacc
================================================
#!/bin/sh
find_nvcc() {
CC=$(command -v nvcc 2>/dev/null) && return
CC="$CUDA_PATH/bin/nvcc"
[ -x "$CC" ] && return
CC="/opt/cuda/bin/nvcc"
[ -x "$CC" ] && return
CC="/usr/local/cuda/bin/nvcc"
[ -x "$CC" ] && return
return 1
}
find_hipcc() {
CC=$(command -v hipcc 2>/dev/null) && return
CC="$HIP_PATH/bin/hipcc"
[ -x "$CC" ] && return
CC="/opt/rocm/bin/hipcc"
[ -x "$CC" ] && return
CC="/usr/local/rocm/bin/hipcc"
[ -x "$CC" ] && return
return 1
}
if find_hipcc; then
VENDOR=AMD
FLAGS=
elif find_nvcc; then
VENDOR=NVIDIA
FLAGS="--forward-unknown-to-host-compiler"
else
echo 'error: need either hipcc (AMD) or nvcc (NVIDIA) on $PATH' >&2
exit 1
fi
FIRST=1
for x; do
if [ $FIRST -eq 1 ]; then
set --
FIRST=0
fi
if [ $VENDOR = AMD ]; then
if [ x"$x" = x"-lcublas" ]; then
set -- "$@" -lhipblas -lrocblas
continue
elif [ x"$x" = x"--use_fast_math" ]; then
continue
fi
fi
set -- "$@" "$x"
done
exec "$CC" $FLAGS "$@"
================================================
FILE: build/deps.mk
================================================
#-*-mode:makefile-gmake;indent-tabs-mode:t;tab-width:8;coding:utf-8-*-┐
#── vi: set noet ft=make ts=8 sw=8 fenc=utf-8 :vi ────────────────────┘
SRCS = $(foreach x,$(PKGS),$($(x)_SRCS))
HDRS = $(foreach x,$(PKGS),$($(x)_HDRS))
INCS = $(foreach x,$(PKGS),$($(x)_INCS))
o/$(MODE)/depend: $(SRCS) $(HDRS) $(INCS)
@mkdir -p $(@D)
$(MKDEPS) -o $@ -r o/$(MODE)/ $(SRCS) $(HDRS) $(INCS)
o/$(MODE)/depend.test: $(SRCS) $(HDRS) $(INCS)
@mkdir -p $(@D)
$(MKDEPS) -o $@ -r o/$(MODE)/ $(SRCS) $(HDRS) $(INCS)
$(SRCS):
$(HDRS):
$(INCS):
.DEFAULT:
@echo
@echo NOTE: deleting o/$(MODE)/depend because of an unspecified prerequisite: $@
@echo
rm -f o/$(MODE)/depend
-include o/$(MODE)/depend
================================================
FILE: build/download-cosmocc.sh
================================================
#!/bin/sh
# cosmocc downloader script
# https://justine.lol/cosmo3/#install
# https://github.com/jart/cosmopolitan/blob/master/tool/cosmocc/README.md
# collect arguments
OUTPUT_DIR=${1:?OUTPUT_DIR}
COSMOCC_VERSION=${2:?COSMOCC_VERSION}
COSMOCC_SHA256SUM=${3:?COSMOCC_SHA256SUM}
URL1="https://github.com/jart/cosmopolitan/releases/download/${COSMOCC_VERSION}/cosmocc-${COSMOCC_VERSION}.zip"
URL2="https://cosmo.zip/pub/cosmocc/cosmocc-${COSMOCC_VERSION}.zip"
# helper function
abort() {
printf '%s\n' "download terminated." >&2
exit 1
}
# exit if already downloaded
# we need it because directory timestamps work wierdly
OUTPUT_DIR=${OUTPUT_DIR%/}
if [ -d "${OUTPUT_DIR}" ]; then
exit 0
fi
# find commands we need to securely download cosmocc
if ! UNZIP=$(command -v unzip 2>/dev/null); then
printf '%s\n' "$0: fatal error: you need the unzip command" >&2
printf '%s\n' "please download https://cosmo.zip/pub/cosmos/bin/unzip and put it on the system path" >&2
abort
fi
if command -v sha256sum >/dev/null 2>&1; then
# can use system sha256sum
true
elif command -v shasum >/dev/null 2>&1; then
sha256sum() {
shasum -a 256 "$@"
}
else
if [ ! -f build/sha256sum.c ]; then
printf '%s\n' "$0: fatal error: you need to install sha256sum" >&2
printf '%s\n' "please download https://cosmo.zip/pub/cosmos/bin/sha256sum and put it on the system path" >&2
abort
fi
if ! SHA256SUM=$(command -v "$PWD/o/build/sha256sum" 2>/dev/null); then
if ! CC=$(command -v "$CC" 2>/dev/null); then
if ! CC=$(command -v cc 2>/dev/null); then
if ! CC=$(command -v cosmocc 2>/dev/null); then
printf '%s\n' "$0: fatal error: you need to install either sha256sum, cc, or cosmocc" >&2
printf '%s\n' "please download https://cosmo.zip/pub/cosmos/bin/sha256sum and put it on the system path" >&2
abort
fi
fi
fi
mkdir -p o/build || abort
SHA256SUM="$PWD/o/build/sha256sum"
printf '%s\n' "${CC} -w -O2 -o ${SHA256SUM} build/sha256sum.c" >&2
"${CC}" -w -O2 -o "${SHA256SUM}.$$" build/sha256sum.c || abort
mv -f "${SHA256SUM}.$$" "${SHA256SUM}" || abort
fi
sha256sum() {
"${SHA256SUM}" "$@"
}
fi
if WGET=$(command -v wget 2>/dev/null); then
DOWNLOAD=$WGET
DOWNLOAD_ARGS=-O
elif CURL=$(command -v curl 2>/dev/null); then
DOWNLOAD=$CURL
DOWNLOAD_ARGS=-fLo
else
printf '%s\n' "$0: fatal error: you need to install either wget or curl" >&2
printf '%s\n' "please download https://cosmo.zip/pub/cosmos/bin/wget and put it on the system path" >&2
abort
fi
# create temporary output directory
OLDPWD=$PWD
OUTPUT_TMP="${OUTPUT_DIR}.tmp.$$/"
mkdir -p "${OUTPUT_TMP}" || abort
cd "${OUTPUT_TMP}"
die() {
cd "${OLDPWD}"
rm -rf "${OUTPUT_TMP}"
abort
}
# download cosmocc toolchain
# multiple urls avoids outages and national firewalls
if ! "${DOWNLOAD}" ${DOWNLOAD_ARGS} cosmocc.zip "${URL1}"; then
rm -f cosmocc.zip
"${DOWNLOAD}" ${DOWNLOAD_ARGS} cosmocc.zip "${URL2}" || die
fi
printf '%s\n' "${COSMOCC_SHA256SUM} *cosmocc.zip" >cosmocc.zip.sha256sum
sha256sum -c cosmocc.zip.sha256sum || die
"${UNZIP}" cosmocc.zip || die
rm -f cosmocc.zip cosmocc.zip.sha256sum
# commit output directory
cd "${OLDPWD}" || die
mv "${OUTPUT_TMP}" "${OUTPUT_DIR}" || die
================================================
FILE: build/htags
================================================
#!/bin/sh
#-*-mode:sh;indent-tabs-mode:nil;tab-width:2;coding:utf-8-*-┐
#── vi: set et ft=sh ts=2 sts=2 fenc=utf-8 :vi ─────────────┘
#
# OVERVIEW
#
# Header Symbol Index Generator
#
# DESCRIPTION
#
# This is a static source analyzer that lets us configure Emacs
# keybindings to insert #include lines.
#
# EXAMPLES
#
# build/htags -o HTAGS $(find . -name \*.h)
#
# (defun jart-add-include ()
# (interactive)
# (let* ((tag-file "HTAGS")
# (case-fold-search nil)
# (search (thing-at-point 'symbol))
# (buffer (find-file-noselect (format "%s/%s"
# (locate-dominating-file
# (buffer-name) tag-file)
# tag-file)))
# (header (with-current-buffer buffer
# (save-excursion
# (goto-char 0)
# (when (re-search-forward
# (concat "\177" search "\001") nil t)
# (when (re-search-backward "\f\n\\([^,]*\\)," nil t)
# (match-string 1)))))))
# (when header
# (save-excursion
# (goto-char 0)
# (re-search-forward "#include")
# (re-search-forward "^$")
# (insert (concat "#include \"" header "\"\n"))))))
# (defun jart-c-mode-common-hook ()
# (define-key c-mode-base-map (kbd "C-c C-h") 'jart-add-include))
# (eval-after-load 'markdown-mode
# '(progn
# (add-hook 'c-mode-common-hook 'jart-c-mode-common-hook)))
TAGS="$1"
shift
# ctags doesn't understand atomics, e.g.
# extern char **environ;
set -- --regex-c='/_Atomic(\([^)]*\))/\1/b' "$@"
# ctags doesn't understand variable prototypes, e.g.
# extern char **environ;
set -- --regex-c='/^\(\(hidden\|extern\|const\) \)*[_[:alpha:]][_[:alnum:]]*[ *][ *]*\([_[:alpha:]][_[:alnum:]]*[ *][ *]*\)*\([_[:alpha:]][_$[:alnum:]]*\)/\4/b' "$@"
# ctags doesn't understand function prototypes, e.g.
# bool isheap(void *p) dontthrow nocallback;
set -- --regex-c='/^[_[:alpha:]][_[:alnum:]]*[ *][ *]*\([_[:alpha:]][_[:alnum:]]*[ *][ *]*\)*\([_[:alpha:]][_$[:alnum:]]*\)(.*/\2/b' "$@"
# ctags doesn't understand function pointers, e.g.
# extern int32_t (*const SetEvent)(int64_t hEvent) wincall;
set -- --regex-c='/^extern [^(]*(\*const \([^)]*\))(/\1/b' "$@"
# ctags doesn't understand forward declarations, e.g.
# struct WorstSoftwareEver;
set -- --regex-c='/^struct.*;$/uehocruehcroue/b' "$@"
exec $TAGS \
-e \
--langmap=c:.c.h \
--exclude=libc/nt/struct/imagefileheader.internal.h \
--exclude=libc/nt/struct/imageseparatedebugheader.internal.h \
--exclude=libc/nt/struct/importobjectheader.h \
--exclude=libc/nt/struct/nonpageddebuginfo.h \
--exclude=libc/nt/struct/ansistring.h \
--exclude=libc/nt/struct/filesegmentelement.h \
"$@"
================================================
FILE: build/llamafile-convert
================================================
#!/bin/sh
BIN=${0%/*}
PROG=${0##*/}
if [ x"$1" = x"--help" ]; then
echo "Usage: $PROG <gguf file or url>"
echo
echo "This program converts GGUF weights into a llamafile."
echo "Your .llamafile is outputted to the current directory."
echo
echo "You can supply either a .gguf filename, or the URL to"
echo "download one from an online service like Hugging Face."
echo
echo "When you run this program, it's recommended that you've"
echo "downloaded or installed an official llamafile-VERSION.zip"
echo "from https://github.com/Mozilla-Ocho/llamafile/releases"
echo "because they include prebuilt DLLs for CUDA and ROCm."
echo "You can verify your llamafile has them w/ unzip -vl"
exit 0
fi
abort() {
echo "conversion terminated." >&2
exit 1
}
# find paths of golden llamafile binaries
#
# 1. if user downloaded `llamafile-VERSION.zip`, extracted it, and ran
# `./llamafile-VERSION/bin/llamafile-convert` directly, then we can
# support that by looking for a `llamafile` in the same bin folder.
#
# 2. otherwise, perform a $PATH lookup for llamafile
#
LLAMAFILE="$BIN/llamafile"
if [ ! -x "$LLAMAFILE" ]; then
LLAMAFILE=$(command -v llamafile) || abort
fi
ZIPALIGN="$BIN/zipalign"
if [ ! -x "$ZIPALIGN" ]; then
ZIPALIGN=$(command -v zipalign) || abort
fi
# get path of downloader program
if WGET=$(command -v wget 2>/dev/null); then
DOWNLOAD=$WGET
DOWNLOAD_ARGS=-O
elif CURL=$(command -v curl 2>/dev/null); then
DOWNLOAD=$CURL
DOWNLOAD_ARGS=-fLo
else
echo "$PROG: fatal error: you need to install either wget or curl" >&2
echo "please download https://cosmo.zip/pub/cosmos/bin/wget and put it on the system path" >&2
abort
fi
# get first program argument
FILE=$1
if [ -z "$FILE" ]; then
echo "$PROG: missing operand (pass --help for help)" >&2
abort
fi
# if the file starts with http
SHOULD_DELETE=0
if [ x"$FILE" != x"${FILE#http*}" ]; then
URL=$FILE
URL=${URL%?download=true} # strip "?download=true" suffix
FILE=${URL##*/} # local file is basename of url
echo "Downloading $FILE" >&2
"${DOWNLOAD}" ${DOWNLOAD_ARGS} "$FILE" "$URL" || abort
SHOULD_DELETE=1
fi
# create output in current directory
echo "Using $LLAMAFILE as golden llamafile binary" >&2
OUTPUT=${FILE##*/} # basename
OUTPUT="${OUTPUT%.gguf}.llamafile"
echo "Converting $FILE to $OUTPUT" >&2
cp -f "$LLAMAFILE" "$OUTPUT" || abort
printf %s "-m
${FILE##*/}
...
" > .args
"$ZIPALIGN" -j0 "$OUTPUT" "$FILE" .args || abort
# cleanup
rm -f .args
if [ $SHOULD_DELETE -eq 1 ]; then
rm -f "$FILE"
fi
echo "Success. You may now run ./$OUTPUT" >&2
================================================
FILE: build/llamafile-upgrade-engine
================================================
#!/bin/sh
BIN="${0%/*}"
PROG="${0##*/}"
print_full_help() {
cat << EOF
Usage: $PROG [OPTION]... <old> (new)
Upgrade llamafile archives.
Options:
-h, --help display this help and exit
-f, --force skip version check
-v, --verbose verbose mode
Arguments:
<old> the name of the old llamafile archive to be upgraded
(new) the name of the new llamafile archive to be created
if not defined output will be <old>.updated.llamafile
Example:
$PROG old.llamafile new.llamafile
This command will upgrade the old_llamafile to a new llamafile named new_llamafile.
When you run this program, it's recommended that you've
downloaded or installed an official llamafile-VERSION.zip
from https://github.com/Mozilla-Ocho/llamafile/releases
because they include prebuilt DLLs for CUDA and ROCm.
You can verify your llamafile has them w/ unzip -vl
EOF
}
abort() {
echo "Error: $1" >&2
cat << EOF >&2
Usage: $PROG [OPTION]... <old> (new)
Upgrade llamafile archives.
Refer to --help for full instructions.
EOF
exit 1
}
if [ x"$1" = x"-h" ] || [ x"$1" = x"--help" ]; then
print_full_help >&2
exit 0
fi
# find paths of golden llamafile binaries
#
# 1. if user downloaded `llamafile-VERSION.zip`, extracted it, and ran
# `./llamafile-VERSION/bin/llamafile-upgrade-engine` directly, then we can
# support that by looking for a `llamafile` in the same bin folder.
#
# 2. otherwise, perform a $PATH lookup for llamafile
#
LLAMAFILE="$BIN/llamafile"
if [ ! -x "$LLAMAFILE" ]; then
LLAMAFILE="$(command -v llamafile)" || abort "llamafile not found in PATH"
fi
ZIPALIGN="$BIN/zipalign"
if [ ! -x "$ZIPALIGN" ]; then
ZIPALIGN="$(command -v zipalign)" || abort "zipalign not found in PATH"
fi
# Parse command-line options
force_upgrade=false
verbose=false
while getopts "fv" opt; do
case $opt in
f)
force_upgrade=true
echo "Skipping version check."
;;
v)
verbose=true
echo "Verbose Output Mode."
;;
esac
done
# Shift the option parameters
shift $((OPTIND - 1))
# Remove .llamafile extension from arguments if present
if [ -z "${1}" ]; then
abort "Missing path to old llamafile archive to be upgraded"
else
old_llamafile="${1%.llamafile}"
fi
if [ -z "$2" ]; then
new_llamafile="${old_llamafile}.updated"
else
new_llamafile="${2%.llamafile}"
fi
# Obtain versions of old and new llamafiles
old_llamafile_engine_version="$("./$old_llamafile".llamafile --version)" || abort "Failed to get version of old llamafile"
new_llamafile_engine_version="$("$LLAMAFILE" --version)" || abort "Failed to get version of new llamafile"
# Check if llamafile has been upgraded
echo "== Engine Version Check ==" >&2
echo "Engine version from $old_llamafile: $old_llamafile_engine_version" >&2
echo "Engine version from $LLAMAFILE: $new_llamafile_engine_version" >&2
if [ "$old_llamafile_engine_version" = "$new_llamafile_engine_version" ] && [ "$force_upgrade" != "true" ]; then
echo "Upgrade not required. Exiting..." >&2
exit 0
fi
if [ "$verbose" = "true" ]; then
echo "== Current Content ==" >&2
zipinfo "${old_llamafile}.llamafile" || abort "Failed to get current content of old llamafile"
fi
tempdir="$(mktemp -d)" || abort "Failed to create temporary directory"
trap 'rm -rf "$tempdir"' EXIT
echo "== Repackaging / Upgrading ==" >&2
echo "extracting..." >&2
unzip "${old_llamafile}.llamafile" -d "$tempdir" || abort "Failed to extract old llamafile"
echo "repackaging..." >&2
cp "$LLAMAFILE" "${new_llamafile}.llamafile" || abort "Failed to copy new llamafile"
"$ZIPALIGN" -j0 "${new_llamafile}.llamafile" "$tempdir"/*.gguf "$tempdir"/.args || abort "Failed to repackaging"
echo "== Completed ==" >&2
echo "Original File: ${old_llamafile}.llamafile" >&2
echo "Upgraded File: ${new_llamafile}.llamafile" >&2
================================================
FILE: build/objdump
================================================
#!/bin/sh
if printf '%s\n' "$*" | grep aarch64 >/dev/null 2>&1; then
exec aarch64-unknown-cosmo-objdump $1 ${2%/*}/.aarch64/${2##*/}
else
exec x86_64-unknown-cosmo-objdump "$@"
fi
================================================
FILE: build/rules.mk
================================================
#-*-mode:makefile-gmake;indent-tabs-mode:t;tab-width:8;coding:utf-8-*-┐
#── vi: set noet ft=make ts=8 sw=8 fenc=utf-8 :vi ────────────────────┘
# ==============================================================================
# Compiler Commands
# ==============================================================================
LINK.o = $(CXX) $(CCFLAGS) $(LDFLAGS)
COMPILE.c = $(CC) $(CCFLAGS) $(CFLAGS) $(CPPFLAGS_) $(CPPFLAGS) $(TARGET_ARCH) -c
COMPILE.cc = $(CXX) $(CCFLAGS) $(CXXFLAGS) $(CPPFLAGS_) $(CPPFLAGS) $(TARGET_ARCH) -c
# ==============================================================================
# Standard Compilation Rules
# ==============================================================================
o/$(MODE)/%.o: %.c $(COSMOCC)
@mkdir -p $(@D)
$(COMPILE.c) -o $@ $<
o/$(MODE)/%.o: o/$(MODE)/%.c $(COSMOCC)
@mkdir -p $(@D)
$(COMPILE.c) -o $@ $<
o/$(MODE)/%.o: %.cc $(COSMOCC)
@mkdir -p $(@D)
$(COMPILE.cc) -o $@ $<
o/$(MODE)/%.o: %.cpp $(COSMOCC)
@mkdir -p $(@D)
$(COMPILE.cc) -o $@ $<
# ==============================================================================
# Extension-preserving compilation rules
# ==============================================================================
# These rules produce foo.c.o from foo.c (instead of foo.o).
# Required when both foo.c and foo.cpp exist in the same directory,
# otherwise both would produce foo.o and collide.
# Example: ggml/src/ggml.c and ggml/src/ggml.cpp both exist in llama.cpp.
o/$(MODE)/%.c.o: %.c $(COSMOCC)
@mkdir -p $(@D)
$(COMPILE.c) -o $@ $<
o/$(MODE)/%.cpp.o: %.cpp $(COSMOCC)
@mkdir -p $(@D)
$(COMPILE.cc) -o $@ $<
o/$(MODE)/%.c.o: o/$(MODE)/%.c $(COSMOCC)
@mkdir -p $(@D)
$(COMPILE.c) -o $@ $<
o/$(MODE)/%.cpp.o: o/$(MODE)/%.cpp $(COSMOCC)
@mkdir -p $(@D)
$(COMPILE.cc) -o $@ $<
# ==============================================================================
# Hash functions generated by gperf
# ==============================================================================
o/$(MODE)/%.c: %.gperf
@mkdir -p $(@D)
build/gperf --output-file=$@ $<
# ==============================================================================
# Archive Creation
# ==============================================================================
o/$(MODE)/%.a:
@mkdir -p $(dir $@)/.aarch64
$(AR) $(ARFLAGS) $@ $^
$(AR) $(ARFLAGS) $(dir $@)/.aarch64/$(notdir $@) $(foreach x,$^,$(dir $(x)).aarch64/$(notdir $(x)))
# ==============================================================================
# Linking Rules
# ==============================================================================
o/$(MODE)/%: o/$(MODE)/%.o
$(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@
o/$(MODE)/%.com: o/$(MODE)/%.o
$(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@
# ==============================================================================
# Test Execution
# ==============================================================================
%.runs: %
$<
@touch $@
# ==============================================================================
# Man Page Generation
# ==============================================================================
.PRECIOUS: %.1.asc
%.1.asc: %.1
-MANWIDTH=80 MAN_KEEP_FORMATTING=1 man $< >$@.tmp && mv -f $@.tmp $@
@rm -f $@.tmp
# ==============================================================================
# Zip Object Creation via Cosmpolitan Zip File Compiler (zipobj)
# ==============================================================================
o/$(MODE)/%.zip.o: % $(COSMOCC)
@mkdir -p $(dir $@)/.aarch64
$(ZIPOBJ) $(ZIPOBJ_FLAGS) -a x86_64 -o $@ $<
$(ZIPOBJ) $(ZIPOBJ_FLAGS) -a aarch64 -o $(dir $@)/.aarch64/$(notdir $@) $<
# ==============================================================================
# APE Setup
# ==============================================================================
$(PREFIX)/bin/ape: $(COSMOCC)
$(INSTALL) $(COSMOCC)/bin/ape-$(ARCH).elf $(PREFIX)/bin/ape
echo ':APE:M::MZqFpD::/usr/bin/ape:' > /proc/sys/fs/binfmt_misc/register
================================================
FILE: build/run
================================================
#!/bin/sh
exec "$@"
================================================
FILE: build/sha256sum.c
================================================
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
│ vi: set et ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi │
╞══════════════════════════════════════════════════════════════════════════════╡
│ Copyright 2022 Justine Alexandra Roberts Tunney │
│ │
│ Permission to use, copy, modify, and/or distribute this software for │
│ any purpose with or without fee is hereby granted, provided that the │
│ above copyright notice and this permission notice appear in all copies. │
│ │
│ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │
│ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │
│ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │
│ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │
│ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │
│ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
│ PERFORMANCE OF THIS SOFTWARE. │
╚─────────────────────────────────────────────────────────────────────────────*/
#include <errno.h>
#include <limits.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
// this file should not have dependencies, because everything will be
// re-downloaded if the o/tool/sha256sum artifact becomes invalidated
#define PROG "sha256sum"
#define USAGE \
"\
Usage: " PROG " [-?hbctw] [PATH...]\n\
-h help\n\
-c check mode\n\
-b binary mode\n\
-t textual mode\n\
-w warning mode\n"
#define ROTR(a, b) (((a) >> (b)) | ((a) << (32 - (b))))
#define CH(x, y, z) (((x) & (y)) ^ (~(x) & (z)))
#define MAJ(x, y, z) (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z)))
#define EP0(x) (ROTR(x, 2) ^ ROTR(x, 13) ^ ROTR(x, 22))
#define EP1(x) (ROTR(x, 6) ^ ROTR(x, 11) ^ ROTR(x, 25))
#define SIG0(x) (ROTR(x, 7) ^ ROTR(x, 18) ^ ((x) >> 3))
#define SIG1(x) (ROTR(x, 17) ^ ROTR(x, 19) ^ ((x) >> 10))
struct Sha256Ctx {
uint8_t data[64];
uint32_t datalen;
uint64_t bitlen;
uint32_t state[8];
};
static const uint32_t kSha256Tab[64] = {
0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, //
0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, //
0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, //
0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, //
0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, //
0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, //
0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, //
0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, //
0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, //
0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, //
0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, //
0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, //
0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, //
0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, //
0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, //
0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2, //
};
static bool g_warn;
static char g_mode;
static bool g_check;
static int g_mismatches;
static void Sha256Transform(uint32_t state[8], const uint8_t data[64]) {
unsigned i;
uint32_t a, b, c, d, e, f, g, h, t1, t2, m[64];
for (i = 0; i < 16; ++i, data += 4) {
m[i] = (uint32_t)data[0] << 24 | data[1] << 16 | data[2] << 8 | data[3];
}
for (; i < 64; ++i) {
m[i] = SIG1(m[i - 2]) + m[i - 7] + SIG0(m[i - 15]) + m[i - 16];
}
a = state[0];
b = state[1];
c = state[2];
d = state[3];
e = state[4];
f = state[5];
g = state[6];
h = state[7];
for (i = 0; i < 64; ++i) {
t1 = h + EP1(e) + CH(e, f, g) + kSha256Tab[i] + m[i];
t2 = EP0(a) + MAJ(a, b, c);
h = g;
g = f;
f = e;
e = d + t1;
d = c;
c = b;
b = a;
a = t1 + t2;
}
state[0] += a;
state[1] += b;
state[2] += c;
state[3] += d;
state[4] += e;
state[5] += f;
state[6] += g;
state[7] += h;
}
static void Sha256Init(struct Sha256Ctx *ctx) {
ctx->datalen = 0;
ctx->bitlen = 0;
ctx->state[0] = 0x6a09e667;
ctx->state[1] = 0xbb67ae85;
ctx->state[2] = 0x3c6ef372;
ctx->state[3] = 0xa54ff53a;
ctx->state[4] = 0x510e527f;
ctx->state[5] = 0x9b05688c;
ctx->state[6] = 0x1f83d9ab;
ctx->state[7] = 0x5be0cd19;
}
static void Sha256Update(struct Sha256Ctx *ctx, const uint8_t *data,
long size) {
long i;
for (i = 0; i < size; ++i) {
ctx->data[ctx->datalen] = data[i];
ctx->datalen++;
if (ctx->datalen == 64) {
Sha256Transform(ctx->state, ctx->data);
ctx->bitlen += 512;
ctx->datalen = 0;
}
}
}
static void Sha256Final(struct Sha256Ctx *ctx, uint8_t *hash) {
long i;
i = ctx->datalen;
ctx->data[i++] = 0x80;
if (ctx->datalen < 56) {
memset(ctx->data + i, 0, 56 - i);
} else {
memset(ctx->data + i, 0, 64 - i);
Sha256Transform(ctx->state, ctx->data);
memset(ctx->data, 0, 56);
}
ctx->bitlen += ctx->datalen * 8;
ctx->data[63] = ctx->bitlen;
ctx->data[62] = ctx->bitlen >> 8;
ctx->data[61] = ctx->bitlen >> 16;
ctx->data[60] = ctx->bitlen >> 24;
ctx->data[59] = ctx->bitlen >> 32;
ctx->data[58] = ctx->bitlen >> 40;
ctx->data[57] = ctx->bitlen >> 48;
ctx->data[56] = ctx->bitlen >> 56;
Sha256Transform(ctx->state, ctx->data);
for (i = 0; i < 4; ++i) {
hash[i] = (ctx->state[0] >> (24 - i * 8)) & 0xff;
hash[i + 4] = (ctx->state[1] >> (24 - i * 8)) & 0xff;
hash[i + 8] = (ctx->state[2] >> (24 - i * 8)) & 0xff;
hash[i + 12] = (ctx->state[3] >> (24 - i * 8)) & 0xff;
hash[i + 16] = (ctx->state[4] >> (24 - i * 8)) & 0xff;
hash[i + 20] = (ctx->state[5] >> (24 - i * 8)) & 0xff;
hash[i + 24] = (ctx->state[6] >> (24 - i * 8)) & 0xff;
hash[i + 28] = (ctx->state[7] >> (24 - i * 8)) & 0xff;
}
}
static char *FormatUint32(char *p, uint32_t x) {
char t;
size_t i, a, b;
i = 0;
do {
p[i++] = x % 10 + '0';
x = x / 10;
} while (x > 0);
p[i] = '\0';
if (i) {
for (a = 0, b = i - 1; a < b; ++a, --b) {
t = p[a];
p[a] = p[b];
p[b] = t;
}
}
return p + i;
}
static char *FormatInt32(char *p, int32_t x) {
if (x < 0) *p++ = '-', x = -(uint32_t)x;
return FormatUint32(p, x);
}
static size_t StrCat(char *dst, const char *src, size_t dsize) {
size_t m, n = dsize;
const char *p = dst;
const char *q = src;
while (n-- != 0 && *dst != '\0') dst++;
m = dst - p;
n = dsize - m;
if (n-- == 0) {
return m + strlen(src);
}
while (*src != '\0') {
if (n != 0) {
*dst++ = *src;
n--;
}
src++;
}
*dst = '\0';
return m + (src - q);
}
static void GetOpts(int argc, char *argv[]) {
int opt;
g_mode = ' ';
while ((opt = getopt(argc, argv, "?hbctw")) != -1) {
switch (opt) {
case 'w':
g_warn = true;
break;
case 'c':
g_check = true;
break;
case 't':
g_mode = ' ';
break;
case 'b':
g_mode = '*';
break;
case 'h':
case '?':
(void)write(1, USAGE, sizeof(USAGE) - 1);
exit(0);
default:
(void)write(2, USAGE, sizeof(USAGE) - 1);
exit(64);
}
}
}
static void Write(int fd, const char *s, ...) {
va_list va;
char buf[512];
buf[0] = 0;
va_start(va, s);
do {
StrCat(buf, s, sizeof(buf));
} while ((s = va_arg(va, const char *)));
va_end(va);
(void)write(fd, buf, strlen(buf));
}
static bool IsModeCharacter(char c) {
switch (c) {
case ' ':
case '*':
return true;
default:
return false;
}
}
static bool IsSupportedPath(const char *path) {
size_t i;
for (i = 0;; ++i) {
switch (path[i]) {
case 0:
if (i) return true;
// fallthrough
case '\r':
case '\n':
case '\\':
Write(2, PROG, ": ", path, ": unsupported path\n", NULL);
return false;
default:
break;
}
}
}
static bool GetDigest(const char *path, FILE *f, uint8_t digest[32]) {
size_t got;
uint8_t buf[512];
struct Sha256Ctx ctx;
Sha256Init(&ctx);
while ((got = fread(buf, 1, sizeof(buf), f))) {
Sha256Update(&ctx, buf, got);
}
if (ferror(f)) {
Write(2, PROG, ": ", path, ": ", strerror(errno), "\n", NULL);
return false;
}
Sha256Final(&ctx, digest);
return true;
}
static char *CopyHex(char *s, const void *p, size_t n) {
const char *d, *e;
for (d = (const char *)p, e = d + n; d < e; ++d) {
*s++ = "0123456789abcdef"[(*d >> 4) & 15];
*s++ = "0123456789abcdef"[(*d >> 0) & 15];
}
*s = 0;
return s;
}
static bool ProduceDigest(const char *path, FILE *f) {
char hexdigest[65];
char mode[2] = {g_mode};
unsigned char digest[32];
if (!IsSupportedPath(path)) return false;
if (!GetDigest(path, f, digest)) return false;
CopyHex(hexdigest, digest, 32);
Write(1, hexdigest, " ", mode, path, "\n", NULL);
return true;
}
static char *Chomp(char *line) {
size_t i;
if (line) {
for (i = strlen(line); i--;) {
if (line[i] == '\r' || line[i] == '\n') {
line[i] = '\0';
} else {
break;
}
}
}
return line;
}
static int HexToInt(int c) {
if ('0' <= c && c <= '9') {
return c - '0';
} else if ('a' <= c && c <= 'f') {
return c - 'a' + 10;
} else if ('A' <= c && c <= 'F') {
return c - 'A' + 10;
} else {
return -1;
}
}
static bool CheckDigests(const char *path, FILE *f) {
FILE *f2;
bool k = true;
int a, b, i, line;
const char *path2, *status;
uint8_t wantdigest[32], gotdigest[32];
char buf[64 + 2 + PATH_MAX + 1 + 1], *p;
for (line = 0; fgets(buf, sizeof(buf), f); ++line) {
if (!*Chomp(buf)) continue;
for (p = buf, i = 0; i < 32; ++i) {
if ((a = HexToInt(*p++ & 255)) == -1) goto InvalidLine;
if ((b = HexToInt(*p++ & 255)) == -1) goto InvalidLine;
wantdigest[i] = a << 4 | b;
}
if (*p++ != ' ') goto InvalidLine;
if (!IsModeCharacter(*p++)) goto InvalidLine;
path2 = p;
if (!*path2) goto InvalidLine;
if (!IsSupportedPath(path2)) continue;
if ((f2 = fopen(path2, "rb"))) {
if (GetDigest(path2, f2, gotdigest)) {
if (!memcmp(wantdigest, gotdigest, 32)) {
status = "OK";
} else {
status = "FAILED";
++g_mismatches;
k = false;
}
Write(1, path2, ": ", status, "\n", NULL);
} else {
k = false;
}
fclose(f2);
} else {
Write(2, PROG, ": ", path2, ": ", strerror(errno), "\n", NULL);
k = false;
}
continue;
InvalidLine:
if (g_warn) {
char linestr[12];
FormatInt32(linestr, line + 1);
Write(2, PROG, ": ", path, ":", linestr, ": ",
"improperly formatted checksum line", "\n", NULL);
}
}
if (ferror(f)) {
Write(2, PROG, ": ", path, ": ", strerror(errno), "\n", NULL);
k = false;
}
return k;
}
static bool Process(const char *path, FILE *f) {
if (g_check) {
return CheckDigests(path, f);
} else {
return ProduceDigest(path, f);
}
}
int main(int argc, char *argv[]) {
int i;
FILE *f;
bool k = true;
GetOpts(argc, argv);
if (optind == argc) {
f = stdin;
k &= Process("-", f);
} else {
for (i = optind; i < argc; ++i) {
if ((f = fopen(argv[i], "rb"))) {
k &= Process(argv[i], f);
fclose(f);
} else {
Write(2, PROG, ": ", argv[i], ": ", strerror(errno), "\n", NULL);
k = false;
}
}
}
if (g_mismatches) {
char ibuf[12];
FormatInt32(ibuf, g_mismatches);
Write(2, PROG, ": WARNING: ", ibuf, " computed checksum did NOT match\n",
NULL);
}
return !k;
}
================================================
FILE: build/tags.mk
================================================
#-*-mode:makefile-gmake;indent-tabs-mode:t;tab-width:8;coding:utf-8-*-┐
#── vi: set noet ft=make ts=8 sw=8 fenc=utf-8 :vi ────────────────────┘
TAGSFLAGS = \
-e \
-a \
--if0=no \
--langmap=c:.c.h.i \
--line-directives=yes
tags: TAGS HTAGS
TAGS: o/$(MODE)/tags-srcs.txt $(SRCS)
@rm -f $@
ctags $(TAGSFLAGS) -L $< -o $@
HTAGS: o/$(MODE)/tags-hdrs.txt $(HDRS) $(INCS)
@rm -f $@
build/htags ctags -L $< -o $@
o/$(MODE)/tags-srcs.txt: $(call uniq,$(foreach x,$(SRCS),$(dir $(x))))
@mkdir -p $(@D)
$(file >$@) $(foreach x,$(SRCS),$(file >>$@,$(x)))
o/$(MODE)/tags-hdrs.txt: $(call uniq,$(foreach x,$(HDRS) $(INCS),$(dir $(x))))
@mkdir -p $(@D)
$(file >$@) $(foreach x,$(HDRS) $(INCS),$(file >>$@,$(x)))
================================================
FILE: cosmocc-override.cmake
================================================
set(CMAKE_ASM_OUTPUT_EXTENSION .o)
set(CMAKE_C_OUTPUT_EXTENSION .o)
set(CMAKE_CXX_OUTPUT_EXTENSION .o)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Xx86_64-mtune=znver4")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Xx86_64-mtune=znver4")
================================================
FILE: docs/AGENTS.md
================================================
# AGENTS.md
This file provides guidance to Claude Code when working with this repository.
## Project Overview
Llamafile combines llama.cpp, whisper.cpp, and stable-diffusion.cpp with Cosmopolitan Libc to create single-file executables that run LLMs locally across Windows, macOS, Linux, and BSD without installation.
## Quick Reference
```sh
# Initial setup (run once after clone)
make setup
# Build (always use cosmocc make, not system make)
# Adapt `nproc` to the OS where you are building, (e.g. `sysctl -n hw.physicalcpu` on mac)
.cosmocc/4.0.2/bin/make -j $(nproc)
# Run tests
.cosmocc/4.0.2/bin/make check
# Clean build outputs
.cosmocc/4.0.2/bin/make clean
# Reset all submodules (warning: removes local changes)
make reset-repo
```
## Key Directories
| Directory | Purpose |
|-----------|---------|
| `llamafile/` | Core library (edit directly) |
| `llama.cpp/` | LLM inference (submodule, edit directly then convert to patches) |
| `whisper.cpp/` | Speech-to-text (submodule, edit directly then convert to patches) |
| `stable-diffusion.cpp/` | Image generation (submodule, edit directly then convert to patches) |
| `*.patches/` | Patch directories for submodules |
| `o/` | Build outputs |
## Important Notes
- Always use `.cosmocc/4.0.2/bin/make`, not system make
- Run `make setup` after cloning or updating submodules
- Submodule changes require patch files (see skill for workflow)
## Detailed Documentation
For comprehensive build, architecture, development, and testing documentation, ask Claude about "how to build llamafile" or "llamafile development workflow" to load the llamafile skill.
================================================
FILE: docs/commands/build.md
================================================
---
description: Build llamafile using the cosmocc toolchain
---
# Build Llamafile
Build the project using the Cosmopolitan toolchain.
First, ensure the toolchain is available:
```bash
if [ ! -d .cosmocc/4.0.2 ]; then
build/download-cosmocc.sh .cosmocc/4.0.2 4.0.2 85b8c37a406d862e656ad4ec14be9f6ce474c1b436b9615e91a55208aced3f44
fi
```
Then build:
```bash
.cosmocc/4.0.2/bin/make -j $(nproc)
```
Adapt `nproc` to the OS where you are building, (e.g. `sysctl -n hw.physicalcpu` on mac)
Build outputs will be in `o/$(MODE)/`.
================================================
FILE: docs/commands/check.md
================================================
---
description: Run llamafile unit tests
---
# Run Llamafile Tests
Run the unit test suite using the Cosmopolitan toolchain.
```bash
.cosmocc/4.0.2/bin/make check
```
================================================
FILE: docs/commands/clean.md
================================================
---
description: Clean llamafile build outputs
---
# Clean Llamafile Build
Remove all build outputs from the `o/` directory.
```bash
.cosmocc/4.0.2/bin/make clean
```
================================================
FILE: docs/creating_llamafiles.md
================================================
# Creating a llamafile
A llamafile bundles the llamafile executable, model weights, and a set of
default arguments into a single self-contained file using the
[APE](https://justine.lol/ape.html) (Actually Portable Executable) format,
which supports ZIP as a container for extra data. If you have already
downloaded a llamafile, you can inspect its contents with
`unzip -vl <filename.llamafile>` (or on Windows, rename it to `.zip` and
open it in your ZIP GUI).
## Prerequisites
llamafile uses [zipalign](https://github.com/jart/zipalign) to bundle files
into the executable. It is included as a git submodule and built alongside
llamafile, so if you have already compiled llamafile you have the `zipalign`
executable in the `o//third_party/zipalign` folder. To build it on its own:
```sh
make o//third_party/zipalign
```
> [!NOTE]
> The zipalign tool referenced here is **not** the
> [Android zipalign](https://developer.android.com/tools/zipalign). See the
> GitHub repo above for an in-depth description and up-to-date code.
## What you need
- **The llamafile executable** — download a prebuilt binary from the
[releases page](https://github.com/mozilla-ai/llamafile/releases), or build
from source following
[these instructions](https://mozilla-ai.github.io/llamafile/source_installation/).
- **Model weights in GGUF format** — download from Hugging Face
([search here](https://huggingface.co/models?library=gguf)), or use weights
already on disk from
[another application](https://mozilla-ai.github.io/llamafile/quickstart/#running-llamafile-with-models-downloaded-by-third-party-applications).
- **A `.args` file** — specifies default arguments (at minimum, the model
path so it loads automatically).
## Examples
### TUI, text-only
Let's see how this works in practice with a simple, text-only language
model, e.g. Qwen3-0.6B:
- [Search](https://huggingface.co/models?library=gguf&sort=trending&search=qwen3-0.6b) for the model weights in GGUF format
(for the sake of this example we'll download [these](https://huggingface.co/Qwen/Qwen3-0.6B-GGUF) with Q8 quantization)
- Create a file named `.args` with the following content:
```text
-m
/zip/Qwen3-0.6B-Q8_0.gguf
-fa
on
--temp
0.6
--top-k
20
--top-p
0.95
--min-p
0
--presence-penalty
1.5
-c
40960
-n
32768
--no-context-shift
--no-mmap
...
```
> [!NOTE]
> There is one argument per line. Most arguments are optional — the model
> name is the only required one (the above replicates the parameters suggested
> [here](https://huggingface.co/Qwen/Qwen3-0.6B-GGUF)). The `/zip/` path
> prefix is required whenever referencing a file packaged inside the llamafile.
> The `...` token is replaced with any additional CLI arguments the user passes
> at runtime.
- Copy the llamafile executable and run zipalign to embed the weights and args:
```bash
cp o//llamafile/llamafile Qwen3-0.6B-Q8.llamafile
o//third_party/zipalign/zipalign -j0 \
Qwen3-0.6B-Q8.llamafile \
Qwen3-0.6B-Q8_0.gguf \
.args
./Qwen3-0.6B-Q8.llamafile
```
Congratulations, you've just made your own LLM executable that's easy to
share with your friends!
Your new llamafile will start loading the Qwen model in the TUI. You can also
run it as a web server with:
```bash
./Qwen3-0.6B-Q8.llamafile --server
```
### Server, multimodal
Now, let us build another llamafile running a multimodal model served
via HTTP. If you want to be able to just say:
```bash
./llava.llamafile
```
...and have it run the web server without having to specify arguments,
embed both the weights and the following `.args` file
(weights used in this example are downloaded from [here](https://huggingface.co/cjpais/llava-1.6-mistral-7b-gguf)):
```text
-m
/zip/llava-v1.6-mistral-7b.Q8_0.gguf
--mmproj
/zip/mmproj-model-f16.gguf
--server
--host
0.0.0.0
-ngl
9999
--no-mmap
...
```
Next, add both the weights and the argument file to the executable:
```bash
cp o//llamafile/llamafile llava.llamafile
o//third_party/zipalign/zipalign -j0 \
llava.llamafile \
llava-v1.6-mistral-7b.Q8_0.gguf \
mmproj-model-f16.gguf \
.args
./llava.llamafile
```
## Distribution
One good way to share a llamafile with your friends is by posting it on
Hugging Face. If you do that, then it's recommended that you mention in
your Hugging Face commit message what git revision or released version
of llamafile you used when building your llamafile. That way everyone
online will be able verify the provenance of its executable content. If
you've made changes to the llama.cpp or cosmopolitan source code, then
the Apache 2.0 license requires you to explain what changed. One way you
can do that is by embedding a notice in your llamafile using `zipalign`
that describes the changes, and mention it in your Hugging Face commit.
================================================
FILE: docs/example_llamafiles.md
================================================
We provide example llamafiles for a variety of models, so you can easily try out llamafile
with different kinds of LLMs. The following table lists llamafiles bundled with the latest
available version of the server (v0.10.0). The smaller the file is, the more easily it will
run on your computer, even if no GPU is present (as a reference, Qwen3.5 0.8B Q8 generates
text on a Raspberry Pi5 at ~8 tokens/sec).
| Model | Size | License | llamafile |
| --- | --- | --- | --- |
| [Qwen3.5 0.8B](https://huggingface.co/Qwen/Qwen3.5-0.8B) Q8_0 | 1.6 GB | [Apache 2.0](https://choosealicense.com/licenses/apache-2.0/) | [Qwen3.5-0.8B-Q8_0.llamafile](https://huggingface.co/mozilla-ai/llamafile_0.10.0/resolve/main/Qwen3.5-0.8B-Q8_0.llamafile) |
| [Qwen3.5 2B](https://huggingface.co/Qwen/Qwen3.5-2B) Q8_0 | 3.2 GB | [Apache 2.0](https://choosealicense.com/licenses/apache-2.0/) | [Qwen3.5-2B-Q8_0.llamafile](https://huggingface.co/mozilla-ai/llamafile_0.10.0/resolve/main/Qwen3.5-2B-Q8_0.llamafile) |
| [Ministral 3 3B Instruct 2512](https://huggingface.co/mistralai/Ministral-3-3B-Instruct-2512) Q4_K_M | 3.4 GB | [Apache 2.0](https://choosealicense.com/licenses/apache-2.0/) | [Ministral-3-3B-Instruct-2512-Q4_K_M.llamafile](https://huggingface.co/mozilla-ai/llamafile_0.10.0/resolve/main/Ministral-3-3B-Instruct-2512-Q4_K_M.llamafile) |
| [Qwen3.5 4B](https://huggingface.co/Qwen/Qwen3.5-4B) Q5_K_S | 4.1 GB | [Apache 2.0](https://choosealicense.com/licenses/apache-2.0/) | [Qwen3.5-4B-Q5_K_S.llamafile](https://huggingface.co/mozilla-ai/llamafile_0.10.0/resolve/main/Qwen3.5-4B-Q5_K_S.llamafile) |
| [llava v1.6 mistral 7b](https://huggingface.co/liuhaotian/llava-v1.6-mistral-7b) Q4_K_M | 5.3 GB | [Apache 2.0](https://choosealicense.com/licenses/apache-2.0/) | [llava-v1.6-mistral-7b-Q4_K_M.llamafile](https://huggingface.co/mozilla-ai/llamafile_0.10.0/resolve/main/llava-v1.6-mistral-7b-Q4_K_M.llamafile) |
| [Apertus 8B Instruct 2509](https://huggingface.co/swiss-ai/Apertus-8B-Instruct-2509) | 5.9 GB | [Apache 2.0](https://choosealicense.com/licenses/apache-2.0/) | [Apertus-8B-Instruct-2509.llamafile](https://huggingface.co/mozilla-ai/llamafile_0.10.0/resolve/main/Apertus-8B-Instruct-2509.llamafile) |
| [Qwen3.5 9B](https://huggingface.co/Qwen/Qwen3.5-9B) Q5_K_S | 7.4 GB | [Apache 2.0](https://choosealicense.com/licenses/apache-2.0/) | [Qwen3.5-9B-Q5_K_S.llamafile](https://huggingface.co/mozilla-ai/llamafile_0.10.0/resolve/main/Qwen3.5-9B-Q5_K_S.llamafile) |
| [Ministral 3 3B Instruct 2512](https://huggingface.co/mistralai/Ministral-3-3B-Instruct-2512) BF16 | 7.8 GB | [Apache 2.0](https://choosealicense.com/licenses/apache-2.0/) | [Ministral-3-3B-Instruct-2512-BF16.llamafile](https://huggingface.co/mozilla-ai/llamafile_0.10.0/resolve/main/Ministral-3-3B-Instruct-2512-BF16.llamafile) |
| [llava v1.6 mistral 7b](https://huggingface.co/liuhaotian/llava-v1.6-mistral-7b) Q8_0 | 8.4 GB | [Apache 2.0](https://choosealicense.com/licenses/apache-2.0/) | [llava-v1.6-mistral-7b-Q8_0.llamafile](https://huggingface.co/mozilla-ai/llamafile_0.10.0/resolve/main/llava-v1.6-mistral-7b-Q8_0.llamafile) |
| [gpt-oss 20b](https://huggingface.co/openai/gpt-oss-20b) mxfp4 | 12 GB | [Apache 2.0](https://choosealicense.com/licenses/apache-2.0/) | [gpt-oss-20b-mxfp4.llamafile](https://huggingface.co/mozilla-ai/llamafile_0.10.0/resolve/main/gpt-oss-20b-mxfp4.llamafile) |
| [gpt-oss 20b](https://huggingface.co/openai/gpt-oss-20b) Q5_K_S | 12 GB | [Apache 2.0](https://choosealicense.com/licenses/apache-2.0/) | [gpt-oss-20b-Q5_K_S.llamafile](https://huggingface.co/mozilla-ai/llamafile_0.10.0/resolve/main/gpt-oss-20b-Q5_K_S.llamafile) |
| [LFM2 24B A2B](https://huggingface.co/LiquidAI/LFM2-24B-A2B) Q5_K_M | 16 GB | [lfm1.0](https://huggingface.co/LiquidAI/LFM2-24B-A2B/blob/main/LICENSE) | [LFM2-24B-A2B-Q5_K_M.llamafile](https://huggingface.co/mozilla-ai/llamafile_0.10.0/resolve/main/LFM2-24B-A2B-Q5_K_M.llamafile) |
| [Qwen3.5 27B](https://huggingface.co/Qwen/Qwen3.5-27B) Q5_K_S | 19 GB | [Apache 2.0](https://choosealicense.com/licenses/apache-2.0/) | [Qwen3.5-27B-Q5_K_S.llamafile](https://huggingface.co/mozilla-ai/llamafile_0.10.0/resolve/main/Qwen3.5-27B-Q5_K_S.llamafile) |
## Legacy llamafiles
If you prefer the "classic llamafile experience" from previous versions (0.9.*),
here's a list of llamafiles bundled with the older server executable.
| Model | Size | License | llamafile | other quants |
| --- | --- | --- | --- | --- |
| LLaMA 3.2 1B Instruct | 1.11 GB | [LLaMA 3.2](https://huggingface.co/Mozilla/Llama-3.2-1B-Instruct-llamafile/blob/main/LICENSE) | [Llama-3.2-1B-Instruct-Q6\_K.llamafile](https://huggingface.co/Mozilla/Llama-3.2-1B-Instruct-llamafile/blob/main/Llama-3.2-1B-Instruct-Q6_K.llamafile?download=true) | [See HF repo](https://huggingface.co/Mozilla/Llama-3.2-1B-Instruct-llamafile) |
| LLaMA 3.2 3B Instruct | 2.62 GB | [LLaMA 3.2](https://huggingface.co/Mozilla/Llama-3.2-3B-Instruct-llamafile/blob/main/LICENSE) | [Llama-3.2-3B-Instruct.Q6\_K.llamafile](https://huggingface.co/Mozilla/Llama-3.2-3B-Instruct-llamafile/blob/main/Llama-3.2-3B-Instruct.Q6_K.llamafile?download=true) | [See HF repo](https://huggingface.co/Mozilla/Llama-3.2-3B-Instruct-llamafile) |
| LLaMA 3.1 8B Instruct | 5.23 GB | [LLaMA 3.1](https://huggingface.co/Mozilla/Meta-Llama-3.1-8B-Instruct-llamafile/blob/main/LICENSE) | [Llama-3.1-8B-Instruct.Q4\_K\_M.llamafile](https://huggingface.co/Mozilla/Meta-Llama-3.1-8B-Instruct-llamafile/resolve/main/Meta-Llama-3.1-8B-Instruct.Q4_K_M.llamafile?download=true) | [See HF repo](https://huggingface.co/Mozilla/Meta-Llama-3.1-8B-Instruct-llamafile) |
| Gemma 3 1B Instruct | 1.32 GB | [Gemma 3](https://ai.google.dev/gemma/terms) | [gemma-3-1b-it.Q6\_K.llamafile](https://huggingface.co/Mozilla/gemma-3-1b-it-llamafile/resolve/main/google_gemma-3-1b-it-Q6_K.llamafile?download=true) | [See HF repo](https://huggingface.co/Mozilla/gemma-3-1b-it-llamafile) |
| Gemma 3 4B Instruct | 3.50 GB | [Gemma 3](https://ai.google.dev/gemma/terms) | [gemma-3-4b-it.Q6\_K.llamafile](https://huggingface.co/Mozilla/gemma-3-4b-it-llamafile/resolve/main/google_gemma-3-4b-it-Q6_K.llamafile?download=true) | [See HF repo](https://huggingface.co/Mozilla/gemma-3-4b-it-llamafile) |
| Gemma 3 12B Instruct | 7.61 GB | [Gemma 3](https://ai.google.dev/gemma/terms) | [gemma-3-12b-it.Q4\_K\_M.llamafile](https://huggingface.co/Mozilla/gemma-3-12b-it-llamafile/resolve/main/google_gemma-3-12b-it-Q4_K_M.llamafile?download=true) | [See HF repo](https://huggingface.co/Mozilla/gemma-3-12b-it-llamafile) |
| QwQ 32B | 7.61 GB | [Apache 2.0](https://choosealicense.com/licenses/apache-2.0/) | [Qwen\_QwQ-32B-Q4\_K\_M.llamafile](https://huggingface.co/Mozilla/QwQ-32B-llamafile/resolve/main/Qwen_QwQ-32B-Q4_K_M.llamafile?download=true) | [See HF repo](https://huggingface.co/Mozilla/QwQ-32B-llamafile) |
| R1 Distill Qwen 14B | 9.30 GB | [MIT](https://choosealicense.com/licenses/mit/) | [DeepSeek-R1-Distill-Qwen-14B-Q4\_K\_M](https://huggingface.co/Mozilla/DeepSeek-R1-Distill-Qwen-14B-llamafile/resolve/main/DeepSeek-R1-Distill-Qwen-14B-Q4_K_M.llamafile?download=true) | [See HF repo](https://huggingface.co/Mozilla/DeepSeek-R1-Distill-Qwen-14B-llamafile)|
| R1 Distill Llama 8B | 5.23 GB | [MIT](https://choosealicense.com/licenses/mit/) | [DeepSeek-R1-Distill-Llama-8B-Q4\_K\_M](https://huggingface.co/Mozilla/DeepSeek-R1-Distill-Llama-8B-llamafile/resolve/main/DeepSeek-R1-Distill-Llama-8B-Q4_K_M.llamafile?download=true) | [See HF repo](https://huggingface.co/Mozilla/DeepSeek-R1-Distill-Llama-8B-llamafile)|
| LLaVA 1.5 | 3.97 GB | [LLaMA 2](https://ai.meta.com/resources/models-and-libraries/llama-downloads/) | [llava-v1.5-7b-q4.llamafile](https://huggingface.co/Mozilla/llava-v1.5-7b-llamafile/resolve/main/llava-v1.5-7b-q4.llamafile?download=true) | [See HF repo](https://huggingface.co/Mozilla/llava-v1.5-7b-llamafile) |
| Mistral-7B-Instruct v0.3| 4.42 GB | [Apache 2.0](https://choosealicense.com/licenses/apache-2.0/) | [mistral-7b-instruct-v0.3.Q4\_0.llamafile](https://huggingface.co/Mozilla/Mistral-7B-Instruct-v0.3-llamafile/resolve/main/Mistral-7B-Instruct-v0.3.Q4_0.llamafile?download=true) | [See HF repo](https://huggingface.co/Mozilla/Mistral-7B-Instruct-v0.3-llamafile) |
| Granite 3.2 8B Instruct | 5.25 GB | [Apache 2.0](https://choosealicense.com/licenses/apache-2.0/) | [granite-3.2-8b-instruct-Q4\_K\_M.llamafile](https://huggingface.co/Mozilla/granite-3.2-8b-instruct-llamafile/resolve/main/granite-3.2-8b-instruct-Q4_K_M.llamafile?download=true) | [See HF repo](https://huggingface.co/Mozilla/granite-3.2-8b-instruct-llamafile) |
| Phi-3-mini-4k-instruct | 7.67 GB | [Apache 2.0](https://huggingface.co/Mozilla/Phi-3-mini-4k-instruct-llamafile/blob/main/LICENSE) | [Phi-3-mini-4k-instruct.F16.llamafile](https://huggingface.co/Mozilla/Phi-3-mini-4k-instruct-llamafile/resolve/main/Phi-3-mini-4k-instruct.F16.llamafile?download=true) | [See HF repo](https://huggingface.co/Mozilla/Phi-3-mini-4k-instruct-llamafile) |
| Mixtral-8x7B-Instruct | 30.03 GB | [Apache 2.0](https://choosealicense.com/licenses/apache-2.0/) | [mixtral-8x7b-instruct-v0.1.Q5\_K\_M.llamafile](https://huggingface.co/Mozilla/Mixtral-8x7B-Instruct-v0.1-llamafile/resolve/main/mixtral-8x7b-instruct-v0.1.Q5_K_M.llamafile?download=true) | [See HF repo](https://huggingface.co/Mozilla/Mixtral-8x7B-Instruct-v0.1-llamafile) |
| OLMo-7B | 5.68 GB | [Apache 2.0](https://huggingface.co/Mozilla/OLMo-7B-0424-llamafile/blob/main/LICENSE) | [OLMo-7B-0424.Q6\_K.llamafile](https://huggingface.co/Mozilla/OLMo-7B-0424-llamafile/resolve/main/OLMo-7B-0424.Q6_K.llamafile?download=true) | [See HF repo](https://huggingface.co/Mozilla/OLMo-7B-0424-llamafile) |
| *Text Embedding Models* | | | | |
| E5-Mistral-7B-Instruct | 5.16 GB | [MIT](https://choosealicense.com/licenses/mit/) | [e5-mistral-7b-instruct-Q5_K_M.llamafile](https://huggingface.co/Mozilla/e5-mistral-7b-instruct/resolve/main/e5-mistral-7b-instruct-Q5_K_M.llamafile?download=true) | [See HF repo](https://huggingface.co/Mozilla/e5-mistral-7b-instruct) |
| mxbai-embed-large-v1 | 0.7 GB | [Apache 2.0](https://choosealicense.com/licenses/apache-2.0/) | [mxbai-embed-large-v1-f16.llamafile](https://huggingface.co/Mozilla/mxbai-embed-large-v1-llamafile/resolve/main/mxbai-embed-large-v1-f16.llamafile?download=true) | [See HF Repo](https://huggingface.co/Mozilla/mxbai-embed-large-v1-llamafile) |
As described in the [Getting Started](quickstart.md) section,
macOS, Linux, and BSD users will need to use the "chmod"
command to grant execution permissions to the file before running these
llamafiles for the first time.
Unfortunately, Windows users cannot make use of many of these example
llamafiles because Windows has a maximum executable file size of 4GB,
and all of these examples exceed that size. (The LLaVA llamafile works
on Windows because it is 30MB shy of the size limit.) But don't lose
heart: llamafile allows you to use external weights; this is described
in the [Getting Started](quickstart.md) section.
**Having trouble? See the [Troubleshooting](troubleshooting.md) page.**
## A note about models
The example llamafiles provided above should not be interpreted as
endorsements or recommendations of specific models, licenses, or data
sets on the part of Mozilla.
================================================
FILE: docs/index.md
================================================
# llamafile
<img src="images/llamafile-640x640.png" width="320" height="320"
alt="[line drawing of llama animal head in front of slightly open manilla folder filled with files]">
[](https://github.com/mozilla-ai/llamafile/blob/main/LICENSE)
[](https://github.com/mozilla-ai/llamafile/actions/workflows/ci.yml)
[](https://github.com/ggml-org/llama.cpp/commit/7f5ee54)
[](https://github.com/ggml-org/whisper.cpp/commit/2eeeba5)
[](https://discord.gg/YuMNeuKStr)
[](https://builders.mozilla.org/)
**llamafile lets you distribute and run LLMs with a single file.**
llamafile is a [Mozilla Builders](https://builders.mozilla.org/) project (see its [announcement blog post](https://hacks.mozilla.org/2023/11/introducing-llamafile/)), now revamped by [Mozilla.ai](https://www.mozilla.ai/open-tools/llamafile).
Our goal is to make open LLMs much more
accessible to both developers and end users. We're doing that by
combining [llama.cpp](https://github.com/ggerganov/llama.cpp) with [Cosmopolitan Libc](https://github.com/jart/cosmopolitan) into one
framework that collapses all the complexity of LLMs down to
a single-file executable (called a "llamafile") that runs
locally on most operating systems and CPU archiectures, with no installation.
llamafile also includes **[whisperfile](whisperfile/index.md)**, a single-file speech-to-text tool built on [whisper.cpp](https://github.com/ggerganov/whisper.cpp) and the same Cosmopolitan packaging. It supports transcription and translation of audio files across all the same platforms, with no installation required.
## v0.10.0
**llamafile versions starting from 0.10.0 use a new build system**, aimed at keeping our code more easily
aligned with the latest versions of llama.cpp. This means they support more recent models and functionalities,
but at the same time they might be missing some of
the features you were accustomed to (check out [this doc](https://github.com/mozilla-ai/llamafile/blob/main/README_0.10.0.md) for a high-level description of what has been done). If you liked
the "classic experience" more, you will always be able to access the previous versions from our
[releases](https://github.com/mozilla-ai/llamafile/releases) page. Our pre-built llamafiles always
show which version of the server they have been bundled with ([0.9.* example](https://huggingface.co/mozilla-ai/llava-v1.5-7b-llamafile), [0.10.* example](https://huggingface.co/mozilla-ai/llamafile_0.10.0)), so you will always know
which version of the software you are downloading.
> **We want to hear from you!**
Whether you are a new user or a long-time fan, please share what you find most valuable about llamafile and what would make it more useful for you.
[Read more via the blog](https://blog.mozilla.ai/llamafile-returns/) and add your voice to the discussion [here](https://github.com/mozilla-ai/llamafile/discussions/809).
## How llamafile works
A llamafile is an executable LLM that you can run on your own
computer. It contains the weights for a given open LLM, as well
as everything needed to actually run that model on your computer.
There's nothing to install or configure (with a few caveats, discussed
in subsequent sections of this document).
This is all accomplished by combining llama.cpp with Cosmopolitan Libc,
which provides some useful capabilities:
1. llamafiles can run on multiple CPU microarchitectures. We
added runtime dispatching to llama.cpp that lets new Intel systems use
modern CPU features without trading away support for older computers.
2. llamafiles can run on multiple CPU architectures. We do
that by concatenating AMD64 and ARM64 builds with a shell script that
launches the appropriate one. Our file format is compatible with WIN32
and most UNIX shells. It's also able to be easily converted (by either
you or your users) to the platform-native format, whenever required.
3. llamafiles can run on six OSes (macOS, Windows, Linux,
FreeBSD, OpenBSD, and NetBSD). If you make your own llama files, you'll
only need to build your code once, using a Linux-style toolchain. The
GCC-based compiler we provide is itself an Actually Portable Executable,
so you can build your software for all six OSes from the comfort of
whichever one you prefer most for development.
4. The weights for an LLM can be embedded within the llamafile.
We added support for PKZIP to the GGML library. This lets uncompressed
weights be mapped directly into memory, similar to a self-extracting
archive. It enables quantized weights distributed online to be prefixed
with a compatible version of the llama.cpp software, thereby ensuring
its originally observed behaviors can be reproduced indefinitely.
5. Finally, with the tools included in this project you can create your
*own* llamafiles, using any compatible model weights you want. You can
then distribute these llamafiles to other people, who can easily make
use of them regardless of what kind of computer they have.
## Licensing
While the llamafile project is Apache 2.0-licensed, our changes
to llama.cpp are licensed under MIT (just like the llama.cpp project
itself) so as to remain compatible and upstreamable in the future,
should that be desired.
The llamafile logo on this page was generated with the assistance of DALL·E 3.
[](https://star-history.com/#mozilla-ai/llamafile&Date)
================================================
FILE: docs/quickstart.md
================================================
# Getting Started with llamafile
The easiest way to try it for yourself is to download our example llamafile
for the [Qwen3.5](https://huggingface.co/Qwen/Qwen3.5-0.8B/) model (license:
[Apache 2.0](https://huggingface.co/Qwen/Qwen3.5-0.8B/blob/main/LICENSE)).
Qwen3.5 is a recent LLM that can do more than just chat; you can also upload
images and ask it questions about them. With llamafile, this all happens
locally: no data ever leaves your computer.
> **NOTE**: we chose this model because that's the smallest one we have
built a llamafile for, so most likely to work out-of-the-box for you.
Please let us know if you are still having issues with that! If, on the
other hand, you have powerful hardware and/or GPUs, [feel free to choose](example_llamafiles.md)
larger and more expressive models which should provide more accurate
responses.
1. Download [Qwen3.5-0.8B-Q8_0.llamafile](https://huggingface.co/mozilla-ai/llamafile_0.10.0/resolve/main/Qwen3.5-0.8B-Q8_0.llamafile) (1.77 GB).
2. Open your computer's terminal.
- If you're using macOS, Linux, or BSD, you'll need to grant permission
for your computer to execute this new file. (You only need to do this
once.)
```sh
chmod +x Qwen3.5-0.8B-Q8_0.llamafile
```
- If you're on Windows, rename the file by adding ".exe" on the end.
5. Run the llamafile. e.g.:
```sh
./Qwen3.5-0.8B-Q8_0.llamafile
```
6. A chat interface will open in the terminal window. That's it: you can immediately
start writing. You can also upload an image by using the `/upload` command and specifying the path to the image, or write
`/help` to see the available commands).
7. Note that when llamafile is running, you can also chat with it using
[llama.cpp](https://github.com/ggml-org/llama.cpp)'s Web UI: just open a
browser window and connect to <http://localhost:8080/>.
8. When you're done chatting, `Control-C` to shut down llamafile.
**Having trouble? See the [Troubleshooting](troubleshooting.md) page.**
## JSON API Quickstart
As llamafile relies on llama.cpp for serving models, it comes with all its
features. When it is started, in addition to hosting a web UI chat server at
<http://127.0.0.1:8080/>, it also exposes an endpoint compatible with
[OpenAI API](https://platform.openai.com/docs/api-reference/chat)
and [Anthropic's Messages API](https://platform.claude.com/docs/en/api/messages).
For further details on what fields and endpoints are available, refer to the
APIs documentation and llama.cpp server's
[README](https://github.com/ggml-org/llama.cpp/tree/master/tools/server).
<details>
<summary>Curl API Client Example</summary>
The simplest way to get started using the API is to copy and paste the
following curl command into your terminal.
```shell
curl http://localhost:8080/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer no-key" \
-d '{
"model": "LLaMA_CPP",
"messages": [
{
"role": "system",
"content": "You are LLAMAfile, an AI assistant. Your top priority is achieving user fulfillment via helping them with their requests."
},
{
"role": "user",
"content": "Write a limerick about python exceptions"
}
]
}' | python3 -c '
import json
import sys
json.dump(json.load(sys.stdin), sys.stdout, indent=2)
print()
'
```
The response that's printed should look like the following:
```json
{
"choices": [
{
"finish_reason": "stop",
"index": 0,
"message": {
"role": "assistant",
"content": "In the world of Python, where magic breaks and errors occur,\nA script fails when it should not have failed.\nWith a `KeyError`, I can't access the key,\nSo I tell you to use the `except` clause!"
}
}
],
"created": 1773659260,
"model": "Qwen3.5-0.8B-Q8_0.gguf",
"system_fingerprint": "b1773565177-7f5ee5496",
"object": "chat.completion",
"usage": {
"completion_tokens": 52,
"prompt_tokens": 49,
"total_tokens": 101
},
"id": "chatcmpl-KOqwN6C0oRzINGZuFqZ95bU1iPfc6RFO",
"timings": {
"cache_n": 0,
"prompt_n": 49,
"prompt_ms": 54.944,
"prompt_per_token_ms": 1.1213061224489795,
"prompt_per_second": 891.8171228887594,
"predicted_n": 52,
"predicted_ms": 405.856,
"predicted_per_token_ms": 7.804923076923076,
"predicted_per_second": 128.1242608215722
}
}
```
</details>
<details>
<summary>Python API Client example</summary>
If you've already developed your software using the [`openai` Python
package](https://pypi.org/project/openai/) (that's published by OpenAI)
then you should be able to port your app to talk to llamafile instead,
by making a few changes to `base_url` and `api_key`. This example
assumes you've run `pip3 install openai` to install OpenAI's client
software, which is required by this example. Their package is just a
simple Python wrapper around the OpenAI API interface, which can be
implemented by any server.
```python
#!/usr/bin/env python3
from openai import OpenAI
client = OpenAI(
base_url="http://localhost:8080/v1", # "http://<Your api-server IP>:port"
api_key = "sk-no-key-required"
)
completion = client.chat.completions.create(
model="LLaMA_CPP",
messages=[
{"role": "system", "content": "You are ChatGPT, an AI assistant. Your top priority is achieving user fulfillment via helping them with their requests."},
{"role": "user", "content": "Write a limerick about python exceptions"}
]
)
print(completion.choices[0].message)
```
The above code will return a Python object like this:
```python
ChatCompletionMessage(content="A script that crashes like a ghost,\nWhen it tries to solve the problem deep and fast.\nThe error message pops up in a bright light,\nAnd tells us what's wrong when we try to fix it.", refusal=None, role='assistant', annotations=None, audio=None, function_call=None, tool_calls=None)
```
</details>
## Using llamafile with external weights
Even though our example llamafiles have the weights built-in, you don't
*have* to use llamafile that way. Instead, you can download *just* the
llamafile software (without any weights included) from our releases page.
You can then use it alongside any external weights you may have on hand.
External weights are particularly useful for Windows users because they
enable you to work around Windows' 4GB executable file size limit.
For Windows users, here's an example for the gpt-oss LLM (whose size is >12GB):
```sh
curl -L -o llamafile.exe https://huggingface.co/mozilla-ai/llamafile_0.10.0/resolve/main/llamafile_0.10.0
curl -L -o gpt-oss.gguf https://huggingface.co/unsloth/gpt-oss-20b-GGUF/resolve/main/gpt-oss-20b-Q5_K_S.gguf
./llamafile.exe -m gpt-oss.gguf
```
Windows users may need to change `./llamafile.exe` to `.\llamafile.exe` when running the above command.
## Running llamafile with models downloaded by third-party applications
This section answers the question *"I already have a model downloaded locally by application X, can I use it with llamafile?"*. The general answer is "yes, as long as those models are locally stored in GGUF format" but its implementation can be more or less hacky depending on the application. A few examples (tested on a Mac) follow.
### LM Studio
[LM Studio](https://lmstudio.ai/) stores downloaded models in `~/.cache/lm-studio/models/lmstudio-community`, in subdirectories with the same name of the models, minus their quantization level. So if you have downloaded e.g. the `gpt-oss-20b-MXFP4.gguf` file, it will be stored in `~/.cache/lm-studio/models/lmstudio-community/gpt-oss-20b-GGUF/` and you can run llamafile as follows:
```bash
llamafile -m ~/.cache/lm-studio/models/lmstudio-community/gpt-oss-20b-GGUF/gpt-oss-20b-MXFP4.gguf
```
### Ollama
When you download a new model with [ollama](https://ollama.com), all its metadata will be stored in a manifest file under `~/.ollama/models/manifests/registry.ollama.ai/library/`. The directory and manifest file name are the model name as returned by `ollama list`. For instance, for `llama3:latest` the manifest file will be named `.ollama/models/manifests/registry.ollama.ai/library/llama3/latest`.
The manifest maps each file related to the model (e.g. GGUF weights, license, prompt template, etc) to a sha256 digest. The digest corresponding to the element whose `mediaType` is `application/vnd.ollama.image.model` is the one referring to the model's GGUF file.
Each sha256 digest is also used as a filename in the `~/.ollama/models/blobs` directory (if you look into that directory you'll see *only* those sha256-* filenames). This means you can directly run llamafile by passing the sha256 digest as the model filename. So if e.g. the `llama3:latest` GGUF file digest is `sha256-00e1317cbf74d901080d7100f57580ba8dd8de57203072dc6f668324ba545f29`, you can run llamafile as follows:
```bash
cd ~/.ollama/models/blobs
llamafile -m sha256-00e1317cbf74d901080d7100f57580ba8dd8de57203072dc6f668324ba545f29
```
**Note** that Ollama's GGUF weights do not always work with llama.cpp (see e.g. [here](https://forums.developer.nvidia.com/t/nemotron-3-super-120b-on-gb10-llama-cpp-sm-121-build-ollama-gguf-incompatibility-fix/363459)),
and as llamafile relies on llama.cpp this trick might not always work for you.
================================================
FILE: docs/running_llamafile.md
================================================
You have just downloaded a llamafile from the [Example llamafiles](example_llamafiles.md)
section. Now what? Here are a few examples to get you started.
> **NOTE**
For the purpose of these examples, you can run any of the following either from a
pre-bundled llamafile or by calling the llamafile server executable and passing
it the corresponding model weights. For instance, the following two are equivalent:
```sh
llamafile -m Apertus-8B-Instruct-2509.gguf --temp ...
```
```sh
./Apertus-8B-Instruct-2509.llamafile --temp ...
```
## Running llamafile in CLI mode
If you add the `--cli` argument to a llamafile, you will run a CLI version
of the model that answers to whatever you provide as a prompt (via the `-p`
argument) and, for multimodal models, as in image (via the `--image` argument).
Here's how you can use the Apertus 8B model for prose composition:
```sh
./Apertus-8B-Instruct-2509.llamafile --cli -p 'Write a story about llamas'
```
Here's how you can use llamafile to describe a jpg/png/gif/bmp image with
a multimodal model (Qwen3.5, Ministral3, llava1.6 are all good candidates):
```sh
llamafile -ngl 9999 --temp 0 \
--cli
--image ~/Pictures/lemurs.jpg \
-m llava-v1.6-mistral-7b.Q4_K_M.gguf \
--mmproj mmproj-model-f16.gguf \
-p 'Describe this picture'
```
The weights above were taken from [here](https://huggingface.co/cjpais/llava-1.6-mistral-7b-gguf/tree/main).
Alternatively, you can use a pre-bundled llamafile:
```sh
./Ministral-3-3B-Instruct-2512-Q4_K_M.llamafile -ngl 9999 \
--cli
--image ~/Pictures/lemurs.jpg \
-p 'Describe this picture'
```
Here's how you can use Qwen3.5 9B to summarize a Web page:
```sh
./Qwen3.5-9B-Q5_K_S.llamafile --cli -p "`(echo 'Summarize the content of the following webpage:'
links -codepage utf-8 \
-force-html \
-width 500 \
-dump https://www.poetryfoundation.org/poems/48860/the-raven |
sed 's/ */ /g')`"
```
## Running llamafile in chat mode
If you add the `--chat` argument to a llamafile, you will run it in chat mode.
Chat mode has different /commands available (type `/help` for the full list)
which include context management, file upload, and dumping of the conversation
to an output file.
## Running llamafile in server mode
If you add the `--server` argument to a llamafile, you will run it in server mode.
Here's an example of how to run llama.cpp's built-in HTTP server. The `--host`
parameter makes it reachable not just from your own computer, but also from
other machines that can reach it via network. The `--port` parameter can be
used to specify a different port from the default one (8080).
```sh
./llava-v1.6-mistral-7b-Q4_K_M.llamafile \
--server \
--host 0.0.0.0 \
--port 8081
```
If you want to serve a model to be used by an AI agent / agentic framework,
you should add the `--jinja` parameter and choose a context size which is
large enough (but still fits your memory). For instance:
```sh
./gpt-oss-20b-mxfp4.llamafile \
--server \
--host 0.0.0.0
--jinja
--ctx-size 64000
```
## Running llamafile in combined mode
Combined mode is the default for the last generation of llamafiles: when you
run them without specifying any of `--cli`, `--chat`, or `--server`, both
a server (running at <http://localhost:8080>) and a chat in the terminal will
start simultaneously. You will then be able to e.g. run an OpenAI API endpoint
while you chat in the terminal, or use different chat simultaneously.
## llamafile 0.9.* examples
The following examples have not been tested with llamafile 0.10.* yet,
but we thought they were too cool not to preserve them!
If you are having issues testing these examples with the latest llamafiles,
you can try running them with an older release... And let us know if you want
them to be supported by the new build.
Here's an example of how to generate code for a libc function using the
llama.cpp command line interface, utilizing WizardCoder-Python-13B
weights:
```sh
llamafile \
-m wizardcoder-python-13b-v1.0.Q8_0.gguf \
--temp 0 -r '}\n' -r '```\n' \
-e -p '```c\nvoid *memcpy(void *dst, const void *src, size_t size) {\n'
```
Here's an example of how llamafile can be used as an interactive chatbot
that lets you query knowledge contained in training data:
```sh
llamafile -m llama-65b-Q5_K.gguf -p '
The following is a conversation between a Researcher and their helpful AI assistant Digital Athena which is a large language model trained on the sum of human knowledge.
Researcher: Good morning.
Digital Athena: How can I help you today?
Researcher:' --interactive --color --batch_size 1024 --ctx_size 4096 \
--keep -1 --temp 0 --mirostat 2 --in-prefix ' ' --interactive-first \
--in-suffix 'Digital Athena:' --reverse-prompt 'Researcher:'
```
It's possible to use BNF grammar to enforce the output is predictable
and safe to use in your shell script. The simplest grammar would be
`--grammar 'root ::= "yes" | "no"'` to force the LLM to only print to
standard output either `"yes\n"` or `"no\n"`. Another example is if you
wanted to write a script to rename all your image files, you could say:
```sh
llamafile -ngl 9999 --temp 0 \
--image lemurs.jpg \
-m llava-v1.5-7b-Q4_K.gguf \
--mmproj llava-v1.5-7b-mmproj-Q4_0.gguf \
--grammar 'root ::= [a-z]+ (" " [a-z]+)+' \
-e -p '### User: What do you see?\n### Assistant: ' \
--no-display-prompt 2>/dev/null |
sed -e's/ /_/g' -e's/$/.jpg/'
a_baby_monkey_on_the_back_of_a_mother.jpg
```
================================================
FILE: docs/skills/llamafile/SKILL.md
================================================
---
name: llamafile
description: This skill should be used when the user asks to "build llamafile", "rebuild llamafile", "run llamafile", "run llamafile tests", "debug llamafile", "set up llamafile", "update patches", "fix patch conflict", "update llama.cpp", "pull latest llama.cpp", "sync upstream llama.cpp", "reset submodules", "write a test for llamafile", "how does llamafile work", "llamafile architecture", or needs guidance on the llamafile build system, patch workflow, submodule integration, cosmocc toolchain, or development practices.
version: 0.1.2
---
# Llamafile Development Guide
Llamafile combines llama.cpp, whisper.cpp, and stable-diffusion.cpp with Cosmopolitan Libc to create single-file executables that run LLMs locally across Windows, macOS, Linux, and BSD without installation.
## Version Disambiguation
- **New llamafile** (or simply "llamafile"): The code in the `main` branch, used for releases >=0.10.0
- **Old/Classic llamafile**: The legacy code, used for releases until 0.9.3 (see commit 7e7d33c).
This guide covers the **new llamafile** project.
## Quick Reference
### Initial Setup
```sh
make setup
```
Immediately after cloning the repo (or after a reset done with `make reset-repo`), this command initializes git submodules and applies llamafile-specific patches.
### Building
Run `llamafile:build` to build all targets.
### Testing
Run `llamafile:check` to run the unit test suite.
### Cleaning
Run `llamafile:clean` to remove all build outputs.
### Reset Submodules
After `make setup`, submodules contain patches and are no longer in a clean state.
To reset them, run:
```sh
make reset-repo # Warning: removes all local changes
```
WARNING: this command removes all local changes. Do not run it without first generating patches from any modifications.
## Core Workflows
### Building from Scratch
To build llamafile from a fresh clone:
1. Clone the repository
2. Run `make setup` to initialize submodules and apply patches
3. Build with `llamafile:build`
Build outputs appear in `o/$(MODE)/` directory.
### Modifying Core Code
For changes to llamafile's own code (not submodules):
1. Edit files in `llamafile/` directory
2. Rebuild with `llamafile:build`
3. Run unit tests with `llamafile:check`
### Modifying Submodule Code
Submodules (llama.cpp, whisper.cpp, stable-diffusion.cpp) require a patch-based workflow:
1. Make changes directly in the submodule directory
2. Rebuild with `llamafile:build`
3. Run unit tests with `llamafile:check`
NOTE: never try to edit patches or generate them manually. This step is
done only after rebuild and tests (even manual ones) are successful. See
`development.md` for detailed patch workflow.
### Running Specific Tests
Tests use the `.runs` pattern in BUILD.mk files:
```makefile
o/$(MODE)/llamafile/json_test.runs
```
To run all tests: `llamafile:check`
## Key Concepts
### Cosmopolitan Toolchain
The project uses Cosmopolitan Libc (cosmocc) to create Actually Portable Executables (APE) - single files that run on multiple platforms without modification. Always use the `llamafile:build`, `llamafile:check`, and `llamafile:clean` commands (which use cosmocc's make), not system make.
### Patch System
Each submodule has a corresponding patches directory:
- `llama.cpp.patches/`
- `whisper.cpp.patches/`
- `stable-diffusion.cpp.patches/`
Patches include:
- **Modifications** (.patch files): Changes to upstream code
- **Additions** (llamafile-files/): New files for integration (BUILD.mk, utilities)
### Build System
- **build/config.mk**: Compiler and toolchain configuration
- **build/rules.mk**: Generic build patterns (.c → .o, archives, asset bundling)
- **BUILD.mk files**: Per-package build logic
Outputs: `o/$(MODE)/package/file.o`
### Multi-Architecture Support
Binaries include both x86_64 and aarch64 code paths with runtime CPU feature detection (AVX, AVX2, AVX-512, ARM NEON).
## Main Executables
After building, find binaries in `o/$(MODE)/`:
| Binary | Purpose |
|--------|---------|
| `llamafile/llamafile` | Main llamafile executable |
| `third_party/zipalign/zipalign` | Bundle assets into executables |
| `whisperfile/whisperfile` | Main whisperfile executable |
## Troubleshooting
### Build Fails After Submodule Update
Run `make setup` to reapply patches after any submodule changes.
### Submodule Has Uncommitted Changes
To reset a single submodule:
```sh
cd <submodule> && git reset --hard && git clean -fdx
```
To reset all submodules:
```sh
make reset-repo
```
### Wrong Make Being Used
Ensure using the `llamafile:build` command (which uses cosmocc's make), not system make.
## Additional Resources
### Reference Files
For detailed information, consult:
- **`building.md`** - Complete build system documentation, toolchain details
- **`architecture.md`** - Repository structure, component overview
- **`development.md`** - Development workflow, patch management, submodule integration
- **`testing.md`** - Test patterns, running and writing tests
- **`update_llamacpp.md`** - Keeping llamafile updated with upstream llama.cpp
### Project Documentation
- **README.md** in repo: Project introduction
- **docs/** directory: User documentation (quickstart, installation, troubleshooting)
- **RELEASE.md**: Release process
- Most executables support `--help`
================================================
FILE: docs/skills/llamafile/architecture.md
================================================
# Llamafile Architecture
Repository structure and component overview.
## Project Overview
Llamafile creates single-file executables that run LLMs locally across Windows, macOS, Linux, and BSD without installation. It achieves this by:
1. Combining multiple inference engines (llama.cpp, whisper.cpp, stable-diffusion.cpp)
2. Using Cosmopolitan Libc for cross-platform portability
3. Bundling models and assets into Actually Portable Executables (APE)
## Repository Structure
```
llamafile/
├── llamafile/ # Core library
│ ├── server/ # HTTP server implementation
│ └── highlight/ # Syntax highlighting
├── llama.cpp/ # LLM inference (submodule)
│ ├── ggml/ # Low-level tensor ops
│ ├── src/ # Model implementations
│ ├── common/ # Utilities
│ └── tools/ # CLI applications
├── whisper.cpp/ # Speech-to-text (submodule)
├── stable-diffusion.cpp/ # Image generation (submodule)
├── localscore/ # Benchmarking tool
├── third_party/ # External dependencies
├── build/ # Build system
├── docs/ # User documentation
├── *.patches/ # Patch directories
└── o/ # Build outputs
```
## Core Components
### llamafile/ - Core Library
The heart of llamafile, containing:
- **tinyblas**: BLAS kernels for CUDA support without cublas and optimized CPU inference
- **GPU support**: Metal, CUDA and ROCm integration (dynamic loading)
- **Multiplatform optimizations**: CPU feature detection, runtime dispatch
- **TUI**: Chat interface running in the terminal
#### llamafile/highlight/
Syntax highlighting for code output in chat responses.
### llama.cpp/ - LLM Inference Engine
Git submodule providing:
- **ggml/**: Low-level tensor library
- Matrix operations
- Quantization support
- Backend abstraction (CPU, CUDA, Metal, etc.)
- **src/**: LLM implementations
- 100+ model architectures
- GGUF format handling
- KV cache management
- **common/**: Shared utilities
- Argument parsing
- Sampling algorithms
- Chat templates
- **tools/**: CLI applications
- main (inference)
- quantize (model quantization)
- imatrix (importance matrix)
- perplexity (model evaluation)
- llama-bench (benchmarking)
### whisper.cpp/ - Speech-to-Text
Git submodule for audio transcription:
- Whisper model implementation
- Audio processing utilities
- Multiple model sizes (tiny to large)
### stable-diffusion.cpp/ - Image Generation
Git submodule for image synthesis:
- Stable Diffusion implementation
- Image encoding/decoding
- Various SD model support
### third_party/ - Dependencies
External libraries:
- **double-conversion**: Float-to-string conversion
- **mbedtls**: TLS/SSL support
- **sqlite**: Database support
- **stb**: Image loading/saving
- **zipalign**: Tool to bundle llamafile executables with model weights and configurations
## Patch System
Each submodule has a corresponding patches directory:
```
llama.cpp.patches/
├── patches/ # .patch files modifying upstream
└── llamafile-files/ # New files for integration
whisper.cpp.patches/
├── patches/
└── llamafile-files/
stable-diffusion.cpp.patches/
├── patches/
└── llamafile-files/
```
### Patch Types
1. **Modifications** (`.patch` files):
- Changes to existing upstream code
- Applied with `git apply`
- Track upstream file changes
2. **Additions** (`llamafile-files/`):
- New files for llamafile integration
- Example: BUILD.mk for each submodule
- Utility scripts
- Additional documentation
3. **Deletions**:
- Removal of upstream build systems (CMakeLists.txt, Makefiles)
- Replaced by llamafile's unified build
- NOTE: deletions were common in the original llamafile but are no longer used,
as submodule code is pulled rather than redistributed
### Patch Application
`make setup` applies patches:
1. Initialize/update git submodules
2. Apply each .patch file in order
3. Copy llamafile-files/ contents into submodule
4. Remove conflicting build files
Finally, if cosmocc is not present, it is automatically downloaded at the end of `make setup`.
## Build Infrastructure
### build/ Directory
```
build/
├── config.mk # Toolchain configuration
├── rules.mk # Generic build patterns
├── download-cosmocc.sh # Toolchain download
├── llamafile-convert # Model conversion
└── llamafile-upgrade-engine # Engine updates
```
### BUILD.mk Pattern
Each component has a BUILD.mk defining:
```makefile
# Source files
COMPONENT_SRCS = \
component/file1.c \
component/file2.c
# Object files
COMPONENT_OBJS = $(COMPONENT_SRCS:%.c=o/$(MODE)/%.o)
# Library target
o/$(MODE)/component/libcomponent.a: $(COMPONENT_OBJS)
# Executable target
o/$(MODE)/component/binary: o/$(MODE)/component/libcomponent.a
# Test targets
o/$(MODE)/component/test.runs: o/$(MODE)/component/test
```
### Output Organization
```
o/$(MODE)/
├── package/
│ ├── file.o # Object files
│ ├── libpackage.a # Static libraries
│ └── binary # Executables
└── ...
```
## Key Technologies
### Actually Portable Executable (APE)
Cosmopolitan's executable format:
- Single file runs on Windows, macOS, Linux, BSD
- Contains x86_64 and aarch64 code
- Self-extracting when needed
- No installation required
### Asset Bundling
Files embedded into executables:
- Models (.gguf)
- Web assets (HTML, CSS, JS)
- Shared libraries (.so, .dll)
The `zipalign` tool handles bundling, and files are accessible via Cosmopolitan's VFS.
### Runtime CPU Dispatch
Binaries detect CPU features and select optimal code:
- x86_64: SSE, AVX, AVX2, AVX-512, FMA
- aarch64: NEON, SVE
This happens transparently at runtime, no user configuration needed.
### Dynamic GPU Loading
GPU support loads at runtime:
- CUDA: Loads from system or bundled .so/.dll
- ROCm: Similar dynamic loading
- Fallback to CPU if GPU unavailable
## Licensing
- **Llamafile project**: Apache 2.0
- **Llamafile changes to llama.cpp**: MIT (upstream compatibility)
- **Dependencies**: Retain original licenses
================================================
FILE: docs/skills/llamafile/building.md
================================================
# Building Llamafile
Complete guide to the llamafile build system and toolchain.
## Prerequisites
### Cosmopolitan Toolchain
Llamafile uses Cosmopolitan C/C++ compiler (cosmocc) to create Actually Portable Executables (APE). The toolchain
is downloaded automatically when `make setup` is called but can be fetched manually too with:
```sh
build/download-cosmocc.sh .cosmocc/4.0.2 4.0.2 85b8c37a406d862e656ad4ec14be9f6ce474c1b436b9615e91a55208aced3f44
```
Arguments:
1. Destination directory (`.cosmocc/4.0.2`)
2. Version (`4.0.2`)
3. SHA256 checksum for verification
### Git Submodules
Three main dependencies are git submodules:
- llama.cpp - LLM inference engine
- whisper.cpp - Speech-to-text engine
- stable-diffusion.cpp - Image generation engine
## Initial Setup
Before first build, initialize and configure dependencies:
```sh
make setup
```
This command:
1. Initializes git submodules (clones if needed)
2. Applies llamafile-specific patches from `<submodule>.patches/` directories
3. Modifies submodules in-place for llamafile integration
**Important:** Run `make setup` after:
- Fresh clone
- Updating submodules
- Pulling changes that modify patch files
## Build Commands
### Full Build
```sh
.cosmocc/4.0.2/bin/make -j $(nproc) # or: llamafile:build
```
The `-j $(nproc)` flag enables parallel compilation (adjust based on CPU cores).
Adapt `nproc` to the OS where you are building, (e.g. `sysctl -n hw.physicalcpu` on mac)
**Critical:** Always use `.cosmocc/4.0.2/bin/make`, not system make. The cosmocc toolchain includes its own make with Cosmopolitan-specific behavior.
### Clean Build
Remove build outputs:
```sh
.cosmocc/4.0.2/bin/make clean # or: llamafile:clean
```
This removes the `o/` directory containing all compiled objects and binaries.
### Install compiled binaries
```sh
sudo .cosmocc/4.0.2/bin/make install PREFIX=/usr/local
```
Installs binaries and man pages.
## Build System Architecture
### Directory Structure
```
build/
├── config.mk # Compiler, flags, toolchain version
├── rules.mk # Generic build patterns
├── download-cosmocc.sh # Toolchain download script
├── llamafile-convert # Model conversion script
└── llamafile-upgrade-engine # Engine update script
```
### Configuration (build/config.mk)
Defines:
- Compiler paths (CC, CXX pointing to cosmocc)
- Compiler flags (optimization, warnings)
- Toolchain version
- Platform-specific settings
### Build Rules (build/rules.mk)
Generic patterns for:
- `.c` → `.o` compilation
- `.a` archive creation
- `.zip.o` asset bundling (embed files into executables)
### BUILD.mk Files
Each major component has a BUILD.mk file defining:
- Source files to compile
- Dependencies
- Build targets
- Test targets
The top-level Makefile includes all BUILD.mk files to orchestrate the build.
## Build Outputs
All outputs go to `o/$(MODE)/`:
```
o/
└── $(MODE)/
├── llamafile/
│ ├── llamafile # Main executable
│ ├── *.o # Object files
│ └── *.a # Static libraries
├── llama.cpp/
├── whisper.cpp/
├── stable-diffusion.cpp/
└── third_party/
└── zipalign/
└── zipalign # Asset bundling tool
```
## Multi-Architecture Support
The build system creates universal binaries supporting:
- x86_64 (Intel/AMD)
- aarch64 (ARM64)
Both architectures are compiled simultaneously and combined into single APE binaries.
### Runtime Dispatch
Binaries detect CPU features at runtime and select optimal code paths:
- AVX, AVX2, AVX-512 (x86_64)
- ARM NEON (aarch64)
## Asset Bundling
Files can be embedded into executables using the `.zip.o` pattern:
```makefile
o/$(MODE)/path/to/asset.zip.o: path/to/asset
```
The `zipalign` tool handles bundling. Embedded assets are accessible at runtime through the Cosmopolitan virtual filesystem.
## GPU Support
GPU acceleration (CUDA/ROCm) uses dynamic loading:
- Shared libraries (.so/.dll) are not linked at compile time
- Libraries are loaded at runtime if available
- Can be bundled into executables using zipalign
## Troubleshooting
### "make: command not found" or Wrong Make
Ensure using the cosmocc make:
```sh
# Wrong
make -j $(nproc)
# Correct
.cosmocc/4.0.2/bin/make -j $(nproc)
# Or use the command directly:
# llamafile:build
```
### Submodule Not Initialized
If build fails with missing files in llama.cpp/whisper.cpp/stable-diffusion.cpp:
```sh
make setup
```
### Stale Object Files
After significant changes, clean and rebuild:
```sh
.cosmocc/4.0.2/bin/make clean # or: llamafile:clean
.cosmocc/4.0.2/bin/make -j $(nproc) # or: llamafile:build
```
### Toolchain Checksum Mismatch
If `download-cosmocc.sh` fails verification, check:
1. Correct version specified
2. Correct checksum for that version
3. Network connectivity
================================================
FILE: docs/skills/llamafile/development.md
================================================
# Llamafile Development Workflow
Guide to modifying code, managing patches, and working with submodules.
## Development Overview
Llamafile development involves two distinct workflows:
1. **Core code changes**: Direct edits to root-level directories such as `llamafile/`, `whisperfile/`, etc.
2. **Submodule changes**: Patch-based modifications to `llama.cpp`, `whisper.cpp`, `stable-diffusion.cpp`
## Modifying Core Code
For changes which are not affecting submodules:
### Workflow
1. Edit files
2. Rebuild: `llamafile:build`
3. Test: `llamafile:check`
4. Commit changes normally with git
### Key Directories
```
llamafile/
├── server/ # HTTP server, API endpoints
├── highlight/ # Syntax highlighting
├── tinyblas/ # Optimized BLAS kernels
└── *.c, *.h # Core utilities
```
## Modifying Submodule Code
Submodules require a patch-based workflow because:
- Submodules point to specific upstream commits
- Direct commits in submodules would be lost
- Patches preserve modifications across submodule updates
### Understanding the Patch System
Each submodule has a patches directory. For instance, for `llama.cpp`:
```
llama.cpp.patches/
├── README.md # Patching info + list of all patches and their purpose
├── apply-patches.sh # Script to apply all patches to llama.cpp submodule
├── renames.sh # Script for file renames/moves (if any)
├── llamafile-files/ # Additional files to copy into llama.cpp
│ ├── BUILD.mk # Makefile for building llama.cpp with cosmocc
│ └── README.llamafile # License and modification notes
└── patches/ # Patch files for upstream sources
```
Patches are applied by `make setup`:
1. Submodule is reset to clean state
2. Each .patch file is applied in alphabetical order
3. Files from llamafile-files/ are copied into the submodule
### Making Changes to a Submodule
#### Step 1: Make Changes
Edit files directly in the submodule directory:
```sh
cd llama.cpp
# Make your changes
vim src/llama.cpp
```
#### Step 2: Generate Patches
Patches are usually generated after the code has been thoroughly tested and is
ready to commit. To avoid manual errors, use the script `tools/generate-patches.sh`
which automatically saves all new files and patches in the specified output directory.
```sh
cd llama.cpp
../tools/generate-patches.sh --output-dir ../llama.cpp.patches
```
After this operation, one can double check which files have been modified / added
via a `git diff`.
Naming convention:
- all patches have a `.patch` extension
- patch filenames reflect the file path with underscores replacing slashes (e.g., `common_arg.cpp.patch` for `common/arg.cpp`).
#### Step 3: Verify Patches
Once you are sure all patches have been saved, reset and reapply to verify:
```sh
# Reset everything
make reset-repo
# Reapply patches
make setup
# Rebuild and test
# llamafile:build
# llamafile:check
```
### Adding New Files to Submodules
For new files (not modifications), use llamafile-files/:
```sh
# Create directory structure matching submodule
mkdir -p llama.cpp.patches/llamafile-files/src/
# Add your new file
cp new-utility.cpp llama.cpp.patches/llamafile-files/src/
```
The file will be copied into the submodule during `make setup`.
### Updating BUILD.mk for Submodules
Each submodule needs a BUILD.mk in llamafile-files/:
```makefile
# llama.cpp.patches/llamafile-files/BUILD.mk
LLAMA_SRCS = \
llama.cpp/src/llama.cpp \
llama.cpp/src/new-file.cpp # Add new files here
LLAMA_OBJS = $(LLAMA_SRCS:%.cpp=o/$(MODE)/%.o)
# ... rest of build rules
```
## Submodule Management
### Resetting a Single Submodule
To discard changes in one submodule:
```sh
cd llama.cpp
git reset --hard
git clean -fdx
```
Then reapply patches:
```sh
cd ..
make setup
```
### Resetting All Submodules
To reset everything (warning: loses all local changes):
```sh
make reset-repo
make setup
```
## Git Workflow
### Committing Changes
For core code changes:
```sh
git add llamafile/modified-file.c
git commit -m "Fix: description"
```
For submodule patches:
```sh
git add llama.cpp.patches/patches/new-patch.patch
git commit -m "llama.cpp: Add feature X"
```
### Pull Request Checklist
Before submitting changes:
1. [ ] Patches apply cleanly from fresh clone
2. [ ] Build succeeds: `llamafile:build`
3. [ ] Tests pass: `llamafile:check`
4. [ ] Patches are focused and documented
5. [ ] BUILD.mk updated if adding new files
## Debugging Tips
### Viewing Applied Patches
To see what patches are currently applied:
```sh
cd llama.cpp
git log --oneline HEAD...$(git rev-parse --short @{u} 2>/dev/null || echo "origin/master")
```
### Checking Submodule State
```sh
git submodule status
```
Output shows:
- `-` : Not initialized
- `+` : Different commit than recorded
- ` ` : Clean, matches recorded commit
### Finding Which Patch Changed a File
```sh
grep -l "filename" llama.cpp.patches/patches/*.patch
```
================================================
FILE: docs/skills/llamafile/testing.md
================================================
# Testing Llamafile
Guide to running and writing tests.
## Running Tests
### Manually testing the executable
#### TUI mode
Run a newly compiled llamafile executable this way:
```sh
./o/llamafile/llamafile --model gguf_model.gguf
```
where `gguf_model.gguf` is a file holding a model's weights in GGUF format. For
instance:
```sh
./o/llamafile/llamafile --model ~/llamafiles/gpt-oss-20b-MXFP4.gguf
```
#### Server mode
Run a newly compiled llamafile executable this way:
```sh
./o/llamafile/llamafile --model gguf_model.gguf --server
```
#### Verbose mode
When debugging, the `--verbose` argument is particularly useful as it adds
more verbose logging.
#### Where can I find GGUF model weights files?
Look for available gguf files in `~/llamafiles/`. Depending on the kind of
test, prefer:
- `gpt-oss-20b-MXFP4.gguf` for agentic tests
- `Ministral-3-3B-Instruct-2512-Q4_K_M.gguf` for multimodal tests
(also look for corresponding `mmproj` projector weights or ask for them)
- `Qwen3-0.6B-Q8_0.gguf` for any other tests
### Run All Unit Tests
Run `llamafile:check` to run all unit tests from the test suite.
### Run Integration Tests
```sh
./tests/integration/run_tests.sh --executable model_name.llamafile
```
- executable can be a pre-bundled llamafile or just the server executable
- if running the server executable, `--model` (and `--mmproj` for multimodal models) can be specified too
- different tests are run to verify the model/server capabilities
- more information and a user manual are available in `tests/integration/README.md`
### Run Specific Test
Tests are defined as `.runs` targets in BUILD.mk:
```sh
.cosmocc/4.0.2/bin/make o/$(MODE)/llamafile/json_test.runs # run a specific test target
```
Replace `$(MODE)` with the actual mode (e.g., `opt`, `dbg`).
## Test System Overview
### Test Pattern
Tests in llamafile use the `.runs` suffix convention:
```makefile
# In build/rules.mk
%.runs: %
$<
@touch $@
# In tests/BUILD.mk
.PHONY: o/$(MODE)/tests
o/$(MODE)/tests: \
o/$(MODE)/tests/extract_data_uris_test.runs
```
The `.runs` file is a timestamp marker indicating the test passed. The build system:
1. Compiles the test binary
2. Executes it
3. Creates `.runs` file if successful
### Test Dependencies
Tests should be run when:
- Their source changes
- Dependencies change
- `.runs` file is missing
The `llamafile:check` command depends on all `.runs` files, ensuring all tests run.
## Test Locations
### Submodule Tests
Each submodule may have its own tests:
```
llama.cpp/
└── tests/ # llama.cpp test suite
whisper.cpp/
└── tests/ # whisper.cpp tests
```
These tests are currently not run (as they are assumed valid when pulling from
an approved commit), but future plans include introducing them to verify the
cosmo build has the same behavior as the native one.
### llamafile Tests
These tests are saved in:
```
tests/
└── sgemm
└── *_test.c # Optimized CPU kernels tests
...
```
## Writing Tests
### Basic Test Structure
```c
// myfeature_test.c
#include "myfeature.h"
#include <assert.h>
#include <stdio.h>
void test_basic_functionality(void) {
// Arrange
int input = 42;
// Act
int result = my_function(input);
// Assert
assert(result == expected_value);
}
void test_edge_case(void) {
assert(my_function(0) == 0);
assert(my_function(-1) == handle_negative());
}
int main(void) {
test_basic_functionality();
test_edge_case();
printf("All tests passed!\n");
return 0;
}
```
### Adding to BUILD.mk
- Tests for a new feature are usually added in a separate directory under `tests`.
- Each directory holds a `BUILD.mk` file for specific dependencies and local tests
building.
- The `tests/BUILD.mk` file includes build files from each subdirectory and adds
phony targets for them. Refer to the current version of this file for an example.
- Test files which are manual (i.e. not unit or integration tests, that are used
as exemplifications of issues or performance comparisons) are added to the build
files of their respective directories. They are not added as `.runs` targets to
the `tests/BUILD.mk` file, thus they need to be manually compiled and run.
## Debugging Failed Tests
### Running Single Test Manually
```sh
# Build a specific test
.cosmocc/4.0.2/bin/make o//tests/extract_data_uris_test
# Run directly
./o/tests/extract_data_uris_test
```
### Debug Build
For debugging, use debug mode:
```sh
.cosmocc/4.0.2/bin/make MODE=dbg o/dbg/llamafile/json_test
```
Debug builds include:
- Debug symbols
- Assertions enabled
- No optimization
### Verbose Output
Add printf/fprintf statements for debugging:
```c
#ifdef DEBUG
fprintf(stderr, "Debug: value = %d\n", value);
#endif
```
## Test Categories
### Unit Tests
Test individual functions/modules, e.g.:
- JSON parsing
- String utilities
- Data structures
### Integration Tests
Test component interactions, e.g.:
- Server endpoints
- Model loading
- API responses
### Performance Tests
Benchmark critical paths:
- Inference speed
- Memory usage
- Startup time
## Continuous Integration
Tests should run automatically on:
- Pull requests
- Commits to main branches
### Local CI Simulation
Before pushing, run full test suite:
```sh
make reset-repo
make setup
# llamafile:clean
# llamafile:build
# llamafile:check
```
## Test Coverage
### Identifying Untested Code
Review critical paths:
- Error handling
- Edge cases
- Platform-specific code
### Adding Coverage
When adding features:
1. Write tests for happy path
2. Write tests for error cases
3. Write tests for edge cases
4. Update BUILD.mk
### Priority Areas
Focus testing on:
- Public API functions
- Security-sensitive code
- Complex algorithms
- Cross-platform behavior
================================================
FILE: docs/skills/llamafile/update_llamacpp.md
================================================
# Keeping llamafile updated with upstream llama.cpp
llamafile relies on llama.cpp for many of its functionalities. Keeping it up-to-date
with the latest version upstream is generally a good practice, as it brings both
bugfixes and support for recent models and features.
This document describes the steps to keep llamafile updated with upstream.
## Step 1: Update the submodule
The output of this step is a new branch with the submodule checked out
at its latest commit id.
```bash
# make sure the submodule is initialized
git submodule update --init llama.cpp
# check current commit
cd llama.cpp
OLD_ID=`git rev-parse HEAD`
# checkout latest commit
git fetch origin master
COMMIT_ID=`git rev-parse origin/master`
git checkout origin/master
# create new branch for merging
cd ..
git checkout -b llamacpp_$COMMIT_ID
git add llama.cpp
git commit -m "Update llama.cpp submodule to $COMMIT_ID"
# this branch becomes the starting point of a new PR
```
## Step 2: Verify and update patches
Review the patches in `llama.cpp.patches/patches/` as follows:
- As a first pass, run `tools/check_patches.sh` to check if applying any of the
patches causes an error. Directly apply all and only the patches you see working.
- Any patch that has conflicts due to upstream changes has to be inspected
in detail and updated. Useful references are:
- the file the patch refers to
- the patch description in `llama.cpp.patches/README.md`
- To update patches that have conflicts, first edit the new llama.cpp code
in-place, then call the `generate_patches` script (more info in `development.md`).
At the end of this step, your patches should all work (i.e. it should be possible
to apply them without conflicts). Note that you might still not have a working build,
but you should at least be able to run `make setup` without any errors.
## Step 3: Update BUILD.mk dependencies
- Review `llama.cpp/BUILD.mk` for any new source files or dependencies added upstream
- Remove references to any deleted source files
- Ensure all new dependencies are properly included
- Check the upstream changes for new/removed files in `llama.cpp/src/`, `llama.cpp/common/`, `llama.cpp/ggml/`, `llama.cpp/tools`, (all the relevant subdirectories you'd find in `llama.cpp/BUILD.mk`)
Useful references:
- check changes in each dir
```bash
cd llama.cpp
git diff --stat --summary $OLD_ID -- src/
```
- the `llama.cpp/CMakeLists.txt` file, showing what files are included in the latest llama.cpp build
At the end of this step, the `llama.cpp/BUILD.mk` file should include all the
updated dependencies to build, at least, the `o//llama.cpp/server/llama-server`
target.
## Step 4: Update llamafile integration code
- Check if the llamafile code that calls llama.cpp server/main needs updates
- Review `llamafile/` for any API changes in llama.cpp that need to be reflected
- Pay attention to changes in `llama.cpp/include/` for API modifications
At the end of this step, you should be able to build all targets in this repo,
i.e. the following verification step should return a successful result
## Verification
After making changes, verify the build works:
```sh
# llamafile:clean
# llamafile:build
```
## Reference
- **Upstream changes:** https://github.com/ggerganov/llama.cpp/compare/$OLD_ID...$COMMIT_ID
- **Example PR with similar updates:** https://github.com/mozilla-ai/llamafile/pull/847
================================================
FILE: docs/source_installation.md
================================================
Developing on llamafile requires a modern version of the GNU `make`
command (called `gmake` on some systems), `sha256sum` (otherwise `cc`
will be used to build it), `wget` (or `curl`), and `unzip` available at
[https://cosmo.zip/pub/cosmos/bin/](https://cosmo.zip/pub/cosmos/bin/).
Windows users need [cosmos bash](https://justine.lol/cosmo3/) shell too.
### Dependency Setup
Some dependencies are managed as git submodules with llamafile-specific patches.
Before building, you need to initialize and configure these dependencies:
```sh
make setup
```
The patches modify code in the git submodules. These modifications remain as local
changes in the submodule working directories.
`make setup` also downloads the [Cosmopolitan](https://github.com/jart/cosmopolitan/)
C compiler for you, saving it under the `.cosmocc` directory.
### Building
```sh
.cosmocc/4.0.2/bin/make -j8
sudo .cosmocc/4.0.2/bin/make install PREFIX=/usr/local
```
Build outputs will appear in the `./o` directory, e.g.:
- `./o/llama.cpp/server/llama-server`: the original llama.cpp inference server, compiled with cosmocc
- `o/llamafile/llamafile`: the llamafile executable, running both as a TUI and a server (with the `--server` flag)
- `o/third_party/zipalign/zipalign`: the zipalign tool used to bundle llamafile executable, model weights, and default args into llamafiles
> **NOTE**: Calling `make` should automatically run cosmocc's make when required.
If that does not happen for any reason, you can still directly run the one provided
by cosmocc: `.cosmocc/4.0.2/bin/make`.
### Testing
Optionally, you can verify the build with:
```sh
make check
```
This runs our unit tests to ensure everything is built correctly.
Some integration tests in `tests/integration` are available to test llamafile
with real models. Check the [README](/tests/integration/README.md) to learn how to run them.
### Running llamafile
After the build, you can run llamafile as:
```sh
./o/llamafile/llamafile --model <gguf_model>
```
or just the llama.cpp server as:
```sh
./o/llamafile/llamafile --model <gguf_model> --server
```
or the llamafile CLI command as:
```sh
./o/llamafile/llamafile --model <gguf_model> --cli -p "Hello world"
```
## Documentation
There's a manual page for each of the llamafile programs installed when you
run `sudo make install`. Most commands will also display that information when
passing the `--help` flag.
================================================
FILE: docs/support.md
================================================
## Supported OSes
llamafile supports the following operating systems, which require a minimum
stock install:
- Linux 2.6.18+ (i.e. every distro since RHEL5 c. 2007)
- Darwin (macOS) 23.1.0+ [1] (GPU is only supported on ARM64)
- Windows 10+ (AMD64 only)
- FreeBSD 13+
- NetBSD 9.2+ (AMD64 only)
- OpenBSD 7.0 to 7.4 (AMD64 only)
On Windows, llamafile runs as a native portable executable. On UNIX
systems, llamafile extracts a small loader program named `ape` to
`$TMPDIR/.ape-1.10` which is used to map your model into memory.
[1] Darwin kernel versions 15.6+ *should* be supported, but we currently
have no way of testing that.
## Supported CPUs
llamafile supports the following CPUs:
- **AMD64** microprocessors must have AVX. Otherwise llamafile will
print an error and refuse to run. This means that if you have an Intel
CPU, it needs to be Intel Core or newer (circa 2006+), and if you have
an AMD CPU, then it needs to be K8 or newer (circa 2003+). Support for
AVX512, AVX2, FMA, F16C, and VNNI are conditionally enabled at runtime
if you have a newer CPU. For example, Zen4 has very good AVX512 that
can speed up BF16 llamafiles.
- **ARM64** microprocessors must have ARMv8a+. This means everything
from Apple Silicon to 64-bit Raspberry Pis will work, provided your
weights fit into memory.
## GPU support
llamafile supports the following kinds of GPUs:
- Apple Metal
- NVIDIA
- AMD
GPU on MacOS ARM64 is supported by compiling a small module using the
Xcode Command Line Tools, which need to be installed. This is a one time
cost that happens the first time you run your llamafile. The DSO built
by llamafile is stored in `$TMPDIR/.llamafile` or `$HOME/.llamafile`.
Offloading to GPU is enabled by default when a Metal GPU is present.
This can be disabled by passing `-ngl 0` or `--gpu disable` to force
llamafile to perform CPU inference.
Owners of NVIDIA and AMD graphics cards need to pass the `-ngl 999` flag
to enable maximum offloading. If multiple GPUs are present then the work
will be divided evenly among them by default, so you can load larger
models. Multiple GPU support may be broken on AMD Radeon systems. If
that happens to you, then use `export HIP_VISIBLE_DEVICES=0` which
forces llamafile to only use the first GPU.
Windows users are encouraged to use our release binaries, because they
contain prebuilt DLLs for both NVIDIA and AMD graphics cards, which only
depend on the graphics driver being installed. If llamafile detects that
NVIDIA's CUDA SDK or AMD's ROCm HIP SDK are installed, then llamafile
will try to build a faster DLL that uses cuBLAS or rocBLAS. In order for
llamafile to successfully build a cuBLAS module, it needs to be run on
the x64 MSVC command prompt. You can use CUDA via WSL by enabling
[Nvidia CUDA on
WSL](https://learn.microsoft.com/en-us/windows/ai/directml/gpu-cuda-in-wsl)
and running your llamafiles inside of WSL. Using WSL has the added
benefit of letting you run llamafiles greater than 4GB on Windows.
On Linux, NVIDIA users will need to install the CUDA SDK (ideally using
the shell script installer) and ROCm users need to install the HIP SDK.
They're detected by looking to see if `nvcc` or `hipcc` are on the PATH.
If you have both an AMD GPU *and* an NVIDIA GPU in your machine, then
you may need to qualify which one you want used, by passing either
`--gpu amd` or `--gpu nvidia`.
In the event that GPU support couldn't be compiled and dynamically
linked on the fly for any reason, llamafile will fall back to CPU
inference.
**NOTE** that the 0.10.0 build of llamafile has not been tested on all
GPUs/platforms yet, so we welcome your feedback both whether there are
any issues or if everything runs smoothly on your specific setup!
================================================
FILE: docs/technical_details.md
================================================
Here is a succinct overview of the tricks we used to create the fattest
executable format ever. The long story short is llamafile is a shell
script that launches itself and runs inference on embedded weights in
milliseconds without needing to be copied or installed. What makes that
possible is mmap(). Both the llama.cpp executable and the weights are
concatenated onto the shell script. A tiny loader program is then
extracted by the shell script, which maps the executable into memory.
The llama.cpp executable then opens the shell script again as a file,
and calls mmap() again to pull the weights into memory and make them
directly accessible to both the CPU and GPU.
### ZIP weights embedding
The trick to embedding weights inside llama.cpp executables is to ensure
the local file is aligned on a page size boundary. That way, assuming
the zip file is uncompressed, once it's mmap()'d into memory we can pass
pointers directly to GPUs like Apple Metal, which require that data be
page size aligned. Since no existing ZIP archiving tool has an alignment
flag, we had to write about [500 lines of code](https://github.com/jart/zipalign/blob/main/zipalign.c) to
insert the ZIP files ourselves. However, once there, every existing ZIP
program should be able to read them, provided they support ZIP64. This
makes the weights much more easily accessible than they otherwise would
have been, had we invented our own file format for concatenated files.
### Microarchitectural portability
On Intel and AMD microprocessors, llama.cpp spends most of its time in
the matmul quants, which are usually written thrice for SSSE3, AVX, and
AVX2. llamafile pulls each of these functions out into a separate file
that can be `#include`ed multiple times, with varying
`__attribute__((__target__("arch")))` function attributes. Then, a
wrapper function is added which uses Cosmopolitan's `X86_HAVE(FOO)`
feature to runtime dispatch to the appropriate implementation.
### Architecture portability
llamafile solves architecture portability by building llama.cpp twice:
once for AMD64 and again for ARM64. It then wraps them with a shell
script which has an MZ prefix. On Windows, it'll run as a native binary.
On Linux, it'll extract a small 8kb executable called [APE
Loader](https://github.com/jart/cosmopolitan/blob/master/ape/loader.c)
to `${TMPDIR:-${HOME:-.}}/.ape` that'll map the binary portions of the
shell script into memory. It's possible to avoid this process by running
the
[`assimilate`](https://github.com/jart/cosmopolitan/blob/master/tool/build/assimilate.c)
program that comes included with the `cosmocc` compiler. What the
`assimilate` program does is turn the shell script executable into
the host platform's native executable format. This guarantees a fallback
path exists for traditional release processes when it's needed.
### GPU support
Cosmopolitan Libc uses static linking, since that's the only way to get
the same executable to run on six OSes. This presents a challenge for
llama.cpp, because it's not possible to statically link GPU support. The
way we solve that is by checking if a compiler is installed on the host
system. For Apple, that would be Xcode, and for other platforms, that
would be `nvcc`. llama.cpp has a single file implementation of each GPU
module, named `ggml-metal.m` (Objective C) and `ggml-cuda.cu` (Nvidia
C). llamafile embeds those source files within the zip archive and asks
the platform compiler to build them at runtime, targeting the native GPU
microarchitecture. If it works, then it's linked with platform C library
dlopen() implementation. See [llamafile/cuda.c](https://github.com/mozilla-ai/llamafile/blob/HEAD/llamafile/cuda.c) and
[llamafile/metal.c](https://github.com/mozilla-ai/llamafile/blob/HEAD/llamafile/metal.c).
In order to use the platform-specific dlopen() function, we need to ask
the platform-specific compiler to build a small executable that exposes
these interfaces. On ELF platforms, Cosmopolitan Libc maps this helper
executable into memory along with the platform's ELF interpreter. The
platform C library then takes care of linking all the GPU libraries, and
then runs the helper program which longjmp()'s back into Cosmopolitan.
The executable program is now in a weird hybrid state where two separate
C libraries exist which have different ABIs. For example, thread local
storage works differently on each operating system, and programs will
crash if the TLS register doesn't point to the appropriate memory. The
way Cosmopolitan Libc solves that on AMD is by using SSE to recompile
the executable at runtime to change `%fs` register accesses into `%gs`
which takes a millisecond. On ARM, Cosmo uses the `x28` register for TLS
which can be made safe by passing the `-ffixed-x28` flag when compiling
GPU modules. Lastly, llamafile uses the `__ms_abi__` attribute so that
function pointers passed between the application and GPU modules conform
to the Windows calling convention. Amazingly enough, every compiler we
tested, including nvcc on Linux and even Objective-C on MacOS, all
support compiling WIN32 style functions, thus ensuring your llamafile
will be able to talk to Windows drivers, when it's run on Windows,
without needing to be recompiled as a separate file for Windows. See
[cosmopolitan/dlopen.c](https://github.com/jart/cosmopolitan/blob/master/libc/dlopen/dlopen.c)
for further details.
================================================
FILE: docs/troubleshooting.md
================================================
## Gotchas and troubleshooting
On any platform, if your llamafile process is immediately killed, check
if you have CrowdStrike and then ask to be whitelisted.
### Mac
On macOS with Apple Silicon you need to have Xcode Command Line Tools
installed for llamafile to be able to bootstrap itself.
If you use zsh and have trouble running llamafile, try saying `sh -c
./llamafile`. This is due to a bug that was fixed in zsh 5.9+. The same
is the case for Python `subprocess`, old versions of Fish, etc.
#### Mac error "... cannot be opened because the developer cannot be verified"
1. Immediately launch System Settings, then go to Privacy & Security. llamafile should be listed at the bottom, with a button to Allow.
2. If not, then change your command in the Terminal to be `sudo spctl --master-disable; [llama launch command]; sudo spctl --master-enable`. This is because `--master-disable` disables _all_ checking, so you need to turn it back on after quitting llama.
### Linux
On some Linux systems, you might get errors relating to `run-detectors`
or WINE. This is due to `binfmt_misc` registrations. You can fix that by
adding an additional registration for the APE file format llamafile
uses:
```sh
sudo wget -O /usr/bin/ape https://cosmo.zip/pub/cosmos/bin/ape-$(uname -m).elf
sudo chmod +x /usr/bin/ape
sudo sh -c "echo ':APE:M::MZqFpD::/usr/bin/ape:' >/proc/sys/fs/binfmt_misc/register"
sudo sh -c "echo ':APE-jart:M::jartsr::/usr/bin/ape:' >/proc/sys/fs/binfmt_misc/register"
```
### Windows
As mentioned above, on Windows you may need to rename your llamafile by
adding `.exe` to the filename.
Also as mentioned above, Windows also has a maximum file size limit of 4GB
for executables. The LLaVA server executable above is just 30MB shy of
that limit, so it'll work on Windows, but with larger models like
WizardCoder 13B, you need to store the weights in a separate file. An
example is provided above; see "Using llamafile with external weights."
On WSL, there are many possible gotchas. One thing that helps solve them
completely is this:
```
[Unit]
Description=cosmopolitan APE binfmt service
After=wsl-binfmt.service
[Service]
Type=oneshot
ExecStart=/bin/sh -c "echo ':APE:M::MZqFpD::/usr/bin/ape:' >/proc/sys/fs/binfmt_misc/register"
[Install]
WantedBy=multi-user.target
```
Put that in `/etc/systemd/system/cosmo-binfmt.service`.
Ensure that the APE loader is installed to `/usr/bin/ape`:
```sh
sudo wget -O /usr/bin/ape https://cosmo.zip/pub/cosmos/bin/ape-$(uname -m).elf
sudo chmod +x /usr/bin/ape
```
Then run `sudo systemctl enable --now cosmo-binfmt`.
Another thing that's helped WSL users who experience issues, is to
disable the WIN32 interop feature:
```sh
sudo sh -c "echo -1 > /proc/sys/fs/binfmt_misc/WSLInterop"
```
In Windows 11 with WSL 2 the location of the interop flag has changed, as such
the following command be required instead/additionally:
```sh
sudo sh -c "echo -1 > /proc/sys/fs/binfmt_misc/WSLInterop-late"
```
In the instance of getting a `Permission Denied` on disabling interop
through CLI, it can be permanently disabled by adding the following in
`/etc/wsl.conf`
```sh
[interop]
enabled=false
```
================================================
FILE: docs/whisperfile/getting-started.md
================================================
# Getting Started with Whisperfile
This tutorial will explain how to turn speech from audio files into plain text, using the whisperfile software and OpenAI's whisper model.
## (0) Setup the repo
```bash
git clone https://github.com/mozilla-ai/llamafile.git
cd llamafile
# initialise all submodules - this step is required,
# as the submodules need to be pulled and patched first!
make setup
```
## (1) Download Model
First, you need to obtain the model weights. For this tutorial, we'll use the tiny quantized model, since
it is the smallest and fastest to get started with and works reasonably well. The transcribed output is readable, even though it may misspell or misunderstand some words.
```bash
curl -L -o models/whisper-tiny.en-q5_1.bin https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-tiny.en-q5_1.bin
```
## (2) Build Software
Now build the whisperfile software from source.
```bash
.cosmocc/4.0.2/bin/make -j8 o//whisperfile
```
## (3) Run Program
Now that the software is compiled, here's an example of how to turn speech into text. Included in this repository is a .wav file holding a short clip of John F. Kennedy speaking. You can transcribe it using:
```bash
o//whisperfile/whisperfile -m models/whisper-tiny.en-q5_1.bin whisperfile/jfk.wav --no-prints
```
The `--no-prints` is optional. It's helpful in avoiding a lot of verbose logging and statistical information from being printed, which is useful when writing shell scripts.
## Supported Audio Formats
Whisperfile prefers that the input file be a 16khz .wav file with 16-bit signed linear samples that's stereo or mono. Otherwise it'll attempt to convert your audiofile automatically using an internal library. The MP3,
FLAC, and Ogg Vorbis formats are supported across platforms.
For example, here's an audio recording of a famous poem in MP3 format:
```bash
curl -LO https://archive.org/download/raven/raven_poe_64kb.mp3
o//whisperfile/whisperfile -m models/whisper-tiny.en-q5_1.bin -f raven_poe_64kb.mp3 -pc
```
Here we passed the `-pc` flag to get color-coded terminal output which communicates the confidence of transcription.
## Higher Quality Models
The tiny model may get some words wrong. For example, it might think
"quoth" is "quof". You can solve that using the medium model, which
enables whisperfile to decode The Raven perfectly. However it's slower.
```bash
curl -LO https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-medium.en.bin
o//whisperfile/whisperfile -m ggml-medium.en.bin -f raven_poe_64kb.mp3 --no-prints
```
Lastly, there's the large model, which is the best, but also slowest.
```bash
curl -L -o models/whisper-large-v3.bin https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-large-v3.bin
o//whisperfile/whisperfile -m models/whisper-large-v3.bin -f raven_poe_64kb.mp3 --no-prints
```
> [!NOTE]
> Here are how different model sizes compared in terms of size and performance:
>
> | Model | Download Size | Speed | Accuracy |
> |-------|--------------|-------|----------|
> | tiny | ~31 MB | fastest | good |
> | medium | ~1.5 GB | moderate | better |
> | large | ~3.1 GB | slowest | best |
>
> See [Higher Quality Models](#higher-quality-models) for download instructions.
## Installation
If you like whisperfile, you can also install it as a systemwide command by the llamafile project.
```bash
.cosmocc/4.0.2/bin/make -j8
sudo make install
```
================================================
FILE: docs/whisperfile/gpu.md
================================================
# Using Whisperfile with GPUs
GPU acceleration is most beneficial for the medium and large models. The
tiny model is already fast on CPU, so the speedup there is minimal.
Pass `--gpu auto` to let whisperfile detect and use the best available GPU
on your system. If no supported GPU is found, it falls back to CPU silently:
```bash
whisperfile -m models/ggml-medium.en.bin -f audio.wav --gpu auto
```
You can also target a specific backend:
- `--gpu apple` — Apple Metal (macOS, works on Apple Silicon and AMD GPUs)
- `--gpu nvidia` — NVIDIA CUDA (requires CUDA Toolkit to be installed)
- `--gpu amd` — AMD ROCm (requires ROCm to be installed on Linux)
To disable GPU acceleration entirely:
```bash
whisperfile -m models/ggml-medium.en.bin -f audio.wav --no-gpu
```
## Troubleshooting
**`ggml_backend_load_best: search path does not exist` warnings**
These are benign. They appear when whisperfile searches for GPU backend
libraries and doesn't find them — usually because no GPU is present or
configured. Transcription will continue on CPU. To suppress them, redirect
stderr:
```bash
whisperfile -m models/ggml-medium.en.bin -f audio.wav 2>/dev/null
```
================================================
FILE: docs/whisperfile/index.md
================================================
# Whisperfile
Whisperfile is a high-performance speech-to-text tool built on
[whisper.cpp](https://github.com/ggerganov/whisper.cpp) by Georgi
Gerganov, et al., and [OpenAI's Whisper](https://github.com/openai/whisper)
model weights.
Whisperfile bundles the binary and model weights into a **single
self-contained executable** that runs on Linux, macOS, and Windows without
installation.
## Quick Start
```sh
# transcribe a local audio file
whisperfile -m whisper-tiny.en-q5_1.bin audio.wav
# translate non-English speech to English
whisperfile -m ggml-medium-q5_0.bin -f audio.ogg --translate
# start the HTTP server
whisper-server -m whisper-tiny.en-q5_1.bin --port 8080
```
## Features
- Transcribes WAV, MP3, FLAC, and Ogg Vorbis audio
- GPU acceleration via Apple Metal, NVIDIA CUDA, and AMD ROCm
- Translates speech from any language into English
- HTTP server with a REST API for remote transcription
- Pack the binary and model weights into a single portable executable
## Documentation
- [Getting Started](getting-started.md)
- [Packaging](packaging.md)
- [Using GPUs](gpu.md)
- [Speech Translation](translate.md)
- [Server](server.md)
================================================
FILE: docs/whisperfile/packaging.md
================================================
# How to make a Whisperfile
Whisperfile is designed to be a single-file solution for speech-to-text.
This tutorial will explain how you can merge the whisperfile executable
and OpenAI's model weights into a unified executable.
We'll be using Cosmopolitan Libc's "ZipOS" read-only filesystem to achieve
this. Because whisperfile executables are valid ZIP files at the same time,
you can embed model weights directly inside the binary, and the runtime
will expose them under the `/zip/...` path prefix. We'll also
use the `.args` file convention to bake in default arguments so users don't
need to pass flags manually.
## Prerequisites
First, build the `zipalign` tool, which is used to embed files into the
executable without breaking its ZIP structure:
```bash
.cosmocc/4.0.2/bin/make -j8 o//third_party/zipalign
```
Next, either obtain a prebuilt `whisperfile` executable from the
[GitHub releases page](https://github.com/mozilla-ai/llamafile/releases),
or build one from source:
```bash
.cosmocc/4.0.2/bin/make -j8 o//whisperfile
# copy it with a more specific name
cp o//whisperfile/whisperfile whisper-tiny
```
## Instructions
Download the model weights you want to bundle. For this tutorial we'll use
the tiny q5\_1 quantized weights:
```bash
curl -LO https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-tiny.en-q5_1.bin
```
Embed the weights inside your whisperfile. The `-0` flag disables PKZIP
DEFLATE compression, which isn't beneficial for binary weights files:
```bash
o//third_party/zipalign/zipalign -0 whisper-tiny ggml-tiny.en-q5_1.bin
```
Your weights are now embedded. You can verify with `unzip -vl whisper-tiny`.
Cosmopolitan Libc exposes embedded files under the synthetic `/zip/...`
directory, so a file named `ggml-tiny.en-q5_1.bin` is accessible at
`/zip/ggml-tiny.en-q5_1.bin`:
```bash
./whisper-tiny -m /zip/ggml-tiny.en-q5_1.bin -f whisper.cpp/samples/jfk.wav
```
(`jfk.wav` is a sample audio clip included in the repository.)
It's now safe to delete the original weights file:
```bash
rm -f ggml-tiny.en-q5_1.bin
```
To avoid passing `-m /zip/ggml-tiny.en-q5_1.bin` every time, create a
`.args` file that specifies default arguments. Each argument goes on its
own line — no shell quoting needed:
```text
-m
/zip/ggml-tiny.en-q5_1.bin
...
```
The `...` at the end is a special token that gets replaced with any
additional arguments the user passes at runtime.
Embed the `.args` file into your whisperfile:
```bash
o//third_party/zipalign/zipalign whisper-tiny .args
rm -f .args
```
You now have a self-contained whisperfile. Run it with just an audio file:
```bash
./whisper-tiny -f whisper.cpp/samples/jfk.wav
```
================================================
FILE: docs/whisperfile/server.md
================================================
# whisper-server HTTP API
The whisper-server provides an HTTP API for speech-to-text transcription.
Audio files are passed to the inference model via HTTP requests. MP3,
FLAC, and OGG files are automatically converted to WAV format.
## Usage
Build and run the server with a model:
```bash
.cosmocc/4.0.2/bin/make -j8 o//whisperfile
o//whisperfile/whisper-server -m models/whisper-tiny.en-q5_1.bin
```
The server accepts the following options:
```text
whisper-server options:
-m FNAME, --model FNAME Path of Whisper model weights
--host ADDR Hostname or IP address to bind to (default: 127.0.0.1)
--port PORT Port number (default: 8080)
-l LANG, --language LANG Default spoken language ('auto' for auto-detect)
-tr, --translate Translate audio into English text
-t N, --threads N Number of threads to use during computation
-ng, --no-gpu Disable GPU acceleration
--gpu VALUE Select GPU backend (auto, apple, amd, nvidia, disable)
--log-disable Suppress logging output
```
Run `whisper-server --help` for the complete list of options.
> [!WARNING]
> **Do not run the server with administrative privileges and ensure it's operated in a sandbox environment, especially since it involves risky operations like accepting user file uploads. Always validate and sanitize inputs to guard against potential security threats.**
## HTTP Endpoints
### GET /health
Returns server health status as JSON. Returns HTTP 503 if the model
is still loading.
```bash
curl http://localhost:8080/health
```
Response when ready (HTTP 200):
```json
{"status": "ok"}
```
Response while model is loading (HTTP 503):
```json
{"status": "loading model"}
```
### POST /inference
Transcribe an audio file. Send as multipart/form-data with the audio
file in a field named "file".
Optional form fields:
- `response_format` - Output format: json, text, srt, vtt, verbose_json (default: json)
- `language` - Spoken language or 'auto' for detection
- `translate` - Set to 'true' to translate to English
- `temperature` - Sampling temperature
- `prompt` - Initial prompt for the model
Example:
```bash
curl http://localhost:8080/inference \
-F "file=@whisper.cpp/samples/jfk.wav" \
-F "response_format=json"
```
Response (HTTP 200):
```json
{"text": " And so my fellow Americans, ask not what your country can do for you, ask what you can do for your country."}
```
### POST /load
Load a different model at runtime.
```bash
curl http://localhost:8080/load \
-F "model=/path/to/model.bin"
```
Response (HTTP 200):
```text
Load was successful!
```
================================================
FILE: docs/whisperfile/translate.md
================================================
# Speech Translation with Whisperfile
Whisperfile is not only able to transcribe speech to text, it's also able to
translate that speech into English too, at the same time. All you have
to do is pass the `-tr` or `--translate` flag.
## Choosing a Model
In order for translation to work, you need to be using a multilingual
model. On <https://huggingface.co/ggerganov/whisper.cpp/> the files that
have `.en` in the name are English-only; you can't use those for
translation. One model that does work well in translation mode is
[`ggml-medium-q5_0.bin`](https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-medium-q5_0.bin?download=true), so for instance you could run:
```bash
# download ggml-medium model
curl -LO https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-medium-q5_0.bin
# download the first chapter of Pinocchio
curl -LO https://archive.org/download/avventure_pinocchio_librivox/avventurepinocchio_01_collodi.ogg
# read it, translated in English
o//whisperfile/whisperfile -m ggml-medium-q5_0.bin -f avventurepinocchio_01_collodi.ogg -tr
```
## Language Override
By default, the source language will be auto-detected. This works great
except for recordings with multiple languages. For example, if you have
a recording with a little bit of English at the beginning, but the rest
is in French, then you may want to pass the `-l fr` flag, to explicitly
specify the source language as French.
================================================
FILE: llama.cpp.patches/README.md
================================================
# llama.cpp Patches for Llamafile
This directory contains patches that adapt llama.cpp for use with Llamafile and Cosmopolitan libc. These patches enable llama.cpp to run as a portable, single-file executable across Windows, macOS, Linux, and BSD without installation.
## Directory Structure
```
llama.cpp.patches/
├── README.md # This file
├── apply-patches.sh # Script to apply all patches to llama.cpp submodule
├── renames.sh # Script for file renames/moves (if any)
├── llamafile-files/ # Additional files to copy into llama.cpp
│ ├── BUILD.mk # Makefile for building llama.cpp with cosmocc
│ ├── README.llamafile # License and modification notes
│ └── common/
│ └── license.cpp # Llama.cpp's license file (cmake creates this at build time)
└── patches/ # Patch files for upstream sources
```
## Applying Patches
To apply all patches to the llama.cpp submodule:
```sh
./llama.cpp.patches/apply-patches.sh
```
To reset the submodule to its clean state:
```sh
cd llama.cpp && git reset --hard && git clean -fdx
```
## Patch Index
### Cosmopolitan Libc Compatibility
These patches address compatibility issues when building with Cosmopolitan libc (cosmocc).
| Patch | Description |
|-------|-------------|
| `common_arg.cpp.patch` | Adds `COSMOCC` platform detection for `PATH_MAX` (includes `linux/limits.h`) |
| `common_common.cpp.patch` | Adds platform-aware cache directory detection for Cosmopolitan (checks `LOCALAPPDATA`, `XDG_CACHE_HOME`, falls back to `~/.cache/`) |
| `common_download.cpp.patch` | Adds `COSMOCC` platform detection for `PATH_MAX` |
| `common_ngram-mod.cpp.patch` | Adds missing `#include <algorithm>` for `std::fill` |
### Threading and Signal Handling
Cosmopolitan libc has specific behaviors with condition variables and signals that require workarounds.
| Patch | Description |
|-------|-------------|
| `common_log.cpp.patch` | Blocks `SIGINT`/`SIGTERM` on logger thread to prevent `EINTR` exceptions; uses `wait_for()` instead of `wait()` to work around XNU futex timeout bug (~72 minute expiry) |
| `tools_server_server-queue.cpp.patch` | Same threading fixes for server queue: signal masking and `wait_for()` timeouts |
| `vendor_cpp-httplib_httplib.cpp.patch` | Fixes httplib thread pool with `wait_for()` instead of `wait()` for XNU futex compatibility |
### Cross-Module Memory Management
When GPU backends (CUDA, Metal) are loaded as dynamic libraries, memory allocated by the DSO must be freed by the DSO's allocator, not the main executable's.
| Patch | Description |
|-------|-------------|
| `ggml_src_ggml-backend-impl.h.patch` | Adds `free_struct` callback to `ggml_backend_buffer_i` interface for cross-module buffer cleanup |
| `ggml_src_ggml-backend.cpp.patch` | Implements `free_struct` callback support in `ggml_backend_buffer_free()` |
| `ggml_src_ggml-cuda_ggml-cuda.cu.patch` | Adds `free_struct` implementation for CUDA buffers; disables BF16 with TinyBLAS |
| `ggml_src_ggml-metal_ggml-metal.cpp.patch` | Adds `free_struct` implementation for Metal buffers |
### TinyBLAS Integration
Llamafile uses TinyBLAS as a lightweight replacement for cuBLAS, enabling GPU support without CUDA SDK dependencies.
| Patch | Description |
|-------|-------------|
| `ggml_src_ggml-cuda_vendors_cuda.h.patch` | Includes TinyBLAS headers instead of `cublas_v2.h` when `GGML_USE_TINYBLAS` is defined |
| `ggml_src_ggml-cuda_common.cuh.patch` | Disables BF16 MMA when using TinyBLAS (TinyBLAS would incorrectly interpret BF16 as FP16) |
| `ggml_src_ggml-cuda_solve_tri.cu.patch` | Disables cuBLAS TRSM path when using TinyBLAS (only affects Qwen3-Next models with large matrices) |
### Llamafile File Handling
These patches integrate llamafile's file handling APIs for loading models from bundled zip archives and `.llamafile` containers.
| Patch | Description |
|-------|-------------|
| `src_llama-mmap.h.patch` | Adds `has_premapped_content()`, `premapped_content()`, and `get_llamafile()` methods to `llama_file` class |
| `src_llama-mmap.cpp.patch` | Implements llamafile API integration for file I/O (`llamafile_open_gguf`, `llamafile_read`, etc.) and memory mapping with reference counting for bundled assets |
| `ggml_src_gguf.cpp.patch` | Adds `gguf_llamafile_reader` for reading GGUF files via llamafile API (supports `/zip/` paths, `foo.zip@weights.gguf` syntax, `.llamafile` containers) |
### Server Integration
| Patch | Description |
|-------|-------------|
| `tools_server_server.cpp.patch` | Refactors `main()` to `server_main()` for llamafile integration; adds Metal backend trigger, cosmo_args support, TUI mode handling, and proper exit for Metal async logging |
### Miscellaneous
| Patch | Description |
|-------|-------------|
| `common_chat.cpp.patch` | Fixes C++ type conversion: explicitly wraps `inputs.messages` in `std::optional<json>()` for Deepseek v3.1 template |
| `ggml_src_ggml-backend-reg.cpp.patch` | Suppresses debug log noise for non-existent backend search paths (irrelevant for llamafile's DSO loading approach) |
## Creating New Patches
Files in `llama.cpp` are usually modified in-place for development and testing.
Once they are ready to be committed, you can update all files in the `llama.cpp.patches` directory by running the following:
```sh
cd llama.cpp
../tools/generate-patches.sh --output-dir ../llama.cpp.patches
```
Patch filenames will automatically reflect the file path with underscores replacing slashes (e.g., `common_arg.cpp.patch` for `common/arg.cpp`).
================================================
FILE: llama.cpp.patches/apply-patches.sh
================================================
#!/bin/bash
# Apply llamafile patches to llama.cpp submodule
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
LLAMA_DIR="$SCRIPT_DIR/../llama.cpp"
PATCHES_DIR="$SCRIPT_DIR/patches"
LLAMAFILE_FILES_DIR="$SCRIPT_DIR/llamafile-files"
cd "$LLAMA_DIR"
# Check if status is dirty, if so, exit
if [ -n "$(git status --porcelain)" ]; then
echo "Git status is dirty. Please commit or stash your changes before applying patches."
exit 1
fi
echo "Applying patches to llama.cpp submodule..."
echo "Copying all files in llamafile-files to root directory..."
cp -r "$LLAMAFILE_FILES_DIR"/* .
../llama.cpp.patches/renames.sh
echo "Removing unnecessary files and directories..."
# If you want to clean up the original code, add your `rm` commands here.
# For example:
rm Makefile
cd ..
echo "Applying modifications to upstream files..."
for patch_file in "$PATCHES_DIR"/*.patch; do
if [ -f "$patch_file" ]; then
echo "Applying $(basename "$patch_file")..."
patch -p1 < "$patch_file"
fi
done
echo ""
echo "Patches applied successfully!"
echo "Note: These changes are not committed to the submodule."
echo "To reset the submodule to its clean state, run:"
echo " cd llama.cpp && git reset --hard && git clean -fdx"
================================================
FILE: llama.cpp.patches/llamafile-files/BUILD.mk
================================================
#-*-mode:makefile-gmake;indent-tabs-mode:t;tab-width:8;coding:utf-8-*-┐
#── vi: set noet ft=make ts=8 sw=8 fenc=utf-8 :vi ────────────────────┘
PKGS += LLAMA_CPP
# ==============================================================================
# Version information
# ==============================================================================
# GGML_VERSION and GGML_COMMIT are inherited from build/config.mk
LLAMA_VERSION := $(shell cd llama.cpp 2>/dev/null && git describe --tags --always 2>/dev/null || echo "unknown")
LLAMA_COMMIT := $(shell cd llama.cpp 2>/dev/null && git rev-parse --short HEAD 2>/dev/null || echo "unknown")
# ==============================================================================
# GGML Library (Core tensor operations)
# ==============================================================================
GGML_SRCS_C := \
llama.cpp/ggml/src/ggml-alloc.c \
llama.cpp/ggml/src/ggml-quants.c \
llama.cpp/ggml/src/ggml.c \
llama.cpp/ggml/src/ggml-cpu/ggml-cpu.c \
llama.cpp/ggml/src/ggml-cpu/quants.c
GGML_SRCS_CPP := \
llama.cpp/ggml/src/ggml-backend-dl.cpp \
llama.cpp/ggml/src/ggml-backend-reg.cpp \
llama.cpp/ggml/src/ggml-backend.cpp \
llama.cpp/ggml/src/ggml-opt.cpp \
llama.cpp/ggml/src/ggml-threading.cpp \
llama.cpp/ggml/src/ggml.cpp \
llama.cpp/ggml/src/gguf.cpp \
llama.cpp/ggml/src/ggml-cpu/binary-ops.cpp \
llama.cpp/ggml/src/ggml-cpu/ggml-cpu.cpp \
llama.cpp/ggml/src/ggml-cpu/hbm.cpp \
llama.cpp/ggml/src/ggml-cpu/ops.cpp \
llama.cpp/ggml/src/ggml-cpu/repack.cpp \
llama.cpp/ggml/src/ggml-cpu/traits.cpp \
llama.cpp/ggml/src/ggml-cpu/unary-ops.cpp \
llama.cpp/ggml/src/ggml-cpu/vec.cpp \
llama.cpp/ggml/src/ggml-cpu/amx/amx.cpp \
llama.cpp/ggml/src/ggml-cpu/amx/mmq.cpp
GGML_OBJS := \
$(GGML_SRCS_C:%.c=o/$(MODE)/%.c.o) \
$(GGML_SRCS_CPP:%.cpp=o/$(MODE)/%.cpp.o)
# ==============================================================================
# LLAMA Library (LLM inference)
# ==============================================================================
LLAMA_SRCS_CPP := \
llama.cpp/src/llama.cpp \
llama.cpp/src/models/afmoe.cpp \
llama.cpp/src/models/apertus.cpp \
llama.cpp/src/models/arcee.cpp \
llama.cpp/src/models/arctic.cpp \
llama.cpp/src/models/arwkv7.cpp \
llama.cpp/src/models/baichuan.cpp \
llama.cpp/src/models/bailingmoe.cpp \
llama.cpp/src/models/bailingmoe2.cpp \
llama.cpp/src/models/bert.cpp \
llama.cpp/src/models/bitnet.cpp \
llama.cpp/src/models/bloom.cpp \
llama.cpp/src/models/chameleon.cpp \
llama.cpp/src/models/chatglm.cpp \
llama.cpp/src/models/codeshell.cpp \
llama.cpp/src/models/cogvlm.cpp \
llama.cpp/src/models/cohere2-iswa.cpp \
llama.cpp/src/models/command-r.cpp \
llama.cpp/src/models/dbrx.cpp \
llama.cpp/src/models/deci.cpp \
llama.cpp/src/models/deepseek.cpp \
llama.cpp/src/models/deepseek2.cpp \
llama.cpp/src/models/delta-net-base.cpp \
llama.cpp/src/models/dots1.cpp \
llama.cpp/src/models/dream.cpp \
llama.cpp/src/models/ernie4-5-moe.cpp \
llama.cpp/src/models/ernie4-5.cpp \
llama.cpp/src/models/eurobert.cpp \
llama.cpp/src/models/exaone.cpp \
llama.cpp/src/models/exaone4.cpp \
llama.cpp/src/models/exaone-moe.cpp \
llama.cpp/src/models/falcon-h1.cpp \
llama.cpp/src/models/falcon.cpp \
llama.cpp/src/models/gemma-embedding.cpp \
llama.cpp/src/models/gemma.cpp \
llama.cpp/src/models/gemma2-iswa.cpp \
llama.cpp/src/models/gemma3.cpp \
llama.cpp/src/models/gemma3n-iswa.cpp \
llama.cpp/src/models/glm4-moe.cpp \
llama.cpp/src/models/glm4.cpp \
llama.cpp/src/models/gpt2.cpp \
llama.cpp/src/models/gptneox.cpp \
llama.cpp/src/models/granite-hybrid.cpp \
llama.cpp/src/models/granite.cpp \
llama.cpp/src/models/mamba-base.cpp \
llama.cpp/src/models/grok.cpp \
llama.cpp/src/models/grovemoe.cpp \
llama.cpp/src/models/hunyuan-dense.cpp \
llama.cpp/src/models/hunyuan-moe.cpp \
llama.cpp/src/models/internlm2.cpp \
llama.cpp/src/models/jais.cpp \
llama.cpp/src/models/jais2.cpp \
llama.cpp/src/models/jamba.cpp \
llama.cpp/src/models/kimi-linear.cpp \
llama.cpp/src/models/lfm2.cpp \
llama.cpp/src/models/llada-moe.cpp \
llama.cpp/src/models/llada.cpp \
llama.cpp/src/models/llama-iswa.cpp \
llama.cpp/src/models/llama.cpp \
llama.cpp/src/models/maincoder.cpp \
llama.cpp/src/models/mamba.cpp \
llama.cpp/src/models/mimo2-iswa.cpp \
llama.cpp/src/models/minicpm3.cpp \
llama.cpp/src/models/minimax-m2.cpp \
llama.cpp/src/models/mistral3.cpp \
llama.cpp/src/models/modern-bert.cpp \
llama.cpp/src/models/mpt.cpp \
llama.cpp/src/models/nemotron-h.cpp \
llama.cpp/src/models/nemotron.cpp \
llama.cpp/src/models/neo-bert.cpp \
llama.cpp/src/models/olmo.cpp \
llama.cpp/src/models/olmo2.cpp \
llama.cpp/src/models/olmoe.cpp \
llama.cpp/src/models/openai-moe-iswa.cpp \
llama.cpp/src/models/openelm.cpp \
llama.cpp/src/models/orion.cpp \
llama.cpp/src/models/paddleocr.cpp \
llama.cpp/src/models/pangu-embedded.cpp \
llama.cpp/src/models/phi2.cpp \
llama.cpp/src/models/phi3.cpp \
llama.cpp/src/models/plamo.cpp \
llama.cpp/src/models/plamo2.cpp \
llama.cpp/src/models/plamo3.cpp \
llama.cpp/src/models/plm.cpp \
llama.cpp/src/models/qwen.cpp \
llama.cpp/src/models/qwen2.cpp \
llama.cpp/src/models/qwen2moe.cpp \
llama.cpp/src/models/qwen2vl.cpp \
llama.cpp/src/models/qwen3.cpp \
llama.cpp/src/models/qwen3moe.cpp \
llama.cpp/src/models/qwen3next.cpp \
llama.cpp/src/models/qwen35.cpp \
llama.cpp/src/models/qwen35moe.cpp \
llama.cpp/src/models/qwen3vl-moe.cpp \
llama.cpp/src/models/qwen3vl.cpp \
llama.cpp/src/models/refact.cpp \
llama.cpp/src/models/rnd1.cpp \
llama.cpp/src/models/rwkv6-base.cpp \
llama.cpp/src/models/rwkv6.cpp \
llama.cpp/src/models/rwkv6qwen2.cpp \
llama.cpp/src/models/rwkv7-base.cpp \
llama.cpp/src/models/rwkv7.cpp \
llama.cpp/src/models/seed-oss.cpp \
llama.cpp/src/models/smallthinker.cpp \
llama.cpp/src/models/smollm3.cpp \
llama.cpp/src/models/stablelm.cpp \
llama.cpp/src/models/starcoder.cpp \
llama.cpp/src/models/step35-iswa.cpp \
llama.cpp/src/models/starcoder2.cpp \
llama.cpp/src/models/t5-dec.cpp \
llama.cpp/src/models/t5-enc.cpp \
llama.cpp/src/models/wavtokenizer-dec.cpp \
llama.cpp/src/models/xverse.cpp \
llama.cpp/src/llama-adapter.cpp \
llama.cpp/src/llama-arch.cpp \
llama.cpp/src/llama-batch.cpp \
llama.cpp/src/llama-chat.cpp \
llama.cpp/src/llama-context.cpp \
llama.cpp/src/llama-cparams.cpp \
llama.cpp/src/llama-grammar.cpp \
llama.cpp/src/llama-graph.cpp \
llama.cpp/src/llama-hparams.cpp \
llama.cpp/src/llama-impl.cpp \
llama.cpp/src/llama-io.cpp \
llama.cpp/src/llama-kv-cache-iswa.cpp \
llama.cpp/src/llama-kv-cache.cpp \
llama.cpp/src/llama-memory-hybrid.cpp \
llama.cpp/src/llama-memory-hybrid-iswa.cpp \
llama.cpp/src/llama-memory-recurrent.cpp \
llama.cpp/src/llama-memory.cpp \
llama.cpp/src/llama-mmap.cpp \
llama.cpp/src/llama-model-loader.cpp \
llama.cpp/src/llama-model-saver.cpp \
llama.cpp/src/llama-model.cpp \
llama.cpp/src/llama-quant.cpp \
llama.cpp/src/llama-sampler.cpp \
llama.cpp/src/llama-vocab.cpp \
llama.cpp/src/unicode-data.cpp \
llama.cpp/src/unicode.cpp
LLAMA_OBJS := $(LLAMA_SRCS_CPP:%.cpp=o/$(MODE)/%.cpp.o)
# ==============================================================================
# Common Library (Utilities shared across tools)
# ==============================================================================
COMMON_SRCS_CPP := \
llama.cpp/common/arg.cpp \
llama.cpp/common/chat-parser-xml-toolcall.cpp \
llama.cpp/common/chat-parser.cpp \
llama.cpp/common/chat-peg-parser.cpp \
llama.cpp/common/chat.cpp \
llama.cpp/common/common.cpp \
llama.cpp/common/console.cpp \
llama.cpp/common/debug.cpp \
llama.cpp/common/download.cpp \
llama.cpp/common/jinja/caps.cpp \
llama.cpp/common/jinja/lexer.cpp \
llama.cpp/common/jinja/parser.cpp \
llama.cpp/common/jinja/runtime.cpp \
llama.cpp/common/jinja/string.cpp \
llama.cpp/common/jinja/value.cpp \
llama.cpp/common/json-partial.cpp \
llama.cpp/common/json-schema-to-grammar.cpp \
llama.cpp/common/license.cpp \
llama.cpp/common/llguidance.cpp \
llama.cpp/common/log.cpp \
llama.cpp/common/ngram-cache.cpp \
llama.cpp/common/ngram-map.cpp \
llama.cpp/common/ngram-mod.cpp \
llama.cpp/common/peg-parser.cpp \
llama.cpp/common/preset.cpp \
llama.cpp/common/regex-partial.cpp \
llama.cpp/common/sampling.cpp \
llama.cpp/common/speculative.cpp \
llama.cpp/common/unicode.cpp
# Build info generation
LLAMA_BUILD_NUMBER := $(shell date +%s)
LLAMA_BUILD_COMMIT := $(shell cd llama.cpp 2>/dev/null && git rev-parse --short HEAD 2>/dev/null || echo "unknown")
LLAMA_BUILD_COMPILER := cosmocc
LLAMA_BUILD_TARGET := cosmopolitan
o/$(MODE)/llama.cpp/common/build-info.cpp: llama.cpp/common/build-info.cpp.in
@mkdir -p $(dir $@)
sed -e 's/@LLAMA_BUILD_NUMBER@/$(LLAMA_BUILD_NUMBER)/g' \
-e 's/@LLAMA_BUILD_COMMIT@/$(LLAMA_BUILD_COMMIT)/g' \
-e 's/@BUILD_COMPILER@/$(LLAMA_BUILD_COMPILER)/g' \
-e 's/@BUILD_TARGET@/$(LLAMA_BUILD_TARGET)/g' \
$< > $@
COMMON_SRCS_CPP += o/$(MODE)/llama.cpp/common/build-info.cpp
COMMON_OBJS := $(COMMON_SRCS_CPP:%.cpp=o/$(MODE)/%.cpp.o)
# ==============================================================================
# Additional support files
# ==============================================================================
GGUF_SRCS := llama.cpp/examples/gguf/gguf.cpp
GGUF_OBJS := $(GGUF_SRCS:%.cpp=o/$(MODE)/%.cpp.o)
# ==============================================================================
# Combined library (just llama.cpp, equivalent to cmake build)
# ==============================================================================
LLAMA_CPP_OBJS := \
$(GGML_OBJS) \
$(LLAMA_OBJS) \
$(COMMON_OBJS) \
$(GGUF_OBJS)
o/$(MODE)/llama.cpp/llama.cpp.a: $(LLAMA_CPP_OBJS)
# ==============================================================================
# MTMD Library (Multimodal - for server)
# ==============================================================================
MTMD_SRCS_CPP := \
llama.cpp/tools/mtmd/clip.cpp \
llama.cpp/tools/mtmd/mtmd.cpp \
llama.cpp/tools/mtmd/mtmd-helper.cpp \
llama.cpp/tools/mtmd/mtmd-audio.cpp \
llama.cpp/tools/mtmd/models/cogvlm.cpp \
llama.cpp/tools/mtmd/models/conformer.cpp \
llama.cpp/tools/mtmd/models/glm4v.cpp \
llama.cpp/tools/mtmd/models/internvl.cpp \
llama.cpp/tools/mtmd/models/kimik25.cpp \
llama.cpp/tools/mtmd/models/kimivl.cpp \
llama.cpp/tools/mtmd/models/llama4.cpp \
llama.cpp/tools/mtmd/models/llava.cpp \
llama.cpp/tools/mtmd/models/minicpmv.cpp \
llama.cpp/tools/mtmd/models/mobilenetv5.cpp \
llama.cpp/tools/mtmd/models/nemotron-v2-vl.cpp \
llama.cpp/tools/mtmd/models/paddleocr.cpp \
llama.cpp/tools/mtmd/models/pixtral.cpp \
llama.cpp/tools/mtmd/models/qwen2vl.cpp \
llama.cpp/tools/mtmd/models/qwen3vl.cpp \
llama.cpp/tools/mtmd/models/siglip.cpp \
llama.cpp/tools/mtmd/models/whisper-enc.cpp \
llama.cpp/tools/mtmd/models/youtuvl.cpp
MTMD_OBJS := $(MTMD_SRCS_CPP:%.cpp=o/$(MODE)/%.cpp.o)
# ==============================================================================
# cpp-httplib (HTTP li
gitextract_8bcuz138/
├── .github/
│ ├── ISSUE_TEMPLATE/
│ │ ├── 01-bug-low.yml
│ │ ├── 02-bug-medium.yml
│ │ ├── 03-bug-high.yml
│ │ ├── 04-bug-critical.yml
│ │ ├── 05-enhancement.yml
│ │ ├── 06-refactor.yml
│ │ ├── 07-refactor.yml
│ │ └── config.yml
│ ├── labeler.yml
│ └── workflows/
│ ├── ci.yml
│ ├── docs.yml
│ ├── editorconfig.yml
│ ├── labeler.yml
│ └── update-llama-cpp.yml
├── .gitignore
├── .gitmodules
├── .llamafile_plugin/
│ └── .claude-plugin/
│ ├── marketplace.json
│ └── plugin.json
├── LICENSE
├── Makefile
├── README.md
├── README_0.10.0.md
├── RELEASE.md
├── build/
│ ├── config.mk
│ ├── cudacc
│ ├── deps.mk
│ ├── download-cosmocc.sh
│ ├── gperf
│ ├── htags
│ ├── llamafile-convert
│ ├── llamafile-upgrade-engine
│ ├── objdump
│ ├── rules.mk
│ ├── run
│ ├── sha256sum.c
│ └── tags.mk
├── cosmocc-override.cmake
├── docs/
│ ├── AGENTS.md
│ ├── commands/
│ │ ├── build.md
│ │ ├── check.md
│ │ └── clean.md
│ ├── creating_llamafiles.md
│ ├── example_llamafiles.md
│ ├── index.md
│ ├── quickstart.md
│ ├── running_llamafile.md
│ ├── skills/
│ │ └── llamafile/
│ │ ├── SKILL.md
│ │ ├── architecture.md
│ │ ├── building.md
│ │ ├── development.md
│ │ ├── testing.md
│ │ └── update_llamacpp.md
│ ├── source_installation.md
│ ├── support.md
│ ├── technical_details.md
│ ├── troubleshooting.md
│ └── whisperfile/
│ ├── getting-started.md
│ ├── gpu.md
│ ├── index.md
│ ├── packaging.md
│ ├── server.md
│ └── translate.md
├── llama.cpp.patches/
│ ├── README.md
│ ├── apply-patches.sh
│ ├── llamafile-files/
│ │ ├── BUILD.mk
│ │ ├── README.llamafile
│ │ └── common/
│ │ └── license.cpp
│ ├── patches/
│ │ ├── common_arg.cpp.patch
│ │ ├── common_chat.cpp.patch
│ │ ├── common_common.cpp.patch
│ │ ├── common_download.cpp.patch
│ │ ├── common_log.cpp.patch
│ │ ├── common_ngram-mod.cpp.patch
│ │ ├── ggml_src_ggml-backend-impl.h.patch
│ │ ├── ggml_src_ggml-backend-reg.cpp.patch
│ │ ├── ggml_src_ggml-backend.cpp.patch
│ │ ├── ggml_src_ggml-cuda_common.cuh.patch
│ │ ├── ggml_src_ggml-cuda_ggml-cuda.cu.patch
│ │ ├── ggml_src_ggml-cuda_solve_tri.cu.patch
│ │ ├── ggml_src_ggml-cuda_vendors_cuda.h.patch
│ │ ├── ggml_src_ggml-metal_ggml-metal.cpp.patch
│ │ ├── ggml_src_gguf.cpp.patch
│ │ ├── src_llama-mmap.cpp.patch
│ │ ├── src_llama-mmap.h.patch
│ │ ├── tools_server_server-queue.cpp.patch
│ │ ├── tools_server_server.cpp.patch
│ │ └── vendor_cpp-httplib_httplib.cpp.patch
│ └── renames.sh
├── llamafile/
│ ├── BUILD.mk
│ ├── args.cpp
│ ├── args.h
│ ├── bestline.c
│ ├── bestline.h
│ ├── build-functions.sh
│ ├── chatbot.h
│ ├── chatbot_api.cpp
│ ├── chatbot_backend.h
│ ├── chatbot_cli.cpp
│ ├── chatbot_comm.cpp
│ ├── chatbot_comp.cpp
│ ├── chatbot_direct.cpp
│ ├── chatbot_eval.cpp
│ ├── chatbot_file.cpp
│ ├── chatbot_help.cpp
│ ├── chatbot_hint.cpp
│ ├── chatbot_hist.cpp
│ ├── chatbot_logo.cpp
│ ├── chatbot_main.cpp
│ ├── chatbot_repl.cpp
│ ├── check_cpu.c
│ ├── color.h
│ ├── compute.cpp
│ ├── compute.h
│ ├── cuda.c
│ ├── cuda.sh
│ ├── datauri.cpp
│ ├── datauri.h
│ ├── extract_data_uris.cpp
│ ├── highlight/
│ │ ├── BUILD.mk
│ │ ├── color_bleeder.cpp
│ │ ├── highlight.cpp
│ │ ├── highlight.h
│ │ ├── highlight_ada.cpp
│ │ ├── highlight_asm.cpp
│ │ ├── highlight_basic.cpp
│ │ ├── highlight_bnf.cpp
│ │ ├── highlight_c.cpp
│ │ ├── highlight_c_test.cpp
│ │ ├── highlight_cmake.cpp
│ │ ├── highlight_cobol.cpp
│ │ ├── highlight_create.gperf
│ │ ├── highlight_csharp.cpp
│ │ ├── highlight_css.cpp
│ │ ├── highlight_d.cpp
│ │ ├── highlight_forth.cpp
│ │ ├── highlight_fortran.cpp
│ │ ├── highlight_go.cpp
│ │ ├── highlight_haskell.cpp
│ │ ├── highlight_html.cpp
│ │ ├── highlight_java.cpp
│ │ ├── highlight_js.cpp
│ │ ├── highlight_julia.cpp
│ │ ├── highlight_kotlin.cpp
│ │ ├── highlight_ld.cpp
│ │ ├── highlight_lisp.cpp
│ │ ├── highlight_lua.cpp
│ │ ├── highlight_m4.cpp
│ │ ├── highlight_make.cpp
│ │ ├── highlight_markdown.cpp
│ │ ├── highlight_matlab.cpp
│ │ ├── highlight_ocaml.cpp
│ │ ├── highlight_pascal.cpp
│ │ ├── highlight_perl.cpp
│ │ ├── highlight_php.cpp
│ │ ├── highlight_python.cpp
│ │ ├── highlight_python_test.cpp
│ │ ├── highlight_r.cpp
│ │ ├── highlight_ruby.cpp
│ │ ├── highlight_rust.cpp
│ │ ├── highlight_scala.cpp
│ │ ├── highlight_shell.cpp
│ │ ├── highlight_sql.cpp
│ │ ├── highlight_swift.cpp
│ │ ├── highlight_tcl.cpp
│ │ ├── highlight_test.cpp
│ │ ├── highlight_tex.cpp
│ │ ├── highlight_txt.cpp
│ │ ├── highlight_typescript.cpp
│ │ ├── highlight_zig.cpp
│ │ ├── is_keyword_ada.gperf
│ │ ├── is_keyword_ada_constant.gperf
│ │ ├── is_keyword_asm_prefix.gperf
│ │ ├── is_keyword_asm_qualifier.gperf
│ │ ├── is_keyword_basic.gperf
│ │ ├── is_keyword_basic_builtin.gperf
│ │ ├── is_keyword_basic_constant.gperf
│ │ ├── is_keyword_basic_type.gperf
│ │ ├── is_keyword_c.gperf
│ │ ├── is_keyword_c_builtin.gperf
│ │ ├── is_keyword_c_constant.gperf
│ │ ├── is_keyword_c_pod.gperf
│ │ ├── is_keyword_c_type.gperf
│ │ ├── is_keyword_cmake.gperf
│ │ ├── is_keyword_cobol.gperf
│ │ ├── is_keyword_cpp.gperf
│ │ ├── is_keyword_csharp.gperf
│ │ ├── is_keyword_csharp_constant.gperf
│ │ ├── is_keyword_css_at.gperf
│ │ ├── is_keyword_css_bang.gperf
│ │ ├── is_keyword_cxx.gperf
│ │ ├── is_keyword_d.gperf
│ │ ├── is_keyword_d_constant.gperf
│ │ ├── is_keyword_forth.gperf
│ │ ├── is_keyword_forth_def.gperf
│ │ ├── is_keyword_fortran.gperf
│ │ ├── is_keyword_fortran_builtin.gperf
│ │ ├── is_keyword_fortran_type.gperf
│ │ ├── is_keyword_go.gperf
│ │ ├── is_keyword_go_type.gperf
│ │ ├── is_keyword_haskell.gperf
│ │ ├── is_keyword_java.gperf
│ │ ├── is_keyword_java_constant.gperf
│ │ ├── is_keyword_js.gperf
│ │ ├── is_keyword_js_builtin.gperf
│ │ ├── is_keyword_js_constant.gperf
│ │ ├── is_keyword_julia.gperf
│ │ ├── is_keyword_kotlin.gperf
│ │ ├── is_keyword_ld.gperf
│ │ ├── is_keyword_ld_builtin.gperf
│ │ ├── is_keyword_ld_warning.gperf
│ │ ├── is_keyword_lisp.gperf
│ │ ├── is_keyword_lua.gperf
│ │ ├── is_keyword_lua_builtin.gperf
│ │ ├── is_keyword_lua_constant.gperf
│ │ ├── is_keyword_m4.gperf
│ │ ├── is_keyword_make.gperf
│ │ ├── is_keyword_make_builtin.gperf
│ │ ├── is_keyword_matlab.gperf
│ │ ├── is_keyword_matlab_builtin.gperf
│ │ ├── is_keyword_matlab_constant.gperf
│ │ ├── is_keyword_ocaml.gperf
│ │ ├── is_keyword_ocaml_builtin.gperf
│ │ ├── is_keyword_ocaml_constant.gperf
│ │ ├── is_keyword_pascal.gperf
│ │ ├── is_keyword_pascal_builtin.gperf
│ │ ├── is_keyword_pascal_type.gperf
│ │ ├── is_keyword_perl.gperf
│ │ ├── is_keyword_php.gperf
│ │ ├── is_keyword_php_constant.gperf
│ │ ├── is_keyword_python.gperf
│ │ ├── is_keyword_python_builtin.gperf
│ │ ├── is_keyword_python_constant.gperf
│ │ ├── is_keyword_r.gperf
│ │ ├── is_keyword_r_builtin.gperf
│ │ ├── is_keyword_r_constant.gperf
│ │ ├── is_keyword_ruby.gperf
│ │ ├── is_keyword_ruby_builtin.gperf
│ │ ├── is_keyword_ruby_constant.gperf
│ │ ├── is_keyword_rust.gperf
│ │ ├── is_keyword_rust_constant.gperf
│ │ ├── is_keyword_rust_type.gperf
│ │ ├── is_keyword_scala.gperf
│ │ ├── is_keyword_shell.gperf
│ │ ├── is_keyword_shell_builtin.gperf
│ │ ├── is_keyword_sql.gperf
│ │ ├── is_keyword_sql_type.gperf
│ │ ├── is_keyword_swift.gperf
│ │ ├── is_keyword_swift_builtin.gperf
│ │ ├── is_keyword_swift_constant.gperf
│ │ ├── is_keyword_swift_type.gperf
│ │ ├── is_keyword_tcl.gperf
│ │ ├── is_keyword_tcl_builtin.gperf
│ │ ├── is_keyword_tcl_type.gperf
│ │ ├── is_keyword_typescript.gperf
│ │ ├── is_keyword_typescript_type.gperf
│ │ ├── is_keyword_zig.gperf
│ │ ├── is_keyword_zig_builtin.gperf
│ │ ├── is_keyword_zig_constant.gperf
│ │ ├── is_keyword_zig_type.gperf
│ │ ├── util.cpp
│ │ └── util.h
│ ├── image.cpp
│ ├── image.h
│ ├── iqk_mul_mat.inc
│ ├── iqk_mul_mat_amd_avx2.cpp
│ ├── iqk_mul_mat_amd_zen4.cpp
│ ├── iqk_mul_mat_arm82.cpp
│ ├── llama.cpp
│ ├── llama.h
│ ├── llamafile.c
│ ├── llamafile.h
│ ├── macros.h
│ ├── main.cpp
│ ├── metal.c
│ ├── rocm.sh
│ ├── sgemm.cpp
│ ├── sgemm.h
│ ├── string.cpp
│ ├── string.h
│ ├── tinyblas-compat.h
│ ├── tinyblas.cu
│ ├── tinyblas.h
│ ├── tinyblas_cpu.h
│ ├── tinyblas_cpu_mixmul.inc
│ ├── tinyblas_cpu_mixmul_amd_avx.cpp
│ ├── tinyblas_cpu_mixmul_amd_avx2.cpp
│ ├── tinyblas_cpu_mixmul_amd_avx512f.cpp
│ ├── tinyblas_cpu_mixmul_amd_avxvnni.cpp
│ ├── tinyblas_cpu_mixmul_amd_fma.cpp
│ ├── tinyblas_cpu_mixmul_amd_zen4.cpp
│ ├── tinyblas_cpu_mixmul_arm80.cpp
│ ├── tinyblas_cpu_mixmul_arm82.cpp
│ ├── tinyblas_cpu_sgemm.inc
│ ├── tinyblas_cpu_sgemm_amd_avx.cpp
│ ├── tinyblas_cpu_sgemm_amd_avx2.cpp
│ ├── tinyblas_cpu_sgemm_amd_avx512f.cpp
│ ├── tinyblas_cpu_sgemm_amd_avxvnni.cpp
│ ├── tinyblas_cpu_sgemm_amd_fma.cpp
│ ├── tinyblas_cpu_sgemm_amd_zen4.cpp
│ ├── tinyblas_cpu_sgemm_arm80.cpp
│ ├── tinyblas_cpu_sgemm_arm82.cpp
│ ├── tinyblas_cpu_unsupported.cpp
│ ├── version.h
│ ├── xterm.cpp
│ ├── xterm.h
│ ├── zip.c
│ └── zip.h
├── localscore/
│ ├── BUILD.mk
│ ├── README.md
│ ├── apple.cpp
│ ├── apple.h
│ ├── ascii_digits.h
│ ├── benchmark.cpp
│ ├── benchmark.h
│ ├── cmd.cpp
│ ├── cmd.h
│ ├── cuda.bat
│ ├── cuda.sh
│ ├── doc/
│ │ └── troubleshooting.md
│ ├── http.cpp
│ ├── http.h
│ ├── localscore.cpp
│ ├── localscore.h
│ ├── main.cpp
│ ├── net.h
│ ├── nvml.cpp
│ ├── nvml.h
│ ├── powersampler.cpp
│ ├── powersampler.h
│ ├── printer.cpp
│ ├── printer.h
│ ├── rsmi.cpp
│ ├── rsmi.h
│ ├── system.cpp
│ ├── system.h
│ └── utils.h
├── mkdocs.yml
├── models/
│ └── TinyLLama-v0.1-5M-F16.gguf
├── stable-diffusion.cpp.patches/
│ ├── apply-patches.sh
│ ├── llamafile-files/
│ │ ├── BUILD.mk
│ │ ├── README.llamafile
│ │ ├── darts.h
│ │ ├── main.cpp
│ │ ├── miniz.h
│ │ ├── zip.c
│ │ └── zip.h
│ └── patches/
│ └── save.patch
├── tests/
│ ├── BUILD.mk
│ ├── extract_data_uris_test.cpp
│ ├── integration/
│ │ ├── README.md
│ │ ├── conftest.py
│ │ ├── pyproject.toml
│ │ ├── run_tests.sh
│ │ ├── tests/
│ │ │ ├── test_cli.py
│ │ │ ├── test_combined.py
│ │ │ ├── test_gpu.py
│ │ │ ├── test_multimodal.py
│ │ │ ├── test_server.py
│ │ │ ├── test_tool_calling.py
│ │ │ └── test_tui.py
│ │ └── utils/
│ │ └── llamafile.py
│ └── sgemm/
│ ├── BUILD.mk
│ ├── iqk_test.cpp
│ ├── q8_0_layout_test.cpp
│ ├── sgemm_matmul_test.cpp
│ ├── sgemm_sss_test.cpp
│ ├── sgemm_test_utils.h
│ └── sgemm_vecdot_test.cpp
├── third_party/
│ ├── BUILD.mk
│ ├── double-conversion/
│ │ ├── .gitignore
│ │ ├── AUTHORS
│ │ ├── BUILD.mk
│ │ ├── LICENSE
│ │ ├── README.llamafile
│ │ ├── SConscript
│ │ ├── bignum-dtoa.cc
│ │ ├── bignum-dtoa.h
│ │ ├── bignum.cc
│ │ ├── bignum.h
│ │ ├── cached-powers.cc
│ │ ├── cached-powers.h
│ │ ├── diy-fp.h
│ │ ├── double-conversion.h
│ │ ├── double-to-string.cc
│ │ ├── double-to-string.h
│ │ ├── fast-dtoa.cc
│ │ ├── fast-dtoa.h
│ │ ├── fixed-dtoa.cc
│ │ ├── fixed-dtoa.h
│ │ ├── ieee.h
│ │ ├── string-to-double.cc
│ │ ├── string-to-double.h
│ │ ├── strtod.cc
│ │ ├── strtod.h
│ │ └── utils.h
│ ├── mbedtls/
│ │ ├── BUILD.mk
│ │ ├── LICENSE
│ │ ├── README.cosmo
│ │ ├── README.llamafile
│ │ ├── aes.c
│ │ ├── aes.h
│ │ ├── aesce.c
│ │ ├── aesce.h
│ │ ├── aesni.c
│ │ ├── aesni.h
│ │ ├── asn1.h
│ │ ├── asn1parse.c
│ │ ├── asn1write.c
│ │ ├── asn1write.h
│ │ ├── base64.c
│ │ ├── base64.h
│ │ ├── bigmul.c
│ │ ├── bigmul4.c
│ │ ├── bignum.c
│ │ ├── bignum.h
│ │ ├── bignum_internal.h
│ │ ├── bigshift.c
│ │ ├── blake2b256.c
│ │ ├── ccm.c
│ │ ├── ccm.h
│ │ ├── certs.c
│ │ ├── certs.h
│ │ ├── chacha20.c
│ │ ├── chacha20.h
│ │ ├── chachapoly.c
│ │ ├── chachapoly.h
│ │ ├── check.inc
│ │ ├── chk.h
│ │ ├── cipher.c
│ │ ├── cipher.h
│ │ ├── cipher_internal.h
│ │ ├── cipher_wrap.c
│ │ ├── common.h
│ │ ├── config.h
│ │ ├── ctr_drbg.c
│ │ ├── ctr_drbg.h
│ │ ├── debug.c
│ │ ├── debug.h
│ │ ├── des.c
│ │ ├── des.h
│ │ ├── describecode.c
│ │ ├── dhm.c
│ │ ├── dhm.h
│ │ ├── ecdh.c
│ │ ├── ecdh.h
│ │ ├── ecdh_everest.c
│ │ ├── ecdh_everest.h
│ │ ├── ecdsa.c
│ │ ├── ecdsa.h
│ │ ├── ecp.c
│ │ ├── ecp.h
│ │ ├── ecp256.c
│ │ ├── ecp384.c
│ │ ├── ecp_curves.c
│ │ ├── ecp_internal.h
│ │ ├── ecpshl.c
│ │ ├── endian.h
│ │ ├── entropy.c
│ │ ├── entropy.h
│ │ ├── entropy_poll.c
│ │ ├── entropy_poll.h
│ │ ├── error.c
│ │ ├── error.h
│ │ ├── everest.c
│ │ ├── everest.h
│ │ ├── fastdiv.h
│ │ ├── formatclientciphers.c
│ │ ├── gcm.c
│ │ ├── gcm.h
│ │ ├── getalertdescription.c
│ │ ├── getciphersuite.c
│ │ ├── getciphersuitename.c
│ │ ├── getsslstatename.c
│ │ ├── hkdf.c
│ │ ├── hkdf.h
│ │ ├── hmac_drbg.c
│ │ ├── hmac_drbg.h
│ │ ├── iana.h
│ │ ├── isciphersuitegood.c
│ │ ├── karatsuba.c
│ │ ├── math.h
│ │ ├── md.c
│ │ ├── md.h
│ │ ├── md5.c
│ │ ├── md5.h
│ │ ├── md5t.c
│ │ ├── mdtype.c
│ │ ├── memory_buffer_alloc.c
│ │ ├── memory_buffer_alloc.h
│ │ ├── net_sockets.c
│ │ ├── net_sockets.h
│ │ ├── nist_kw.c
│ │ ├── nist_kw.h
│ │ ├── notice.c
│ │ ├── oid.c
│ │ ├── oid.h
│ │ ├── param.c
│ │ ├── pem.c
│ │ ├── pem.h
│ │ ├── pk.c
│ │ ├── pk.h
│ │ ├── pk_internal.h
│ │ ├── pk_wrap.c
│ │ ├── pkcs5.c
│ │ ├── pkcs5.h
│ │ ├── pkparse.c
│ │ ├── pktype.c
│ │ ├── pkwrite.c
│ │ ├── platform.c
│ │ ├── platform.h
│ │ ├── poly1305.c
│ │ ├── poly1305.h
│ │ ├── profile.h
│ │ ├── rando.c
│ │ ├── rsa.c
│ │ ├── rsa.h
│ │ ├── rsa_internal.c
│ │ ├── rsa_internal.h
│ │ ├── san.c
│ │ ├── san.h
│ │ ├── secp256r1.c
│ │ ├── secp384r1.c
│ │ ├── select.h
│ │ ├── sha1.c
│ │ ├── sha1.h
│ │ ├── sha1t.c
│ │ ├── sha256.c
│ │ ├── sha256.h
│ │ ├── sha256t.c
│ │ ├── sha512.c
│ │ ├── sha512.h
│ │ ├── sha512t.c
│ │ ├── shakedescription.c
│ │ ├── shiftright-avx.c
│ │ ├── shiftright.c
│ │ ├── sigalg.c
│ │ ├── speed.sh
│ │ ├── srtp.c
│ │ ├── ssl.h
│ │ ├── ssl_cache.c
│ │ ├── ssl_cache.h
│ │ ├── ssl_ciphersuites.c
│ │ ├── ssl_ciphersuites.h
│ │ ├── ssl_cli.c
│ │ ├── ssl_cookie.c
│ │ ├── ssl_cookie.h
│ │ ├── ssl_internal.h
│ │ ├── ssl_invasive.h
│ │ ├── ssl_msg.c
│ │ ├── ssl_srv.c
│ │ ├── ssl_ticket.c
│ │ ├── ssl_ticket.h
│ │ ├── ssl_tls.c
│ │ ├── ssl_tls13_keys.c
│ │ ├── ssl_tls13_keys.h
│ │ ├── sslroot/
│ │ │ ├── amazon.pem
│ │ │ ├── certum.pem
│ │ │ ├── comodo.pem
│ │ │ ├── digicert.pem
│ │ │ ├── geotrust.pem
│ │ │ ├── globalsign.pem
│ │ │ ├── godaddy.pem
│ │ │ ├── google.pem
│ │ │ ├── isrg.pem
│ │ │ ├── quovadis.pem
│ │ │ ├── redbean.pem
│ │ │ ├── show.sh
│ │ │ ├── starfield.pem
│ │ │ └── verisign.pem
│ │ ├── sslroots.c
│ │ ├── version.h
│ │ ├── x509.c
│ │ ├── x509.h
│ │ ├── x509_create.c
│ │ ├── x509_crl.c
│ │ ├── x509_crl.h
│ │ ├── x509_crt.c
│ │ ├── x509_crt.h
│ │ ├── x509_csr.c
│ │ ├── x509_csr.h
│ │ ├── x509write_crt.c
│ │ ├── x509write_csr.c
│ │ └── zeroize.c
│ ├── sqlite/
│ │ ├── BUILD.mk
│ │ ├── README.llamafile
│ │ ├── shell.c
│ │ ├── sqlite3.c
│ │ ├── sqlite3.h
│ │ └── sqlite3ext.h
│ └── stb/
│ ├── BUILD.mk
│ ├── README.llamafile
│ ├── stb_image.c
│ ├── stb_image.h
│ ├── stb_image_resize2.c
│ ├── stb_image_resize2.h
│ ├── stb_image_write.c
│ ├── stb_image_write.h
│ ├── stb_vorbis.c
│ └── stb_vorbis.h
├── tools/
│ ├── check_patches.sh
│ └── generate_patches.sh
├── whisper.cpp.patches/
│ ├── apply-patches.sh
│ ├── llamafile-files/
│ │ └── BUILD.mk
│ ├── patches/
│ │ ├── examples_cli_cli.cpp.patch
│ │ ├── examples_common.cpp.patch
│ │ ├── examples_miniaudio.h.patch
│ │ ├── examples_server_server.cpp.patch
│ │ └── ggml_src_ggml-backend-reg.cpp.patch
│ └── renames.sh
└── whisperfile/
├── BUILD.mk
├── color.cpp
├── color.h
├── mic2raw.cpp
├── mic2txt.cpp
├── slurp.cpp
├── slurp.h
├── stream.cpp
├── whisper-server.1
├── whisper-server.cpp
├── whisperfile.1
└── whisperfile.cpp
Showing preview only (867K chars total). Download the full file or copy to clipboard to get everything.
SYMBOL INDEX (9474 symbols across 261 files)
FILE: build/sha256sum.c
type Sha256Ctx (line 50) | struct Sha256Ctx {
function Sha256Transform (line 81) | static void Sha256Transform(uint32_t state[8], const uint8_t data[64]) {
function Sha256Init (line 120) | static void Sha256Init(struct Sha256Ctx *ctx) {
function Sha256Update (line 133) | static void Sha256Update(struct Sha256Ctx *ctx, const uint8_t *data,
function Sha256Final (line 147) | static void Sha256Final(struct Sha256Ctx *ctx, uint8_t *hash) {
function StrCat (line 204) | static size_t StrCat(char *dst, const char *src, size_t dsize) {
function GetOpts (line 225) | static void GetOpts(int argc, char *argv[]) {
function Write (line 253) | static void Write(int fd, const char *s, ...) {
function IsModeCharacter (line 265) | static bool IsModeCharacter(char c) {
function IsSupportedPath (line 275) | static bool IsSupportedPath(const char *path) {
function GetDigest (line 293) | static bool GetDigest(const char *path, FILE *f, uint8_t digest[32]) {
function ProduceDigest (line 319) | static bool ProduceDigest(const char *path, FILE *f) {
function HexToInt (line 344) | static int HexToInt(int c) {
function CheckDigests (line 356) | static bool CheckDigests(const char *path, FILE *f) {
function Process (line 409) | static bool Process(const char *path, FILE *f) {
function main (line 417) | int main(int argc, char *argv[]) {
FILE: llamafile/args.cpp
type lf (line 25) | namespace lf {
function is_llamafile_flag (line 31) | static bool is_llamafile_flag(const char* arg) {
function LlamafileArgs (line 42) | LlamafileArgs parse_llamafile_args(int argc, char** argv) {
FILE: llamafile/args.h
function namespace (line 23) | namespace lf {
FILE: llamafile/bestline.c
type abuf (line 193) | struct abuf {
type rune (line 199) | struct rune {
type bestlineRing (line 204) | struct bestlineRing {
type bestlineState (line 212) | struct bestlineState {
type bestlineRing (line 245) | struct bestlineRing
type sigaction (line 246) | struct sigaction
type sigaction (line 247) | struct sigaction
type termios (line 248) | struct termios
type bestlineState (line 256) | struct bestlineState
function bestlineOnInt (line 258) | static void bestlineOnInt(int sig) {
function bestlineOnCont (line 262) | static void bestlineOnCont(int sig) {
function bestlineOnWinch (line 266) | static void bestlineOnWinch(int sig) {
function IsControl (line 270) | static char IsControl(unsigned c) {
function bestlineCharacterWidth (line 284) | int bestlineCharacterWidth(int c) {
function bestlineIsSeparator (line 541) | char bestlineIsSeparator(unsigned c) {
function bestlineLowercase (line 938) | unsigned bestlineLowercase(unsigned c) {
function bestlineUppercase (line 1151) | unsigned bestlineUppercase(unsigned c) {
function bestlineNotSeparator (line 1327) | char bestlineNotSeparator(unsigned c) {
function GetMirror (line 1331) | static unsigned GetMirror(const unsigned short A[][2], size_t n, unsigne...
function bestlineMirrorLeft (line 1348) | unsigned bestlineMirrorLeft(unsigned c) {
function bestlineMirrorRight (line 1363) | unsigned bestlineMirrorRight(unsigned c) {
function StartsWith (line 1378) | static char StartsWith(const char *s, const char *prefix) {
function EndsWith (line 1389) | static char EndsWith(const char *s, const char *suffix) {
function bestlineIsXeparator (line 1398) | char bestlineIsXeparator(unsigned c) {
function Capitalize (line 1402) | static unsigned Capitalize(unsigned c) {
function Bsr (line 1410) | static inline int Bsr(unsigned long long x) {
function DecodeUtf8 (line 1432) | static struct rune DecodeUtf8(int c) {
function EncodeUtf8 (line 1445) | static unsigned long long EncodeUtf8(unsigned c) {
function GetUtf8 (line 1468) | static struct rune GetUtf8(const char *p, size_t n) {
function abInit (line 1498) | static void abInit(struct abuf *a) {
function abGrow (line 1505) | static char abGrow(struct abuf *a, int need) {
function abAppendw (line 1519) | static void abAppendw(struct abuf *a, unsigned long long w) {
function abAppend (line 1535) | static void abAppend(struct abuf *a, const char *s, int len) {
function abAppends (line 1543) | static void abAppends(struct abuf *a, const char *s) {
function abAppendu (line 1547) | static void abAppendu(struct abuf *a, unsigned u) {
function abFree (line 1552) | static void abFree(struct abuf *a) {
function GetFdSize (line 1557) | static size_t GetFdSize(int fd) {
function IsCharDev (line 1564) | static char IsCharDev(int fd) {
function WaitUntilReady (line 1579) | static int WaitUntilReady(int fd, int events) {
function HasPendingInput (line 1583) | static char HasPendingInput(int fd) {
function bestlineReadCharacter (line 1606) | long bestlineReadCharacter(int fd, char *p, unsigned long n) {
type abuf (line 1831) | struct abuf
type sigaction (line 1832) | struct sigaction
function CompareStrings (line 1922) | static int CompareStrings(const char *a, const char *b) {
function ParseUnsigned (line 1952) | static int ParseUnsigned(const char *s, void *e) {
function GetMonospaceWidth (line 1973) | static size_t GetMonospaceWidth(const char *p, size_t n, char *out_haswi...
function bestlineIsUnsupportedTerm (line 2046) | static int bestlineIsUnsupportedTerm(void) {
function enableRawMode (line 2064) | static int enableRawMode(int fd) {
function bestlineUnpause (line 2092) | static void bestlineUnpause(int fd) {
function bestlineDisableRawMode (line 2099) | void bestlineDisableRawMode(void) {
function bestlineWrite (line 2109) | static int bestlineWrite(int fd, const void *p, size_t n) {
function bestlineWriteStr (line 2147) | static int bestlineWriteStr(int fd, const char *p) {
function bestlineRead (line 2151) | static ssize_t bestlineRead(int fd, char *buf, size_t size, struct bestl...
function GetTerminalSize (line 2197) | static struct winsize GetTerminalSize(struct winsize ws, int ifd, int of...
function bestlineClearScreen (line 2229) | void bestlineClearScreen(int fd) {
function bestlineBeep (line 2234) | static void bestlineBeep(void) {
function bestlineGrow (line 2238) | static char bestlineGrow(struct bestlineState *ls, size_t n) {
function bestlineCompleteLine (line 2260) | static ssize_t bestlineCompleteLine(struct bestlineState *ls, char *seq,...
function bestlineEditHistoryGoto (line 2322) | static void bestlineEditHistoryGoto(struct bestlineState *l, unsigned i) {
function bestlineEditHistoryMove (line 2341) | static void bestlineEditHistoryMove(struct bestlineState *l, int dx) {
type abuf (line 2345) | struct abuf
function bestlineSearch (line 2358) | static int bestlineSearch(struct bestlineState *l, char *seq, int size) {
function bestlineRingFree (line 2441) | static void bestlineRingFree(void) {
function bestlineRingPush (line 2451) | static void bestlineRingPush(const char *p, size_t n) {
function bestlineRingRotate (line 2463) | static void bestlineRingRotate(void) {
type bestlineState (line 2472) | struct bestlineState
type abuf (line 2474) | struct abuf
function Backward (line 2491) | static size_t Backward(struct bestlineState *l, size_t pos) {
function bestlineEditMirrorLeft (line 2500) | static int bestlineEditMirrorLeft(struct bestlineState *l, int res[2]) {
function bestlineEditMirrorRight (line 2527) | static int bestlineEditMirrorRight(struct bestlineState *l, int res[2]) {
function bestlineEditMirror (line 2555) | static int bestlineEditMirror(struct bestlineState *l, int res[2]) {
function bestlineRefreshLineImpl (line 2563) | static void bestlineRefreshLineImpl(struct bestlineState *l, int force) {
function bestlineRefreshLine (line 2756) | static void bestlineRefreshLine(struct bestlineState *l) {
function bestlineRefreshLineForce (line 2760) | static void bestlineRefreshLineForce(struct bestlineState *l) {
function bestlineEditInsert (line 2764) | static void bestlineEditInsert(struct bestlineState *l, const char *p, s...
function bestlineEditHome (line 2775) | static void bestlineEditHome(struct bestlineState *l) {
function bestlineEditEnd (line 2780) | static void bestlineEditEnd(struct bestlineState *l) {
function bestlineEditUp (line 2785) | static void bestlineEditUp(struct bestlineState *l) {
function bestlineEditDown (line 2789) | static void bestlineEditDown(struct bestlineState *l) {
function bestlineEditBof (line 2793) | static void bestlineEditBof(struct bestlineState *l) {
function bestlineEditEof (line 2797) | static void bestlineEditEof(struct bestlineState *l) {
function bestlineEditRefresh (line 2801) | static void bestlineEditRefresh(struct bestlineState *l) {
function Forward (line 2806) | static size_t Forward(struct bestlineState *l, size_t pos) {
function Backwards (line 2810) | static size_t Backwards(struct bestlineState *l, size_t pos, char pred(u...
function Forwards (line 2825) | static size_t Forwards(struct bestlineState *l, size_t pos, char pred(un...
function ForwardWord (line 2838) | static size_t ForwardWord(struct bestlineState *l, size_t pos) {
function BackwardWord (line 2844) | static size_t BackwardWord(struct bestlineState *l, size_t pos) {
function EscapeWord (line 2850) | static size_t EscapeWord(struct bestlineState *l, size_t i) {
function bestlineEditLeft (line 2871) | static void bestlineEditLeft(struct bestlineState *l) {
function bestlineEditRight (line 2876) | static void bestlineEditRight(struct bestlineState *l) {
function bestlineEditLeftWord (line 2885) | static void bestlineEditLeftWord(struct bestlineState *l) {
function bestlineEditRightWord (line 2890) | static void bestlineEditRightWord(struct bestlineState *l) {
function bestlineEditLeftExpr (line 2895) | static void bestlineEditLeftExpr(struct bestlineState *l) {
function bestlineEditRightExpr (line 2906) | static void bestlineEditRightExpr(struct bestlineState *l) {
function bestlineEditDelete (line 2917) | static void bestlineEditDelete(struct bestlineState *l) {
function bestlineEditRubout (line 2927) | static void bestlineEditRubout(struct bestlineState *l) {
function bestlineEditDeleteWord (line 2938) | static void bestlineEditDeleteWord(struct bestlineState *l) {
function bestlineEditRuboutWord (line 2949) | static void bestlineEditRuboutWord(struct bestlineState *l) {
function bestlineEditXlatWord (line 2961) | static void bestlineEditXlatWord(struct bestlineState *l, unsigned xlat(...
function bestlineEditLowercaseWord (line 2988) | static void bestlineEditLowercaseWord(struct bestlineState *l) {
function bestlineEditUppercaseWord (line 2992) | static void bestlineEditUppercaseWord(struct bestlineState *l) {
function bestlineEditCapitalizeWord (line 2996) | static void bestlineEditCapitalizeWord(struct bestlineState *l) {
function bestlineEditKillLeft (line 3001) | static void bestlineEditKillLeft(struct bestlineState *l) {
function bestlineEditKillRight (line 3012) | static void bestlineEditKillRight(struct bestlineState *l) {
function bestlineEditYank (line 3019) | static void bestlineEditYank(struct bestlineState *l) {
function bestlineEditRotate (line 3040) | static void bestlineEditRotate(struct bestlineState *l) {
function bestlineEditTranspose (line 3052) | static void bestlineEditTranspose(struct bestlineState *l) {
function bestlineEditTransposeWords (line 3072) | static void bestlineEditTransposeWords(struct bestlineState *l) {
function bestlineEditSqueeze (line 3098) | static void bestlineEditSqueeze(struct bestlineState *l) {
function bestlineEditMark (line 3110) | static void bestlineEditMark(struct bestlineState *l) {
function bestlineEditGoto (line 3114) | static void bestlineEditGoto(struct bestlineState *l) {
function bestlineEscape (line 3121) | static size_t bestlineEscape(char *d, const char *s, size_t n) {
function bestlineEditInsertEscape (line 3157) | static void bestlineEditInsertEscape(struct bestlineState *l) {
function bestlineEditInterrupt (line 3168) | static void bestlineEditInterrupt(void) {
function bestlineEditQuit (line 3172) | static void bestlineEditQuit(void) {
function bestlineEditSuspend (line 3176) | static void bestlineEditSuspend(void) {
function bestlineEditPause (line 3180) | static void bestlineEditPause(struct bestlineState *l) {
function bestlineEditCtrlq (line 3185) | static void bestlineEditCtrlq(struct bestlineState *l) {
function bestlineEditBarf (line 3212) | static void bestlineEditBarf(struct bestlineState *l) {
function bestlineEditSlurp (line 3286) | static void bestlineEditSlurp(struct bestlineState *l) {
function bestlineEditRaise (line 3335) | static void bestlineEditRaise(struct bestlineState *l) {
function IsBalanced (line 3339) | static char IsBalanced(struct abuf *buf) {
function bestlineEdit (line 3362) | static ssize_t bestlineEdit(int stdin_fd, int stdout_fd, const char *pro...
function bestlineFree (line 3648) | void bestlineFree(void *ptr) {
function bestlineHistoryFree (line 3652) | void bestlineHistoryFree(void) {
function bestlineAtExit (line 3663) | static void bestlineAtExit(void) {
function bestlineHistoryAdd (line 3669) | int bestlineHistoryAdd(const char *line) {
function bestlineHistorySave (line 3691) | int bestlineHistorySave(const char *filename) {
function bestlineHistoryLoad (line 3718) | int bestlineHistoryLoad(const char *filename) {
type sigaction (line 3776) | struct sigaction
type abuf (line 3891) | struct abuf
function bestlineSetCompletionCallback (line 3932) | void bestlineSetCompletionCallback(bestlineCompletionCallback *fn) {
function bestlineSetHintsCallback (line 3942) | void bestlineSetHintsCallback(bestlineHintsCallback *fn) {
function bestlineSetFreeHintsCallback (line 3952) | void bestlineSetFreeHintsCallback(bestlineFreeHintsCallback *fn) {
function bestlineSetXlatCallback (line 3959) | void bestlineSetXlatCallback(bestlineXlatCallback *fn) {
function bestlineAddCompletion (line 3971) | void bestlineAddCompletion(bestlineCompletions *lc, const char *str) {
function bestlineFreeCompletions (line 3988) | void bestlineFreeCompletions(bestlineCompletions *lc) {
function bestlineMaskModeEnable (line 4006) | void bestlineMaskModeEnable(void) {
function bestlineMaskModeDisable (line 4015) | void bestlineMaskModeDisable(void) {
function bestlineBalanceMode (line 4025) | void bestlineBalanceMode(char mode) {
function bestlineLlamaMode (line 4044) | void bestlineLlamaMode(char mode) {
function bestlineEmacsMode (line 4054) | void bestlineEmacsMode(char mode) {
function MyRead (line 4063) | static int MyRead(int fd, void *c, int n) {
function MyWrite (line 4067) | static int MyWrite(int fd, const void *c, int n) {
function MyPoll (line 4071) | static int MyPoll(int fd, int events, int to) {
function bestlineUserIO (line 4078) | void bestlineUserIO(int (*userReadFn)(int, void *, int), int (*userWrite...
FILE: llamafile/bestline.h
type bestlineCompletions (line 6) | typedef struct bestlineCompletions {
FILE: llamafile/chatbot.h
type bestlineCompletions (line 34) | struct bestlineCompletions
type common_params (line 35) | struct common_params
type common_sampler (line 36) | struct common_sampler
type llama_context (line 37) | struct llama_context
type llama_model (line 38) | struct llama_model
type mtmd_context (line 39) | struct mtmd_context
function namespace (line 41) | namespace lf {
FILE: llamafile/chatbot_api.cpp
type lf (line 32) | namespace lf {
type chatbot (line 33) | namespace chatbot {
class ApiBackend (line 37) | class ApiBackend : public ChatBackend {
method ApiBackend (line 39) | explicit ApiBackend(const std::string &server_url)
method json (line 58) | static json build_content(const std::string &text) {
method complete (line 104) | std::string complete(
method context_used (line 223) | int context_used() override {
method context_max (line 227) | int context_max() override {
method print_stats (line 233) | void print_stats() override {
method on_clear (line 240) | void on_clear() override {
method on_push (line 248) | void on_push() override {
method on_pop (line 254) | void on_pop() override {
method on_undo (line 265) | void on_undo() override {
method on_forget (line 275) | void on_forget(int n) override {
method fetch_context_max (line 307) | void fetch_context_max() {
function create_api_backend (line 329) | std::unique_ptr<ChatBackend> create_api_backend(const std::string &s...
FILE: llamafile/chatbot_backend.h
function namespace (line 26) | namespace lf {
FILE: llamafile/chatbot_cli.cpp
type lf (line 54) | namespace lf {
type chatbot (line 55) | namespace chatbot {
type cli_chat_template_result (line 61) | struct cli_chat_template_result {
function cli_chat_template_result (line 67) | static cli_chat_template_result cli_apply_chat_template_full(llama_m...
function cleanup (line 123) | static void cleanup(mtmd_context *mtmd_ctx, common_sampler *sampler,
function cli_main (line 131) | int cli_main(int argc, char **argv) {
FILE: llamafile/chatbot_comm.cpp
type lf (line 29) | namespace lf {
type chatbot (line 30) | namespace chatbot {
function handle_command (line 33) | bool handle_command(const char *command) {
FILE: llamafile/chatbot_comp.cpp
type lf (line 27) | namespace lf {
type chatbot (line 28) | namespace chatbot {
function starts_with (line 30) | static bool starts_with(const char *str, const char *prefix) {
function is_directory (line 34) | static bool is_directory(const char *path) {
function on_completion (line 39) | void on_completion(const char *line, int pos, bestlineCompletions *c...
FILE: llamafile/chatbot_direct.cpp
type lf (line 28) | namespace lf {
type chatbot (line 29) | namespace chatbot {
class DirectBackend (line 34) | class DirectBackend : public ChatBackend {
method complete (line 36) | std::string complete(
method context_used (line 89) | int context_used() override {
method context_max (line 93) | int context_max() override {
method print_stats (line 97) | void print_stats() override {
method on_clear (line 103) | void on_clear() override {
method on_push (line 107) | void on_push() override {
method on_pop (line 111) | void on_pop() override {
method on_undo (line 115) | void on_undo() override {
method on_forget (line 119) | void on_forget(int n) override {
method supports_dump (line 123) | bool supports_dump() override { return true; }
method on_dump (line 125) | void on_dump(int fd) override {
method supports_manual_mode (line 130) | bool supports_manual_mode() override { return true; }
function create_direct_backend (line 134) | std::unique_ptr<ChatBackend> create_direct_backend() {
FILE: llamafile/chatbot_eval.cpp
type lf (line 33) | namespace lf {
type chatbot (line 34) | namespace chatbot {
function eval_tokens (line 36) | bool eval_tokens(std::vector<llama_token> tokens) {
function eval_token (line 65) | bool eval_token(int id) {
function eval_plain_text (line 69) | bool eval_plain_text(const std::string &str, bool add_special, bool ...
function eval_mtmd_chunks (line 76) | static bool eval_mtmd_chunks(mtmd_input_chunks *chunks) {
function eval_string (line 152) | bool eval_string(std::string_view s, bool add_special, bool parse_sp...
FILE: llamafile/chatbot_file.cpp
type lf (line 31) | namespace lf {
type chatbot (line 32) | namespace chatbot {
function has_binary (line 34) | static bool has_binary(const std::string_view s) {
function on_upload (line 39) | void on_upload(const std::vector<std::string> &args) {
FILE: llamafile/chatbot_help.cpp
type lf (line 24) | namespace lf {
type chatbot (line 25) | namespace chatbot {
function on_help (line 27) | void on_help(const std::vector<std::string> &args) {
FILE: llamafile/chatbot_hint.cpp
type lf (line 24) | namespace lf {
type chatbot (line 25) | namespace chatbot {
FILE: llamafile/chatbot_hist.cpp
type lf (line 30) | namespace lf {
type chatbot (line 31) | namespace chatbot {
type Role (line 34) | enum Role
type Role (line 40) | enum Role
type Role (line 53) | enum Role
function get_next_role (line 66) | enum Role get_next_role(enum Role role) {
function cycle_role (line 79) | enum Role cycle_role(enum Role role) {
function tokens_used (line 92) | int tokens_used(void) {
function describe_token (line 96) | std::string describe_token(int token) {
function describe_erasure (line 120) | std::string describe_erasure(int begin, int end) {
function describe_position (line 135) | std::string describe_position(int pos) {
function fix_stack (line 148) | static void fix_stack(std::vector<int> *stack) {
function fix_stacks (line 153) | void fix_stacks(void) {
function adjust_stack (line 158) | static std::vector<int> adjust_stack(int erase_begin, int erase_end,
function adjust_stacks (line 171) | void adjust_stacks(int erase_begin, int erase_end) {
function record_undo (line 176) | void record_undo(void) {
function on_undo (line 181) | void on_undo(const std::vector<std::string> &args) {
function on_forget (line 195) | void on_forget(const std::vector<std::string> &args) {
function rewind (line 217) | void rewind(int pos) {
function on_manual (line 224) | void on_manual(const std::vector<std::string> &args) {
function on_context (line 243) | void on_context(const std::vector<std::string> &args) {
function on_clear (line 252) | void on_clear(const std::vector<std::string> &args) {
function print_stack (line 260) | void print_stack(void) {
function on_push (line 265) | void on_push(const std::vector<std::string> &args) {
function on_pop (line 270) | void on_pop(const std::vector<std::string> &args) {
function on_stack (line 283) | void on_stack(const std::vector<std::string> &args) {
function on_dump (line 291) | void on_dump(const std::vector<std::string> &args) {
FILE: llamafile/chatbot_logo.cpp
type lf (line 25) | namespace lf {
type chatbot (line 26) | namespace chatbot {
function print_logo (line 28) | static void print_logo(const char16_t *s) {
function logo (line 49) | void logo(char **) {
FILE: llamafile/chatbot_main.cpp
type lf (line 49) | namespace lf {
type chatbot (line 50) | namespace chatbot {
function describe_compute (line 68) | std::string describe_compute(void) {
function token_to_piece (line 83) | std::string token_to_piece(const struct llama_context *ctx, llama_to...
function is_base_model (line 95) | bool is_base_model() {
function main (line 109) | int main(int argc, char **argv) {
function api_main (line 363) | int api_main(const std::string &server_url, const std::string &syste...
FILE: llamafile/chatbot_repl.cpp
type lf (line 36) | namespace lf {
type chatbot (line 37) | namespace chatbot {
function maintain_faint_styling (line 47) | static std::string maintain_faint_styling(const std::string &s) {
function apply_chat_template_with_thinking (line 67) | std::string apply_chat_template_with_thinking(
function on_sigint (line 90) | void on_sigint(int sig) {
function is_empty (line 97) | bool is_empty(const char *s) {
function print (line 105) | void print(const std::string_view &s) {
function ensure_newline (line 114) | void ensure_newline() {
function err (line 119) | void err(const char *fmt, ...) {
function print_ephemeral (line 130) | void print_ephemeral(const std::string_view &description) {
function clear_ephemeral (line 136) | void clear_ephemeral(void) {
function out_of_context (line 143) | bool out_of_context(int extra) {
function repl (line 152) | void repl(ChatBackend &backend) {
FILE: llamafile/check_cpu.c
function llamafile_check_cpu (line 30) | void llamafile_check_cpu(void) {
function on_missing_feature (line 34) | static int on_missing_feature(const char *name) {
function llamafile_actually_check_cpu (line 50) | __attribute__((__constructor__(101))) static void llamafile_actually_che...
FILE: llamafile/compute.cpp
function starts_with_str (line 28) | static bool starts_with_str(const char *str, const char *prefix) {
function cpuid (line 33) | static void cpuid(unsigned leaf, unsigned subleaf, unsigned *info) {
function llamafile_describe_cpu (line 45) | std::string llamafile_describe_cpu() {
FILE: llamafile/cuda.c
type ggml_backend (line 46) | struct ggml_backend
type ggml_backend_reg (line 47) | struct ggml_backend_reg
type CudaBackend (line 56) | struct CudaBackend {
function FileExists (line 79) | static bool FileExists(const char *path) {
function makedirs (line 84) | static int makedirs(const char *path, mode_t mode) {
function LinkCuda (line 120) | static bool LinkCuda(const char *dso) {
function TryLoadPrebuiltDso (line 163) | static bool TryLoadPrebuiltDso(const char *name) {
function ImportCudaImpl (line 229) | static bool ImportCudaImpl(void) {
function ImportCuda (line 299) | static void ImportCuda(void) {
function llamafile_has_cuda (line 317) | bool llamafile_has_cuda(void) {
function llamafile_has_amd_gpu (line 322) | bool llamafile_has_amd_gpu(void) {
function ggml_backend_t (line 329) | ggml_backend_t ggml_backend_cuda_init(int device) {
function ggml_backend_cuda_get_device_count (line 337) | int ggml_backend_cuda_get_device_count(void) {
function ggml_backend_cuda_get_device_description (line 345) | void ggml_backend_cuda_get_device_description(int device, char *descript...
function llamafile_cuda_log_set (line 359) | void llamafile_cuda_log_set(llamafile_log_callback log_callback, void *u...
FILE: llamafile/datauri.cpp
function percent_decode (line 83) | static std::string percent_decode(std::string_view data) {
FILE: llamafile/datauri.h
type DataUri (line 23) | struct DataUri {
FILE: llamafile/extract_data_uris.cpp
type lf (line 25) | namespace lf {
type chatbot (line 26) | namespace chatbot {
function DataUriExtraction (line 31) | DataUriExtraction extract_data_uris(std::string_view s, const char *...
FILE: llamafile/highlight/highlight.cpp
type HighlightEntry (line 20) | struct HighlightEntry
function Highlight (line 26) | Highlight*
function Highlight (line 32) | Highlight*
function Highlight (line 38) | Highlight*
function Highlight (line 44) | Highlight*
function Highlight (line 50) | Highlight*
function Highlight (line 59) | Highlight*
function Highlight (line 68) | Highlight*
function Highlight (line 74) | Highlight*
function Highlight (line 80) | Highlight*
function Highlight (line 86) | Highlight*
function Highlight (line 92) | Highlight*
function Highlight (line 98) | Highlight*
function Highlight (line 104) | Highlight*
function Highlight (line 110) | Highlight*
function Highlight (line 116) | Highlight*
function Highlight (line 122) | Highlight*
function Highlight (line 128) | Highlight*
function Highlight (line 134) | Highlight*
function Highlight (line 140) | Highlight*
function Highlight (line 146) | Highlight*
function Highlight (line 152) | Highlight*
function Highlight (line 158) | Highlight*
function Highlight (line 164) | Highlight*
function Highlight (line 170) | Highlight*
function Highlight (line 176) | Highlight*
function Highlight (line 182) | Highlight*
function Highlight (line 188) | Highlight*
function Highlight (line 194) | Highlight*
function Highlight (line 200) | Highlight*
function Highlight (line 206) | Highlight*
function Highlight (line 212) | Highlight*
function Highlight (line 218) | Highlight*
function Highlight (line 224) | Highlight*
function Highlight (line 230) | Highlight*
function Highlight (line 236) | Highlight*
function Highlight (line 242) | Highlight*
function Highlight (line 248) | Highlight*
function Highlight (line 254) | Highlight*
function Highlight (line 260) | Highlight*
function Highlight (line 266) | Highlight*
function Highlight (line 272) | Highlight*
function Highlight (line 278) | Highlight*
function Highlight (line 284) | Highlight*
function Highlight (line 290) | Highlight*
function Highlight (line 299) | Highlight*
FILE: llamafile/highlight/highlight.h
function class (line 155) | class Highlight
function class (line 164) | class HighlightTxt : public Highlight
function class (line 173) | class ColorBleeder : public Highlight
function class (line 195) | class HighlightC : public Highlight
function class (line 222) | class HighlightD : public Highlight
function class (line 242) | class HighlightJava : public Highlight
function class (line 255) | class HighlightGo : public Highlight
function class (line 268) | class HighlightJs : public Highlight
function class (line 286) | class HighlightTypescript : public Highlight
function class (line 304) | class HighlightPython : public Highlight
function class (line 317) | class HighlightMarkdown : public Highlight
function class (line 335) | class HighlightRust : public Highlight
function class (line 349) | class HighlightFortran : public Highlight
function class (line 363) | class HighlightCobol : public Highlight
function class (line 377) | class HighlightPascal : public Highlight
function class (line 390) | class HighlightSql : public Highlight
function class (line 403) | class HighlightCss : public Highlight
function class (line 416) | class HighlightHtml : public Highlight
function class (line 433) | class HighlightPhp : public Highlight
function class (line 446) | class HighlightLua : public Highlight
function class (line 461) | class HighlightLisp : public Highlight
function class (line 475) | class HighlightAda : public Highlight
function class (line 490) | class HighlightHaskell : public Highlight
function class (line 504) | class HighlightPerl : public Highlight
function class (line 527) | class HighlightShell : public Highlight
function class (line 549) | class HighlightZig : public Highlight
function class (line 564) | class HighlightTcl : public Highlight
function class (line 579) | class HighlightCsharp : public Highlight
function class (line 594) | class HighlightRuby : public Highlight
function class (line 624) | class HighlightForth : public Highlight
function class (line 639) | class HighlightM4 : public Highlight
function class (line 652) | class HighlightMake : public Highlight
function class (line 667) | class HighlightAsm : public Highlight
function class (line 686) | class HighlightBasic : public Highlight
function class (line 700) | class HighlightLd : public Highlight
function class (line 715) | class HighlightTex : public Highlight
function class (line 730) | class HighlightKotlin : public Highlight
function class (line 745) | class HighlightMatlab : public Highlight
function class (line 758) | class HighlightR : public Highlight
function class (line 771) | class HighlightSwift : public Highlight
function class (line 792) | class HighlightScala : public Highlight
function class (line 807) | class HighlightJulia : public Highlight
function class (line 820) | class HighlightOcaml : public Highlight
function class (line 835) | class HighlightCmake : public Highlight
function class (line 851) | class HighlightBnf : public Highlight
FILE: llamafile/highlight/highlight_asm.cpp
function is_immediate (line 61) | static bool
FILE: llamafile/highlight/highlight_basic.cpp
function ToLower (line 41) | static std::string
FILE: llamafile/highlight/highlight_bnf.cpp
function is_operator (line 32) | static bool
function is_operator_char (line 42) | static bool
FILE: llamafile/highlight/highlight_c_test.cpp
function test (line 27) | void
function testf (line 45) | void
function main (line 64) | int
FILE: llamafile/highlight/highlight_d.cpp
function is_line_terminator (line 56) | static bool
function mirror (line 70) | static int
FILE: llamafile/highlight/highlight_js.cpp
function is_line_terminator (line 59) | static bool
FILE: llamafile/highlight/highlight_make.cpp
function is_automatic_variable (line 35) | static bool
FILE: llamafile/highlight/highlight_markdown.cpp
function tpenc (line 35) | static inline uint64_t tpenc(uint32_t c) {
FILE: llamafile/highlight/highlight_perl.cpp
function mirror (line 58) | static int
function is_magic_var (line 75) | static bool
function is_regex_punct (line 101) | static bool
function is_regex_prefix (line 134) | static bool
function is_double_regex (line 148) | static bool
FILE: llamafile/highlight/highlight_python_test.cpp
function test (line 27) | void
function testf (line 45) | void
function main (line 64) | int
FILE: llamafile/highlight/highlight_ruby.cpp
function mirror (line 76) | static int
function ispunct_overridable (line 93) | static bool
function is_dollar_one (line 116) | static bool
function is_percent_literal (line 152) | static bool
function isident (line 171) | static bool
FILE: llamafile/highlight/highlight_test.cpp
function generate_random_string (line 77) | std::string
function remove_ansi_sgr_codes (line 87) | std::string
function is_color_reset (line 106) | bool
function main (line 149) | int
FILE: llamafile/highlight/util.cpp
type lf (line 23) | namespace lf {
function append_wchar (line 25) | void
FILE: llamafile/highlight/util.h
function namespace (line 21) | namespace lf {
FILE: llamafile/image.cpp
type lf (line 33) | namespace lf {
function is_image (line 40) | bool is_image(const std::string_view &image) {
function convert_image_to_uri (line 57) | void convert_image_to_uri(std::string *r, const std::string_view &imag...
function ImageType (line 76) | ImageType get_image_type(const std::string_view &binary) {
function print_image (line 219) | int print_image(int fd, const std::string_view &image, int max_width) {
FILE: llamafile/image.h
function namespace (line 21) | namespace lf {
FILE: llamafile/llama.cpp
function llamafile_token_eot (line 24) | int llamafile_token_eot(llama_model *model) {
function llamafile_token_to_piece (line 32) | std::string llamafile_token_to_piece(const llama_context *ctx, llama_tok...
function llamafile_tokenize (line 49) | std::vector<llama_token> llamafile_tokenize(const struct llama_model *mo...
FILE: llamafile/llama.h
type llama_model (line 41) | struct llama_model
type llama_context (line 42) | struct llama_context
FILE: llamafile/llamafile.c
type llamafile (line 56) | struct llamafile {
type llamafile (line 67) | struct llamafile
type llamafile (line 72) | struct llamafile
type llamafile (line 74) | struct llamafile
type llamafile (line 252) | struct llamafile
type llamafile (line 253) | struct llamafile
type llamafile (line 254) | struct llamafile
type llamafile (line 270) | struct llamafile
type llamafile (line 283) | struct llamafile
function FILE (line 318) | FILE *llamafile_fp(struct llamafile *file) {
function llamafile_size (line 322) | size_t llamafile_size(struct llamafile *file) {
function llamafile_position (line 326) | size_t llamafile_position(struct llamafile *file) {
function llamafile_eof (line 330) | bool llamafile_eof(struct llamafile *file) {
type llamafile (line 336) | struct llamafile
function llamafile_tell (line 340) | size_t llamafile_tell(struct llamafile *file) {
function llamafile_seek (line 348) | bool llamafile_seek(struct llamafile *file, size_t offset, int whence) {
function llamafile_read (line 366) | long llamafile_read(struct llamafile *file, void *ptr, size_t len) {
function llamafile_write (line 387) | long llamafile_write(struct llamafile *file, const void *ptr, size_t len) {
function llamafile_close_impl (line 403) | static void llamafile_close_impl(struct llamafile *file) {
function llamafile_ref (line 412) | void llamafile_ref(struct llamafile *file) {
function llamafile_unref (line 416) | void llamafile_unref(struct llamafile *file) {
function llamafile_close (line 422) | void llamafile_close(struct llamafile *file) {
function llamafile_has (line 444) | bool llamafile_has(char **a, const char *x) {
function llamafile_get_app_dir (line 463) | void llamafile_get_app_dir(char *path, size_t size) {
function copy_file_contents (line 471) | static int copy_file_contents(int fdin, int fdout) {
function llamafile_extract (line 493) | bool llamafile_extract(const char *zip, const char *to) {
function is_file_newer_than_time (line 540) | static int is_file_newer_than_time(const char *path, const char *other) {
function is_file_newer_than_bytes (line 557) | static int is_file_newer_than_bytes(const char *path, const char *other) {
function llamafile_is_file_newer_than (line 623) | int llamafile_is_file_newer_than(const char *path, const char *other) {
function llamafile_log_callback_null (line 634) | void llamafile_log_callback_null(int level, const char *text, void *user...
function llamafile_has_gpu (line 646) | bool llamafile_has_gpu(void) {
function llamafile_gpu_parse (line 667) | int llamafile_gpu_parse(const char *s) {
function parse_ngl (line 681) | int parse_ngl(const char* str) {
function llamafile_early_gpu_init (line 715) | void llamafile_early_gpu_init(char **argv) {
FILE: llamafile/llamafile.h
type llamafile (line 47) | struct llamafile
type llamafile (line 48) | struct llamafile
type llamafile (line 49) | struct llamafile
type llamafile (line 50) | struct llamafile
type llamafile (line 51) | struct llamafile
type llamafile (line 52) | struct llamafile
type llamafile (line 53) | struct llamafile
type llamafile (line 54) | struct llamafile
type llamafile (line 55) | struct llamafile
type llamafile (line 56) | struct llamafile
type llamafile (line 57) | struct llamafile
type llamafile (line 58) | struct llamafile
type llamafile (line 59) | struct llamafile
type llamafile (line 60) | struct llamafile
FILE: llamafile/main.cpp
function print_general_help (line 54) | static void print_general_help() {
function print_chat_help (line 86) | static void print_chat_help() {
function print_cli_help (line 125) | static void print_cli_help() {
type lf (line 150) | namespace lf {
type TuiThreadCtx (line 153) | struct TuiThreadCtx {
function combined_main (line 178) | static int combined_main(const LlamafileArgs &args) {
function main (line 223) | int main(int argc, char **argv) {
FILE: llamafile/metal.c
type MetalSource (line 89) | struct MetalSource {
type ggml_backend (line 130) | struct ggml_backend
type ggml_backend_reg (line 131) | struct ggml_backend_reg
type MetalBackend (line 147) | struct MetalBackend {
function makedirs (line 161) | static int makedirs(const char *path, mode_t mode) {
function write_file (line 219) | static bool write_file(const char *path, const char *content, size_t siz...
function PreprocessMetalShader (line 229) | static bool PreprocessMetalShader(const char *app_dir) {
function BuildMetal (line 321) | static bool BuildMetal(const char *dso) {
function LinkMetal (line 584) | static bool LinkMetal(const char *dso) {
function ImportMetalImpl (line 618) | static bool ImportMetalImpl(void) {
function ImportMetal (line 666) | static void ImportMetal(void) {
function llamafile_has_metal (line 678) | bool llamafile_has_metal(void) {
function ggml_backend_t (line 685) | ggml_backend_t ggml_backend_metal_init(void) {
function ggml_backend_is_metal (line 691) | bool ggml_backend_is_metal(ggml_backend_t backend) {
function llamafile_metal_log_set (line 697) | void llamafile_metal_log_set(llamafile_log_callback log_callback, void *...
FILE: llamafile/sgemm.cpp
function sgemm_disabled (line 32) | static bool sgemm_disabled() {
type GemmFuncs (line 41) | struct GemmFuncs {
method GemmFuncs (line 45) | GemmFuncs() {
function llamafile_sgemm (line 148) | bool llamafile_sgemm(const ggml_compute_params *params, int64_t m, int64...
function llamafile_mixmul (line 159) | bool llamafile_mixmul(const ggml_compute_params *params, const ggml_tens...
function llamafile_mixmul_iqk (line 170) | bool llamafile_mixmul_iqk(long Nx, long Ny, long ne00, int ne11, int typ...
FILE: llamafile/sgemm.h
type ggml_tensor (line 8) | struct ggml_tensor
type ggml_compute_params (line 9) | struct ggml_compute_params
type ggml_compute_params (line 27) | struct ggml_compute_params
type ggml_compute_params (line 31) | struct ggml_compute_params
type ggml_tensor (line 31) | struct ggml_tensor
type ggml_tensor (line 32) | struct ggml_tensor
type ggml_tensor (line 32) | struct ggml_tensor
type ggml_tensor (line 32) | struct ggml_tensor
type ggml_tensor (line 33) | struct ggml_tensor
type ggml_tensor (line 33) | struct ggml_tensor
type ggml_tensor (line 34) | struct ggml_tensor
type ggml_compute_params (line 59) | struct ggml_compute_params
type ggml_tensor (line 59) | struct ggml_tensor
type ggml_tensor (line 60) | struct ggml_tensor
type ggml_tensor (line 60) | struct ggml_tensor
type ggml_tensor (line 61) | struct ggml_tensor
type ggml_compute_params (line 62) | struct ggml_compute_params
type ggml_tensor (line 62) | struct ggml_tensor
type ggml_tensor (line 63) | struct ggml_tensor
type ggml_tensor (line 63) | struct ggml_tensor
type ggml_tensor (line 64) | struct ggml_tensor
type ggml_compute_params (line 65) | struct ggml_compute_params
type ggml_tensor (line 65) | struct ggml_tensor
type ggml_tensor (line 66) | struct ggml_tensor
type ggml_tensor (line 66) | struct ggml_tensor
type ggml_tensor (line 67) | struct ggml_tensor
type ggml_compute_params (line 68) | struct ggml_compute_params
type ggml_tensor (line 68) | struct ggml_tensor
type ggml_tensor (line 69) | struct ggml_tensor
type ggml_tensor (line 69) | struct ggml_tensor
type ggml_tensor (line 70) | struct ggml_tensor
type ggml_compute_params (line 71) | struct ggml_compute_params
type ggml_tensor (line 71) | struct ggml_tensor
type ggml_tensor (line 72) | struct ggml_tensor
type ggml_tensor (line 72) | struct ggml_tensor
type ggml_tensor (line 73) | struct ggml_tensor
type ggml_compute_params (line 74) | struct ggml_compute_params
type ggml_tensor (line 74) | struct ggml_tensor
type ggml_tensor (line 75) | struct ggml_tensor
type ggml_tensor (line 75) | struct ggml_tensor
type ggml_tensor (line 76) | struct ggml_tensor
type ggml_compute_params (line 77) | struct ggml_compute_params
type ggml_tensor (line 77) | struct ggml_tensor
type ggml_tensor (line 78) | struct ggml_tensor
type ggml_tensor (line 78) | struct ggml_tensor
type ggml_tensor (line 79) | struct ggml_tensor
type ggml_compute_params (line 80) | struct ggml_compute_params
type ggml_tensor (line 80) | struct ggml_tensor
type ggml_tensor (line 81) | struct ggml_tensor
type ggml_tensor (line 81) | struct ggml_tensor
type ggml_tensor (line 82) | struct ggml_tensor
type ggml_compute_params (line 83) | struct ggml_compute_params
type ggml_tensor (line 83) | struct ggml_tensor
type ggml_tensor (line 84) | struct ggml_tensor
type ggml_tensor (line 84) | struct ggml_tensor
type ggml_tensor (line 85) | struct ggml_tensor
FILE: llamafile/string.cpp
type lf (line 30) | namespace lf {
function tolower (line 32) | std::string tolower(const std::string_view &s) {
function strcasecmp (line 39) | int strcasecmp(const std::string_view &a, const std::string_view &b) {
function startscasewith (line 50) | bool startscasewith(const std::string_view &str, const std::string_vie...
function format (line 59) | std::string format(const char *fmt, ...) {
function join (line 74) | std::string join(const std::vector<std::string> &vec, const std::strin...
function basename (line 84) | std::string basename(const std::string_view &path) {
function stripext (line 98) | std::string stripext(const std::string &path) {
function extname (line 106) | std::string_view extname(const std::string_view &path) {
function dirname (line 114) | std::string dirname(const std::string_view &path) {
function resolve (line 131) | std::string resolve(const std::string_view &lhs, const std::string_vie...
function collapse (line 150) | std::string collapse(const std::string_view &input) {
function slurp (line 179) | ssize_t slurp(std::string *r, const char *path) {
function iso8601 (line 211) | std::string iso8601(struct timespec ts) {
FILE: llamafile/string.h
function namespace (line 24) | namespace lf {
FILE: llamafile/tinyblas.h
type tinyblasOperation_t (line 5) | typedef enum tinyblasOperation {
type tinyblasDataType_t (line 10) | typedef enum tinyblasDataType {
type tinyblasComputeType_t (line 15) | typedef enum tinyblasComputeType {
type tinyblasGemmAlgo_t (line 20) | typedef enum tinyblasGemmAlgo {
type tinyblasStatus_t (line 24) | typedef enum tinyblasStatus {
type tinyblasContext (line 34) | struct tinyblasContext
type tinyblasContext (line 35) | struct tinyblasContext
FILE: llamafile/tinyblas_cpu.h
function tinyBLAS_not_supported (line 84) | bool tinyBLAS_not_supported(const char *file, int line) {
function unhalf (line 89) | inline float unhalf(ggml_fp16_t d) {
function unhalf (line 92) | inline float unhalf(ggml_bf16_t d) {
function float (line 111) | struct ggml_type_trait<float> {
function ggml_bf16_t (line 115) | struct ggml_type_trait<ggml_bf16_t> {
function ggml_fp16_t (line 119) | struct ggml_type_trait<ggml_fp16_t> {
function block_q8_0 (line 123) | struct ggml_type_trait<block_q8_0> {
function __m128 (line 131) | inline __m128 add(__m128 x, __m128 y) {
function __m128 (line 134) | inline __m128 sub(__m128 x, __m128 y) {
function __m128 (line 137) | inline __m128 mul(__m128 x, __m128 y) {
function __m256 (line 143) | inline __m256 add(__m256 x, __m256 y) {
function __m256 (line 146) | inline __m256 sub(__m256 x, __m256 y) {
function __m256 (line 149) | inline __m256 mul(__m256 x, __m256 y) {
function __m512 (line 155) | inline __m512 add(__m512 x, __m512 y) {
function __m512 (line 158) | inline __m512 sub(__m512 x, __m512 y) {
function __m512 (line 161) | inline __m512 mul(__m512 x, __m512 y) {
function float32x4_t (line 167) | inline float32x4_t add(float32x4_t x, float32x4_t y) {
function float32x4_t (line 170) | inline float32x4_t sub(float32x4_t x, float32x4_t y) {
function float32x4_t (line 173) | inline float32x4_t mul(float32x4_t x, float32x4_t y) {
function float16x8_t (line 179) | inline float16x8_t add(float16x8_t x, float16x8_t y) {
function float16x8_t (line 182) | inline float16x8_t sub(float16x8_t x, float16x8_t y) {
function float16x8_t (line 185) | inline float16x8_t mul(float16x8_t x, float16x8_t y) {
function U (line 197) | U madd(T a, T b, U c) {
function U (line 209) | U madder(T a, T b, U c, U *e) {
function float32x4_t (line 217) | inline float32x4_t badder(float32x4_t a, float b, float32x4_t c, float32...
function __m256 (line 228) | inline __m256 madd(__m256 a, __m256 b, __m256 c) {
function __m512 (line 234) | inline __m512 madd(__m512 a, __m512 b, __m512 c) {
function float32x4_t (line 242) | inline float32x4_t madd(float32x4_t a, float32x4_t b, float32x4_t c) {
function float16x8_t (line 248) | inline float16x8_t madd(float16x8_t a, float16x8_t b, float16x8_t c) {
function __m512 (line 257) | inline __m512 madd(__m512bh x, __m512bh y, __m512 z) {
function __m512 (line 261) | inline __m512 madder(__m512bh x, __m512bh y, __m512 z, __m512 *_) {
function hsum (line 270) | inline float hsum(float32x4_t x) {
function hsum (line 276) | inline float hsum(float16x8_t x) {
function hsum (line 283) | inline float hsum(__m128 x) {
function hsum (line 299) | inline float hsum(__m256 x) {
function hsum (line 305) | inline float hsum(__m512 x) {
function load (line 317) | inline float load(const float *p) {
function load (line 321) | inline float load(const ggml_fp16_t *p) {
function load (line 325) | inline float load(const ggml_bf16_t *p) {
function float32x4_t (line 331) | inline float32x4_t load(const float *p) {
function float32x4_t (line 335) | inline float32x4_t load(const ggml_bf16_t *p) {
function float16x8_t (line 340) | inline float16x8_t load(const ggml_fp16_t *p) {
function float32x4_t (line 344) | inline float32x4_t load(const ggml_fp16_t *p) {
function __m128 (line 352) | inline __m128 load(const float *p) {
function __m256 (line 359) | inline __m256 load(const float *p) {
function __m256 (line 366) | inline __m256 load(const ggml_bf16_t *p) {
function __m256 (line 374) | inline __m256 load(const ggml_fp16_t *p) {
function __m512 (line 381) | inline __m512 load(const float *p) {
function __m512 (line 385) | inline __m512 load(const ggml_fp16_t *p) {
function __m512 (line 389) | inline __m512 load(const ggml_bf16_t *p) {
function __m512bh (line 397) | inline __m512bh load(const ggml_bf16_t *p) {
function __m512bh (line 401) | inline __m512bh load(const float *p) {
function store (line 409) | inline void store(float *p, float f) {
function store (line 413) | inline void store(ggml_fp16_t *p, float f) {
function store (line 417) | inline void store(ggml_bf16_t *p, float f) {
function gemm (line 717) | void gemm(long m0, long m, long n0, long n) {
function int8x16_t (line 755) | inline int8x16_t load_lo(const block_q8_0 *b) {
function int8x16_t (line 759) | inline int8x16_t load_hi(const block_q8_0 *b) {
function int8x16_t (line 763) | inline int8x16_t load_lo(const block_q4_0 *b) {
function int8x16_t (line 768) | inline int8x16_t load_hi(const block_q4_0 *b) {
function gemm (line 940) | void gemm(long m0, long m, long n0, long n) {
function __m256i (line 978) | inline __m256i load(const block_q8_0 *b) {
function __m256i (line 982) | inline __m256i load(const block_q4_0 *b) {
function __m256 (line 990) | inline __m256 updot(__m256i u, __m256i s) {
FILE: llamafile/tinyblas_cpu_mixmul_amd_avx.cpp
function llamafile_mixmul_needs (line 8) | size_t llamafile_mixmul_needs(const ggml_tensor *weights, const ggml_ten...
FILE: llamafile/tinyblas_cpu_mixmul_arm80.cpp
function llamafile_mixmul_needs (line 8) | size_t llamafile_mixmul_needs(const ggml_tensor *weights, const ggml_ten...
FILE: llamafile/tinyblas_cpu_unsupported.cpp
function llamafile_sgemm_unsupported (line 22) | bool llamafile_sgemm_unsupported(long m, long n, long k, const void *A, ...
function llamafile_mixmul_unsupported (line 28) | bool llamafile_mixmul_unsupported(const struct ggml_compute_params *params,
function iqk_mul_mat_moe_unsupported (line 35) | bool iqk_mul_mat_moe_unsupported(long, long, long, int, int, const void ...
FILE: llamafile/xterm.cpp
function is_rgb_terminal (line 30) | bool is_rgb_terminal(void) {
function rgb2xterm256 (line 56) | int rgb2xterm256(int rgb) {
FILE: llamafile/zip.c
function get_zip_cfile_uncompressed_size (line 21) | int64_t get_zip_cfile_uncompressed_size(const uint8_t *z) {
function get_zip_cfile_compressed_size (line 33) | int64_t get_zip_cfile_compressed_size(const uint8_t *z) {
function get_zip_cfile_offset (line 49) | int64_t get_zip_cfile_offset(const uint8_t *z) {
FILE: localscore/apple.cpp
type IOReport (line 14) | struct IOReport {
type CoreFoundation (line 24) | struct CoreFoundation {
function init_apple_mon (line 37) | bool init_apple_mon() {
function get_cstring_from_cfstring (line 80) | static bool get_cstring_from_cfstring(CFStringRef cfString, char* buffer...
function get_item_energy_millijoules (line 98) | static double get_item_energy_millijoules(CFDictionaryRef item, const ch...
function am_release (line 120) | void am_release(void* obj) {
function am_print_object (line 124) | void am_print_object(CFTypeRef obj) {
function CFMutableDictionaryRef (line 128) | CFMutableDictionaryRef am_get_power_channels() {
function IOReportSubscriptionRef (line 139) | IOReportSubscriptionRef am_get_subscription(CFMutableDictionaryRef chann...
function CFDictionaryRef (line 146) | CFDictionaryRef am_sample_power(IOReportSubscriptionRef sub, CFMutableDi...
function am_sample_to_millijoules (line 150) | double am_sample_to_millijoules(CFDictionaryRef sample) {
FILE: localscore/apple.h
type CFIndex (line 8) | typedef int CFIndex;
FILE: localscore/benchmark.h
type time_interval (line 14) | struct time_interval {
type test_config (line 19) | struct test_config {
type token_metric (line 24) | enum token_metric { TOTAL_TPS, PROMPT_TPS, GEN_TPS }
type test (line 26) | struct test {
FILE: localscore/cmd.cpp
function llama_model_params (line 34) | llama_model_params cmd_params::to_llama_mparams() const {
function llama_context_params (line 55) | llama_context_params cmd_params::to_llama_cparams() const {
function cmd_params (line 70) | cmd_params parse_cmd_params(int argc, char ** argv) {
function print_usage (line 187) | void print_usage(int /* argc */, char ** argv) {
FILE: localscore/cmd.h
type output_formats (line 7) | enum output_formats {CSV, JSON, CONSOLE}
type send_results_mode (line 8) | enum send_results_mode {SEND_ASK, SEND_YES, SEND_NO}
type cmd_params (line 10) | struct cmd_params {
FILE: localscore/http.cpp
function wontreturn (line 54) | static wontreturn void PrintUsage(int fd, int rc) {
function GetSslEntropy (line 63) | static int GetSslEntropy(void *c, unsigned char *p, size_t n) {
function OnSslDebug (line 71) | static void OnSslDebug(void *ctx, int level, const char *file, int line,...
function TlsSend (line 79) | static int TlsSend(void *c, const unsigned char *p, size_t n) {
function TlsRecv (line 88) | static int TlsRecv(void *c, unsigned char *p, size_t n, uint32_t o) {
type ParsedUrl (line 115) | struct ParsedUrl {
type SSLContext (line 121) | struct SSLContext {
method SSLContext (line 126) | SSLContext() {
function ParsedUrl (line 139) | static ParsedUrl ExtractUrlComponents(const std::string& url_str, bool* ...
function BuildHTTPRequest (line 190) | static std::string BuildHTTPRequest(const ParsedUrl url, const Headers& ...
function ConnectToServer (line 221) | static int ConnectToServer(const ParsedUrl url) {
function SetupSSL (line 261) | static std::unique_ptr<SSLContext> SetupSSL(int& sock, const std::string...
function SendRequest (line 293) | static void SendRequest(const std::string& request, int sock, SSLContext...
function hasHeader (line 312) | bool hasHeader(const HttpMessage& msg, int header) {
function getHeaderLength (line 320) | size_t getHeaderLength(const HttpMessage& msg, int header) {
function headerEqualCase (line 324) | bool headerEqualCase(const HttpMessage& msg, int header, const char* str...
function Response (line 330) | static Response DecodeHttpResponse(int sock, SSLContext* ssl_ctx, size_t...
function Response (line 466) | Response SendHttpRequest(const std::string& url_str, uint64_t method,
function Response (line 496) | Response GET(const std::string& url_str, const Headers& headers) {
function Response (line 500) | Response POST(const std::string& url_str, const std::string& body, const...
FILE: localscore/http.h
type std (line 4) | typedef std::map<std::string, std::string> Headers;
type Response (line 6) | struct Response {
FILE: localscore/localscore.cpp
function llama_null_log_callback (line 70) | static void llama_null_log_callback(enum ggml_log_level level, const cha...
type update_t_gen_column_args (line 76) | struct update_t_gen_column_args {
function getUserConfirmation (line 120) | std::string getUserConfirmation() {
function init (line 130) | __attribute__((__constructor__(101))) static void init(void) {
function warmup_run (line 134) | static void warmup_run(llama_model *model, llama_context *ctx, cmd_param...
function submitBenchmarkResults (line 176) | static bool submitBenchmarkResults(const std::string& req_payload, const...
function acceleratorSelector (line 244) | static void acceleratorSelector(cmd_params* params) {
type LocalScoreResultsSummary (line 273) | struct LocalScoreResultsSummary {
function LocalScoreResultsSummary (line 280) | static LocalScoreResultsSummary getResultsSummary(Json data) {
function displayResults (line 340) | static void displayResults(LocalScoreResultsSummary results_summary, boo...
type SystemData (line 379) | struct SystemData {
function get_baseline_test_configs (line 387) | std::vector<test_config> get_baseline_test_configs() {
function setup_initial_environment (line 401) | void setup_initial_environment(int* argc, char*** argv, cmd_params* para...
function initialize_llama_backend (line 412) | void initialize_llama_backend(const cmd_params& params) {
function llama_model (line 421) | llama_model* load_model(const cmd_params& params) {
function create_printer (line 434) | std::unique_ptr<printer> create_printer(const cmd_params& params) {
function perform_warmup (line 446) | void perform_warmup(llama_model* model, const cmd_params& params) {
function run_baseline_tests (line 463) | bool run_baseline_tests(const std::vector<test_config>& tests, llama_mod...
function process_and_submit_results (line 498) | void process_and_submit_results(const std::string& req_payload, const cm...
function localscore_cli (line 521) | int localscore_cli(int argc, char** argv) {
FILE: localscore/main.cpp
function main (line 3) | int main(int argc, char** argv) {
FILE: localscore/net.h
function namespace (line 22) | namespace lf {
FILE: localscore/nvml.cpp
type Nvml (line 15) | struct Nvml {
function import_nvml_function (line 48) | static void import_nvml_function(void *lib, const char *func_name, Union...
function nvml_function_call (line 68) | auto nvml_function_call(UnionType &func_union, Args &&... args) -> declt...
function FileExists (line 76) | static bool FileExists(const char *path) {
function get_nvml_bin_path (line 81) | static bool get_nvml_bin_path(char path[PATH_MAX]) {
function nvml_init (line 119) | bool nvml_init() {
function nvml_get_device (line 151) | bool nvml_get_device(nvmlDevice_t *device, unsigned int index) {
function nvml_get_power_usage (line 156) | bool nvml_get_power_usage(nvmlDevice_t device, unsigned int *power) {
function nvml_get_energy_consumption (line 161) | bool nvml_get_energy_consumption(nvmlDevice_t device, unsigned long long...
function nvml_shutdown (line 166) | bool nvml_shutdown() {
FILE: localscore/powersampler.cpp
function power_sample_t (line 34) | power_sample_t PowerSampler::stop() {
function power_sample_t (line 72) | power_sample_t PowerSampler::getLatestSample() {
function power_sample_t (line 119) | power_sample_t NvidiaPowerSampler::sample() {
function power_sample_t (line 149) | power_sample_t AMDPowerSampler::sample() {
function power_sample_t (line 188) | power_sample_t ApplePowerSampler::sample() {
function power_sample_t (line 211) | power_sample_t DummyPowerSampler::sample() {
function PowerSampler (line 219) | PowerSampler* getPowerSampler(long sample_length_ms, unsigned int main_g...
FILE: localscore/powersampler.h
type power_sample_t (line 11) | typedef struct {
type PowerSampler (line 15) | struct PowerSampler {
function PowerSampler (line 48) | struct NvidiaPowerSampler : public PowerSampler {
function PowerSampler (line 61) | struct AMDPowerSampler : public PowerSampler {
function PowerSampler (line 70) | struct ApplePowerSampler : public PowerSampler {
function PowerSampler (line 85) | struct DummyPowerSampler : public PowerSampler {
FILE: localscore/printer.h
type OutputWriter (line 11) | struct OutputWriter {
function OutputWriter (line 17) | struct FileWriter : public OutputWriter {
function OutputWriter (line 25) | struct StringWriter : public OutputWriter {
function set_string_output (line 33) | struct printer {
function virtual (line 46) | virtual void print_header(const cmd_params & params, AcceleratorInfo acc...
function virtual (line 48) | virtual void print_footer() { }
function printer (line 51) | struct csv_printer : public printer {
function printer (line 63) | struct json_printer : public printer {
function printer (line 83) | struct console_printer : public printer {
FILE: localscore/rsmi.cpp
type Rsmi (line 36) | struct Rsmi {
function rsmi_init (line 48) | bool rsmi_init() {
function rsmi_get_avg_power (line 72) | bool rsmi_get_avg_power(double *power) {
function rsmi_get_power (line 79) | bool rsmi_get_power(double *power) {
function rsmi_get_energy_count (line 89) | bool rsmi_get_energy_count(double *energy) {
function rsmi_get_power_instant (line 99) | bool rsmi_get_power_instant(double *power) {
function rsmi_get_memory_usage (line 106) | bool rsmi_get_memory_usage(float *memory) {
function rsmi_shutdown (line 114) | bool rsmi_shutdown() {
FILE: localscore/system.cpp
function cpuid (line 21) | void cpuid(unsigned leaf, unsigned subleaf, unsigned *info) {
function get_cpu_info (line 58) | std::string get_cpu_info() { // [jart]
function get_runtime_info (line 155) | void get_runtime_info(RuntimeInfo* info) {
function get_mem_gb (line 169) | double get_mem_gb() {
function get_sys_info (line 178) | void get_sys_info(SystemInfo* info) {
function get_accelerator_info (line 208) | void get_accelerator_info(AcceleratorInfo* info, cmd_params * params) {
function list_available_accelerators (line 303) | void list_available_accelerators() {
function get_model_info (line 324) | void get_model_info(ModelInfo *info, llama_model *model) {
FILE: localscore/system.h
type cmd_params (line 9) | struct cmd_params
type RuntimeInfo (line 12) | struct RuntimeInfo {
type SystemInfo (line 17) | struct SystemInfo {
type AcceleratorInfo (line 26) | struct AcceleratorInfo {
type ModelInfo (line 34) | struct ModelInfo {
FILE: localscore/utils.h
function namespace (line 20) | namespace utils {
FILE: stable-diffusion.cpp.patches/llamafile-files/darts.h
function namespace (line 21) | namespace Darts {
type DoubleArrayImpl (line 316) | typedef DoubleArrayImpl<void, void, int, void> DoubleArray;
function namespace (line 549) | namespace Details {
function T (line 607) | const T &operator[](std::size_t id) const {
function clear (line 621) | void clear() {
function push_back (line 628) | void push_back(const T &value) {
function pop_back (line 631) | void pop_back() {
function append (line 635) | void append() {
function append (line 640) | void append(const T &value) {
function resize (line 646) | void resize(std::size_t size) {
function resize (line 657) | void resize(std::size_t size, const T &value) {
function reserve (line 669) | void reserve(std::size_t size) {
function push (line 745) | void push(const T &value) {
function pop (line 748) | void pop() {
function clear (line 752) | void clear() {
function class (line 768) | class BitVector {
function build (line 838) | inline void BitVector::build() {
function char_type (line 866) | const char_type *keys(std::size_t id) const {
function uchar_type (line 869) | uchar_type keys(std::size_t key_id, std::size_t char_id) const {
function value_type (line 892) | const value_type values(std::size_t id) const {
function set_sibling (line 922) | void set_sibling(id_type sibling) {
function set_value (line 925) | void set_value(value_type value) {
function set_label (line 928) | void set_label(uchar_type label) {
function set_is_state (line 931) | void set_is_state(bool is_state) {
function set_has_sibling (line 934) | void set_has_sibling(bool has_sibling) {
function class (line 978) | class DawgUnit {
function class (line 1015) | class DawgBuilder {
function id_type (line 1027) | id_type child(id_type id) const {
function id_type (line 1030) | id_type sibling(id_type id) const {
function value (line 1033) | int value(id_type id) const {
function is_leaf (line 1037) | bool is_leaf(id_type id) const {
function uchar_type (line 1040) | uchar_type label(id_type id) const {
function is_intersection (line 1044) | bool is_intersection(id_type id) const {
function id_type (line 1047) | id_type intersection_id(id_type id) const {
function free_node (line 1097) | void free_node(id_type id) {
function id_type (line 1101) | static id_type hash(id_type key) {
function init (line 1112) | inline void DawgBuilder::init() {
function finish (line 1124) | inline void DawgBuilder::finish() {
function insert (line 1138) | inline void DawgBuilder::insert(const char *key, std::size_t length,
function clear (line 1193) | inline void DawgBuilder::clear() {
function flush (line 1204) | inline void DawgBuilder::flush(id_type id) {
function expand_table (line 1247) | inline void DawgBuilder::expand_table() {
function id_type (line 1262) | inline id_type DawgBuilder::find_unit(id_type id, id_type *hash_id) const {
function id_type (line 1275) | inline id_type DawgBuilder::find_node(id_type node_id,
function are_equal (line 1291) | inline bool DawgBuilder::are_equal(id_type node_id, id_type unit_id) con...
function id_type (line 1312) | inline id_type DawgBuilder::hash_unit(id_type id) const {
function id_type (line 1326) | inline id_type DawgBuilder::hash_node(id_type id) const {
function id_type (line 1336) | inline id_type DawgBuilder::append_unit() {
function id_type (line 1344) | inline id_type DawgBuilder::append_node() {
function class (line 1361) | class DoubleArrayBuilderUnit {
function class (line 1400) | class DoubleArrayBuilderExtraUnit {
function class (line 1444) | class DoubleArrayBuilder {
type DoubleArrayBuilderUnit (line 1467) | typedef DoubleArrayBuilderUnit unit_type;
type DoubleArrayBuilderExtraUnit (line 1468) | typedef DoubleArrayBuilderExtraUnit extra_type;
function extra_type (line 1485) | const extra_type &extras(id_type id) const {
function copy (line 1531) | inline void DoubleArrayBuilder::copy(std::size_t *size_ptr,
function clear (line 1545) | inline void DoubleArrayBuilder::clear() {
function build_from_dawg (line 1566) | inline void DoubleArrayBuilder::build_from_dawg(const DawgBuilder &dawg) {
function build_from_dawg (line 1596) | inline void DoubleArrayBuilder::build_from_dawg(const DawgBuilder &dawg,
function id_type (line 1629) | inline id_type DoubleArrayBuilder::arrange_from_dawg(const DawgBuilder &...
function id_type (line 1767) | inline id_type DoubleArrayBuilder::find_valid_offset(id_type id) const {
function is_valid_offset (line 1784) | inline bool DoubleArrayBuilder::is_valid_offset(id_type id,
function reserve_id (line 1804) | inline void DoubleArrayBuilder::reserve_id(id_type id) {
function expand_units (line 1820) | inline void DoubleArrayBuilder::expand_units() {
function fix_all_blocks (line 1855) | inline void DoubleArrayBuilder::fix_all_blocks() {
function fix_block (line 1867) | inline void DoubleArrayBuilder::fix_block(id_type block_id) {
FILE: stable-diffusion.cpp.patches/llamafile-files/main.cpp
type SDMode (line 64) | enum SDMode {
type SDParams (line 72) | struct SDParams {
function print_params (line 123) | void print_params(SDParams params) {
function print_usage (line 163) | void print_usage(int argc, const char* argv[]) {
function parse_args (line 212) | void parse_args(int argc, const char** argv, SDParams& params) {
function sd_basename (line 592) | static std::string sd_basename(const std::string& path) {
function get_image_params (line 604) | std::string get_image_params(SDParams params, int64_t seed) {
function sd_log_cb (line 625) | void sd_log_cb(enum sd_log_level_t level, const char* log, void* data) {
function main (line 667) | int main(int argc, const char* argv[]) {
FILE: stable-diffusion.cpp.patches/llamafile-files/miniz.h
type mz_ulong (line 240) | typedef unsigned long mz_ulong;
type mz_internal_state (line 328) | struct mz_internal_state
type mz_stream (line 331) | typedef struct mz_stream_s {
type mz_stream (line 354) | typedef mz_stream *mz_streamp;
type Byte (line 496) | typedef unsigned char Byte;
type uInt (line 497) | typedef unsigned int uInt;
type mz_ulong (line 498) | typedef mz_ulong uLong;
type Byte (line 499) | typedef Byte Bytef;
type uInt (line 500) | typedef uInt uIntf;
type charf (line 501) | typedef char charf;
type intf (line 502) | typedef int intf;
type uLong (line 504) | typedef uLong uLongf;
type mz_uint8 (line 583) | typedef unsigned char mz_uint8;
type mz_int16 (line 584) | typedef signed short mz_int16;
type mz_uint16 (line 585) | typedef unsigned short mz_uint16;
type mz_uint32 (line 586) | typedef unsigned int mz_uint32;
type mz_uint (line 587) | typedef unsigned int mz_uint;
type mz_int64 (line 588) | typedef int64_t mz_int64;
type mz_uint64 (line 589) | typedef uint64_t mz_uint64;
type mz_bool (line 590) | typedef int mz_bool;
type mz_dummy_time_t (line 611) | typedef struct mz_dummy_time_t_tag {
type mz_bool (line 778) | typedef mz_bool (*tdefl_put_buf_func_ptr)(const void *pBuf, int len,
type tdefl_status (line 825) | typedef enum {
type tdefl_flush (line 833) | typedef enum {
type tdefl_compressor (line 841) | typedef struct {
type tinfl_decompressor_tag (line 987) | struct tinfl_decompressor_tag
type tinfl_decompressor (line 988) | typedef struct tinfl_decompressor_tag tinfl_decompressor;
type tinfl_status (line 1002) | typedef enum {
type tinfl_huff_table (line 1089) | typedef struct {
type mz_uint64 (line 1102) | typedef mz_uint64 tinfl_bit_buf_t;
type mz_uint32 (line 1105) | typedef mz_uint32 tinfl_bit_buf_t;
type tinfl_decompressor_tag (line 1109) | struct tinfl_decompressor_tag {
type mz_zip_archive_file_stat (line 1142) | typedef struct {
type mz_bool (line 1206) | typedef mz_bool (*mz_file_needs_keepalive)(void *pOpaque);
type mz_zip_internal_state_tag (line 1208) | struct mz_zip_internal_state_tag
type mz_zip_internal_state (line 1209) | typedef struct mz_zip_internal_state_tag mz_zip_internal_state;
type mz_zip_mode (line 1211) | typedef enum {
type mz_zip_flags (line 1218) | typedef enum {
type mz_zip_type (line 1241) | typedef enum {
type mz_zip_error (line 1253) | typedef enum {
type mz_zip_archive (line 1289) | typedef struct {
type mz_zip_reader_extract_iter_state (line 1315) | typedef struct {
function mz_ulong (line 1800) | mz_ulong mz_adler32(mz_ulong adler, const unsigned char *ptr, size_t buf...
function mz_ulong (line 1829) | mz_ulong mz_crc32(mz_ulong crc, const mz_uint8 *ptr, size_t buf_len)
function mz_ulong (line 1854) | mz_ulong mz_crc32(mz_ulong crc, const mz_uint8 *ptr, size_t buf_len) {
function mz_free (line 1922) | void mz_free(void *p) { MZ_FREE(p); }
function MINIZ_EXPORT (line 1924) | MINIZ_EXPORT void *miniz_def_alloc_func(void *opaque, size_t items,
function MINIZ_EXPORT (line 1929) | MINIZ_EXPORT void miniz_def_free_func(void *opaque, void *address) {
function MINIZ_EXPORT (line 1933) | MINIZ_EXPORT void *miniz_def_realloc_func(void *opaque, void *address,
function mz_deflateInit (line 1943) | int mz_deflateInit(mz_streamp pStream, int level) {
function mz_deflateInit2 (line 1948) | int mz_deflateInit2(mz_streamp pStream, int level, int method, int windo...
function mz_deflateReset (line 1988) | int mz_deflateReset(mz_streamp pStream) {
function mz_deflate (line 1998) | int mz_deflate(mz_streamp pStream, int flush) {
function mz_deflateEnd (line 2054) | int mz_deflateEnd(mz_streamp pStream) {
function mz_ulong (line 2064) | mz_ulong mz_deflateBound(mz_streamp pStream, mz_ulong source_len) {
function mz_compress2 (line 2073) | int mz_compress2(unsigned char *pDest, mz_ulong *pDest_len,
function mz_compress (line 2102) | int mz_compress(unsigned char *pDest, mz_ulong *pDest_len,
function mz_ulong (line 2108) | mz_ulong mz_compressBound(mz_ulong source_len) {
type inflate_state (line 2112) | typedef struct {
function mz_inflateInit2 (line 2120) | int mz_inflateInit2(mz_streamp pStream, int window_bits) {
function mz_inflateInit (line 2157) | int mz_inflateInit(mz_streamp pStream) {
function mz_inflateReset (line 2161) | int mz_inflateReset(mz_streamp pStream) {
function mz_inflate (line 2186) | int mz_inflate(mz_streamp pStream, int flush) {
function mz_inflateEnd (line 2309) | int mz_inflateEnd(mz_streamp pStream) {
function mz_uncompress2 (line 2318) | int mz_uncompress2(unsigned char *pDest, mz_ulong *pDest_len,
function mz_uncompress (line 2349) | int mz_uncompress(unsigned char *pDest, mz_ulong *pDest_len,
type tdefl_sym_freq (line 2546) | typedef struct {
function tdefl_sym_freq (line 2549) | static tdefl_sym_freq *tdefl_radix_sort_syms(mz_uint num_syms,
function tdefl_calculate_minimum_redundancy (line 2583) | static void tdefl_calculate_minimum_redundancy(tdefl_sym_freq *A, int n) {
function tdefl_huffman_enforce_max_code_size (line 2630) | static void tdefl_huffman_enforce_max_code_size(int *pNum_codes,
function tdefl_optimize_huffman_table (line 2653) | static void tdefl_optimize_huffman_table(tdefl_compressor *d, int table_...
function tdefl_start_dynamic_block (line 2765) | static void tdefl_start_dynamic_block(tdefl_compressor *d) {
function tdefl_start_static_block (line 2850) | static void tdefl_start_static_block(tdefl_compressor *d) {
function mz_bool (line 2877) | static mz_bool tdefl_compress_lz_codes(tdefl_compressor *d) {
function mz_bool (line 2972) | static mz_bool tdefl_compress_lz_codes(tdefl_compressor *d) {
function mz_bool (line 3017) | static mz_bool tdefl_compress_block(tdefl_compressor *d, mz_bool static_...
function tdefl_flush_block (line 3025) | static int tdefl_flush_block(tdefl_compressor *d, int flush) {
function mz_uint16 (line 3157) | static mz_uint16 TDEFL_READ_UNALIGNED_WORD(const mz_uint8 *p) {
function mz_uint16 (line 3162) | static mz_uint16 TDEFL_READ_UNALIGNED_WORD2(const mz_uint16 *p) {
function MZ_FORCEINLINE (line 3171) | static MZ_FORCEINLINE void
function MZ_FORCEINLINE (line 3231) | static MZ_FORCEINLINE void
function mz_uint32 (line 3281) | static mz_uint32 TDEFL_READ_UNALIGNED_WORD32(const mz_uint8 *p) {
function mz_bool (line 3289) | static mz_bool tdefl_compress_fast(tdefl_compressor *d) {
function MZ_FORCEINLINE (line 3475) | static MZ_FORCEINLINE void tdefl_record_literal(tdefl_compressor *d,
function MZ_FORCEINLINE (line 3487) | static MZ_FORCEINLINE void
function mz_bool (line 3515) | static mz_bool tdefl_compress_normal(tdefl_compressor *d) {
function tdefl_status (line 3659) | static tdefl_status tdefl_flush_output_buffer(tdefl_compressor *d) {
function tdefl_status (line 3680) | tdefl_status tdefl_compress(tdefl_compressor *d, const void *pIn_buf,
function tdefl_status (line 3752) | tdefl_status tdefl_compress_buffer(tdefl_compressor *d, const void *pIn_...
function tdefl_status (line 3758) | tdefl_status tdefl_init(tdefl_compressor *d,
function tdefl_status (line 3799) | tdefl_status tdefl_get_prev_return_status(tdefl_compressor *d) {
function mz_uint32 (line 3803) | mz_uint32 tdefl_get_adler32(tdefl_compressor *d) { return d->m_adler32; }
function mz_bool (line 3805) | mz_bool tdefl_compress_mem_to_output(const void *pBuf, size_t buf_len,
type tdefl_output_buffer (line 3824) | typedef struct {
function mz_bool (line 3830) | static mz_bool tdefl_output_buffer_putter(const void *pBuf, int len,
function tdefl_compress_mem_to_mem (line 3869) | size_t tdefl_compress_mem_to_mem(void *pOut_buf, size_t out_buf_len,
function mz_uint (line 3890) | mz_uint tdefl_create_comp_flags_from_zip_params(int level, int window_bits,
function tdefl_compressor (line 4020) | tdefl_compressor *tdefl_compressor_alloc(void) {
function tdefl_compressor_free (line 4024) | void tdefl_compressor_free(tdefl_compressor *pComp) { MZ_FREE(pComp); }
function tinfl_status (line 4202) | tinfl_status tinfl_decompress(tinfl_decompressor *r,
function tinfl_decompress_mem_to_mem (line 4723) | size_t tinfl_decompress_mem_to_mem(void *pOut_buf, size_t out_buf_len,
function tinfl_decompress_mem_to_callback (line 4738) | int tinfl_decompress_mem_to_callback(const void *pIn_buf, size_t *pIn_bu...
function tinfl_decompressor (line 4772) | tinfl_decompressor *tinfl_decompressor_alloc(void) {
function tinfl_decompressor_free (line 4780) | void tinfl_decompressor_free(tinfl_decompressor *pDecomp) { MZ_FREE(pDec...
function wchar_t (line 4831) | static wchar_t *str2wstr(const char *str) {
function FILE (line 4839) | static FILE *mz_fopen(const char *pFilename, const char *pMode) {
function FILE (line 4855) | static FILE *mz_freopen(const char *pPath, const char *pMode, FILE *pStr...
function mz_stat (line 4880) | static int mz_stat(const char *pPath, struct _stat64 *buffer) {
function mz_mkdir (line 4889) | static int mz_mkdir(const char *pDirname) {
type mz_zip_array (line 5114) | typedef struct {
type mz_zip_internal_state_tag (line 5120) | struct mz_zip_internal_state_tag {
function MZ_FORCEINLINE (line 5151) | static MZ_FORCEINLINE mz_uint
function MZ_FORCEINLINE (line 5164) | static MZ_FORCEINLINE void mz_zip_array_init(mz_zip_array *pArray,
function MZ_FORCEINLINE (line 5170) | static MZ_FORCEINLINE void mz_zip_array_clear(mz_zip_archive *pZip,
function mz_bool (line 5176) | static mz_bool mz_zip_array_ensure_capacity(mz_zip_archive *pZip,
function MZ_FORCEINLINE (line 5198) | static MZ_FORCEINLINE mz_bool mz_zip_array_reserve(mz_zip_archive *pZip,
function MZ_FORCEINLINE (line 5209) | static MZ_FORCEINLINE mz_bool mz_zip_array_resize(mz_zip_archive *pZip,
function MZ_FORCEINLINE (line 5221) | static MZ_FORCEINLINE mz_bool mz_zip_array_ensure_room(mz_zip_archive *p...
function MZ_FORCEINLINE (line 5227) | static MZ_FORCEINLINE mz_bool mz_zip_array_push_back(mz_zip_archive *pZip,
function MZ_TIME_T (line 5241) | static MZ_TIME_T mz_zip_dos_to_time_t(int dos_time, int dos_date) {
function mz_zip_time_t_to_dos_time (line 5255) | static void mz_zip_time_t_to_dos_time(MZ_TIME_T time, mz_uint16 *pDOS_time,
function mz_bool (line 5279) | static mz_bool mz_zip_get_file_modified_time(const char *pFilename,
function mz_bool (line 5294) | static mz_bool mz_zip_set_file_times(const char *pFilename,
function MZ_FORCEINLINE (line 5308) | static MZ_FORCEINLINE mz_bool mz_zip_set_error(mz_zip_archive *pZip,
function mz_bool (line 5315) | static mz_bool mz_zip_reader_init_internal(mz_zip_archive *pZip,
function MZ_FORCEINLINE (line 5353) | static MZ_FORCEINLINE mz_bool
function mz_zip_reader_sort_central_dir_offsets_by_filename (line 5391) | static void
function mz_bool (line 5448) | static mz_bool mz_zip_reader_locate_header_sig(mz_zip_archive *pZip,
function mz_bool (line 5496) | static mz_bool mz_zip_reader_read_central_dir(mz_zip_archive *pZip,
function mz_zip_zero_struct (line 5799) | void mz_zip_zero_struct(mz_zip_archive *pZip) {
function mz_bool (line 5804) | static mz_bool mz_zip_reader_end_internal(mz_zip_archive *pZip,
function mz_bool (line 5847) | mz_bool mz_zip_reader_end(mz_zip_archive *pZip) {
function mz_bool (line 5850) | mz_bool mz_zip_reader_init(mz_zip_archive *pZip, mz_uint64 size,
function mz_zip_mem_read_func (line 5869) | static size_t mz_zip_mem_read_func(void *pOpaque, mz_uint64 file_ofs,
function mz_bool (line 5879) | mz_bool mz_zip_reader_init_mem(mz_zip_archive *pZip, const void *pMem,
function mz_zip_file_read_func (line 5913) | static size_t mz_zip_file_read_func(void *pOpaque, mz_uint64 file_ofs,
function mz_bool (line 5928) | mz_bool mz_zip_reader_init_file(mz_zip_archive *pZip, const char *pFilen...
function mz_bool (line 5933) | mz_bool mz_zip_reader_init_file_v2(mz_zip_archive *pZip, const char *pFi...
function mz_bool (line 5986) | mz_bool mz_zip_reader_init_file_v2_rpb(mz_zip_archive *pZip,
function mz_bool (line 6040) | mz_bool mz_zip_reader_init_cfile(mz_zip_archive *pZip, MZ_FILE *pFile,
function MZ_FORCEINLINE (line 6080) | static MZ_FORCEINLINE const mz_uint8 *mz_zip_get_cdh(mz_zip_archive *pZip,
function mz_bool (line 6090) | mz_bool mz_zip_reader_is_file_encrypted(mz_zip_archive *pZip,
function mz_bool (line 6105) | mz_bool mz_zip_reader_is_file_supported(mz_zip_archive *pZip,
function mz_bool (line 6138) | mz_bool mz_zip_reader_is_file_a_directory(mz_zip_archive *pZip,
function mz_bool (line 6171) | static mz_bool mz_zip_file_stat_internal(mz_zip_archive *pZip,
function MZ_FORCEINLINE (line 6303) | static MZ_FORCEINLINE mz_bool mz_zip_string_equal(const char *pA,
function MZ_FORCEINLINE (line 6315) | static MZ_FORCEINLINE int
function mz_bool (line 6337) | static mz_bool mz_zip_locate_file_binary_search(mz_zip_archive *pZip,
function mz_zip_reader_locate_file (line 6378) | int mz_zip_reader_locate_file(mz_zip_archive *pZip, const char *pName,
function mz_bool (line 6387) | mz_bool mz_zip_reader_locate_file_v2(mz_zip_archive *pZip, const char *p...
function mz_bool (line 6459) | static mz_bool mz_zip_reader_extract_to_mem_no_alloc1(
function mz_bool (line 6619) | mz_bool mz_zip_reader_extract_to_mem_no_alloc(mz_zip_archive *pZip,
function mz_bool (line 6629) | mz_bool mz_zip_reader_extract_file_to_mem_no_alloc(
function mz_bool (line 6640) | mz_bool mz_zip_reader_extract_to_mem(mz_zip_archive *pZip, mz_uint file_...
function mz_bool (line 6647) | mz_bool mz_zip_reader_extract_file_to_mem(mz_zip_archive *pZip,
function mz_bool (line 6704) | mz_bool mz_zip_reader_extract_to_callback(mz_zip_archive *pZip,
function mz_bool (line 6913) | mz_bool mz_zip_reader_extract_file_to_callback(mz_zip_archive *pZip,
function mz_zip_reader_extract_iter_state (line 6925) | mz_zip_reader_extract_iter_state *
function mz_zip_reader_extract_iter_state (line 7062) | mz_zip_reader_extract_iter_state *
function mz_zip_reader_extract_iter_read (line 7075) | size_t mz_zip_reader_extract_iter_read(mz_zip_reader_extract_iter_state ...
function mz_bool (line 7202) | mz_bool
function mz_zip_file_write_callback (line 7242) | static size_t mz_zip_file_write_callback(void *pOpaque, mz_uint64 ofs,
function mz_bool (line 7249) | mz_bool mz_zip_reader_extract_to_file(mz_zip_archive *pZip, mz_uint file...
function mz_bool (line 7284) | mz_bool mz_zip_reader_extract_file_to_file(mz_zip_archive *pZip,
function mz_bool (line 7296) | mz_bool mz_zip_reader_extract_to_cfile(mz_zip_archive *pZip, mz_uint fil...
function mz_bool (line 7310) | mz_bool mz_zip_reader_extract_file_to_cfile(mz_zip_archive *pZip,
function mz_zip_compute_crc32_callback (line 7322) | static size_t mz_zip_compute_crc32_callback(void *pOpaque, mz_uint64 fil...
function mz_bool (line 7330) | mz_bool mz_zip_validate_file(mz_zip_archive *pZip, mz_uint file_index,
function mz_bool (line 7568) | mz_bool mz_zip_validate_archive(mz_zip_archive *pZip, mz_uint flags) {
function mz_bool (line 7618) | mz_bool mz_zip_validate_mem_archive(const void *pMem, size_t size,
function mz_bool (line 7656) | mz_bool mz_zip_validate_file_archive(const char *pFilename, mz_uint flags,
function MZ_FORCEINLINE (line 7698) | static MZ_FORCEINLINE void mz_write_le16(mz_uint8 *p, mz_uint16 v) {
function MZ_FORCEINLINE (line 7702) | static MZ_FORCEINLINE void mz_write_le32(mz_uint8 *p, mz_uint32 v) {
function MZ_FORCEINLINE (line 7708) | static MZ_FORCEINLINE void mz_write_le64(mz_uint8 *p, mz_uint64 v) {
function mz_zip_heap_write_func (line 7717) | static size_t mz_zip_heap_write_func(void *pOpaque, mz_uint64 file_ofs,
function mz_bool (line 7754) | static mz_bool mz_zip_writer_end_internal(mz_zip_archive *pZip,
function mz_bool (line 7797) | mz_bool mz_zip_writer_init_v2(mz_zip_archive *pZip, mz_uint64 existing_s...
function mz_bool (line 7849) | mz_bool mz_zip_writer_init(mz_zip_archive *pZip, mz_uint64 existing_size) {
function mz_bool (line 7853) | mz_bool mz_zip_writer_init_heap_v2(mz_zip_archive *pZip,
function mz_bool (line 7883) | mz_bool mz_zip_writer_init_heap(mz_zip_archive *pZip,
function mz_zip_file_write_func (line 7891) | static size_t mz_zip_file_write_func(void *pOpaque, mz_uint64 file_ofs,
function mz_bool (line 7908) | mz_bool mz_zip_writer_init_file(mz_zip_archive *pZip, const char *pFilen...
function mz_bool (line 7914) | mz_bool mz_zip_writer_init_file_v2(mz_zip_archive *pZip, const char *pFi...
function mz_bool (line 7960) | mz_bool mz_zip_writer_init_cfile(mz_zip_archive *pZip, MZ_FILE *pFile,
function mz_bool (line 7982) | mz_bool mz_zip_writer_init_from_reader_v2(mz_zip_archive *pZip,
function mz_bool (line 8074) | mz_bool mz_zip_writer_init_from_reader_v2_noreopen(mz_zip_archive *pZip,
function mz_bool (line 8156) | mz_bool mz_zip_writer_init_from_reader(mz_zip_archive *pZip,
function mz_bool (line 8162) | mz_bool mz_zip_writer_add_mem(mz_zip_archive *pZip, const char *pArchive...
type mz_zip_writer_add_state (line 8169) | typedef struct {
function mz_bool (line 8175) | static mz_bool mz_zip_writer_add_put_buf_callback(const void *pBuf, int ...
function mz_uint32 (line 8192) | static mz_uint32
function mz_bool (line 8226) | static mz_bool mz_zip_writer_create_local_dir_header(
function mz_bool (line 8249) | static mz_bool mz_zip_writer_create_central_dir_header(
function mz_bool (line 8277) | static mz_bool mz_zip_writer_add_to_central_dir(
function mz_bool (line 8330) | static mz_bool mz_zip_writer_validate_archive_name(const char *pArchive_...
function mz_uint (line 8343) | static mz_uint
function mz_bool (line 8353) | static mz_bool mz_zip_writer_write_zeros(mz_zip_archive *pZip,
function mz_bool (line 8368) | mz_bool mz_zip_writer_add_mem_ex(mz_zip_archive *pZip,
function mz_bool (line 8379) | mz_bool mz_zip_writer_add_mem_ex_v2(
function mz_bool (line 8686) | mz_bool mz_zip_writer_add_read_buf_callback(
function mz_file_read_func_stdio (line 9067) | static size_t mz_file_read_func_stdio(void *pOpaque, mz_uint64 file_ofs,
function mz_bool (line 9080) | mz_bool mz_zip_writer_add_cfile(
function mz_bool (line 9093) | mz_bool mz_zip_writer_add_file(mz_zip_archive *pZip, const char *pArchiv...
function mz_bool (line 9129) | static mz_bool mz_zip_writer_update_zip64_extension_block(
function mz_bool (line 9206) | mz_bool mz_zip_writer_add_from_zip_reader(mz_zip_archive *pZip,
function mz_bool (line 9626) | mz_bool mz_zip_writer_finalize_archive(mz_zip_archive *pZip) {
function mz_bool (line 9732) | mz_bool mz_zip_writer_finalize_heap_archive(mz_zip_archive *pZip, void *...
function mz_bool (line 9757) | mz_bool mz_zip_writer_end(mz_zip_archive *pZip) {
function mz_bool (line 9762) | mz_bool mz_zip_add_mem_to_archive_file_in_place(
function mz_bool (line 9771) | mz_bool mz_zip_add_mem_to_archive_file_in_place_v2(
function mz_zip_mode (line 9921) | mz_zip_mode mz_zip_get_mode(mz_zip_archive *pZip) {
function mz_zip_type (line 9925) | mz_zip_type mz_zip_get_type(mz_zip_archive *pZip) {
function mz_zip_error (line 9929) | mz_zip_error mz_zip_set_last_error(mz_zip_archive *pZip, mz_zip_error er...
function mz_zip_error (line 9941) | mz_zip_error mz_zip_peek_last_error(mz_zip_archive *pZip) {
function mz_zip_error (line 9948) | mz_zip_error mz_zip_clear_last_error(mz_zip_archive *pZip) {
function mz_zip_error (line 9952) | mz_zip_error mz_zip_get_last_error(mz_zip_archive *pZip) {
function mz_bool (line 10041) | mz_bool mz_zip_is_zip64(mz_zip_archive *pZip) {
function mz_zip_get_central_dir_size (line 10048) | size_t mz_zip_get_central_dir_size(mz_zip_archive *pZip) {
function mz_uint (line 10055) | mz_uint mz_zip_reader_get_num_files(mz_zip_archive *pZip) {
function mz_uint64 (line 10059) | mz_uint64 mz_zip_get_archive_size(mz_zip_archive *pZip) {
function mz_uint64 (line 10065) | mz_uint64 mz_zip_get_archive_file_start_offset(mz_zip_archive *pZip) {
function MZ_FILE (line 10071) | MZ_FILE *mz_zip_get_cfile(mz_zip_archive *pZip) {
function mz_zip_read_archive_data (line 10077) | size_t mz_zip_read_archive_data(mz_zip_archive *pZip, mz_uint64 file_ofs,
function mz_uint (line 10085) | mz_uint mz_zip_reader_get_filename(mz_zip_archive *pZip, mz_uint file_in...
function mz_bool (line 10104) | mz_bool mz_zip_reader_file_stat(mz_zip_archive *pZip, mz_uint file_index,
function mz_bool (line 10110) | mz_bool mz_zip_end(mz_zip_archive *pZip) {
FILE: stable-diffusion.cpp.patches/llamafile-files/zip.c
type zip_entry_t (line 85) | struct zip_entry_t {
type zip_t (line 101) | struct zip_t {
type zip_modify_t (line 107) | enum zip_modify_t {
type zip_entry_mark_t (line 113) | struct zip_entry_mark_t {
function zip_mkpath (line 184) | static int zip_mkpath(char *path) {
function mz_bool (line 271) | static mz_bool zip_name_match(const char *name1, const char *name2) {
function zip_archive_truncate (line 289) | static int zip_archive_truncate(mz_zip_archive *pzip) {
function zip_archive_extract (line 304) | static int zip_archive_extract(mz_zip_archive *zip_archive, const char *...
function zip_archive_finalize (line 432) | static inline void zip_archive_finalize(mz_zip_archive *pzip) {
function zip_entry_mark (line 437) | static ssize_t zip_entry_mark(struct zip_t *zip,
function zip_index_next (line 494) | static ssize_t zip_index_next(mz_uint64 *local_header_ofs_array,
function zip_sort (line 506) | static ssize_t zip_sort(mz_uint64 *local_header_ofs_array, ssize_t cur_i...
function zip_index_update (line 520) | static int zip_index_update(struct zip_entry_mark_t *entry_mark,
function zip_entry_finalize (line 532) | static int zip_entry_finalize(struct zip_t *zip,
function zip_entry_set (line 573) | static ssize_t zip_entry_set(struct zip_t *zip,
function zip_file_move (line 587) | static ssize_t zip_file_move(MZ_FILE *m_pFile, const mz_uint64 to,
function zip_files_move (line 608) | static ssize_t zip_files_move(MZ_FILE *m_pFile, mz_uint64 writen_num,
function zip_central_dir_move (line 643) | static int zip_central_dir_move(mz_zip_internal_state *pState, int begin,
function zip_central_dir_delete (line 695) | static int zip_central_dir_delete(mz_zip_internal_state *pState,
function zip_entries_delete_mark (line 744) | static ssize_t zip_entries_delete_mark(struct zip_t *zip,
type zip_t (line 818) | struct zip_t
type zip_t (line 823) | struct zip_t
type zip_t (line 825) | struct zip_t
type zip_t (line 842) | struct zip_t
type zip_t (line 842) | struct zip_t
function zip_close (line 904) | void zip_close(struct zip_t *zip) {
function zip_is64 (line 926) | int zip_is64(struct zip_t *zip) {
function _zip_entry_open (line 935) | static int _zip_entry_open(struct zip_t *zip, const char *entryname,
function zip_entry_open (line 1135) | int zip_entry_open(struct zip_t *zip, const char *entryname) {
function zip_entry_opencasesensitive (line 1139) | int zip_entry_opencasesensitive(struct zip_t *zip, const char *entryname) {
function zip_entry_openbyindex (line 1143) | int zip_entry_openbyindex(struct zip_t *zip, size_t index) {
function zip_entry_close (line 1221) | int zip_entry_close(struct zip_t *zip) {
type zip_t (line 1315) | struct zip_t
function zip_entry_index (line 1324) | ssize_t zip_entry_index(struct zip_t *zip) {
function zip_entry_isdir (line 1333) | int zip_entry_isdir(struct zip_t *zip) {
function zip_entry_size (line 1348) | unsigned long long zip_entry_size(struct zip_t *zip) {
function zip_entry_uncomp_size (line 1352) | unsigned long long zip_entry_uncomp_size(struct zip_t *zip) {
function zip_entry_comp_size (line 1356) | unsigned long long zip_entry_comp_size(struct zip_t *zip) {
function zip_entry_crc32 (line 1360) | unsigned int zip_entry_crc32(struct zip_t *zip) {
function zip_entry_write (line 1364) | int zip_entry_write(struct zip_t *zip, const void *buf, size_t bufsize) {
function zip_entry_fwrite (line 1402) | int zip_entry_fwrite(struct zip_t *zip, const char *filename) {
function zip_entry_read (line 1467) | ssize_t zip_entry_read(struct zip_t *zip, void **buf, size_t *bufsize) {
function zip_entry_noallocread (line 1497) | ssize_t zip_entry_noallocread(struct zip_t *zip, void *buf, size_t bufsi...
function zip_entry_fread (line 1520) | int zip_entry_fread(struct zip_t *zip, const char *filename) {
function zip_entry_extract (line 1568) | int zip_entry_extract(struct zip_t *zip,
function zip_entries_total (line 1593) | ssize_t zip_entries_total(struct zip_t *zip) {
function zip_entries_delete (line 1602) | ssize_t zip_entries_delete(struct zip_t *zip, char *const entries[],
function zip_stream_extract (line 1637) | int zip_stream_extract(const char *stream, size_t size, const char *dir,
type zip_t (line 1657) | struct zip_t
type zip_t (line 1663) | struct zip_t
type zip_t (line 1665) | struct zip_t
type zip_t (line 1665) | struct zip_t
type zip_t (line 1665) | struct zip_t
function zip_stream_copy (line 1707) | ssize_t zip_stream_copy(struct zip_t *zip, void **buf, size_t *bufsize) {
function zip_stream_close (line 1726) | void zip_stream_close(struct zip_t *zip) {
function zip_create (line 1734) | int zip_create(const char *zipname, const char *filenames[], size_t len) {
function zip_extract (line 1816) | int zip_extract(const char *zipname, const char *dir,
function mz_ulong (line 1847) | mz_ulong mz_crc32(mz_ulong init, const uint8_t *buf, size_t len) {
FILE: stable-diffusion.cpp.patches/llamafile-files/zip.h
type zip_t (line 113) | struct zip_t
type zip_t (line 152) | struct zip_t
type zip_t (line 162) | struct zip_t
type zip_t (line 176) | struct zip_t
type zip_t (line 190) | struct zip_t
type zip_t (line 203) | struct zip_t
type zip_t (line 212) | struct zip_t
type zip_t (line 228) | struct zip_t
type zip_t (line 237) | struct zip_t
type zip_t (line 247) | struct zip_t
type zip_t (line 257) | struct zip_t
type zip_t (line 266) | struct zip_t
type zip_t (line 275) | struct zip_t
type zip_t (line 284) | struct zip_t
type zip_t (line 295) | struct zip_t
type zip_t (line 306) | struct zip_t
type zip_t (line 323) | struct zip_t
type zip_t (line 343) | struct zip_t
type zip_t (line 354) | struct zip_t
type zip_t (line 367) | struct zip_t
type zip_t (line 380) | struct zip_t
type zip_t (line 390) | struct zip_t
type zip_t (line 460) | struct zip_t
type zip_t (line 470) | struct zip_t
FILE: tests/extract_data_uris_test.cpp
function TEST (line 63) | TEST(plain_text_no_data_uri) {
function TEST (line 73) | TEST(text_with_invalid_data_uri) {
function TEST (line 83) | TEST(text_with_non_image_data_uri) {
function TEST (line 93) | TEST(trailing_invalid_data_uri) {
function TEST (line 103) | TEST(valid_png_data_uri) {
function TEST (line 117) | TEST(valid_gif_data_uri) {
function TEST (line 130) | TEST(multiple_images) {
function TEST (line 146) | TEST(valid_image_followed_by_trailing_data) {
function TEST (line 160) | TEST(empty_string) {
function TEST (line 169) | TEST(marker_is_stored) {
function main (line 176) | int main(int argc, char *argv[]) {
FILE: tests/integration/conftest.py
function pytest_addoption (line 18) | def pytest_addoption(parser):
function executable (line 55) | def executable(request) -> str:
function model (line 72) | def model(request) -> str | None:
function gpu_mode (line 85) | def gpu_mode(request) -> str | None:
function mmproj (line 94) | def mmproj(request) -> str | None:
function timeout_multiplier (line 107) | def timeout_multiplier(request) -> float:
class Timeouts (line 112) | class Timeouts:
method __init__ (line 115) | def __init__(self, multiplier: float):
function timeouts (line 125) | def timeouts(timeout_multiplier) -> Timeouts:
function llamafile (line 131) | def llamafile(executable, model, gpu_mode) -> LlamafileRunner:
function fixtures_dir (line 141) | def fixtures_dir() -> Path:
function test_image (line 147) | def test_image(fixtures_dir) -> Path:
function server_port (line 156) | def server_port() -> int:
FILE: tests/integration/tests/test_cli.py
class TestCLIBasic (line 7) | class TestCLIBasic:
method test_cli_responds (line 10) | def test_cli_responds(self, llamafile, timeouts):
method test_cli_math_question (line 17) | def test_cli_math_question(self, llamafile, timeouts):
method test_cli_exits_cleanly (line 26) | def test_cli_exits_cleanly(self, llamafile, timeouts):
class TestCLIThinking (line 35) | class TestCLIThinking:
method test_thinking_enabled (line 38) | def test_thinking_enabled(self, llamafile, timeouts):
method test_nothink_removes_thinking (line 50) | def test_nothink_removes_thinking(self, llamafile, timeouts):
method test_nothink_shorter_output (line 62) | def test_nothink_shorter_output(self, llamafile, timeouts):
FILE: tests/integration/tests/test_combined.py
class TestCombinedMode (line 11) | class TestCombinedMode:
method test_combined_server_responds (line 14) | def test_combined_server_responds(self, llamafile, server_port, timeou...
method test_combined_tui_and_server_simultaneously (line 36) | def test_combined_tui_and_server_simultaneously(self, llamafile, serve...
FILE: tests/integration/tests/test_gpu.py
function get_available_gpu (line 13) | def get_available_gpu() -> str | None:
function check_gpu_in_output (line 48) | def check_gpu_in_output(log_output: str) -> dict:
function available_gpu (line 115) | def available_gpu():
class TestGPUAcceleration (line 124) | class TestGPUAcceleration:
method test_gpu_cli (line 127) | def test_gpu_cli(self, executable, model, available_gpu, timeouts):
method test_gpu_server (line 161) | def test_gpu_server(self, executable, model, available_gpu, server_por...
class TestCPUExecution (line 207) | class TestCPUExecution:
method test_cpu_cli (line 210) | def test_cpu_cli(self, executable, model, timeouts):
method test_cpu_server (line 244) | def test_cpu_server(self, executable, model, server_port, timeouts):
FILE: tests/integration/tests/test_multimodal.py
class TestMultimodalCLI (line 10) | class TestMultimodalCLI:
method _image_args (line 17) | def _image_args(self, mmproj, image_path):
method test_cli_describe_image (line 24) | def test_cli_describe_image(self, llamafile, mmproj, test_image, timeo...
method test_cli_image_question (line 35) | def test_cli_image_question(self, llamafile, mmproj, test_image, timeo...
method test_cli_multiple_images_with_markers (line 48) | def test_cli_multiple_images_with_markers(self, llamafile, mmproj, tes...
method test_cli_multiple_images_marker_mismatch (line 60) | def test_cli_multiple_images_marker_mismatch(self, llamafile, mmproj, ...
class TestMultimodalTUI (line 75) | class TestMultimodalTUI:
method _mmproj_args (line 78) | def _mmproj_args(self, mmproj):
method test_tui_describe_image (line 84) | def test_tui_describe_image(self, llamafile, mmproj, test_image, tmp_p...
method test_tui_image_question (line 96) | def test_tui_image_question(self, llamafile, mmproj, test_image, tmp_p...
class TestMultimodalServer (line 115) | class TestMultimodalServer:
method _mmproj_args (line 118) | def _mmproj_args(self, mmproj):
method test_server_describe_image (line 124) | def test_server_describe_image(self, llamafile, mmproj, test_image, se...
method test_server_image_question (line 149) | def test_server_image_question(self, llamafile, mmproj, test_image, se...
FILE: tests/integration/tests/test_server.py
class TestServerBasic (line 9) | class TestServerBasic:
method test_server_starts_and_responds (line 12) | def test_server_starts_and_responds(self, llamafile, server_port, time...
method test_server_chat_completion (line 25) | def test_server_chat_completion(self, llamafile, server_port, timeouts):
method test_server_chat_completion_math (line 50) | def test_server_chat_completion_math(self, llamafile, server_port, tim...
class TestServerParameters (line 78) | class TestServerParameters:
method test_server_with_temperature_zero (line 81) | def test_server_with_temperature_zero(self, llamafile, server_port, ti...
method test_server_with_max_tokens (line 127) | def test_server_with_max_tokens(self, llamafile, server_port, timeouts):
FILE: tests/integration/tests/test_tool_calling.py
class TestToolCalling (line 50) | class TestToolCalling:
method test_tool_call_basic (line 53) | def test_tool_call_basic(self, llamafile, server_port, timeouts):
method test_tool_call_correct_function (line 88) | def test_tool_call_correct_function(self, llamafile, server_port, time...
method test_tool_call_with_arguments (line 119) | def test_tool_call_with_arguments(self, llamafile, server_port, timeou...
FILE: tests/integration/tests/test_tui.py
class TestTUIBasic (line 7) | class TestTUIBasic:
method test_tui_responds_to_hello (line 10) | def test_tui_responds_to_hello(self, llamafile, tmp_path, timeouts):
method test_tui_math_question (line 21) | def test_tui_math_question(self, llamafile, tmp_path, timeouts):
method test_tui_multi_turn (line 32) | def test_tui_multi_turn(self, llamafile, tmp_path, timeouts):
method test_tui_exits_cleanly (line 43) | def test_tui_exits_cleanly(self, llamafile, tmp_path, timeouts):
class TestTUIThinking (line 55) | class TestTUIThinking:
method test_tui_thinking_visible (line 58) | def test_tui_thinking_visible(self, llamafile, tmp_path, timeouts):
FILE: tests/integration/utils/llamafile.py
function read_until_idle (line 19) | def read_until_idle(fd, idle_timeout=1.0, max_timeout=60.0):
function stop_tui (line 67) | def stop_tui(proc, timeout=30):
class LlamafileRunner (line 95) | class LlamafileRunner:
method __init__ (line 113) | def __init__(
method _base_args (line 135) | def _base_args(self) -> list[str]:
method run_cli (line 151) | def run_cli(
method run_tui (line 208) | def run_tui(
method start_server (line 265) | def start_server(
method start_combined (line 299) | def start_combined(
method read_log_file (line 335) | def read_log_file(log_file: str) -> str:
method wait_for_server (line 352) | def wait_for_server(
method chat_completion (line 387) | def chat_completion(
method chat_completion_streaming (line 443) | def chat_completion_streaming(
method chat_completion_with_image (line 521) | def chat_completion_with_image(
FILE: tests/sgemm/iqk_test.cpp
function micros (line 110) | static inline long long micros(void) {
function get_num_threads (line 129) | static int get_num_threads() {
function rand32 (line 136) | static inline int rand32(void) {
function rand_float (line 142) | static inline float rand_float(void) {
function randomize_floats (line 146) | static void randomize_floats(float *data, size_t count) {
function iqk_mul_mat_openmp (line 157) | static bool iqk_mul_mat_openmp(long Nx, long Ny, long ne00, int typeA,
function reference_matmul (line 187) | static void reference_matmul(long Nx, long Ny, long ne00, int typeA,
function test_quant_type (line 240) | static int test_quant_type(int typeA, const char *type_name) {
function print_test_info (line 406) | static void print_test_info() {
function main (line 433) | int main(int argc, char *argv[]) {
FILE: tests/sgemm/q8_0_layout_test.cpp
function main (line 36) | int main() {
FILE: tests/sgemm/sgemm_matmul_test.cpp
function get_num_threads (line 84) | static int get_num_threads() {
function llamafile_sgemm_openmp (line 89) | bool llamafile_sgemm_openmp(long m, long n, long k, const void *A, long ...
function test (line 102) | int test(void) {
function print_test_info (line 190) | void print_test_info() {
function main (line 211) | int main(int argc, char *argv[]) {
FILE: tests/sgemm/sgemm_sss_test.cpp
function get_num_threads (line 83) | static int get_num_threads() {
function llamafile_sgemm_openmp (line 88) | bool llamafile_sgemm_openmp(long m, long n, long k, const void *A, long ...
function test (line 101) | int test(void) {
function print_test_info (line 185) | void print_test_info() {
function main (line 207) | int main(int argc, char *argv[]) {
FILE: tests/sgemm/sgemm_test_utils.h
function micros (line 18) | static inline long long micros(void) {
function rand32 (line 42) | static inline int rand32(void) {
function float01 (line 49) | static inline float float01(unsigned x) {
function numba (line 53) | static inline float numba(void) {
function namespace (line 71) | namespace flt {
function namespace (line 88) | namespace ansiBLAS {
function sgemm (line 191) | inline void sgemm(int m, int n, int k, const float *A, int lda, const fl...
function namespace (line 210) | namespace ggmlBLAS {
FILE: tests/sgemm/sgemm_vecdot_test.cpp
function get_num_threads (line 86) | static int get_num_threads() {
function llamafile_sgemm_openmp (line 91) | bool llamafile_sgemm_openmp(long m, long n, long k, const void *A, long ...
function test (line 104) | int test(void) {
function print_test_info (line 188) | void print_test_info() {
function main (line 212) | int main(int argc, char *argv[]) {
FILE: third_party/double-conversion/bignum-dtoa.cc
type double_conversion (line 35) | namespace double_conversion {
function NormalizedExponent (line 37) | static int NormalizedExponent(uint64_t significand, int exponent) {
function BignumDtoa (line 89) | void BignumDtoa(double v, BignumDtoaMode mode, int requested_digits,
function GenerateShortestDigits (line 185) | static void GenerateShortestDigits(Bignum* numerator, Bignum* denomina...
function GenerateCountedDigits (line 283) | static void GenerateCountedDigits(int count, int* decimal_point,
function BignumToFixed (line 326) | static void BignumToFixed(int requested_digits, int* decimal_point,
function EstimatePower (line 385) | static int EstimatePower(int exponent) {
function InitialScaledStartValuesPositiveExponent (line 417) | static void InitialScaledStartValuesPositiveExponent(
function InitialScaledStartValuesNegativeExponentPositivePower (line 450) | static void InitialScaledStartValuesNegativeExponentPositivePower(
function InitialScaledStartValuesNegativeExponentNegativePower (line 484) | static void InitialScaledStartValuesNegativeExponentNegativePower(
function InitialScaledStartValues (line 568) | static void InitialScaledStartValues(uint64_t significand,
function FixupMultiply10 (line 612) | static void FixupMultiply10(int estimated_power, bool is_even,
FILE: third_party/double-conversion/bignum-dtoa.h
function namespace (line 33) | namespace double_conversion {
FILE: third_party/double-conversion/bignum.cc
type double_conversion (line 34) | namespace double_conversion {
function BitSize (line 49) | static int BitSize(const S value) {
function ReadUInt64 (line 84) | static uint64_t ReadUInt64(const Vector<const char> buffer,
function HexCharValue (line 118) | static uint64_t HexCharValue(const int c) {
function SizeInHexChars (line 569) | static int SizeInHexChars(S number) {
function HexCharOfValue (line 580) | static char HexCharOfValue(const int value) {
FILE: third_party/double-conversion/bignum.h
function namespace (line 33) | namespace double_conversion {
FILE: third_party/double-conversion/cached-powers.cc
type double_conversion (line 36) | namespace double_conversion {
type PowersOfTenCache (line 38) | namespace PowersOfTenCache {
type CachedPower (line 40) | struct CachedPower {
function GetCachedPowerForBinaryExponentRange (line 139) | void GetCachedPowerForBinaryExponentRange(
function GetCachedPowerForDecimalExponent (line 159) | void GetCachedPowerForDecimalExponent(int requested_exponent,
FILE: third_party/double-conversion/cached-powers.h
function namespace (line 33) | namespace double_conversion {
FILE: third_party/double-conversion/diy-fp.h
function namespace (line 33) | namespace double_conversion {
FILE: third_party/double-conversion/double-to-string.cc
type double_conversion (line 40) | namespace double_conversion {
function DoubleToStringConverter (line 42) | const DoubleToStringConverter& DoubleToStringConverter::EcmaScriptConv...
function BignumDtoaMode (line 372) | static BignumDtoaMode DtoaToBignumDtoaMode(
FILE: third_party/double-conversion/double-to-string.h
function namespace (line 33) | namespace double_conversion {
FILE: third_party/double-conversion/fast-dtoa.cc
type double_conversion (line 34) | namespace double_conversion {
function RoundWeed (line 61) | static bool RoundWeed(Vector<char> buffer,
function RoundWeedCounted (line 181) | static bool RoundWeedCounted(Vector<char> buffer,
function BiggestPowerTen (line 240) | static void BiggestPowerTen(uint32_t number,
function DigitGen (line 300) | static bool DigitGen(DiyFp low,
function DigitGenCounted (line 428) | static bool DigitGenCounted(DiyFp w,
function Grisu3 (line 519) | static bool Grisu3(double v,
function Grisu3Counted (line 591) | static bool Grisu3Counted(double v,
function FastDtoa (line 635) | bool FastDtoa(double v,
FILE: third_party/double-conversion/fast-dtoa.h
function namespace (line 33) | namespace double_conversion {
FILE: third_party/double-conversion/fixed-dtoa.cc
type double_conversion (line 33) | namespace double_conversion {
class UInt128 (line 37) | class UInt128 {
method UInt128 (line 39) | UInt128() : high_bits_(0), low_bits_(0) { }
method UInt128 (line 40) | UInt128(uint64_t high, uint64_t low) : high_bits_(high), low_bits_(l...
method Multiply (line 42) | void Multiply(uint32_t multiplicand) {
method Shift (line 59) | void Shift(int shift_amount) {
method DivModPowerOf2 (line 82) | int DivModPowerOf2(int power) {
method IsZero (line 97) | bool IsZero() const {
method BitAt (line 101) | int BitAt(int position) const {
function FillDigits32FixedLength (line 120) | static void FillDigits32FixedLength(uint32_t number, int requested_len...
function FillDigits32 (line 130) | static void FillDigits32(uint32_t number, Vector<char> buffer, int* le...
function FillDigits64FixedLength (line 153) | static void FillDigits64FixedLength(uint64_t number,
function FillDigits64 (line 168) | static void FillDigits64(uint64_t number, Vector<char> buffer, int* le...
function RoundUp (line 189) | static void RoundUp(Vector<char> buffer, int* length, int* decimal_poi...
function FillFractionals (line 230) | static void FillFractionals(uint64_t fractionals, int exponent,
function TrimZeros (line 292) | static void TrimZeros(Vector<char> buffer, int* length, int* decimal_p...
function FastFixedDtoa (line 310) | bool FastFixedDtoa(double v,
FILE: third_party/double-conversion/fixed-dtoa.h
function namespace (line 33) | namespace double_conversion {
FILE: third_party/double-conversion/ieee.h
function namespace (line 33) | namespace double_conversion {
function IsDenormal (line 134) | bool IsDenormal() const {
function IsNan (line 146) | bool IsNan() const {
function IsInfinite (line 169) | bool IsInfinite() const {
function DiyFp (line 182) | DiyFp UpperBoundary() const {
function SignificandSizeForOrderOfMagnitude (line 228) | static int SignificandSizeForOrderOfMagnitude(int order) {
function Infinity (line 236) | static double Infinity() {
function NaN (line 240) | static double NaN() {
function DiyFpToUint64 (line 256) | static uint64_t DiyFpToUint64(DiyFp diy_fp) {
function class (line 286) | class Single {
function IsDenormal (line 333) | bool IsDenormal() const {
function IsNan (line 345) | bool IsNan() const {
function IsInfinite (line 368) | bool IsInfinite() const {
function NormalizedBoundaries (line 383) | void NormalizedBoundaries(DiyFp* out_m_minus, DiyFp* out_m_plus) const {
function DiyFp (line 401) | DiyFp UpperBoundary() const {
function Infinity (line 421) | static float Infinity() {
function NaN (line 425) | static float NaN() {
FILE: third_party/double-conversion/string-to-double.cc
type double_conversion (line 52) | namespace double_conversion {
function ToLower (line 56) | inline char ToLower(char ch) {
function Pass (line 62) | inline char Pass(char ch) {
function ConsumeSubStringImpl (line 67) | static inline bool ConsumeSubStringImpl(Iterator* current,
function ConsumeSubString (line 85) | static bool ConsumeSubString(Iterator* current,
function ConsumeFirstCharacter (line 97) | inline bool ConsumeFirstCharacter(char ch,
function isWhitespace (line 125) | static bool isWhitespace(int x) {
function AdvanceToNonspace (line 141) | static inline bool AdvanceToNonspace(Iterator* current, Iterator end) {
function isDigit (line 150) | static bool isDigit(int x, int radix) {
function SignedZero (line 157) | static double SignedZero(bool sign) {
function IsDecimalDigitForRadix (line 170) | static bool IsDecimalDigitForRadix(int c, int radix) {
function IsDecimalDigitForRadix (line 175) | static bool inline IsDecimalDigitForRadix(int c, int radix) {
function IsCharacterDigitForRadix (line 186) | static bool IsCharacterDigitForRadix(int c, int radix, char a_characte...
function Advance (line 192) | static bool Advance (Iterator* it, uc16 separator, int base, Iterator&...
function IsHexFloatString (line 218) | static bool IsHexFloatString(Iterator start,
function RadixStringToIeee (line 258) | static double RadixStringToIeee(Iterator* current,
FILE: third_party/double-conversion/string-to-double.h
function namespace (line 33) | namespace double_conversion {
FILE: third_party/double-conversion/strtod.cc
type double_conversion (line 36) | namespace double_conversion {
function TrimLeadingZeros (line 95) | static Vector<const char> TrimLeadingZeros(Vector<const char> buffer) {
function CutToMaxSignificantDigits (line 104) | static void CutToMaxSignificantDigits(Vector<const char> buffer,
function TrimAndCut (line 126) | static void TrimAndCut(Vector<const char> buffer, int exponent,
function ReadUint64 (line 151) | static uint64_t ReadUint64(Vector<const char> buffer,
function ReadDiyFp (line 169) | static void ReadDiyFp(Vector<const char> buffer,
function DoubleStrtod (line 190) | static bool DoubleStrtod(Vector<const char> trimmed,
function DiyFp (line 247) | static DiyFp AdjustmentPowerOfTen(int exponent) {
function DiyFpStrtod (line 270) | static bool DiyFpStrtod(Vector<const char> buffer,
function CompareBufferWithDiyFp (line 388) | static int CompareBufferWithDiyFp(Vector<const char> buffer,
function ComputeGuess (line 419) | static bool ComputeGuess(Vector<const char> trimmed, int exponent,
function IsDigit (line 444) | static bool IsDigit(const char d) {
function IsNonZeroDigit (line 448) | static bool IsNonZeroDigit(const char d) {
function AssertTrimmedDigits (line 457) | static bool AssertTrimmedDigits(const Vector<const char>& buffer) {
function StrtodTrimmed (line 466) | double StrtodTrimmed(Vector<const char> trimmed, int exponent) {
function Strtod (line 488) | double Strtod(Vector<const char> buffer, int exponent) {
function SanitizedDoubletof (line 497) | static float SanitizedDoubletof(double d) {
function Strtof (line 521) | float Strtof(Vector<const char> buffer, int exponent) {
function StrtofTrimmed (line 531) | float StrtofTrimmed(Vector<const char> trimmed, int exponent) {
FILE: third_party/double-conversion/strtod.h
function namespace (line 33) | namespace double_conversion {
FILE: third_party/double-conversion/utils.h
function abort_noreturn (line 74) | inline void abort_noreturn() { abort(); }
type __int64 (line 180) | typedef __int64 int64_t;
type uc16 (line 190) | typedef uint16_t uc16;
function namespace (line 239) | namespace double_conversion {
FILE: third_party/mbedtls/aes.c
function dontinline (line 370) | static dontinline void aes_gen_tables( void )
function mbedtls_aes_uses_hardware (line 472) | int mbedtls_aes_uses_hardware( void )
function mbedtls_aes_init (line 492) | void mbedtls_aes_init( mbedtls_aes_context *ctx )
function mbedtls_aes_free (line 498) | void mbedtls_aes_free( mbedtls_aes_context *ctx )
function mbedtls_aes_xts_init (line 506) | void mbedtls_aes_xts_init( mbedtls_aes_xts_context *ctx )
function mbedtls_aes_xts_free (line 513) | void mbedtls_aes_xts_free( mbedtls_aes_xts_context *ctx )
function mbedtls_aes_setkey_enc (line 526) | int mbedtls_aes_setkey_enc( mbedtls_aes_context *ctx, const unsigned cha...
function mbedtls_aes_setkey_dec (line 627) | int mbedtls_aes_setkey_dec( mbedtls_aes_context *ctx, const unsigned cha...
function mbedtls_aes_xts_decode_keys (line 691) | static int mbedtls_aes_xts_decode_keys( const unsigned char *key,
function mbedtls_aes_xts_setkey_enc (line 713) | int mbedtls_aes_xts_setkey_enc( mbedtls_aes_xts_context *ctx,
function mbedtls_aes_xts_setkey_dec (line 734) | int mbedtls_aes_xts_setkey_dec( mbedtls_aes_xts_context *ctx,
function mbedtls_internal_aes_encrypt (line 802) | int mbedtls_internal_aes_encrypt( mbedtls_aes_context *ctx,
function mbedtls_internal_aes_decrypt (line 856) | int mbedtls_internal_aes_decrypt( mbedtls_aes_context *ctx,
function mbedtls_aes_crypt_ecb (line 909) | int mbedtls_aes_crypt_ecb( mbedtls_aes_context *ctx,
function mbedtls_aes_crypt_cbc (line 947) | int mbedtls_aes_crypt_cbc( mbedtls_aes_context *ctx,
function mbedtls_gf128mul_x_ble (line 1017) | static void mbedtls_gf128mul_x_ble( unsigned char r[16],
function mbedtls_aes_crypt_xts (line 1032) | int mbedtls_aes_crypt_xts( mbedtls_aes_xts_context *ctx,
function mbedtls_aes_crypt_cfb128 (line 1125) | int mbedtls_aes_crypt_cfb128( mbedtls_aes_context *ctx,
function mbedtls_aes_crypt_cfb8 (line 1174) | int mbedtls_aes_crypt_cfb8( mbedtls_aes_context *ctx,
function mbedtls_aes_crypt_ofb (line 1208) | int mbedtls_aes_crypt_ofb( mbedtls_aes_context *ctx,
function mbedtls_aes_crypt_ctr (line 1246) | int mbedtls_aes_crypt_ctr( mbedtls_aes_context *ctx,
function mbedtls_aes_self_test (line 1598) | int mbedtls_aes_self_test( int verbose )
FILE: third_party/mbedtls/aes.h
type mbedtls_aes_context (line 26) | typedef struct mbedtls_aes_context
type mbedtls_aes_xts_context (line 45) | typedef struct mbedtls_aes_xts_context
FILE: third_party/mbedtls/aesce.c
function uint8x16_t (line 87) | static uint8x16_t aesce_encrypt_block(uint8x16_t block,
function uint8x16_t (line 111) | static uint8x16_t aesce_decrypt_block(uint8x16_t block,
function mbedtls_aesce_crypt_ecb (line 147) | int mbedtls_aesce_crypt_ecb(mbedtls_aes_context *ctx,
function mbedtls_aesce_inverse_key (line 168) | void mbedtls_aesce_inverse_key(unsigned char *invkey,
function aes_rot_word (line 183) | static inline uint32_t aes_rot_word(uint32_t word)
function aes_sub_word (line 188) | static inline uint32_t aes_sub_word(uint32_t in)
function aesce_setkey_enc (line 202) | static void aesce_setkey_enc(unsigned char *rk,
function mbedtls_aesce_setkey_enc (line 257) | int mbedtls_aesce_setkey_enc(unsigned char *rk,
function poly64_t (line 280) | static inline poly64_t vget_low_p64(poly64x2_t __a)
function uint8x16_t (line 293) | static inline uint8x16_t pmull_low(uint8x16_t a, uint8x16_t b)
function uint8x16_t (line 301) | static inline uint8x16_t pmull_high(uint8x16_t a, uint8x16_t b)
function uint8x16x3_t (line 324) | static inline uint8x16x3_t poly_mult_128(uint8x16_t a, uint8x16_t b)
function uint8x16_t (line 357) | static inline uint8x16_t poly_mult_reduce(uint8x16x3_t input)
function mbedtls_aesce_gcm_mult (line 382) | void mbedtls_aesce_gcm_mult(unsigned char c[16],
FILE: third_party/mbedtls/aesni.c
function mbedtls_aesni_crypt_ecb (line 71) | int mbedtls_aesni_crypt_ecb( mbedtls_aes_context *ctx,
function mbedtls_aesni_gcm_mult (line 125) | void mbedtls_aesni_gcm_mult( unsigned char a[16], const uint64_t b[2] )
function mbedtls_aesni_inverse_key (line 233) | void mbedtls_aesni_inverse_key( unsigned char *invkey,
function aesni_setkey_enc_128 (line 255) | static void aesni_setkey_enc_128( unsigned char *rk,
function aesni_setkey_enc_192 (line 305) | static void aesni_setkey_enc_192( unsigned char *rk,
function aesni_setkey_enc_256 (line 362) | static void aesni_setkey_enc_256( unsigned char *rk,
function mbedtls_aesni_setkey_enc (line 437) | int mbedtls_aesni_setkey_enc( unsigned char *rk,
FILE: third_party/mbedtls/asn1.h
type mbedtls_asn1_buf (line 119) | typedef struct mbedtls_asn1_buf
type mbedtls_asn1_bitstring (line 130) | typedef struct mbedtls_asn1_bitstring
type mbedtls_asn1_sequence (line 141) | typedef struct mbedtls_asn1_sequence
type mbedtls_asn1_named_data (line 151) | typedef struct mbedtls_asn1_named_data
function forceinline (line 178) | forceinline int mbedtls_asn1_get_len( unsigned char **p,
function forceinline (line 213) | forceinline int mbedtls_asn1_get_tag( unsigned char **p,
FILE: third_party/mbedtls/asn1parse.c
function mbedtls_asn1_get_len_impl (line 31) | int mbedtls_asn1_get_len_impl( unsigned char **p,
function mbedtls_asn1_get_bool (line 78) | int mbedtls_asn1_get_bool( unsigned char **p,
function asn1_get_tagged_int (line 93) | static int asn1_get_tagged_int( unsigned char **p,
function mbedtls_asn1_get_int (line 131) | int mbedtls_asn1_get_int( unsigned char **p,
function mbedtls_asn1_get_enum (line 138) | int mbedtls_asn1_get_enum( unsigned char **p,
function mbedtls_asn1_get_mpi (line 145) | int mbedtls_asn1_get_mpi( unsigned char **p,
function mbedtls_asn1_get_bitstring (line 158) | int mbedtls_asn1_get_bitstring( unsigned char **p,
function mbedtls_asn1_traverse_sequence_of (line 187) | int mbedtls_asn1_traverse_sequence_of(
function mbedtls_asn1_get_bitstring_null (line 230) | int mbedtls_asn1_get_bitstring_null( unsigned char **p,
function mbedtls_asn1_sequence_free (line 246) | void mbedtls_asn1_sequence_free( mbedtls_asn1_sequence *seq )
type asn1_get_sequence_of_cb_ctx_t (line 257) | typedef struct
function asn1_get_sequence_of_cb (line 263) | static int asn1_get_sequence_of_cb( void *ctx,
function mbedtls_asn1_get_sequence_of (line 290) | int mbedtls_asn1_get_sequence_of( unsigned char **p,
function mbedtls_asn1_get_alg (line 302) | int mbedtls_asn1_get_alg( unsigned char **p,
function mbedtls_asn1_get_alg_null (line 336) | int mbedtls_asn1_get_alg_null( unsigned char **p,
function mbedtls_asn1_free_named_data (line 350) | void mbedtls_asn1_free_named_data( mbedtls_asn1_named_data *cur )
function mbedtls_asn1_free_named_data_list (line 359) | void mbedtls_asn1_free_named_data_list( mbedtls_asn1_named_data **head )
function mbedtls_asn1_named_data (line 370) | mbedtls_asn1_named_data *
FILE: third_party/mbedtls/asn1write.c
function mbedtls_asn1_write_len (line 43) | int mbedtls_asn1_write_len( unsigned char **p, unsigned char *start, siz...
function mbedtls_asn1_write_tag (line 109) | int mbedtls_asn1_write_tag( unsigned char **p, unsigned char *start, uns...
function mbedtls_asn1_write_raw_buffer (line 130) | int mbedtls_asn1_write_raw_buffer( unsigned char **p, unsigned char *start,
function mbedtls_asn1_write_mpi (line 157) | int mbedtls_asn1_write_mpi( unsigned char **p, unsigned char *start, con...
function mbedtls_asn1_write_null (line 198) | int mbedtls_asn1_write_null( unsigned char **p, unsigned char *start )
function mbedtls_asn1_write_oid (line 223) | int mbedtls_asn1_write_oid( unsigned char **p, unsigned char *start,
function mbedtls_asn1_write_algorithm_identifier (line 250) | int mbedtls_asn1_write_algorithm_identifier( unsigned char **p, unsigned...
function mbedtls_asn1_write_bool (line 280) | int mbedtls_asn1_write_bool( unsigned char **p, unsigned char *start, in...
function asn1_write_tagged_int (line 293) | static int asn1_write_tagged_int( unsigned char **p, unsigned char *star...
function mbedtls_asn1_write_int (line 332) | int mbedtls_asn1_write_int( unsigned char **p, unsigned char *start, int...
function mbedtls_asn1_write_enum (line 350) | int mbedtls_asn1_write_enum( unsigned char **p, unsigned char *start, in...
function mbedtls_asn1_write_tagged_string (line 372) | int mbedtls_asn1_write_tagged_string( unsigned char **p, unsigned char *...
function mbedtls_asn1_write_utf8_string (line 399) | int mbedtls_asn1_write_utf8_string( unsigned char **p, unsigned char *st...
function mbedtls_asn1_write_printable_string (line 420) | int mbedtls_asn1_write_printable_string( unsigned char **p, unsigned cha...
function mbedtls_asn1_write_ia5_string (line 441) | int mbedtls_asn1_write_ia5_string( unsigned char **p, unsigned char *start,
function mbedtls_asn1_write_named_bitstring (line 464) | int mbedtls_asn1_write_named_bitstring( unsigned char **p,
function mbedtls_asn1_write_bitstring (line 514) | int mbedtls_asn1_write_bitstring( unsigned char **p, unsigned char *start,
function mbedtls_asn1_write_octet_string (line 554) | int mbedtls_asn1_write_octet_string( unsigned char **p, unsigned char *s...
function mbedtls_asn1_named_data (line 567) | static mbedtls_asn1_named_data *asn1_find_named_data(
function mbedtls_asn1_named_data (line 604) | mbedtls_asn1_named_data *mbedtls_asn1_store_named_data(mbedtls_asn1_name...
FILE: third_party/mbedtls/base64.c
function forceinline (line 48) | forceinline void mbedtls_base64_cond_assign_uchar( unsigned char * dest,
function forceinline (line 62) | forceinline void mbedtls_base64_cond_assign_uint32( uint32_t * dest, con...
function mbedtls_base64_eq (line 75) | forceinline unsigned char mbedtls_base64_eq( size_t in_a, size_t in_b )
function mbedtls_base64_table_lookup (line 87) | static inline unsigned char mbedtls_base64_table_lookup( const unsigned ...
function mbedtls_base64_encode (line 121) | int mbedtls_base64_encode( unsigned char *dst, size_t dlen, size_t *olen,
function mbedtls_base64_decode (line 174) | int mbedtls_base64_decode( unsigned char *dst, size_t dlen, size_t *olen,
function mbedtls_base64_self_test (line 269) | int mbedtls_base64_self_test( int verbose )
FILE: third_party/mbedtls/bigmul.c
function Mul (line 27) | void Mul(uint64_t *c, const uint64_t *A, unsigned n, const uint64_t *B, ...
function mbedtls_mpi_mul_hlp1 (line 39) | void mbedtls_mpi_mul_hlp1(size_t n, const uint64_t *s, uint64_t *d, uint...
function mbedtls_mpi_mul_hlp (line 114) | void mbedtls_mpi_mul_hlp(size_t n, const uint64_t *s, uint64_t *d, uint6...
function mbedtls_mpi_mul_int (line 216) | int mbedtls_mpi_mul_int(mbedtls_mpi *X, const mbedtls_mpi *A,
function mbedtls_mpi_mul_mpi (line 239) | int mbedtls_mpi_mul_mpi(mbedtls_mpi *X, const mbedtls_mpi *A,
FILE: third_party/mbedtls/bigmul4.c
function textstartup (line 33) | __attribute__((__constructor__)) static textstartup void Mul4x4Init()
function Mul4x4Pure (line 38) | void Mul4x4Pure(uint64_t C[16], const uint64_t A[8], const uint64_t B[8])
FILE: third_party/mbedtls/bignum.c
function mbedtls_mpi_zeroize (line 58) | static inline void mbedtls_mpi_zeroize( mbedtls_mpi_uint *v, size_t n )
function mbedtls_mpi_free (line 70) | void mbedtls_mpi_free( mbedtls_mpi *X )
function mbedtls_mpi_grow (line 97) | int mbedtls_mpi_grow(mbedtls_mpi *X, size_t nblimbs)
function mbedtls_mpi_resize (line 142) | int mbedtls_mpi_resize(mbedtls_mpi *X, size_t n)
function mbedtls_mpi_shrink (line 181) | int mbedtls_mpi_shrink(mbedtls_mpi *X, size_t nblimbs)
function mbedtls_mpi_copy (line 201) | int mbedtls_mpi_copy( mbedtls_mpi *X, const mbedtls_mpi *Y )
function mbedtls_mpi_swap (line 238) | void mbedtls_mpi_swap( mbedtls_mpi *X, mbedtls_mpi *Y )
function mbedtls_mpi_safe_cond_assign (line 272) | int mbedtls_mpi_safe_cond_assign(mbedtls_mpi *X,
function mbedtls_mpi_safe_cond_swap (line 316) | int mbedtls_mpi_safe_cond_swap( mbedtls_mpi *X, mbedtls_mpi *Y, unsigned...
function mbedtls_mpi_lset (line 352) | int mbedtls_mpi_lset( mbedtls_mpi *X, mbedtls_mpi_sint z )
function mbedtls_mpi_get_bit (line 374) | int mbedtls_mpi_get_bit( const mbedtls_mpi *X, size_t pos )
function mbedtls_mpi_set_bit (line 401) | int mbedtls_mpi_set_bit( mbedtls_mpi *X, size_t pos, unsigned char val )
function mbedtls_mpi_lsb (line 433) | size_t mbedtls_mpi_lsb( const mbedtls_mpi *X )
function mbedtls_clz (line 450) | static inline size_t mbedtls_clz( const mbedtls_mpi_uint x )
function mbedtls_mpi_bitlen (line 467) | size_t mbedtls_mpi_bitlen(const mbedtls_mpi *X)
function mbedtls_mpi_size (line 488) | size_t mbedtls_mpi_size( const mbedtls_mpi *X )
function mpi_get_digit (line 496) | static int mpi_get_digit( mbedtls_mpi_uint *d, int radix, char c )
function mbedtls_mpi_read_string (line 517) | int mbedtls_mpi_read_string( mbedtls_mpi *X, int radix, const char *s )
function mpi_write_hlp (line 577) | static int mpi_write_hlp( mbedtls_mpi *X, int radix,
function mbedtls_mpi_write_string (line 629) | int mbedtls_mpi_write_string( const mbedtls_mpi *X, int radix,
function mbedtls_mpi_read_file (line 719) | int mbedtls_mpi_read_file( mbedtls_mpi *X, int radix, FILE *fin )
function mbedtls_mpi_write_file (line 763) | int mbedtls_mpi_write_file( const char *p, const mbedtls_mpi *X, int rad...
function mpi_bigendian_to_host (line 803) | static void mpi_bigendian_to_host( mbedtls_mpi_uint * const p, size_t li...
function mbedtls_mpi_read_binary_le (line 842) | int mbedtls_mpi_read_binary_le(mbedtls_mpi *X, const unsigned char *p, s...
function mbedtls_mpi_read_binary (line 880) | int mbedtls_mpi_read_binary(mbedtls_mpi *X, const unsigned char *p, size...
function mbedtls_mpi_write_binary_le (line 929) | int mbedtls_mpi_write_binary_le( const mbedtls_mpi *X,
function mbedtls_mpi_write_binary (line 975) | int mbedtls_mpi_write_binary( const mbedtls_mpi *X,
function mbedtls_mpi_cmp_abs (line 1023) | int mbedtls_mpi_cmp_abs( const mbedtls_mpi *X, const mbedtls_mpi *Y )
function mbedtls_mpi_cmp_mpi (line 1052) | int mbedtls_mpi_cmp_mpi( const mbedtls_mpi *X, const mbedtls_mpi *Y )
function ct_lt_mpi_uint (line 1081) | static unsigned ct_lt_mpi_uint( const mbedtls_mpi_uint x,
function mbedtls_mpi_lt_mpi_ct (line 1121) | int mbedtls_mpi_lt_mpi_ct( const mbedtls_mpi *X, const mbedtls_mpi *Y,
function mbedtls_mpi_cmp_int (line 1186) | int mbedtls_mpi_cmp_int( const mbedtls_mpi *X, mbedtls_mpi_sint z )
function mbedtls_mpi_add_abs (line 1209) | int mbedtls_mpi_add_abs( mbedtls_mpi *X, const mbedtls_mpi *A, const mbe...
function forceinline (line 1268) | forceinline mbedtls_mpi_uint mpi_sub_hlp(mbedtls_mpi_uint *d,
function mbedtls_mpi_sub_abs (line 1311) | int mbedtls_mpi_sub_abs( mbedtls_mpi *X, const mbedtls_mpi *A, const mbe...
function mpi_cmp_abs (line 1352) | static int mpi_cmp_abs(const mbedtls_mpi *X,
function mpi_sub_abs (line 1373) | static int mpi_sub_abs( mbedtls_mpi *X, const mbedtls_mpi *A, const mbed...
function mbedtls_mpi_add_mpi (line 1419) | int mbedtls_mpi_add_mpi( mbedtls_mpi *X, const mbedtls_mpi *A, const mbe...
function mbedtls_mpi_sub_mpi (line 1460) | int mbedtls_mpi_sub_mpi( mbedtls_mpi *X, const mbedtls_mpi *A, const mbe...
function mbedtls_mpi_add_int (line 1501) | int mbedtls_mpi_add_int( mbedtls_mpi *X, const mbedtls_mpi *A, mbedtls_m...
function mbedtls_mpi_sub_int (line 1526) | int mbedtls_mpi_sub_int( mbedtls_mpi *X, const mbedtls_mpi *A, mbedtls_m...
function mbedtls_mpi_uint (line 1543) | static mbedtls_mpi_uint mbedtls_int_div_int( mbedtls_mpi_uint u1,
function Multiply2x1 (line 1633) | static inline void Multiply2x1(uint64_t a[3], uint64_t b) {
function GreaterThan3x3 (line 1648) | static inline bool GreaterThan3x3(uint64_t a[3], uint64_t b[3]) {
function mbedtls_mpi_div_mpi (line 1674) | int mbedtls_mpi_div_mpi(mbedtls_mpi *Q, mbedtls_mpi *R, const mbedtls_mp...
function mbedtls_mpi_div_int (line 1797) | int mbedtls_mpi_div_int( mbedtls_mpi *Q, mbedtls_mpi *R,
function mbedtls_mpi_mod_mpi (line 1828) | int mbedtls_mpi_mod_mpi( mbedtls_mpi *R, const mbedtls_mpi *A, const mbe...
function mbedtls_mpi_mod_int (line 1861) | int mbedtls_mpi_mod_int( mbedtls_mpi_uint *r, const mbedtls_mpi *A, mbed...
function mpi_montg_init (line 1911) | static void mpi_montg_init( mbedtls_mpi_uint *mm, const mbedtls_mpi *N )
function mpi_montmul (line 1945) | static void mpi_montmul( mbedtls_mpi *A, const mbedtls_mpi *B, const mbe...
function mpi_montred (line 1995) | static void mpi_montred( mbedtls_mpi *A, const mbedtls_mpi *N,
function mbedtls_mpi_exp_mod (line 2031) | int mbedtls_mpi_exp_mod( mbedtls_mpi *X, const mbedtls_mpi *A,
function mbedtls_mpi_gcd (line 2217) | int mbedtls_mpi_gcd( mbedtls_mpi *G, const mbedtls_mpi *A, const mbedtls...
function mbedtls_mpi_fill_random (line 2278) | int mbedtls_mpi_fill_random( mbedtls_mpi *X, size_t size,
function mbedtls_mpi_inv_mod (line 2313) | int mbedtls_mpi_inv_mod( mbedtls_mpi *X, const mbedtls_mpi *A, const mbe...
function mpi_check_small_factors (line 2425) | static int mpi_check_small_factors( const mbedtls_mpi *X )
function mpi_miller_rabin (line 2447) | static int mpi_miller_rabin( const mbedtls_mpi *X, size_t rounds,
function mbedtls_mpi_is_prime_ext (line 2549) | int mbedtls_mpi_is_prime_ext( const mbedtls_mpi *X, int rounds,
function mbedtls_mpi_gen_prime (line 2598) | int mbedtls_mpi_gen_prime( mbedtls_mpi *X, size_t nbits, int flags,
function mbedtls_mpi_self_test (line 2711) | int mbedtls_mpi_self_test( int verbose )
FILE: third_party/mbedtls/bignum.h
type mbedtls_mpi_sint (line 77) | typedef int64_t mbedtls_mpi_sint;
type mbedtls_mpi_uint (line 78) | typedef uint64_t mbedtls_mpi_uint;
type mbedtls_mpi (line 83) | typedef struct mbedtls_mpi
type mbedtls_mpi_gen_prime_flag_t (line 97) | typedef enum {
function forceinline (line 158) | forceinline void mbedtls_mpi_init(mbedtls_mpi *X)
function forceinline (line 166) | forceinline size_t mbedtls_mpi_limbs(const mbedtls_mpi *X) {
function mbedtls_mpi_is_zero (line 176) | static inline bool mbedtls_mpi_is_zero(const mbedtls_mpi *X)
function mbedtls_mpi_is_one (line 183) | static inline bool mbedtls_mpi_is_one(const mbedtls_mpi *X)
FILE: third_party/mbedtls/bigshift.c
type xmm_t (line 24) | typedef long long xmm_t __attribute__((__vector_size__(16), __aligned__(...
function shrd (line 26) | static inline void shrd(mbedtls_mpi_uint *p, size_t n, size_t j, size_t m,
function shld (line 47) | static inline void shld(mbedtls_mpi_uint *p, size_t n, size_t m, char k)
function mbedtls_mpi_shift_l (line 69) | int mbedtls_mpi_shift_l(mbedtls_mpi *X, size_t k)
function ShiftRightPure (line 93) | void ShiftRightPure(mbedtls_mpi_uint *p, size_t n, unsigned char k) {
function mbedtls_mpi_shift_r (line 100) | int mbedtls_mpi_shift_r(mbedtls_mpi *X, size_t k)
FILE: third_party/mbedtls/ccm.c
function mbedtls_ccm_init (line 70) | void mbedtls_ccm_init( mbedtls_ccm_context *ctx )
function mbedtls_ccm_setkey (line 89) | int mbedtls_ccm_setkey( mbedtls_ccm_context *ctx,
function mbedtls_ccm_free (line 122) | void mbedtls_ccm_free( mbedtls_ccm_context *ctx )
function ccm_auth_crypt (line 167) | static int ccm_auth_crypt( mbedtls_ccm_context *ctx, int mode, size_t le...
function mbedtls_ccm_star_encrypt_and_tag (line 378) | int mbedtls_ccm_star_encrypt_and_tag( mbedtls_ccm_context *ctx, size_t l...
function mbedtls_ccm_encrypt_and_tag (line 430) | int mbedtls_ccm_encrypt_and_tag( mbedtls_ccm_context *ctx, size_t length,
function mbedtls_ccm_star_auth_decrypt (line 488) | int mbedtls_ccm_star_auth_decrypt( mbedtls_ccm_context *ctx, size_t length,
function mbedtls_ccm_auth_decrypt (line 557) | int mbedtls_ccm_auth_decrypt( mbedtls_ccm_context *ctx, size_t length,
function mbedtls_ccm_self_test (line 630) | int mbedtls_ccm_self_test( int verbose )
FILE: third_party/mbedtls/ccm.h
type mbedtls_ccm_context (line 19) | typedef struct mbedtls_ccm_context {
FILE: third_party/mbedtls/chacha20.c
function chacha20_block (line 48) | static void chacha20_block( const uint32_t s[16], unsigned char k[64] )
function mbedtls_chacha20_init (line 137) | void mbedtls_chacha20_init( mbedtls_chacha20_context *ctx )
function mbedtls_chacha20_free (line 155) | void mbedtls_chacha20_free( mbedtls_chacha20_context *ctx )
function mbedtls_chacha20_setkey (line 179) | int mbedtls_chacha20_setkey( mbedtls_chacha20_context *ctx,
function mbedtls_chacha20_starts (line 223) | int mbedtls_chacha20_starts( mbedtls_chacha20_context* ctx,
function mbedtls_chacha20_update (line 275) | int mbedtls_chacha20_update( mbedtls_chacha20_context *ctx,
function mbedtls_chacha20_crypt (line 368) | int mbedtls_chacha20_crypt( const unsigned char key[32],
function mbedtls_chacha20_self_test (line 590) | int mbedtls_chacha20_self_test( int verbose )
FILE: third_party/mbedtls/chacha20.h
type mbedtls_chacha20_context (line 8) | typedef struct mbedtls_chacha20_context
FILE: third_party/mbedtls/chachapoly.c
function chachapoly_pad_aad (line 50) | static int chachapoly_pad_aad( mbedtls_chachapoly_context *ctx )
function chachapoly_pad_ciphertext (line 70) | static int chachapoly_pad_ciphertext( mbedtls_chachapoly_context *ctx )
function mbedtls_chachapoly_init (line 84) | void mbedtls_chachapoly_init( mbedtls_chachapoly_context *ctx )
function mbedtls_chachapoly_free (line 96) | void mbedtls_chachapoly_free( mbedtls_chachapoly_context *ctx )
function mbedtls_chachapoly_setkey (line 109) | int mbedtls_chachapoly_setkey( mbedtls_chachapoly_context *ctx,
function mbedtls_chachapoly_starts (line 119) | int mbedtls_chachapoly_starts( mbedtls_chachapoly_context *ctx,
function mbedtls_chachapoly_update_aad (line 155) | int mbedtls_chachapoly_update_aad( mbedtls_chachapoly_context *ctx,
function mbedtls_chachapoly_update (line 170) | int mbedtls_chachapoly_update( mbedtls_chachapoly_context *ctx,
function mbedtls_chachapoly_finish (line 221) | int mbedtls_chachapoly_finish( mbedtls_chachapoly_context *ctx,
function chachapoly_crypt_and_tag (line 271) | static int chachapoly_crypt_and_tag( mbedtls_chachapoly_context *ctx,
function mbedtls_chachapoly_encrypt_and_tag (line 290) | int mbedtls_chachapoly_encrypt_and_tag( mbedtls_chachapoly_context *ctx,
function mbedtls_chachapoly_auth_decrypt (line 310) | int mbedtls_chachapoly_auth_decrypt( mbedtls_chachapoly_context *ctx,
function mbedtls_chachapoly_self_test (line 452) | int mbedtls_chachapoly_self_test( int verbose )
FILE: third_party/mbedtls/chachapoly.h
type mbedtls_chachapoly_mode_t (line 13) | typedef enum
type mbedtls_chachapoly_context (line 24) | typedef struct mbedtls_chachapoly_context
FILE: third_party/mbedtls/cipher.c
function mbedtls_cipher_info_t (line 61) | const mbedtls_cipher_info_t *mbedtls_cipher_info_from_type(
function mbedtls_cipher_info_t (line 73) | const mbedtls_cipher_info_t *mbedtls_cipher_info_from_string(
function mbedtls_cipher_info_t (line 88) | const mbedtls_cipher_info_t *mbedtls_cipher_info_from_values(
function mbedtls_cipher_init (line 104) | void mbedtls_cipher_init( mbedtls_cipher_context_t *ctx )
function mbedtls_cipher_free (line 110) | void mbedtls_cipher_free( mbedtls_cipher_context_t *ctx )
function mbedtls_cipher_setup (line 153) | int mbedtls_cipher_setup( mbedtls_cipher_context_t *ctx,
function mbedtls_cipher_setup_psa (line 182) | int mbedtls_cipher_setup_psa( mbedtls_cipher_context_t *ctx,
function mbedtls_cipher_setkey (line 213) | int mbedtls_cipher_setkey( mbedtls_cipher_context_t *ctx,
function mbedtls_cipher_set_iv (line 311) | int mbedtls_cipher_set_iv( mbedtls_cipher_context_t *ctx,
function mbedtls_cipher_reset (line 367) | int mbedtls_cipher_reset( mbedtls_cipher_context_t *ctx )
function mbedtls_cipher_update_ad (line 388) | int mbedtls_cipher_update_ad( mbedtls_cipher_context_t *ctx,
function mbedtls_cipher_update (line 439) | int mbedtls_cipher_update( mbedtls_cipher_context_t *ctx, const unsigned...
function add_pkcs_padding (line 680) | static void add_pkcs_padding( unsigned char *output, size_t output_len,
function get_pkcs_padding (line 690) | static int get_pkcs_padding( unsigned char *input, size_t input_len,
function add_one_and_zeros_padding (line 720) | static void add_one_and_zeros_padding( unsigned char *output,
function get_one_and_zeros_padding (line 731) | static int get_one_and_zeros_padding( unsigned char *input, size_t input...
function add_zeros_and_len_padding (line 759) | static void add_zeros_and_len_padding( unsigned char *output,
function get_zeros_and_len_padding (line 770) | static int get_zeros_and_len_padding( unsigned char *input, size_t input...
function add_zeros_padding (line 799) | static void add_zeros_padding( unsigned char *output,
function get_zeros_padding (line 808) | static int get_zeros_padding( unsigned char *input, size_t input_len,
function get_no_padding (line 835) | static int get_no_padding( unsigned char *input, size_t input_len,
function mbedtls_cipher_finish (line 847) | int mbedtls_cipher_finish( mbedtls_cipher_context_t *ctx,
function mbedtls_cipher_set_padding_mode (line 948) | int mbedtls_cipher_set_padding_mode( mbedtls_cipher_context_t *ctx,
function mbedtls_cipher_write_tag (line 1011) | int mbedtls_cipher_write_tag( mbedtls_cipher_context_t *ctx,
function mbedtls_cipher_check_tag (line 1053) | int mbedtls_cipher_check_tag( mbedtls_cipher_context_t *ctx,
function mbedtls_cipher_crypt (line 1129) | int mbedtls_cipher_crypt( mbedtls_cipher_context_t *ctx,
function mbedtls_cipher_aead_encrypt (line 1225) | static int mbedtls_cipher_aead_encrypt( mbedtls_cipher_context_t *ctx,
function mbedtls_cipher_aead_decrypt (line 1301) | static int mbedtls_cipher_aead_decrypt( mbedtls_cipher_context_t *ctx,
function mbedtls_cipher_auth_encrypt (line 1402) | int mbedtls_cipher_auth_encrypt( mbedtls_cipher_context_t *ctx,
function mbedtls_cipher_auth_decrypt (line 1425) | int mbedtls_cipher_auth_decrypt( mbedtls_cipher_context_t *ctx,
function mbedtls_cipher_auth_encrypt_ext (line 1451) | int mbedtls_cipher_auth_encrypt_ext( mbedtls_cipher_context_t *ctx,
function mbedtls_cipher_auth_decrypt_ext (line 1507) | int mbedtls_cipher_auth_decrypt_ext( mbedtls_cipher_context_t *ctx,
FILE: third_party/mbedtls/cipher.h
type mbedtls_cipher_id_t (line 31) | typedef enum {
type mbedtls_cipher_type_t (line 51) | typedef enum {
type mbedtls_cipher_mode_t (line 135) | typedef enum {
type mbedtls_cipher_padding_t (line 152) | typedef enum {
type mbedtls_operation_t (line 161) | typedef enum {
type mbedtls_cipher_base_t (line 206) | typedef struct mbedtls_cipher_base_t mbedtls_cipher_base_t;
type mbedtls_cmac_context_t (line 211) | typedef struct mbedtls_cmac_context_t mbedtls_cmac_context_t;
type mbedtls_cipher_info_t (line 217) | typedef struct mbedtls_cipher_info_t
type mbedtls_cipher_context_t (line 259) | typedef struct mbedtls_cipher_context_t
function mbedtls_cipher_get_block_size (line 407) | static inline unsigned int mbedtls_cipher_get_block_size(
function mbedtls_cipher_mode_t (line 425) | static inline mbedtls_cipher_mode_t mbedtls_cipher_get_cipher_mode(
function mbedtls_cipher_get_iv_size (line 444) | static inline int mbedtls_cipher_get_iv_size(
function mbedtls_cipher_type_t (line 465) | static inline mbedtls_cipher_type_t mbedtls_cipher_get_type(
function mbedtls_cipher_get_key_bitlen (line 504) | static inline int mbedtls_cipher_get_key_bitlen(
function mbedtls_operation_t (line 523) | static inline mbedtls_operation_t mbedtls_cipher_get_operation(
FILE: third_party/mbedtls/cipher_internal.h
function COSMOPOLITAN_C_START_ (line 5) | COSMOPOLITAN_C_START_
type mbedtls_cipher_definition_t (line 77) | typedef struct
FILE: third_party/mbedtls/cipher_wrap.c
function gcm_ctx_free (line 46) | static void gcm_ctx_free( void *ctx )
function ccm_ctx_free (line 65) | static void ccm_ctx_free( void *ctx )
function aes_crypt_cfb128_wrap (line 75) | static int aes_crypt_cfb128_wrap( void *ctx, mbedtls_operation_t operation,
function aes_crypt_ofb_wrap (line 85) | static int aes_crypt_ofb_wrap( void *ctx, size_t length, size_t *iv_off,
function aes_crypt_ctr_wrap (line 94) | static int aes_crypt_ctr_wrap( void *ctx, size_t length, size_t *nc_off,
function aes_crypt_xts_wrap (line 104) | static int aes_crypt_xts_wrap( void *ctx, mbedtls_operation_t operation,
function aes_setkey_dec_wrap (line 130) | static int aes_setkey_dec_wrap( void *ctx, const unsigned char *key,
function aes_setkey_enc_wrap (line 136) | static int aes_setkey_enc_wrap( void *ctx, const unsigned char *key,
function aes_ctx_free (line 154) | static void aes_ctx_free( void *ctx )
function xts_aes_setkey_enc_wrap (line 361) | static int xts_aes_setkey_enc_wrap( void *ctx, const unsigned char *key,
function xts_aes_setkey_dec_wrap (line 368) | static int xts_aes_setkey_dec_wrap( void *ctx, const unsigned char *key,
function xts_aes_ctx_free (line 385) | static void xts_aes_ctx_free( void *ctx )
function gcm_aes_setkey_wrap (line 447) | static int gcm_aes_setkey_wrap( void *ctx, const unsigned char *key,
function ccm_aes_setkey_wrap (line 516) | static int ccm_aes_setkey_wrap( void *ctx, const unsigned char *key,
function des_crypt_ecb_wrap (line 588) | static int des_crypt_ecb_wrap( void *ctx, mbedtls_operation_t operation,
function des3_crypt_ecb_wrap (line 595) | static int des3_crypt_ecb_wrap( void *ctx, mbedtls_operation_t operation,
function des_crypt_cbc_wrap (line 603) | static int des_crypt_cbc_wrap( void *ctx, mbedtls_operation_t operation,...
function des3_crypt_cbc_wrap (line 612) | static int des3_crypt_cbc_wrap( void *ctx, mbedtls_operation_t operation...
function des_setkey_dec_wrap (line 620) | static int des_setkey_dec_wrap( void *ctx, const unsigned char *key,
function des_setkey_enc_wrap (line 628) | static int des_setkey_enc_wrap( void *ctx, const unsigned char *key,
function des3_set2key_dec_wrap (line 636) | static int des3_set2key_dec_wrap( void *ctx, const unsigned char *key,
function des3_set2key_enc_wrap (line 644) | static int des3_set2key_enc_wrap( void *ctx, const unsigned char *key,
function des3_set3key_dec_wrap (line 652) | static int des3_set3key_dec_wrap( void *ctx, const unsigned char *key,
function des3_set3key_enc_wrap (line 660) | static int des3_set3key_enc_wrap( void *ctx, const unsigned char *key,
function des_ctx_free (line 680) | static void des_ctx_free( void *ctx )
function des3_ctx_free (line 699) | static void des3_ctx_free( void *ctx )
function blowfish_crypt_ecb_wrap (line 860) | static int blowfish_crypt_ecb_wrap( void *ctx, mbedtls_operation_t opera...
function blowfish_crypt_cbc_wrap (line 868) | static int blowfish_crypt_cbc_wrap( void *ctx, mbedtls_operation_t opera...
function blowfish_crypt_cfb64_wrap (line 878) | static int blowfish_crypt_cfb64_wrap( void *ctx, mbedtls_operation_t ope...
function blowfish_crypt_ctr_wrap (line 888) | static int blowfish_crypt_ctr_wrap( void *ctx, size_t length, size_t *nc...
function blowfish_setkey_wrap (line 897) | static int blowfish_setkey_wrap( void *ctx, const unsigned char *key,
function blowfish_ctx_free (line 916) | static void blowfish_ctx_free( void *ctx )
function chacha20_setkey_wrap (line 1002) | static int chacha20_setkey_wrap( void *ctx, const unsigned char *key,
function chacha20_stream_wrap (line 1014) | static int chacha20_stream_wrap( void *ctx, size_t length,
function chacha20_ctx_free (line 1040) | static void chacha20_ctx_free( void *ctx )
function chachapoly_setkey_wrap (line 1086) | static int chachapoly_setkey_wrap( void *ctx,
function chachapoly_ctx_free (line 1112) | static void chachapoly_ctx_free( void *ctx )
function null_crypt_stream (line 1157) | static int null_crypt_stream( void *ctx, size_t length,
function null_setkey (line 1166) | static int null_setkey( void *ctx, const unsigned char *key,
function null_ctx_free (line 1181) | static void null_ctx_free( void *ctx )
function kw_ctx_free (line 1236) | static void kw_ctx_free( void *ctx )
function kw_aes_setkey_wrap (line 1242) | static int kw_aes_setkey_wrap( void *ctx, const unsigned char *key,
function kw_aes_setkey_unwrap (line 1249) | static int kw_aes_setkey_unwrap( void *ctx, const unsigned char *key,
FILE: third_party/mbedtls/ctr_drbg.c
function mbedtls_ctr_drbg_init (line 46) | void mbedtls_ctr_drbg_init( mbedtls_ctr_drbg_context *ctx )
function mbedtls_ctr_drbg_free (line 60) | void mbedtls_ctr_drbg_free( mbedtls_ctr_drbg_context *ctx )
function mbedtls_ctr_drbg_set_prediction_resistance (line 70) | void mbedtls_ctr_drbg_set_prediction_resistance( mbedtls_ctr_drbg_contex...
function mbedtls_ctr_drbg_set_entropy_len (line 76) | void mbedtls_ctr_drbg_set_entropy_len( mbedtls_ctr_drbg_context *ctx,
function mbedtls_ctr_drbg_set_nonce_len (line 82) | int mbedtls_ctr_drbg_set_nonce_len( mbedtls_ctr_drbg_context *ctx,
function mbedtls_ctr_drbg_set_reseed_interval (line 108) | void mbedtls_ctr_drbg_set_reseed_interval( mbedtls_ctr_drbg_context *ctx,
function block_cipher_df (line 114) | static int block_cipher_df( unsigned char *output,
function ctr_drbg_update_internal (line 245) | static int ctr_drbg_update_internal( mbedtls_ctr_drbg_context *ctx,
function mbedtls_ctr_drbg_update_ret (line 307) | int mbedtls_ctr_drbg_update_ret( mbedtls_ctr_drbg_context *ctx,
function mbedtls_ctr_drbg_reseed_internal (line 340) | static int mbedtls_ctr_drbg_reseed_internal( mbedtls_ctr_drbg_context *ctx,
function mbedtls_ctr_drbg_reseed (line 396) | int mbedtls_ctr_drbg_reseed( mbedtls_ctr_drbg_context *ctx,
function good_nonce_len (line 407) | static size_t good_nonce_len( size_t entropy_len )
function mbedtls_ctr_drbg_seed (line 426) | int mbedtls_ctr_drbg_seed( mbedtls_ctr_drbg_context *ctx,
function mbedtls_ctr_drbg_random_with_add (line 488) | int mbedtls_ctr_drbg_random_with_add( void *p_rng,
function mbedtls_ctr_drbg_random (line 580) | int mbedtls_ctr_drbg_random( void *p_rng, unsigned char *output,
function mbedtls_ctr_drbg_write_seed_file (line 588) | int mbedtls_ctr_drbg_write_seed_file( mbedtls_ctr_drbg_context *ctx,
function mbedtls_ctr_drbg_update_seed_file (line 619) | int mbedtls_ctr_drbg_update_seed_file( mbedtls_ctr_drbg_context *ctx,
function ctr_drbg_self_test_entropy (line 790) | static int ctr_drbg_self_test_entropy( void *data, unsigned char *buf,
function mbedtls_ctr_drbg_self_test (line 811) | int mbedtls_ctr_drbg_self_test( int verbose )
FILE: third_party/mbedtls/ctr_drbg.h
type mbedtls_ctr_drbg_context (line 116) | typedef struct mbedtls_ctr_drbg_context
FILE: third_party/mbedtls/debug.c
function mbedtls_debug_set_threshold (line 27) | void mbedtls_debug_set_threshold( int threshold )
function debug_send_line (line 39) | static inline void debug_send_line( const mbedtls_ssl_context *ssl, int ...
function mbedtls_debug_print_msg (line 47) | void mbedtls_debug_print_msg( const mbedtls_ssl_context *ssl, int level,
function mbedtls_debug_print_ret (line 75) | void mbedtls_debug_print_ret( const mbedtls_ssl_context *ssl, int level,
function mbedtls_debug_print_buf (line 103) | void mbedtls_debug_print_buf( const mbedtls_ssl_context *ssl, int level,
function mbedtls_debug_print_ecp (line 163) | void mbedtls_debug_print_ecp( const mbedtls_ssl_context *ssl, int level,
function mbedtls_debug_print_mpi (line 186) | void mbedtls_debug_print_mpi( const mbedtls_ssl_context *ssl, int level,
function debug_print_pk (line 261) | static void debug_print_pk( const mbedtls_ssl_context *ssl, int level,
function debug_print_line_by_line (line 299) | static void debug_print_line_by_line( const mbedtls_ssl_context *ssl, in...
function mbedtls_debug_print_crt (line 324) | void mbedtls_debug_print_crt( const mbedtls_ssl_context *ssl, int level,
function mbedtls_debug_printf_ecdh_internal (line 358) | static void mbedtls_debug_printf_ecdh_internal( const mbedtls_ssl_contex...
function mbedtls_debug_printf_ecdh (line 389) | void mbedtls_debug_printf_ecdh( const mbedtls_ssl_context *ssl, int level,
FILE: third_party/mbedtls/debug.h
type mbedtls_debug_ecdh_attr (line 269) | typedef enum {
FILE: third_party/mbedtls/des.c
function mbedtls_des_init (line 274) | void mbedtls_des_init( mbedtls_des_context *ctx )
function mbedtls_des_free (line 279) | void mbedtls_des_free( mbedtls_des_context *ctx )
function mbedtls_des3_init (line 287) | void mbedtls_des3_init( mbedtls_des3_context *ctx )
function mbedtls_des3_free (line 292) | void mbedtls_des3_free( mbedtls_des3_context *ctx )
function mbedtls_des_key_set_parity (line 311) | void mbedtls_des_key_set_parity( unsigned char key[MBEDTLS_DES_KEY_SIZE] )
function mbedtls_des_key_check_key_parity (line 322) | int mbedtls_des_key_check_key_parity( const unsigned char key[MBEDTLS_DE...
function mbedtls_des_key_check_weak (line 376) | int mbedtls_des_key_check_weak( const unsigned char key[MBEDTLS_DES_KEY_...
function mbedtls_des_setkey (line 386) | void mbedtls_des_setkey( uint32_t SK[32], const unsigned char key[MBEDTL...
function mbedtls_des_setkey_enc (line 459) | int mbedtls_des_setkey_enc( mbedtls_des_context *ctx, const unsigned cha...
function mbedtls_des_setkey_dec (line 469) | int mbedtls_des_setkey_dec( mbedtls_des_context *ctx, const unsigned cha...
function des3_set2key (line 484) | static void des3_set2key( uint32_t esk[96],
function mbedtls_des3_set2key_enc (line 512) | int mbedtls_des3_set2key_enc( mbedtls_des3_context *ctx,
function mbedtls_des3_set2key_dec (line 526) | int mbedtls_des3_set2key_dec( mbedtls_des3_context *ctx,
function des3_set3key (line 537) | static void des3_set3key( uint32_t esk[96],
function mbedtls_des3_set3key_enc (line 563) | int mbedtls_des3_set3key_enc( mbedtls_des3_context *ctx,
function mbedtls_des3_set3key_dec (line 577) | int mbedtls_des3_set3key_dec( mbedtls_des3_context *ctx,
function mbedtls_des_crypt_ecb (line 592) | int mbedtls_des_crypt_ecb( mbedtls_des_context *ctx,
function mbedtls_des_crypt_cbc (line 625) | int mbedtls_des_crypt_cbc( mbedtls_des_context *ctx,
function mbedtls_des3_crypt_ecb (line 679) | int mbedtls_des3_crypt_ecb( mbedtls_des3_context *ctx,
function mbedtls_des3_crypt_cbc (line 724) | int mbedtls_des3_crypt_cbc( mbedtls_des3_context *ctx,
function mbedtls_des_self_test_impl (line 827) | static int mbedtls_des_self_test_impl( int verbose,
function mbedtls_des_self_test (line 1016) | int mbedtls_des_self_test( int verbose )
FILE: third_party/mbedtls/des.h
type mbedtls_des_context (line 30) | typedef struct mbedtls_des_context
type mbedtls_des3_context (line 39) | typedef struct mbedtls_des3_context
FILE: third_party/mbedtls/dhm.c
function dhm_read_bignum (line 51) | static int dhm_read_bignum( mbedtls_mpi *X,
function dhm_check_range (line 86) | static int dhm_check_range( const mbedtls_mpi *param, const mbedtls_mpi ...
function mbedtls_dhm_init (line 107) | void mbedtls_dhm_init( mbedtls_dhm_context *ctx )
function mbedtls_dhm_read_params (line 116) | int mbedtls_dhm_read_params( mbedtls_dhm_context *ctx,
function mbedtls_dhm_make_params (line 141) | int mbedtls_dhm_make_params( mbedtls_dhm_context *ctx, int x_size,
function mbedtls_dhm_set_group (line 218) | int mbedtls_dhm_set_group( mbedtls_dhm_context *ctx,
function mbedtls_dhm_read_public (line 240) | int mbedtls_dhm_read_public( mbedtls_dhm_context *ctx,
function mbedtls_dhm_make_public (line 259) | int mbedtls_dhm_make_public( mbedtls_dhm_context *ctx, int x_size,
function dhm_random_below (line 309) | static int dhm_random_below( mbedtls_mpi *R, const mbedtls_mpi *M,
function dhm_update_blinding (line 339) | static int dhm_update_blinding( mbedtls_dhm_context *ctx,
function mbedtls_dhm_calc_secret (line 404) | int mbedtls_dhm_calc_secret( mbedtls_dhm_context *ctx,
function mbedtls_dhm_free (line 460) | void mbedtls_dhm_free( mbedtls_dhm_context *ctx )
function mbedtls_dhm_parse_dhm (line 483) | int mbedtls_dhm_parse_dhm( mbedtls_dhm_context *dhm, const unsigned char...
function load_file (line 590) | static int load_file( const char *path, unsigned char **buf, size_t *n )
function mbedtls_dhm_parse_dhmfile (line 638) | int mbedtls_dhm_parse_dhmfile( mbedtls_dhm_context *dhm, const char *path )
function mbedtls_dhm_self_test (line 690) | int mbedtls_dhm_self_test( int verbose )
FILE: third_party/mbedtls/dhm.h
type mbedtls_dhm_context (line 33) | typedef struct mbedtls_dhm_context
FILE: third_party/mbedtls/ecdh.c
type mbedtls_ecdh_context (line 39) | typedef mbedtls_ecdh_context mbedtls_ecdh_context_mbed;
function mbedtls_ecp_group_id (line 42) | static mbedtls_ecp_group_id mbedtls_ecdh_grp_id(
function mbedtls_ecdh_can_do (line 52) | int mbedtls_ecdh_can_do( mbedtls_ecp_group_id gid )
function ecdh_gen_public_restartable (line 67) | static int ecdh_gen_public_restartable( mbedtls_ecp_group *grp,
function mbedtls_ecdh_gen_public (line 91) | int mbedtls_ecdh_gen_public( mbedtls_ecp_group *grp, mbedtls_mpi *d, mbe...
function ecdh_compute_shared_restartable (line 107) | static int ecdh_compute_shared_restartable( mbedtls_ecp_group *grp,
function mbedtls_ecdh_compute_shared (line 139) | int mbedtls_ecdh_compute_shared( mbedtls_ecp_group *grp, mbedtls_mpi *z,
function ecdh_init_internal (line 153) | static void ecdh_init_internal( mbedtls_ecdh_context_mbed *ctx )
function mbedtls_ecdh_init (line 169) | void mbedtls_ecdh_init( mbedtls_ecdh_context *ctx )
function ecdh_setup_internal (line 189) | static int ecdh_setup_internal( mbedtls_ecdh_context_mbed *ctx,
function mbedtls_ecdh_setup (line 206) | int mbedtls_ecdh_setup( mbedtls_ecdh_context *ctx, mbedtls_ecp_group_id ...
function ecdh_free_internal (line 232) | static void ecdh_free_internal( mbedtls_ecdh_context_mbed *ctx )
function mbedtls_ecdh_enable_restart (line 249) | void mbedtls_ecdh_enable_restart( mbedtls_ecdh_context *ctx )
function mbedtls_ecdh_free (line 260) | void mbedtls_ecdh_free( mbedtls_ecdh_context *ctx )
function ecdh_make_params_internal (line 291) | static int ecdh_make_params_internal( mbedtls_ecdh_context_mbed *ctx,
function mbedtls_ecdh_make_params (line 349) | int mbedtls_ecdh_make_params( mbedtls_ecdh_context *ctx, size_t *olen,
function ecdh_read_params_internal (line 388) | static int ecdh_read_params_internal( mbedtls_ecdh_context_mbed *ctx,
function mbedtls_ecdh_read_params (line 403) | int mbedtls_ecdh_read_params( mbedtls_ecdh_context *ctx,
function ecdh_get_params_internal (line 440) | static int ecdh_get_params_internal( mbedtls_ecdh_context_mbed *ctx,
function mbedtls_ecdh_get_params (line 464) | int mbedtls_ecdh_get_params( mbedtls_ecdh_context *ctx,
function ecdh_make_public_internal (line 514) | static int ecdh_make_public_internal( mbedtls_ecdh_context_mbed *ctx,
function mbedtls_ecdh_make_public (line 555) | int mbedtls_ecdh_make_public( mbedtls_ecdh_context *ctx, size_t *olen,
function ecdh_read_public_internal (line 592) | static int ecdh_read_public_internal( mbedtls_ecdh_context_mbed *ctx,
function mbedtls_ecdh_read_public (line 611) | int mbedtls_ecdh_read_public( mbedtls_ecdh_context *ctx,
function ecdh_calc_secret_internal (line 636) | static int ecdh_calc_secret_internal( mbedtls_ecdh_context_mbed *ctx,
function mbedtls_ecdh_calc_secret (line 689) | int mbedtls_ecdh_calc_secret( mbedtls_ecdh_context *ctx, size_t *olen,
FILE: third_party/mbedtls/ecdh.h
type mbedtls_ecdh_side (line 14) | typedef enum
type mbedtls_ecdh_variant (line 27) | typedef enum
type mbedtls_ecdh_context_mbed (line 43) | typedef struct mbedtls_ecdh_context_mbed
type mbedtls_ecdh_context (line 63) | typedef struct mbedtls_ecdh_context
FILE: third_party/mbedtls/ecdh_everest.c
function mbedtls_everest_setup (line 41) | int mbedtls_everest_setup(mbedtls_ecdh_context_everest *ctx, int grp_id)
function mbedtls_everest_free (line 54) | void mbedtls_everest_free(mbedtls_ecdh_context_everest *ctx)
function mbedtls_everest_make_params (line 83) | int mbedtls_everest_make_params(mbedtls_ecdh_context_everest *ctx, size_...
function mbedtls_everest_read_params (line 120) | int mbedtls_everest_read_params(mbedtls_ecdh_context_everest *ctx,
function mbedtls_everest_get_params (line 148) | int mbedtls_everest_get_params(mbedtls_ecdh_context_everest *ctx,
function mbedtls_everest_make_public (line 185) | int mbedtls_everest_make_public(mbedtls_ecdh_context_everest *ctx, size_...
function mbedtls_everest_read_public (line 221) | int mbedtls_everest_read_public(mbedtls_ecdh_context_everest *ctx,
function mbedtls_everest_calc_secret (line 252) | int mbedtls_everest_calc_secret(mbedtls_ecdh_context_everest *ctx, size_...
FILE: third_party/mbedtls/ecdh_everest.h
type mbedtls_everest_ecdh_side (line 10) | typedef enum {
type mbedtls_ecdh_context_everest (line 15) | typedef struct {
FILE: third_party/mbedtls/ecdsa.c
type mbedtls_ecdsa_restart_ver (line 47) | struct mbedtls_ecdsa_restart_ver
function ecdsa_restart_ver_init (line 59) | static void ecdsa_restart_ver_init( mbedtls_ecdsa_restart_ver_ctx *ctx )
function ecdsa_restart_ver_free (line 69) | static void ecdsa_restart_ver_free( mbedtls_ecdsa_restart_ver_ctx *ctx )
type mbedtls_ecdsa_restart_sig (line 83) | struct mbedtls_ecdsa_restart_sig
function ecdsa_restart_sig_init (line 99) | static void ecdsa_restart_sig_init( mbedtls_ecdsa_restart_sig_ctx *ctx )
function ecdsa_restart_sig_free (line 111) | static void ecdsa_restart_sig_free( mbedtls_ecdsa_restart_sig_ctx *ctx )
type mbedtls_ecdsa_restart_det (line 124) | struct mbedtls_ecdsa_restart_det
function ecdsa_restart_det_init (line 136) | static void ecdsa_restart_det_init( mbedtls_ecdsa_restart_det_ctx *ctx )
function ecdsa_restart_det_free (line 145) | static void ecdsa_restart_det_free( mbedtls_ecdsa_restart_det_ctx *ctx )
function derive_mpi (line 213) | static int derive_mpi( const mbedtls_ecp_group *grp, mbedtls_mpi *x,
function mbedtls_ecdsa_can_do (line 372) | int mbedtls_ecdsa_can_do( mbedtls_ecp_group_id gid )
function mbedtls_ecdsa_sign (line 389) | int mbedtls_ecdsa_sign( mbedtls_ecp_group *grp, mbedtls_mpi *r, mbedtls_...
function ecdsa_sign_det_restartable (line 410) | static int ecdsa_sign_det_restartable( mbedtls_ecp_group *grp,
function mbedtls_ecdsa_sign_det_ext (line 542) | int mbedtls_ecdsa_sign_det_ext( mbedtls_ecp_group *grp, mbedtls_mpi *r,
function ecdsa_verify_restartable (line 567) | static int ecdsa_verify_restartable( mbedtls_ecp_group *grp,
function mbedtls_ecdsa_verify (line 675) | int mbedtls_ecdsa_verify( mbedtls_ecp_group *grp,
function ecdsa_signature_to_asn1 (line 694) | static int ecdsa_signature_to_asn1( const mbedtls_mpi *r, const mbedtls_...
function mbedtls_ecdsa_write_signature_restartable (line 718) | int mbedtls_ecdsa_write_signature_restartable( mbedtls_ecdsa_context *ctx,
function mbedtls_ecdsa_write_signature (line 768) | int mbedtls_ecdsa_write_signature( mbedtls_ecdsa_context *ctx,
function mbedtls_ecdsa_read_signature (line 786) | int mbedtls_ecdsa_read_signature( mbedtls_ecdsa_context *ctx,
function mbedtls_ecdsa_read_signature_restartable (line 800) | int mbedtls_ecdsa_read_signature_restartable( mbedtls_ecdsa_context *ctx,
function mbedtls_ecdsa_genkey (line 866) | int mbedtls_ecdsa_genkey( mbedtls_ecdsa_context *ctx, mbedtls_ecp_group_...
function mbedtls_ecdsa_from_keypair (line 885) | int mbedtls_ecdsa_from_keypair( mbedtls_ecdsa_context *ctx, const mbedtl...
function mbedtls_ecdsa_init (line 904) | void mbedtls_ecdsa_init( mbedtls_ecdsa_context *ctx )
function mbedtls_ecdsa_free (line 914) | void mbedtls_ecdsa_free( mbedtls_ecdsa_context *ctx )
function mbedtls_ecdsa_restart_init (line 926) | void mbedtls_ecdsa_restart_init( mbedtls_ecdsa_restart_ctx *ctx )
function mbedtls_ecdsa_restart_free (line 942) | void mbedtls_ecdsa_restart_free( mbedtls_ecdsa_restart_ctx *ctx )
FILE: third_party/mbedtls/ecdsa.h
type mbedtls_ecdsa_restart_sig_ctx (line 56) | typedef struct mbedtls_ecdsa_restart_sig mbedtls_ecdsa_restart_sig_ctx;
type mbedtls_ecdsa_restart_det_ctx (line 63) | typedef struct mbedtls_ecdsa_restart_det mbedtls_ecdsa_restart_det_ctx;
type mbedtls_ecdsa_restart_ctx (line 68) | typedef struct
type mbedtls_ecdsa_restart_ctx (line 82) | typedef void mbedtls_ecdsa_restart_ctx;
FILE: third_party/mbedtls/ecp.c
type mbedtls_hmac_drbg_context (line 100) | typedef mbedtls_hmac_drbg_context ecp_drbg_context;
function ecp_drbg_init (line 103) | static inline void ecp_drbg_init( ecp_drbg_context *ctx )
function ecp_drbg_free (line 109) | static inline void ecp_drbg_free( ecp_drbg_context *ctx )
function ecp_drbg_random (line 115) | static inline int ecp_drbg_random( void *p_rng,
function ecp_drbg_seed (line 122) | static int ecp_drbg_seed( ecp_drbg_context *ctx,
type mbedtls_ctr_drbg_context (line 147) | typedef mbedtls_ctr_drbg_context ecp_drbg_context;
function ecp_drbg_init (line 150) | static inline void ecp_drbg_init( ecp_drbg_context *ctx )
function ecp_drbg_free (line 156) | static inline void ecp_drbg_free( ecp_drbg_context *ctx )
function ecp_drbg_random (line 162) | static inline int ecp_drbg_random( void *p_rng,
function ecp_ctr_drbg_null_entropy (line 175) | static int ecp_ctr_drbg_null_entropy(void *ctx, unsigned char *out, size...
function ecp_drbg_seed (line 183) | static int ecp_drbg_seed( ecp_drbg_context *ctx,
function mbedtls_ecp_set_max_ops (line 277) | void mbedtls_ecp_set_max_ops( unsigned max_ops )
function mbedtls_ecp_restart_is_enabled (line 288) | int mbedtls_ecp_restart_is_enabled( void )
type mbedtls_ecp_restart_mul (line 296) | struct mbedtls_ecp_restart_mul
function ecp_restart_rsm_init (line 320) | static void ecp_restart_rsm_init( mbedtls_ecp_restart_mul_ctx *ctx )
function ecp_restart_rsm_free (line 336) | static void ecp_restart_rsm_free( mbedtls_ecp_restart_mul_ctx *ctx )
type mbedtls_ecp_restart_muladd (line 357) | struct mbedtls_ecp_restart_muladd
function ecp_restart_ma_init (line 372) | static void ecp_restart_ma_init( mbedtls_ecp_restart_muladd_ctx *ctx )
function ecp_restart_ma_free (line 382) | static void ecp_restart_ma_free( mbedtls_ecp_restart_muladd_ctx *ctx )
function mbedtls_ecp_restart_init (line 397) | void mbedtls_ecp_restart_init( mbedtls_ecp_restart_ctx *ctx )
function mbedtls_ecp_restart_free (line 413) | void mbedtls_ecp_restart_free( mbedtls_ecp_restart_ctx *ctx )
function mbedtls_ecp_check_budget (line 427) | int mbedtls_ecp_check_budget( const mbedtls_ecp_group *grp,
function mbedtls_ecp_curve_info (line 581) | const mbedtls_ecp_curve_info *mbedtls_ecp_curve_list( void )
function mbedtls_ecp_group_id (line 600) | const mbedtls_ecp_group_id *mbedtls_ecp_grp_id_list( void )
function mbedtls_ecp_curve_info (line 628) | const mbedtls_ecp_curve_info *mbedtls_ecp_curve_info_from_grp_id( mbedtl...
function mbedtls_ecp_curve_info (line 650) | const mbedtls_ecp_curve_info *mbedtls_ecp_curve_info_from_tls_id( uint16...
function mbedtls_ecp_curve_info (line 672) | const mbedtls_ecp_curve_info *mbedtls_ecp_curve_info_from_name( const ch...
function mbedtls_ecp_curve_type (line 690) | mbedtls_ecp_curve_type mbedtls_ecp_get_type( const mbedtls_ecp_group *grp )
function mbedtls_ecp_point_init (line 705) | void mbedtls_ecp_point_init( mbedtls_ecp_point *pt )
function mbedtls_ecp_group_init (line 722) | void mbedtls_ecp_group_init( mbedtls_ecp_group *grp )
function mbedtls_ecp_keypair_init (line 747) | void mbedtls_ecp_keypair_init( mbedtls_ecp_keypair *key )
function mbedtls_ecp_point_free (line 760) | void mbedtls_ecp_point_free( mbedtls_ecp_point *pt )
function mbedtls_ecp_group_free (line 776) | void mbedtls_ecp_group_free( mbedtls_ecp_group *grp )
function mbedtls_ecp_keypair_free (line 805) | void mbedtls_ecp_keypair_free( mbedtls_ecp_keypair *key )
function mbedtls_ecp_copy (line 825) | int mbedtls_ecp_copy( mbedtls_ecp_point *P, const mbedtls_ecp_point *Q )
function mbedtls_ecp_group_copy (line 848) | int mbedtls_ecp_group_copy( mbedtls_ecp_group *dst, const mbedtls_ecp_gr...
function mbedtls_ecp_is_zero (line 864) | int mbedtls_ecp_is_zero( mbedtls_ecp_point *pt )
function mbedtls_ecp_point_cmp (line 882) | int mbedtls_ecp_point_cmp( const mbedtls_ecp_point *P,
function mbedtls_ecp_point_read_string (line 908) | int mbedtls_ecp_point_read_string( mbedtls_ecp_point *P, int radix,
function mbedtls_ecp_point_write_binary (line 947) | int mbedtls_ecp_point_write_binary( const mbedtls_ecp_group *grp,
function mbedtls_ecp_point_read_binary (line 1033) | int mbedtls_ecp_point_read_binary( const mbedtls_ecp_group *grp,
function mbedtls_ecp_tls_read_point (line 1102) | int mbedtls_ecp_tls_read_point( const mbedtls_ecp_group *grp,
function mbedtls_ecp_tls_write_point (line 1156) | int mbedtls_ecp_tls_write_point( const mbedtls_ecp_group *grp,
function mbedtls_ecp_tls_read_group (line 1207) | int mbedtls_ecp_tls_read_group( mbedtls_ecp_group *grp,
function mbedtls_ecp_tls_read_group_id (line 1238) | int mbedtls_ecp_tls_read_group_id( mbedtls_ecp_group_id *grp,
function mbedtls_ecp_tls_write_group (line 1286) | int mbedtls_ecp_tls_write_group( const mbedtls_ecp_group *grp, size_t *o...
function ecp_modp (line 1319) | static int ecp_modp( mbedtls_mpi *N, const mbedtls_ecp_group *grp )
function mbedtls_mpi_mul_mod (line 1367) | int mbedtls_mpi_mul_mod( const mbedtls_ecp_group *grp,
function mbedtls_mpi_sub_mod (line 1394) | int mbedtls_mpi_sub_mod( const mbedtls_ecp_group *grp,
function mbedtls_mpi_add_mod (line 1416) | static inline int mbedtls_mpi_add_mod( const mbedtls_ecp_group *grp,
function ecp_normalize_jac (line 1441) | static int ecp_normalize_jac( const mbedtls_ecp_group *grp, mbedtls_ecp_...
function ecp_normalize_jac_many (line 1495) | static int ecp_normalize_jac_many( const mbedtls_ecp_group *grp,
function ecp_safe_invert_jac (line 1581) | static int ecp_safe_invert_jac( const mbedtls_ecp_group *grp,
function ecp_double_jac (line 1612) | static int ecp_double_jac( const mbedtls_ecp_group *grp, mbedtls_ecp_poi...
function ecp_add_mixed (line 1716) | static int ecp_add_mixed( const mbedtls_ecp_group *grp, mbedtls_ecp_poin...
function ecp_randomize_jac (line 1803) | static int ecp_randomize_jac( const mbedtls_ecp_group *grp, mbedtls_ecp_...
function ecp_comb_recode_core (line 1905) | static void ecp_comb_recode_core( unsigned char x[], size_t d,
function ecp_precompute_comb (line 1965) | static int ecp_precompute_comb( const mbedtls_ecp_group *grp,
function ecp_select_comb (line 2081) | static int ecp_select_comb( const mbedtls_ecp_group *grp, mbedtls_ecp_po...
function ecp_mul_comb_core (line 2107) | static int ecp_mul_comb_core( const mbedtls_ecp_group *grp, mbedtls_ecp_...
function ecp_comb_recode_scalar (line 2179) | static int ecp_comb_recode_scalar( const mbedtls_ecp_group *grp,
function ecp_mul_comb_after_precomp (line 2214) | static int ecp_mul_comb_after_precomp( const mbedtls_ecp_group *grp,
function ecp_pick_window_size (line 2275) | static unsigned char ecp_pick_window_size( const mbedtls_ecp_group *grp,
function ecp_mul_comb (line 2318) | static int ecp_mul_comb( mbedtls_ecp_group *grp, mbedtls_ecp_point *R,
function ecp_normalize_mxz (line 2470) | static int ecp_normalize_mxz( const mbedtls_ecp_group *grp, mbedtls_ecp_...
function ecp_randomize_mxz (line 2496) | static int ecp_randomize_mxz( const mbedtls_ecp_group *grp, mbedtls_ecp_...
function ecp_double_add_mxz (line 2548) | static int ecp_double_add_mxz( const mbedtls_ecp_group *grp,
function mbedtls_ecp_mul_restartable (line 2707) | int mbedtls_ecp_mul_restartable( mbedtls_ecp_group *grp, mbedtls_ecp_poi...
function mbedtls_ecp_mul (line 2799) | int mbedtls_ecp_mul( mbedtls_ecp_group *grp, mbedtls_ecp_point *R,
function ecp_check_pubkey_sw (line 2815) | static int ecp_check_pubkey_sw( const mbedtls_ecp_group *grp, const mbed...
function mbedtls_ecp_mul_shortcuts (line 2856) | static int mbedtls_ecp_mul_shortcuts( mbedtls_ecp_group *grp,
function mbedtls_ecp_muladd (line 3034) | int mbedtls_ecp_muladd( mbedtls_ecp_group *grp, mbedtls_ecp_point *R,
function ecp_check_pubkey_mx (line 3052) | static int ecp_check_pubkey_mx( const mbedtls_ecp_group *grp, const mbed...
function mbedtls_ecp_check_pubkey (line 3090) | int mbedtls_ecp_check_pubkey( const mbedtls_ecp_group *grp,
function dontinline (line 3128) | dontinline int mbedtls_ecp_check_privkey( const mbedtls_ecp_group *grp,
function mbedtls_ecp_gen_privkey (line 3176) | int mbedtls_ecp_gen_privkey( const mbedtls_ecp_group *grp,
function mbedtls_ecp_gen_keypair_base (line 3293) | int mbedtls_ecp_gen_keypair_base( mbedtls_ecp_group *grp,
function mbedtls_ecp_gen_keypair (line 3334) | int mbedtls_ecp_gen_keypair( mbedtls_ecp_group *grp,
function mbedtls_ecp_gen_key (line 3362) | int mbedtls_ecp_gen_key( mbedtls_ecp_group_id grp_id, mbedtls_ecp_keypai...
function mbedtls_ecp_read_key (line 3393) | int mbedtls_ecp_read_key( mbedtls_ecp_group_id grp_id, mbedtls_ecp_keypa...
function mbedtls_ecp_write_key (line 3474) | int mbedtls_ecp_write_key( mbedtls_ecp_keypair *key,
function mbedtls_ecp_check_pub_priv (line 3526) | int mbedtls_ecp_check_pub_priv( const mbedtls_ecp_keypair *pub,
function self_test_adjust_exponent (line 3573) | static int self_test_adjust_exponent( const mbedtls_ecp_group *grp,
function self_test_point (line 3608) | static int self_test_point( int verbose,
function mbedtls_ecp_self_test (line 3666) | int mbedtls_ecp_self_test( int verbose )
function mbedtls_ecp_set_zero (line 3790) | int mbedtls_ecp_set_zero( mbedtls_ecp_point *pt )
FILE: third_party/mbedtls/ecp.h
type mbedtls_ecp_group_id (line 27) | typedef enum
type mbedtls_ecp_curve_type (line 73) | typedef enum
type mbedtls_ecp_curve_info (line 83) | typedef struct mbedtls_ecp_curve_info
type mbedtls_ecp_point (line 102) | typedef struct mbedtls_ecp_point
type mbedtls_ecp_group (line 151) | typedef struct mbedtls_ecp_group
type mbedtls_ecp_restart_mul_ctx (line 243) | typedef struct mbedtls_ecp_restart_mul mbedtls_ecp_restart_mul_ctx;
type mbedtls_ecp_restart_muladd_ctx (line 250) | typedef struct mbedtls_ecp_restart_muladd mbedtls_ecp_restart_muladd_ctx;
type mbedtls_ecp_restart_ctx (line 255) | typedef struct
type mbedtls_ecp_restart_ctx (line 296) | typedef void mbedtls_ecp_restart_ctx;
type mbedtls_ecp_keypair (line 308) | typedef struct mbedtls_ecp_keypair
FILE: third_party/mbedtls/ecp256.c
function mbedtls_p256_isz (line 35) | static bool
function mbedtls_p256_gte (line 41) | static bool
function mbedtls_p256_cmp (line 56) | static int
function mbedtls_p256_red (line 79) | static void
function mbedtls_p256_gro (line 102) | static void
function mbedtls_p256_rum (line 125) | static void
function mbedtls_p256_mod (line 132) | static void
function mbedtls_p256_sar (line 147) | static void
function mbedtls_p256_shl (line 157) | static void
function mbedtls_p256_mul (line 168) | static inline void
function mbedtls_p256_plu (line 177) | static void
function mbedtls_p256_slu (line 205) | static void
function mbedtls_p256_add (line 233) | static void
function mbedtls_p256_sub (line 268) | static void
function mbedtls_p256_hub (line 305) | static void
function mbedtls_p256_cop (line 332) | static inline void
function mbedtls_p256_dim (line 339) | static int
function mbedtls_p256_double_jac (line 349) | int mbedtls_p256_double_jac( const mbedtls_ecp_group *G,
function mbedtls_p256_add_mixed (line 405) | int mbedtls_p256_add_mixed( const mbedtls_ecp_group *G,
function mbedtls_p256_inv (line 469) | static void
function mbedtls_p256_normalize_jac_many (line 517) | int mbedtls_p256_normalize_jac_many( const mbedtls_ecp_group *grp,
function mbedtls_p256_normalize_jac (line 550) | int mbedtls_p256_normalize_jac( const mbedtls_ecp_group *grp,
FILE: third_party/mbedtls/ecp384.c
function mbedtls_p384_isz (line 35) | static bool
function mbedtls_p384_gte (line 41) | static bool
function mbedtls_p384_cmp (line 60) | static int
function mbedtls_p384_red (line 83) | static inline void
function mbedtls_p384_gro (line 110) | static inline void
function mbedtls_p384_rum (line 137) | static inline void
function mbedtls_p384_mod (line 144) | void mbedtls_p384_mod( uint64_t X[12] )
function mbedtls_p384_sar (line 156) | static inline void
function mbedtls_p384_shl (line 168) | static inline void
function mbedtls_p384_mul (line 181) | static void
function mbedtls_p384_plu (line 208) | static void
function mbedtls_p384_slu (line 242) | static void
function mbedtls_p384_add (line 276) | static void
function mbedtls_p384_sub (line 319) | static void
function mbedtls_p384_hub (line 364) | static void
function mbedtls_p384_cop (line 395) | static inline void
function mbedtls_p384_dim (line 402) | static int
function mbedtls_p384_double_jac (line 412) | int mbedtls_p384_double_jac( const mbedtls_ecp_group *G,
function mbedtls_p384_add_mixed (line 447) | int mbedtls_p384_add_mixed( const mbedtls_ecp_group *G,
function mbedtls_p384_inv (line 506) | static void
function mbedtls_p384_normalize_jac (line 554) | int mbedtls_p384_normalize_jac( const mbedtls_ecp_group *grp,
function mbedtls_p384_normalize_jac_many (line 571) | int mbedtls_p384_normalize_jac_many( const mbedtls_ecp_group *grp,
FILE: third_party/mbedtls/ecp_curves.c
function ecp_mpi_load (line 584) | static inline void ecp_mpi_load( mbedtls_mpi *X, const mbedtls_mpi_uint ...
function ecp_mpi_set1 (line 594) | static inline void ecp_mpi_set1( mbedtls_mpi *X )
function ecp_group_load (line 605) | static int ecp_group_load( mbedtls_ecp_group *grp,
function ecp_use_curve25519 (line 688) | static int ecp_use_curve25519( mbedtls_ecp_group *grp )
function ecp_use_curve448 (line 727) | static int ecp_use_curve448( mbedtls_ecp_group *grp )
function mbedtls_ecp_group_load (line 786) | int mbedtls_ecp_group_load( mbedtls_ecp_group *grp, mbedtls_ecp_group_id...
function add64 (line 901) | static inline void add64( mbedtls_mpi_uint *dst, mbedtls_mpi_uint *src, ...
function carry64 (line 914) | static inline void carry64( mbedtls_mpi_uint *dst, mbedtls_mpi_uint *car...
function ecp_mod_p192 (line 933) | static int ecp_mod_p192( mbedtls_mpi *N )
function add32 (line 1006) | static inline void add32( uint32_t *dst, uint32_t src, signed char *carry )
function sub32 (line 1012) | static inline void sub32( uint32_t *dst, uint32_t src, signed char *carry )
function fix_negative (line 1060) | static inline int fix_negative( mbedtls_mpi *N, signed char c, mbedtls_m...
function ecp_mod_p224 (line 1087) | static int ecp_mod_p224( mbedtls_mpi *N )
function ecp_mod_p256_old (line 1108) | int ecp_mod_p256_old( mbedtls_mpi *N )
function ecp_mod_p384_old (line 1145) | int ecp_mod_p384_old( mbedtls_mpi *N )
function ecp_mod_p521 (line 1218) | static int ecp_mod_p521( mbedtls_mpi *N )
function ecp_mod_p255 (line 1267) | static int ecp_mod_p255( mbedtls_mpi *N )
function ecp_mod_p448 (line 1324) | static int ecp_mod_p448( mbedtls_mpi *N )
function ecp_mod_koblitz (line 1385) | static inline int ecp_mod_koblitz( mbedtls_mpi *N, mbedtls_mpi_uint *Rp,...
function ecp_mod_p192k1 (line 1459) | static int ecp_mod_p192k1( mbedtls_mpi *N )
function ecp_mod_p224k1 (line 1473) | static int ecp_mod_p224k1( mbedtls_mpi *N )
function ecp_mod_p256k1 (line 1492) | static int ecp_mod_p256k1( mbedtls_mpi *N )
FILE: third_party/mbedtls/ecpshl.c
function mbedtls_mpi_shift_l_mod_p256 (line 21) | static void mbedtls_mpi_shift_l_mod_p256( const mbedtls_ecp_group *G,
function mbedtls_mpi_shift_l_mod_p384 (line 49) | static void mbedtls_mpi_shift_l_mod_p384( const mbedtls_ecp_group *G,
function mbedtls_mpi_shift_l_mod (line 85) | int mbedtls_mpi_shift_l_mod( const mbedtls_ecp_group *G, mbedtls_mpi *X )
FILE: third_party/mbedtls/entropy.c
function mbedtls_entropy_init (line 62) | void mbedtls_entropy_init( mbedtls_entropy_context *ctx )
function mbedtls_entropy_free (line 86) | void mbedtls_entropy_free( mbedtls_entropy_context *ctx )
function mbedtls_entropy_add_source (line 121) | int mbedtls_entropy_add_source( mbedtls_entropy_context *ctx,
function entropy_update (line 139) | static int entropy_update( mbedtls_entropy_context *ctx, unsigned char s...
function mbedtls_entropy_update_manual (line 204) | int mbedtls_entropy_update_manual( mbedtls_entropy_context *ctx,
function entropy_gather_internal (line 213) | static int entropy_gather_internal( mbedtls_entropy_context *ctx )
function mbedtls_entropy_gather (line 267) | int mbedtls_entropy_gather( mbedtls_entropy_context *ctx )
function mbedtls_entropy_func (line 282) | int mbedtls_entropy_func( void *data, unsigned char *output, size_t len )
function mbedtls_entropy_update_nv_seed (line 403) | int mbedtls_entropy_update_nv_seed( mbedtls_entropy_context *ctx )
function mbedtls_entropy_write_seed_file (line 430) | int mbedtls_entropy_write_seed_file( mbedtls_entropy_context *ctx, const...
function mbedtls_entropy_update_seed_file (line 469) | int mbedtls_entropy_update_seed_file( mbedtls_entropy_context *ctx, cons...
function entropy_dummy_source (line 507) | static int entropy_dummy_source( void *data, unsigned char *output,
function mbedtls_entropy_source_self_test_gather (line 521) | static int mbedtls_entropy_source_self_test_gather( unsigned char *buf, ...
function mbedtls_entropy_source_self_test_check_bits (line 547) | static int mbedtls_entropy_source_self_test_check_bits( const unsigned c...
function mbedtls_entropy_source_self_test (line 576) | int mbedtls_entropy_source_self_test( int verbose )
function mbedtls_entropy_self_test (line 643) | int mbedtls_entropy_self_test( int verbose )
FILE: third_party/mbedtls/entropy.h
type mbedtls_entropy_source_state (line 58) | typedef struct mbedtls_entropy_source_state
type mbedtls_entropy_context (line 71) | typedef struct mbedtls_entropy_context
FILE: third_party/mbedtls/entropy_poll.c
function mbedtls_hardclock_poll (line 22) | int mbedtls_hardclock_poll(void *data, unsigned char *output, size_t len,
FILE: third_party/mbedtls/error.c
function mbedtls_strerror (line 643) | void mbedtls_strerror( int ret, char *buf, size_t buflen )
function mbedtls_strerror (line 713) | void mbedtls_strerror( int ret, char *buf, size_t buflen )
FILE: third_party/mbedtls/everest.c
function forceinline (line 31) | forceinline void HaclBignumCopy(uint64_t o[5], uint64_t p[5]) {
function forceinline (line 37) | forceinline void HaclBignumFsum(uint64_t o[5], uint64_t p[5]) {
function forceinline (line 43) | forceinline void HaclBignumTrunc(uint64_t o[5], uint128_t p[5]) {
function forceinline (line 49) | forceinline void HaclBignumCarry(uint64_t p[5]) {
function forceinline (line 56) | forceinline void HaclBignumCarryWide(uint128_t p[5]) {
function HaclBignumFmulReduce (line 63) | static void HaclBignumFmulReduce(uint128_t o[5], uint64_t p[5], uint64_t...
function HaclBignumFmul (line 80) | static void HaclBignumFmul(uint64_t o[5], uint64_t p[5], uint64_t q[5]) {
function HaclBignumFsquare (line 92) | static void HaclBignumFsquare(uint128_t t[5], uint64_t p[5]) {
function HaclBignumFsqa (line 100) | static void HaclBignumFsqa(uint64_t o[5], uint32_t n) {
function HaclBignumFsqr (line 113) | static void HaclBignumFsqr(uint64_t o[5], uint64_t p[5], uint32_t n) {
function HaclBignumCrecip (line 118) | static void HaclBignumCrecip(uint64_t o[5], uint64_t z[5]) {
function HaclBignumFdif (line 144) | static void HaclBignumFdif(uint64_t a[5], uint64_t b[5]) {
function HaclBignumFscalar (line 152) | static void HaclBignumFscalar(uint64_t o[5], uint64_t p[5], uint64_t s) {
function HaclEcPointSwap (line 162) | static void HaclEcPointSwap(uint64_t a[2][5], uint64_t b[2][5], uint64_t...
function HaclEcFormatFexpand (line 175) | static void HaclEcFormatFexpand(uint64_t o[5], const uint8_t p[32]) {
function HaclEcFormatFcontract (line 183) | static void HaclEcFormatFcontract(uint8_t o[32], uint64_t p[5]) {
function HaclEcFormatScalarOfPoint (line 210) | static void HaclEcFormatScalarOfPoint(uint8_t o[32], uint64_t p[2][5]) {
function HaclEcAddAndDoubleFmonty (line 217) | static void HaclEcAddAndDoubleFmonty(uint64_t xz2[2][5], uint64_t xz3[2]...
function curve25519 (line 247) | void curve25519(uint8_t mypublic[32], const uint8_t secret[32],
FILE: third_party/mbedtls/fastdiv.h
function COSMOPOLITAN_C_START_ (line 4) | COSMOPOLITAN_C_START_
function GetDivisor (line 12) | static inline struct Divisor GetDivisor(uint64_t d) {
function forceinline (line 20) | forceinline uint64_t Divide(uint64_t x, struct Divisor d) {
FILE: third_party/mbedtls/formatclientciphers.c
function __wur (line 28) | __wur char *FormatSslClientCiphers(const mbedtls_ssl_context *ssl) {
FILE: third_party/mbedtls/gcm.c
function mbedtls_gcm_init (line 82) | void mbedtls_gcm_init( mbedtls_gcm_context *ctx )
function gcm_gen_table (line 96) | static int gcm_gen_table( mbedtls_gcm_context *ctx )
function mbedtls_gcm_setkey (line 156) | int mbedtls_gcm_setkey( mbedtls_gcm_context *ctx,
function gcm_mult (line 202) | static void gcm_mult( mbedtls_gcm_context *ctx, unsigned char x[16] )
function mbedtls_gcm_starts (line 255) | int mbedtls_gcm_starts( mbedtls_gcm_context *ctx,
function mbedtls_gcm_update (line 343) | int mbedtls_gcm_update( mbedtls_gcm_context *ctx,
function mbedtls_gcm_finish (line 459) | int mbedtls_gcm_finish( mbedtls_gcm_context *ctx,
function mbedtls_gcm_crypt_and_tag (line 533) | int mbedtls_gcm_crypt_and_tag( mbedtls_gcm_context *ctx,
function mbedtls_gcm_auth_decrypt (line 594) | int mbedtls_gcm_auth_decrypt( mbedtls_gcm_context *ctx,
function mbedtls_gcm_free (line 637) | void mbedtls_gcm_free( mbedtls_gcm_context *ctx )
function mbedtls_gcm_self_test (line 881) | int mbedtls_gcm_self_test( int verbose )
FILE: third_party/mbedtls/gcm.h
type mbedtls_gcm_context (line 13) | typedef struct mbedtls_gcm_context {
FILE: third_party/mbedtls/getciphersuite.c
function mbedtls_ssl_ciphersuite_t (line 35) | const mbedtls_ssl_ciphersuite_t *GetCipherSuite(const char *s) {
FILE: third_party/mbedtls/hkdf.c
function mbedtls_hkdf (line 52) | int mbedtls_hkdf( const mbedtls_md_info_t *md, const unsigned char *salt,
function mbedtls_hkdf_extract (line 93) | int mbedtls_hkdf_extract( const mbedtls_md_info_t *md,
function mbedtls_hkdf_expand (line 144) | int mbedtls_hkdf_expand( const mbedtls_md_info_t *md, const unsigned cha...
FILE: third_party/mbedtls/hmac_drbg.c
function mbedtls_hmac_drbg_init (line 65) | void mbedtls_hmac_drbg_init( mbedtls_hmac_drbg_context *ctx )
function mbedtls_hmac_drbg_update_ret (line 88) | int mbedtls_hmac_drbg_update_ret( mbedtls_hmac_drbg_context *ctx,
function mbedtls_hmac_drbg_seed_buf (line 151) | int mbedtls_hmac_drbg_seed_buf( mbedtls_hmac_drbg_context *ctx,
function hmac_drbg_reseed_core (line 181) | static int hmac_drbg_reseed_core( mbedtls_hmac_drbg_context *ctx,
function mbedtls_hmac_drbg_reseed (line 281) | int mbedtls_hmac_drbg_reseed( mbedtls_hmac_drbg_context *ctx,
function mbedtls_hmac_drbg_seed (line 345) | int mbedtls_hmac_drbg_seed( mbedtls_hmac_drbg_context *ctx,
function mbedtls_hmac_drbg_set_prediction_resistance (line 408) | void mbedtls_hmac_drbg_set_prediction_resistance( mbedtls_hmac_drbg_cont...
function mbedtls_hmac_drbg_set_entropy_len (line 423) | void mbedtls_hmac_drbg_set_entropy_len( mbedtls_hmac_drbg_context *ctx, ...
function mbedtls_hmac_drbg_set_reseed_interval (line 440) | void mbedtls_hmac_drbg_set_reseed_interval( mbedtls_hmac_drbg_context *c...
function mbedtls_hmac_drbg_random_with_add (line 476) | int mbedtls_hmac_drbg_random_with_add( void *p_rng,
function mbedtls_hmac_drbg_random (line 562) | int mbedtls_hmac_drbg_random( void *p_rng, unsigned char *output, size_t...
function mbedtls_hmac_drbg_free (line 574) | void mbedtls_hmac_drbg_free( mbedtls_hmac_drbg_context *ctx )
function mbedtls_hmac_drbg_write_seed_file (line 596) | int mbedtls_hmac_drbg_write_seed_file( mbedtls_hmac_drbg_context *ctx, c...
function mbedtls_hmac_drbg_update_seed_file (line 637) | int mbedtls_hmac_drbg_update_seed_file( mbedtls_hmac_drbg_context *ctx, ...
function hmac_drbg_self_test_entropy (line 712) | static int hmac_drbg_self_test_entropy( void *data,
function mbedtls_hmac_drbg_self_test (line 734) | int mbedtls_hmac_drbg_self_test( int verbose )
FILE: third_party/mbedtls/hmac_drbg.h
type mbedtls_hmac_drbg_context (line 31) | typedef struct mbedtls_hmac_drbg_context
FILE: third_party/mbedtls/isciphersuitegood.c
function IsCipherSuiteGood (line 20) | bool IsCipherSuiteGood(uint16_t x) {
FILE: third_party/mbedtls/karatsuba.c
function forceinline (line 26) | forceinline int Cmp(uint64_t *a, uint64_t *b, size_t n) {
function forceinline (line 38) | forceinline bool Sub(uint64_t *C, uint64_t *A, uint64_t *B, size_t n) {
function forceinline (line 62) | forceinline bool Add(uint64_t *C, uint64_t *A, uint64_t *B, size_t n) {
function Karatsuba (line 92) | void Karatsuba(uint64_t *C, uint64_t *A, uint64_t *B, size_t n, uint64_t...
FILE: third_party/mbedtls/md.c
function mbedtls_md_info_t (line 119) | const mbedtls_md_info_t *mbedtls_md_info_from_string( const char *md_name )
function mbedtls_md_info_t (line 168) | const mbedtls_md_info_t *mbedtls_md_info_from_type( mbedtls_md_type_t md...
function GetMdContextSize (line 209) | static int16_t GetMdContextSize(mbedtls_md_type_t t)
function mbedtls_md_init (line 256) | void mbedtls_md_init( mbedtls_md_context_t *ctx )
function mbedtls_md_free (line 274) | void mbedtls_md_free( mbedtls_md_context_t *ctx )
function mbedtls_md_clone (line 313) | int mbedtls_md_clone( mbedtls_md_context_t *dst,
function mbedtls_md_setup (line 355) | int mbedtls_md_setup( mbedtls_md_context_t *ctx, const mbedtls_md_info_t...
function mbedtls_md_file (line 396) | int mbedtls_md_file( const mbedtls_md_info_t *md_info, const char *path,...
function mbedtls_md_hmac_starts (line 441) | int mbedtls_md_hmac_starts( mbedtls_md_context_t *ctx, const unsigned ch...
function mbedtls_md_hmac_finish (line 491) | int mbedtls_md_hmac_finish( mbedtls_md_context_t *ctx, unsigned char *ou...
function mbedtls_md_hmac_reset (line 523) | int mbedtls_md_hmac_reset( mbedtls_md_context_t *ctx )
function mbedtls_md_hmac (line 557) | int mbedtls_md_hmac( const mbedtls_md_info_t *md_info,
FILE: third_party/mbedtls/md.h
type mbedtls_md_type_t (line 21) | typedef enum {
type mbedtls_md_info_t (line 51) | typedef struct mbedtls_md_info_t {
type mbedtls_md_context_t (line 66) | typedef struct mbedtls_md_context_t {
function mbedtls_md_get_size (line 89) | forceinline unsigned char mbedtls_md_get_size( const mbedtls_md_info_t *...
function mbedtls_md_get_block_size (line 105) | forceinline unsigned char mbedtls_md_get_block_size( const mbedtls_md_in...
function forceinline (line 121) | forceinline mbedtls_md_type_t mbedtls_md_get_type( const mbedtls_md_info...
function forceinline (line 137) | forceinline const char *mbedtls_md_get_name( const mbedtls_md_info_t *md...
function forceinline (line 157) | forceinline int mbedtls_md_starts( mbedtls_md_context_t *ctx )
function forceinline (line 180) | forceinline int mbedtls_md_update( mbedtls_md_context_t *ctx,
function forceinline (line 206) | forceinline int mbedtls_md_finish( mbedtls_md_context_t *ctx,
function forceinline (line 232) | forceinline int mbedtls_md( const mbedtls_md_info_t *md_info,
function forceinline (line 266) | forceinline int mbedtls_md_hmac_update( mbedtls_md_context_t *ctx,
function forceinline (line 279) | forceinline int mbedtls_md_process( mbedtls_md_context_t *ctx, const uns...
FILE: third_party/mbedtls/md5.c
function mbedtls_md5_clone (line 66) | void mbedtls_md5_clone( mbedtls_md5_context *dst,
function mbedtls_md5_starts_ret (line 83) | int mbedtls_md5_starts_ret( mbedtls_md5_context *ctx )
function mbedtls_internal_md5_process (line 109) | int mbedtls_internal_md5_process( mbedtls_md5_context *ctx,
function mbedtls_md5_update_ret (line 233) | int mbedtls_md5_update_ret( mbedtls_md5_context *ctx,
function mbedtls_md5_finish_ret (line 293) | int mbedtls_md5_finish_ret( mbedtls_md5_context *ctx,
function mbedtls_md5_ret (line 362) | int mbedtls_md5_ret( const void *input,
FILE: third_party/mbedtls/md5.h
type mbedtls_md5_context (line 17) | typedef struct mbedtls_md5_context
function mbedtls_md5_init (line 42) | static inline void mbedtls_md5_init( mbedtls_md5_context *ctx )
function mbedtls_md5_free (line 56) | static inline void mbedtls_md5_free( mbedtls_md5_context *ctx )
FILE: third_party/mbedtls/md5t.c
function mbedtls_md5_self_test (line 70) | int mbedtls_md5_self_test( int verbose )
FILE: third_party/mbedtls/memory_buffer_alloc.c
type memory_header (line 48) | typedef struct _memory_header memory_header;
type _memory_header (line 49) | struct _memory_header
type buffer_alloc_ctx (line 65) | typedef struct
function debug_header (line 86) | static void debug_header( memory_header *hdr )
function debug_chain (line 107) | static void debug_chain( void )
function verify_header (line 129) | static int verify_header( memory_header *hdr )
function verify_chain (line 174) | static int verify_chain( void )
function buffer_alloc_free (line 376) | static void buffer_alloc_free( void *ptr )
function mbedtls_memory_buffer_set_verify (line 493) | void mbedtls_memory_buffer_set_verify( int verify )
function mbedtls_memory_buffer_alloc_verify (line 498) | int mbedtls_memory_buffer_alloc_verify( void )
function mbedtls_memory_buffer_alloc_status (line 504) | void mbedtls_memory_buffer_alloc_status( void )
function mbedtls_memory_buffer_alloc_max_get (line 526) | void mbedtls_memory_buffer_alloc_max_get( size_t *max_used, size_t *max_...
function mbedtls_memory_buffer_alloc_max_reset (line 532) | void mbedtls_memory_buffer_alloc_max_reset( void )
function mbedtls_memory_buffer_alloc_cur_get (line 538) | void mbedtls_memory_buffer_alloc_cur_get( size_t *cur_used, size_t *cur_...
function mbedtls_memory_buffer_alloc_init (line 545) | void mbedtls_memory_buffer_alloc_init( unsigned char *buf, size_t len )
function mbedtls_memory_buffer_alloc_free (line 573) | void mbedtls_memory_buffer_alloc_free( void )
function check_pointer (line 579) | static int check_pointer( void *p )
function mbedtls_memory_buffer_alloc_self_test (line 615) | int mbedtls_memory_buffer_alloc_self_test( int verbose )
FILE: third_party/mbedtls/net_sockets.c
function net_prepare (line 42) | static int net_prepare(void) {
function mbedtls_net_init (line 53) | void mbedtls_net_init(mbedtls_net_context *ctx) {
function mbedtls_net_connect (line 72) | int mbedtls_net_connect(mbedtls_net_context *ctx, const char *host,
function mbedtls_net_bind (line 126) | int mbedtls_net_bind(mbedtls_net_context *ctx, const char *bind_ip,
function net_would_block (line 182) | static int net_would_block(const mbedtls_net_context *ctx) {
function mbedtls_net_accept (line 214) | int mbedtls_net_accept(mbedtls_net_context *bind_ctx,
function mbedtls_net_set_block (line 303) | int mbedtls_net_set_block(mbedtls_net_context *ctx) {
function mbedtls_net_set_nonblock (line 314) | int mbedtls_net_set_nonblock(mbedtls_net_context *ctx) {
function mbedtls_net_poll (line 343) | int mbedtls_net_poll(mbedtls_net_context *ctx, uint32_t rw, uint32_t tim...
function mbedtls_net_usleep (line 399) | void mbedtls_net_usleep(unsigned long usec) {
function mbedtls_net_recv (line 415) | int mbedtls_net_recv(void *ctx, unsigned char *buf, size_t len) {
function mbedtls_net_recv_timeout (line 457) | int mbedtls_net_recv_timeout(void *ctx, unsigned char *buf, size_t len,
function mbedtls_net_send (line 497) | int mbedtls_net_send(void *ctx, const unsigned char *buf, size_t len) {
function mbedtls_net_close (line 518) | void mbedtls_net_close(mbedtls_net_context *ctx) {
function mbedtls_net_free (line 529) | void mbedtls_net_free(mbedtls_net_context *ctx) {
FILE: third_party/mbedtls/net_sockets.h
type mbedtls_net_context (line 34) | typedef struct mbedtls_net_context
FILE: third_party/mbedtls/nist_kw.c
function mbedtls_nist_kw_init (line 68) | void mbedtls_nist_kw_init( mbedtls_nist_kw_context *ctx )
function mbedtls_nist_kw_setkey (line 73) | int mbedtls_nist_kw_setkey( mbedtls_nist_kw_context *ctx,
function mbedtls_nist_kw_free (line 122) | void mbedtls_nist_kw_free( mbedtls_nist_kw_context *ctx )
function calc_a_xor_t (line 132) | static void calc_a_xor_t( unsigned char A[KW_SEMIBLOCK_LENGTH], uint64_t...
function mbedtls_nist_kw_wrap (line 145) | int mbedtls_nist_kw_wrap( mbedtls_nist_kw_context *ctx,
function unwrap (line 286) | static int unwrap( mbedtls_nist_kw_context *ctx,
function mbedtls_nist_kw_unwrap (line 347) | int mbedtls_nist_kw_unwrap( mbedtls_nist_kw_context *ctx,
function mbedtls_nist_kw_self_test (line 587) | int mbedtls_nist_kw_self_test( int verbose )
FILE: third_party/mbedtls/nist_kw.h
type mbedtls_nist_kw_mode_t (line 10) | typedef enum
type mbedtls_nist_kw_context (line 27) | typedef struct {
FILE: third_party/mbedtls/oid.c
type oid_x520_attr_t (line 145) | typedef struct {
type oid_x509_ext_t (line 240) | typedef struct {
type oid_sig_alg_t (line 307) | typedef struct {
type oid_pk_alg_t (line 416) | typedef struct {
type oid_ecp_grp_t (line 449) | typedef struct {
type oid_cipher_alg_t (line 537) | typedef struct {
type oid_md_alg_t (line 566) | typedef struct {
type oid_md_hmac_t (line 630) | typedef struct {
type oid_pkcs12_pbe_alg_t (line 677) | typedef struct {
function mbedtls_oid_get_numeric_string (line 713) | int mbedtls_oid_get_numeric_string( char *buf, size_t size,
FILE: third_party/mbedtls/oid.h
type mbedtls_oid_descriptor_t (line 396) | typedef struct mbedtls_oid_descriptor_t
FILE: third_party/mbedtls/param.c
function mbedtls_param_failed (line 26) | void mbedtls_param_failed(const char *msg, const char *file, int line) {
FILE: third_party/mbedtls/pem.c
function mbedtls_pem_init (line 39) | void mbedtls_pem_init( mbedtls_pem_context *ctx )
function pem_get_iv (line 49) | static int pem_get_iv( const unsigned char *s, unsigned char *iv,
function pem_pbkdf1 (line 66) | static int pem_pbkdf1( unsigned char *key, size_t keylen,
function pem_des_decrypt (line 110) | static int pem_des_decrypt( unsigned char des_iv[8],
function pem_des3_decrypt (line 133) | static int pem_des3_decrypt( unsigned char des3_iv[8],
function pem_aes_decrypt (line 158) | static int pem_aes_decrypt( unsigned char aes_iv[16], unsigned int keylen,
function mbedtls_pem_read_buffer (line 182) | int mbedtls_pem_read_buffer( mbedtls_pem_context *ctx, const char *heade.
Copy disabled (too large)
Download .json
Condensed preview — 621 files, each showing path, character count, and a content snippet. Download the .json file for the full structured content (18,985K chars).
[
{
"path": ".github/ISSUE_TEMPLATE/01-bug-low.yml",
"chars": 2018,
"preview": "name: Low Severity Bugs\ndescription: Used to report low severity bugs in llamafiles (e.g. cosmetic issues, non critical "
},
{
"path": ".github/ISSUE_TEMPLATE/02-bug-medium.yml",
"chars": 2036,
"preview": "name: Medium Severity Bug\ndescription: Used to report medium severity bugs in llamafiles (e.g. Malfunctioning Features b"
},
{
"path": ".github/ISSUE_TEMPLATE/03-bug-high.yml",
"chars": 2038,
"preview": "name: High Severity Bug\ndescription: Used to report high severity bugs in llamafiles (e.g. Malfunctioning features hinde"
},
{
"path": ".github/ISSUE_TEMPLATE/04-bug-critical.yml",
"chars": 2020,
"preview": "name: Critical Severity Bug\ndescription: Used to report critical severity bugs in llamafiles (e.g. Crashing, Corrupted, "
},
{
"path": ".github/ISSUE_TEMPLATE/05-enhancement.yml",
"chars": 2429,
"preview": "name: Enhancement template\ndescription: Used to request enhancements for llamafiles\ntitle: \"Feature Request: \"\nlabels: ["
},
{
"path": ".github/ISSUE_TEMPLATE/06-refactor.yml",
"chars": 1230,
"preview": "name: Refactor (Maintainers)\ndescription: Used to track refactoring opportunities\ntitle: \"Refactor: \"\nlabels: [\"refactor"
},
{
"path": ".github/ISSUE_TEMPLATE/07-refactor.yml",
"chars": 1230,
"preview": "name: Refactor (Maintainers)\ndescription: Used to track refactoring opportunities\ntitle: \"Refactor: \"\nlabels: [\"refactor"
},
{
"path": ".github/ISSUE_TEMPLATE/config.yml",
"chars": 543,
"preview": "blank_issues_enabled: true\ncontact_links:\n - name: Got an idea?\n url: https://github.com/Mozilla-Ocho/llamafile/disc"
},
{
"path": ".github/labeler.yml",
"chars": 692,
"preview": "# https://github.com/actions/labeler\ndocumentation:\n - changed-files:\n - any-glob-to-any-file:\n - R"
},
{
"path": ".github/workflows/ci.yml",
"chars": 1673,
"preview": "name: CI\non:\n workflow_dispatch:\n push:\n branches: [ master, main, fix ]\n pull_request:\n branches: [ master, ma"
},
{
"path": ".github/workflows/docs.yml",
"chars": 1103,
"preview": "name: Documentation\n\non:\n push:\n branches: [main]\n paths:\n - mkdocs.yml\n - 'docs/**'\n - '.github/w"
},
{
"path": ".github/workflows/editorconfig.yml",
"chars": 607,
"preview": "name: EditorConfig Checker\n\non:\n workflow_dispatch: # allows manual triggering\n inputs:\n create_release:\n "
},
{
"path": ".github/workflows/labeler.yml",
"chars": 358,
"preview": "name: \"Pull Request Labeler\"\non:\n- pull_request_target\n\njobs:\n labeler:\n permissions:\n contents: read\n pul"
},
{
"path": ".github/workflows/update-llama-cpp.yml",
"chars": 2866,
"preview": "name: Update llama.cpp submodule\n\non:\n schedule:\n - cron: '0 0 * * 1'\n workflow_dispatch:\n\njobs:\n update-submodule"
},
{
"path": ".gitignore",
"chars": 166,
"preview": "# -*- conf -*-\n\n/o\n/.cosmocc\n/TAGS\n/HTAGS\n/cosmocc\n/perf.data\n/perf.data.old\n/trace.json\n\n/*.log\n/*.bin\n/*.mp3\n\n.claude\n"
},
{
"path": ".gitmodules",
"chars": 420,
"preview": "[submodule \"whisper.cpp\"]\n\tpath = whisper.cpp\n\turl = https://github.com/ggerganov/whisper.cpp.git\n[submodule \"stable-dif"
},
{
"path": ".llamafile_plugin/.claude-plugin/marketplace.json",
"chars": 442,
"preview": "{\n \"name\": \"llamafile-local\",\n \"description\": \"Local llamafile plugin marketplace\",\n \"owner\": {\n \"name\": \"Mozilla "
},
{
"path": ".llamafile_plugin/.claude-plugin/plugin.json",
"chars": 122,
"preview": "{\n \"name\": \"llamafile\",\n \"version\": \"0.1.1\",\n \"description\": \"Build guidance and commands for the llamafile project\"\n"
},
{
"path": "LICENSE",
"chars": 583,
"preview": "The Apache 2.0 License\n\nCopyright 2023 Mozilla Foundation\n\nLicensed under the Apache License, Version 2.0 (the \"License\""
},
{
"path": "Makefile",
"chars": 4488,
"preview": "#-*-mode:makefile-gmake;indent-tabs-mode:t;tab-width:8;coding:utf-8-*-┐\n#── vi: set noet ft=make ts=8 sw=8 fenc=utf-8 :v"
},
{
"path": "README.md",
"chars": 5459,
"preview": "# llamafile\n\n<img src=\"docs/images/llamafile-640x640.png\" width=\"320\" height=\"320\"\n alt=\"[line drawing of llama anim"
},
{
"path": "README_0.10.0.md",
"chars": 4747,
"preview": "llamafile 0.10.0 has been a work in progress for a while. Now that we are merging\nits code with main, we want to leave t"
},
{
"path": "RELEASE.md",
"chars": 2764,
"preview": "# Making a llamafile Release\n\nThere are a few steps in making a llamafile release which will be detailed in this documen"
},
{
"path": "build/config.mk",
"chars": 2562,
"preview": "#-*-mode:makefile-gmake;indent-tabs-mode:t;tab-width:8;coding:utf-8-*-┐\n#── vi: set noet ft=make ts=8 sw=8 fenc=utf-8 :v"
},
{
"path": "build/cudacc",
"chars": 1009,
"preview": "#!/bin/sh\n\nfind_nvcc() {\n CC=$(command -v nvcc 2>/dev/null) && return\n CC=\"$CUDA_PATH/bin/nvcc\"\n [ -x \"$CC\" ] && retu"
},
{
"path": "build/deps.mk",
"chars": 688,
"preview": "#-*-mode:makefile-gmake;indent-tabs-mode:t;tab-width:8;coding:utf-8-*-┐\n#── vi: set noet ft=make ts=8 sw=8 fenc=utf-8 :v"
},
{
"path": "build/download-cosmocc.sh",
"chars": 3272,
"preview": "#!/bin/sh\n# cosmocc downloader script\n# https://justine.lol/cosmo3/#install\n# https://github.com/jart/cosmopolitan/blob/"
},
{
"path": "build/htags",
"chars": 3181,
"preview": "#!/bin/sh\n#-*-mode:sh;indent-tabs-mode:nil;tab-width:2;coding:utf-8-*-┐\n#── vi: set et ft=sh ts=2 sts=2 fenc=utf-8 :vi ─"
},
{
"path": "build/llamafile-convert",
"chars": 2592,
"preview": "#!/bin/sh\nBIN=${0%/*}\nPROG=${0##*/}\n\nif [ x\"$1\" = x\"--help\" ]; then\n echo \"Usage: $PROG <gguf file or url>\"\n echo\n ec"
},
{
"path": "build/llamafile-upgrade-engine",
"chars": 3908,
"preview": "#!/bin/sh\nBIN=\"${0%/*}\"\nPROG=\"${0##*/}\"\n\nprint_full_help() {\n cat << EOF\nUsage: $PROG [OPTION]... <old> (new)\nUpgrade l"
},
{
"path": "build/objdump",
"chars": 184,
"preview": "#!/bin/sh\nif printf '%s\\n' \"$*\" | grep aarch64 >/dev/null 2>&1; then\n exec aarch64-unknown-cosmo-objdump $1 ${2%/*}/.aa"
},
{
"path": "build/rules.mk",
"chars": 4018,
"preview": "#-*-mode:makefile-gmake;indent-tabs-mode:t;tab-width:8;coding:utf-8-*-┐\n#── vi: set noet ft=make ts=8 sw=8 fenc=utf-8 :v"
},
{
"path": "build/run",
"chars": 20,
"preview": "#!/bin/sh\nexec \"$@\"\n"
},
{
"path": "build/sha256sum.c",
"chars": 12114,
"preview": "/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│\n│ vi: set et ft=c ts=2 sts=2 sw=2 fenc="
},
{
"path": "build/tags.mk",
"chars": 748,
"preview": "#-*-mode:makefile-gmake;indent-tabs-mode:t;tab-width:8;coding:utf-8-*-┐\n#── vi: set noet ft=make ts=8 sw=8 fenc=utf-8 :v"
},
{
"path": "cosmocc-override.cmake",
"chars": 227,
"preview": "set(CMAKE_ASM_OUTPUT_EXTENSION .o)\nset(CMAKE_C_OUTPUT_EXTENSION .o)\nset(CMAKE_CXX_OUTPUT_EXTENSION .o)\nset(CMAKE_C_FLAGS"
},
{
"path": "docs/AGENTS.md",
"chars": 1624,
"preview": "# AGENTS.md\n\nThis file provides guidance to Claude Code when working with this repository.\n\n## Project Overview\n\nLlamafi"
},
{
"path": "docs/commands/build.md",
"chars": 534,
"preview": "---\ndescription: Build llamafile using the cosmocc toolchain\n---\n\n# Build Llamafile\n\nBuild the project using the Cosmopo"
},
{
"path": "docs/commands/check.md",
"chars": 171,
"preview": "---\ndescription: Run llamafile unit tests\n---\n\n# Run Llamafile Tests\n\nRun the unit test suite using the Cosmopolitan too"
},
{
"path": "docs/commands/clean.md",
"chars": 170,
"preview": "---\ndescription: Clean llamafile build outputs\n---\n\n# Clean Llamafile Build\n\nRemove all build outputs from the `o/` dire"
},
{
"path": "docs/creating_llamafiles.md",
"chars": 4754,
"preview": "# Creating a llamafile\n\nA llamafile bundles the llamafile executable, model weights, and a set of\ndefault arguments into"
},
{
"path": "docs/example_llamafiles.md",
"chars": 13461,
"preview": "We provide example llamafiles for a variety of models, so you can easily try out llamafile \nwith different kinds of LLMs"
},
{
"path": "docs/index.md",
"chars": 5915,
"preview": "# llamafile\n\n<img src=\"images/llamafile-640x640.png\" width=\"320\" height=\"320\"\n alt=\"[line drawing of llama animal he"
},
{
"path": "docs/quickstart.md",
"chars": 9291,
"preview": "# Getting Started with llamafile \n\nThe easiest way to try it for yourself is to download our example llamafile\nfor the ["
},
{
"path": "docs/running_llamafile.md",
"chars": 5488,
"preview": "You have just downloaded a llamafile from the [Example llamafiles](example_llamafiles.md) \nsection. Now what? Here are a"
},
{
"path": "docs/skills/llamafile/SKILL.md",
"chars": 5325,
"preview": "---\nname: llamafile\ndescription: This skill should be used when the user asks to \"build llamafile\", \"rebuild llamafile\","
},
{
"path": "docs/skills/llamafile/architecture.md",
"chars": 6161,
"preview": "# Llamafile Architecture\n\nRepository structure and component overview.\n\n## Project Overview\n\nLlamafile creates single-fi"
},
{
"path": "docs/skills/llamafile/building.md",
"chars": 4841,
"preview": "# Building Llamafile\n\nComplete guide to the llamafile build system and toolchain.\n\n## Prerequisites\n\n### Cosmopolitan To"
},
{
"path": "docs/skills/llamafile/development.md",
"chars": 4951,
"preview": "# Llamafile Development Workflow\n\nGuide to modifying code, managing patches, and working with submodules.\n\n## Developmen"
},
{
"path": "docs/skills/llamafile/testing.md",
"chars": 5791,
"preview": "# Testing Llamafile\n\nGuide to running and writing tests.\n\n## Running Tests\n\n### Manually testing the executable\n\n#### TU"
},
{
"path": "docs/skills/llamafile/update_llamacpp.md",
"chars": 3385,
"preview": "# Keeping llamafile updated with upstream llama.cpp\n\nllamafile relies on llama.cpp for many of its functionalities. Keep"
},
{
"path": "docs/source_installation.md",
"chars": 2418,
"preview": "Developing on llamafile requires a modern version of the GNU `make`\ncommand (called `gmake` on some systems), `sha256sum"
},
{
"path": "docs/support.md",
"chars": 3743,
"preview": "\n## Supported OSes\n\nllamafile supports the following operating systems, which require a minimum\nstock install:\n\n- Linux "
},
{
"path": "docs/technical_details.md",
"chars": 5386,
"preview": "Here is a succinct overview of the tricks we used to create the fattest\nexecutable format ever. The long story short is "
},
{
"path": "docs/troubleshooting.md",
"chars": 3172,
"preview": "\n\n\n## Gotchas and troubleshooting\n\nOn any platform, if your llamafile process is immediately killed, check\nif you have C"
},
{
"path": "docs/whisperfile/getting-started.md",
"chars": 3412,
"preview": "# Getting Started with Whisperfile\n\nThis tutorial will explain how to turn speech from audio files into plain text, usin"
},
{
"path": "docs/whisperfile/gpu.md",
"chars": 1165,
"preview": "# Using Whisperfile with GPUs\n\nGPU acceleration is most beneficial for the medium and large models. The\ntiny model is al"
},
{
"path": "docs/whisperfile/index.md",
"chars": 1156,
"preview": "# Whisperfile\n\nWhisperfile is a high-performance speech-to-text tool built on\n[whisper.cpp](https://github.com/ggerganov"
},
{
"path": "docs/whisperfile/packaging.md",
"chars": 2678,
"preview": "# How to make a Whisperfile\n\nWhisperfile is designed to be a single-file solution for speech-to-text.\nThis tutorial will"
},
{
"path": "docs/whisperfile/server.md",
"chars": 2665,
"preview": "# whisper-server HTTP API\n\nThe whisper-server provides an HTTP API for speech-to-text transcription.\nAudio files are pas"
},
{
"path": "docs/whisperfile/translate.md",
"chars": 1431,
"preview": "# Speech Translation with Whisperfile\n\nWhisperfile is not only able to transcribe speech to text, it's also able to\ntran"
},
{
"path": "llama.cpp.patches/README.md",
"chars": 5560,
"preview": "# llama.cpp Patches for Llamafile\n\nThis directory contains patches that adapt llama.cpp for use with Llamafile and Cosmo"
},
{
"path": "llama.cpp.patches/apply-patches.sh",
"chars": 1257,
"preview": "#!/bin/bash\n# Apply llamafile patches to llama.cpp submodule\n\nset -e\n\nSCRIPT_DIR=\"$(cd \"$(dirname \"${BASH_SOURCE[0]}\")\" "
},
{
"path": "llama.cpp.patches/llamafile-files/BUILD.mk",
"chars": 18883,
"preview": "#-*-mode:makefile-gmake;indent-tabs-mode:t;tab-width:8;coding:utf-8-*-┐\n#── vi: set noet ft=make ts=8 sw=8 fenc=utf-8 :v"
},
{
"path": "llama.cpp.patches/llamafile-files/README.llamafile",
"chars": 1181,
"preview": "DESCRIPTION\n\n llama.cpp is a machine learning library for large language models\n\nLICENSE\n\n MIT\n\nORIGIN\n\n https://gith"
},
{
"path": "llama.cpp.patches/llamafile-files/common/license.cpp",
"chars": 3463,
"preview": "// Generated by CMake\n\nconst char* LICENSES[] = {\nR\"=L=(License for llama.cpp\n=====================\n\nMIT License\n\nCopyri"
},
{
"path": "llama.cpp.patches/patches/common_arg.cpp.patch",
"chars": 325,
"preview": "diff --git a/common/arg.cpp b/common/arg.cpp\n--- a/llama.cpp/common/arg.cpp\n+++ b/llama.cpp/common/arg.cpp\n@@ -36,6 +36,"
},
{
"path": "llama.cpp.patches/patches/common_chat.cpp.patch",
"chars": 548,
"preview": "diff --git a/common/chat.cpp b/common/chat.cpp\n--- a/llama.cpp/common/chat.cpp\n+++ b/llama.cpp/common/chat.cpp\n@@ -1795,"
},
{
"path": "llama.cpp.patches/patches/common_common.cpp.patch",
"chars": 947,
"preview": "diff --git a/common/common.cpp b/common/common.cpp\n--- a/llama.cpp/common/common.cpp\n+++ b/llama.cpp/common/common.cpp\n@"
},
{
"path": "llama.cpp.patches/patches/common_download.cpp.patch",
"chars": 345,
"preview": "diff --git a/common/download.cpp b/common/download.cpp\n--- a/llama.cpp/common/download.cpp\n+++ b/llama.cpp/common/downlo"
},
{
"path": "llama.cpp.patches/patches/common_log.cpp.patch",
"chars": 1625,
"preview": "diff --git a/common/log.cpp b/common/log.cpp\n--- a/llama.cpp/common/log.cpp\n+++ b/llama.cpp/common/log.cpp\n@@ -19,6 +19,"
},
{
"path": "llama.cpp.patches/patches/common_ngram-mod.cpp.patch",
"chars": 226,
"preview": "diff --git a/common/ngram-mod.cpp b/common/ngram-mod.cpp\n--- a/llama.cpp/common/ngram-mod.cpp\n+++ b/llama.cpp/common/ngr"
},
{
"path": "llama.cpp.patches/patches/ggml_src_ggml-backend-impl.h.patch",
"chars": 1133,
"preview": "diff --git a/ggml/src/ggml-backend-impl.h b/ggml/src/ggml-backend-impl.h\n--- a/llama.cpp/ggml/src/ggml-backend-impl.h\n++"
},
{
"path": "llama.cpp.patches/patches/ggml_src_ggml-backend-reg.cpp.patch",
"chars": 738,
"preview": "diff --git a/ggml/src/ggml-backend-reg.cpp b/ggml/src/ggml-backend-reg.cpp\n--- a/llama.cpp/ggml/src/ggml-backend-reg.cpp"
},
{
"path": "llama.cpp.patches/patches/ggml_src_ggml-backend.cpp.patch",
"chars": 1815,
"preview": "diff --git a/ggml/src/ggml-backend.cpp b/ggml/src/ggml-backend.cpp\n--- a/llama.cpp/ggml/src/ggml-backend.cpp\n+++ b/llama"
},
{
"path": "llama.cpp.patches/patches/ggml_src_ggml-cuda_common.cuh.patch",
"chars": 745,
"preview": "diff --git a/ggml/src/ggml-cuda/common.cuh b/ggml/src/ggml-cuda/common.cuh\n--- a/llama.cpp/ggml/src/ggml-cuda/common.cuh"
},
{
"path": "llama.cpp.patches/patches/ggml_src_ggml-cuda_ggml-cuda.cu.patch",
"chars": 3317,
"preview": "diff --git a/ggml/src/ggml-cuda/ggml-cuda.cu b/ggml/src/ggml-cuda/ggml-cuda.cu\n--- a/llama.cpp/ggml/src/ggml-cuda/ggml-c"
},
{
"path": "llama.cpp.patches/patches/ggml_src_ggml-cuda_solve_tri.cu.patch",
"chars": 2108,
"preview": "diff --git a/ggml/src/ggml-cuda/solve_tri.cu b/ggml/src/ggml-cuda/solve_tri.cu\n--- a/llama.cpp/ggml/src/ggml-cuda/solve_"
},
{
"path": "llama.cpp.patches/patches/ggml_src_ggml-cuda_vendors_cuda.h.patch",
"chars": 1053,
"preview": "diff --git a/ggml/src/ggml-cuda/vendors/cuda.h b/ggml/src/ggml-cuda/vendors/cuda.h\n--- a/llama.cpp/ggml/src/ggml-cuda/ve"
},
{
"path": "llama.cpp.patches/patches/ggml_src_ggml-metal_ggml-metal.cpp.patch",
"chars": 1710,
"preview": "diff --git a/ggml/src/ggml-metal/ggml-metal.cpp b/ggml/src/ggml-metal/ggml-metal.cpp\n--- a/llama.cpp/ggml/src/ggml-metal"
},
{
"path": "llama.cpp.patches/patches/ggml_src_gguf.cpp.patch",
"chars": 5952,
"preview": "diff --git a/ggml/src/gguf.cpp b/ggml/src/gguf.cpp\n--- a/llama.cpp/ggml/src/gguf.cpp\n+++ b/llama.cpp/ggml/src/gguf.cpp\n@"
},
{
"path": "llama.cpp.patches/patches/src_llama-mmap.cpp.patch",
"chars": 7172,
"preview": "diff --git a/src/llama-mmap.cpp b/src/llama-mmap.cpp\n--- a/llama.cpp/src/llama-mmap.cpp\n+++ b/llama.cpp/src/llama-mmap.c"
},
{
"path": "llama.cpp.patches/patches/src_llama-mmap.h.patch",
"chars": 531,
"preview": "diff --git a/src/llama-mmap.h b/src/llama-mmap.h\n--- a/llama.cpp/src/llama-mmap.h\n+++ b/llama.cpp/src/llama-mmap.h\n@@ -3"
},
{
"path": "llama.cpp.patches/patches/tools_server_server-queue.cpp.patch",
"chars": 3887,
"preview": "diff --git a/tools/server/server-queue.cpp b/tools/server/server-queue.cpp\n--- a/llama.cpp/tools/server/server-queue.cpp"
},
{
"path": "llama.cpp.patches/patches/tools_server_server.cpp.patch",
"chars": 4414,
"preview": "diff --git a/tools/server/server.cpp b/tools/server/server.cpp\n--- a/llama.cpp/tools/server/server.cpp\n+++ b/llama.cpp/t"
},
{
"path": "llama.cpp.patches/patches/vendor_cpp-httplib_httplib.cpp.patch",
"chars": 753,
"preview": "diff --git a/vendor/cpp-httplib/httplib.cpp b/vendor/cpp-httplib/httplib.cpp\n--- a/llama.cpp/vendor/cpp-httplib/httplib."
},
{
"path": "llama.cpp.patches/renames.sh",
"chars": 167,
"preview": "#!/usr/bin/env bash\nset -euo pipefail\n\n# use this script if you just want to move files from one directory to another.\n#"
},
{
"path": "llamafile/BUILD.mk",
"chars": 16966,
"preview": "#\n# Copyright 2024 Mozilla Foundation\n# Copyright 2026 Mozilla.ai\n#\n# Licensed under the Apache License, Version 2.0 (th"
},
{
"path": "llamafile/args.cpp",
"chars": 3897,
"preview": "// -*- mode:c++;indent-tabs-mode:nil;c-basic-offset:4;coding:utf-8 -*-\n// vi: set et ft=cpp ts=4 sts=4 sw=4 fenc=utf-8 :"
},
{
"path": "llamafile/args.h",
"chars": 2209,
"preview": "// -*- mode:c++;indent-tabs-mode:nil;c-basic-offset:4;coding:utf-8 -*-\n// vi: set et ft=cpp ts=4 sts=4 sw=4 fenc=utf-8 :"
},
{
"path": "llamafile/bestline.c",
"chars": 156561,
"preview": "/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;tab-width:8;coding:utf-8 -*-│\n│ vi: set et ft=c ts=4 sts=4 sw=4 fenc="
},
{
"path": "llamafile/bestline.h",
"chars": 1892,
"preview": "#pragma once\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\ntypedef struct bestlineCompletions {\n unsigned long len;\n cha"
},
{
"path": "llamafile/build-functions.sh",
"chars": 7819,
"preview": "#!/bin/bash\n# -*- mode:sh;indent-tabs-mode:nil;tab-width:4;coding:utf-8 -*-\n# vi: set et ft=sh ts=4 sts=4 sw=4 fenc=utf-"
},
{
"path": "llamafile/chatbot.h",
"chars": 4648,
"preview": "// -*- mode:c++;indent-tabs-mode:nil;c-basic-offset:4;coding:utf-8 -*-\n// vi: set et ft=cpp ts=4 sts=4 sw=4 fenc=utf-8 :"
},
{
"path": "llamafile/chatbot_api.cpp",
"chars": 11559,
"preview": "// -*- mode:c++;indent-tabs-mode:nil;c-basic-offset:4;coding:utf-8 -*-\n// vi: set et ft=cpp ts=4 sts=4 sw=4 fenc=utf-8 :"
},
{
"path": "llamafile/chatbot_backend.h",
"chars": 2275,
"preview": "// -*- mode:c++;indent-tabs-mode:nil;c-basic-offset:4;coding:utf-8 -*-\n// vi: set et ft=cpp ts=4 sts=4 sw=4 fenc=utf-8 :"
},
{
"path": "llamafile/chatbot_cli.cpp",
"chars": 18087,
"preview": "// -*- mode:c++;indent-tabs-mode:nil;c-basic-offset:4;coding:utf-8 -*-\n// vi: set et ft=cpp ts=4 sts=4 sw=4 fenc=utf-8 :"
},
{
"path": "llamafile/chatbot_comm.cpp",
"chars": 2923,
"preview": "// -*- mode:c++;indent-tabs-mode:nil;c-basic-offset:4;coding:utf-8 -*-\n// vi: set et ft=cpp ts=4 sts=4 sw=4 fenc=utf-8 :"
},
{
"path": "llamafile/chatbot_comp.cpp",
"chars": 2606,
"preview": "// -*- mode:c++;indent-tabs-mode:nil;c-basic-offset:4;coding:utf-8 -*-\n// vi: set et ft=cpp ts=4 sts=4 sw=4 fenc=utf-8 :"
},
{
"path": "llamafile/chatbot_direct.cpp",
"chars": 4307,
"preview": "// -*- mode:c++;indent-tabs-mode:nil;c-basic-offset:4;coding:utf-8 -*-\n// vi: set et ft=cpp ts=4 sts=4 sw=4 fenc=utf-8 :"
},
{
"path": "llamafile/chatbot_eval.cpp",
"chars": 7384,
"preview": "// -*- mode:c++;indent-tabs-mode:nil;c-basic-offset:4;coding:utf-8 -*-\n// vi: set et ft=cpp ts=4 sts=4 sw=4 fenc=utf-8 :"
},
{
"path": "llamafile/chatbot_file.cpp",
"chars": 3034,
"preview": "// -*- mode:c++;indent-tabs-mode:nil;c-basic-offset:4;coding:utf-8 -*-\n// vi: set et ft=cpp ts=4 sts=4 sw=4 fenc=utf-8 :"
},
{
"path": "llamafile/chatbot_help.cpp",
"chars": 6824,
"preview": "// -*- mode:c++;indent-tabs-mode:nil;c-basic-offset:4;coding:utf-8 -*-\n// vi: set et ft=cpp ts=4 sts=4 sw=4 fenc=utf-8 :"
},
{
"path": "llamafile/chatbot_hint.cpp",
"chars": 2244,
"preview": "// -*- mode:c++;indent-tabs-mode:nil;c-basic-offset:4;coding:utf-8 -*-\n// vi: set et ft=cpp ts=4 sts=4 sw=4 fenc=utf-8 :"
},
{
"path": "llamafile/chatbot_hist.cpp",
"chars": 9010,
"preview": "// -*- mode:c++;indent-tabs-mode:nil;c-basic-offset:4;coding:utf-8 -*-\n// vi: set et ft=cpp ts=4 sts=4 sw=4 fenc=utf-8 :"
},
{
"path": "llamafile/chatbot_logo.cpp",
"chars": 2146,
"preview": "// -*- mode:c++;indent-tabs-mode:nil;c-basic-offset:4;coding:utf-8 -*-\n// vi: set et ft=cpp ts=4 sts=4 sw=4 fenc=utf-8 :"
},
{
"path": "llamafile/chatbot_main.cpp",
"chars": 14462,
"preview": "// -*- mode:c++;indent-tabs-mode:nil;c-basic-offset:4;coding:utf-8 -*-\n// vi: set et ft=cpp ts=4 sts=4 sw=4 fenc=utf-8 :"
},
{
"path": "llamafile/chatbot_repl.cpp",
"chars": 10310,
"preview": "// -*- mode:c++;indent-tabs-mode:nil;c-basic-offset:4;coding:utf-8 -*-\n// vi: set et ft=cpp ts=4 sts=4 sw=4 fenc=utf-8 :"
},
{
"path": "llamafile/check_cpu.c",
"chars": 2870,
"preview": "// -*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;coding:utf-8 -*-\n// vi: set et ft=c ts=4 sts=4 sw=4 fenc=utf-8 :vi\n/"
},
{
"path": "llamafile/color.h",
"chars": 1087,
"preview": "// -*- mode:c++;indent-tabs-mode:nil;c-basic-offset:4;coding:utf-8 -*-\n// vi: set et ft=cpp ts=4 sts=4 sw=4 fenc=utf-8 :"
},
{
"path": "llamafile/compute.cpp",
"chars": 3619,
"preview": "// -*- mode:c++;indent-tabs-mode:nil;c-basic-offset:4;coding:utf-8 -*-\n// vi: set et ft=cpp ts=4 sts=4 sw=4 fenc=utf-8 :"
},
{
"path": "llamafile/compute.h",
"chars": 792,
"preview": "// -*- mode:c++;indent-tabs-mode:nil;c-basic-offset:4;coding:utf-8 -*-\n// vi: set et ft=cpp ts=4 sts=4 sw=4 fenc=utf-8 :"
},
{
"path": "llamafile/cuda.c",
"chars": 11256,
"preview": "// -*- mode:c;indent-tabs-mode:nil;c-basic-offset:4;coding:utf-8 -*-\n// vi: set et ft=c ts=4 sts=4 sw=4 fenc=utf-8 :vi\n/"
},
{
"path": "llamafile/cuda.sh",
"chars": 6310,
"preview": "#!/bin/bash\n# -*- mode:sh;indent-tabs-mode:nil;tab-width:4;coding:utf-8 -*-\n# vi: set et ft=sh ts=4 sts=4 sw=4 fenc=utf-"
},
{
"path": "llamafile/datauri.cpp",
"chars": 9722,
"preview": "// -*- mode:c++;indent-tabs-mode:nil;c-basic-offset:4;coding:utf-8 -*-\n// vi: set et ft=cpp ts=4 sts=4 sw=4 fenc=utf-8 :"
},
{
"path": "llamafile/datauri.h",
"chars": 1130,
"preview": "// -*- mode:c++;indent-tabs-mode:nil;c-basic-offset:4;coding:utf-8 -*-\n// vi: set et ft=cpp ts=4 sts=4 sw=4 fenc=utf-8 :"
},
{
"path": "llamafile/extract_data_uris.cpp",
"chars": 2777,
"preview": "// -*- mode:c++;indent-tabs-mode:nil;c-basic-offset:4;coding:utf-8 -*-\n// vi: set et ft=cpp ts=4 sts=4 sw=4 fenc=utf-8 :"
},
{
"path": "llamafile/highlight/BUILD.mk",
"chars": 2460,
"preview": "#-*-mode:makefile-gmake;indent-tabs-mode:t;tab-width:8;coding:utf-8-*-┐\n#── vi: set noet ft=make ts=8 sw=8 fenc=utf-8 :v"
},
{
"path": "llamafile/highlight/color_bleeder.cpp",
"chars": 5407,
"preview": "// -*- mode:c++;indent-tabs-mode:nil;c-basic-offset:4;coding:utf-8 -*-\n// vi: set et ft=cpp ts=4 sts=4 sw=4 fenc=utf-8 :"
},
{
"path": "llamafile/highlight/highlight.cpp",
"chars": 5234,
"preview": "// -*- mode:c++;indent-tabs-mode:nil;c-basic-offset:4;coding:utf-8 -*-\n// vi: set et ft=cpp ts=4 sts=4 sw=4 fenc=utf-8 :"
},
{
"path": "llamafile/highlight/highlight.h",
"chars": 21183,
"preview": "// -*- mode:c++;indent-tabs-mode:nil;c-basic-offset:4;coding:utf-8 -*-\n// vi: set et ft=cpp ts=4 sts=4 sw=4 fenc=utf-8 :"
},
{
"path": "llamafile/highlight/highlight_ada.cpp",
"chars": 3979,
"preview": "// -*- mode:c++;indent-tabs-mode:nil;c-basic-offset:4;coding:utf-8 -*-\n// vi: set et ft=cpp ts=4 sts=4 sw=4 fenc=utf-8 :"
},
{
"path": "llamafile/highlight/highlight_asm.cpp",
"chars": 12161,
"preview": "// -*- mode:c++;indent-tabs-mode:nil;c-basic-offset:4;coding:utf-8 -*-\n// vi: set et ft=cpp ts=4 sts=4 sw=4 fenc=utf-8 :"
},
{
"path": "llamafile/highlight/highlight_basic.cpp",
"chars": 5720,
"preview": "// -*- mode:c++;indent-tabs-mode:nil;c-basic-offset:4;coding:utf-8 -*-\n// vi: set et ft=cpp ts=4 sts=4 sw=4 fenc=utf-8 :"
},
{
"path": "llamafile/highlight/highlight_bnf.cpp",
"chars": 4653,
"preview": "// -*- mode:c++;indent-tabs-mode:nil;c-basic-offset:4;coding:utf-8 -*-\n// vi: set et ft=cpp ts=4 sts=4 sw=4 fenc=utf-8 :"
},
{
"path": "llamafile/highlight/highlight_c.cpp",
"chars": 12562,
"preview": "// -*- mode:c++;indent-tabs-mode:nil;c-basic-offset:4;coding:utf-8 -*-\n// vi: set et ft=cpp ts=4 sts=4 sw=4 fenc=utf-8 :"
},
{
"path": "llamafile/highlight/highlight_c_test.cpp",
"chars": 2811,
"preview": "// -*- mode:c++;indent-tabs-mode:nil;c-basic-offset:4;coding:utf-8 -*-\n// vi: set et ft=cpp ts=4 sts=4 sw=4 fenc=utf-8 :"
},
{
"path": "llamafile/highlight/highlight_cmake.cpp",
"chars": 7023,
"preview": "// -*- mode:c++;indent-tabs-mode:nil;c-basic-offset:4;coding:utf-8 -*-\n// vi: set et ft=cpp ts=4 sts=4 sw=4 fenc=utf-8 :"
},
{
"path": "llamafile/highlight/highlight_cobol.cpp",
"chars": 4667,
"preview": "// -*- mode:c++;indent-tabs-mode:nil;c-basic-offset:4;coding:utf-8 -*-\n// vi: set et ft=cpp ts=4 sts=4 sw=4 fenc=utf-8 :"
},
{
"path": "llamafile/highlight/highlight_create.gperf",
"chars": 5813,
"preview": "%{\n#include <string.h>\n#include <libc/str/tab.h>\n#define GPERF_DOWNCASE\nstruct Highlight;\nstruct Highlight *highlight_cr"
},
{
"path": "llamafile/highlight/highlight_csharp.cpp",
"chars": 7206,
"preview": "// -*- mode:c++;indent-tabs-mode:nil;c-basic-offset:4;coding:utf-8 -*-\n// vi: set et ft=cpp ts=4 sts=4 sw=4 fenc=utf-8 :"
},
{
"path": "llamafile/highlight/highlight_css.cpp",
"chars": 7862,
"preview": "// -*- mode:c++;indent-tabs-mode:nil;c-basic-offset:4;coding:utf-8 -*-\n// vi: set et ft=cpp ts=4 sts=4 sw=4 fenc=utf-8 :"
},
{
"path": "llamafile/highlight/highlight_d.cpp",
"chars": 13091,
"preview": "// -*- mode:c++;indent-tabs-mode:nil;c-basic-offset:4;coding:utf-8 -*-\n// vi: set et ft=cpp ts=4 sts=4 sw=4 fenc=utf-8 :"
},
{
"path": "llamafile/highlight/highlight_forth.cpp",
"chars": 3849,
"preview": "// -*- mode:c++;indent-tabs-mode:nil;c-basic-offset:4;coding:utf-8 -*-\n// vi: set et ft=cpp ts=4 sts=4 sw=4 fenc=utf-8 :"
},
{
"path": "llamafile/highlight/highlight_fortran.cpp",
"chars": 5458,
"preview": "// -*- mode:c++;indent-tabs-mode:nil;c-basic-offset:4;coding:utf-8 -*-\n// vi: set et ft=cpp ts=4 sts=4 sw=4 fenc=utf-8 :"
},
{
"path": "llamafile/highlight/highlight_go.cpp",
"chars": 5368,
"preview": "// -*- mode:c++;indent-tabs-mode:nil;c-basic-offset:4;coding:utf-8 -*-\n// vi: set et ft=cpp ts=4 sts=4 sw=4 fenc=utf-8 :"
},
{
"path": "llamafile/highlight/highlight_haskell.cpp",
"chars": 7906,
"preview": "// -*- mode:c++;indent-tabs-mode:nil;c-basic-offset:4;coding:utf-8 -*-\n// vi: set et ft=cpp ts=4 sts=4 sw=4 fenc=utf-8 :"
},
{
"path": "llamafile/highlight/highlight_html.cpp",
"chars": 8416,
"preview": "// -*- mode:c++;indent-tabs-mode:nil;c-basic-offset:4;coding:utf-8 -*-\n// vi: set et ft=cpp ts=4 sts=4 sw=4 fenc=utf-8 :"
},
{
"path": "llamafile/highlight/highlight_java.cpp",
"chars": 7450,
"preview": "// -*- mode:c++;indent-tabs-mode:nil;c-basic-offset:4;coding:utf-8 -*-\n// vi: set et ft=cpp ts=4 sts=4 sw=4 fenc=utf-8 :"
},
{
"path": "llamafile/highlight/highlight_js.cpp",
"chars": 10358,
"preview": "// -*- mode:c++;indent-tabs-mode:nil;c-basic-offset:4;coding:utf-8 -*-\n// vi: set et ft=cpp ts=4 sts=4 sw=4 fenc=utf-8 :"
},
{
"path": "llamafile/highlight/highlight_julia.cpp",
"chars": 6096,
"preview": "// -*- mode:c++;indent-tabs-mode:nil;c-basic-offset:4;coding:utf-8 -*-\n// vi: set et ft=cpp ts=4 sts=4 sw=4 fenc=utf-8 :"
},
{
"path": "llamafile/highlight/highlight_kotlin.cpp",
"chars": 10057,
"preview": "// -*- mode:c++;indent-tabs-mode:nil;c-basic-offset:4;coding:utf-8 -*-\n// vi: set et ft=cpp ts=4 sts=4 sw=4 fenc=utf-8 :"
},
{
"path": "llamafile/highlight/highlight_ld.cpp",
"chars": 6863,
"preview": "// -*- mode:c++;indent-tabs-mode:nil;c-basic-offset:4;coding:utf-8 -*-\n// vi: set et ft=cpp ts=4 sts=4 sw=4 fenc=utf-8 :"
},
{
"path": "llamafile/highlight/highlight_lisp.cpp",
"chars": 4287,
"preview": "// -*- mode:c++;indent-tabs-mode:nil;c-basic-offset:4;coding:utf-8 -*-\n// vi: set et ft=cpp ts=4 sts=4 sw=4 fenc=utf-8 :"
},
{
"path": "llamafile/highlight/highlight_lua.cpp",
"chars": 6759,
"preview": "// -*- mode:c++;indent-tabs-mode:nil;c-basic-offset:4;coding:utf-8 -*-\n// vi: set et ft=cpp ts=4 sts=4 sw=4 fenc=utf-8 :"
},
{
"path": "llamafile/highlight/highlight_m4.cpp",
"chars": 3326,
"preview": "// -*- mode:c++;indent-tabs-mode:nil;c-basic-offset:4;coding:utf-8 -*-\n// vi: set et ft=cpp ts=4 sts=4 sw=4 fenc=utf-8 :"
},
{
"path": "llamafile/highlight/highlight_make.cpp",
"chars": 6290,
"preview": "// -*- mode:c++;indent-tabs-mode:nil;c-basic-offset:4;coding:utf-8 -*-\n// vi: set et ft=cpp ts=4 sts=4 sw=4 fenc=utf-8 :"
},
{
"path": "llamafile/highlight/highlight_markdown.cpp",
"chars": 10197,
"preview": "// -*- mode:c++;indent-tabs-mode:nil;c-basic-offset:4;coding:utf-8 -*-\n// vi: set et ft=cpp ts=4 sts=4 sw=4 fenc=utf-8 :"
},
{
"path": "llamafile/highlight/highlight_matlab.cpp",
"chars": 4473,
"preview": "// -*- mode:c++;indent-tabs-mode:nil;c-basic-offset:4;coding:utf-8 -*-\n// vi: set et ft=cpp ts=4 sts=4 sw=4 fenc=utf-8 :"
},
{
"path": "llamafile/highlight/highlight_ocaml.cpp",
"chars": 7236,
"preview": "// -*- mode:c++;indent-tabs-mode:nil;c-basic-offset:4;coding:utf-8 -*-\n// vi: set et ft=cpp ts=4 sts=4 sw=4 fenc=utf-8 :"
},
{
"path": "llamafile/highlight/highlight_pascal.cpp",
"chars": 5628,
"preview": "// -*- mode:c++;indent-tabs-mode:nil;c-basic-offset:4;coding:utf-8 -*-\n// vi: set et ft=cpp ts=4 sts=4 sw=4 fenc=utf-8 :"
},
{
"path": "llamafile/highlight/highlight_perl.cpp",
"chars": 14333,
"preview": "// -*- mode:c++;indent-tabs-mode:nil;c-basic-offset:4;coding:utf-8 -*-\n// vi: set et ft=cpp ts=4 sts=4 sw=4 fenc=utf-8 :"
},
{
"path": "llamafile/highlight/highlight_php.cpp",
"chars": 5807,
"preview": "// -*- mode:c++;indent-tabs-mode:nil;c-basic-offset:4;coding:utf-8 -*-\n// vi: set et ft=cpp ts=4 sts=4 sw=4 fenc=utf-8 :"
},
{
"path": "llamafile/highlight/highlight_python.cpp",
"chars": 7825,
"preview": "// -*- mode:c++;indent-tabs-mode:nil;c-basic-offset:4;coding:utf-8 -*-\n// vi: set et ft=cpp ts=4 sts=4 sw=4 fenc=utf-8 :"
},
{
"path": "llamafile/highlight/highlight_python_test.cpp",
"chars": 3083,
"preview": "// -*- mode:c++;indent-tabs-mode:nil;c-basic-offset:4;coding:utf-8 -*-\n// vi: set et ft=cpp ts=4 sts=4 sw=4 fenc=utf-8 :"
},
{
"path": "llamafile/highlight/highlight_r.cpp",
"chars": 6556,
"preview": "// -*- mode:c++;indent-tabs-mode:nil;c-basic-offset:4;coding:utf-8 -*-\n// vi: set et ft=cpp ts=4 sts=4 sw=4 fenc=utf-8 :"
},
{
"path": "llamafile/highlight/highlight_ruby.cpp",
"chars": 27536,
"preview": "// -*- mode:c++;indent-tabs-mode:nil;c-basic-offset:4;coding:utf-8 -*-\n// vi: set et ft=cpp ts=4 sts=4 sw=4 fenc=utf-8 :"
},
{
"path": "llamafile/highlight/highlight_rust.cpp",
"chars": 7229,
"preview": "// -*- mode:c++;indent-tabs-mode:nil;c-basic-offset:4;coding:utf-8 -*-\n// vi: set et ft=cpp ts=4 sts=4 sw=4 fenc=utf-8 :"
},
{
"path": "llamafile/highlight/highlight_scala.cpp",
"chars": 10155,
"preview": "// -*- mode:c++;indent-tabs-mode:nil;c-basic-offset:4;coding:utf-8 -*-\n// vi: set et ft=cpp ts=4 sts=4 sw=4 fenc=utf-8 :"
},
{
"path": "llamafile/highlight/highlight_shell.cpp",
"chars": 15169,
"preview": "// -*- mode:c++;indent-tabs-mode:nil;c-basic-offset:4;coding:utf-8 -*-\n// vi: set et ft=cpp ts=4 sts=4 sw=4 fenc=utf-8 :"
},
{
"path": "llamafile/highlight/highlight_sql.cpp",
"chars": 5159,
"preview": "// -*- mode:c++;indent-tabs-mode:nil;c-basic-offset:4;coding:utf-8 -*-\n// vi: set et ft=cpp ts=4 sts=4 sw=4 fenc=utf-8 :"
},
{
"path": "llamafile/highlight/highlight_swift.cpp",
"chars": 12880,
"preview": "// -*- mode:c++;indent-tabs-mode:nil;c-basic-offset:4;coding:utf-8 -*-\n// vi: set et ft=cpp ts=4 sts=4 sw=4 fenc=utf-8 :"
},
{
"path": "llamafile/highlight/highlight_tcl.cpp",
"chars": 5869,
"preview": "// -*- mode:c++;indent-tabs-mode:nil;c-basic-offset:4;coding:utf-8 -*-\n// vi: set et ft=cpp ts=4 sts=4 sw=4 fenc=utf-8 :"
},
{
"path": "llamafile/highlight/highlight_test.cpp",
"chars": 4635,
"preview": "// -*- mode:c++;indent-tabs-mode:nil;c-basic-offset:4;coding:utf-8 -*-\n// vi: set et ft=cpp ts=4 sts=4 sw=4 fenc=utf-8 :"
},
{
"path": "llamafile/highlight/highlight_tex.cpp",
"chars": 5293,
"preview": "// -*- mode:c++;indent-tabs-mode:nil;c-basic-offset:4;coding:utf-8 -*-\n// vi: set et ft=cpp ts=4 sts=4 sw=4 fenc=utf-8 :"
},
{
"path": "llamafile/highlight/highlight_txt.cpp",
"chars": 1005,
"preview": "// -*- mode:c++;indent-tabs-mode:nil;c-basic-offset:4;coding:utf-8 -*-\n// vi: set et ft=cpp ts=4 sts=4 sw=4 fenc=utf-8 :"
},
{
"path": "llamafile/highlight/highlight_typescript.cpp",
"chars": 10376,
"preview": "// -*- mode:c++;indent-tabs-mode:nil;c-basic-offset:4;coding:utf-8 -*-\n// vi: set et ft=cpp ts=4 sts=4 sw=4 fenc=utf-8 :"
},
{
"path": "llamafile/highlight/highlight_zig.cpp",
"chars": 6206,
"preview": "// -*- mode:c++;indent-tabs-mode:nil;c-basic-offset:4;coding:utf-8 -*-\n// vi: set et ft=cpp ts=4 sts=4 sw=4 fenc=utf-8 :"
},
{
"path": "llamafile/highlight/is_keyword_ada.gperf",
"chars": 653,
"preview": "%{\n#include <string.h>\n#include <libc/str/tab.h>\n#define GPERF_DOWNCASE\n%}\n%pic\n%ignore-case\n%compare-strncmp\n%language="
},
{
"path": "llamafile/highlight/is_keyword_ada_constant.gperf",
"chars": 211,
"preview": "%{\n#include <string.h>\n#include <libc/str/tab.h>\n#define GPERF_DOWNCASE\n%}\n%pic\n%ignore-case\n%compare-strncmp\n%language="
},
{
"path": "llamafile/highlight/is_keyword_asm_prefix.gperf",
"chars": 372,
"preview": "%{\n#include <string.h>\n#include <libc/str/tab.h>\n#define GPERF_DOWNCASE\n%}\n%pic\n%ignore-case\n%compare-strncmp\n%language="
},
{
"path": "llamafile/highlight/is_keyword_asm_qualifier.gperf",
"chars": 415,
"preview": "%{\n#include <string.h>\n#include <libc/str/tab.h>\n#define GPERF_DOWNCASE\n%}\n%pic\n%ignore-case\n%compare-strncmp\n%language="
},
{
"path": "llamafile/highlight/is_keyword_basic.gperf",
"chars": 1215,
"preview": "%{\n#include <string.h>\n#include <libc/str/tab.h>\n#define GPERF_DOWNCASE\n%}\n%pic\n%ignore-case\n%compare-strncmp\n%language="
},
{
"path": "llamafile/highlight/is_keyword_basic_builtin.gperf",
"chars": 970,
"preview": "%{\n#include <string.h>\n#include <libc/str/tab.h>\n#define GPERF_DOWNCASE\n%}\n%pic\n%ignore-case\n%compare-strncmp\n%language="
},
{
"path": "llamafile/highlight/is_keyword_basic_constant.gperf",
"chars": 1387,
"preview": "%{\n#include <string.h>\n#include <libc/str/tab.h>\n#define GPERF_DOWNCASE\n%}\n%pic\n%ignore-case\n%compare-strncmp\n%language="
},
{
"path": "llamafile/highlight/is_keyword_basic_type.gperf",
"chars": 312,
"preview": "%{\n#include <string.h>\n#include <libc/str/tab.h>\n#define GPERF_DOWNCASE\n%}\n%pic\n%ignore-case\n%compare-strncmp\n%language="
},
{
"path": "llamafile/highlight/is_keyword_c.gperf",
"chars": 3043,
"preview": "%{\n#include <string.h>\n%}\n%pic\n%compare-strncmp\n%language=ANSI-C\n%readonly-tables\n%define lookup-function-name is_keywor"
},
{
"path": "llamafile/highlight/is_keyword_c_builtin.gperf",
"chars": 65546,
"preview": "%{\n#include <string.h>\n%}\n%pic\n%compare-strncmp\n%language=ANSI-C\n%readonly-tables\n%define lookup-function-name is_keywor"
},
{
"path": "llamafile/highlight/is_keyword_c_constant.gperf",
"chars": 9711,
"preview": "%{\n#include <string.h>\n%}\n%compare-strncmp\n%language=ANSI-C\n%readonly-tables\n%define lookup-function-name is_keyword_c_c"
},
{
"path": "llamafile/highlight/is_keyword_c_pod.gperf",
"chars": 149,
"preview": "%{\n#include <string.h>\n%}\n%pic\n%compare-strncmp\n%language=ANSI-C\n%readonly-tables\n%define lookup-function-name is_keywor"
},
{
"path": "llamafile/highlight/is_keyword_c_type.gperf",
"chars": 2358,
"preview": "%{\n#include <string.h>\n%}\n%pic\n%compare-strncmp\n%language=ANSI-C\n%readonly-tables\n%define lookup-function-name is_keywor"
},
{
"path": "llamafile/highlight/is_keyword_cmake.gperf",
"chars": 299,
"preview": "%{\n#include <string.h>\n#include <libc/str/tab.h>\n#define GPERF_DOWNCASE\n%}\n%pic\n%ignore-case\n%compare-strncmp\n%language="
},
{
"path": "llamafile/highlight/is_keyword_cobol.gperf",
"chars": 3567,
"preview": "%{\n#include <string.h>\n#include <libc/str/tab.h>\n#define GPERF_DOWNCASE\n%}\n%pic\n%ignore-case\n%compare-strncmp\n%language="
},
{
"path": "llamafile/highlight/is_keyword_cpp.gperf",
"chars": 332,
"preview": "%{\n#include <string.h>\n%}\n%compare-strncmp\n%language=ANSI-C\n%readonly-tables\n%define lookup-function-name is_keyword_cpp"
},
{
"path": "llamafile/highlight/is_keyword_csharp.gperf",
"chars": 882,
"preview": "%{\n#include <string.h>\n%}\n%pic\n%compare-strncmp\n%language=ANSI-C\n%readonly-tables\n%define lookup-function-name is_keywor"
},
{
"path": "llamafile/highlight/is_keyword_csharp_constant.gperf",
"chars": 157,
"preview": "%{\n#include <string.h>\n%}\n%pic\n%compare-strncmp\n%language=ANSI-C\n%readonly-tables\n%define lookup-function-name is_keywor"
},
{
"path": "llamafile/highlight/is_keyword_css_at.gperf",
"chars": 197,
"preview": "%{\n#include <string.h>\n%}\n%pic\n%compare-strncmp\n%language=ANSI-C\n%readonly-tables\n%define lookup-function-name is_keywor"
},
{
"path": "llamafile/highlight/is_keyword_css_bang.gperf",
"chars": 144,
"preview": "%{\n#include <string.h>\n%}\n%pic\n%compare-strncmp\n%language=ANSI-C\n%readonly-tables\n%define lookup-function-name is_keywor"
},
{
"path": "llamafile/highlight/is_keyword_cxx.gperf",
"chars": 1767,
"preview": "%{\n#include <string.h>\n%}\n%pic\n%compare-strncmp\n%language=ANSI-C\n%readonly-tables\n%define lookup-function-name is_keywor"
},
{
"path": "llamafile/highlight/is_keyword_d.gperf",
"chars": 882,
"preview": "%{\n#include <string.h>\n%}\n%pic\n%compare-strncmp\n%language=ANSI-C\n%readonly-tables\n%define lookup-function-name is_keywor"
},
{
"path": "llamafile/highlight/is_keyword_d_constant.gperf",
"chars": 233,
"preview": "%{\n#include <string.h>\n%}\n%pic\n%compare-strncmp\n%language=ANSI-C\n%readonly-tables\n%define lookup-function-name is_keywor"
},
{
"path": "llamafile/highlight/is_keyword_forth.gperf",
"chars": 405,
"preview": "%{\n#include <string.h>\n#include <libc/str/tab.h>\n#define GPERF_DOWNCASE\n%}\n%pic\n%ignore-case\n%compare-strncmp\n%language="
},
{
"path": "llamafile/highlight/is_keyword_forth_def.gperf",
"chars": 351,
"preview": "%{\n#include <string.h>\n#include <libc/str/tab.h>\n#define GPERF_DOWNCASE\n%}\n%pic\n%ignore-case\n%compare-strncmp\n%language="
},
{
"path": "llamafile/highlight/is_keyword_fortran.gperf",
"chars": 1083,
"preview": "%{\n#include <string.h>\n#include <libc/str/tab.h>\n#define GPERF_DOWNCASE\n%}\n%pic\n%ignore-case\n%compare-strncmp\n%language="
},
{
"path": "llamafile/highlight/is_keyword_fortran_builtin.gperf",
"chars": 648,
"preview": "%{\n#include <string.h>\n#include <libc/str/tab.h>\n#define GPERF_DOWNCASE\n%}\n%pic\n%ignore-case\n%compare-strncmp\n%language="
},
{
"path": "llamafile/highlight/is_keyword_fortran_type.gperf",
"chars": 375,
"preview": "%{\n#include <string.h>\n#include <libc/str/tab.h>\n#define GPERF_DOWNCASE\n%}\n%pic\n%ignore-case\n%compare-strncmp\n%language="
},
{
"path": "llamafile/highlight/is_keyword_go.gperf",
"chars": 282,
"preview": "%{\n#include <string.h>\n%}\n%pic\n%compare-strncmp\n%language=ANSI-C\n%readonly-tables\n%define lookup-function-name is_keywor"
},
{
"path": "llamafile/highlight/is_keyword_go_type.gperf",
"chars": 254,
"preview": "%{\n#include <string.h>\n%}\n%pic\n%compare-strncmp\n%language=ANSI-C\n%readonly-tables\n%define lookup-function-name is_keywor"
},
{
"path": "llamafile/highlight/is_keyword_haskell.gperf",
"chars": 309,
"preview": "%{\n#include <string.h>\n%}\n%pic\n%compare-strncmp\n%language=ANSI-C\n%readonly-tables\n%define lookup-function-name is_keywor"
},
{
"path": "llamafile/highlight/is_keyword_java.gperf",
"chars": 469,
"preview": "%{\n#include <string.h>\n%}\n%pic\n%compare-strncmp\n%language=ANSI-C\n%readonly-tables\n%define lookup-function-name is_keywor"
}
]
// ... and 421 more files (download for full content)
About this extraction
This page contains the full source code of the mozilla-ai/llamafile GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 621 files (17.6 MB), approximately 4.6M tokens, and a symbol index with 9474 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.