vulkan: combine duplicated fastdiv functions, rename the one optimizing small divs (#27526)

* vulkan: combine duplicated fastdiv functions, rename the one optimizing small divs

* remove one more fastdiv
This commit is contained in:
Jeff Bolz
2026-08-29 10:59:48 +03:00
committed by GitHub
parent 5ea1b124e7
commit c9ca51c1f6
7 changed files with 24 additions and 53 deletions
@@ -8,6 +8,7 @@
#endif
#include "types.glsl"
#include "utils.glsl"
layout (push_constant) uniform parameter
{
@@ -33,14 +34,6 @@ shared uint vals[BLOCK_SIZE];
shared uint offsets[BLOCK_SIZE];
shared uint cursors[BLOCK_SIZE];
// see init_fastdiv_values in ggml-vulkan.cpp
uint fastdiv(uint n, uint mp, uint L) {
uint msbs, lsbs;
// msbs = mulhi(n, mp)
umulExtended(n, mp, msbs, lsbs);
return (msbs + n) >> L;
}
// data_d layout when p.hoist_row_ids is set:
// [0, n_experts) per-expert row count
// [n_experts, 2*n_experts) per-expert start offset into the row id region