Skip to main content

dispatch_softcap

Function dispatch_softcap 

Source
pub fn dispatch_softcap(
    encoder: &mut CommandEncoder,
    registry: &mut KernelRegistry,
    device: &DeviceRef,
    input: &MlxBuffer,
    output: &MlxBuffer,
    params_buf: &MlxBuffer,
    cap: f32,
) -> Result<()>
Expand description

Dispatch a softcap operation on the GPU.

§Arguments

  • encoder - Command encoder to record the dispatch into.
  • registry - Kernel registry (must have softcap sources registered).
  • device - Metal device for pipeline compilation.
  • input - Input buffer (f32, f16, or bf16).
  • output - Output buffer (same dtype and shape as input).
  • params_buf - Params buffer containing [cap, n_elements_as_f32_bits] as two f32 values.
  • cap - The capping value (e.g. 30.0).

§Errors

Returns MlxError::InvalidArgument if:

  • Input dtype is not f32, f16, or bf16.
  • Input and output element counts do not match.
  • Cap is not positive.