whispercpp 1.3.3 → 1.3.4
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.
- checksums.yaml +4 -4
- data/ext/ruby_whisper_params.c +55 -25
- data/ext/sources/CMakeLists.txt +1 -1
- data/ext/sources/bindings/javascript/package.json +1 -1
- data/ext/sources/build-xcframework.sh +24 -0
- data/ext/sources/examples/CMakeLists.txt +1 -0
- data/ext/sources/examples/addon.node/addon.cpp +19 -19
- data/ext/sources/examples/addon.node/index.js +7 -5
- data/ext/sources/examples/bench/bench.cpp +26 -16
- data/ext/sources/examples/bench.wasm/index-tmpl.html +10 -9
- data/ext/sources/examples/cli/cli.cpp +4 -2
- data/ext/sources/examples/command/command.cpp +26 -24
- data/ext/sources/examples/command.wasm/index-tmpl.html +5 -4
- data/ext/sources/examples/common-ggml.cpp +2 -0
- data/ext/sources/examples/lsp/lsp.cpp +19 -17
- data/ext/sources/examples/server/server.cpp +24 -13
- data/ext/sources/examples/server.py +6 -1
- data/ext/sources/examples/stream/stream.cpp +4 -2
- data/ext/sources/examples/stream.wasm/emscripten.cpp +6 -6
- data/ext/sources/examples/stream.wasm/index-tmpl.html +82 -5
- data/ext/sources/examples/talk-llama/CMakeLists.txt +2 -2
- data/ext/sources/examples/talk-llama/llama-adapter.cpp +101 -4
- data/ext/sources/examples/talk-llama/llama-adapter.h +6 -0
- data/ext/sources/examples/talk-llama/llama-arch.cpp +588 -15
- data/ext/sources/examples/talk-llama/llama-arch.h +58 -1
- data/ext/sources/examples/talk-llama/llama-batch.cpp +103 -71
- data/ext/sources/examples/talk-llama/llama-batch.h +31 -18
- data/ext/sources/examples/talk-llama/llama-chat.cpp +120 -5
- data/ext/sources/examples/talk-llama/llama-chat.h +7 -0
- data/ext/sources/examples/talk-llama/llama-context.cpp +460 -357
- data/ext/sources/examples/talk-llama/llama-context.h +44 -29
- data/ext/sources/examples/talk-llama/llama-cparams.h +4 -4
- data/ext/sources/examples/talk-llama/llama-graph.cpp +543 -271
- data/ext/sources/examples/talk-llama/llama-graph.h +278 -168
- data/ext/sources/examples/talk-llama/llama-hparams.cpp +118 -4
- data/ext/sources/examples/talk-llama/llama-hparams.h +61 -15
- data/ext/sources/examples/talk-llama/llama-impl.h +2 -0
- data/ext/sources/examples/talk-llama/llama-kv-cache-iswa.cpp +326 -0
- data/ext/sources/examples/talk-llama/{llama-kv-cache-unified-iswa.h → llama-kv-cache-iswa.h} +38 -29
- data/ext/sources/examples/talk-llama/llama-kv-cache.cpp +2020 -0
- data/ext/sources/examples/talk-llama/llama-kv-cache.h +358 -27
- data/ext/sources/examples/talk-llama/llama-kv-cells.h +80 -28
- data/ext/sources/examples/talk-llama/llama-memory-hybrid.cpp +56 -36
- data/ext/sources/examples/talk-llama/llama-memory-hybrid.h +30 -29
- data/ext/sources/examples/talk-llama/llama-memory-recurrent.cpp +48 -19
- data/ext/sources/examples/talk-llama/llama-memory-recurrent.h +13 -14
- data/ext/sources/examples/talk-llama/llama-memory.h +16 -10
- data/ext/sources/examples/talk-llama/llama-model-loader.cpp +2 -0
- data/ext/sources/examples/talk-llama/llama-model-loader.h +3 -2
- data/ext/sources/examples/talk-llama/llama-model.cpp +7165 -2336
- data/ext/sources/examples/talk-llama/llama-model.h +60 -9
- data/ext/sources/examples/talk-llama/llama-quant.cpp +48 -10
- data/ext/sources/examples/talk-llama/llama-sampling.cpp +226 -126
- data/ext/sources/examples/talk-llama/llama-vocab.cpp +440 -13
- data/ext/sources/examples/talk-llama/llama-vocab.h +45 -0
- data/ext/sources/examples/talk-llama/llama.cpp +65 -10
- data/ext/sources/examples/talk-llama/llama.h +95 -177
- data/ext/sources/examples/talk-llama/talk-llama.cpp +9 -6
- data/ext/sources/examples/talk-llama/unicode.cpp +207 -0
- data/ext/sources/examples/talk-llama/unicode.h +45 -0
- data/ext/sources/examples/wchess/wchess.cmd/wchess.cmd.cpp +4 -2
- data/ext/sources/examples/whisper.wasm/index-tmpl.html +17 -16
- data/ext/sources/ggml/CMakeLists.txt +59 -31
- data/ext/sources/ggml/cmake/ggml-config.cmake.in +132 -93
- data/ext/sources/ggml/include/ggml-backend.h +17 -1
- data/ext/sources/ggml/include/ggml-cpu.h +1 -1
- data/ext/sources/ggml/include/ggml-metal.h +1 -6
- data/ext/sources/ggml/include/ggml-opt.h +25 -6
- data/ext/sources/ggml/include/ggml-webgpu.h +19 -0
- data/ext/sources/ggml/include/ggml-zdnn.h +17 -0
- data/ext/sources/ggml/include/ggml.h +221 -16
- data/ext/sources/ggml/src/CMakeLists.txt +17 -2
- data/ext/sources/ggml/src/ggml-alloc.c +265 -141
- data/ext/sources/ggml/src/ggml-backend-impl.h +4 -1
- data/ext/sources/ggml/src/ggml-backend-reg.cpp +30 -13
- data/ext/sources/ggml/src/ggml-backend.cpp +221 -38
- data/ext/sources/ggml/src/ggml-blas/CMakeLists.txt +1 -1
- data/ext/sources/ggml/src/ggml-blas/ggml-blas.cpp +5 -4
- data/ext/sources/ggml/src/ggml-cann/CMakeLists.txt +14 -0
- data/ext/sources/ggml/src/ggml-cann/acl_tensor.cpp +3 -1
- data/ext/sources/ggml/src/ggml-cann/aclnn_ops.cpp +903 -717
- data/ext/sources/ggml/src/ggml-cann/aclnn_ops.h +143 -25
- data/ext/sources/ggml/src/ggml-cann/common.h +143 -1
- data/ext/sources/ggml/src/ggml-cann/ggml-cann.cpp +488 -69
- data/ext/sources/ggml/src/ggml-common.h +17 -0
- data/ext/sources/ggml/src/ggml-cpu/CMakeLists.txt +40 -18
- data/ext/sources/ggml/src/ggml-cpu/amx/amx.cpp +4 -2
- data/ext/sources/ggml/src/ggml-cpu/arch/arm/quants.c +132 -596
- data/ext/sources/ggml/src/ggml-cpu/arch/arm/repack.cpp +14 -286
- data/ext/sources/ggml/src/ggml-cpu/arch/loongarch/quants.c +103 -582
- data/ext/sources/ggml/src/ggml-cpu/arch/powerpc/quants.c +162 -589
- data/ext/sources/ggml/src/ggml-cpu/arch/riscv/quants.c +265 -437
- data/ext/sources/ggml/src/ggml-cpu/arch/riscv/repack.cpp +3 -58
- data/ext/sources/ggml/src/ggml-cpu/arch/s390/quants.c +521 -353
- data/ext/sources/ggml/src/ggml-cpu/arch/wasm/quants.c +54 -314
- data/ext/sources/ggml/src/ggml-cpu/arch/x86/quants.c +184 -675
- data/ext/sources/ggml/src/ggml-cpu/arch/x86/repack.cpp +4679 -1657
- data/ext/sources/ggml/src/ggml-cpu/arch-fallback.h +32 -2
- data/ext/sources/ggml/src/ggml-cpu/common.h +14 -0
- data/ext/sources/ggml/src/ggml-cpu/ggml-cpu-impl.h +13 -6
- data/ext/sources/ggml/src/ggml-cpu/ggml-cpu.c +70 -42
- data/ext/sources/ggml/src/ggml-cpu/ggml-cpu.cpp +35 -28
- data/ext/sources/ggml/src/ggml-cpu/kleidiai/kernels.cpp +152 -18
- data/ext/sources/ggml/src/ggml-cpu/kleidiai/kernels.h +7 -1
- data/ext/sources/ggml/src/ggml-cpu/kleidiai/kleidiai.cpp +227 -97
- data/ext/sources/ggml/src/ggml-cpu/llamafile/sgemm.cpp +474 -1116
- data/ext/sources/ggml/src/ggml-cpu/ops.cpp +1587 -1177
- data/ext/sources/ggml/src/ggml-cpu/ops.h +5 -8
- data/ext/sources/ggml/src/ggml-cpu/quants.c +35 -0
- data/ext/sources/ggml/src/ggml-cpu/quants.h +8 -0
- data/ext/sources/ggml/src/ggml-cpu/repack.cpp +458 -47
- data/ext/sources/ggml/src/ggml-cpu/repack.h +22 -0
- data/ext/sources/ggml/src/ggml-cpu/simd-mappings.h +89 -60
- data/ext/sources/ggml/src/ggml-cpu/spacemit/ime.cpp +1024 -0
- data/ext/sources/ggml/src/ggml-cpu/spacemit/ime.h +13 -0
- data/ext/sources/ggml/src/ggml-cpu/spacemit/ime1_kernels.cpp +3196 -0
- data/ext/sources/ggml/src/ggml-cpu/spacemit/ime_kernels.h +26 -0
- data/ext/sources/ggml/src/ggml-cpu/traits.cpp +2 -2
- data/ext/sources/ggml/src/ggml-cpu/traits.h +1 -1
- data/ext/sources/ggml/src/ggml-cpu/vec.cpp +170 -26
- data/ext/sources/ggml/src/ggml-cpu/vec.h +506 -63
- data/ext/sources/ggml/src/ggml-cuda/CMakeLists.txt +20 -16
- data/ext/sources/ggml/src/ggml-cuda/add-id.cu +58 -0
- data/ext/sources/ggml/src/ggml-cuda/add-id.cuh +3 -0
- data/ext/sources/ggml/src/ggml-cuda/binbcast.cu +330 -191
- data/ext/sources/ggml/src/ggml-cuda/binbcast.cuh +2 -0
- data/ext/sources/ggml/src/ggml-cuda/common.cuh +250 -63
- data/ext/sources/ggml/src/ggml-cuda/conv-transpose-1d.cu +1 -4
- data/ext/sources/ggml/src/ggml-cuda/conv2d.cu +166 -0
- data/ext/sources/ggml/src/ggml-cuda/conv2d.cuh +5 -0
- data/ext/sources/ggml/src/ggml-cuda/convert.cu +95 -22
- data/ext/sources/ggml/src/ggml-cuda/convert.cuh +15 -0
- data/ext/sources/ggml/src/ggml-cuda/cpy-utils.cuh +217 -0
- data/ext/sources/ggml/src/ggml-cuda/cpy.cu +64 -307
- data/ext/sources/ggml/src/ggml-cuda/cross-entropy-loss.cu +2 -14
- data/ext/sources/ggml/src/ggml-cuda/dequantize.cuh +14 -40
- data/ext/sources/ggml/src/ggml-cuda/fattn-common.cuh +498 -367
- data/ext/sources/ggml/src/ggml-cuda/fattn-mma-f16.cuh +137 -91
- data/ext/sources/ggml/src/ggml-cuda/fattn-tile.cu +755 -0
- data/ext/sources/ggml/src/ggml-cuda/fattn-tile.cuh +3 -0
- data/ext/sources/ggml/src/ggml-cuda/fattn-vec.cuh +593 -0
- data/ext/sources/ggml/src/ggml-cuda/fattn-wmma-f16.cu +86 -50
- data/ext/sources/ggml/src/ggml-cuda/fattn.cu +185 -198
- data/ext/sources/ggml/src/ggml-cuda/fattn.cuh +2 -0
- data/ext/sources/ggml/src/ggml-cuda/getrows.cu +50 -39
- data/ext/sources/ggml/src/ggml-cuda/ggml-cuda.cu +379 -107
- data/ext/sources/ggml/src/ggml-cuda/im2col.cu +196 -35
- data/ext/sources/ggml/src/ggml-cuda/im2col.cuh +1 -0
- data/ext/sources/ggml/src/ggml-cuda/mean.cu +56 -2
- data/ext/sources/ggml/src/ggml-cuda/mma.cuh +198 -45
- data/ext/sources/ggml/src/ggml-cuda/mmf.cu +123 -0
- data/ext/sources/ggml/src/ggml-cuda/mmf.cuh +496 -0
- data/ext/sources/ggml/src/ggml-cuda/mmq.cu +206 -57
- data/ext/sources/ggml/src/ggml-cuda/mmq.cuh +1262 -721
- data/ext/sources/ggml/src/ggml-cuda/{mmv.cu → mmvf.cu} +53 -53
- data/ext/sources/ggml/src/ggml-cuda/{mmv.cuh → mmvf.cuh} +3 -3
- data/ext/sources/ggml/src/ggml-cuda/mmvq.cu +64 -73
- data/ext/sources/ggml/src/ggml-cuda/norm.cu +284 -12
- data/ext/sources/ggml/src/ggml-cuda/norm.cuh +7 -0
- data/ext/sources/ggml/src/ggml-cuda/opt-step-sgd.cu +49 -0
- data/ext/sources/ggml/src/ggml-cuda/opt-step-sgd.cuh +5 -0
- data/ext/sources/ggml/src/ggml-cuda/pad.cu +46 -23
- data/ext/sources/ggml/src/ggml-cuda/pad_reflect_1d.cu +91 -0
- data/ext/sources/ggml/src/ggml-cuda/pad_reflect_1d.cuh +5 -0
- data/ext/sources/ggml/src/ggml-cuda/quantize.cu +12 -10
- data/ext/sources/ggml/src/ggml-cuda/reduce_rows.cuh +53 -0
- data/ext/sources/ggml/src/ggml-cuda/roll.cu +67 -0
- data/ext/sources/ggml/src/ggml-cuda/roll.cuh +5 -0
- data/ext/sources/ggml/src/ggml-cuda/rope.cu +21 -27
- data/ext/sources/ggml/src/ggml-cuda/scale.cu +14 -11
- data/ext/sources/ggml/src/ggml-cuda/set-rows.cu +276 -0
- data/ext/sources/ggml/src/ggml-cuda/set-rows.cuh +7 -0
- data/ext/sources/ggml/src/ggml-cuda/softcap.cu +34 -0
- data/ext/sources/ggml/src/ggml-cuda/softcap.cuh +5 -0
- data/ext/sources/ggml/src/ggml-cuda/softmax.cu +126 -59
- data/ext/sources/ggml/src/ggml-cuda/ssm-conv.cu +10 -2
- data/ext/sources/ggml/src/ggml-cuda/ssm-scan.cu +322 -100
- data/ext/sources/ggml/src/ggml-cuda/sum.cu +6 -10
- data/ext/sources/ggml/src/ggml-cuda/sumrows.cu +21 -4
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-f16-f16.cu +7 -0
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-f16-q4_0.cu +7 -0
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-f16-q4_1.cu +7 -0
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-f16-q5_0.cu +7 -0
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-f16-q5_1.cu +7 -0
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-f16-q8_0.cu +7 -0
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q4_0-f16.cu +7 -0
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q4_0-q4_0.cu +7 -0
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q4_0-q4_1.cu +7 -0
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q4_0-q5_0.cu +7 -0
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q4_0-q5_1.cu +7 -0
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q4_0-q8_0.cu +7 -0
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q4_1-f16.cu +7 -0
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q4_1-q4_0.cu +7 -0
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q4_1-q4_1.cu +7 -0
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q4_1-q5_0.cu +7 -0
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q4_1-q5_1.cu +7 -0
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q4_1-q8_0.cu +7 -0
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q5_0-f16.cu +7 -0
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q5_0-q4_0.cu +7 -0
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q5_0-q4_1.cu +7 -0
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q5_0-q5_0.cu +7 -0
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q5_0-q5_1.cu +7 -0
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q5_0-q8_0.cu +7 -0
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q5_1-f16.cu +7 -0
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q5_1-q4_0.cu +7 -0
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q5_1-q4_1.cu +7 -0
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q5_1-q5_0.cu +7 -0
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q5_1-q5_1.cu +7 -0
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q5_1-q8_0.cu +7 -0
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q8_0-f16.cu +7 -0
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q8_0-q4_0.cu +7 -0
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q8_0-q4_1.cu +7 -0
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q8_0-q5_0.cu +7 -0
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q8_0-q5_1.cu +7 -0
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-instance-q8_0-q8_0.cu +7 -0
- data/ext/sources/ggml/src/ggml-cuda/template-instances/generate_cu_files.py +21 -18
- data/ext/sources/ggml/src/ggml-cuda/template-instances/mmf-instance-ncols_1.cu +5 -0
- data/ext/sources/ggml/src/ggml-cuda/template-instances/mmf-instance-ncols_10.cu +5 -0
- data/ext/sources/ggml/src/ggml-cuda/template-instances/mmf-instance-ncols_11.cu +5 -0
- data/ext/sources/ggml/src/ggml-cuda/template-instances/mmf-instance-ncols_12.cu +5 -0
- data/ext/sources/ggml/src/ggml-cuda/template-instances/mmf-instance-ncols_13.cu +5 -0
- data/ext/sources/ggml/src/ggml-cuda/template-instances/mmf-instance-ncols_14.cu +5 -0
- data/ext/sources/ggml/src/ggml-cuda/template-instances/mmf-instance-ncols_15.cu +5 -0
- data/ext/sources/ggml/src/ggml-cuda/template-instances/mmf-instance-ncols_16.cu +5 -0
- data/ext/sources/ggml/src/ggml-cuda/template-instances/mmf-instance-ncols_2.cu +5 -0
- data/ext/sources/ggml/src/ggml-cuda/template-instances/mmf-instance-ncols_3.cu +5 -0
- data/ext/sources/ggml/src/ggml-cuda/template-instances/mmf-instance-ncols_4.cu +5 -0
- data/ext/sources/ggml/src/ggml-cuda/template-instances/mmf-instance-ncols_5.cu +5 -0
- data/ext/sources/ggml/src/ggml-cuda/template-instances/mmf-instance-ncols_6.cu +5 -0
- data/ext/sources/ggml/src/ggml-cuda/template-instances/mmf-instance-ncols_7.cu +5 -0
- data/ext/sources/ggml/src/ggml-cuda/template-instances/mmf-instance-ncols_8.cu +5 -0
- data/ext/sources/ggml/src/ggml-cuda/template-instances/mmf-instance-ncols_9.cu +5 -0
- data/ext/sources/ggml/src/ggml-cuda/template-instances/mmq-instance-mxfp4.cu +5 -0
- data/ext/sources/ggml/src/ggml-cuda/topk-moe.cu +259 -0
- data/ext/sources/ggml/src/ggml-cuda/topk-moe.cuh +14 -0
- data/ext/sources/ggml/src/ggml-cuda/tsembd.cu +3 -3
- data/ext/sources/ggml/src/ggml-cuda/unary.cu +90 -0
- data/ext/sources/ggml/src/ggml-cuda/unary.cuh +8 -0
- data/ext/sources/ggml/src/ggml-cuda/upscale.cu +92 -6
- data/ext/sources/ggml/src/ggml-cuda/vecdotq.cuh +110 -22
- data/ext/sources/ggml/src/ggml-cuda/vendors/cuda.h +4 -0
- data/ext/sources/ggml/src/ggml-cuda/vendors/hip.h +58 -36
- data/ext/sources/ggml/src/ggml-cuda/vendors/musa.h +4 -3
- data/ext/sources/ggml/src/ggml-hip/CMakeLists.txt +10 -2
- data/ext/sources/ggml/src/ggml-impl.h +119 -9
- data/ext/sources/ggml/src/ggml-metal/CMakeLists.txt +10 -7
- data/ext/sources/ggml/src/ggml-metal/ggml-metal-common.cpp +446 -0
- data/ext/sources/ggml/src/ggml-metal/ggml-metal-common.h +52 -0
- data/ext/sources/ggml/src/ggml-metal/ggml-metal-context.h +33 -0
- data/ext/sources/ggml/src/ggml-metal/ggml-metal-context.m +600 -0
- data/ext/sources/ggml/src/ggml-metal/ggml-metal-device.cpp +1376 -0
- data/ext/sources/ggml/src/ggml-metal/ggml-metal-device.h +226 -0
- data/ext/sources/ggml/src/ggml-metal/ggml-metal-device.m +1308 -0
- data/ext/sources/ggml/src/ggml-metal/ggml-metal-impl.h +136 -63
- data/ext/sources/ggml/src/ggml-metal/ggml-metal-ops.cpp +3158 -0
- data/ext/sources/ggml/src/ggml-metal/ggml-metal-ops.h +82 -0
- data/ext/sources/ggml/src/ggml-metal/ggml-metal.cpp +718 -0
- data/ext/sources/ggml/src/ggml-metal/ggml-metal.metal +2854 -1503
- data/ext/sources/ggml/src/ggml-musa/CMakeLists.txt +18 -8
- data/ext/sources/ggml/src/ggml-opencl/CMakeLists.txt +18 -0
- data/ext/sources/ggml/src/ggml-opencl/ggml-opencl.cpp +2510 -242
- data/ext/sources/ggml/src/ggml-opencl/kernels/add.cl +107 -0
- data/ext/sources/ggml/src/ggml-opencl/kernels/add_id.cl +42 -0
- data/ext/sources/ggml/src/ggml-opencl/kernels/conv2d.cl +185 -0
- data/ext/sources/ggml/src/ggml-opencl/kernels/conv2d_f16_f32.cl +176 -0
- data/ext/sources/ggml/src/ggml-opencl/kernels/cvt.cl +84 -0
- data/ext/sources/ggml/src/ggml-opencl/kernels/div.cl +66 -0
- data/ext/sources/ggml/src/ggml-opencl/kernels/flash_attn_f16.cl +370 -0
- data/ext/sources/ggml/src/ggml-opencl/kernels/flash_attn_f32.cl +370 -0
- data/ext/sources/ggml/src/ggml-opencl/kernels/flash_attn_f32_f16.cl +373 -0
- data/ext/sources/ggml/src/ggml-opencl/kernels/gelu.cl +27 -0
- data/ext/sources/ggml/src/ggml-opencl/kernels/glu.cl +177 -0
- data/ext/sources/ggml/src/ggml-opencl/kernels/group_norm.cl +49 -0
- data/ext/sources/ggml/src/ggml-opencl/kernels/im2col_f16.cl +1 -1
- data/ext/sources/ggml/src/ggml-opencl/kernels/im2col_f32.cl +1 -1
- data/ext/sources/ggml/src/ggml-opencl/kernels/mul.cl +73 -0
- data/ext/sources/ggml/src/ggml-opencl/kernels/mul_mat_f16_f32.cl +130 -0
- data/ext/sources/ggml/src/ggml-opencl/kernels/mul_mm_f16_f32_l4_lm.cl +132 -0
- data/ext/sources/ggml/src/ggml-opencl/kernels/mul_mm_f32_f32_l4_lm.cl +133 -0
- data/ext/sources/ggml/src/ggml-opencl/kernels/mul_mv_id_mxfp4_f32.cl +189 -0
- data/ext/sources/ggml/src/ggml-opencl/kernels/mul_mv_id_mxfp4_f32_flat.cl +176 -0
- data/ext/sources/ggml/src/ggml-opencl/kernels/mul_mv_id_q8_0_f32.cl +140 -0
- data/ext/sources/ggml/src/ggml-opencl/kernels/mul_mv_id_q8_0_f32_flat.cl +222 -0
- data/ext/sources/ggml/src/ggml-opencl/kernels/mul_mv_mxfp4_f32.cl +144 -0
- data/ext/sources/ggml/src/ggml-opencl/kernels/mul_mv_mxfp4_f32_flat.cl +167 -0
- data/ext/sources/ggml/src/ggml-opencl/kernels/mul_mv_q8_0_f32.cl +125 -0
- data/ext/sources/ggml/src/ggml-opencl/kernels/mul_mv_q8_0_f32_flat.cl +202 -0
- data/ext/sources/ggml/src/ggml-opencl/kernels/norm.cl +80 -0
- data/ext/sources/ggml/src/ggml-opencl/kernels/rms_norm.cl +79 -0
- data/ext/sources/ggml/src/ggml-opencl/kernels/scale.cl +3 -2
- data/ext/sources/ggml/src/ggml-opencl/kernels/set_rows.cl +189 -0
- data/ext/sources/ggml/src/ggml-opencl/kernels/softmax_4_f16.cl +34 -13
- data/ext/sources/ggml/src/ggml-opencl/kernels/softmax_4_f32.cl +34 -13
- data/ext/sources/ggml/src/ggml-opencl/kernels/softmax_f16.cl +34 -13
- data/ext/sources/ggml/src/ggml-opencl/kernels/softmax_f32.cl +34 -13
- data/ext/sources/ggml/src/ggml-opencl/kernels/sub.cl +66 -0
- data/ext/sources/ggml/src/ggml-opencl/kernels/transpose.cl +20 -0
- data/ext/sources/ggml/src/ggml-opencl/kernels/tsembd.cl +2 -2
- data/ext/sources/ggml/src/ggml-opencl/kernels/upscale.cl +2 -3
- data/ext/sources/ggml/src/ggml-opt.cpp +97 -41
- data/ext/sources/ggml/src/ggml-quants.c +111 -16
- data/ext/sources/ggml/src/ggml-quants.h +6 -0
- data/ext/sources/ggml/src/ggml-rpc/ggml-rpc.cpp +67 -47
- data/ext/sources/ggml/src/ggml-sycl/backend.hpp +2 -0
- data/ext/sources/ggml/src/ggml-sycl/binbcast.cpp +15 -5
- data/ext/sources/ggml/src/ggml-sycl/binbcast.hpp +6 -0
- data/ext/sources/ggml/src/ggml-sycl/concat.cpp +25 -16
- data/ext/sources/ggml/src/ggml-sycl/conv.cpp +10 -4
- data/ext/sources/ggml/src/ggml-sycl/convert.cpp +166 -99
- data/ext/sources/ggml/src/ggml-sycl/cpy.cpp +72 -306
- data/ext/sources/ggml/src/ggml-sycl/cpy.hpp +213 -1
- data/ext/sources/ggml/src/ggml-sycl/dmmv.cpp +67 -49
- data/ext/sources/ggml/src/ggml-sycl/dpct/helper.hpp +1 -31
- data/ext/sources/ggml/src/ggml-sycl/element_wise.cpp +79 -29
- data/ext/sources/ggml/src/ggml-sycl/element_wise.hpp +2 -0
- data/ext/sources/ggml/src/ggml-sycl/gemm.hpp +14 -26
- data/ext/sources/ggml/src/ggml-sycl/getrows.cpp +9 -6
- data/ext/sources/ggml/src/ggml-sycl/ggml-sycl.cpp +328 -323
- data/ext/sources/ggml/src/ggml-sycl/gla.cpp +2 -2
- data/ext/sources/ggml/src/ggml-sycl/im2col.cpp +2 -2
- data/ext/sources/ggml/src/ggml-sycl/mmq.cpp +80 -60
- data/ext/sources/ggml/src/ggml-sycl/mmvq.cpp +201 -132
- data/ext/sources/ggml/src/ggml-sycl/norm.cpp +74 -55
- data/ext/sources/ggml/src/ggml-sycl/quantize.hpp +133 -0
- data/ext/sources/ggml/src/ggml-sycl/quants.hpp +8 -9
- data/ext/sources/ggml/src/ggml-sycl/rope.cpp +35 -42
- data/ext/sources/ggml/src/ggml-sycl/set_rows.cpp +234 -0
- data/ext/sources/ggml/src/ggml-sycl/set_rows.hpp +8 -0
- data/ext/sources/ggml/src/ggml-sycl/softmax.cpp +3 -3
- data/ext/sources/ggml/src/ggml-sycl/tsembd.cpp +12 -6
- data/ext/sources/ggml/src/ggml-sycl/vecdotq.hpp +2 -6
- data/ext/sources/ggml/src/ggml-sycl/wkv.cpp +16 -12
- data/ext/sources/ggml/src/ggml-vulkan/ggml-vulkan.cpp +3492 -883
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/add.comp +41 -1
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/add_id.comp +42 -0
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/argmax.comp +13 -4
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/argsort.comp +39 -29
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/conv2d_mm.comp +349 -0
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/copy_from_quant.comp +2 -2
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/copy_to_quant.comp +66 -12
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/dequant_funcs.comp +154 -0
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/dequant_funcs_cm2.comp +21 -0
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/dequant_iq2_s.comp +1 -1
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/dequant_iq2_xxs.comp +2 -1
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/dequant_iq3_s.comp +6 -5
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/dequant_iq3_xxs.comp +4 -2
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/dequant_mxfp4.comp +32 -0
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/dequant_q2_k.comp +1 -1
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/dequant_q3_k.comp +1 -1
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/dequant_q4_k.comp +1 -1
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/dequant_q5_k.comp +1 -1
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/dequant_q6_k.comp +1 -1
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/exp.comp +21 -0
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/flash_attn.comp +69 -24
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/flash_attn_base.comp +60 -20
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/flash_attn_cm1.comp +98 -42
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/flash_attn_cm2.comp +64 -27
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/flash_attn_split_k_reduce.comp +74 -13
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/geglu_erf.comp +27 -0
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/geglu_quick.comp +11 -0
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/gelu_erf.comp +39 -0
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/generic_binary_head.comp +4 -17
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/get_rows.comp +19 -10
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/get_rows_quant.comp +25 -15
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/glu_head.comp +4 -0
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/hardsigmoid.comp +22 -0
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/hardswish.comp +22 -0
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/im2col.comp +18 -14
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/im2col_3d.comp +126 -0
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/mul_mat_vec_base.comp +65 -1
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/mul_mat_vec_nc.comp +11 -7
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/mul_mat_vecq.comp +140 -0
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/mul_mm.comp +144 -531
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/mul_mm_cm2.comp +206 -38
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/mul_mm_funcs.comp +556 -0
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/mul_mmq.comp +12 -5
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/mul_mmq_funcs.comp +15 -9
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/multi_add.comp +111 -0
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/opt_step_sgd.comp +22 -0
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/pad.comp +24 -3
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/quantize_q8_1.comp +53 -3
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/rms_norm.comp +55 -11
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/rms_norm_partials.comp +65 -0
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/roll.comp +46 -0
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/rope_head.comp +1 -4
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/rope_multi.comp +7 -9
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/rope_neox.comp +7 -9
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/rope_norm.comp +7 -9
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/rte.comp +5 -0
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/scale.comp +1 -1
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/soft_max.comp +29 -7
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/soft_max_back.comp +4 -0
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/sqrt.comp +17 -0
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/sum_rows.comp +38 -5
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/swiglu_oai.comp +14 -0
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/timestep_embedding.comp +4 -3
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/types.comp +101 -9
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/upscale.comp +69 -5
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/utils.comp +25 -0
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/vulkan-shaders-gen.cpp +335 -77
- data/ext/sources/ggml/src/ggml-webgpu/CMakeLists.txt +54 -0
- data/ext/sources/ggml/src/ggml-webgpu/ggml-webgpu.cpp +1558 -0
- data/ext/sources/ggml/src/ggml-webgpu/wgsl-shaders/add.tmpl.wgsl +44 -0
- data/ext/sources/ggml/src/ggml-webgpu/wgsl-shaders/add_in_place.tmpl.wgsl +41 -0
- data/ext/sources/ggml/src/ggml-webgpu/wgsl-shaders/binary_head.tmpl +45 -0
- data/ext/sources/ggml/src/ggml-webgpu/wgsl-shaders/common_decls.tmpl +930 -0
- data/ext/sources/ggml/src/ggml-webgpu/wgsl-shaders/cpy.wgsl +60 -0
- data/ext/sources/ggml/src/ggml-webgpu/wgsl-shaders/embed_wgsl.py +124 -0
- data/ext/sources/ggml/src/ggml-webgpu/wgsl-shaders/get_rows.tmpl.wgsl +874 -0
- data/ext/sources/ggml/src/ggml-webgpu/wgsl-shaders/memset.wgsl +40 -0
- data/ext/sources/ggml/src/ggml-webgpu/wgsl-shaders/mul.tmpl.wgsl +44 -0
- data/ext/sources/ggml/src/ggml-webgpu/wgsl-shaders/mul_in_place.tmpl.wgsl +41 -0
- data/ext/sources/ggml/src/ggml-webgpu/wgsl-shaders/mul_mat.tmpl.wgsl +907 -0
- data/ext/sources/ggml/src/ggml-webgpu/wgsl-shaders/rms_norm.wgsl +57 -0
- data/ext/sources/ggml/src/ggml-webgpu/wgsl-shaders/rms_norm_in_place.wgsl +48 -0
- data/ext/sources/ggml/src/ggml-webgpu/wgsl-shaders/set_rows.wgsl +81 -0
- data/ext/sources/ggml/src/ggml-zdnn/CMakeLists.txt +36 -0
- data/ext/sources/ggml/src/ggml-zdnn/common.hpp +59 -0
- data/ext/sources/ggml/src/ggml-zdnn/ggml-zdnn.cpp +628 -0
- data/ext/sources/ggml/src/ggml-zdnn/mmf.cpp +80 -0
- data/ext/sources/ggml/src/ggml-zdnn/mmf.hpp +12 -0
- data/ext/sources/ggml/src/ggml-zdnn/utils.cpp +79 -0
- data/ext/sources/ggml/src/ggml-zdnn/utils.hpp +19 -0
- data/ext/sources/ggml/src/ggml.c +478 -98
- data/ext/sources/ggml/src/gguf.cpp +8 -1
- data/ext/sources/src/whisper.cpp +23 -46
- data/ext/sources/tests/CMakeLists.txt +8 -1
- data/ext/sources/tests/test-vad-full.cpp +3 -3
- data/ext/sources/tests/test-vad.cpp +2 -2
- data/lib/whisper/model/uri.rb +1 -1
- data/sig/whisper.rbs +7 -0
- data/test/test_params.rb +8 -0
- data/test/test_whisper.rb +1 -1
- data/whispercpp.gemspec +1 -1
- metadata +164 -157
- data/ext/sources/examples/talk-llama/llama-kv-cache-unified-iswa.cpp +0 -279
- data/ext/sources/examples/talk-llama/llama-kv-cache-unified.cpp +0 -1841
- data/ext/sources/examples/talk-llama/llama-kv-cache-unified.h +0 -303
- data/ext/sources/ggml/include/ggml-kompute.h +0 -50
- data/ext/sources/ggml/src/ggml-amx/CMakeLists.txt +0 -107
- data/ext/sources/ggml/src/ggml-amx/common.h +0 -94
- data/ext/sources/ggml/src/ggml-amx/ggml-amx.cpp +0 -446
- data/ext/sources/ggml/src/ggml-amx/mmq.cpp +0 -2510
- data/ext/sources/ggml/src/ggml-amx/mmq.h +0 -17
- data/ext/sources/ggml/src/ggml-cann/kernels/CMakeLists.txt +0 -30
- data/ext/sources/ggml/src/ggml-cann/kernels/ascendc_kernels.h +0 -19
- data/ext/sources/ggml/src/ggml-cann/kernels/dup.cpp +0 -234
- data/ext/sources/ggml/src/ggml-cann/kernels/get_row_f16.cpp +0 -197
- data/ext/sources/ggml/src/ggml-cann/kernels/get_row_f32.cpp +0 -190
- data/ext/sources/ggml/src/ggml-cann/kernels/get_row_q4_0.cpp +0 -204
- data/ext/sources/ggml/src/ggml-cann/kernels/get_row_q8_0.cpp +0 -191
- data/ext/sources/ggml/src/ggml-cann/kernels/quantize_f16_q8_0.cpp +0 -218
- data/ext/sources/ggml/src/ggml-cann/kernels/quantize_f32_q8_0.cpp +0 -216
- data/ext/sources/ggml/src/ggml-cann/kernels/quantize_float_to_q4_0.cpp +0 -295
- data/ext/sources/ggml/src/ggml-cuda/fattn-tile-f16.cu +0 -357
- data/ext/sources/ggml/src/ggml-cuda/fattn-tile-f16.cuh +0 -3
- data/ext/sources/ggml/src/ggml-cuda/fattn-tile-f32.cu +0 -365
- data/ext/sources/ggml/src/ggml-cuda/fattn-tile-f32.cuh +0 -3
- data/ext/sources/ggml/src/ggml-cuda/fattn-vec-f16.cuh +0 -482
- data/ext/sources/ggml/src/ggml-cuda/fattn-vec-f32.cuh +0 -472
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-f16-instance-hs128-f16-f16.cu +0 -5
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-f16-instance-hs128-f16-q4_0.cu +0 -5
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-f16-instance-hs128-f16-q4_1.cu +0 -5
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-f16-instance-hs128-f16-q5_0.cu +0 -5
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-f16-instance-hs128-f16-q5_1.cu +0 -5
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-f16-instance-hs128-f16-q8_0.cu +0 -5
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-f16-instance-hs128-q4_0-f16.cu +0 -5
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-f16-instance-hs128-q4_0-q4_0.cu +0 -5
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-f16-instance-hs128-q4_0-q4_1.cu +0 -5
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-f16-instance-hs128-q4_0-q5_0.cu +0 -5
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-f16-instance-hs128-q4_0-q5_1.cu +0 -5
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-f16-instance-hs128-q4_0-q8_0.cu +0 -5
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-f16-instance-hs128-q4_1-f16.cu +0 -5
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-f16-instance-hs128-q4_1-q4_0.cu +0 -5
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-f16-instance-hs128-q4_1-q4_1.cu +0 -5
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-f16-instance-hs128-q4_1-q5_0.cu +0 -5
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-f16-instance-hs128-q4_1-q5_1.cu +0 -5
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-f16-instance-hs128-q4_1-q8_0.cu +0 -5
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-f16-instance-hs128-q5_0-f16.cu +0 -5
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-f16-instance-hs128-q5_0-q4_0.cu +0 -5
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-f16-instance-hs128-q5_0-q4_1.cu +0 -5
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-f16-instance-hs128-q5_0-q5_0.cu +0 -5
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-f16-instance-hs128-q5_0-q5_1.cu +0 -5
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-f16-instance-hs128-q5_0-q8_0.cu +0 -5
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-f16-instance-hs128-q5_1-f16.cu +0 -5
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-f16-instance-hs128-q5_1-q4_0.cu +0 -5
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-f16-instance-hs128-q5_1-q4_1.cu +0 -5
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-f16-instance-hs128-q5_1-q5_0.cu +0 -5
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-f16-instance-hs128-q5_1-q5_1.cu +0 -5
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-f16-instance-hs128-q5_1-q8_0.cu +0 -5
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-f16-instance-hs128-q8_0-f16.cu +0 -5
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-f16-instance-hs128-q8_0-q4_0.cu +0 -5
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-f16-instance-hs128-q8_0-q4_1.cu +0 -5
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-f16-instance-hs128-q8_0-q5_0.cu +0 -5
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-f16-instance-hs128-q8_0-q5_1.cu +0 -5
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-f16-instance-hs128-q8_0-q8_0.cu +0 -5
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-f16-instance-hs256-f16-f16.cu +0 -5
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-f16-instance-hs64-f16-f16.cu +0 -5
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-f16-instance-hs64-f16-q4_0.cu +0 -5
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-f16-instance-hs64-f16-q4_1.cu +0 -5
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-f16-instance-hs64-f16-q5_0.cu +0 -5
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-f16-instance-hs64-f16-q5_1.cu +0 -5
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-f16-instance-hs64-f16-q8_0.cu +0 -5
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-f32-instance-hs128-f16-f16.cu +0 -5
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-f32-instance-hs128-f16-q4_0.cu +0 -5
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-f32-instance-hs128-f16-q4_1.cu +0 -5
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-f32-instance-hs128-f16-q5_0.cu +0 -5
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-f32-instance-hs128-f16-q5_1.cu +0 -5
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-f32-instance-hs128-f16-q8_0.cu +0 -5
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-f32-instance-hs128-q4_0-f16.cu +0 -5
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-f32-instance-hs128-q4_0-q4_0.cu +0 -5
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-f32-instance-hs128-q4_0-q4_1.cu +0 -5
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-f32-instance-hs128-q4_0-q5_0.cu +0 -5
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-f32-instance-hs128-q4_0-q5_1.cu +0 -5
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-f32-instance-hs128-q4_0-q8_0.cu +0 -5
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-f32-instance-hs128-q4_1-f16.cu +0 -5
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-f32-instance-hs128-q4_1-q4_0.cu +0 -5
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-f32-instance-hs128-q4_1-q4_1.cu +0 -5
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-f32-instance-hs128-q4_1-q5_0.cu +0 -5
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-f32-instance-hs128-q4_1-q5_1.cu +0 -5
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-f32-instance-hs128-q4_1-q8_0.cu +0 -5
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-f32-instance-hs128-q5_0-f16.cu +0 -5
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-f32-instance-hs128-q5_0-q4_0.cu +0 -5
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-f32-instance-hs128-q5_0-q4_1.cu +0 -5
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-f32-instance-hs128-q5_0-q5_0.cu +0 -5
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-f32-instance-hs128-q5_0-q5_1.cu +0 -5
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-f32-instance-hs128-q5_0-q8_0.cu +0 -5
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-f32-instance-hs128-q5_1-f16.cu +0 -5
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-f32-instance-hs128-q5_1-q4_0.cu +0 -5
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-f32-instance-hs128-q5_1-q4_1.cu +0 -5
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-f32-instance-hs128-q5_1-q5_0.cu +0 -5
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-f32-instance-hs128-q5_1-q5_1.cu +0 -5
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-f32-instance-hs128-q5_1-q8_0.cu +0 -5
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-f32-instance-hs128-q8_0-f16.cu +0 -5
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-f32-instance-hs128-q8_0-q4_0.cu +0 -5
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-f32-instance-hs128-q8_0-q4_1.cu +0 -5
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-f32-instance-hs128-q8_0-q5_0.cu +0 -5
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-f32-instance-hs128-q8_0-q5_1.cu +0 -5
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-f32-instance-hs128-q8_0-q8_0.cu +0 -5
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-f32-instance-hs256-f16-f16.cu +0 -5
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-f32-instance-hs64-f16-f16.cu +0 -5
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-f32-instance-hs64-f16-q4_0.cu +0 -5
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-f32-instance-hs64-f16-q4_1.cu +0 -5
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-f32-instance-hs64-f16-q5_0.cu +0 -5
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-f32-instance-hs64-f16-q5_1.cu +0 -5
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-vec-f32-instance-hs64-f16-q8_0.cu +0 -5
- data/ext/sources/ggml/src/ggml-kompute/CMakeLists.txt +0 -166
- data/ext/sources/ggml/src/ggml-kompute/ggml-kompute.cpp +0 -2251
- data/ext/sources/ggml/src/ggml-kompute/kompute-shaders/common.comp +0 -112
- data/ext/sources/ggml/src/ggml-kompute/kompute-shaders/op_add.comp +0 -58
- data/ext/sources/ggml/src/ggml-kompute/kompute-shaders/op_addrow.comp +0 -25
- data/ext/sources/ggml/src/ggml-kompute/kompute-shaders/op_cpy_f16_f16.comp +0 -52
- data/ext/sources/ggml/src/ggml-kompute/kompute-shaders/op_cpy_f16_f32.comp +0 -52
- data/ext/sources/ggml/src/ggml-kompute/kompute-shaders/op_cpy_f32_f16.comp +0 -52
- data/ext/sources/ggml/src/ggml-kompute/kompute-shaders/op_cpy_f32_f32.comp +0 -52
- data/ext/sources/ggml/src/ggml-kompute/kompute-shaders/op_diagmask.comp +0 -30
- data/ext/sources/ggml/src/ggml-kompute/kompute-shaders/op_gelu.comp +0 -22
- data/ext/sources/ggml/src/ggml-kompute/kompute-shaders/op_getrows.comp +0 -17
- data/ext/sources/ggml/src/ggml-kompute/kompute-shaders/op_getrows_f16.comp +0 -31
- data/ext/sources/ggml/src/ggml-kompute/kompute-shaders/op_getrows_f32.comp +0 -31
- data/ext/sources/ggml/src/ggml-kompute/kompute-shaders/op_getrows_q4_0.comp +0 -38
- data/ext/sources/ggml/src/ggml-kompute/kompute-shaders/op_getrows_q4_1.comp +0 -39
- data/ext/sources/ggml/src/ggml-kompute/kompute-shaders/op_getrows_q6_k.comp +0 -44
- data/ext/sources/ggml/src/ggml-kompute/kompute-shaders/op_mul.comp +0 -52
- data/ext/sources/ggml/src/ggml-kompute/kompute-shaders/op_mul_mat_f16.comp +0 -69
- data/ext/sources/ggml/src/ggml-kompute/kompute-shaders/op_mul_mat_mat_f32.comp +0 -51
- data/ext/sources/ggml/src/ggml-kompute/kompute-shaders/op_mul_mat_q4_0.comp +0 -33
- data/ext/sources/ggml/src/ggml-kompute/kompute-shaders/op_mul_mat_q4_1.comp +0 -35
- data/ext/sources/ggml/src/ggml-kompute/kompute-shaders/op_mul_mat_q4_k.comp +0 -140
- data/ext/sources/ggml/src/ggml-kompute/kompute-shaders/op_mul_mat_q6_k.comp +0 -106
- data/ext/sources/ggml/src/ggml-kompute/kompute-shaders/op_mul_mat_q8_0.comp +0 -73
- data/ext/sources/ggml/src/ggml-kompute/kompute-shaders/op_mul_mv_q_n.comp +0 -52
- data/ext/sources/ggml/src/ggml-kompute/kompute-shaders/op_mul_mv_q_n_pre.comp +0 -28
- data/ext/sources/ggml/src/ggml-kompute/kompute-shaders/op_norm.comp +0 -84
- data/ext/sources/ggml/src/ggml-kompute/kompute-shaders/op_relu.comp +0 -21
- data/ext/sources/ggml/src/ggml-kompute/kompute-shaders/op_rmsnorm.comp +0 -53
- data/ext/sources/ggml/src/ggml-kompute/kompute-shaders/op_rope_neox_f16.comp +0 -52
- data/ext/sources/ggml/src/ggml-kompute/kompute-shaders/op_rope_neox_f32.comp +0 -52
- data/ext/sources/ggml/src/ggml-kompute/kompute-shaders/op_rope_norm_f16.comp +0 -52
- data/ext/sources/ggml/src/ggml-kompute/kompute-shaders/op_rope_norm_f32.comp +0 -52
- data/ext/sources/ggml/src/ggml-kompute/kompute-shaders/op_scale.comp +0 -19
- data/ext/sources/ggml/src/ggml-kompute/kompute-shaders/op_scale_8.comp +0 -23
- data/ext/sources/ggml/src/ggml-kompute/kompute-shaders/op_silu.comp +0 -22
- data/ext/sources/ggml/src/ggml-kompute/kompute-shaders/op_softmax.comp +0 -72
- data/ext/sources/ggml/src/ggml-kompute/kompute-shaders/rope_common.comp +0 -71
- data/ext/sources/ggml/src/ggml-metal/ggml-metal.m +0 -6280
@@ -17,7 +17,11 @@
|
|
17
17
|
#ifdef COOPMAT
|
18
18
|
#extension GL_KHR_cooperative_matrix : enable
|
19
19
|
#extension GL_KHR_memory_scope_semantics : enable
|
20
|
+
#endif
|
21
|
+
|
22
|
+
#if defined(COOPMAT) || defined(MUL_MAT_ID_USE_SUBGROUPS)
|
20
23
|
#extension GL_KHR_shader_subgroup_basic : enable
|
24
|
+
#extension GL_KHR_shader_subgroup_ballot : enable
|
21
25
|
#endif
|
22
26
|
|
23
27
|
#ifdef MUL_MAT_ID
|
@@ -33,6 +37,18 @@
|
|
33
37
|
#define LOAD_VEC_B 1
|
34
38
|
#endif
|
35
39
|
|
40
|
+
// Load 2 values at once without affecting index calculations through LOAD_VEC
|
41
|
+
#if (defined(DATA_A_F32) || defined(DATA_A_F16) || defined(DATA_A_BF16)) && !defined(ALIGNED)
|
42
|
+
#define LOAD_VEC_BATCH_A 2
|
43
|
+
#else
|
44
|
+
#define LOAD_VEC_BATCH_A 1
|
45
|
+
#endif
|
46
|
+
#if !defined(ALIGNED)
|
47
|
+
#define LOAD_VEC_BATCH_B 2
|
48
|
+
#else
|
49
|
+
#define LOAD_VEC_BATCH_B 1
|
50
|
+
#endif
|
51
|
+
|
36
52
|
#if !defined(TO_FLOAT_TYPE)
|
37
53
|
#define TO_FLOAT_TYPE FLOAT_TYPE
|
38
54
|
#endif
|
@@ -94,24 +110,93 @@ layout (constant_id = 9) const uint TK = 1; // Only needed for coopmat
|
|
94
110
|
layout (constant_id = 10) const uint WARP = 32;
|
95
111
|
|
96
112
|
#ifdef COOPMAT
|
97
|
-
#define SHMEM_STRIDE (BK +
|
113
|
+
#define SHMEM_STRIDE (BK / 2 + 4)
|
98
114
|
#else
|
99
|
-
#define SHMEM_STRIDE (BK + 1)
|
115
|
+
#define SHMEM_STRIDE (BK / 2 + 1)
|
100
116
|
#endif
|
101
117
|
|
102
|
-
shared
|
103
|
-
shared
|
118
|
+
shared FLOAT_TYPE_VEC2 buf_a[BM * SHMEM_STRIDE];
|
119
|
+
shared FLOAT_TYPE_VEC2 buf_b[BN * SHMEM_STRIDE];
|
120
|
+
|
121
|
+
#define NUM_WARPS (BLOCK_SIZE / WARP)
|
104
122
|
|
105
123
|
#ifdef MUL_MAT_ID
|
106
|
-
shared u16vec2 row_ids[
|
107
|
-
|
124
|
+
shared u16vec2 row_ids[BN];
|
125
|
+
uint _ne1;
|
126
|
+
|
127
|
+
#ifdef MUL_MAT_ID_USE_SUBGROUPS
|
128
|
+
shared uvec4 ballots_sh[NUM_WARPS];
|
129
|
+
|
130
|
+
void load_row_ids(uint expert_idx, bool nei0_is_pow2, uint ic) {
|
131
|
+
_ne1 = 0;
|
132
|
+
uint num_elements = p.nei1 * p.nei0;
|
133
|
+
uint nei0shift = findLSB(p.nei0);
|
134
|
+
|
135
|
+
uint ids[16];
|
136
|
+
uint iter = 0;
|
137
|
+
|
138
|
+
for (uint j = 0; j < num_elements; j += BLOCK_SIZE) {
|
139
|
+
// prefetch up to 16 elements
|
140
|
+
if (iter == 0) {
|
141
|
+
[[unroll]] for (uint k = 0; k < 16; ++k) {
|
142
|
+
uint i = j + gl_LocalInvocationIndex + k*BLOCK_SIZE;
|
143
|
+
bool in_range = i < num_elements;
|
144
|
+
uint ii1;
|
145
|
+
if (nei0_is_pow2) {
|
146
|
+
ii1 = i >> nei0shift;
|
147
|
+
} else {
|
148
|
+
ii1 = i / p.nei0;
|
149
|
+
}
|
150
|
+
uint ii0 = i - ii1 * p.nei0;
|
151
|
+
ids[k] = in_range ? data_ids[ii1*p.nbi1 + ii0] : 0;
|
152
|
+
}
|
153
|
+
}
|
154
|
+
uint i = j + gl_LocalInvocationIndex;
|
155
|
+
bool in_range = i < num_elements;
|
156
|
+
uint ii1;
|
157
|
+
if (nei0_is_pow2) {
|
158
|
+
ii1 = i >> nei0shift;
|
159
|
+
} else {
|
160
|
+
ii1 = i / p.nei0;
|
161
|
+
}
|
162
|
+
uint ii0 = i - ii1 * p.nei0;
|
163
|
+
uint id = ids[iter++];
|
164
|
+
uvec4 ballot = subgroupBallot(in_range && id == expert_idx);
|
108
165
|
|
109
|
-
|
166
|
+
ballots_sh[gl_SubgroupID] = ballot;
|
167
|
+
barrier();
|
168
|
+
|
169
|
+
uint subgroup_base = 0;
|
170
|
+
uint total = 0;
|
171
|
+
for (uint k = 0; k < gl_NumSubgroups; ++k) {
|
172
|
+
if (k == gl_SubgroupID) {
|
173
|
+
subgroup_base = total;
|
174
|
+
}
|
175
|
+
total += subgroupBallotBitCount(ballots_sh[k]);
|
176
|
+
}
|
177
|
+
barrier();
|
178
|
+
|
179
|
+
uint idx = subgroup_base + subgroupBallotExclusiveBitCount(ballot);
|
180
|
+
if (in_range && id == expert_idx && _ne1 + idx >= ic * BN && _ne1 + idx < (ic + 1) * BN) {
|
181
|
+
row_ids[_ne1 + idx - ic * BN] = u16vec2(ii0, ii1);
|
182
|
+
}
|
183
|
+
_ne1 += total;
|
184
|
+
iter &= 15;
|
185
|
+
if (_ne1 >= (ic + 1) * BN) {
|
186
|
+
break;
|
187
|
+
}
|
188
|
+
}
|
189
|
+
barrier();
|
190
|
+
}
|
191
|
+
#endif // MUL_MAT_ID_USE_SUBGROUPS
|
192
|
+
#endif // MUL_MAT_ID
|
110
193
|
|
111
194
|
#ifdef COOPMAT
|
112
195
|
shared ACC_TYPE coopmat_stage[TM * TN * NUM_WARPS];
|
113
196
|
#endif
|
114
197
|
|
198
|
+
#include "mul_mm_funcs.comp"
|
199
|
+
|
115
200
|
void main() {
|
116
201
|
#ifdef NEEDS_INIT_IQ_SHMEM
|
117
202
|
init_iq_shmem(gl_WorkGroupSize);
|
@@ -163,26 +248,36 @@ void main() {
|
|
163
248
|
const uint warp_r = warp_i % (BM / WM);
|
164
249
|
const uint warp_c = warp_i / (BM / WM);
|
165
250
|
|
166
|
-
const uint loadr_a = gl_LocalInvocationID.x % (BK / LOAD_VEC_A);
|
167
|
-
const uint loadc_a = gl_LocalInvocationID.x / (BK / LOAD_VEC_A);
|
168
|
-
const uint loadr_b = gl_LocalInvocationID.x % (BK / LOAD_VEC_B);
|
169
|
-
const uint loadc_b = gl_LocalInvocationID.x / (BK / LOAD_VEC_B);
|
251
|
+
const uint loadr_a = gl_LocalInvocationID.x % (BK / LOAD_VEC_A / LOAD_VEC_BATCH_A);
|
252
|
+
const uint loadc_a = gl_LocalInvocationID.x / (BK / LOAD_VEC_A / LOAD_VEC_BATCH_A);
|
253
|
+
const uint loadr_b = gl_LocalInvocationID.x % (BK / LOAD_VEC_B / LOAD_VEC_BATCH_B);
|
254
|
+
const uint loadc_b = gl_LocalInvocationID.x / (BK / LOAD_VEC_B / LOAD_VEC_BATCH_B);
|
170
255
|
|
171
|
-
const uint loadstride_a = gl_WorkGroupSize.x * LOAD_VEC_A / BK;
|
172
|
-
const uint loadstride_b = gl_WorkGroupSize.x * LOAD_VEC_B / BK;
|
256
|
+
const uint loadstride_a = gl_WorkGroupSize.x * LOAD_VEC_A * LOAD_VEC_BATCH_A / BK;
|
257
|
+
const uint loadstride_b = gl_WorkGroupSize.x * LOAD_VEC_B * LOAD_VEC_BATCH_B / BK;
|
173
258
|
|
174
259
|
#ifdef MUL_MAT_ID
|
175
|
-
|
176
|
-
|
177
|
-
|
260
|
+
#ifdef MUL_MAT_ID_USE_SUBGROUPS
|
261
|
+
if (bitCount(p.nei0) == 1) {
|
262
|
+
load_row_ids(expert_idx, true, ic);
|
263
|
+
} else {
|
264
|
+
load_row_ids(expert_idx, false, ic);
|
265
|
+
}
|
266
|
+
#else
|
267
|
+
_ne1 = 0;
|
268
|
+
for (uint ii1 = 0; ii1 < p.nei1 && _ne1 < (ic + 1) * BN; ii1++) {
|
269
|
+
for (uint ii0 = 0; ii0 < p.nei0 && _ne1 < (ic + 1) * BN; ii0++) {
|
178
270
|
if (data_ids[ii1*p.nbi1 + ii0] == expert_idx) {
|
179
|
-
|
271
|
+
if (_ne1 >= ic * BN) {
|
272
|
+
row_ids[_ne1 - ic * BN] = u16vec2(ii0, ii1);
|
273
|
+
}
|
180
274
|
_ne1++;
|
181
275
|
}
|
182
276
|
}
|
183
277
|
}
|
184
278
|
|
185
279
|
barrier();
|
280
|
+
#endif
|
186
281
|
|
187
282
|
// Workgroup has no work
|
188
283
|
if (ic * BN >= _ne1) return;
|
@@ -219,8 +314,8 @@ void main() {
|
|
219
314
|
}
|
220
315
|
#else
|
221
316
|
ACC_TYPE sums[WMITER * TM * WNITER * TN];
|
222
|
-
|
223
|
-
|
317
|
+
FLOAT_TYPE_VEC2 cache_a[WMITER * TM];
|
318
|
+
FLOAT_TYPE_VEC2 cache_b[TN];
|
224
319
|
|
225
320
|
[[unroll]] for (uint i = 0; i < WMITER*TM*WNITER*TN; i++) {
|
226
321
|
sums[i] = ACC_TYPE(0.0f);
|
@@ -229,513 +324,13 @@ void main() {
|
|
229
324
|
|
230
325
|
for (uint block = start_k; block < end_k; block += BK) {
|
231
326
|
[[unroll]] for (uint l = 0; l < BM; l += loadstride_a) {
|
232
|
-
|
233
|
-
#if defined(DATA_A_F32) || defined(DATA_A_F16)
|
234
|
-
#if LOAD_VEC_A == 8
|
235
|
-
const uint idx = pos_a + (loadc_a + l) * p.stride_a / LOAD_VEC_A + loadr_a;
|
236
|
-
const uint buf_idx = (loadc_a + l) * SHMEM_STRIDE + loadr_a * LOAD_VEC_A;
|
237
|
-
buf_a[buf_idx ] = FLOAT_TYPE(data_a[idx][0].x);
|
238
|
-
buf_a[buf_idx + 1] = FLOAT_TYPE(data_a[idx][0].y);
|
239
|
-
buf_a[buf_idx + 2] = FLOAT_TYPE(data_a[idx][0].z);
|
240
|
-
buf_a[buf_idx + 3] = FLOAT_TYPE(data_a[idx][0].w);
|
241
|
-
buf_a[buf_idx + 4] = FLOAT_TYPE(data_a[idx][1].x);
|
242
|
-
buf_a[buf_idx + 5] = FLOAT_TYPE(data_a[idx][1].y);
|
243
|
-
buf_a[buf_idx + 6] = FLOAT_TYPE(data_a[idx][1].z);
|
244
|
-
buf_a[buf_idx + 7] = FLOAT_TYPE(data_a[idx][1].w);
|
245
|
-
#elif LOAD_VEC_A == 4
|
246
|
-
const uint idx = pos_a + (loadc_a + l) * p.stride_a / LOAD_VEC_A + loadr_a;
|
247
|
-
const uint buf_idx = (loadc_a + l) * SHMEM_STRIDE + loadr_a * LOAD_VEC_A;
|
248
|
-
buf_a[buf_idx ] = FLOAT_TYPE(data_a[idx].x);
|
249
|
-
buf_a[buf_idx + 1] = FLOAT_TYPE(data_a[idx].y);
|
250
|
-
buf_a[buf_idx + 2] = FLOAT_TYPE(data_a[idx].z);
|
251
|
-
buf_a[buf_idx + 3] = FLOAT_TYPE(data_a[idx].w);
|
252
|
-
#else
|
253
|
-
if (ir * BM + loadc_a + l < p.M && block + loadr_a < end_k) {
|
254
|
-
buf_a[(loadc_a + l) * SHMEM_STRIDE + loadr_a] = FLOAT_TYPE(data_a[pos_a + (loadc_a + l) * p.stride_a + loadr_a]);
|
255
|
-
} else {
|
256
|
-
buf_a[(loadc_a + l) * SHMEM_STRIDE + loadr_a] = FLOAT_TYPE(0.0f);
|
257
|
-
}
|
258
|
-
#endif
|
259
|
-
#elif defined(DATA_A_BF16)
|
260
|
-
#if LOAD_VEC_A == 4
|
261
|
-
const uint idx = pos_a + (loadc_a + l) * p.stride_a / LOAD_VEC_A + loadr_a;
|
262
|
-
const uint buf_idx = (loadc_a + l) * SHMEM_STRIDE + loadr_a * LOAD_VEC_A;
|
263
|
-
buf_a[buf_idx ] = TO_FLOAT_TYPE(data_a[idx].x);
|
264
|
-
buf_a[buf_idx + 1] = TO_FLOAT_TYPE(data_a[idx].y);
|
265
|
-
buf_a[buf_idx + 2] = TO_FLOAT_TYPE(data_a[idx].z);
|
266
|
-
buf_a[buf_idx + 3] = TO_FLOAT_TYPE(data_a[idx].w);
|
267
|
-
#else
|
268
|
-
if (ir * BM + loadc_a + l < p.M && block + loadr_a < end_k) {
|
269
|
-
buf_a[(loadc_a + l) * SHMEM_STRIDE + loadr_a] = TO_FLOAT_TYPE(data_a[pos_a + (loadc_a + l) * p.stride_a + loadr_a]);
|
270
|
-
} else {
|
271
|
-
buf_a[(loadc_a + l) * SHMEM_STRIDE + loadr_a] = TO_FLOAT_TYPE(uint16_t(0));
|
272
|
-
}
|
273
|
-
#endif
|
274
|
-
#elif defined(DATA_A_Q4_0)
|
275
|
-
const uint idx = pos_a + (loadc_a + l) * p.stride_a / LOAD_VEC_A + loadr_a;
|
276
|
-
const uint buf_idx = (loadc_a + l) * SHMEM_STRIDE + 4 * loadr_a;
|
277
|
-
|
278
|
-
const uint ib = idx / 4;
|
279
|
-
const uint iqs = idx & 0x03;
|
280
|
-
|
281
|
-
const float d = float(data_a_packed16[ib].d);
|
282
|
-
const uint vui = uint(data_a_packed16[ib].qs[2*iqs]) | (uint(data_a_packed16[ib].qs[2*iqs + 1]) << 16);
|
283
|
-
const vec4 v0 = (vec4(unpack8(vui & 0x0F0F0F0F)) - 8.0f) * d;
|
284
|
-
const vec4 v1 = (vec4(unpack8((vui >> 4) & 0x0F0F0F0F)) - 8.0f) * d;
|
285
|
-
|
286
|
-
buf_a[buf_idx ] = FLOAT_TYPE(v0.x);
|
287
|
-
buf_a[buf_idx + 1 ] = FLOAT_TYPE(v0.y);
|
288
|
-
buf_a[buf_idx + 2 ] = FLOAT_TYPE(v0.z);
|
289
|
-
buf_a[buf_idx + 3 ] = FLOAT_TYPE(v0.w);
|
290
|
-
buf_a[buf_idx + 16] = FLOAT_TYPE(v1.x);
|
291
|
-
buf_a[buf_idx + 17] = FLOAT_TYPE(v1.y);
|
292
|
-
buf_a[buf_idx + 18] = FLOAT_TYPE(v1.z);
|
293
|
-
buf_a[buf_idx + 19] = FLOAT_TYPE(v1.w);
|
294
|
-
#elif defined(DATA_A_Q4_1)
|
295
|
-
const uint idx = pos_a + (loadc_a + l) * p.stride_a / LOAD_VEC_A + loadr_a;
|
296
|
-
const uint buf_idx = (loadc_a + l) * SHMEM_STRIDE + 4 * loadr_a;
|
297
|
-
|
298
|
-
const uint ib = idx / 4;
|
299
|
-
const uint iqs = idx & 0x03;
|
300
|
-
|
301
|
-
const float d = float(data_a_packed16[ib].d);
|
302
|
-
const float m = float(data_a_packed16[ib].m);
|
303
|
-
const uint vui = uint(data_a_packed16[ib].qs[2*iqs]) | (uint(data_a_packed16[ib].qs[2*iqs + 1]) << 16);
|
304
|
-
const vec4 v0 = vec4(unpack8(vui & 0x0F0F0F0F)) * d + m;
|
305
|
-
const vec4 v1 = vec4(unpack8((vui >> 4) & 0x0F0F0F0F)) * d + m;
|
306
|
-
|
307
|
-
buf_a[buf_idx ] = FLOAT_TYPE(v0.x);
|
308
|
-
buf_a[buf_idx + 1 ] = FLOAT_TYPE(v0.y);
|
309
|
-
buf_a[buf_idx + 2 ] = FLOAT_TYPE(v0.z);
|
310
|
-
buf_a[buf_idx + 3 ] = FLOAT_TYPE(v0.w);
|
311
|
-
buf_a[buf_idx + 16] = FLOAT_TYPE(v1.x);
|
312
|
-
buf_a[buf_idx + 17] = FLOAT_TYPE(v1.y);
|
313
|
-
buf_a[buf_idx + 18] = FLOAT_TYPE(v1.z);
|
314
|
-
buf_a[buf_idx + 19] = FLOAT_TYPE(v1.w);
|
315
|
-
#elif defined(DATA_A_Q5_0)
|
316
|
-
const uint idx = pos_a + (loadc_a + l) * p.stride_a / LOAD_VEC_A + loadr_a;
|
317
|
-
const uint buf_idx = (loadc_a + l) * SHMEM_STRIDE + 2 * loadr_a;
|
318
|
-
|
319
|
-
const uint ib = idx / 8;
|
320
|
-
const uint iqs = idx & 0x07;
|
321
|
-
|
322
|
-
const float d = float(data_a_packed16[ib].d);
|
323
|
-
const uint uint_qh = uint(data_a_packed16[ib].qh[1]) << 16 | uint(data_a_packed16[ib].qh[0]);
|
324
|
-
const ivec2 qh0 = ivec2(((uint_qh >> 2*iqs) << 4) & 0x10, (uint_qh >> (2*iqs + 12)) & 0x10);
|
325
|
-
const ivec2 qh1 = ivec2(((uint_qh >> (2*iqs + 1)) << 4) & 0x10, (uint_qh >> (2*iqs + 13)) & 0x10);
|
326
|
-
|
327
|
-
const uint vui = uint(data_a_packed16[ib].qs[iqs]);
|
328
|
-
const vec4 v = (vec4((vui & 0xF) | qh0.x, ((vui >> 4) & 0xF) | qh0.y, ((vui >> 8) & 0xF) | qh1.x, (vui >> 12) | qh1.y) - 16.0f) * d;
|
329
|
-
|
330
|
-
buf_a[buf_idx ] = FLOAT_TYPE(v.x);
|
331
|
-
buf_a[buf_idx + 1 ] = FLOAT_TYPE(v.z);
|
332
|
-
buf_a[buf_idx + 16] = FLOAT_TYPE(v.y);
|
333
|
-
buf_a[buf_idx + 17] = FLOAT_TYPE(v.w);
|
334
|
-
#elif defined(DATA_A_Q5_1)
|
335
|
-
const uint idx = pos_a + (loadc_a + l) * p.stride_a / LOAD_VEC_A + loadr_a;
|
336
|
-
const uint buf_idx = (loadc_a + l) * SHMEM_STRIDE + 2 * loadr_a;
|
337
|
-
|
338
|
-
const uint ib = idx / 8;
|
339
|
-
const uint iqs = idx & 0x07;
|
340
|
-
|
341
|
-
const float d = float(data_a_packed16[ib].d);
|
342
|
-
const float m = float(data_a_packed16[ib].m);
|
343
|
-
const uint uint_qh = data_a_packed16[ib].qh;
|
344
|
-
const ivec2 qh0 = ivec2(((uint_qh >> 2*iqs) << 4) & 0x10, (uint_qh >> (2*iqs + 12)) & 0x10);
|
345
|
-
const ivec2 qh1 = ivec2(((uint_qh >> (2*iqs + 1)) << 4) & 0x10, (uint_qh >> (2*iqs + 13)) & 0x10);
|
346
|
-
|
347
|
-
const uint vui = uint(data_a_packed16[ib].qs[iqs]);
|
348
|
-
const vec4 v = vec4((vui & 0xF) | qh0.x, ((vui >> 4) & 0xF) | qh0.y, ((vui >> 8) & 0xF) | qh1.x, (vui >> 12) | qh1.y) * d + m;
|
349
|
-
|
350
|
-
buf_a[buf_idx ] = FLOAT_TYPE(v.x);
|
351
|
-
buf_a[buf_idx + 1 ] = FLOAT_TYPE(v.z);
|
352
|
-
buf_a[buf_idx + 16] = FLOAT_TYPE(v.y);
|
353
|
-
buf_a[buf_idx + 17] = FLOAT_TYPE(v.w);
|
354
|
-
#elif defined(DATA_A_Q8_0)
|
355
|
-
const uint idx = pos_a + (loadc_a + l) * p.stride_a / LOAD_VEC_A + loadr_a;
|
356
|
-
const uint buf_idx = (loadc_a + l) * SHMEM_STRIDE + loadr_a * LOAD_VEC_A;
|
357
|
-
|
358
|
-
const uint ib = idx / 8;
|
359
|
-
const uint iqs = idx & 0x07;
|
360
|
-
|
361
|
-
const float d = float(data_a_packed16[ib].d);
|
362
|
-
const i8vec2 v0 = unpack8(int32_t(data_a_packed16[ib].qs[2*iqs])).xy; // vec4 used due to #12147
|
363
|
-
const i8vec2 v1 = unpack8(int32_t(data_a_packed16[ib].qs[2*iqs + 1])).xy;
|
364
|
-
const vec4 v = vec4(v0.x, v0.y, v1.x, v1.y) * d;
|
365
|
-
|
366
|
-
buf_a[buf_idx ] = FLOAT_TYPE(v.x);
|
367
|
-
buf_a[buf_idx + 1] = FLOAT_TYPE(v.y);
|
368
|
-
buf_a[buf_idx + 2] = FLOAT_TYPE(v.z);
|
369
|
-
buf_a[buf_idx + 3] = FLOAT_TYPE(v.w);
|
370
|
-
#elif defined(DATA_A_Q2_K)
|
371
|
-
const uint idx = pos_a + (loadc_a + l) * p.stride_a / LOAD_VEC_A + loadr_a;
|
372
|
-
const uint buf_idx = (loadc_a + l) * SHMEM_STRIDE + loadr_a * LOAD_VEC_A;
|
373
|
-
|
374
|
-
const uint ib = idx / 128; // 2 values per idx
|
375
|
-
const uint iqs = idx % 128; // 0..127
|
376
|
-
|
377
|
-
const uint qsi = (iqs / 64) * 32 + (iqs % 16) * 2; // 0,2,4..30
|
378
|
-
const uint scalesi = iqs / 8; // 0..15
|
379
|
-
const uint qsshift = ((iqs % 64) / 16) * 2; // 0,2,4,6
|
380
|
-
|
381
|
-
const uvec2 qs = uvec2(data_a[ib].qs[qsi], data_a[ib].qs[qsi + 1]);
|
382
|
-
const uint scales = data_a[ib].scales[scalesi];
|
383
|
-
const vec2 d = vec2(data_a[ib].d);
|
384
|
-
|
385
|
-
const vec2 v = d.x * float(scales & 0xF) * vec2((qs >> qsshift) & 3) - d.y * float(scales >> 4);
|
386
|
-
|
387
|
-
buf_a[buf_idx ] = FLOAT_TYPE(v.x);
|
388
|
-
buf_a[buf_idx + 1] = FLOAT_TYPE(v.y);
|
389
|
-
#elif defined(DATA_A_Q3_K)
|
390
|
-
const uint idx = pos_a + (loadc_a + l) * p.stride_a / LOAD_VEC_A + loadr_a;
|
391
|
-
const uint buf_idx = (loadc_a + l) * SHMEM_STRIDE + loadr_a * LOAD_VEC_A;
|
392
|
-
|
393
|
-
const uint ib = idx / 128; // 2 values per idx
|
394
|
-
const uint iqs = idx % 128; // 0..127
|
395
|
-
|
396
|
-
const uint n = iqs / 64; // 0,1
|
397
|
-
const uint qsi = n * 32 + (iqs % 16) * 2; // 0,2,4..62
|
398
|
-
const uint hmi = (iqs % 16) * 2; // 0,2,4..30
|
399
|
-
const uint j = (iqs % 64) / 4; // 0..3
|
400
|
-
const uint is = iqs / 8; // 0..15
|
401
|
-
const uint halfsplit = ((iqs % 64) / 16); // 0,1,2,3
|
402
|
-
const uint qsshift = halfsplit * 2; // 0,2,4,6
|
403
|
-
const uint m = 1 << (4 * n + halfsplit); // 1,2,4,8,16,32,64,128
|
404
|
-
|
405
|
-
const int8_t us = int8_t(((data_a[ib].scales[is % 8] >> (4 * int(is / 8))) & 0xF)
|
406
|
-
| (((data_a[ib].scales[8 + (is % 4)] >> (2 * int(is / 4))) & 3) << 4));
|
407
|
-
const float dl = float(data_a[ib].d) * float(us - 32);
|
408
|
-
|
409
|
-
buf_a[buf_idx ] = FLOAT_TYPE(dl * float(int8_t((data_a[ib].qs[qsi ] >> qsshift) & 3) - (((data_a[ib].hmask[hmi ] & m) != 0) ? 0 : 4)));
|
410
|
-
buf_a[buf_idx + 1] = FLOAT_TYPE(dl * float(int8_t((data_a[ib].qs[qsi + 1] >> qsshift) & 3) - (((data_a[ib].hmask[hmi + 1] & m) != 0) ? 0 : 4)));
|
411
|
-
#elif defined(DATA_A_Q4_K)
|
412
|
-
const uint idx = pos_a + (loadc_a + l) * p.stride_a / LOAD_VEC_A + loadr_a;
|
413
|
-
const uint buf_idx = (loadc_a + l) * SHMEM_STRIDE + loadr_a * LOAD_VEC_A;
|
414
|
-
|
415
|
-
const uint ib = idx / 128; // 2 values per idx
|
416
|
-
const uint iqs = idx % 128; // 0..127
|
417
|
-
|
418
|
-
const uint n = iqs / 32; // 0,1,2,3
|
419
|
-
const uint b = (iqs % 32) / 16; // 0,1
|
420
|
-
const uint is = 2 * n + b; // 0..7
|
421
|
-
const uint qsi = n * 32 + (iqs % 16) * 2; // 0,2,4..126
|
422
|
-
|
423
|
-
const vec2 loadd = vec2(data_a[ib].d);
|
424
|
-
|
425
|
-
const uint scidx0 = (is < 4) ? is : (is + 4);
|
426
|
-
const uint scidx1 = (is < 4) ? is : (is - 4);
|
427
|
-
const uint scidxmask1 = (is < 4) ? 0x30 : 0xC0;
|
428
|
-
const uint scidxshift1 = (is < 4) ? 0 : 2;
|
429
|
-
const uint mbidx0 = is + 4;
|
430
|
-
const uint mbidx1 = (is < 4) ? is + 4 : is;
|
431
|
-
const uint mbidxmask0 = (is < 4) ? 0xF : 0xF0;
|
432
|
-
const uint mbidxshift0 = (is < 4) ? 0 : 4;
|
433
|
-
const uint mbidxmask1 = (is < 4) ? 0x30 : 0xC0;
|
434
|
-
const uint mbidxshift1 = (is < 4) ? 0 : 2;
|
435
|
-
|
436
|
-
const uint8_t sc = uint8_t((data_a[ib].scales[scidx0] & 0xF) | ((data_a[ib].scales[scidx1] & scidxmask1) >> scidxshift1));
|
437
|
-
const uint8_t mbyte = uint8_t((data_a[ib].scales[mbidx0] & mbidxmask0) >> mbidxshift0 | ((data_a[ib].scales[mbidx1] & mbidxmask1) >> mbidxshift1));
|
438
|
-
|
439
|
-
const float d = loadd.x * sc;
|
440
|
-
const float m = -loadd.y * mbyte;
|
441
|
-
|
442
|
-
buf_a[buf_idx ] = FLOAT_TYPE(fma(d, float((data_a[ib].qs[qsi ] >> (b * 4)) & 0xF), m));
|
443
|
-
buf_a[buf_idx + 1] = FLOAT_TYPE(fma(d, float((data_a[ib].qs[qsi + 1] >> (b * 4)) & 0xF), m));
|
444
|
-
#elif defined(DATA_A_Q5_K)
|
445
|
-
const uint idx = pos_a + (loadc_a + l) * p.stride_a / LOAD_VEC_A + loadr_a;
|
446
|
-
const uint buf_idx = (loadc_a + l) * SHMEM_STRIDE + loadr_a * LOAD_VEC_A;
|
447
|
-
|
448
|
-
const uint ib = idx / 128; // 2 values per idx
|
449
|
-
const uint iqs = idx % 128; // 0..127
|
450
|
-
|
451
|
-
const uint n = iqs / 32; // 0,1,2,3
|
452
|
-
const uint b = (iqs % 32) / 16; // 0,1
|
453
|
-
const uint is = 2 * n + b; // 0..7
|
454
|
-
const uint qsi = n * 32 + (iqs % 16) * 2; // 0,2,4..126
|
455
|
-
const uint qhi = (iqs % 16) * 2; // 0,2,4..30
|
456
|
-
|
457
|
-
const uint8_t hm = uint8_t(1 << (iqs / 16));
|
458
|
-
|
459
|
-
const vec2 loadd = vec2(data_a[ib].d);
|
460
|
-
|
461
|
-
const uint scidx0 = (is < 4) ? is : (is + 4);
|
462
|
-
const uint scidx1 = (is < 4) ? is : (is - 4);
|
463
|
-
const uint scidxmask1 = (is < 4) ? 0x30 : 0xC0;
|
464
|
-
const uint scidxshift1 = (is < 4) ? 0 : 2;
|
465
|
-
const uint mbidx0 = is + 4;
|
466
|
-
const uint mbidx1 = (is < 4) ? is + 4 : is;
|
467
|
-
const uint mbidxmask0 = (is < 4) ? 0xF : 0xF0;
|
468
|
-
const uint mbidxshift0 = (is < 4) ? 0 : 4;
|
469
|
-
const uint mbidxmask1 = (is < 4) ? 0x30 : 0xC0;
|
470
|
-
const uint mbidxshift1 = (is < 4) ? 0 : 2;
|
471
|
-
|
472
|
-
const uint8_t sc = uint8_t((data_a[ib].scales[scidx0] & 0xF) | ((data_a[ib].scales[scidx1] & scidxmask1) >> scidxshift1));
|
473
|
-
const uint8_t mbyte = uint8_t(((data_a[ib].scales[mbidx0] & mbidxmask0) >> mbidxshift0) | ((data_a[ib].scales[mbidx1] & mbidxmask1) >> mbidxshift1));
|
474
|
-
|
475
|
-
const float d = loadd.x * sc;
|
476
|
-
const float m = -loadd.y * mbyte;
|
477
|
-
|
478
|
-
buf_a[buf_idx ] = FLOAT_TYPE(fma(d, float((data_a[ib].qs[qsi ] >> (b * 4)) & 0xF) + float((data_a[ib].qh[qhi ] & hm) != 0 ? 16 : 0), m));
|
479
|
-
buf_a[buf_idx + 1] = FLOAT_TYPE(fma(d, float((data_a[ib].qs[qsi + 1] >> (b * 4)) & 0xF) + float((data_a[ib].qh[qhi + 1] & hm) != 0 ? 16 : 0), m));
|
480
|
-
#elif defined(DATA_A_Q6_K)
|
481
|
-
const uint idx = pos_a + (loadc_a + l) * p.stride_a / LOAD_VEC_A + loadr_a;
|
482
|
-
const uint buf_idx = (loadc_a + l) * SHMEM_STRIDE + loadr_a * LOAD_VEC_A;
|
483
|
-
|
484
|
-
const uint ib = idx / 128; // 2 values per idx
|
485
|
-
const uint iqs = idx % 128; // 0..127
|
486
|
-
|
487
|
-
const uint n = iqs / 64; // 0,1
|
488
|
-
const uint b = (iqs % 64) / 32; // 0,1
|
489
|
-
const uint is_b = (iqs % 16) / 8; // 0,1
|
490
|
-
const uint qhshift = ((iqs % 64) / 16) * 2; // 0,2,4,6
|
491
|
-
const uint is = 8 * n + qhshift + is_b; // 0..15
|
492
|
-
const uint qsi = n * 64 + (iqs % 32) * 2; // 0,2,4..126
|
493
|
-
const uint qhi = n * 32 + (iqs % 16) * 2; // 0,2,4..62
|
494
|
-
|
495
|
-
const float dscale = float(data_a[ib].d) * float(data_a[ib].scales[is]);
|
496
|
-
|
497
|
-
buf_a[buf_idx ] = FLOAT_TYPE(dscale * float(int8_t(((data_a[ib].ql[qsi ] >> (b * 4)) & 0xF) | (((data_a[ib].qh[qhi ] >> qhshift) & 3) << 4)) - 32));
|
498
|
-
buf_a[buf_idx + 1] = FLOAT_TYPE(dscale * float(int8_t(((data_a[ib].ql[qsi + 1] >> (b * 4)) & 0xF) | (((data_a[ib].qh[qhi + 1] >> qhshift) & 3) << 4)) - 32));
|
499
|
-
#elif defined(DATA_A_IQ1_S)
|
500
|
-
const uint idx = pos_a + (loadc_a + l) * p.stride_a / LOAD_VEC_A + loadr_a;
|
501
|
-
const uint buf_idx = (loadc_a + l) * SHMEM_STRIDE + loadr_a * LOAD_VEC_A;
|
502
|
-
|
503
|
-
const uint ib = idx / 128; // 2 values per idx
|
504
|
-
const uint ib32 = (idx % 128) / 16; // 0..7
|
505
|
-
const uint ib8 = (idx % 128) / 4;
|
506
|
-
const int i8 = 2 * int(idx % 4);
|
507
|
-
|
508
|
-
const float d = float(data_a[ib].d);
|
509
|
-
const uint qh = data_a[ib].qh[ib32];
|
510
|
-
const uint qs = data_a[ib].qs[ib8];
|
511
|
-
const float dl = d * (2 * bitfieldExtract(qh, 12, 3) + 1);
|
512
|
-
const float delta = ((qh & 0x8000) != 0) ? -IQ1S_DELTA : IQ1S_DELTA;
|
513
|
-
const int16_t grid = int16_t(iq1s_grid[qs | (bitfieldExtract(qh, 3 * int(ib8 & 3), 3) << 8)]);
|
514
|
-
|
515
|
-
const ivec2 gvec = ivec2(
|
516
|
-
bitfieldExtract(grid, 2 * (i8), 2),
|
517
|
-
bitfieldExtract(grid, 2 * (i8 + 1), 2)
|
518
|
-
);
|
519
|
-
const vec2 v = dl * (vec2(gvec) + delta);
|
520
|
-
|
521
|
-
buf_a[buf_idx ] = FLOAT_TYPE(v.x);
|
522
|
-
buf_a[buf_idx + 1] = FLOAT_TYPE(v.y);
|
523
|
-
#elif defined(DATA_A_IQ1_M)
|
524
|
-
const uint idx = pos_a + (loadc_a + l) * p.stride_a / LOAD_VEC_A + loadr_a;
|
525
|
-
const uint buf_idx = (loadc_a + l) * SHMEM_STRIDE + loadr_a * LOAD_VEC_A;
|
526
|
-
|
527
|
-
const uint ib = idx / 128; // 2 values per idx
|
528
|
-
const uint ib8 = (idx % 128) / 4;
|
529
|
-
const uint ib16 = ib8 / 2;
|
530
|
-
const int i8 = 2 * int(idx % 4);
|
531
|
-
|
532
|
-
const uint16_t[4] scales = data_a[ib].scales;
|
533
|
-
const u16vec4 s = u16vec4(scales[0], scales[1], scales[2], scales[3]) >> 12;
|
534
|
-
const float d = float(unpackHalf2x16(s.x | (s.y << 4) | (s.z << 8) | (s.w << 12)).x);
|
535
|
-
const uint sc = scales[ib8 / 8];
|
536
|
-
const uint qs = data_a[ib].qs[ib8];
|
537
|
-
const uint qh = data_a[ib].qh[ib16] >> (4 * (ib8 & 1));
|
538
|
-
const float dl = d * (2 * bitfieldExtract(sc, 3 * int(ib16 & 3), 3) + 1);
|
539
|
-
const float delta = ((qh & 8) != 0) ? -IQ1M_DELTA : IQ1M_DELTA;
|
540
|
-
const int16_t grid = int16_t(iq1s_grid[qs | ((qh & 7) << 8)]);
|
541
|
-
const ivec2 gvec = ivec2(
|
542
|
-
bitfieldExtract(grid, 2 * (i8), 2),
|
543
|
-
bitfieldExtract(grid, 2 * (i8 + 1), 2)
|
544
|
-
);
|
545
|
-
const vec2 v = dl * (vec2(gvec) + delta);
|
546
|
-
|
547
|
-
buf_a[buf_idx ] = FLOAT_TYPE(v.x);
|
548
|
-
buf_a[buf_idx + 1] = FLOAT_TYPE(v.y);
|
549
|
-
#elif defined(DATA_A_IQ2_XXS)
|
550
|
-
const uint idx = pos_a + (loadc_a + l) * p.stride_a / LOAD_VEC_A + loadr_a;
|
551
|
-
const uint buf_idx = (loadc_a + l) * SHMEM_STRIDE + loadr_a * LOAD_VEC_A;
|
552
|
-
|
553
|
-
const uint ib = idx / 128; // 2 values per idx
|
554
|
-
const uint ib32 = (idx % 128) / 16; // 0..7
|
555
|
-
const uint ib8 = (idx / 4) % 4;
|
556
|
-
|
557
|
-
const float d = float(data_a[ib].d);
|
558
|
-
const uint qs = data_a[ib].qs[8 * ib32 + ib8];
|
559
|
-
const uint signs = pack32(u8vec4(
|
560
|
-
data_a[ib].qs[8*ib32 + 4],
|
561
|
-
data_a[ib].qs[8*ib32 + 5],
|
562
|
-
data_a[ib].qs[8*ib32 + 6],
|
563
|
-
data_a[ib].qs[8*ib32 + 7]
|
564
|
-
));
|
565
|
-
const float db = d * 0.25 * (0.5 + (signs >> 28));
|
566
|
-
const uint32_t sign7 = bitfieldExtract(signs, 7 * int(ib8), 7);
|
567
|
-
const uint sign = (sign7 | (bitCount(sign7) << 7)) >> (2 * (idx % 4));
|
568
|
-
const i8vec2 sign01 = i8vec2(1 - (2 & i8vec2(int8_t(sign << 1), int8_t(sign))));
|
569
|
-
const uint grid = iq2xxs_grid[qs][(idx % 4) / 2] >> (16 * (idx & 1));
|
570
|
-
const vec2 v = db * vec2(sign01) * vec2(unpack8(grid).xy); // vec4 used due to #12147
|
571
|
-
|
572
|
-
buf_a[buf_idx ] = FLOAT_TYPE(v.x);
|
573
|
-
buf_a[buf_idx + 1] = FLOAT_TYPE(v.y);
|
574
|
-
#elif defined(DATA_A_IQ2_XS)
|
575
|
-
const uint idx = pos_a + (loadc_a + l) * p.stride_a / LOAD_VEC_A + loadr_a;
|
576
|
-
const uint buf_idx = (loadc_a + l) * SHMEM_STRIDE + loadr_a * LOAD_VEC_A;
|
577
|
-
|
578
|
-
const uint ib = idx / 128; // 2 values per idx
|
579
|
-
const uint ib32 = (idx % 128) / 16; // 0..7
|
580
|
-
const uint ib8 = (idx / 4) % 4; // 0..3
|
581
|
-
|
582
|
-
const float d = float(data_a[ib].d);
|
583
|
-
const uint scale = (data_a[ib].scales[ib32] >> (2 * (ib8 & 2))) & 0xf;
|
584
|
-
const float db = d * 0.25 * (0.5 + scale);
|
585
|
-
const uint qs = data_a[ib].qs[4 * ib32 + ib8];
|
586
|
-
const uint sign7 = qs >> 9;
|
587
|
-
const uint sign = (sign7 | (bitCount(sign7) << 7)) >> (2 * (idx % 4));
|
588
|
-
const i8vec2 sign01 = i8vec2(1 - (2 & i8vec2(int8_t(sign << 1), int8_t(sign))));
|
589
|
-
const uint grid = iq2xs_grid[qs & 511][(idx % 4) / 2] >> (16 * (idx & 1));
|
590
|
-
const vec2 v = db * vec2(sign01) * vec2(unpack8(grid).xy); // vec4 used due to #12147
|
591
|
-
|
592
|
-
buf_a[buf_idx ] = FLOAT_TYPE(v.x);
|
593
|
-
buf_a[buf_idx + 1] = FLOAT_TYPE(v.y);
|
594
|
-
#elif defined(DATA_A_IQ2_S)
|
595
|
-
const uint idx = pos_a + (loadc_a + l) * p.stride_a / LOAD_VEC_A + loadr_a;
|
596
|
-
const uint buf_idx = (loadc_a + l) * SHMEM_STRIDE + loadr_a * LOAD_VEC_A;
|
597
|
-
|
598
|
-
const uint ib = idx / 128; // 2 values per idx
|
599
|
-
const uint ib8 = (idx % 128) / 4; // 0..31
|
600
|
-
const uint ib32 = ib8 / 4; // 0..7
|
601
|
-
|
602
|
-
const uint scale = (data_a[ib].scales[ib32] >> (2 * (ib8 & 2))) & 0xf;
|
603
|
-
const uint qs = data_a[ib].qs[ib8];
|
604
|
-
const uint qh = data_a[ib].qh[ib32];
|
605
|
-
const uint qhshift = 2 * (ib8 % 4);
|
606
|
-
const uint sign = data_a[ib].qs[QUANT_K / 8 + ib8] >> (2 * (idx % 4));
|
607
|
-
|
608
|
-
const float d = float(data_a[ib].d);
|
609
|
-
const float db = d * 0.25 * (0.5 + scale);
|
610
|
-
const i8vec2 sign01 = i8vec2(1 - (2 & i8vec2(int8_t(sign << 1), int8_t(sign))));
|
611
|
-
const uint16_t grid = unpack16(iq2s_grid[qs | ((qh << (8 - qhshift)) & 0x300)][(idx & 2) >> 1])[idx & 1];
|
612
|
-
const vec2 v = db * vec2(sign01) * vec2(unpack8(uint32_t(grid)).xy); // vec4 used due to #12147
|
613
|
-
|
614
|
-
buf_a[buf_idx ] = FLOAT_TYPE(v.x);
|
615
|
-
buf_a[buf_idx + 1] = FLOAT_TYPE(v.y);
|
616
|
-
#elif defined(DATA_A_IQ3_XXS)
|
617
|
-
const uint idx = pos_a + (loadc_a + l) * p.stride_a / LOAD_VEC_A + loadr_a;
|
618
|
-
const uint buf_idx = (loadc_a + l) * SHMEM_STRIDE + loadr_a * LOAD_VEC_A;
|
619
|
-
|
620
|
-
const uint ib = idx / 128; // 2 values per idx
|
621
|
-
const uint iqs = (idx % 128) / 2; // 0..63
|
622
|
-
const uint is = QUANT_K / 4 + 4 * (iqs / 8); // 8 values
|
623
|
-
|
624
|
-
const float d = float(data_a[ib].d);
|
625
|
-
const uint qs = data_a[ib].qs[iqs];
|
626
|
-
const uint signs = pack32(u8vec4(
|
627
|
-
data_a[ib].qs[is+0],
|
628
|
-
data_a[ib].qs[is+1],
|
629
|
-
data_a[ib].qs[is+2],
|
630
|
-
data_a[ib].qs[is+3]
|
631
|
-
));
|
632
|
-
const float db = d * 0.5 * (0.5 + (signs >> 28));
|
633
|
-
const uint32_t sign7 = bitfieldExtract(signs, 7 * (int(iqs / 2) % 4), 7);
|
634
|
-
const uint sign = (sign7 | (bitCount(sign7) << 7)) >> (2 * (idx % 4));
|
635
|
-
const i8vec2 sign01 = i8vec2(1 - (2 & i8vec2(int8_t(sign << 1), int8_t(sign))));
|
636
|
-
const uint grid = iq3xxs_grid[qs] >> (16 * (idx & 1));
|
637
|
-
const vec2 v = db * vec2(sign01) * vec2(unpack8(grid).xy); // vec4 used due to #12147
|
638
|
-
|
639
|
-
buf_a[buf_idx ] = FLOAT_TYPE(v.x);
|
640
|
-
buf_a[buf_idx + 1] = FLOAT_TYPE(v.y);
|
641
|
-
#elif defined(DATA_A_IQ3_S)
|
642
|
-
const uint idx = pos_a + (loadc_a + l) * p.stride_a / LOAD_VEC_A + loadr_a;
|
643
|
-
const uint buf_idx = (loadc_a + l) * SHMEM_STRIDE + loadr_a * LOAD_VEC_A;
|
644
|
-
|
645
|
-
const uint ib = idx / 128; // 2 values per idx
|
646
|
-
const uint iqs = (idx % 128) / 2; // 0..63
|
647
|
-
const uint iqh = iqs / 8;
|
648
|
-
|
649
|
-
const float d = float(data_a[ib].d);
|
650
|
-
const uint qs = data_a[ib].qs[iqs];
|
651
|
-
const uint qh = data_a[ib].qh[iqh];
|
652
|
-
const int8_t sign = int8_t(data_a[ib].signs[iqs / 2] >> (2 * (idx % 4)));
|
653
|
-
const uint scale = data_a[ib].scales[iqs / 16];
|
654
|
-
const i8vec2 sign01 = i8vec2(1 - (2 & i8vec2(sign << 1, sign)));
|
655
|
-
const float db = d * (1 + 2 * ((scale >> (4 * (iqh & 1))) & 0xf));
|
656
|
-
const uint32_t grid = iq3s_grid[qs | ((qh << (8 - (iqs % 8))) & 256)] >> (16 * (idx % 2));
|
657
|
-
const vec2 v = db * vec2(sign01) * vec2(unpack8(grid).xy); // vec4 used due to #12147
|
658
|
-
|
659
|
-
buf_a[buf_idx ] = FLOAT_TYPE(v.x);
|
660
|
-
buf_a[buf_idx + 1] = FLOAT_TYPE(v.y);
|
661
|
-
#elif defined(DATA_A_IQ4_XS)
|
662
|
-
const uint idx = pos_a + (loadc_a + l) * p.stride_a / LOAD_VEC_A + loadr_a;
|
663
|
-
const uint buf_idx = (loadc_a + l) * SHMEM_STRIDE + loadr_a * LOAD_VEC_A;
|
664
|
-
|
665
|
-
const uint ib = idx / 128; // 2 values per idx
|
666
|
-
const uint ib32 = (idx % 128) / 16; // 0..7
|
667
|
-
const uint iq = 16 * ib32 + 2 * (idx % 8);
|
668
|
-
|
669
|
-
const uint sl = (data_a[ib].scales_l[ib32/2] >> (4 * (ib32 & 1))) & 0xF;
|
670
|
-
const uint sh = ((data_a[ib].scales_h) >> (2 * ib32)) & 3;
|
671
|
-
const uint qshift = (idx & 8) >> 1;
|
672
|
-
u8vec2 qs = u8vec2(data_a[ib].qs[iq], data_a[ib].qs[iq + 1]);
|
673
|
-
qs = (qs >> qshift) & uint8_t(0xF);
|
674
|
-
|
675
|
-
const float d = float(data_a[ib].d);
|
676
|
-
const vec2 v = d * float(int(sl | (sh << 4)) - 32) * vec2(kvalues_iq4nl[qs.x], kvalues_iq4nl[qs.y]);
|
677
|
-
|
678
|
-
buf_a[buf_idx ] = FLOAT_TYPE(v.x);
|
679
|
-
buf_a[buf_idx + 1] = FLOAT_TYPE(v.y);
|
680
|
-
#elif defined(DATA_A_IQ4_NL)
|
681
|
-
const uint idx = pos_a + (loadc_a + l) * p.stride_a / LOAD_VEC_A + loadr_a;
|
682
|
-
const uint buf_idx = (loadc_a + l) * SHMEM_STRIDE + 2 * loadr_a;
|
683
|
-
|
684
|
-
const uint ib = idx / 8;
|
685
|
-
const uint iqs = idx & 0x07;
|
686
|
-
|
687
|
-
const FLOAT_TYPE d = FLOAT_TYPE(data_a_packed16[ib].d);
|
688
|
-
const uint vui = uint(data_a_packed16[ib].qs[iqs]);
|
689
|
-
|
690
|
-
buf_a[buf_idx ] = FLOAT_TYPE(kvalues_iq4nl[vui & 0xF]) * d;
|
691
|
-
buf_a[buf_idx + 1 ] = FLOAT_TYPE(kvalues_iq4nl[bitfieldExtract(vui, 8, 4)]) * d;
|
692
|
-
buf_a[buf_idx + 16] = FLOAT_TYPE(kvalues_iq4nl[bitfieldExtract(vui, 4, 4)]) * d;
|
693
|
-
buf_a[buf_idx + 17] = FLOAT_TYPE(kvalues_iq4nl[vui >> 12]) * d;
|
694
|
-
#endif
|
327
|
+
load_a_to_shmem(pos_a, loadr_a, loadc_a + l, ir * BM + loadc_a + l, block, end_k);
|
695
328
|
}
|
696
329
|
[[unroll]] for (uint l = 0; l < BN; l += loadstride_b) {
|
697
|
-
#if
|
698
|
-
|
699
|
-
const u16vec2 row_idx = row_ids[ic * BN + loadc_b + l];
|
700
|
-
const uint idx = pos_b + row_idx.y * p.batch_stride_b / LOAD_VEC_B + (row_idx.x % p.ne11) * p.stride_b / LOAD_VEC_B + loadr_b;
|
330
|
+
#if !defined(MUL_MAT_ID)
|
331
|
+
load_b_to_shmem(pos_b, loadr_b, loadc_b + l, ic * BN + loadc_b + l, block, end_k);
|
701
332
|
#else
|
702
|
-
|
703
|
-
#endif
|
704
|
-
const uint buf_idx = (loadc_b + l) * SHMEM_STRIDE + loadr_b * LOAD_VEC_B;
|
705
|
-
buf_b[buf_idx + 0] = FLOAT_TYPE(data_b[idx][0].x);
|
706
|
-
buf_b[buf_idx + 1] = FLOAT_TYPE(data_b[idx][0].y);
|
707
|
-
buf_b[buf_idx + 2] = FLOAT_TYPE(data_b[idx][0].z);
|
708
|
-
buf_b[buf_idx + 3] = FLOAT_TYPE(data_b[idx][0].w);
|
709
|
-
buf_b[buf_idx + 4] = FLOAT_TYPE(data_b[idx][1].x);
|
710
|
-
buf_b[buf_idx + 5] = FLOAT_TYPE(data_b[idx][1].y);
|
711
|
-
buf_b[buf_idx + 6] = FLOAT_TYPE(data_b[idx][1].z);
|
712
|
-
buf_b[buf_idx + 7] = FLOAT_TYPE(data_b[idx][1].w);
|
713
|
-
#elif LOAD_VEC_B == 4
|
714
|
-
#ifdef MUL_MAT_ID
|
715
|
-
const u16vec2 row_idx = row_ids[ic * BN + loadc_b + l];
|
716
|
-
const uint idx = pos_b + row_idx.y * p.batch_stride_b / LOAD_VEC_B + (row_idx.x % p.ne11) * p.stride_b / LOAD_VEC_B + loadr_b;
|
717
|
-
#else
|
718
|
-
const uint idx = pos_b + (loadc_b + l) * p.stride_b / LOAD_VEC_B + loadr_b;
|
719
|
-
#endif
|
720
|
-
const uint buf_idx = (loadc_b + l) * SHMEM_STRIDE + loadr_b * LOAD_VEC_B;
|
721
|
-
buf_b[buf_idx + 0] = TO_FLOAT_TYPE(data_b[idx].x);
|
722
|
-
buf_b[buf_idx + 1] = TO_FLOAT_TYPE(data_b[idx].y);
|
723
|
-
buf_b[buf_idx + 2] = TO_FLOAT_TYPE(data_b[idx].z);
|
724
|
-
buf_b[buf_idx + 3] = TO_FLOAT_TYPE(data_b[idx].w);
|
725
|
-
#elif !MUL_MAT_ID
|
726
|
-
if (ic * BN + loadc_b + l < p.N && block + loadr_b < end_k) {
|
727
|
-
buf_b[(loadc_b + l) * SHMEM_STRIDE + loadr_b] = TO_FLOAT_TYPE(data_b[pos_b + (loadc_b + l) * p.stride_b + loadr_b]);
|
728
|
-
} else {
|
729
|
-
buf_b[(loadc_b + l) * SHMEM_STRIDE + loadr_b] = FLOAT_TYPE(0.0f);
|
730
|
-
}
|
731
|
-
#else
|
732
|
-
const uint row_i = ic * BN + loadc_b + l;
|
733
|
-
if (row_i < _ne1) {
|
734
|
-
const u16vec2 row_idx = row_ids[row_i];
|
735
|
-
buf_b[(loadc_b + l) * SHMEM_STRIDE + loadr_b] = TO_FLOAT_TYPE(data_b[pos_b + row_idx.y * p.batch_stride_b + (row_idx.x % p.ne11) * p.stride_b + loadr_b]);
|
736
|
-
} else {
|
737
|
-
buf_b[(loadc_b + l) * SHMEM_STRIDE + loadr_b] = FLOAT_TYPE(0.0f);
|
738
|
-
}
|
333
|
+
load_b_to_shmem(pos_b, loadr_b, loadc_b + l, ic, _ne1, block, end_k);
|
739
334
|
#endif
|
740
335
|
}
|
741
336
|
|
@@ -748,17 +343,17 @@ void main() {
|
|
748
343
|
[[unroll]] for (uint i = 0; i < BK; i += TK) {
|
749
344
|
[[unroll]] for (uint cm_row = 0; cm_row < cms_per_row; cm_row++) {
|
750
345
|
// Load from shared into cache
|
751
|
-
coopMatLoad(cache_a, buf_a, (warp_r * WM + cm_row * TM) * SHMEM_STRIDE + i, SHMEM_STRIDE, gl_CooperativeMatrixLayoutRowMajor);
|
346
|
+
coopMatLoad(cache_a, buf_a, (warp_r * WM + cm_row * TM) * SHMEM_STRIDE + i / 2, SHMEM_STRIDE, gl_CooperativeMatrixLayoutRowMajor);
|
752
347
|
|
753
348
|
[[unroll]] for (uint cm_col = 0; cm_col < cms_per_col; cm_col++) {
|
754
|
-
coopMatLoad(cache_b, buf_b, (warp_c * WN + cm_col * TN) * SHMEM_STRIDE + i, SHMEM_STRIDE, gl_CooperativeMatrixLayoutColumnMajor);
|
349
|
+
coopMatLoad(cache_b, buf_b, (warp_c * WN + cm_col * TN) * SHMEM_STRIDE + i / 2, SHMEM_STRIDE, gl_CooperativeMatrixLayoutColumnMajor);
|
755
350
|
|
756
351
|
sums[cm_col * cms_per_row + cm_row] = coopMatMulAdd(cache_a, cache_b, sums[cm_col * cms_per_row + cm_row]);
|
757
352
|
}
|
758
353
|
}
|
759
354
|
}
|
760
355
|
#else
|
761
|
-
[[unroll]] for (uint i = 0; i < BK; i++) {
|
356
|
+
[[unroll]] for (uint i = 0; i < BK / 2; i++) {
|
762
357
|
// Load from shared into cache
|
763
358
|
[[unroll]] for (uint wsir = 0; wsir < WMITER; wsir++) {
|
764
359
|
[[unroll]] for (uint j = 0; j < TM; j++) {
|
@@ -774,7 +369,7 @@ void main() {
|
|
774
369
|
[[unroll]] for (uint cc = 0; cc < TN; cc++) {
|
775
370
|
[[unroll]] for (uint cr = 0; cr < TM; cr++) {
|
776
371
|
const uint sums_idx = (wsic * TN + cc) * (WMITER * TM) + wsir * TM + cr;
|
777
|
-
sums[sums_idx] = fma(ACC_TYPE(cache_a[wsir * TM + cr]), ACC_TYPE(cache_b[cc]), sums[sums_idx]);
|
372
|
+
sums[sums_idx] = fma(ACC_TYPE(cache_a[wsir * TM + cr].x), ACC_TYPE(cache_b[cc].x), fma(ACC_TYPE(cache_a[wsir * TM + cr].y), ACC_TYPE(cache_b[cc].y), sums[sums_idx]));
|
778
373
|
}
|
779
374
|
}
|
780
375
|
}
|
@@ -785,6 +380,20 @@ void main() {
|
|
785
380
|
barrier();
|
786
381
|
}
|
787
382
|
|
383
|
+
#if defined(ACC_TYPE_MAX)
|
384
|
+
#ifdef COOPMAT
|
385
|
+
[[unroll]] for (uint j = 0; j < cms_per_row * cms_per_col; j++) {
|
386
|
+
[[unroll]] for (uint i = 0; i < sums[j].length(); ++i) {
|
387
|
+
sums[j][i] = clamp(sums[j][i], -ACC_TYPE_MAX, ACC_TYPE_MAX);
|
388
|
+
}
|
389
|
+
}
|
390
|
+
#else
|
391
|
+
[[unroll]] for (uint i = 0; i < WMITER*TM*WNITER*TN; i++) {
|
392
|
+
sums[i] = clamp(sums[i], -ACC_TYPE_MAX, ACC_TYPE_MAX);
|
393
|
+
}
|
394
|
+
#endif
|
395
|
+
#endif
|
396
|
+
|
788
397
|
const uint dr = ir * BM + warp_r * WM;
|
789
398
|
const uint dc = ic * BN + warp_c * WN;
|
790
399
|
|
@@ -802,9 +411,11 @@ void main() {
|
|
802
411
|
const uint row_i = dc + cm_col * TN + col + store_c;
|
803
412
|
if (row_i >= _ne1) break;
|
804
413
|
|
805
|
-
const u16vec2 row_idx = row_ids[row_i];
|
414
|
+
const u16vec2 row_idx = row_ids[row_i - ic * BN];
|
806
415
|
|
807
|
-
|
416
|
+
if (dr + cm_row * TM + store_r < p.M) {
|
417
|
+
data_d[row_idx.y * p.batch_stride_d + row_idx.x * p.stride_d + dr + cm_row * TM + store_r] = D_TYPE(coopmat_stage[warp_i * TM * TN + (col + store_c) * TM + store_r]);
|
418
|
+
}
|
808
419
|
}
|
809
420
|
}
|
810
421
|
}
|
@@ -850,11 +461,13 @@ void main() {
|
|
850
461
|
const uint row_i = dc_warp + cc;
|
851
462
|
if (row_i >= _ne1) break;
|
852
463
|
|
853
|
-
const u16vec2 row_idx = row_ids[row_i];
|
464
|
+
const u16vec2 row_idx = row_ids[row_i - ic * BN];
|
854
465
|
#endif // MUL_MAT_ID
|
855
466
|
[[unroll]] for (uint cr = 0; cr < TM; cr++) {
|
856
467
|
#ifdef MUL_MAT_ID
|
857
|
-
|
468
|
+
if (dr_warp + cr < p.M) {
|
469
|
+
data_d[row_idx.y * p.batch_stride_d + row_idx.x * p.stride_d + dr_warp + cr] = D_TYPE(sums[(wsic * TN + cc) * (WMITER * TM) + wsir * TM + cr]);
|
470
|
+
}
|
858
471
|
#else
|
859
472
|
if (dr_warp + cr < p.M && dc_warp + cc < p.N) {
|
860
473
|
data_d[offsets + (dc_warp + cc) * p.stride_d + dr_warp + cr] = D_TYPE(sums[(wsic * TN + cc) * (WMITER * TM) + wsir * TM + cr]);
|