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

Update IPEX_LLM_PERFORMANCE_MODE #11823

Merged
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
18 changes: 11 additions & 7 deletions python/llm/src/ipex_llm/transformers/models/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -487,14 +487,18 @@ def update_past_key_value(past_key_value, key_states, value_states,

def should_use_compresskv(x: torch.Tensor, prompt_len: int):
use_compress_kv = os.environ.get("IPEX_LLM_COMPRESS_KV_CACHE", None)
if use_compress_kv is None:
return (
get_xpu_device_type(x) == "mtl"
and prompt_len >= 1800
and prompt_len <= 4500
)
perf_mode = os.environ.get("IPEX_LLM_PERFORMANCE_MODE", None)
if perf_mode == "1":
return False
else:
return x.device.type == 'xpu' and use_compress_kv == "1"
if use_compress_kv is None:
return (
get_xpu_device_type(x) == "mtl"
and prompt_len >= 1800
and prompt_len <= 4500
)
else:
return x.device.type == 'xpu' and use_compress_kv == "1"


def get_compresskv_attn_mask(key_states: torch.Tensor,
Expand Down
Loading