Skip to content

cuda : the activation scale of the MoE down projection takes ten launches and a single-thread maximum #128

Closed

Description

@rafasmour

For Mellum, Mistral4, Flint and Laguna the graph scales the input of the MoE down projection by a power of two per row (llm_graph_context::build_amax_src1_f16): abs, max pool over the row, scale, log, scale, ceil, clamp, scale, exp, then a div; the scale is multiplied back behind the mat-mul.

On ROCm that is ten launches per MoE layer for one token, and the pool kernel (pool1d_nchw_kernel) computes each row maximum with a single thread.

Kernel trace of Mellum 2.1 12B-A2.5B Q5_K_M, one token, on an RX 7900 XT (rocprofv3): 813 launches per token, of which 280 belong to this chain. pool1d_nchw_kernel 28 launches of 43.8 us = 1.23 ms of 6.07 ms kernel time; the eight small kernels around it another 0.4 ms.

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