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

use new q4_0 batch kernel #12396

Merged
merged 2 commits into from
Nov 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions python/llm/src/ipex_llm/transformers/low_bit_linear.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,12 +362,16 @@ def use_batch_forward(x: torch.Tensor, qtype: int, output_len: int):
batch_size = x.shape[0]
hard_condition = (
x.dtype in [torch.float, torch.half]
and x.shape[1] % 256 == 0
and output_len % 32 == 0
and device in ["arc", "flex", "pvc", "mtl"]
and qtype in [SYM_INT4, ASYM_INT4, SYM_INT8, FP4,
FP8E5, FP6, FP8E4, Q4_K, Q6_K]
and batch_size <= 64
and (
x.shape[1] % 128 == 0 and qtype in [SYM_INT4]
or (
x.shape[1] % 256 == 0
and output_len % 32 == 0
and device in ["arc", "flex", "pvc", "mtl"]
and qtype in [ASYM_INT4, SYM_INT8, FP4, FP8E5, FP6, FP8E4, Q4_K, Q6_K]
)
)
and batch_size <= 48
)
if hard_condition:
return (
Expand Down
Loading