Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Kernel] add bfloat16 support for gptq kernel #4781

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

jinzhen-lin
Copy link
Contributor

Some models would overflow when using fp16 inference (e.g. Deepseek-V2), so we should add bfloat16 support for quantization kernel. This PR add bfloat16 support for gptq kernel.

Related issue: #2149

main changes:

  • add bfloat16 input/output support for cuda kernels
  • dequant qweight to bfloat16 in proper ways.

NOTE: Currently, bfloat16 kernel may be much slower than float16 on >=sm80,<sm90 device since the support for atomicAdd with bfloat16 is not native (see description of atomicAdd). Increase the value of BLOCK_KN_SIZE can much improve the performance, but I don't sure if this will affect other situations.

@mgoin
Copy link
Collaborator

mgoin commented May 21, 2024

@alexm-neuralmagic should we support bfloat16 here the same way as done for gptq_marlin?

@jinzhen-lin
Copy link
Contributor Author

@alexm-neuralmagic should we support bfloat16 here the same way as done for gptq_marlin?

The bfloat16 gptq kernel have serious performance issue now, I may optimize it recently.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants