Skip to content

cuda : the attention gate of Qwen3.5 is copied before the sigmoid #118

Closed

Description

@rafasmour

The attention layers of the Qwen3.5 family take their gate from every second row of the Q projection (Qcur_full holds per head a row of Q and a row of the gate). The graph makes the gate contiguous first: a cpy_scalar launch per attention layer (3.1 to 4.1 us in a rocprofv3 kernel trace on an RX 7900 XT), then sigmoid + mul run as one kernel. Per token: Ornith 1.5 9B 8, Qwen3.6 35B-A3B 10, Qwen3.8 27B 16.

The unary + mul kernel already takes a row length and a row stride for its inputs, so it can read the gate rows where they are.

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