Perf/minimax h3 dit swiglu rope cache npu (#6410)
Signed-off-by: Wenjia Li <wjialish@gmail.com> Co-authored-by: WeiQing Chen <40507679+david6666666@users.noreply.github.com>
This commit is contained in:
1 parent
bb5bf8fd0a
commit
d9980c75e8
11 files changed
+920
-33
No files matched your search
+10
-1
@@ -138,7 +138,16 @@ class TeaCacheHook(ModelHook):
|
||||
state = self.state_manager.get_state()
|
||||
|
||||
# Decide whether to compute or cache based on modulated input similarity
|
||||
should_compute = self._should_compute_full_transformer(state, ctx.modulated_input)
|
||||
local_should_compute = self._should_compute_full_transformer(state, ctx.modulated_input)
|
||||
sync_cache_decision = (ctx.extra_states or {}).get("synchronize_cache_decision")
|
||||
if sync_cache_decision is not None:
|
||||
should_compute = sync_cache_decision(local_should_compute)
|
||||
# A rank that locally chose the cache path must reset its counter
|
||||
# when another SP rank requires a full collective block execution.
|
||||
if should_compute and not local_should_compute:
|
||||
state.accumulated_rel_l1_distance = 0.0
|
||||
else:
|
||||
should_compute = local_should_compute
|
||||
|
||||
if not should_compute and state.previous_residual is not None:
|
||||
# ============================================================================
|
||||
|
||||
Reference in new issue
Block a user