Skip to main content

Module argsort

Module argsort 

Source
Expand description

GPU-accelerated argsort (descending) for MoE top-K routing.

Sorts indices by value in descending order using a bitonic sort kernel. For MoE with N <= 128 experts per row, this fits in a single threadgroup.

Statics§

ARGSORT_SHADER_SOURCE
MSL source for the argsort kernel (embedded at compile time).

Functions§

dispatch_argsort_desc_f32
Dispatch an argsort (descending) operation on the GPU.
register
Register argsort shader source with the given kernel registry.