Skip to content

cuda : the signs of IQ2 / IQ3 values cost two SWAR sequences per 4 values on HIP #93

Closed

Description

@rafasmour

The IQ2 and IQ3 mat-vec kernels read about 500 GB/s on an RX 7900 XT (IQ2_S 431 GB/s), against about 740 GB/s for Q4_K, Q6_K and Q8_0. They are bound by the ALU work per value, not by memory.

Per 4 values the kernels build a byte mask from the sign bits with __vcmpne4 and negate with __vsub4. HIP has no byte-wise compare or subtract, so both are SWAR sequences (vendors/hip.h, about 7 and 6 operations). The dot product itself is one instruction.

To check: can the signs be applied with fewer operations on HIP, with the same result.

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