whispercpp 1.3.7 → 1.3.8
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/README.md +5 -4
- data/ext/options.rb +1 -1
- data/ext/ruby_whisper.c +0 -1
- data/ext/ruby_whisper.h +7 -1
- data/ext/ruby_whisper_context.c +50 -1
- data/ext/ruby_whisper_log_settable.h +1 -2
- data/ext/ruby_whisper_params.c +9 -8
- data/ext/ruby_whisper_transcribe.cpp +0 -19
- data/ext/ruby_whisper_vad_context.c +30 -10
- data/ext/ruby_whisper_vad_context_detect.cpp +8 -9
- data/ext/ruby_whisper_vad_params.c +4 -4
- data/ext/ruby_whisper_vad_segment.c +2 -2
- data/ext/sources/CMakeLists.txt +2 -1
- data/ext/sources/cmake/parakeet.pc.in +2 -2
- data/ext/sources/cmake/whisper.pc.in +2 -2
- data/ext/sources/examples/cli/cli.cpp +9 -1
- data/ext/sources/examples/common-ggml.cpp +2 -0
- data/ext/sources/examples/vad-speech-segments/speech.cpp +3 -2
- data/ext/sources/ggml/CMakeLists.txt +3 -4
- data/ext/sources/ggml/include/ggml-cuda.h +0 -3
- data/ext/sources/ggml/include/ggml-sycl.h +8 -0
- data/ext/sources/ggml/include/ggml.h +3 -1
- data/ext/sources/ggml/src/CMakeLists.txt +8 -1
- data/ext/sources/ggml/src/ggml-backend-meta.cpp +7 -4
- data/ext/sources/ggml/src/ggml-common.h +13 -2
- data/ext/sources/ggml/src/ggml-cpu/CMakeLists.txt +1 -1
- data/ext/sources/ggml/src/ggml-cpu/amx/mmq.cpp +5 -6
- data/ext/sources/ggml/src/ggml-cpu/arch/arm/quants.c +78 -4
- data/ext/sources/ggml/src/ggml-cpu/arch/x86/quants.c +142 -4
- data/ext/sources/ggml/src/ggml-cpu/arch-fallback.h +7 -2
- data/ext/sources/ggml/src/ggml-cpu/ggml-cpu.c +14 -0
- data/ext/sources/ggml/src/ggml-cpu/llamafile/sgemm.cpp +26 -19
- data/ext/sources/ggml/src/ggml-cpu/ops.cpp +129 -46
- data/ext/sources/ggml/src/ggml-cpu/quants.c +51 -0
- data/ext/sources/ggml/src/ggml-cpu/quants.h +3 -0
- data/ext/sources/ggml/src/ggml-cpu/simd-gemm.h +1 -1
- data/ext/sources/ggml/src/ggml-cpu/simd-mappings.h +11 -0
- data/ext/sources/ggml/src/ggml-cpu/vec.cpp +2 -2
- data/ext/sources/ggml/src/ggml-cuda/binbcast.cu +90 -46
- data/ext/sources/ggml/src/ggml-cuda/col2im-1d.cu +81 -0
- data/ext/sources/ggml/src/ggml-cuda/col2im-1d.cuh +3 -0
- data/ext/sources/ggml/src/ggml-cuda/common.cuh +4 -0
- data/ext/sources/ggml/src/ggml-cuda/concat.cu +33 -21
- data/ext/sources/ggml/src/ggml-cuda/conv-transpose-1d.cu +14 -12
- data/ext/sources/ggml/src/ggml-cuda/convert.cu +86 -34
- data/ext/sources/ggml/src/ggml-cuda/cpy.cu +80 -29
- data/ext/sources/ggml/src/ggml-cuda/fattn-common.cuh +9 -5
- data/ext/sources/ggml/src/ggml-cuda/fattn-mma-f16.cuh +4 -0
- data/ext/sources/ggml/src/ggml-cuda/fattn-tile.cuh +9 -5
- data/ext/sources/ggml/src/ggml-cuda/fattn.cu +27 -21
- data/ext/sources/ggml/src/ggml-cuda/gated_delta_net.cu +40 -25
- data/ext/sources/ggml/src/ggml-cuda/gated_delta_net.cuh +10 -0
- data/ext/sources/ggml/src/ggml-cuda/getrows.cu +15 -12
- data/ext/sources/ggml/src/ggml-cuda/ggml-cuda.cu +718 -1248
- data/ext/sources/ggml/src/ggml-cuda/mmq.cu +7 -0
- data/ext/sources/ggml/src/ggml-cuda/mmvq.cu +77 -40
- data/ext/sources/ggml/src/ggml-cuda/out-prod.cu +55 -12
- data/ext/sources/ggml/src/ggml-cuda/set-rows.cu +64 -4
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-mma-f16-instance-ncols1_16-ncols2_2.cu +1 -0
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-mma-f16-instance-ncols1_32-ncols2_2.cu +1 -0
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-mma-f16-instance-ncols1_4-ncols2_2.cu +1 -0
- data/ext/sources/ggml/src/ggml-cuda/template-instances/fattn-mma-f16-instance-ncols1_8-ncols2_2.cu +1 -0
- data/ext/sources/ggml/src/ggml-cuda/topk-moe.cu +7 -1
- data/ext/sources/ggml/src/ggml-cuda/vendors/hip.h +1 -0
- data/ext/sources/ggml/src/ggml-cuda/vendors/musa.h +1 -0
- data/ext/sources/ggml/src/ggml-hexagon/CMakeLists.txt +0 -5
- data/ext/sources/ggml/src/ggml-hexagon/ggml-hexagon.cpp +1634 -1293
- data/ext/sources/ggml/src/ggml-hexagon/htp/CMakeLists.txt +11 -40
- data/ext/sources/ggml/src/ggml-hexagon/htp/cmake-toolchain.cmake +13 -15
- data/ext/sources/ggml/src/ggml-hexagon/htp/concat-ops.c +1 -1
- data/ext/sources/ggml/src/ggml-hexagon/htp/flash-attn-ops.c +1749 -399
- data/ext/sources/ggml/src/ggml-hexagon/htp/flash-attn-ops.h +303 -0
- data/ext/sources/ggml/src/ggml-hexagon/htp/hex-common.h +80 -0
- data/ext/sources/ggml/src/ggml-hexagon/htp/hex-dma.h +26 -23
- data/ext/sources/ggml/src/ggml-hexagon/htp/hex-profile.h +64 -0
- data/ext/sources/ggml/src/ggml-hexagon/htp/hex-utils.h +1 -83
- data/ext/sources/ggml/src/ggml-hexagon/htp/hmx-fa-kernels.h +555 -0
- data/ext/sources/ggml/src/ggml-hexagon/htp/hmx-mm-kernels-tiled.h +1303 -0
- data/ext/sources/ggml/src/ggml-hexagon/htp/hmx-queue.c +9 -0
- data/ext/sources/ggml/src/ggml-hexagon/htp/hmx-queue.h +27 -4
- data/ext/sources/ggml/src/ggml-hexagon/htp/hmx-utils.h +59 -37
- data/ext/sources/ggml/src/ggml-hexagon/htp/htp-ctx.h +11 -3
- data/ext/sources/ggml/src/ggml-hexagon/htp/htp-ops.h +52 -12
- data/ext/sources/ggml/src/ggml-hexagon/htp/htp-vtcm.h +19 -0
- data/ext/sources/ggml/src/ggml-hexagon/htp/htp_iface.idl +2 -1
- data/ext/sources/ggml/src/ggml-hexagon/htp/hvx-base.h +14 -30
- data/ext/sources/ggml/src/ggml-hexagon/htp/hvx-exp.h +39 -0
- data/ext/sources/ggml/src/ggml-hexagon/htp/hvx-fa-kernels.h +232 -0
- data/ext/sources/ggml/src/ggml-hexagon/htp/hvx-mm-kernels-flat.h +1511 -0
- data/ext/sources/ggml/src/ggml-hexagon/htp/hvx-mm-kernels-tiled.h +1200 -0
- data/ext/sources/ggml/src/ggml-hexagon/htp/hvx-sigmoid.h +39 -0
- data/ext/sources/ggml/src/ggml-hexagon/htp/main.c +127 -32
- data/ext/sources/ggml/src/ggml-hexagon/htp/matmul-ops.c +3023 -4425
- data/ext/sources/ggml/src/ggml-hexagon/htp/matmul-ops.h +650 -0
- data/ext/sources/ggml/src/ggml-hexagon/htp/rope-ops.c +48 -13
- data/ext/sources/ggml/src/ggml-hexagon/htp/ssm-conv.c +10 -9
- data/ext/sources/ggml/src/ggml-hexagon/htp/worker-pool.c +15 -3
- data/ext/sources/ggml/src/ggml-hexagon/htp/worker-pool.h +8 -0
- data/ext/sources/ggml/src/ggml-hexagon/htp-opnode.h +168 -50
- data/ext/sources/ggml/src/ggml-hexagon/libggml-htp.inf +0 -4
- data/ext/sources/ggml/src/ggml-hip/CMakeLists.txt +5 -0
- data/ext/sources/ggml/src/ggml-metal/ggml-metal-device.cpp +69 -5
- data/ext/sources/ggml/src/ggml-metal/ggml-metal-device.h +4 -1
- data/ext/sources/ggml/src/ggml-metal/ggml-metal-device.m +27 -6
- data/ext/sources/ggml/src/ggml-metal/ggml-metal-impl.h +38 -0
- data/ext/sources/ggml/src/ggml-metal/ggml-metal-ops.cpp +132 -2
- data/ext/sources/ggml/src/ggml-metal/ggml-metal-ops.h +2 -0
- data/ext/sources/ggml/src/ggml-metal/ggml-metal.metal +345 -87
- data/ext/sources/ggml/src/ggml-opencl/CMakeLists.txt +13 -0
- data/ext/sources/ggml/src/ggml-opencl/fa_tune.h +92 -0
- data/ext/sources/ggml/src/ggml-opencl/ggml-opencl.cpp +4060 -357
- data/ext/sources/ggml/src/ggml-opencl/kernels/cvt.cl +198 -0
- data/ext/sources/ggml/src/ggml-opencl/kernels/flash_attn_f16.cl +81 -41
- data/ext/sources/ggml/src/ggml-opencl/kernels/flash_attn_f32.cl +88 -39
- data/ext/sources/ggml/src/ggml-opencl/kernels/flash_attn_f32_f16.cl +1995 -96
- data/ext/sources/ggml/src/ggml-opencl/kernels/flash_attn_f32_q4_0.cl +1615 -0
- data/ext/sources/ggml/src/ggml-opencl/kernels/flash_attn_f32_q8_0.cl +1486 -0
- data/ext/sources/ggml/src/ggml-opencl/kernels/flash_attn_pre_f16.cl +156 -0
- data/ext/sources/ggml/src/ggml-opencl/kernels/gemm_moe_mxfp4_f32_ns.cl +74 -6
- data/ext/sources/ggml/src/ggml-opencl/kernels/gemm_moe_q4_0_f32_ns.cl +74 -6
- data/ext/sources/ggml/src/ggml-opencl/kernels/gemm_moe_q4_1_f32_ns.cl +74 -6
- data/ext/sources/ggml/src/ggml-opencl/kernels/gemm_moe_q4_k_f32_ns.cl +71 -6
- data/ext/sources/ggml/src/ggml-opencl/kernels/gemm_moe_q5_0_f32_ns.cl +74 -6
- data/ext/sources/ggml/src/ggml-opencl/kernels/gemm_moe_q5_1_f32_ns.cl +74 -6
- data/ext/sources/ggml/src/ggml-opencl/kernels/gemm_moe_q5_k_f32_ns.cl +74 -6
- data/ext/sources/ggml/src/ggml-opencl/kernels/gemm_moe_q6_k_f32_ns.cl +74 -6
- data/ext/sources/ggml/src/ggml-opencl/kernels/gemm_noshuffle_q1_0_f32.cl +94 -0
- data/ext/sources/ggml/src/ggml-opencl/kernels/gemv_noshuffle_q1_0_f32.cl +121 -0
- data/ext/sources/ggml/src/ggml-opencl/kernels/gemv_noshuffle_q8_0_f32.cl +1 -1
- data/ext/sources/ggml/src/ggml-opencl/kernels/mul_mm_q1_0_f32_l4_lm.cl +156 -0
- data/ext/sources/ggml/src/ggml-opencl/kernels/mul_mv_f16_f32_l4.cl +1149 -0
- data/ext/sources/ggml/src/ggml-opencl/kernels/mul_mv_q1_0_f32.cl +141 -0
- data/ext/sources/ggml/src/ggml-opencl/kernels/mul_mv_q1_0_f32_flat.cl +190 -0
- data/ext/sources/ggml/src/ggml-opencl/kernels/norm.cl +5 -2
- data/ext/sources/ggml/src/ggml-opencl/kernels/set_rows.cl +500 -0
- data/ext/sources/ggml/src/ggml-opencl/libdl.h +79 -0
- data/ext/sources/ggml/src/ggml-openvino/.clang-format +0 -5
- data/ext/sources/ggml/src/ggml-openvino/CMakeLists.txt +2 -4
- data/ext/sources/ggml/src/ggml-openvino/ggml-decoder.cpp +733 -130
- data/ext/sources/ggml/src/ggml-openvino/ggml-decoder.h +76 -23
- data/ext/sources/ggml/src/ggml-openvino/ggml-openvino-extra.cpp +57 -3
- data/ext/sources/ggml/src/ggml-openvino/ggml-openvino-extra.h +29 -8
- data/ext/sources/ggml/src/ggml-openvino/ggml-openvino.cpp +307 -59
- data/ext/sources/ggml/src/ggml-openvino/ggml-quants.cpp +66 -0
- data/ext/sources/ggml/src/ggml-openvino/ggml-quants.h +10 -4
- data/ext/sources/ggml/src/ggml-openvino/openvino/decoder.h +56 -16
- data/ext/sources/ggml/src/ggml-openvino/openvino/frontend.h +1 -1
- data/ext/sources/ggml/src/ggml-openvino/openvino/input_model.h +4 -4
- data/ext/sources/ggml/src/ggml-openvino/openvino/node_context.h +94 -37
- data/ext/sources/ggml/src/ggml-openvino/openvino/op/add_id.cpp +76 -0
- data/ext/sources/ggml/src/ggml-openvino/openvino/op/argsort.cpp +47 -0
- data/ext/sources/ggml/src/ggml-openvino/openvino/op/clamp.cpp +33 -0
- data/ext/sources/ggml/src/ggml-openvino/openvino/op/concat.cpp +48 -0
- data/ext/sources/ggml/src/ggml-openvino/openvino/op/cont.cpp +8 -16
- data/ext/sources/ggml/src/ggml-openvino/openvino/op/cpy.cpp +14 -1
- data/ext/sources/ggml/src/ggml-openvino/openvino/op/div.cpp +146 -0
- data/ext/sources/ggml/src/ggml-openvino/openvino/op/flash_attn_ext.cpp +108 -21
- data/ext/sources/ggml/src/ggml-openvino/openvino/op/gated_delta_net.cpp +282 -0
- data/ext/sources/ggml/src/ggml-openvino/openvino/op/gated_delta_net.hpp +65 -0
- data/ext/sources/ggml/src/ggml-openvino/openvino/op/get_rows.cpp +2 -9
- data/ext/sources/ggml/src/ggml-openvino/openvino/op/glu_geglu.cpp +21 -7
- data/ext/sources/ggml/src/ggml-openvino/openvino/op/glu_swiglu.cpp +41 -8
- data/ext/sources/ggml/src/ggml-openvino/openvino/op/im2col.cpp +120 -0
- data/ext/sources/ggml/src/ggml-openvino/openvino/op/l2_norm.cpp +44 -0
- data/ext/sources/ggml/src/ggml-openvino/openvino/op/mul_mat_id.cpp +226 -0
- data/ext/sources/ggml/src/ggml-openvino/openvino/op/mulmat.cpp +19 -9
- data/ext/sources/ggml/src/ggml-openvino/openvino/op/norm.cpp +58 -0
- data/ext/sources/ggml/src/ggml-openvino/openvino/op/pad.cpp +95 -0
- data/ext/sources/ggml/src/ggml-openvino/openvino/op/permute.cpp +58 -13
- data/ext/sources/ggml/src/ggml-openvino/openvino/op/repeat.cpp +74 -0
- data/ext/sources/ggml/src/ggml-openvino/openvino/op/reshape.cpp +13 -6
- data/ext/sources/ggml/src/ggml-openvino/openvino/op/rms_norm.cpp +1 -1
- data/ext/sources/ggml/src/ggml-openvino/openvino/op/rope.cpp +134 -38
- data/ext/sources/ggml/src/ggml-openvino/openvino/op/set_rows.cpp +3 -3
- data/ext/sources/ggml/src/ggml-openvino/openvino/op/softmax.cpp +126 -49
- data/ext/sources/ggml/src/ggml-openvino/openvino/op/ssm_conv.cpp +59 -0
- data/ext/sources/ggml/src/ggml-openvino/openvino/op/sum_rows.cpp +27 -0
- data/ext/sources/ggml/src/ggml-openvino/openvino/op/transpose.cpp +32 -1
- data/ext/sources/ggml/src/ggml-openvino/openvino/op/unary_silu.cpp +1 -1
- data/ext/sources/ggml/src/ggml-openvino/openvino/op/unary_softplus.cpp +38 -0
- data/ext/sources/ggml/src/ggml-openvino/openvino/op/view.cpp +90 -25
- data/ext/sources/ggml/src/ggml-openvino/openvino/op_table.cpp +41 -23
- data/ext/sources/ggml/src/ggml-openvino/openvino/op_table.h +18 -5
- data/ext/sources/ggml/src/ggml-openvino/openvino/pass/mark_decompression_convert_constant_folding.h +1 -1
- data/ext/sources/ggml/src/ggml-openvino/openvino/translate_session.cpp +43 -40
- data/ext/sources/ggml/src/ggml-openvino/openvino/translate_session.h +5 -4
- data/ext/sources/ggml/src/ggml-openvino/openvino/utils.cpp +548 -3
- data/ext/sources/ggml/src/ggml-openvino/openvino/utils.h +28 -26
- data/ext/sources/ggml/src/ggml-openvino/utils.cpp +383 -94
- data/ext/sources/ggml/src/ggml-openvino/utils.h +11 -8
- data/ext/sources/ggml/src/ggml-quants.c +76 -0
- data/ext/sources/ggml/src/ggml-quants.h +3 -0
- data/ext/sources/ggml/src/ggml-sycl/CMakeLists.txt +5 -5
- data/ext/sources/ggml/src/ggml-sycl/backend.hpp +2 -0
- data/ext/sources/ggml/src/ggml-sycl/binbcast.cpp +12 -0
- data/ext/sources/ggml/src/ggml-sycl/col2im-1d.cpp +102 -0
- data/ext/sources/ggml/src/ggml-sycl/col2im-1d.hpp +8 -0
- data/ext/sources/ggml/src/ggml-sycl/common.cpp +6 -8
- data/ext/sources/ggml/src/ggml-sycl/common.hpp +19 -2
- data/ext/sources/ggml/src/ggml-sycl/concat.cpp +21 -1
- data/ext/sources/ggml/src/ggml-sycl/conv2d-dw.cpp +158 -0
- data/ext/sources/ggml/src/ggml-sycl/conv2d-dw.hpp +10 -0
- data/ext/sources/ggml/src/ggml-sycl/conv2d-transpose.cpp +125 -0
- data/ext/sources/ggml/src/ggml-sycl/conv2d-transpose.hpp +10 -0
- data/ext/sources/ggml/src/ggml-sycl/conv2d.cpp +150 -0
- data/ext/sources/ggml/src/ggml-sycl/conv2d.hpp +10 -0
- data/ext/sources/ggml/src/ggml-sycl/conv3d.cpp +224 -0
- data/ext/sources/ggml/src/ggml-sycl/conv3d.hpp +8 -0
- data/ext/sources/ggml/src/ggml-sycl/convert.cpp +6 -0
- data/ext/sources/ggml/src/ggml-sycl/cpy.cpp +706 -0
- data/ext/sources/ggml/src/ggml-sycl/cpy.hpp +281 -0
- data/ext/sources/ggml/src/ggml-sycl/cross_entropy_loss.cpp +255 -0
- data/ext/sources/ggml/src/ggml-sycl/cross_entropy_loss.hpp +7 -0
- data/ext/sources/ggml/src/ggml-sycl/dequantize.hpp +15 -0
- data/ext/sources/ggml/src/ggml-sycl/dmmv.cpp +492 -319
- data/ext/sources/ggml/src/ggml-sycl/dpct/helper.hpp +15 -7
- data/ext/sources/ggml/src/ggml-sycl/element_wise.cpp +215 -115
- data/ext/sources/ggml/src/ggml-sycl/element_wise.hpp +2 -0
- data/ext/sources/ggml/src/ggml-sycl/ggml-sycl.cpp +1006 -336
- data/ext/sources/ggml/src/ggml-sycl/mmvq.cpp +252 -67
- data/ext/sources/ggml/src/ggml-sycl/mmvq.hpp +17 -0
- data/ext/sources/ggml/src/ggml-sycl/norm.cpp +103 -49
- data/ext/sources/ggml/src/ggml-sycl/outprod.cpp +45 -9
- data/ext/sources/ggml/src/ggml-sycl/pool.cpp +185 -0
- data/ext/sources/ggml/src/ggml-sycl/pool.hpp +22 -0
- data/ext/sources/ggml/src/ggml-sycl/presets.hpp +3 -1
- data/ext/sources/ggml/src/ggml-sycl/set_rows.cpp +10 -2
- data/ext/sources/ggml/src/ggml-sycl/softmax.cpp +9 -10
- data/ext/sources/ggml/src/ggml-sycl/vecdotq.hpp +35 -0
- data/ext/sources/ggml/src/ggml-vulkan/CMakeLists.txt +5 -0
- data/ext/sources/ggml/src/ggml-vulkan/ggml-vulkan.cpp +833 -215
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/col2im_1d.comp +61 -0
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/conv2d_mm.comp +1 -1
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/conv3d_mm.comp +431 -0
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/diag.comp +3 -3
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/flash_attn.comp +1 -0
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/flash_attn_cm1.comp +1 -0
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/generic_unary_head.glsl +21 -19
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/get_rows_back.comp +25 -0
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/glu_head.glsl +23 -4
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/glu_main.glsl +14 -18
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/l2_norm.comp +4 -7
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/mul_mat_vecq.comp +21 -24
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/mul_mm.comp +31 -23
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/mul_mm_cm2.comp +6 -5
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/mul_mm_funcs.glsl +84 -67
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/norm.comp +10 -10
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/repeat_back.comp +3 -3
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/roll.comp +3 -3
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/tri.comp +3 -3
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/unary.comp +168 -0
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/vulkan-shaders-gen.cpp +121 -74
- data/ext/sources/ggml/src/ggml-webgpu/ggml-webgpu-shader-lib.hpp +26 -19
- data/ext/sources/ggml/src/ggml-webgpu/ggml-webgpu.cpp +31 -36
- data/ext/sources/ggml/src/ggml-webgpu/wgsl-shaders/common_decls.tmpl +16 -2
- data/ext/sources/ggml/src/ggml-webgpu/wgsl-shaders/flash_attn_vec_split.wgsl +7 -7
- data/ext/sources/ggml/src/ggml-webgpu/wgsl-shaders/get_rows.wgsl +21 -0
- data/ext/sources/ggml/src/ggml-webgpu/wgsl-shaders/mul_mat_decls.tmpl +439 -320
- data/ext/sources/ggml/src/ggml-webgpu/wgsl-shaders/mul_mat_id_vec.wgsl +2 -2
- data/ext/sources/ggml/src/ggml-webgpu/wgsl-shaders/mul_mat_vec.wgsl +45 -39
- data/ext/sources/ggml/src/ggml-webgpu/wgsl-shaders/mul_mat_vec_acc.tmpl +586 -465
- data/ext/sources/ggml/src/ggml-webgpu/wgsl-shaders/mul_mat_vec_q_acc.tmpl +63 -69
- data/ext/sources/ggml/src/ggml-webgpu/wgsl-shaders/quantize_q8.wgsl +14 -9
- data/ext/sources/ggml/src/ggml.c +36 -14
- data/ext/sources/include/whisper.h +21 -0
- data/ext/sources/src/whisper.cpp +164 -14
- data/lib/whisper/log_settable.rb +5 -8
- data/lib/whisper/model/uri.rb +0 -7
- data/sig/whisper.rbs +6 -0
- data/test/test_vad.rb +9 -0
- data/test/test_vad_context.rb +2 -2
- data/whispercpp.gemspec +1 -1
- metadata +62 -37
- data/ext/sources/ggml/src/ggml-hexagon/htp/hmx-flash-attn-ops.c +0 -1878
- data/ext/sources/ggml/src/ggml-hexagon/htp/hmx-matmul-ops.c +0 -2066
- data/ext/sources/ggml/src/ggml-hexagon/htp/hmx-ops.c +0 -6
- data/ext/sources/ggml/src/ggml-hexagon/htp/hmx-ops.h +0 -88
- data/ext/sources/ggml/src/ggml-hexagon/htp/hmx-profile.h +0 -34
- data/ext/sources/ggml/src/ggml-hexagon/htp/vtcm-utils.h +0 -16
- data/ext/sources/ggml/src/ggml-openvino/openvino/op/unary_gelu.cpp +0 -25
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/abs.comp +0 -21
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/ceil.comp +0 -22
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/clamp.comp +0 -17
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/cos.comp +0 -17
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/elu.comp +0 -27
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/exp.comp +0 -20
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/floor.comp +0 -22
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/gelu.comp +0 -25
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/gelu_erf.comp +0 -39
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/gelu_quick.comp +0 -23
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/hardsigmoid.comp +0 -22
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/hardswish.comp +0 -22
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/leaky_relu.comp +0 -22
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/neg.comp +0 -20
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/relu.comp +0 -21
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/round.comp +0 -29
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/sgn.comp +0 -21
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/sigmoid.comp +0 -20
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/silu.comp +0 -22
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/sin.comp +0 -17
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/softplus.comp +0 -23
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/sqrt.comp +0 -17
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/square.comp +0 -17
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/step.comp +0 -22
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/tanh.comp +0 -20
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/trunc.comp +0 -22
- data/ext/sources/ggml/src/ggml-vulkan/vulkan-shaders/xielu.comp +0 -35
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
#include "hvx-base.h"
|
|
5
5
|
#include "hvx-inverse.h"
|
|
6
|
+
#include "hvx-exp.h"
|
|
6
7
|
|
|
7
8
|
#define FAST_SIGMOID_LOG2F (0x3fb8aa3b) // 1.442695022
|
|
8
9
|
#define FAST_SIGMOID_C1 (0x3d009076) // 0.03138777
|
|
@@ -139,4 +140,42 @@ static inline void hvx_tanh_f32_aa(uint8_t * restrict dst, const uint8_t * restr
|
|
|
139
140
|
hvx_tanh_loop_body(HVX_Vector, HVX_Vector, hvx_vec_store_a);
|
|
140
141
|
}
|
|
141
142
|
|
|
143
|
+
static inline HVX_Vector hvx_vec_fast_sigmoid_f16(HVX_Vector x_v) {
|
|
144
|
+
const HVX_Vector v_one = hvx_vec_splat_f16(1.0f);
|
|
145
|
+
const HVX_Vector v_neg_log2e = hvx_vec_splat_f16(-EXP_LOG2E_F);
|
|
146
|
+
const HVX_Vector em_mask = Q6_Vh_vsplat_R(0x7FFF);
|
|
147
|
+
|
|
148
|
+
// Compute absolute value of x_v
|
|
149
|
+
HVX_Vector abs_x = Q6_V_vand_VV(x_v, em_mask);
|
|
150
|
+
|
|
151
|
+
// Compute u = -abs_x * log2(e) <= 0.
|
|
152
|
+
HVX_Vector u = hvx_vec_mul_f16_f16(abs_x, v_neg_log2e);
|
|
153
|
+
|
|
154
|
+
// Clamp input to prevent underflow in exp2
|
|
155
|
+
const HVX_Vector v_clamp_min = hvx_vec_splat_f16(-24.0f);
|
|
156
|
+
u = Q6_Vhf_vmax_VhfVhf(v_clamp_min, u);
|
|
157
|
+
|
|
158
|
+
HVX_Vector exp_val = hvx_vec_exp2_f16(u);
|
|
159
|
+
HVX_Vector denom = hvx_vec_add_f16_f16(v_one, exp_val);
|
|
160
|
+
HVX_Vector sig_abs = hvx_vec_inverse_f16(denom);
|
|
161
|
+
|
|
162
|
+
// check if x_v < 0 (using integer comparison on absolute value)
|
|
163
|
+
HVX_VectorPred is_neg = Q6_Q_vcmp_gt_VhVh(abs_x, x_v);
|
|
164
|
+
|
|
165
|
+
// If x_v < 0, return 1.0f - sig_abs
|
|
166
|
+
HVX_Vector sig_neg = Q6_Vhf_equals_Vqf16(Q6_Vqf16_vsub_VhfVhf(v_one, sig_abs));
|
|
167
|
+
return Q6_V_vmux_QVV(is_neg, sig_neg, sig_abs);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
static inline HVX_Vector hvx_vec_tanh_f16(HVX_Vector x) {
|
|
171
|
+
// tanh(x) = 2 * sigmoid(2x) - 1
|
|
172
|
+
const HVX_Vector v_two = hvx_vec_splat_f16(2.0f);
|
|
173
|
+
|
|
174
|
+
HVX_Vector x2 = hvx_vec_mul_f16_f16(x, v_two);
|
|
175
|
+
HVX_Vector sig2x = hvx_vec_fast_sigmoid_f16(x2);
|
|
176
|
+
|
|
177
|
+
const HVX_Vector v_neg_one = hvx_vec_splat_f16(-1.0f);
|
|
178
|
+
return hvx_vec_add_f16_f16(hvx_vec_mul_f16_f16(sig2x, v_two), v_neg_one);
|
|
179
|
+
}
|
|
180
|
+
|
|
142
181
|
#endif /* HVX_SIGMOID_H */
|
|
@@ -361,7 +361,7 @@ static void vtcm_free(struct htp_context * ctx) {
|
|
|
361
361
|
static void htp_packet_callback(dspqueue_t queue, int error, void * context);
|
|
362
362
|
static void htp_error_callback(dspqueue_t queue, int error, void * context);
|
|
363
363
|
|
|
364
|
-
AEEResult htp_iface_start(remote_handle64 handle,
|
|
364
|
+
AEEResult htp_iface_start(remote_handle64 handle, uint32_t sess_id, uint64_t dsp_queue_id, uint32_t n_hvx, uint32_t n_hmx, uint64_t max_vmem) {
|
|
365
365
|
struct htp_context * ctx = (struct htp_context *) handle;
|
|
366
366
|
|
|
367
367
|
if (!ctx) {
|
|
@@ -395,18 +395,18 @@ AEEResult htp_iface_start(remote_handle64 handle, uint32 sess_id, uint64 dsp_que
|
|
|
395
395
|
return AEE_ENOMEMORY;
|
|
396
396
|
}
|
|
397
397
|
|
|
398
|
-
|
|
399
|
-
ctx->hmx_enabled = use_hmx;
|
|
398
|
+
ctx->hmx_enabled = n_hmx;
|
|
400
399
|
ctx->hmx_queue = NULL;
|
|
401
|
-
if (
|
|
400
|
+
if (n_hmx) {
|
|
402
401
|
ctx->hmx_queue = hmx_queue_create(16, ctx->vtcm_rctx);
|
|
403
|
-
if (
|
|
402
|
+
if (ctx->hmx_queue) {
|
|
403
|
+
ctx->hmx_queue->trace = &ctx->trace[HTP_MAX_NTHREADS];
|
|
404
|
+
} else {
|
|
404
405
|
FARF(ERROR, "hmx-queue-create failed");
|
|
405
406
|
ctx->hmx_enabled = false;
|
|
406
407
|
}
|
|
407
408
|
}
|
|
408
|
-
FARF(HIGH, "HMX %s (
|
|
409
|
-
#endif
|
|
409
|
+
FARF(HIGH, "HMX %s (n_hmx=%d)", ctx->hmx_enabled ? "enabled" : "disabled", n_hmx);
|
|
410
410
|
|
|
411
411
|
qurt_sysenv_max_hthreads_t hw_threads;
|
|
412
412
|
qurt_sysenv_get_max_hw_threads(&hw_threads);
|
|
@@ -425,6 +425,9 @@ AEEResult htp_iface_start(remote_handle64 handle, uint32 sess_id, uint64 dsp_que
|
|
|
425
425
|
ctx->n_threads = n_hvx;
|
|
426
426
|
for (int i = 0; i < ctx->n_threads; i++) {
|
|
427
427
|
ctx->dma[i] = dma_queue_create(256); // queue depth
|
|
428
|
+
if (ctx->dma[i]) {
|
|
429
|
+
ctx->dma[i]->trace = &ctx->trace[i];
|
|
430
|
+
}
|
|
428
431
|
}
|
|
429
432
|
|
|
430
433
|
ctx->ddr_spad_size = 512 * 1024; // 512 KB
|
|
@@ -476,13 +479,11 @@ AEEResult htp_iface_stop(remote_handle64 handle) {
|
|
|
476
479
|
dma_queue_delete(ctx->dma[i]);
|
|
477
480
|
}
|
|
478
481
|
|
|
479
|
-
#ifdef HTP_HAS_HMX
|
|
480
482
|
if (ctx->hmx_queue) {
|
|
481
483
|
hmx_queue_delete(ctx->hmx_queue);
|
|
482
484
|
ctx->hmx_queue = NULL;
|
|
483
485
|
}
|
|
484
486
|
ctx->hmx_enabled = false;
|
|
485
|
-
#endif
|
|
486
487
|
|
|
487
488
|
vtcm_free(ctx);
|
|
488
489
|
|
|
@@ -495,6 +496,36 @@ AEEResult htp_iface_stop(remote_handle64 handle) {
|
|
|
495
496
|
return AEE_SUCCESS;
|
|
496
497
|
}
|
|
497
498
|
|
|
499
|
+
AEEResult htp_iface_hwinfo(remote_handle64 handle, uint32_t * n_threads, uint32_t * n_hvx, uint32_t * n_hmx, uint64_t * vtcm_size) {
|
|
500
|
+
(void)handle;
|
|
501
|
+
if (!n_threads || !n_hvx || !n_hmx || !vtcm_size) {
|
|
502
|
+
return AEE_EBADPARM;
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
qurt_sysenv_max_hthreads_t hw_threads;
|
|
506
|
+
qurt_sysenv_get_max_hw_threads(&hw_threads);
|
|
507
|
+
uint32_t hw_nhvx = (qurt_hvx_get_units() >> 8) & 0xFF;
|
|
508
|
+
|
|
509
|
+
uint32_t n_hvx_val = hw_nhvx;
|
|
510
|
+
if (n_hvx_val > hw_threads.max_hthreads) {
|
|
511
|
+
n_hvx_val = hw_threads.max_hthreads;
|
|
512
|
+
}
|
|
513
|
+
if (n_hvx_val > HTP_MAX_NTHREADS) {
|
|
514
|
+
n_hvx_val = HTP_MAX_NTHREADS;
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
// for now we force n_threads == n_hvx
|
|
518
|
+
*n_threads = n_hvx_val;
|
|
519
|
+
*n_hvx = n_hvx_val;
|
|
520
|
+
*n_hmx = 1;
|
|
521
|
+
|
|
522
|
+
uint32_t vtcm_sz = 8 * 1024 * 1024; // 8MB default fallback
|
|
523
|
+
HAP_compute_res_query_VTCM(0, (unsigned int *)&vtcm_sz, NULL, NULL, NULL);
|
|
524
|
+
*vtcm_size = vtcm_sz;
|
|
525
|
+
|
|
526
|
+
return AEE_SUCCESS;
|
|
527
|
+
}
|
|
528
|
+
|
|
498
529
|
static void htp_error_callback(dspqueue_t queue, int error, void * context) {
|
|
499
530
|
// No errors expected on the DSP.
|
|
500
531
|
FARF(ERROR, "Error callback: 0x%08x", (unsigned) error);
|
|
@@ -502,7 +533,8 @@ static void htp_error_callback(dspqueue_t queue, int error, void * context) {
|
|
|
502
533
|
|
|
503
534
|
struct profile_data {
|
|
504
535
|
uint64_t usecs;
|
|
505
|
-
uint64_t
|
|
536
|
+
uint64_t cycles_start;
|
|
537
|
+
uint64_t cycles_stop;
|
|
506
538
|
uint32_t pmu_counters[HEX_NUM_PMU_COUNTERS];
|
|
507
539
|
};
|
|
508
540
|
|
|
@@ -512,8 +544,9 @@ static inline void profile_start(uint32_t mode, struct profile_data * d) {
|
|
|
512
544
|
hex_get_pmu(d->pmu_counters);
|
|
513
545
|
// fallthrough
|
|
514
546
|
case HTP_PROF_BASIC:
|
|
547
|
+
case HTP_PROF_TRACE:
|
|
515
548
|
d->usecs = HAP_perf_get_qtimer_count();
|
|
516
|
-
d->
|
|
549
|
+
d->cycles_start = hex_get_cycles();
|
|
517
550
|
break;
|
|
518
551
|
default:
|
|
519
552
|
break;
|
|
@@ -530,8 +563,9 @@ static inline void profile_stop(uint32_t mode, struct profile_data * d) {
|
|
|
530
563
|
}
|
|
531
564
|
// fallthrough
|
|
532
565
|
case HTP_PROF_BASIC:
|
|
566
|
+
case HTP_PROF_TRACE:
|
|
533
567
|
d->usecs = HAP_perf_qtimer_count_to_us(HAP_perf_get_qtimer_count() - d->usecs);
|
|
534
|
-
d->
|
|
568
|
+
d->cycles_stop = hex_get_cycles();
|
|
535
569
|
break;
|
|
536
570
|
default:
|
|
537
571
|
break;
|
|
@@ -541,11 +575,18 @@ static inline void profile_stop(uint32_t mode, struct profile_data * d) {
|
|
|
541
575
|
static int execute_op(struct htp_ops_context * octx) {
|
|
542
576
|
switch (octx->op) {
|
|
543
577
|
case HTP_OP_MUL_MAT:
|
|
578
|
+
case HTP_OP_MUL_MAT_ADD:
|
|
544
579
|
return op_matmul(octx);
|
|
545
580
|
|
|
546
581
|
case HTP_OP_MUL_MAT_ID:
|
|
547
582
|
return op_matmul_id(octx);
|
|
548
583
|
|
|
584
|
+
case HTP_OP_MUL_MAT_QKV:
|
|
585
|
+
return op_matmul_qkv(octx);
|
|
586
|
+
|
|
587
|
+
case HTP_OP_MUL_MAT_FFN:
|
|
588
|
+
return op_matmul_ffn(octx);
|
|
589
|
+
|
|
549
590
|
case HTP_OP_MUL:
|
|
550
591
|
case HTP_OP_ADD:
|
|
551
592
|
case HTP_OP_SUB:
|
|
@@ -754,8 +795,9 @@ static void prep_tensors(struct htp_context *ctx, struct htp_buf_desc *bufs, str
|
|
|
754
795
|
}
|
|
755
796
|
}
|
|
756
797
|
|
|
757
|
-
static
|
|
798
|
+
static int proc_op_req(struct htp_ops_context * octx, struct htp_tensor *tens, uint32_t idx, struct htp_op_desc * op) {
|
|
758
799
|
memcpy(octx->op_params, op->params, sizeof(octx->op_params));
|
|
800
|
+
memcpy(octx->kernel_params, op->kernel_params, sizeof(octx->kernel_params));
|
|
759
801
|
octx->flags = op->flags;
|
|
760
802
|
octx->op = op->opcode;
|
|
761
803
|
|
|
@@ -777,22 +819,41 @@ static void proc_op_req(struct htp_ops_context * octx, struct htp_tensor *tens,
|
|
|
777
819
|
src->ne[0], src->ne[1], src->ne[3], src->ne[3]);
|
|
778
820
|
}
|
|
779
821
|
|
|
780
|
-
// Prep output
|
|
781
|
-
|
|
822
|
+
// Prep output tensors
|
|
823
|
+
for (uint32_t i = 0; i < HTP_OP_MAX_OUTPUTS; i++) {
|
|
824
|
+
uint16_t dst_idx = op->dst[i];
|
|
825
|
+
if (dst_idx == 0xffff) {
|
|
826
|
+
octx->dsts[i] = NULL;
|
|
827
|
+
continue;
|
|
828
|
+
}
|
|
829
|
+
struct htp_tensor *dst = tens + dst_idx;
|
|
830
|
+
octx->dsts[i] = dst;
|
|
782
831
|
|
|
783
|
-
|
|
832
|
+
FARF(HIGH, "prep-dst[%u] #%u: data %p size %u : %u:%u:%u:%u", i, dst_idx, (void*) dst->data, dst->size,
|
|
833
|
+
dst->ne[0], dst->ne[1], dst->ne[2], dst->ne[3]);
|
|
834
|
+
}
|
|
784
835
|
|
|
785
|
-
|
|
786
|
-
dst->ne[0], dst->ne[1], dst->ne[3], dst->ne[3]);
|
|
836
|
+
int status = execute_op(octx);
|
|
787
837
|
|
|
788
|
-
|
|
838
|
+
octx->src0_spad.src = NULL;
|
|
839
|
+
octx->src1_spad.src = NULL;
|
|
840
|
+
octx->src2_spad.src = NULL;
|
|
841
|
+
octx->src3_spad.src = NULL;
|
|
842
|
+
octx->dst_spad.src = NULL;
|
|
789
843
|
|
|
790
844
|
// flush buffers on output
|
|
791
|
-
|
|
792
|
-
|
|
845
|
+
for (uint32_t i = 0; i < HTP_OP_MAX_OUTPUTS; i++) {
|
|
846
|
+
if (octx->dsts[i]) {
|
|
847
|
+
struct htp_tensor *dst = (struct htp_tensor *)octx->dsts[i];
|
|
848
|
+
hex_l2flush((void *) dst->data, dst->size);
|
|
849
|
+
dst->flags |= HTP_TENSOR_FLUSHED;
|
|
850
|
+
|
|
851
|
+
FARF(HIGH, "post-dst[%u] #%u: data %p size %u : %u:%u:%u:%u", i, op->dst[i], (void*) dst->data, dst->size,
|
|
852
|
+
dst->ne[0], dst->ne[1], dst->ne[2], dst->ne[3]);
|
|
853
|
+
}
|
|
854
|
+
}
|
|
793
855
|
|
|
794
|
-
|
|
795
|
-
dst->ne[0], dst->ne[1], dst->ne[3], dst->ne[3]);
|
|
856
|
+
return status;
|
|
796
857
|
}
|
|
797
858
|
|
|
798
859
|
#define DSPQUEUE_POLL_TIMEOUT_USEC 100
|
|
@@ -845,14 +906,15 @@ static void htp_packet_callback(dspqueue_t queue, int error, void * context) {
|
|
|
845
906
|
const uint32_t t_size = sizeof(struct htp_tensor) * n_tens;
|
|
846
907
|
const uint32_t o_size = sizeof(struct htp_op_desc) * n_ops;
|
|
847
908
|
const uint32_t p_size = sizeof(struct htp_prof_desc) * n_ops;
|
|
909
|
+
const uint32_t tr_size = (HTP_MAX_NTHREADS + 1) * req.n_traces * sizeof(struct htp_trace_desc);
|
|
848
910
|
|
|
849
|
-
if (dbuf.size < b_size + t_size + o_size + p_size) {
|
|
850
|
-
FARF(ERROR, "invalid opbatch memory block size %u", dbuf.size);
|
|
911
|
+
if (dbuf.size < b_size + t_size + o_size + p_size + tr_size) {
|
|
912
|
+
FARF(ERROR, "invalid opbatch memory block size %u (req %u)", dbuf.size, b_size + t_size + o_size + p_size + tr_size);
|
|
851
913
|
break;
|
|
852
914
|
}
|
|
853
915
|
|
|
854
|
-
FARF(HIGH, "processing opbatch #%u: n-bufs %u n-tensors %u n-ops %u : m-size %u b-size %u t-size %u o-size %u", req.id,
|
|
855
|
-
n_bufs, n_tens, n_ops, dbuf.size, b_size, t_size, o_size);
|
|
916
|
+
FARF(HIGH, "processing opbatch #%u: n-bufs %u n-tensors %u n-ops %u n-traces %u : m-size %u b-size %u t-size %u o-size %u", req.id,
|
|
917
|
+
n_bufs, n_tens, n_ops, req.n_traces, dbuf.size, b_size, t_size, o_size);
|
|
856
918
|
|
|
857
919
|
// Setup descriptor pointers
|
|
858
920
|
uint8_t * m_ptr = dbuf.ptr;
|
|
@@ -869,36 +931,69 @@ static void htp_packet_callback(dspqueue_t queue, int error, void * context) {
|
|
|
869
931
|
octx->n_threads = ctx->n_threads;
|
|
870
932
|
octx->ctx = ctx;
|
|
871
933
|
|
|
934
|
+
if (ctx->profiler == HTP_PROF_TRACE) {
|
|
935
|
+
memset(ctx->trace, 0, sizeof(ctx->trace));
|
|
936
|
+
struct htp_trace_desc * trace_events = (struct htp_trace_desc *) (m_ptr + p_size);
|
|
937
|
+
for (int t = 0; t <= HTP_MAX_NTHREADS; t++) {
|
|
938
|
+
ctx->trace[t].events = &trace_events[t * req.n_traces];
|
|
939
|
+
ctx->trace[t].max_events = req.n_traces;
|
|
940
|
+
}
|
|
941
|
+
} else {
|
|
942
|
+
for (int t = 0; t <= HTP_MAX_NTHREADS; t++) {
|
|
943
|
+
ctx->trace[t].events = NULL;
|
|
944
|
+
ctx->trace[t].max_events = 0;
|
|
945
|
+
}
|
|
946
|
+
}
|
|
947
|
+
|
|
948
|
+
int op_status = HTP_STATUS_OK;
|
|
949
|
+
uint32_t op_wakeup = n_ops / 2; // half-way throgh the batch
|
|
950
|
+
|
|
951
|
+
hmx_queue_wakeup(ctx->hmx_queue);
|
|
952
|
+
|
|
872
953
|
for (uint32_t i=0; i < n_ops; i++) {
|
|
873
954
|
struct profile_data prof;
|
|
874
955
|
|
|
875
|
-
if (i ==
|
|
876
|
-
// wake up the host before starting the last op
|
|
956
|
+
if (i == op_wakeup) {
|
|
877
957
|
dspqueue_write_early_wakeup_noblock(queue, 0, 0);
|
|
878
958
|
}
|
|
879
959
|
|
|
880
960
|
profile_start(ctx->profiler, &prof);
|
|
881
961
|
|
|
882
|
-
proc_op_req(octx, tens, i, &ops[i]);
|
|
962
|
+
op_status = proc_op_req(octx, tens, i, &ops[i]);
|
|
883
963
|
|
|
884
964
|
profile_stop(ctx->profiler, &prof);
|
|
885
965
|
|
|
966
|
+
if (op_status != HTP_STATUS_OK) {
|
|
967
|
+
break;
|
|
968
|
+
}
|
|
969
|
+
|
|
886
970
|
if (ctx->profiler) {
|
|
887
971
|
pds[i].opcode = ops[i].opcode;
|
|
888
972
|
pds[i].usecs = prof.usecs;
|
|
889
|
-
pds[i].
|
|
973
|
+
pds[i].cycles_start = prof.cycles_start;
|
|
974
|
+
pds[i].cycles_stop = prof.cycles_stop;
|
|
890
975
|
for (int j = 0; j < HEX_NUM_PMU_COUNTERS; j++) {
|
|
891
976
|
pds[i].pmu[j] = prof.pmu_counters[j];
|
|
892
977
|
}
|
|
893
978
|
}
|
|
894
979
|
}
|
|
895
980
|
|
|
981
|
+
hmx_queue_suspend(ctx->hmx_queue);
|
|
982
|
+
|
|
896
983
|
struct htp_opbatch_rsp rsp;
|
|
897
984
|
rsp.id = req.id;
|
|
898
|
-
rsp.status =
|
|
985
|
+
rsp.status = op_status;
|
|
899
986
|
rsp.n_bufs = n_bufs;
|
|
900
987
|
rsp.n_tensors = n_tens;
|
|
901
988
|
rsp.n_ops = n_ops;
|
|
989
|
+
memset(rsp.pad, 0, sizeof(rsp.pad));
|
|
990
|
+
if (ctx->profiler == HTP_PROF_TRACE) {
|
|
991
|
+
for (int t = 0; t <= HTP_MAX_NTHREADS; t++) {
|
|
992
|
+
rsp.n_traces[t] = ctx->trace[t].count;
|
|
993
|
+
}
|
|
994
|
+
} else {
|
|
995
|
+
memset(rsp.n_traces, 0, sizeof(rsp.n_traces));
|
|
996
|
+
}
|
|
902
997
|
|
|
903
998
|
dbuf.flags = DSPQUEUE_BUFFER_FLAG_FLUSH_SENDER | DSPQUEUE_BUFFER_FLAG_INVALIDATE_RECIPIENT;
|
|
904
999
|
|