deepspeedai / deepspeedai/DeepSpeed

`fp_quantizer` ops bug

Open
#7,236 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
43.1k
Forks
5k
Avg merge
4d 15h
Merged PRs (30d)
112

Description

There appear to be several issues with the fp_quantizer kernels.

First, it appears that the unit tests are not run in CI. I believe these should be run on the A6000 tests, but triton is not installed in the testing environment, so these get skipped.

Second, running on current master branch we see the following error:

>               data, self.scale = out.split(group_size, dim=-1)
E               ValueError: not enough values to unpack (expected 2, got 1)

../deepspeed/ops/fp_quantizer/quantize.py:99: ValueError

I believe this is a "cosmetic" issue that can be fixed after following the different code paths (e.g., quant configs, fallback methods, etc.)

Third and final, the kernels seem to break on triton>=3.2.0. If we go back prior to breaking (described above and introduced in #6932) to v0.16.2 then we can see that running with triton==3.1.0 the tests pass. However with triton==3.2.0 the tests fail due to the error being too large:

FAILED unit/ops/fp_quantizer/test_fp8_gemm.py::test_fp_quant[1-qbits8-bf16] - AssertionError: failed on batch-size 1 with error 5046272.0
FAILED unit/ops/fp_quantizer/test_fp8_gemm.py::test_fp_quant[2-qbits8-bf16] - AssertionError: failed on batch-size 2 with error 5144576.0
FAILED unit/ops/fp_quantizer/test_fp8_gemm.py::test_fp_quant[4-qbits8-bf16] - AssertionError: failed on batch-size 4 with error 5046272.0
FAILED unit/ops/fp_quantizer/test_fp8_gemm.py::test_fp_quant[8-qbits8-bf16] - AssertionError: failed on batch-size 8 with error 5046272.0
FAILED unit/ops/fp_quantizer/test_fp8_gemm.py::test_fp_quant[32-qbits8-bf16] - AssertionError: failed on batch-size 32 with error nan
FAILED unit/ops/fp_quantizer/test_fp8_gemm.py::test_fp_quant[64-qbits8-bf16] - AssertionError: failed on batch-size 64 with error 5111808.0
FAILED unit/ops/fp_quantizer/test_fp8_gemm.py::test_fp_quant[128-qbits8-bf16] - AssertionError: failed on batch-size 128 with error 5111808.0
FAILED unit/ops/fp_quantizer/test_fp8_gemm.py::test_fp_quant[256-qbits8-bf16] - AssertionError: failed on batch-size 256 with error nan
FAILED unit/ops/fp_quantizer/test_fp8_gemm.py::test_fp_quant[512-qbits8-bf16] - AssertionError: failed on batch-size 512 with error nan
FAILED unit/ops/fp_quantizer/test_fp8_gemm.py::test_fp_quant[1024-qbits8-bf16] - AssertionError: failed on batch-size 1024 with error nan
FAILED unit/ops/fp_quantizer/test_fp8_gemm.py::test_fp_quant[2048-qbits8-bf16] - AssertionError: failed on batch-size 2048 with error nan

I have created a reproducer for the third issue and will work to resolve the first two issues. @RezaYazdaniAminabadi Any input on the third issue described here? It seems the values explode here when multiplying w and scale.

Reproducer:

git clone https://github.com/deepspeedai/DeepSpeed.git -b mwyatt/fp-quant-debug
pip install -e ./DeepSpeed/
pip install pytest
pip install triton==3.2.0
cd ./DeepSpeed/tests
python -m pytest ./unit/ops/fp_quantizer/test_fp8_gemm.py

Contributor guide

Open the contributing guide

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.

Research direction

Run tests/unit/ops/fp_quantizer/test_fp8_gemm.py with the provided Triton 3.2.0 reproducer, then inspect deepspeed/ops/fp_quantizer/quantize.py:99 and fp8_gemm_triton.py:51. Trace the quantization configurations and fallback paths, and compare Triton 3.1.0 with 3.2.0. Done means the fp_quantizer tests run in the A6000 CI environment and pass across the reported cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
ci-cd, machine-learning, testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.