Skip to content

cuda : the expert ids helper runs for every mat-mul of a MoE layer #122

Closed

Description

@rafasmour

A prompt batch through a MoE layer runs ggml_cuda_launch_mm_ids_helper once per MUL_MAT_ID that goes to MMQ: for the gate, the up and the down projection, each time on the same ids.

Kernel trace of Qwen3.6 35B-A3B UD-IQ4_XS at ubatch 512 on an RX 7900 XT (rocprofv3): mm_ids_helper 117 launches per batch (three per MoE layer), 54 us each, 6.3 ms of 135 ms kernel time (4.7%).

The gate and the up projection call the helper with the same arguments, so the second call can reuse the result of the first. (The down projection needs the plain map instead of the inverse map and keeps its own call.)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions