[ROCm]: Update rope+kvcache fusion conditions and disable custom op by default (#36716)
Signed-off-by: Rohan138 <rohanpotdar138@gmail.com>
This commit is contained in:
@@ -1042,13 +1042,6 @@ class CompilationConfig:
|
||||
self.splitting_ops = []
|
||||
return
|
||||
|
||||
# NOTE: this function needs to be called only when mode is
|
||||
# CompilationMode.VLLM_COMPILE
|
||||
assert self.mode == CompilationMode.VLLM_COMPILE, (
|
||||
"set_splitting_ops_for_v1 should only be called when "
|
||||
"mode is CompilationMode.VLLM_COMPILE"
|
||||
)
|
||||
|
||||
if self.pass_config.fuse_attn_quant and not self.use_inductor_graph_partition:
|
||||
self.set_splitting_ops_for_attn_fusion()
|
||||
else:
|
||||
@@ -1069,6 +1062,16 @@ class CompilationConfig:
|
||||
# that doesn't seem to affect performance.
|
||||
# https://github.com/vllm-project/vllm/issues/33267
|
||||
if not self.use_inductor_graph_partition:
|
||||
if self.pass_config.fuse_rope_kvcache:
|
||||
logger.warning_once(
|
||||
"fuse_rope_kvcache is enabled, but splitting_ops is None "
|
||||
"and Inductor graph partition is not enabled."
|
||||
"Disabling fuse_rope_kvcache."
|
||||
"Please either set splitting_ops to an empty list []"
|
||||
"or set use_inductor_graph_partition to True "
|
||||
"to enable RoPE+KV cache fusion."
|
||||
)
|
||||
self.pass_config.fuse_rope_kvcache = False
|
||||
self.splitting_ops.append("vllm::unified_kv_cache_update")
|
||||
self.splitting_ops.append("vllm::unified_mla_kv_cache_update")
|
||||
|
||||
@@ -1142,6 +1145,29 @@ class CompilationConfig:
|
||||
op in self.splitting_ops for op in self._attention_ops
|
||||
)
|
||||
|
||||
def splitting_ops_contain_kv_cache_update(self) -> bool:
|
||||
# when using Dynamo partition while splitting ops is None
|
||||
# and attn+quant fusion disabled, the kv_cache_update_ops are
|
||||
# appended to splitting_ops in set_splitting_ops_for_v1 due to
|
||||
# https://github.com/vllm-project/vllm/issues/33267
|
||||
# In this case, we return True if the kv_cache_update_ops
|
||||
# are not in the splitting_ops yet, but will subsequently
|
||||
# be added to splitting_ops.
|
||||
if (
|
||||
not self.use_inductor_graph_partition
|
||||
and self.splitting_ops is None
|
||||
and not self.pass_config.fuse_attn_quant
|
||||
):
|
||||
return True
|
||||
|
||||
kv_cache_update_ops = [
|
||||
"vllm::unified_kv_cache_update",
|
||||
"vllm::unified_mla_kv_cache_update",
|
||||
]
|
||||
return self.splitting_ops is not None and all(
|
||||
op in self.splitting_ops for op in kv_cache_update_ops
|
||||
)
|
||||
|
||||
def is_attention_compiled_piecewise(self) -> bool:
|
||||
if not self.splitting_ops_contain_attention():
|
||||
return False
|
||||
|
||||
Reference in New Issue
Block a user