Skip to content

Conversation

@ixgbe
Copy link
Contributor

@ixgbe ixgbe commented Nov 17, 2025

This PR introduces vectorized support for the ggml_vec_scale_f16 function on RISC-V platforms that implement the Zvfh extension.

Signed-off-by: Wang Yang <yangwang@iscas.ac.cn>
@github-actions github-actions bot added the ggml changes relating to the ggml tensor library for machine learning label Nov 17, 2025
Comment on lines 738 to 742
#else
for (int i = 0; i < n; ++i) {
y[i] = GGML_CPU_FP32_TO_FP16(GGML_CPU_FP16_TO_FP32(y[i]) * v);
}
#endif
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try to reorganize the code to avoid duplicating the scalar implementaiton

@ixgbe ixgbe requested a review from ggerganov November 17, 2025 09:01
svfloat16_t out = svmul_f16_m(pg, hy, vx);
svst1_f16(pg, (__fp16 *)(y + np), out);
}
#elif defined(GGML_SIMD) && defined(__riscv_v_intrinsic) && defined(__riscv_zvfh)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need defined(GGML_SIMD) here?

Copy link
Contributor Author

@ixgbe ixgbe Nov 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ggml/src/ggml-cpu/simd-mappings.h
image
we do not need defined(GGML_SIMD) , thank you for your reminder.

@ixgbe ixgbe requested review from ggerganov November 17, 2025 09:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ggml changes relating to the ggml tensor library for machine learning

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants