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
|
@@ -9,9 +9,12 @@
|
|
|
9
9
|
#define SYCL_LOCAL_ID_CALC(ITEM, IDX) \
|
|
10
10
|
(ITEM.get_local_range(IDX) * ITEM.get_group(IDX) + ITEM.get_local_id(IDX))
|
|
11
11
|
|
|
12
|
-
static void acc_f32(const
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
static void acc_f32(const char * x, const char * y, float * dst, const int64_t ne,
|
|
13
|
+
const int64_t ne0, const int64_t ne1, const int64_t ne2, const int64_t ne3,
|
|
14
|
+
const int64_t nb00, const int64_t nb01, const int64_t nb02, const int64_t nb03,
|
|
15
|
+
const int64_t ne10, const int64_t ne11, const int64_t ne12, const int64_t ne13,
|
|
16
|
+
const int64_t nb10, const int64_t nb11, const int64_t nb12, const int64_t nb13,
|
|
17
|
+
const int64_t s11, const int64_t s12, const int64_t s13, const int64_t offset) {
|
|
15
18
|
auto item_ct1 = sycl::ext::oneapi::this_work_item::get_nd_item<3>();
|
|
16
19
|
const int64_t i = SYCL_LOCAL_ID_CALC(item_ct1, 2);
|
|
17
20
|
|
|
@@ -30,9 +33,18 @@ static void acc_f32(const float * x, const float * y, float * dst, const int64_t
|
|
|
30
33
|
tmp -= i11 * s11;
|
|
31
34
|
const int64_t i10 = tmp;
|
|
32
35
|
|
|
33
|
-
|
|
36
|
+
int64_t tmp_dst = i;
|
|
37
|
+
const int64_t i3 = tmp_dst / (ne2*ne1*ne0);
|
|
38
|
+
tmp_dst -= i3 * (ne2*ne1*ne0);
|
|
39
|
+
const int64_t i2 = tmp_dst / (ne1*ne0);
|
|
40
|
+
tmp_dst -= i2 * (ne1*ne0);
|
|
41
|
+
const int64_t i1 = tmp_dst / ne0;
|
|
42
|
+
tmp_dst -= i1 * ne0;
|
|
43
|
+
const int64_t i0 = tmp_dst;
|
|
44
|
+
|
|
45
|
+
float val = *(const float *) (x + i0*nb00 + i1*nb01 + i2*nb02 + i3*nb03);
|
|
34
46
|
if (src1_idx >= 0 && i10 < ne10 && i11 < ne11 && i12 < ne12 && i13 < ne13) {
|
|
35
|
-
val +=
|
|
47
|
+
val += *(const float *) (y + i10*nb10 + i11*nb11 + i12*nb12 + i13*nb13);
|
|
36
48
|
}
|
|
37
49
|
dst[i] = val;
|
|
38
50
|
}
|
|
@@ -43,14 +55,44 @@ static __dpct_inline__ T op_sgn(T x) {
|
|
|
43
55
|
return x > static_cast<T>(0.f) ? static_cast<T>(1.f) : ((x < static_cast<T>(0.f) ? static_cast<T>(-1.f) : static_cast<T>(0.f)));
|
|
44
56
|
}
|
|
45
57
|
|
|
58
|
+
|
|
46
59
|
template<typename T>
|
|
47
60
|
static __dpct_inline__ T op_abs(T x) {
|
|
48
|
-
|
|
61
|
+
if constexpr (std::is_same_v<T, sycl::ext::oneapi::bfloat16>) {
|
|
62
|
+
return sycl::ext::oneapi::experimental::fabs(x); // or experimental namespace if needed
|
|
63
|
+
} else {
|
|
64
|
+
return sycl::fabs(x);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
template<typename T>
|
|
69
|
+
static __dpct_inline__ T op_expm1(T x) {
|
|
70
|
+
if constexpr (std::is_same_v<T, sycl::ext::oneapi::bfloat16>) {
|
|
71
|
+
return static_cast<sycl::ext::oneapi::bfloat16>(
|
|
72
|
+
sycl::expm1(static_cast<float>(x))
|
|
73
|
+
);
|
|
74
|
+
} else {
|
|
75
|
+
return sycl::expm1(x);
|
|
76
|
+
}
|
|
49
77
|
}
|
|
50
78
|
|
|
51
79
|
template<typename T>
|
|
52
80
|
static __dpct_inline__ T op_elu(T x) {
|
|
53
|
-
return (x > static_cast<T>(0.f)) ? x :
|
|
81
|
+
return (x > static_cast<T>(0.f)) ? x : op_expm1(x);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
template<typename T>
|
|
85
|
+
static __dpct_inline__ T op_tanh(T x) {
|
|
86
|
+
if constexpr (std::is_same_v<T, sycl::ext::oneapi::bfloat16>) {
|
|
87
|
+
constexpr int ver = __INTEL_LLVM_COMPILER;
|
|
88
|
+
#if defined(__INTEL_LLVM_COMPILER) && (__INTEL_LLVM_COMPILER >= 20260000)
|
|
89
|
+
return sycl::ext::oneapi::experimental::tanh(x);
|
|
90
|
+
#else
|
|
91
|
+
return static_cast<T>(sycl::tanh(static_cast<float>(x)));
|
|
92
|
+
#endif
|
|
93
|
+
} else {
|
|
94
|
+
return sycl::tanh(x);
|
|
95
|
+
}
|
|
54
96
|
}
|
|
55
97
|
|
|
56
98
|
template<typename T>
|
|
@@ -59,69 +101,106 @@ static __dpct_inline__ T op_gelu(T x) {
|
|
|
59
101
|
const T SQRT_2_OVER_PI = static_cast<T>(0.79788456080286535587989211986876f);
|
|
60
102
|
return static_cast<T>(0.5f) * x *
|
|
61
103
|
(static_cast<T>(1.0f) +
|
|
62
|
-
|
|
104
|
+
op_tanh(SQRT_2_OVER_PI * x * (static_cast<T>(1.0f) + GELU_COEF_A * x * x)));
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
template<typename T>
|
|
108
|
+
static __dpct_inline__ T op_exp(T x) {
|
|
109
|
+
if constexpr (std::is_same_v<T, sycl::ext::oneapi::bfloat16>) {
|
|
110
|
+
return sycl::ext::oneapi::experimental::exp(x);
|
|
111
|
+
} else {
|
|
112
|
+
return sycl::exp(x);
|
|
113
|
+
}
|
|
63
114
|
}
|
|
64
115
|
|
|
65
116
|
template<typename T>
|
|
66
117
|
static __dpct_inline__ T op_silu(T x) {
|
|
67
|
-
return x / (static_cast<T>(1.0f) +
|
|
118
|
+
return x / (static_cast<T>(1.0f) + op_exp(-x));
|
|
68
119
|
}
|
|
69
120
|
|
|
70
121
|
template<typename T>
|
|
71
|
-
static __dpct_inline__ T
|
|
72
|
-
|
|
73
|
-
|
|
122
|
+
static __dpct_inline__ T op_erf(T x) {
|
|
123
|
+
if constexpr (std::is_same_v<T, sycl::ext::oneapi::bfloat16>) {
|
|
124
|
+
return static_cast<sycl::ext::oneapi::bfloat16>(
|
|
125
|
+
sycl::erf(static_cast<float>(x))
|
|
126
|
+
);
|
|
127
|
+
} else {
|
|
128
|
+
return sycl::erf(x);
|
|
129
|
+
}
|
|
74
130
|
}
|
|
75
131
|
|
|
76
132
|
template<typename T>
|
|
77
133
|
static __dpct_inline__ T op_gelu_erf(T x) {
|
|
78
134
|
const T SQRT_2_INV = static_cast<T>(0.70710678118654752440084436210484f);
|
|
79
|
-
return static_cast<T>(0.5f) * x * (static_cast<T>(1.0f) +
|
|
135
|
+
return static_cast<T>(0.5f) * x * (static_cast<T>(1.0f) + op_erf(x * SQRT_2_INV));
|
|
80
136
|
}
|
|
81
137
|
|
|
82
138
|
template<typename T>
|
|
83
|
-
static __dpct_inline__ T
|
|
84
|
-
|
|
139
|
+
static __dpct_inline__ T op_gelu_quick(T x) {
|
|
140
|
+
const T GELU_QUICK_COEF_LOCAL = static_cast<T>(-1.702f);
|
|
141
|
+
return x * (static_cast<T>(1.0f) / (static_cast<T>(1.0f) + op_exp(GELU_QUICK_COEF_LOCAL * x)));
|
|
85
142
|
}
|
|
86
143
|
|
|
87
144
|
template<typename T>
|
|
88
145
|
static __dpct_inline__ T op_relu(T x) {
|
|
89
|
-
|
|
146
|
+
if constexpr (std::is_same_v<T, sycl::ext::oneapi::bfloat16>) {
|
|
147
|
+
return sycl::ext::oneapi::experimental::fmax(x, static_cast<T>(0));
|
|
148
|
+
} else {
|
|
149
|
+
return sycl::fmax(x, static_cast<T>(0));
|
|
150
|
+
}
|
|
90
151
|
}
|
|
91
152
|
|
|
92
153
|
template<typename T>
|
|
93
154
|
static __dpct_inline__ T op_sigmoid(T x) {
|
|
94
|
-
return static_cast<T>(1.0f) / (static_cast<T>(1.0f) +
|
|
155
|
+
return static_cast<T>(1.0f) / (static_cast<T>(1.0f) + op_exp(-x));
|
|
95
156
|
}
|
|
96
157
|
|
|
97
158
|
template<typename T>
|
|
98
159
|
static __dpct_inline__ T op_sqrt(T x) {
|
|
99
|
-
|
|
160
|
+
if constexpr (std::is_same_v<T, sycl::ext::oneapi::bfloat16>) {
|
|
161
|
+
return sycl::ext::oneapi::experimental::sqrt(x);
|
|
162
|
+
} else {
|
|
163
|
+
return sycl::sqrt(x);
|
|
164
|
+
}
|
|
100
165
|
}
|
|
101
166
|
|
|
102
167
|
template<typename T>
|
|
103
168
|
static __dpct_inline__ T op_sin(T x) {
|
|
104
|
-
|
|
169
|
+
if constexpr (std::is_same_v<T, sycl::ext::oneapi::bfloat16>) {
|
|
170
|
+
return sycl::ext::oneapi::experimental::sin(x);
|
|
171
|
+
} else {
|
|
172
|
+
return sycl::sin(x);
|
|
173
|
+
}
|
|
105
174
|
}
|
|
106
175
|
|
|
107
176
|
template<typename T>
|
|
108
177
|
static __dpct_inline__ T op_cos(T x) {
|
|
109
|
-
|
|
178
|
+
if constexpr (std::is_same_v<T, sycl::ext::oneapi::bfloat16>) {
|
|
179
|
+
return sycl::ext::oneapi::experimental::cos(x);
|
|
180
|
+
} else {
|
|
181
|
+
return sycl::cos(x);
|
|
182
|
+
}
|
|
110
183
|
}
|
|
111
184
|
|
|
112
185
|
template<typename T>
|
|
113
186
|
static __dpct_inline__ T op_hardsigmoid(T x) {
|
|
114
|
-
|
|
187
|
+
if constexpr (std::is_same_v<T, sycl::ext::oneapi::bfloat16>) {
|
|
188
|
+
return sycl::ext::oneapi::experimental::fmin(
|
|
189
|
+
static_cast<T>(1.0f), sycl::ext::oneapi::experimental::fmax(
|
|
190
|
+
static_cast<T>(0.0f), (x + static_cast<T>(3.0f)) / static_cast<T>(6.0f)));
|
|
191
|
+
} else {
|
|
192
|
+
return sycl::fmin(static_cast<T>(1.0f),
|
|
193
|
+
sycl::fmax(static_cast<T>(0.0f), (x + static_cast<T>(3.0f)) / static_cast<T>(6.0f)));
|
|
194
|
+
}
|
|
115
195
|
}
|
|
116
196
|
|
|
117
197
|
template<typename T>
|
|
118
198
|
static __dpct_inline__ T op_hardswish(T x) {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
return sycl::exp(x);
|
|
199
|
+
if constexpr (std::is_same_v<T, sycl::ext::oneapi::bfloat16>) {
|
|
200
|
+
return x * sycl::ext::oneapi::experimental::fmin(static_cast<T>(1.0f), sycl::ext::oneapi::experimental::fmax(static_cast<T>(0.0f), (x + static_cast<T>(3.0f)) / static_cast<T>(6.0f)));
|
|
201
|
+
} else {
|
|
202
|
+
return x * sycl::fmin(static_cast<T>(1.0f), sycl::fmax(static_cast<T>(0.0f), (x + static_cast<T>(3.0f)) / static_cast<T>(6.0f)));
|
|
203
|
+
}
|
|
125
204
|
}
|
|
126
205
|
|
|
127
206
|
template<typename T>
|
|
@@ -129,13 +208,17 @@ static __dpct_inline__ T op_log(T x) {
|
|
|
129
208
|
if (x <= static_cast<T>(0)) {
|
|
130
209
|
return neg_infinity<T>();
|
|
131
210
|
}
|
|
132
|
-
|
|
211
|
+
if constexpr (std::is_same_v<T, sycl::ext::oneapi::bfloat16>) {
|
|
212
|
+
return sycl::ext::oneapi::experimental::log(x);
|
|
213
|
+
} else {
|
|
214
|
+
return sycl::log(x);
|
|
215
|
+
}
|
|
133
216
|
}
|
|
134
217
|
|
|
135
218
|
template<typename T>
|
|
136
219
|
static __dpct_inline__ T op_softplus(T x) {
|
|
137
220
|
const float xf = (float) x;
|
|
138
|
-
const float ax =
|
|
221
|
+
const float ax = op_abs(xf);
|
|
139
222
|
const float m = sycl::fmax(xf, 0.0f);
|
|
140
223
|
const float y = m + sycl::log1p(sycl::exp(-ax));
|
|
141
224
|
return (T) y;
|
|
@@ -154,8 +237,14 @@ static __dpct_inline__ T op_step(T x) {
|
|
|
154
237
|
template<typename T>
|
|
155
238
|
static __dpct_inline__ T op_leaky_relu(T x, float negative_slope) {
|
|
156
239
|
T neg_slope_T = static_cast<T>(negative_slope);
|
|
157
|
-
|
|
240
|
+
if constexpr (std::is_same_v<T, sycl::ext::oneapi::bfloat16>) {
|
|
241
|
+
return sycl::ext::oneapi::experimental::fmax(x, static_cast<T>(0)) +
|
|
242
|
+
sycl::ext::oneapi::experimental::fmin(x, static_cast<T>(0.0f)) * neg_slope_T;
|
|
243
|
+
|
|
244
|
+
} else {
|
|
245
|
+
return sycl::fmax(x, static_cast<T>(0)) +
|
|
158
246
|
sycl::fmin(x, static_cast<T>(0.0f)) * neg_slope_T;
|
|
247
|
+
}
|
|
159
248
|
}
|
|
160
249
|
|
|
161
250
|
template<typename T>
|
|
@@ -170,22 +259,40 @@ static __dpct_inline__ T op_clamp(T x, float min_val, float max_val) {
|
|
|
170
259
|
|
|
171
260
|
template<typename T>
|
|
172
261
|
static __dpct_inline__ T op_floor(T x) {
|
|
173
|
-
|
|
262
|
+
if constexpr (std::is_same_v<T, sycl::ext::oneapi::bfloat16>) {
|
|
263
|
+
return sycl::ext::oneapi::experimental::floor(x);
|
|
264
|
+
} else {
|
|
265
|
+
return sycl::floor(x);
|
|
266
|
+
}
|
|
174
267
|
}
|
|
175
268
|
|
|
176
269
|
template<typename T>
|
|
177
270
|
static __dpct_inline__ T op_ceil(T x) {
|
|
178
|
-
|
|
271
|
+
if constexpr (std::is_same_v<T, sycl::ext::oneapi::bfloat16>) {
|
|
272
|
+
return sycl::ext::oneapi::experimental::ceil(x);
|
|
273
|
+
} else {
|
|
274
|
+
return sycl::ceil(x);
|
|
275
|
+
}
|
|
179
276
|
}
|
|
180
277
|
|
|
181
278
|
template<typename T>
|
|
182
279
|
static __dpct_inline__ T op_round(T x) {
|
|
183
|
-
|
|
280
|
+
if constexpr (std::is_same_v<T, sycl::ext::oneapi::bfloat16>) {
|
|
281
|
+
return static_cast<sycl::ext::oneapi::bfloat16>(
|
|
282
|
+
sycl::round(static_cast<float>(x))
|
|
283
|
+
);
|
|
284
|
+
} else {
|
|
285
|
+
return sycl::round(x);
|
|
286
|
+
}
|
|
184
287
|
}
|
|
185
288
|
|
|
186
289
|
template<typename T>
|
|
187
290
|
static __dpct_inline__ T op_trunc(T x) {
|
|
188
|
-
|
|
291
|
+
if constexpr (std::is_same_v<T, sycl::ext::oneapi::bfloat16>) {
|
|
292
|
+
return sycl::ext::oneapi::experimental::trunc(x);
|
|
293
|
+
} else {
|
|
294
|
+
return sycl::trunc(x);
|
|
295
|
+
}
|
|
189
296
|
}
|
|
190
297
|
|
|
191
298
|
template<typename T, typename F>
|
|
@@ -266,13 +373,6 @@ static void unary_op_clamp_kernel(const T * x, T * dst, const int k, const sycl:
|
|
|
266
373
|
}
|
|
267
374
|
}
|
|
268
375
|
|
|
269
|
-
template<typename T>
|
|
270
|
-
static void unary_op_floor_kernel(const T * x, T * dst, const int k, const sycl::nd_item<1> &item_ct1) {
|
|
271
|
-
SYCL_GLOBAL_ID_LOOP(k, item_ct1) {
|
|
272
|
-
dst[i] = op_floor(x[i]);
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
|
|
276
376
|
template<typename T>
|
|
277
377
|
static void unary_op_ceil_kernel(const T * x, T * dst, const int k, const sycl::nd_item<1> &item_ct1) {
|
|
278
378
|
SYCL_GLOBAL_ID_LOOP(k, item_ct1) {
|
|
@@ -280,20 +380,6 @@ static void unary_op_ceil_kernel(const T * x, T * dst, const int k, const sycl::
|
|
|
280
380
|
}
|
|
281
381
|
}
|
|
282
382
|
|
|
283
|
-
template<typename T>
|
|
284
|
-
static void unary_op_round_kernel(const T * x, T * dst, const int k, const sycl::nd_item<1> &item_ct1) {
|
|
285
|
-
SYCL_GLOBAL_ID_LOOP(k, item_ct1) {
|
|
286
|
-
dst[i] = op_round(x[i]);
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
template<typename T>
|
|
291
|
-
static void unary_op_trunc_kernel(const T * x, T * dst, const int k, const sycl::nd_item<1> &item_ct1) {
|
|
292
|
-
SYCL_GLOBAL_ID_LOOP(k, item_ct1) {
|
|
293
|
-
dst[i] = op_trunc(x[i]);
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
|
|
297
383
|
template<typename T>
|
|
298
384
|
static void clamp(const T * x, T * dst, const float min, const float max, const int k,
|
|
299
385
|
const sycl::nd_item<1> &item_ct1) {
|
|
@@ -348,15 +434,24 @@ static void gated_op_fused_geglu_quick(const T * x, const T * g, T * dst, const
|
|
|
348
434
|
}
|
|
349
435
|
|
|
350
436
|
namespace ggml_sycl_detail {
|
|
351
|
-
static void acc_f32_sycl(const
|
|
352
|
-
const int64_t n_elements,
|
|
353
|
-
const int64_t
|
|
437
|
+
static void acc_f32_sycl(const char *x, const char *y, float *dst,
|
|
438
|
+
const int64_t n_elements,
|
|
439
|
+
const int64_t ne0, const int64_t ne1, const int64_t ne2, const int64_t ne3,
|
|
440
|
+
const int64_t nb00, const int64_t nb01, const int64_t nb02, const int64_t nb03,
|
|
441
|
+
const int64_t ne10, const int64_t ne11, const int64_t ne12, const int64_t ne13,
|
|
442
|
+
const int64_t nb10, const int64_t nb11, const int64_t nb12, const int64_t nb13,
|
|
443
|
+
const int64_t s1, const int64_t s2, const int64_t s3,
|
|
354
444
|
const int64_t offset, queue_ptr stream) {
|
|
355
445
|
const int num_blocks = (n_elements + SYCL_ACC_BLOCK_SIZE - 1) / SYCL_ACC_BLOCK_SIZE;
|
|
356
446
|
stream->parallel_for(sycl::nd_range<3>(sycl::range<3>(1, 1, num_blocks) * sycl::range<3>(1, 1, SYCL_ACC_BLOCK_SIZE),
|
|
357
447
|
sycl::range<3>(1, 1, SYCL_ACC_BLOCK_SIZE)),
|
|
358
|
-
[=](sycl::nd_item<3> /*item_ct1*/) {
|
|
359
|
-
|
|
448
|
+
[=](sycl::nd_item<3> /*item_ct1*/) [[sycl::reqd_sub_group_size(WARP_SIZE)]] {
|
|
449
|
+
acc_f32(x, y, dst, n_elements,
|
|
450
|
+
ne0, ne1, ne2, ne3,
|
|
451
|
+
nb00, nb01, nb02, nb03,
|
|
452
|
+
ne10, ne11, ne12, ne13,
|
|
453
|
+
nb10, nb11, nb12, nb13,
|
|
454
|
+
s1, s2, s3, offset);
|
|
360
455
|
});
|
|
361
456
|
}
|
|
362
457
|
|
|
@@ -370,8 +465,8 @@ static void arange_kernel(T * dst, const int k, T start, T step,
|
|
|
370
465
|
|
|
371
466
|
template<typename KernelInvoker, typename... Args>
|
|
372
467
|
static inline void dispatch_ggml_sycl_op_unary(ggml_backend_sycl_context & ctx, ggml_tensor * dst, KernelInvoker kernel_invoker, Args&&... args) {
|
|
373
|
-
GGML_ASSERT(dst->src[0]->type == GGML_TYPE_F32 || dst->src[0]->type == GGML_TYPE_F16);
|
|
374
|
-
GGML_ASSERT(dst->type == GGML_TYPE_F32 || dst->type == GGML_TYPE_F16);
|
|
468
|
+
GGML_ASSERT(dst->src[0]->type == GGML_TYPE_F32 || dst->src[0]->type == GGML_TYPE_F16 || dst->src[0]->type == GGML_TYPE_BF16);
|
|
469
|
+
GGML_ASSERT(dst->type == GGML_TYPE_F32 || dst->type == GGML_TYPE_F16 || dst->type == GGML_TYPE_BF16);
|
|
375
470
|
GGML_ASSERT(dst->src[0]->type == dst->type);
|
|
376
471
|
|
|
377
472
|
dpct::queue_ptr main_stream = ctx.stream();
|
|
@@ -383,6 +478,14 @@ static inline void dispatch_ggml_sycl_op_unary(ggml_backend_sycl_context & ctx,
|
|
|
383
478
|
kernel_invoker(data_pts.src, data_pts.dst, (int)ggml_nelements(dst->src[0]), main_stream, std::forward<Args>(args)...);
|
|
384
479
|
break;
|
|
385
480
|
}
|
|
481
|
+
#ifdef GGML_SYCL_HAS_BF16
|
|
482
|
+
case GGML_TYPE_BF16:
|
|
483
|
+
{
|
|
484
|
+
auto data_pts = cast_data<sycl::ext::oneapi::bfloat16>(dst);
|
|
485
|
+
kernel_invoker(data_pts.src, data_pts.dst, (int)ggml_nelements(dst->src[0]), main_stream, std::forward<Args>(args)...);
|
|
486
|
+
break;
|
|
487
|
+
}
|
|
488
|
+
#endif
|
|
386
489
|
case GGML_TYPE_F32:
|
|
387
490
|
{
|
|
388
491
|
auto data_pts = cast_data<float>(dst);
|
|
@@ -496,7 +599,7 @@ static inline void ggml_sycl_op_unary(
|
|
|
496
599
|
stream->parallel_for(
|
|
497
600
|
sycl::nd_range<1>(sycl::range<1>(num_blocks) * sycl::range<1>(256),
|
|
498
601
|
sycl::range<1>(256)),
|
|
499
|
-
[=](sycl::nd_item<1> item_ct1) {
|
|
602
|
+
[=](sycl::nd_item<1> item_ct1) [[sycl::reqd_sub_group_size(WARP_SIZE)]] {
|
|
500
603
|
unary_op_generic_kernel(
|
|
501
604
|
src, dst_ptr, k_elements,
|
|
502
605
|
ne0, ne1, ne2, ne3,
|
|
@@ -524,7 +627,7 @@ static inline void ggml_sycl_op_arange(ggml_backend_sycl_context & ctx, ggml_ten
|
|
|
524
627
|
stream->parallel_for(
|
|
525
628
|
sycl::nd_range<1>(sycl::range<1>(num_blocks) * sycl::range<1>(SYCL_ARANGE_BLOCK_SIZE),
|
|
526
629
|
sycl::range<1>(SYCL_ARANGE_BLOCK_SIZE)),
|
|
527
|
-
[=](sycl::nd_item<1> item_ct1) {
|
|
630
|
+
[=](sycl::nd_item<1> item_ct1) [[sycl::reqd_sub_group_size(WARP_SIZE)]] {
|
|
528
631
|
arange_kernel(dst_ptr, k, start, step, item_ct1);
|
|
529
632
|
});
|
|
530
633
|
}
|
|
@@ -605,6 +708,12 @@ static inline void ggml_sycl_op_exp(ggml_backend_sycl_context & ctx, ggml_tensor
|
|
|
605
708
|
});
|
|
606
709
|
}
|
|
607
710
|
|
|
711
|
+
static inline void ggml_sycl_op_expm1(ggml_backend_sycl_context & ctx, ggml_tensor * dst) {
|
|
712
|
+
ggml_sycl_detail::ggml_sycl_op_unary(ctx, dst, [](auto x) {
|
|
713
|
+
return op_expm1(x);
|
|
714
|
+
});
|
|
715
|
+
}
|
|
716
|
+
|
|
608
717
|
static inline void ggml_sycl_op_log(ggml_backend_sycl_context & ctx, ggml_tensor * dst) {
|
|
609
718
|
ggml_sycl_detail::dispatch_ggml_sycl_op_unary(ctx, dst,
|
|
610
719
|
[](const auto* src, auto* dst_ptr, int k_elements, queue_ptr stream) {
|
|
@@ -612,7 +721,7 @@ static inline void ggml_sycl_op_log(ggml_backend_sycl_context & ctx, ggml_tensor
|
|
|
612
721
|
stream->parallel_for(
|
|
613
722
|
sycl::nd_range<1>(sycl::range<1>(num_blocks) * sycl::range<1>(SYCL_EXP_BLOCK_SIZE),
|
|
614
723
|
sycl::range<1>(SYCL_EXP_BLOCK_SIZE)),
|
|
615
|
-
[=](sycl::nd_item<1> item_ct1) {
|
|
724
|
+
[=](sycl::nd_item<1> item_ct1) [[sycl::reqd_sub_group_size(WARP_SIZE)]] {
|
|
616
725
|
unary_op_log_kernel(src, dst_ptr, k_elements, item_ct1);
|
|
617
726
|
});
|
|
618
727
|
});
|
|
@@ -650,7 +759,7 @@ static inline void ggml_sycl_op_sqrt(ggml_backend_sycl_context & ctx, ggml_tenso
|
|
|
650
759
|
stream->parallel_for(
|
|
651
760
|
sycl::nd_range<1>(sycl::range<1>(num_blocks) * sycl::range<1>(SYCL_SQRT_BLOCK_SIZE),
|
|
652
761
|
sycl::range<1>(SYCL_SQRT_BLOCK_SIZE)),
|
|
653
|
-
[=](sycl::nd_item<1> item_ct1) {
|
|
762
|
+
[=](sycl::nd_item<1> item_ct1) [[sycl::reqd_sub_group_size(WARP_SIZE)]] {
|
|
654
763
|
unary_op_sqrt_kernel(src, dst_ptr, k_elements, item_ct1);
|
|
655
764
|
});
|
|
656
765
|
});
|
|
@@ -663,7 +772,7 @@ static inline void ggml_sycl_op_sin(ggml_backend_sycl_context & ctx, ggml_tensor
|
|
|
663
772
|
stream->parallel_for(
|
|
664
773
|
sycl::nd_range<1>(sycl::range<1>(num_blocks) * sycl::range<1>(SYCL_SIN_BLOCK_SIZE),
|
|
665
774
|
sycl::range<1>(SYCL_SIN_BLOCK_SIZE)),
|
|
666
|
-
[=](sycl::nd_item<1> item_ct1) {
|
|
775
|
+
[=](sycl::nd_item<1> item_ct1) [[sycl::reqd_sub_group_size(WARP_SIZE)]] {
|
|
667
776
|
unary_op_sin_kernel(src, dst_ptr, k_elements, item_ct1);
|
|
668
777
|
});
|
|
669
778
|
});
|
|
@@ -676,7 +785,7 @@ static inline void ggml_sycl_op_cos(ggml_backend_sycl_context & ctx, ggml_tensor
|
|
|
676
785
|
stream->parallel_for(
|
|
677
786
|
sycl::nd_range<1>(sycl::range<1>(num_blocks) * sycl::range<1>(SYCL_SIN_BLOCK_SIZE),
|
|
678
787
|
sycl::range<1>(SYCL_SIN_BLOCK_SIZE)),
|
|
679
|
-
[=](sycl::nd_item<1> item_ct1) {
|
|
788
|
+
[=](sycl::nd_item<1> item_ct1) [[sycl::reqd_sub_group_size(WARP_SIZE)]] {
|
|
680
789
|
unary_op_cos_kernel(src, dst_ptr, k_elements, item_ct1);
|
|
681
790
|
});
|
|
682
791
|
});
|
|
@@ -691,7 +800,7 @@ static inline void ggml_sycl_op_leaky_relu(ggml_backend_sycl_context & ctx, ggml
|
|
|
691
800
|
stream->parallel_for(
|
|
692
801
|
sycl::nd_range<1>(sycl::range<1>(num_blocks) * sycl::range<1>(SYCL_RELU_BLOCK_SIZE),
|
|
693
802
|
sycl::range<1>(SYCL_RELU_BLOCK_SIZE)),
|
|
694
|
-
[=](sycl::nd_item<1> item_ct1) {
|
|
803
|
+
[=](sycl::nd_item<1> item_ct1) [[sycl::reqd_sub_group_size(WARP_SIZE)]] {
|
|
695
804
|
unary_op_leaky_relu_kernel(src, dst_ptr, k_elements, slope, item_ct1);
|
|
696
805
|
});
|
|
697
806
|
}, negative_slope);
|
|
@@ -704,7 +813,7 @@ static inline void ggml_sycl_op_sqr(ggml_backend_sycl_context & ctx, ggml_tensor
|
|
|
704
813
|
stream->parallel_for(
|
|
705
814
|
sycl::nd_range<1>(sycl::range<1>(num_blocks) * sycl::range<1>(SYCL_SQR_BLOCK_SIZE),
|
|
706
815
|
sycl::range<1>(SYCL_SQR_BLOCK_SIZE)),
|
|
707
|
-
[=](sycl::nd_item<1> item_ct1) {
|
|
816
|
+
[=](sycl::nd_item<1> item_ct1) [[sycl::reqd_sub_group_size(WARP_SIZE)]] {
|
|
708
817
|
unary_op_sqr_kernel(src, dst_ptr, k_elements, item_ct1);
|
|
709
818
|
});
|
|
710
819
|
});
|
|
@@ -721,23 +830,16 @@ static inline void ggml_sycl_op_clamp(ggml_backend_sycl_context & ctx, ggml_tens
|
|
|
721
830
|
stream->parallel_for(
|
|
722
831
|
sycl::nd_range<1>(sycl::range<1>(num_blocks) * sycl::range<1>(SYCL_CLAMP_BLOCK_SIZE),
|
|
723
832
|
sycl::range<1>(SYCL_CLAMP_BLOCK_SIZE)),
|
|
724
|
-
[=](sycl::nd_item<1> item_ct1) {
|
|
833
|
+
[=](sycl::nd_item<1> item_ct1) [[sycl::reqd_sub_group_size(WARP_SIZE)]] {
|
|
725
834
|
clamp(src, dst_ptr, min_arg, max_arg, k_elements, item_ct1);
|
|
726
835
|
});
|
|
727
836
|
}, min_val, max_val);
|
|
728
837
|
}
|
|
729
838
|
|
|
730
839
|
static inline void ggml_sycl_op_floor(ggml_backend_sycl_context & ctx, ggml_tensor * dst) {
|
|
731
|
-
ggml_sycl_detail::
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
stream->parallel_for(
|
|
735
|
-
sycl::nd_range<1>(sycl::range<1>(num_blocks) * sycl::range<1>(256),
|
|
736
|
-
sycl::range<1>(256)),
|
|
737
|
-
[=](sycl::nd_item<1> item_ct1) {
|
|
738
|
-
unary_op_floor_kernel(src, dst_ptr, k_elements, item_ct1);
|
|
739
|
-
});
|
|
740
|
-
});
|
|
840
|
+
ggml_sycl_detail::ggml_sycl_op_unary(ctx, dst, [](auto x) {
|
|
841
|
+
return op_floor(x);
|
|
842
|
+
});
|
|
741
843
|
}
|
|
742
844
|
|
|
743
845
|
static inline void ggml_sycl_op_ceil(ggml_backend_sycl_context & ctx, ggml_tensor * dst) {
|
|
@@ -747,37 +849,23 @@ static inline void ggml_sycl_op_ceil(ggml_backend_sycl_context & ctx, ggml_tenso
|
|
|
747
849
|
}
|
|
748
850
|
|
|
749
851
|
static inline void ggml_sycl_op_round(ggml_backend_sycl_context & ctx, ggml_tensor * dst) {
|
|
750
|
-
ggml_sycl_detail::
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
stream->parallel_for(
|
|
754
|
-
sycl::nd_range<1>(sycl::range<1>(num_blocks) * sycl::range<1>(256),
|
|
755
|
-
sycl::range<1>(256)),
|
|
756
|
-
[=](sycl::nd_item<1> item_ct1) {
|
|
757
|
-
unary_op_round_kernel(src, dst_ptr, k_elements, item_ct1);
|
|
758
|
-
});
|
|
759
|
-
});
|
|
852
|
+
ggml_sycl_detail::ggml_sycl_op_unary(ctx, dst, [](auto x) {
|
|
853
|
+
return op_round(x);
|
|
854
|
+
});
|
|
760
855
|
}
|
|
761
856
|
|
|
762
857
|
static inline void ggml_sycl_op_trunc(ggml_backend_sycl_context & ctx, ggml_tensor * dst) {
|
|
763
|
-
ggml_sycl_detail::
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
stream->parallel_for(
|
|
767
|
-
sycl::nd_range<1>(sycl::range<1>(num_blocks) * sycl::range<1>(256),
|
|
768
|
-
sycl::range<1>(256)),
|
|
769
|
-
[=](sycl::nd_item<1> item_ct1) {
|
|
770
|
-
unary_op_trunc_kernel(src, dst_ptr, k_elements, item_ct1);
|
|
771
|
-
});
|
|
772
|
-
});
|
|
858
|
+
ggml_sycl_detail::ggml_sycl_op_unary(ctx, dst, [](auto x) {
|
|
859
|
+
return op_trunc(x);
|
|
860
|
+
});
|
|
773
861
|
}
|
|
774
862
|
|
|
775
863
|
static inline void ggml_sycl_op_acc(ggml_backend_sycl_context & ctx, ggml_tensor *dst) {
|
|
776
864
|
const ggml_tensor * src0 = dst->src[0];
|
|
777
865
|
const ggml_tensor * src1 = dst->src[1];
|
|
778
866
|
|
|
779
|
-
const
|
|
780
|
-
const
|
|
867
|
+
const char * src0_d = (const char *) src0->data;
|
|
868
|
+
const char * src1_d = (const char *) src1->data;
|
|
781
869
|
float * dst_d = (float *) dst->data;
|
|
782
870
|
|
|
783
871
|
dpct::queue_ptr stream = ctx.stream();
|
|
@@ -786,17 +874,20 @@ static inline void ggml_sycl_op_acc(ggml_backend_sycl_context & ctx, ggml_tensor
|
|
|
786
874
|
GGML_ASSERT(src1->type == GGML_TYPE_F32);
|
|
787
875
|
GGML_ASSERT( dst->type == GGML_TYPE_F32);
|
|
788
876
|
|
|
789
|
-
GGML_ASSERT(ggml_is_contiguous(src1));
|
|
790
877
|
GGML_ASSERT(dst->nb[0] == ggml_element_size(dst));
|
|
791
878
|
GGML_ASSERT(ggml_is_contiguously_allocated(dst));
|
|
879
|
+
GGML_ASSERT(ggml_are_same_shape(src0, dst));
|
|
792
880
|
|
|
793
|
-
const int64_t s1 = dst->op_params[0] / sizeof(float);
|
|
794
|
-
const int64_t s2 = dst->op_params[1] / sizeof(float);
|
|
795
|
-
const int64_t s3 = dst->op_params[2] / sizeof(float);
|
|
796
|
-
const int64_t offset = dst->op_params[3] / sizeof(float);
|
|
881
|
+
const int64_t s1 = (int64_t) ((const int32_t *) dst->op_params)[0] / (int64_t) sizeof(float);
|
|
882
|
+
const int64_t s2 = (int64_t) ((const int32_t *) dst->op_params)[1] / (int64_t) sizeof(float);
|
|
883
|
+
const int64_t s3 = (int64_t) ((const int32_t *) dst->op_params)[2] / (int64_t) sizeof(float);
|
|
884
|
+
const int64_t offset = (int64_t) ((const int32_t *) dst->op_params)[3] / (int64_t) sizeof(float);
|
|
797
885
|
|
|
798
886
|
ggml_sycl_detail::acc_f32_sycl(src0_d, src1_d, dst_d, ggml_nelements(dst),
|
|
887
|
+
dst->ne[0], dst->ne[1], dst->ne[2], dst->ne[3],
|
|
888
|
+
src0->nb[0], src0->nb[1], src0->nb[2], src0->nb[3],
|
|
799
889
|
src1->ne[0], src1->ne[1], src1->ne[2], src1->ne[3],
|
|
890
|
+
src1->nb[0], src1->nb[1], src1->nb[2], src1->nb[3],
|
|
800
891
|
s1, s2, s3, offset, stream);
|
|
801
892
|
}
|
|
802
893
|
|
|
@@ -805,7 +896,8 @@ static inline void ggml_sycl_op_geglu(ggml_backend_sycl_context & ctx, ggml_tens
|
|
|
805
896
|
[](const auto* x_ptr, const auto* g_ptr, auto* dst_ptr, uint64_t k, uint64_t n, uint64_t o0, uint64_t o1, queue_ptr main_stream) {
|
|
806
897
|
const uint32_t num_blocks = ceil_div(k, SYCL_GELU_BLOCK_SIZE);
|
|
807
898
|
main_stream->parallel_for(
|
|
808
|
-
sycl::nd_range<1>((num_blocks * sycl::range<1>(SYCL_GELU_BLOCK_SIZE)),
|
|
899
|
+
sycl::nd_range<1>((num_blocks * sycl::range<1>(SYCL_GELU_BLOCK_SIZE)),
|
|
900
|
+
sycl::range<1>(SYCL_GELU_BLOCK_SIZE)), [=](sycl::nd_item<1> item_ct1) [[sycl::reqd_sub_group_size(WARP_SIZE)]] {
|
|
809
901
|
gated_op_fused_geglu(x_ptr, g_ptr, dst_ptr, k, n, o0, o1, item_ct1);
|
|
810
902
|
});
|
|
811
903
|
});
|
|
@@ -816,7 +908,8 @@ static inline void ggml_sycl_op_reglu(ggml_backend_sycl_context & ctx, ggml_tens
|
|
|
816
908
|
[](const auto* x_ptr, const auto* g_ptr, auto* dst_ptr, uint64_t k, uint64_t n, uint64_t o0, uint64_t o1, queue_ptr main_stream) {
|
|
817
909
|
const uint32_t num_blocks = ceil_div((uint32_t)k, SYCL_RELU_BLOCK_SIZE); // Using RELU block size for reglu
|
|
818
910
|
main_stream->parallel_for(
|
|
819
|
-
sycl::nd_range<1>((num_blocks * sycl::range<1>(SYCL_RELU_BLOCK_SIZE)),
|
|
911
|
+
sycl::nd_range<1>((num_blocks * sycl::range<1>(SYCL_RELU_BLOCK_SIZE)),
|
|
912
|
+
sycl::range<1>(SYCL_RELU_BLOCK_SIZE)), [=](sycl::nd_item<1> item_ct1) [[sycl::reqd_sub_group_size(WARP_SIZE)]] {
|
|
820
913
|
gated_op_fused_reglu(x_ptr, g_ptr, dst_ptr, k, n, o0, o1, item_ct1);
|
|
821
914
|
});
|
|
822
915
|
});
|
|
@@ -827,7 +920,8 @@ static inline void ggml_sycl_op_swiglu(ggml_backend_sycl_context & ctx, ggml_ten
|
|
|
827
920
|
[](const auto* x_ptr, const auto* g_ptr, auto* dst_ptr, uint64_t k, uint64_t n, uint64_t o0, uint64_t o1, queue_ptr main_stream) {
|
|
828
921
|
const uint32_t num_blocks = ceil_div((uint32_t)k, SYCL_SILU_BLOCK_SIZE); // Using SILU block size for swiglu
|
|
829
922
|
main_stream->parallel_for(
|
|
830
|
-
sycl::nd_range<1>((num_blocks * sycl::range<1>(SYCL_SILU_BLOCK_SIZE)),
|
|
923
|
+
sycl::nd_range<1>((num_blocks * sycl::range<1>(SYCL_SILU_BLOCK_SIZE)),
|
|
924
|
+
sycl::range<1>(SYCL_SILU_BLOCK_SIZE)), [=](sycl::nd_item<1> item_ct1) [[sycl::reqd_sub_group_size(WARP_SIZE)]] {
|
|
831
925
|
gated_op_fused_swiglu(x_ptr, g_ptr, dst_ptr, k, n, o0, o1, item_ct1);
|
|
832
926
|
});
|
|
833
927
|
});
|
|
@@ -842,7 +936,6 @@ __dpct_inline__ float ggml_sycl_op_swiglu_oai_single(float x, float g, float alp
|
|
|
842
936
|
return out_glu;
|
|
843
937
|
}
|
|
844
938
|
|
|
845
|
-
|
|
846
939
|
template <typename T>
|
|
847
940
|
static void swiglu_oai_kernel(const T * x, const T * g, T * dst, const int64_t k,
|
|
848
941
|
const int64_t n, const int64_t o0, const int64_t o1,
|
|
@@ -876,7 +969,7 @@ static void swiglu_oai_sycl(const T * x,
|
|
|
876
969
|
const int64_t num_blocks = (k + SYCL_GLU_BLOCK_SIZE - 1) / SYCL_GLU_BLOCK_SIZE;
|
|
877
970
|
stream->parallel_for(sycl::nd_range<3>(sycl::range<3>(1, 1, num_blocks) * sycl::range<3>(1, 1, SYCL_GLU_BLOCK_SIZE),
|
|
878
971
|
sycl::range<3>(1, 1, SYCL_GLU_BLOCK_SIZE)),
|
|
879
|
-
[=](sycl::nd_item<3> item_ct1) {
|
|
972
|
+
[=](sycl::nd_item<3> item_ct1) [[sycl::reqd_sub_group_size(WARP_SIZE)]] {
|
|
880
973
|
swiglu_oai_kernel(x, g, dst, k, n, o0, o1, alpha, limit, item_ct1);
|
|
881
974
|
});
|
|
882
975
|
}
|
|
@@ -930,7 +1023,8 @@ static inline void ggml_sycl_op_geglu_erf(ggml_backend_sycl_context & ctx, ggml_
|
|
|
930
1023
|
[](const auto* x_ptr, const auto* g_ptr, auto* dst_ptr, uint64_t k, uint64_t n, uint64_t o0, uint64_t o1, queue_ptr main_stream) {
|
|
931
1024
|
const uint32_t num_blocks = ceil_div(k, SYCL_GELU_BLOCK_SIZE);
|
|
932
1025
|
main_stream->parallel_for(
|
|
933
|
-
sycl::nd_range<1>((num_blocks * sycl::range<1>(SYCL_GELU_BLOCK_SIZE)),
|
|
1026
|
+
sycl::nd_range<1>((num_blocks * sycl::range<1>(SYCL_GELU_BLOCK_SIZE)),
|
|
1027
|
+
sycl::range<1>(SYCL_GELU_BLOCK_SIZE)), [=](sycl::nd_item<1> item_ct1) [[sycl::reqd_sub_group_size(WARP_SIZE)]] {
|
|
934
1028
|
gated_op_fused_geglu_erf(x_ptr, g_ptr, dst_ptr, k, n, o0, o1, item_ct1);
|
|
935
1029
|
});
|
|
936
1030
|
});
|
|
@@ -941,7 +1035,8 @@ static inline void ggml_sycl_op_geglu_quick(ggml_backend_sycl_context & ctx, ggm
|
|
|
941
1035
|
[](const auto* x_ptr, const auto* g_ptr, auto* dst_ptr, uint64_t k, uint64_t n, uint64_t o0, uint64_t o1, queue_ptr main_stream) {
|
|
942
1036
|
const uint32_t num_blocks = ceil_div(k, SYCL_GELU_BLOCK_SIZE);
|
|
943
1037
|
main_stream->parallel_for(
|
|
944
|
-
sycl::nd_range<1>((num_blocks * sycl::range<1>(SYCL_GELU_BLOCK_SIZE)),
|
|
1038
|
+
sycl::nd_range<1>((num_blocks * sycl::range<1>(SYCL_GELU_BLOCK_SIZE)),
|
|
1039
|
+
sycl::range<1>(SYCL_GELU_BLOCK_SIZE)), [=](sycl::nd_item<1> item_ct1) [[sycl::reqd_sub_group_size(WARP_SIZE)]] {
|
|
945
1040
|
gated_op_fused_geglu_quick(x_ptr, g_ptr, dst_ptr, k, n, o0, o1, item_ct1);
|
|
946
1041
|
});
|
|
947
1042
|
});
|
|
@@ -1018,6 +1113,11 @@ void ggml_sycl_exp(ggml_backend_sycl_context & ctx, ggml_tensor * dst) {
|
|
|
1018
1113
|
ggml_sycl_op_exp(ctx, dst);
|
|
1019
1114
|
}
|
|
1020
1115
|
|
|
1116
|
+
void ggml_sycl_expm1(ggml_backend_sycl_context & ctx, ggml_tensor * dst) {
|
|
1117
|
+
scope_op_debug_print scope_dbg_print(__func__, dst, /*num_src=*/1);
|
|
1118
|
+
ggml_sycl_op_expm1(ctx, dst);
|
|
1119
|
+
}
|
|
1120
|
+
|
|
1021
1121
|
void ggml_sycl_log(ggml_backend_sycl_context & ctx, ggml_tensor * dst) {
|
|
1022
1122
|
scope_op_debug_print scope_dbg_print(__func__, dst, /*num_src=*/1);
|
|
1023
1123
|
ggml_sycl_op_log(ctx, dst);
|
|
@@ -59,6 +59,8 @@ void ggml_sycl_hardswish(ggml_backend_sycl_context & ctx, ggml_tensor * dst);
|
|
|
59
59
|
|
|
60
60
|
void ggml_sycl_exp(ggml_backend_sycl_context & ctx, ggml_tensor * dst);
|
|
61
61
|
|
|
62
|
+
void ggml_sycl_expm1(ggml_backend_sycl_context & ctx, ggml_tensor * dst);
|
|
63
|
+
|
|
62
64
|
void ggml_sycl_log(ggml_backend_sycl_context & ctx, ggml_tensor * dst);
|
|
63
65
|
|
|
64
66
|
void ggml_sycl_softplus(ggml_backend_sycl_context & ctx, ggml_tensor * dst);
|