Skip to content

Quantized Matmul: Small batches are slower than no-batch #2074

@lucasavila00

Description

@lucasavila00

Thanks for the work on this repo, it's amazing.

The newly added quantized matmul kernels are great, but they're slower than using the vec kernels on small batch sizes.

On Llama.cpp I see they use the vec version if batch is <= 4 ggml-org/llama.cpp#5351 ggml-org/llama.cpp#5370

I'm reading https://github.com/huggingface/candle/blob/main/candle-kernels/src/quantized.cu and it seems the code was extracted from Llama.cpp before this PR was merged, and candle's version misses this optimization.

For context, this issue was noticed on mistral.rs EricLBuehler/mistral.rs#139

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