@fugood/llama.node 0.6.3 → 1.0.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CMakeLists.txt +40 -30
- package/README.md +4 -1
- package/lib/binding.js +41 -29
- package/lib/binding.ts +26 -25
- package/package.json +40 -7
- package/scripts/build.js +47 -0
- package/scripts/llama.cpp.patch +109 -0
- package/src/anyascii.c +22223 -0
- package/src/anyascii.h +42 -0
- package/src/tts_utils.cpp +20 -7
- package/src/tts_utils.h +2 -0
- package/bin/darwin/arm64/llama-node.node +0 -0
- package/bin/darwin/x64/llama-node.node +0 -0
- package/bin/linux/arm64/llama-node.node +0 -0
- package/bin/linux/x64/llama-node.node +0 -0
- package/bin/linux-cuda/arm64/llama-node.node +0 -0
- package/bin/linux-cuda/x64/llama-node.node +0 -0
- package/bin/linux-vulkan/arm64/llama-node.node +0 -0
- package/bin/linux-vulkan/x64/llama-node.node +0 -0
- package/bin/win32/x64/llama-node.node +0 -0
- package/bin/win32/x64/node.lib +0 -0
- package/bin/win32-vulkan/arm64/llama-node.node +0 -0
- package/bin/win32-vulkan/arm64/node.lib +0 -0
- package/bin/win32-vulkan/x64/llama-node.node +0 -0
- package/bin/win32-vulkan/x64/node.lib +0 -0
- package/src/llama.cpp/.github/workflows/build-linux-cross.yml +0 -233
- package/src/llama.cpp/.github/workflows/build.yml +0 -1078
- package/src/llama.cpp/.github/workflows/close-issue.yml +0 -28
- package/src/llama.cpp/.github/workflows/docker.yml +0 -178
- package/src/llama.cpp/.github/workflows/editorconfig.yml +0 -29
- package/src/llama.cpp/.github/workflows/gguf-publish.yml +0 -44
- package/src/llama.cpp/.github/workflows/labeler.yml +0 -17
- package/src/llama.cpp/.github/workflows/python-check-requirements.yml +0 -33
- package/src/llama.cpp/.github/workflows/python-lint.yml +0 -30
- package/src/llama.cpp/.github/workflows/python-type-check.yml +0 -40
- package/src/llama.cpp/.github/workflows/release.yml +0 -739
- package/src/llama.cpp/.github/workflows/server.yml +0 -237
- package/src/llama.cpp/.github/workflows/winget.yml +0 -42
- package/src/llama.cpp/cmake/arm64-apple-clang.cmake +0 -16
- package/src/llama.cpp/cmake/arm64-windows-llvm.cmake +0 -16
- package/src/llama.cpp/cmake/build-info.cmake +0 -64
- package/src/llama.cpp/cmake/common.cmake +0 -35
- package/src/llama.cpp/cmake/git-vars.cmake +0 -22
- package/src/llama.cpp/cmake/x64-windows-llvm.cmake +0 -5
- package/src/llama.cpp/common/build-info.cpp.in +0 -4
- package/src/llama.cpp/docs/build.md +0 -561
- package/src/llama.cpp/examples/CMakeLists.txt +0 -43
- package/src/llama.cpp/examples/batched/CMakeLists.txt +0 -5
- package/src/llama.cpp/examples/batched/batched.cpp +0 -246
- package/src/llama.cpp/examples/chat-13B.bat +0 -57
- package/src/llama.cpp/examples/convert-llama2c-to-ggml/CMakeLists.txt +0 -5
- package/src/llama.cpp/examples/convert-llama2c-to-ggml/convert-llama2c-to-ggml.cpp +0 -941
- package/src/llama.cpp/examples/deprecation-warning/deprecation-warning.cpp +0 -35
- package/src/llama.cpp/examples/embedding/CMakeLists.txt +0 -5
- package/src/llama.cpp/examples/embedding/embedding.cpp +0 -323
- package/src/llama.cpp/examples/eval-callback/CMakeLists.txt +0 -10
- package/src/llama.cpp/examples/eval-callback/eval-callback.cpp +0 -194
- package/src/llama.cpp/examples/gen-docs/CMakeLists.txt +0 -5
- package/src/llama.cpp/examples/gen-docs/gen-docs.cpp +0 -83
- package/src/llama.cpp/examples/gguf/CMakeLists.txt +0 -5
- package/src/llama.cpp/examples/gguf/gguf.cpp +0 -265
- package/src/llama.cpp/examples/gguf-hash/CMakeLists.txt +0 -22
- package/src/llama.cpp/examples/gguf-hash/deps/rotate-bits/rotate-bits.h +0 -46
- package/src/llama.cpp/examples/gguf-hash/deps/sha1/sha1.c +0 -295
- package/src/llama.cpp/examples/gguf-hash/deps/sha1/sha1.h +0 -52
- package/src/llama.cpp/examples/gguf-hash/deps/sha256/sha256.c +0 -221
- package/src/llama.cpp/examples/gguf-hash/deps/sha256/sha256.h +0 -24
- package/src/llama.cpp/examples/gguf-hash/deps/xxhash/xxhash.c +0 -42
- package/src/llama.cpp/examples/gguf-hash/deps/xxhash/xxhash.h +0 -7093
- package/src/llama.cpp/examples/gguf-hash/gguf-hash.cpp +0 -694
- package/src/llama.cpp/examples/gritlm/CMakeLists.txt +0 -5
- package/src/llama.cpp/examples/gritlm/gritlm.cpp +0 -229
- package/src/llama.cpp/examples/jeopardy/questions.txt +0 -100
- package/src/llama.cpp/examples/llama.android/app/build.gradle.kts +0 -65
- package/src/llama.cpp/examples/llama.android/build.gradle.kts +0 -6
- package/src/llama.cpp/examples/llama.android/llama/build.gradle.kts +0 -71
- package/src/llama.cpp/examples/llama.android/llama/src/main/cpp/CMakeLists.txt +0 -53
- package/src/llama.cpp/examples/llama.android/llama/src/main/cpp/llama-android.cpp +0 -452
- package/src/llama.cpp/examples/llama.android/settings.gradle.kts +0 -18
- package/src/llama.cpp/examples/lookahead/CMakeLists.txt +0 -5
- package/src/llama.cpp/examples/lookahead/lookahead.cpp +0 -472
- package/src/llama.cpp/examples/lookup/CMakeLists.txt +0 -23
- package/src/llama.cpp/examples/lookup/lookup-create.cpp +0 -40
- package/src/llama.cpp/examples/lookup/lookup-merge.cpp +0 -47
- package/src/llama.cpp/examples/lookup/lookup-stats.cpp +0 -157
- package/src/llama.cpp/examples/lookup/lookup.cpp +0 -242
- package/src/llama.cpp/examples/parallel/CMakeLists.txt +0 -5
- package/src/llama.cpp/examples/parallel/parallel.cpp +0 -492
- package/src/llama.cpp/examples/passkey/CMakeLists.txt +0 -5
- package/src/llama.cpp/examples/passkey/passkey.cpp +0 -277
- package/src/llama.cpp/examples/retrieval/CMakeLists.txt +0 -5
- package/src/llama.cpp/examples/retrieval/retrieval.cpp +0 -304
- package/src/llama.cpp/examples/save-load-state/CMakeLists.txt +0 -5
- package/src/llama.cpp/examples/save-load-state/save-load-state.cpp +0 -246
- package/src/llama.cpp/examples/simple/CMakeLists.txt +0 -5
- package/src/llama.cpp/examples/simple/simple.cpp +0 -206
- package/src/llama.cpp/examples/simple-chat/CMakeLists.txt +0 -5
- package/src/llama.cpp/examples/simple-chat/simple-chat.cpp +0 -206
- package/src/llama.cpp/examples/simple-cmake-pkg/CMakeLists.txt +0 -11
- package/src/llama.cpp/examples/speculative/CMakeLists.txt +0 -5
- package/src/llama.cpp/examples/speculative/speculative.cpp +0 -644
- package/src/llama.cpp/examples/speculative-simple/CMakeLists.txt +0 -5
- package/src/llama.cpp/examples/speculative-simple/speculative-simple.cpp +0 -261
- package/src/llama.cpp/examples/sycl/CMakeLists.txt +0 -9
- package/src/llama.cpp/examples/sycl/build.sh +0 -23
- package/src/llama.cpp/examples/sycl/ls-sycl-device.cpp +0 -13
- package/src/llama.cpp/examples/sycl/run-llama2.sh +0 -27
- package/src/llama.cpp/examples/sycl/run-llama3.sh +0 -28
- package/src/llama.cpp/examples/sycl/win-build-sycl.bat +0 -33
- package/src/llama.cpp/examples/sycl/win-run-llama2.bat +0 -9
- package/src/llama.cpp/examples/sycl/win-run-llama3.bat +0 -9
- package/src/llama.cpp/examples/training/CMakeLists.txt +0 -5
- package/src/llama.cpp/examples/training/finetune.cpp +0 -96
- package/src/llama.cpp/ggml/cmake/GitVars.cmake +0 -22
- package/src/llama.cpp/ggml/cmake/common.cmake +0 -26
- package/src/llama.cpp/ggml/src/ggml-alloc.c +0 -1042
- package/src/llama.cpp/ggml/src/ggml-backend-impl.h +0 -255
- package/src/llama.cpp/ggml/src/ggml-backend-reg.cpp +0 -586
- package/src/llama.cpp/ggml/src/ggml-backend.cpp +0 -2008
- package/src/llama.cpp/ggml/src/ggml-blas/CMakeLists.txt +0 -87
- package/src/llama.cpp/ggml/src/ggml-blas/ggml-blas.cpp +0 -517
- package/src/llama.cpp/ggml/src/ggml-cann/CMakeLists.txt +0 -74
- package/src/llama.cpp/ggml/src/ggml-cann/acl_tensor.cpp +0 -179
- package/src/llama.cpp/ggml/src/ggml-cann/acl_tensor.h +0 -258
- package/src/llama.cpp/ggml/src/ggml-cann/aclnn_ops.cpp +0 -2863
- package/src/llama.cpp/ggml/src/ggml-cann/aclnn_ops.h +0 -1110
- package/src/llama.cpp/ggml/src/ggml-cann/common.h +0 -420
- package/src/llama.cpp/ggml/src/ggml-cann/ggml-cann.cpp +0 -2570
- package/src/llama.cpp/ggml/src/ggml-common.h +0 -1857
- package/src/llama.cpp/ggml/src/ggml-cpu/cmake/FindSIMD.cmake +0 -100
- package/src/llama.cpp/ggml/src/ggml-cuda/CMakeLists.txt +0 -184
- package/src/llama.cpp/ggml/src/ggml-cuda/vendors/cuda.h +0 -15
- package/src/llama.cpp/ggml/src/ggml-cuda/vendors/hip.h +0 -243
- package/src/llama.cpp/ggml/src/ggml-cuda/vendors/musa.h +0 -140
- package/src/llama.cpp/ggml/src/ggml-hip/CMakeLists.txt +0 -131
- package/src/llama.cpp/ggml/src/ggml-impl.h +0 -601
- package/src/llama.cpp/ggml/src/ggml-kompute/CMakeLists.txt +0 -166
- package/src/llama.cpp/ggml/src/ggml-kompute/ggml-kompute.cpp +0 -2251
- package/src/llama.cpp/ggml/src/ggml-metal/CMakeLists.txt +0 -120
- package/src/llama.cpp/ggml/src/ggml-metal/ggml-metal-impl.h +0 -622
- package/src/llama.cpp/ggml/src/ggml-musa/CMakeLists.txt +0 -113
- package/src/llama.cpp/ggml/src/ggml-opencl/CMakeLists.txt +0 -96
- package/src/llama.cpp/ggml/src/ggml-opencl/ggml-opencl.cpp +0 -5124
- package/src/llama.cpp/ggml/src/ggml-opt.cpp +0 -1037
- package/src/llama.cpp/ggml/src/ggml-quants.c +0 -5232
- package/src/llama.cpp/ggml/src/ggml-quants.h +0 -100
- package/src/llama.cpp/ggml/src/ggml-rpc/CMakeLists.txt +0 -9
- package/src/llama.cpp/ggml/src/ggml-rpc/ggml-rpc.cpp +0 -1813
- package/src/llama.cpp/ggml/src/ggml-sycl/CMakeLists.txt +0 -189
- package/src/llama.cpp/ggml/src/ggml-sycl/backend.hpp +0 -37
- package/src/llama.cpp/ggml/src/ggml-sycl/binbcast.cpp +0 -239
- package/src/llama.cpp/ggml/src/ggml-sycl/binbcast.hpp +0 -39
- package/src/llama.cpp/ggml/src/ggml-sycl/common.cpp +0 -83
- package/src/llama.cpp/ggml/src/ggml-sycl/common.hpp +0 -493
- package/src/llama.cpp/ggml/src/ggml-sycl/concat.cpp +0 -197
- package/src/llama.cpp/ggml/src/ggml-sycl/concat.hpp +0 -20
- package/src/llama.cpp/ggml/src/ggml-sycl/conv.cpp +0 -100
- package/src/llama.cpp/ggml/src/ggml-sycl/conv.hpp +0 -20
- package/src/llama.cpp/ggml/src/ggml-sycl/convert.cpp +0 -623
- package/src/llama.cpp/ggml/src/ggml-sycl/convert.hpp +0 -34
- package/src/llama.cpp/ggml/src/ggml-sycl/cpy.cpp +0 -701
- package/src/llama.cpp/ggml/src/ggml-sycl/cpy.hpp +0 -11
- package/src/llama.cpp/ggml/src/ggml-sycl/dequantize.hpp +0 -791
- package/src/llama.cpp/ggml/src/ggml-sycl/dmmv.cpp +0 -1160
- package/src/llama.cpp/ggml/src/ggml-sycl/dmmv.hpp +0 -27
- package/src/llama.cpp/ggml/src/ggml-sycl/dpct/helper.hpp +0 -2957
- package/src/llama.cpp/ggml/src/ggml-sycl/element_wise.cpp +0 -1536
- package/src/llama.cpp/ggml/src/ggml-sycl/element_wise.hpp +0 -75
- package/src/llama.cpp/ggml/src/ggml-sycl/gemm.hpp +0 -99
- package/src/llama.cpp/ggml/src/ggml-sycl/getrows.cpp +0 -311
- package/src/llama.cpp/ggml/src/ggml-sycl/getrows.hpp +0 -20
- package/src/llama.cpp/ggml/src/ggml-sycl/ggml-sycl.cpp +0 -4443
- package/src/llama.cpp/ggml/src/ggml-sycl/gla.cpp +0 -105
- package/src/llama.cpp/ggml/src/ggml-sycl/gla.hpp +0 -8
- package/src/llama.cpp/ggml/src/ggml-sycl/im2col.cpp +0 -136
- package/src/llama.cpp/ggml/src/ggml-sycl/im2col.hpp +0 -21
- package/src/llama.cpp/ggml/src/ggml-sycl/mmq.cpp +0 -3030
- package/src/llama.cpp/ggml/src/ggml-sycl/mmq.hpp +0 -33
- package/src/llama.cpp/ggml/src/ggml-sycl/mmvq.cpp +0 -1108
- package/src/llama.cpp/ggml/src/ggml-sycl/mmvq.hpp +0 -27
- package/src/llama.cpp/ggml/src/ggml-sycl/norm.cpp +0 -474
- package/src/llama.cpp/ggml/src/ggml-sycl/norm.hpp +0 -26
- package/src/llama.cpp/ggml/src/ggml-sycl/outprod.cpp +0 -46
- package/src/llama.cpp/ggml/src/ggml-sycl/outprod.hpp +0 -10
- package/src/llama.cpp/ggml/src/ggml-sycl/presets.hpp +0 -74
- package/src/llama.cpp/ggml/src/ggml-sycl/quants.hpp +0 -83
- package/src/llama.cpp/ggml/src/ggml-sycl/rope.cpp +0 -362
- package/src/llama.cpp/ggml/src/ggml-sycl/rope.hpp +0 -20
- package/src/llama.cpp/ggml/src/ggml-sycl/softmax.cpp +0 -264
- package/src/llama.cpp/ggml/src/ggml-sycl/softmax.hpp +0 -20
- package/src/llama.cpp/ggml/src/ggml-sycl/sycl_hw.cpp +0 -13
- package/src/llama.cpp/ggml/src/ggml-sycl/sycl_hw.hpp +0 -23
- package/src/llama.cpp/ggml/src/ggml-sycl/tsembd.cpp +0 -73
- package/src/llama.cpp/ggml/src/ggml-sycl/tsembd.hpp +0 -20
- package/src/llama.cpp/ggml/src/ggml-sycl/vecdotq.hpp +0 -1215
- package/src/llama.cpp/ggml/src/ggml-sycl/wkv.cpp +0 -305
- package/src/llama.cpp/ggml/src/ggml-sycl/wkv.hpp +0 -10
- package/src/llama.cpp/ggml/src/ggml-threading.cpp +0 -12
- package/src/llama.cpp/ggml/src/ggml-threading.h +0 -14
- package/src/llama.cpp/ggml/src/ggml-vulkan/CMakeLists.txt +0 -196
- package/src/llama.cpp/ggml/src/ggml-vulkan/ggml-vulkan.cpp +0 -10699
- package/src/llama.cpp/ggml/src/ggml-vulkan/vulkan-shaders/CMakeLists.txt +0 -39
- package/src/llama.cpp/ggml/src/ggml-vulkan/vulkan-shaders/vulkan-shaders-gen.cpp +0 -751
- package/src/llama.cpp/ggml/src/ggml.c +0 -6550
- package/src/llama.cpp/ggml/src/gguf.cpp +0 -1330
- package/src/llama.cpp/models/.editorconfig +0 -1
- package/src/llama.cpp/models/ggml-vocab-aquila.gguf +0 -0
- package/src/llama.cpp/models/ggml-vocab-baichuan.gguf +0 -0
- package/src/llama.cpp/models/ggml-vocab-bert-bge.gguf +0 -0
- package/src/llama.cpp/models/ggml-vocab-bert-bge.gguf.inp +0 -112
- package/src/llama.cpp/models/ggml-vocab-bert-bge.gguf.out +0 -46
- package/src/llama.cpp/models/ggml-vocab-chameleon.gguf.inp +0 -112
- package/src/llama.cpp/models/ggml-vocab-chameleon.gguf.out +0 -46
- package/src/llama.cpp/models/ggml-vocab-command-r.gguf +0 -0
- package/src/llama.cpp/models/ggml-vocab-command-r.gguf.inp +0 -112
- package/src/llama.cpp/models/ggml-vocab-command-r.gguf.out +0 -46
- package/src/llama.cpp/models/ggml-vocab-deepseek-coder.gguf +0 -0
- package/src/llama.cpp/models/ggml-vocab-deepseek-coder.gguf.inp +0 -112
- package/src/llama.cpp/models/ggml-vocab-deepseek-coder.gguf.out +0 -46
- package/src/llama.cpp/models/ggml-vocab-deepseek-llm.gguf +0 -0
- package/src/llama.cpp/models/ggml-vocab-deepseek-llm.gguf.inp +0 -112
- package/src/llama.cpp/models/ggml-vocab-deepseek-llm.gguf.out +0 -46
- package/src/llama.cpp/models/ggml-vocab-deepseek-r1-qwen.gguf.inp +0 -112
- package/src/llama.cpp/models/ggml-vocab-deepseek-r1-qwen.gguf.out +0 -46
- package/src/llama.cpp/models/ggml-vocab-falcon.gguf +0 -0
- package/src/llama.cpp/models/ggml-vocab-falcon.gguf.inp +0 -112
- package/src/llama.cpp/models/ggml-vocab-falcon.gguf.out +0 -46
- package/src/llama.cpp/models/ggml-vocab-gpt-2.gguf +0 -0
- package/src/llama.cpp/models/ggml-vocab-gpt-2.gguf.inp +0 -112
- package/src/llama.cpp/models/ggml-vocab-gpt-2.gguf.out +0 -46
- package/src/llama.cpp/models/ggml-vocab-gpt-4o.gguf.inp +0 -112
- package/src/llama.cpp/models/ggml-vocab-gpt-4o.gguf.out +0 -46
- package/src/llama.cpp/models/ggml-vocab-gpt-neox.gguf +0 -0
- package/src/llama.cpp/models/ggml-vocab-llama-bpe.gguf +0 -0
- package/src/llama.cpp/models/ggml-vocab-llama-bpe.gguf.inp +0 -112
- package/src/llama.cpp/models/ggml-vocab-llama-bpe.gguf.out +0 -46
- package/src/llama.cpp/models/ggml-vocab-llama-spm.gguf +0 -0
- package/src/llama.cpp/models/ggml-vocab-llama-spm.gguf.inp +0 -112
- package/src/llama.cpp/models/ggml-vocab-llama-spm.gguf.out +0 -46
- package/src/llama.cpp/models/ggml-vocab-llama4.gguf.inp +0 -112
- package/src/llama.cpp/models/ggml-vocab-llama4.gguf.out +0 -46
- package/src/llama.cpp/models/ggml-vocab-mpt.gguf +0 -0
- package/src/llama.cpp/models/ggml-vocab-mpt.gguf.inp +0 -112
- package/src/llama.cpp/models/ggml-vocab-mpt.gguf.out +0 -46
- package/src/llama.cpp/models/ggml-vocab-phi-3.gguf +0 -0
- package/src/llama.cpp/models/ggml-vocab-phi-3.gguf.inp +0 -112
- package/src/llama.cpp/models/ggml-vocab-phi-3.gguf.out +0 -46
- package/src/llama.cpp/models/ggml-vocab-pixtral.gguf.inp +0 -112
- package/src/llama.cpp/models/ggml-vocab-pixtral.gguf.out +0 -46
- package/src/llama.cpp/models/ggml-vocab-qwen2.gguf +0 -0
- package/src/llama.cpp/models/ggml-vocab-qwen2.gguf.inp +0 -112
- package/src/llama.cpp/models/ggml-vocab-qwen2.gguf.out +0 -46
- package/src/llama.cpp/models/ggml-vocab-refact.gguf +0 -0
- package/src/llama.cpp/models/ggml-vocab-refact.gguf.inp +0 -112
- package/src/llama.cpp/models/ggml-vocab-refact.gguf.out +0 -46
- package/src/llama.cpp/models/ggml-vocab-roberta-bpe.gguf.inp +0 -112
- package/src/llama.cpp/models/ggml-vocab-roberta-bpe.gguf.out +0 -46
- package/src/llama.cpp/models/ggml-vocab-starcoder.gguf +0 -0
- package/src/llama.cpp/models/ggml-vocab-starcoder.gguf.inp +0 -112
- package/src/llama.cpp/models/ggml-vocab-starcoder.gguf.out +0 -46
- package/src/llama.cpp/pocs/CMakeLists.txt +0 -14
- package/src/llama.cpp/pocs/vdot/CMakeLists.txt +0 -9
- package/src/llama.cpp/pocs/vdot/q8dot.cpp +0 -173
- package/src/llama.cpp/pocs/vdot/vdot.cpp +0 -311
- package/src/llama.cpp/prompts/LLM-questions.txt +0 -49
- package/src/llama.cpp/prompts/alpaca.txt +0 -1
- package/src/llama.cpp/prompts/assistant.txt +0 -31
- package/src/llama.cpp/prompts/chat-with-baichuan.txt +0 -4
- package/src/llama.cpp/prompts/chat-with-bob.txt +0 -7
- package/src/llama.cpp/prompts/chat-with-qwen.txt +0 -1
- package/src/llama.cpp/prompts/chat-with-vicuna-v0.txt +0 -7
- package/src/llama.cpp/prompts/chat-with-vicuna-v1.txt +0 -7
- package/src/llama.cpp/prompts/chat.txt +0 -28
- package/src/llama.cpp/prompts/dan-modified.txt +0 -1
- package/src/llama.cpp/prompts/dan.txt +0 -1
- package/src/llama.cpp/prompts/mnemonics.txt +0 -93
- package/src/llama.cpp/prompts/parallel-questions.txt +0 -43
- package/src/llama.cpp/prompts/reason-act.txt +0 -18
- package/src/llama.cpp/requirements/requirements-all.txt +0 -15
- package/src/llama.cpp/requirements/requirements-compare-llama-bench.txt +0 -2
- package/src/llama.cpp/requirements/requirements-convert_hf_to_gguf.txt +0 -7
- package/src/llama.cpp/requirements/requirements-convert_hf_to_gguf_update.txt +0 -7
- package/src/llama.cpp/requirements/requirements-convert_legacy_llama.txt +0 -5
- package/src/llama.cpp/requirements/requirements-convert_llama_ggml_to_gguf.txt +0 -1
- package/src/llama.cpp/requirements/requirements-convert_lora_to_gguf.txt +0 -4
- package/src/llama.cpp/requirements/requirements-gguf_editor_gui.txt +0 -3
- package/src/llama.cpp/requirements/requirements-pydantic.txt +0 -3
- package/src/llama.cpp/requirements/requirements-test-tokenizer-random.txt +0 -1
- package/src/llama.cpp/requirements/requirements-tool_bench.txt +0 -12
- package/src/llama.cpp/requirements.txt +0 -13
- package/src/llama.cpp/scripts/build-info.sh +0 -30
- package/src/llama.cpp/scripts/install-oneapi.bat +0 -19
- package/src/llama.cpp/scripts/xxd.cmake +0 -16
- package/src/llama.cpp/tests/CMakeLists.txt +0 -177
- package/src/llama.cpp/tests/get-model.cpp +0 -21
- package/src/llama.cpp/tests/get-model.h +0 -2
- package/src/llama.cpp/tests/test-arg-parser.cpp +0 -178
- package/src/llama.cpp/tests/test-autorelease.cpp +0 -24
- package/src/llama.cpp/tests/test-backend-ops.cpp +0 -4793
- package/src/llama.cpp/tests/test-barrier.cpp +0 -94
- package/src/llama.cpp/tests/test-c.c +0 -7
- package/src/llama.cpp/tests/test-chat-template.cpp +0 -417
- package/src/llama.cpp/tests/test-chat.cpp +0 -985
- package/src/llama.cpp/tests/test-double-float.cpp +0 -57
- package/src/llama.cpp/tests/test-gbnf-validator.cpp +0 -109
- package/src/llama.cpp/tests/test-gguf.cpp +0 -1338
- package/src/llama.cpp/tests/test-grammar-integration.cpp +0 -1308
- package/src/llama.cpp/tests/test-grammar-llguidance.cpp +0 -1201
- package/src/llama.cpp/tests/test-grammar-parser.cpp +0 -519
- package/src/llama.cpp/tests/test-json-schema-to-grammar.cpp +0 -1304
- package/src/llama.cpp/tests/test-llama-grammar.cpp +0 -408
- package/src/llama.cpp/tests/test-log.cpp +0 -39
- package/src/llama.cpp/tests/test-model-load-cancel.cpp +0 -27
- package/src/llama.cpp/tests/test-mtmd-c-api.c +0 -63
- package/src/llama.cpp/tests/test-opt.cpp +0 -904
- package/src/llama.cpp/tests/test-quantize-fns.cpp +0 -186
- package/src/llama.cpp/tests/test-quantize-perf.cpp +0 -365
- package/src/llama.cpp/tests/test-quantize-stats.cpp +0 -424
- package/src/llama.cpp/tests/test-regex-partial.cpp +0 -288
- package/src/llama.cpp/tests/test-rope.cpp +0 -262
- package/src/llama.cpp/tests/test-sampling.cpp +0 -399
- package/src/llama.cpp/tests/test-tokenizer-0.cpp +0 -312
- package/src/llama.cpp/tests/test-tokenizer-1-bpe.cpp +0 -155
- package/src/llama.cpp/tests/test-tokenizer-1-spm.cpp +0 -125
- package/src/llama.cpp/tools/CMakeLists.txt +0 -39
- package/src/llama.cpp/tools/batched-bench/CMakeLists.txt +0 -5
- package/src/llama.cpp/tools/batched-bench/batched-bench.cpp +0 -204
- package/src/llama.cpp/tools/cvector-generator/CMakeLists.txt +0 -5
- package/src/llama.cpp/tools/cvector-generator/completions.txt +0 -582
- package/src/llama.cpp/tools/cvector-generator/cvector-generator.cpp +0 -508
- package/src/llama.cpp/tools/cvector-generator/mean.hpp +0 -48
- package/src/llama.cpp/tools/cvector-generator/negative.txt +0 -4
- package/src/llama.cpp/tools/cvector-generator/pca.hpp +0 -315
- package/src/llama.cpp/tools/cvector-generator/positive.txt +0 -4
- package/src/llama.cpp/tools/export-lora/CMakeLists.txt +0 -5
- package/src/llama.cpp/tools/export-lora/export-lora.cpp +0 -434
- package/src/llama.cpp/tools/gguf-split/CMakeLists.txt +0 -5
- package/src/llama.cpp/tools/gguf-split/gguf-split.cpp +0 -583
- package/src/llama.cpp/tools/imatrix/CMakeLists.txt +0 -5
- package/src/llama.cpp/tools/imatrix/imatrix.cpp +0 -667
- package/src/llama.cpp/tools/llama-bench/CMakeLists.txt +0 -5
- package/src/llama.cpp/tools/llama-bench/llama-bench.cpp +0 -2024
- package/src/llama.cpp/tools/main/CMakeLists.txt +0 -5
- package/src/llama.cpp/tools/main/main.cpp +0 -977
- package/src/llama.cpp/tools/mtmd/CMakeLists.txt +0 -58
- package/src/llama.cpp/tools/mtmd/clip-impl.h +0 -462
- package/src/llama.cpp/tools/mtmd/clip.cpp +0 -4024
- package/src/llama.cpp/tools/mtmd/clip.h +0 -101
- package/src/llama.cpp/tools/mtmd/deprecation-warning.cpp +0 -22
- package/src/llama.cpp/tools/mtmd/miniaudio.h +0 -93468
- package/src/llama.cpp/tools/mtmd/mtmd-audio.cpp +0 -855
- package/src/llama.cpp/tools/mtmd/mtmd-audio.h +0 -62
- package/src/llama.cpp/tools/mtmd/mtmd-cli.cpp +0 -377
- package/src/llama.cpp/tools/mtmd/mtmd-helper.cpp +0 -297
- package/src/llama.cpp/tools/mtmd/mtmd.cpp +0 -942
- package/src/llama.cpp/tools/mtmd/mtmd.h +0 -362
- package/src/llama.cpp/tools/mtmd/requirements.txt +0 -5
- package/src/llama.cpp/tools/perplexity/CMakeLists.txt +0 -5
- package/src/llama.cpp/tools/perplexity/perplexity.cpp +0 -2063
- package/src/llama.cpp/tools/quantize/CMakeLists.txt +0 -6
- package/src/llama.cpp/tools/quantize/quantize.cpp +0 -519
- package/src/llama.cpp/tools/rpc/CMakeLists.txt +0 -4
- package/src/llama.cpp/tools/rpc/rpc-server.cpp +0 -322
- package/src/llama.cpp/tools/run/CMakeLists.txt +0 -16
- package/src/llama.cpp/tools/run/linenoise.cpp/linenoise.cpp +0 -1995
- package/src/llama.cpp/tools/run/linenoise.cpp/linenoise.h +0 -137
- package/src/llama.cpp/tools/run/run.cpp +0 -1261
- package/src/llama.cpp/tools/server/CMakeLists.txt +0 -51
- package/src/llama.cpp/tools/server/bench/requirements.txt +0 -2
- package/src/llama.cpp/tools/server/httplib.h +0 -10506
- package/src/llama.cpp/tools/server/server.cpp +0 -4966
- package/src/llama.cpp/tools/server/tests/requirements.txt +0 -8
- package/src/llama.cpp/tools/server/utils.hpp +0 -1337
- package/src/llama.cpp/tools/tokenize/CMakeLists.txt +0 -5
- package/src/llama.cpp/tools/tokenize/tokenize.cpp +0 -416
- package/src/llama.cpp/tools/tts/CMakeLists.txt +0 -5
- package/src/llama.cpp/tools/tts/tts.cpp +0 -1092
|
@@ -1,305 +0,0 @@
|
|
|
1
|
-
#include <sycl/sycl.hpp>
|
|
2
|
-
#include "wkv.hpp"
|
|
3
|
-
|
|
4
|
-
constexpr int WKV_BLOCK_SIZE = 64; // Matching CUDA_WKV_BLOCK_SIZE
|
|
5
|
-
|
|
6
|
-
// Helper function for the main kernel
|
|
7
|
-
template <int block_size>
|
|
8
|
-
static void rwkv_wkv6_f32_kernel(
|
|
9
|
-
const int B, const int T, const int C, const int H,
|
|
10
|
-
const float* k, const float* v, const float* r,
|
|
11
|
-
const float* tf, const float* td, const float* s,
|
|
12
|
-
float* dst, const sycl::nd_item<3>& item_ct1, float* shared_mem) {
|
|
13
|
-
|
|
14
|
-
const int tid = item_ct1.get_local_id(2);
|
|
15
|
-
const int bid = item_ct1.get_group(2);
|
|
16
|
-
|
|
17
|
-
const int head_size = block_size;
|
|
18
|
-
const int batch_i = bid / H;
|
|
19
|
-
const int head_i = bid % H;
|
|
20
|
-
const int state_size = C * head_size;
|
|
21
|
-
const int n_seq_tokens = T / B;
|
|
22
|
-
|
|
23
|
-
// Set up shared memory pointers
|
|
24
|
-
float* _k = shared_mem;
|
|
25
|
-
float* _r = _k + head_size;
|
|
26
|
-
float* _tf = _r + head_size;
|
|
27
|
-
float* _td = _tf + head_size;
|
|
28
|
-
|
|
29
|
-
// Local state array
|
|
30
|
-
float state[block_size];
|
|
31
|
-
|
|
32
|
-
// Load initial state
|
|
33
|
-
#pragma unroll
|
|
34
|
-
for (int i = 0; i < head_size; i++) {
|
|
35
|
-
state[i] = s[batch_i * state_size + head_i * head_size * head_size + i * head_size + tid];
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// Sync threads before shared memory operations
|
|
39
|
-
item_ct1.barrier(sycl::access::fence_space::local_space);
|
|
40
|
-
|
|
41
|
-
// Load time-mixing parameters
|
|
42
|
-
_tf[tid] = tf[head_i * head_size + tid];
|
|
43
|
-
item_ct1.barrier(sycl::access::fence_space::local_space);
|
|
44
|
-
|
|
45
|
-
// Main sequence processing loop
|
|
46
|
-
for (int t = batch_i * n_seq_tokens * C + head_i * head_size + tid;
|
|
47
|
-
t < (batch_i + 1) * n_seq_tokens * C + head_i * head_size + tid;
|
|
48
|
-
t += C) {
|
|
49
|
-
|
|
50
|
-
item_ct1.barrier(sycl::access::fence_space::local_space);
|
|
51
|
-
|
|
52
|
-
// Load current timestep data to shared memory
|
|
53
|
-
_k[tid] = k[t];
|
|
54
|
-
_r[tid] = r[t];
|
|
55
|
-
_td[tid] = td[t];
|
|
56
|
-
|
|
57
|
-
item_ct1.barrier(sycl::access::fence_space::local_space);
|
|
58
|
-
|
|
59
|
-
const float _v = v[t];
|
|
60
|
-
float y = 0;
|
|
61
|
-
|
|
62
|
-
// Process in chunks of 4 for better vectorization
|
|
63
|
-
sycl::float4 k4, r4, tf4, td4, s4;
|
|
64
|
-
#pragma unroll
|
|
65
|
-
for (int j = 0; j < head_size; j += 4) {
|
|
66
|
-
// Load data in vec4 chunks
|
|
67
|
-
k4 = sycl::float4(_k[j], _k[j+1], _k[j+2], _k[j+3]);
|
|
68
|
-
r4 = sycl::float4(_r[j], _r[j+1], _r[j+2], _r[j+3]);
|
|
69
|
-
tf4 = sycl::float4(_tf[j], _tf[j+1], _tf[j+2], _tf[j+3]);
|
|
70
|
-
td4 = sycl::float4(_td[j], _td[j+1], _td[j+2], _td[j+3]);
|
|
71
|
-
s4 = sycl::float4(state[j], state[j+1], state[j+2], state[j+3]);
|
|
72
|
-
|
|
73
|
-
// Compute key-value product
|
|
74
|
-
sycl::float4 kv4 = k4 * _v;
|
|
75
|
-
|
|
76
|
-
// Accumulate weighted sum
|
|
77
|
-
y += sycl::dot(r4, tf4 * kv4 + s4);
|
|
78
|
-
|
|
79
|
-
// Update state
|
|
80
|
-
s4 = s4 * td4 + kv4;
|
|
81
|
-
|
|
82
|
-
// Store updated state
|
|
83
|
-
state[j] = s4.x();
|
|
84
|
-
state[j+1] = s4.y();
|
|
85
|
-
state[j+2] = s4.z();
|
|
86
|
-
state[j+3] = s4.w();
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
dst[t] = y;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
// Save final state
|
|
93
|
-
#pragma unroll
|
|
94
|
-
for (int i = 0; i < head_size; i++) {
|
|
95
|
-
dst[T * C + batch_i * state_size + head_i * head_size * head_size + i * head_size + tid] = state[i];
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
template <int block_size>
|
|
100
|
-
static void rwkv_wkv7_f32_kernel(
|
|
101
|
-
const int B, const int T, const int C, const int H,
|
|
102
|
-
const float* r, const float* w, const float* k, const float* v,
|
|
103
|
-
const float* a, const float* b, const float* s,
|
|
104
|
-
float* dst, const sycl::nd_item<3>& item_ct1, float* shared_mem) {
|
|
105
|
-
|
|
106
|
-
const int tid = item_ct1.get_local_id(2);
|
|
107
|
-
const int bid = item_ct1.get_group(2);
|
|
108
|
-
|
|
109
|
-
const int head_size = block_size;
|
|
110
|
-
const int batch_i = bid / H;
|
|
111
|
-
const int head_i = bid % H;
|
|
112
|
-
const int state_size = C * head_size;
|
|
113
|
-
const int n_seq_tokens = T / B;
|
|
114
|
-
|
|
115
|
-
float* _r = shared_mem;
|
|
116
|
-
float* _w = _r + head_size;
|
|
117
|
-
float* _k = _w + head_size;
|
|
118
|
-
float* _a = _k + head_size;
|
|
119
|
-
float* _b = _a + head_size;
|
|
120
|
-
|
|
121
|
-
float state[block_size];
|
|
122
|
-
|
|
123
|
-
#pragma unroll
|
|
124
|
-
for (int i = 0; i < head_size; i++) {
|
|
125
|
-
state[i] = s[batch_i * state_size + head_i * head_size * head_size + tid * head_size + i];
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
for (int t = batch_i * n_seq_tokens * C + head_i * head_size + tid;
|
|
129
|
-
t < (batch_i + 1) * n_seq_tokens * C + head_i * head_size + tid;
|
|
130
|
-
t += C) {
|
|
131
|
-
|
|
132
|
-
item_ct1.barrier(sycl::access::fence_space::local_space);
|
|
133
|
-
|
|
134
|
-
_r[tid] = r[t];
|
|
135
|
-
_w[tid] = w[t];
|
|
136
|
-
_k[tid] = k[t];
|
|
137
|
-
_a[tid] = a[t];
|
|
138
|
-
_b[tid] = b[t];
|
|
139
|
-
|
|
140
|
-
item_ct1.barrier(sycl::access::fence_space::local_space);
|
|
141
|
-
|
|
142
|
-
const float _v = v[t];
|
|
143
|
-
float y = 0, sa = 0;
|
|
144
|
-
sycl::float4 a4, s4;
|
|
145
|
-
|
|
146
|
-
#pragma unroll
|
|
147
|
-
for (int j = 0; j < head_size; j += 4) {
|
|
148
|
-
a4 = sycl::float4(_a[j], _a[j+1], _a[j+2], _a[j+3]);
|
|
149
|
-
s4 = sycl::float4(state[j], state[j+1], state[j+2], state[j+3]);
|
|
150
|
-
sa += sycl::dot(a4, s4);
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
sycl::float4 r4, w4, k4, b4;
|
|
154
|
-
#pragma unroll
|
|
155
|
-
for (int j = 0; j < head_size; j += 4) {
|
|
156
|
-
r4 = sycl::float4(_r[j], _r[j+1], _r[j+2], _r[j+3]);
|
|
157
|
-
w4 = sycl::float4(_w[j], _w[j+1], _w[j+2], _w[j+3]);
|
|
158
|
-
k4 = sycl::float4(_k[j], _k[j+1], _k[j+2], _k[j+3]);
|
|
159
|
-
b4 = sycl::float4(_b[j], _b[j+1], _b[j+2], _b[j+3]);
|
|
160
|
-
s4 = sycl::float4(state[j], state[j+1], state[j+2], state[j+3]);
|
|
161
|
-
|
|
162
|
-
sycl::float4 kv4 = k4 * _v;
|
|
163
|
-
|
|
164
|
-
s4 = s4 * w4 + kv4 + sa * b4;
|
|
165
|
-
y += sycl::dot(r4, s4);
|
|
166
|
-
|
|
167
|
-
state[j] = s4.x();
|
|
168
|
-
state[j+1] = s4.y();
|
|
169
|
-
state[j+2] = s4.z();
|
|
170
|
-
state[j+3] = s4.w();
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
dst[t] = y;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
#pragma unroll
|
|
177
|
-
for (int i = 0; i < head_size; i++) {
|
|
178
|
-
dst[T * C + batch_i * state_size + head_i * head_size * head_size + tid * head_size + i] = state[i];
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
void ggml_sycl_op_rwkv_wkv6(ggml_backend_sycl_context& ctx, ggml_tensor* dst) {
|
|
183
|
-
|
|
184
|
-
const ggml_tensor *src0 = dst->src[0];
|
|
185
|
-
const ggml_tensor *src1 = dst->src[1];
|
|
186
|
-
|
|
187
|
-
const float* k_d = (const float*)dst->src[0]->data;
|
|
188
|
-
const float* v_d = (const float*)dst->src[1]->data;
|
|
189
|
-
const float* r_d = (const float*)dst->src[2]->data;
|
|
190
|
-
const float* tf_d = (const float*)dst->src[3]->data;
|
|
191
|
-
const float* td_d = (const float*)dst->src[4]->data;
|
|
192
|
-
const float* s_d = (const float*)dst->src[5]->data;
|
|
193
|
-
float* dst_d = (float*)dst->data;
|
|
194
|
-
|
|
195
|
-
const int64_t B = dst->src[5]->ne[1];
|
|
196
|
-
const int64_t T = dst->src[0]->ne[2];
|
|
197
|
-
const int64_t C = dst->ne[0];
|
|
198
|
-
const int64_t H = dst->src[0]->ne[1];
|
|
199
|
-
|
|
200
|
-
GGML_ASSERT(dst->src[5]->type == GGML_TYPE_F32);
|
|
201
|
-
GGML_ASSERT(C % H == 0);
|
|
202
|
-
GGML_ASSERT(C / H == WKV_BLOCK_SIZE || C / H == WKV_BLOCK_SIZE * 2); // The current sycl kernel is designed for RWKV6, HEAD_SIZE == 64
|
|
203
|
-
|
|
204
|
-
dpct::queue_ptr stream = ctx.stream();
|
|
205
|
-
|
|
206
|
-
// Calculate execution configuration
|
|
207
|
-
const size_t shared_mem_size = C / H * 4 * sizeof(float); // For k, r, tf, td
|
|
208
|
-
sycl::range<3> block_dims(1, 1, C / H);
|
|
209
|
-
sycl::range<3> grid_dims(1, 1, B * H);
|
|
210
|
-
|
|
211
|
-
// Submit kernel
|
|
212
|
-
if (C / H == WKV_BLOCK_SIZE) {
|
|
213
|
-
stream->submit([&](sycl::handler& cgh) {
|
|
214
|
-
sycl::local_accessor<float, 1> shared_mem_acc(shared_mem_size, cgh);
|
|
215
|
-
|
|
216
|
-
cgh.parallel_for(
|
|
217
|
-
sycl::nd_range<3>(grid_dims * block_dims, block_dims),
|
|
218
|
-
[=](sycl::nd_item<3> item_ct1) {
|
|
219
|
-
rwkv_wkv6_f32_kernel<WKV_BLOCK_SIZE>(
|
|
220
|
-
B, T, C, H, k_d, v_d, r_d, tf_d, td_d, s_d, dst_d,
|
|
221
|
-
item_ct1, (float*)shared_mem_acc.get_multi_ptr<sycl::access::decorated::no>().get()
|
|
222
|
-
);
|
|
223
|
-
});
|
|
224
|
-
});
|
|
225
|
-
} else {
|
|
226
|
-
stream->submit([&](sycl::handler& cgh) {
|
|
227
|
-
sycl::local_accessor<float, 1> shared_mem_acc(shared_mem_size, cgh);
|
|
228
|
-
|
|
229
|
-
cgh.parallel_for(
|
|
230
|
-
sycl::nd_range<3>(grid_dims * block_dims, block_dims),
|
|
231
|
-
[=](sycl::nd_item<3> item_ct1) {
|
|
232
|
-
rwkv_wkv6_f32_kernel<WKV_BLOCK_SIZE * 2>(
|
|
233
|
-
B, T, C, H, k_d, v_d, r_d, tf_d, td_d, s_d, dst_d,
|
|
234
|
-
item_ct1, (float*)shared_mem_acc.get_multi_ptr<sycl::access::decorated::no>().get()
|
|
235
|
-
);
|
|
236
|
-
});
|
|
237
|
-
});
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
GGML_UNUSED(src0);
|
|
241
|
-
GGML_UNUSED(src1);
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
void ggml_sycl_op_rwkv_wkv7(ggml_backend_sycl_context& ctx, ggml_tensor* dst) {
|
|
245
|
-
|
|
246
|
-
const ggml_tensor *src0 = dst->src[0];
|
|
247
|
-
const ggml_tensor *src1 = dst->src[1];
|
|
248
|
-
|
|
249
|
-
const float* r_d = (const float*)dst->src[0]->data;
|
|
250
|
-
const float* w_d = (const float*)dst->src[1]->data;
|
|
251
|
-
const float* k_d = (const float*)dst->src[2]->data;
|
|
252
|
-
const float* v_d = (const float*)dst->src[3]->data;
|
|
253
|
-
const float* a_d = (const float*)dst->src[4]->data;
|
|
254
|
-
const float* b_d = (const float*)dst->src[5]->data;
|
|
255
|
-
const float* s_d = (const float*)dst->src[6]->data;
|
|
256
|
-
float* dst_d = (float*)dst->data;
|
|
257
|
-
|
|
258
|
-
const int64_t B = dst->src[6]->ne[1];
|
|
259
|
-
const int64_t T = dst->src[0]->ne[2];
|
|
260
|
-
const int64_t C = dst->ne[0];
|
|
261
|
-
const int64_t H = dst->src[0]->ne[1];
|
|
262
|
-
|
|
263
|
-
GGML_ASSERT(dst->src[6]->type == GGML_TYPE_F32);
|
|
264
|
-
GGML_ASSERT(C % H == 0);
|
|
265
|
-
GGML_ASSERT(C / H == WKV_BLOCK_SIZE || C / H == WKV_BLOCK_SIZE * 2);
|
|
266
|
-
|
|
267
|
-
dpct::queue_ptr stream = ctx.stream();
|
|
268
|
-
|
|
269
|
-
// Calculate execution configuration
|
|
270
|
-
const size_t shared_mem_size = C / H * 5 * sizeof(float); // For r, w, k, a, b
|
|
271
|
-
sycl::range<3> block_dims(1, 1, C / H);
|
|
272
|
-
sycl::range<3> grid_dims(1, 1, B * H);
|
|
273
|
-
|
|
274
|
-
// Submit kernel
|
|
275
|
-
if (C / H == WKV_BLOCK_SIZE) {
|
|
276
|
-
stream->submit([&](sycl::handler& cgh) {
|
|
277
|
-
sycl::local_accessor<float, 1> shared_mem_acc(shared_mem_size, cgh);
|
|
278
|
-
|
|
279
|
-
cgh.parallel_for(
|
|
280
|
-
sycl::nd_range<3>(grid_dims * block_dims, block_dims),
|
|
281
|
-
[=](sycl::nd_item<3> item_ct1) {
|
|
282
|
-
rwkv_wkv7_f32_kernel<WKV_BLOCK_SIZE>(
|
|
283
|
-
B, T, C, H, r_d, w_d, k_d, v_d, a_d, b_d, s_d, dst_d,
|
|
284
|
-
item_ct1, (float*)shared_mem_acc.get_multi_ptr<sycl::access::decorated::no>().get()
|
|
285
|
-
);
|
|
286
|
-
});
|
|
287
|
-
});
|
|
288
|
-
} else {
|
|
289
|
-
stream->submit([&](sycl::handler& cgh) {
|
|
290
|
-
sycl::local_accessor<float, 1> shared_mem_acc(shared_mem_size, cgh);
|
|
291
|
-
|
|
292
|
-
cgh.parallel_for(
|
|
293
|
-
sycl::nd_range<3>(grid_dims * block_dims, block_dims),
|
|
294
|
-
[=](sycl::nd_item<3> item_ct1) {
|
|
295
|
-
rwkv_wkv7_f32_kernel<WKV_BLOCK_SIZE * 2>(
|
|
296
|
-
B, T, C, H, r_d, w_d, k_d, v_d, a_d, b_d, s_d, dst_d,
|
|
297
|
-
item_ct1, (float*)shared_mem_acc.get_multi_ptr<sycl::access::decorated::no>().get()
|
|
298
|
-
);
|
|
299
|
-
});
|
|
300
|
-
});
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
GGML_UNUSED(src0);
|
|
304
|
-
GGML_UNUSED(src1);
|
|
305
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
#ifndef GGML_SYCL_WKV_HPP
|
|
2
|
-
#define GGML_SYCL_WKV_HPP
|
|
3
|
-
|
|
4
|
-
#include "common.hpp"
|
|
5
|
-
|
|
6
|
-
void ggml_sycl_op_rwkv_wkv6(ggml_backend_sycl_context & ctx, ggml_tensor * dst);
|
|
7
|
-
|
|
8
|
-
void ggml_sycl_op_rwkv_wkv7(ggml_backend_sycl_context & ctx, ggml_tensor * dst);
|
|
9
|
-
|
|
10
|
-
#endif // GGML_SYCL_WKV_HPP
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
#include "ggml-threading.h"
|
|
2
|
-
#include <mutex>
|
|
3
|
-
|
|
4
|
-
std::mutex ggml_critical_section_mutex;
|
|
5
|
-
|
|
6
|
-
void ggml_critical_section_start() {
|
|
7
|
-
ggml_critical_section_mutex.lock();
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
void ggml_critical_section_end(void) {
|
|
11
|
-
ggml_critical_section_mutex.unlock();
|
|
12
|
-
}
|
|
@@ -1,196 +0,0 @@
|
|
|
1
|
-
cmake_minimum_required(VERSION 3.19)
|
|
2
|
-
cmake_policy(SET CMP0114 NEW)
|
|
3
|
-
|
|
4
|
-
find_package(Vulkan COMPONENTS glslc REQUIRED)
|
|
5
|
-
|
|
6
|
-
function(detect_host_compiler)
|
|
7
|
-
if (CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
|
|
8
|
-
find_program(HOST_C_COMPILER NAMES cl gcc clang NO_CMAKE_FIND_ROOT_PATH)
|
|
9
|
-
find_program(HOST_CXX_COMPILER NAMES cl g++ clang++ NO_CMAKE_FIND_ROOT_PATH)
|
|
10
|
-
else()
|
|
11
|
-
find_program(HOST_C_COMPILER NAMES gcc clang NO_CMAKE_FIND_ROOT_PATH)
|
|
12
|
-
find_program(HOST_CXX_COMPILER NAMES g++ clang++ NO_CMAKE_FIND_ROOT_PATH)
|
|
13
|
-
endif()
|
|
14
|
-
set(HOST_C_COMPILER "${HOST_C_COMPILER}" PARENT_SCOPE)
|
|
15
|
-
set(HOST_CXX_COMPILER "${HOST_CXX_COMPILER}" PARENT_SCOPE)
|
|
16
|
-
endfunction()
|
|
17
|
-
|
|
18
|
-
# Function to test shader extension support
|
|
19
|
-
# Parameters:
|
|
20
|
-
# EXTENSION_NAME - Name of the extension to test (e.g., "GL_EXT_integer_dot_product")
|
|
21
|
-
# TEST_SHADER_FILE - Path to the test shader file
|
|
22
|
-
# RESULT_VARIABLE - Name of the variable to set (ON/OFF) based on test result
|
|
23
|
-
function(test_shader_extension_support EXTENSION_NAME TEST_SHADER_FILE RESULT_VARIABLE)
|
|
24
|
-
execute_process(
|
|
25
|
-
COMMAND ${Vulkan_GLSLC_EXECUTABLE} -o - -fshader-stage=compute --target-env=vulkan1.3 "${TEST_SHADER_FILE}"
|
|
26
|
-
OUTPUT_VARIABLE glslc_output
|
|
27
|
-
ERROR_VARIABLE glslc_error
|
|
28
|
-
)
|
|
29
|
-
|
|
30
|
-
if (${glslc_error} MATCHES ".*extension not supported: ${EXTENSION_NAME}.*")
|
|
31
|
-
message(STATUS "${EXTENSION_NAME} not supported by glslc")
|
|
32
|
-
set(${RESULT_VARIABLE} OFF PARENT_SCOPE)
|
|
33
|
-
else()
|
|
34
|
-
message(STATUS "${EXTENSION_NAME} supported by glslc")
|
|
35
|
-
set(${RESULT_VARIABLE} ON PARENT_SCOPE)
|
|
36
|
-
add_compile_definitions(${RESULT_VARIABLE})
|
|
37
|
-
|
|
38
|
-
# Ensure the extension support is forwarded to vulkan-shaders-gen
|
|
39
|
-
list(APPEND VULKAN_SHADER_GEN_CMAKE_ARGS -D${RESULT_VARIABLE}=ON)
|
|
40
|
-
set(VULKAN_SHADER_GEN_CMAKE_ARGS "${VULKAN_SHADER_GEN_CMAKE_ARGS}" PARENT_SCOPE)
|
|
41
|
-
endif()
|
|
42
|
-
endfunction()
|
|
43
|
-
|
|
44
|
-
if (Vulkan_FOUND)
|
|
45
|
-
message(STATUS "Vulkan found")
|
|
46
|
-
|
|
47
|
-
ggml_add_backend_library(ggml-vulkan
|
|
48
|
-
ggml-vulkan.cpp
|
|
49
|
-
../../include/ggml-vulkan.h
|
|
50
|
-
)
|
|
51
|
-
|
|
52
|
-
set(VULKAN_SHADER_GEN_CMAKE_ARGS
|
|
53
|
-
-DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}
|
|
54
|
-
-DCMAKE_RUNTIME_OUTPUT_DIRECTORY=${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
|
|
55
|
-
)
|
|
56
|
-
|
|
57
|
-
set(VULKAN_SHADER_GEN_CMAKE_BUILD_ARGS "")
|
|
58
|
-
if (CMAKE_BUILD_TYPE AND CMAKE_BUILD_TYPE MATCHES "Debug|Release|MinSizeRel|RelWithDebInfo")
|
|
59
|
-
list(APPEND VULKAN_SHADER_GEN_CMAKE_BUILD_ARGS --config=${CMAKE_BUILD_TYPE})
|
|
60
|
-
endif()
|
|
61
|
-
|
|
62
|
-
# Test all shader extensions
|
|
63
|
-
test_shader_extension_support(
|
|
64
|
-
"GL_KHR_cooperative_matrix"
|
|
65
|
-
"${CMAKE_CURRENT_SOURCE_DIR}/vulkan-shaders/test_coopmat_support.comp"
|
|
66
|
-
"GGML_VULKAN_COOPMAT_GLSLC_SUPPORT"
|
|
67
|
-
)
|
|
68
|
-
|
|
69
|
-
test_shader_extension_support(
|
|
70
|
-
"GL_NV_cooperative_matrix2"
|
|
71
|
-
"${CMAKE_CURRENT_SOURCE_DIR}/vulkan-shaders/test_coopmat2_support.comp"
|
|
72
|
-
"GGML_VULKAN_COOPMAT2_GLSLC_SUPPORT"
|
|
73
|
-
)
|
|
74
|
-
|
|
75
|
-
test_shader_extension_support(
|
|
76
|
-
"GL_EXT_integer_dot_product"
|
|
77
|
-
"${CMAKE_CURRENT_SOURCE_DIR}/vulkan-shaders/test_integer_dot_support.comp"
|
|
78
|
-
"GGML_VULKAN_INTEGER_DOT_GLSLC_SUPPORT"
|
|
79
|
-
)
|
|
80
|
-
|
|
81
|
-
test_shader_extension_support(
|
|
82
|
-
"GL_EXT_bfloat16"
|
|
83
|
-
"${CMAKE_CURRENT_SOURCE_DIR}/vulkan-shaders/test_bfloat16_support.comp"
|
|
84
|
-
"GGML_VULKAN_BFLOAT16_GLSLC_SUPPORT"
|
|
85
|
-
)
|
|
86
|
-
|
|
87
|
-
target_link_libraries(ggml-vulkan PRIVATE Vulkan::Vulkan)
|
|
88
|
-
target_include_directories(ggml-vulkan PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
|
|
89
|
-
|
|
90
|
-
# Workaround to the "can't dereference invalidated vector iterator" bug in clang-cl debug build
|
|
91
|
-
# Posssibly relevant: https://stackoverflow.com/questions/74748276/visual-studio-no-displays-the-correct-length-of-stdvector
|
|
92
|
-
if (MSVC AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
|
93
|
-
add_compile_definitions(_ITERATOR_DEBUG_LEVEL=0)
|
|
94
|
-
endif()
|
|
95
|
-
|
|
96
|
-
if (GGML_VULKAN_CHECK_RESULTS)
|
|
97
|
-
add_compile_definitions(GGML_VULKAN_CHECK_RESULTS)
|
|
98
|
-
endif()
|
|
99
|
-
|
|
100
|
-
if (GGML_VULKAN_DEBUG)
|
|
101
|
-
add_compile_definitions(GGML_VULKAN_DEBUG)
|
|
102
|
-
endif()
|
|
103
|
-
|
|
104
|
-
if (GGML_VULKAN_MEMORY_DEBUG)
|
|
105
|
-
add_compile_definitions(GGML_VULKAN_MEMORY_DEBUG)
|
|
106
|
-
endif()
|
|
107
|
-
|
|
108
|
-
if (GGML_VULKAN_SHADER_DEBUG_INFO)
|
|
109
|
-
add_compile_definitions(GGML_VULKAN_SHADER_DEBUG_INFO)
|
|
110
|
-
endif()
|
|
111
|
-
|
|
112
|
-
if (GGML_VULKAN_PERF)
|
|
113
|
-
add_compile_definitions(GGML_VULKAN_PERF)
|
|
114
|
-
endif()
|
|
115
|
-
|
|
116
|
-
if (GGML_VULKAN_VALIDATE)
|
|
117
|
-
add_compile_definitions(GGML_VULKAN_VALIDATE)
|
|
118
|
-
endif()
|
|
119
|
-
|
|
120
|
-
if (GGML_VULKAN_RUN_TESTS)
|
|
121
|
-
add_compile_definitions(GGML_VULKAN_RUN_TESTS)
|
|
122
|
-
endif()
|
|
123
|
-
|
|
124
|
-
# Set up toolchain for host compilation whether cross-compiling or not
|
|
125
|
-
if (CMAKE_CROSSCOMPILING)
|
|
126
|
-
if (GGML_VULKAN_SHADERS_GEN_TOOLCHAIN)
|
|
127
|
-
set(HOST_CMAKE_TOOLCHAIN_FILE ${GGML_VULKAN_SHADERS_GEN_TOOLCHAIN})
|
|
128
|
-
else()
|
|
129
|
-
detect_host_compiler()
|
|
130
|
-
if (NOT HOST_C_COMPILER OR NOT HOST_CXX_COMPILER)
|
|
131
|
-
message(FATAL_ERROR "Host compiler not found")
|
|
132
|
-
else()
|
|
133
|
-
message(STATUS "Host compiler: ${HOST_C_COMPILER} ${HOST_CXX_COMPILER}")
|
|
134
|
-
endif()
|
|
135
|
-
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/host-toolchain.cmake.in ${CMAKE_BINARY_DIR}/host-toolchain.cmake @ONLY)
|
|
136
|
-
set(HOST_CMAKE_TOOLCHAIN_FILE ${CMAKE_BINARY_DIR}/host-toolchain.cmake)
|
|
137
|
-
endif()
|
|
138
|
-
else()
|
|
139
|
-
# For non-cross-compiling, use empty toolchain (use host compiler)
|
|
140
|
-
set(HOST_CMAKE_TOOLCHAIN_FILE "")
|
|
141
|
-
endif()
|
|
142
|
-
|
|
143
|
-
# Always use ExternalProject_Add approach
|
|
144
|
-
include(ExternalProject)
|
|
145
|
-
|
|
146
|
-
# Add toolchain file if cross-compiling
|
|
147
|
-
if (CMAKE_CROSSCOMPILING)
|
|
148
|
-
list(APPEND VULKAN_SHADER_GEN_CMAKE_ARGS -DCMAKE_TOOLCHAIN_FILE=${HOST_CMAKE_TOOLCHAIN_FILE})
|
|
149
|
-
message(STATUS "vulkan-shaders-gen toolchain file: ${HOST_CMAKE_TOOLCHAIN_FILE}")
|
|
150
|
-
endif()
|
|
151
|
-
|
|
152
|
-
# Native build through ExternalProject_Add
|
|
153
|
-
ExternalProject_Add(
|
|
154
|
-
vulkan-shaders-gen
|
|
155
|
-
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/vulkan-shaders
|
|
156
|
-
CMAKE_ARGS ${VULKAN_SHADER_GEN_CMAKE_ARGS}
|
|
157
|
-
BUILD_COMMAND ${CMAKE_COMMAND} --build . ${VULKAN_SHADER_GEN_CMAKE_BUILD_ARGS}
|
|
158
|
-
INSTALL_COMMAND ${CMAKE_COMMAND} --install .
|
|
159
|
-
INSTALL_DIR ${CMAKE_BINARY_DIR}
|
|
160
|
-
)
|
|
161
|
-
ExternalProject_Add_StepTargets(vulkan-shaders-gen build install)
|
|
162
|
-
|
|
163
|
-
set (_ggml_vk_host_suffix $<IF:$<STREQUAL:${CMAKE_HOST_SYSTEM_NAME},Windows>,.exe,>)
|
|
164
|
-
set (_ggml_vk_genshaders_cmd ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/vulkan-shaders-gen${_ggml_vk_host_suffix})
|
|
165
|
-
set (_ggml_vk_header ${CMAKE_CURRENT_BINARY_DIR}/ggml-vulkan-shaders.hpp)
|
|
166
|
-
set (_ggml_vk_source ${CMAKE_CURRENT_BINARY_DIR}/ggml-vulkan-shaders.cpp)
|
|
167
|
-
set (_ggml_vk_input_dir ${CMAKE_CURRENT_SOURCE_DIR}/vulkan-shaders)
|
|
168
|
-
set (_ggml_vk_output_dir ${CMAKE_CURRENT_BINARY_DIR}/vulkan-shaders.spv)
|
|
169
|
-
|
|
170
|
-
file(GLOB _ggml_vk_shader_deps "${_ggml_vk_input_dir}/*.comp")
|
|
171
|
-
set (_ggml_vk_shader_deps ${_ggml_vk_shader_deps} vulkan-shaders-gen)
|
|
172
|
-
|
|
173
|
-
# Add build and install dependencies for all builds
|
|
174
|
-
set(_ggml_vk_shader_deps ${_ggml_vk_shader_deps} vulkan-shaders-gen-build vulkan-shaders-gen-install)
|
|
175
|
-
|
|
176
|
-
add_custom_command(
|
|
177
|
-
OUTPUT ${_ggml_vk_header}
|
|
178
|
-
${_ggml_vk_source}
|
|
179
|
-
|
|
180
|
-
COMMAND ${_ggml_vk_genshaders_cmd}
|
|
181
|
-
--glslc ${Vulkan_GLSLC_EXECUTABLE}
|
|
182
|
-
--input-dir ${_ggml_vk_input_dir}
|
|
183
|
-
--output-dir ${_ggml_vk_output_dir}
|
|
184
|
-
--target-hpp ${_ggml_vk_header}
|
|
185
|
-
--target-cpp ${_ggml_vk_source}
|
|
186
|
-
--no-clean
|
|
187
|
-
|
|
188
|
-
DEPENDS ${_ggml_vk_shader_deps}
|
|
189
|
-
COMMENT "Generate vulkan shaders"
|
|
190
|
-
)
|
|
191
|
-
|
|
192
|
-
target_sources(ggml-vulkan PRIVATE ${_ggml_vk_source} ${_ggml_vk_header})
|
|
193
|
-
|
|
194
|
-
else()
|
|
195
|
-
message(WARNING "Vulkan not found")
|
|
196
|
-
endif()
|