Real INT8 W8A8 matmul on tensor cores

Open
#14 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
53/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Active
Tech stack
python, pytorch

Research direction

Read src/bitsmith/nn/qlinear.py around set_backend and forward to understand the existing reference path, then inspect tests/gpu/test_cuda.py for its comparison tests. Implement the INT8 activation path with the stated shape-based fallback, and compare its output and W8A8 prefill speed against the reference and fp16 on Ampere; done means it meets the tested error bound and is faster.

Written by the indexing model from the issue text.

Description

area: kernels enhancement help wanted performance

w8a8 and w8a8+smoothquant currently simulate activation quantization (fake quant) and
then run a float matmul, so they are slower than plain INT8 weights.

Task: add a backend for int8 layers with act_bits=8 that quantizes activations per
token to int8 and calls torch._int_mm (int8 x int8 -> int32 on tensor cores), then
applies the activation and weight scales. Note torch._int_mm has shape requirements
(rows above 16, dimensions multiples of 8), so fall back to the reference path otherwise.

Files

  • src/bitsmith/nn/qlinear.py: set_backend and forward
  • tests/gpu/test_cuda.py: compare with the reference path

Done when W8A8 prefill is faster than fp16 on an Ampere GPU and matches the reference
within a tested error bound.

Dominant language
Python
Stars
0
Forks
0
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from yashwanthdevavarapu/bitsmith

All issues in yashwanthdevavarapu/bitsmith

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.