Skip to content

Commit

Permalink
update batch kernel condition (#12421)
Browse files Browse the repository at this point in the history
  • Loading branch information
MeouSker77 authored Nov 21, 2024
1 parent 7288c75 commit 145e8b4
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions python/llm/src/ipex_llm/transformers/low_bit_linear.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,14 +362,22 @@ 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 batch_size <= 48
and x.shape[1] % 128 == 0
and (
(
qtype in [SYM_INT4, ASYM_INT4, FP8E5, FP8E4]
and x.shape[1] % 128 == 0
and (
batch_size <= 48
or (
batch_size <= 64
and x.shape[1] % 256 == 0
and output_len % 64 == 0
)
)
)
or (
qtype in [SYM_INT8, FP4, FP6, Q4_K, Q6_K]
and batch_size <= 48
and device in ["arc", "flex", "pvc", "mtl"]
and x.shape[1] % 256 == 0
and output_len % 32 == 0
Expand Down

0 comments on commit 145e8b4

Please sign in to comment.