Skip to content

Commit 0a5b075

Browse files
Merge pull request #109 from raindaywhu/dev_whq_eplb1
add function take_update_info_from_eplb_process
2 parents d79ace8 + 9b32ca4 commit 0a5b075

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

vllm_ascend/eplb/eplb_updator.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,6 @@ def wakeup_eplb_worker(self):
118118
self.planner_block_queue.put(1)
119119

120120
def forward_before(self):
121-
# Batch after eplb process being triggered, get update info provided by eplb process
122-
if self.get_update_info_flag():
123-
self.update_info_all = self.block_update_queue.get()
124-
125121
if self.update_expert_weight_flag():
126122
(expert_send_info, expert_recv_info, updated_expert_map, log2phy_map, layer_id) = self.update_info_all.pop(0)
127123
rank_id = torch.distributed.get_rank()
@@ -137,6 +133,12 @@ def forward_before(self):
137133
self.reqs = []
138134
self.eplb_loader.asyn_expert_weight_transfer(self.reqs)
139135

136+
def take_update_info_from_eplb_process(self):
137+
# Batch after eplb process being triggered, get update info provided by eplb process
138+
if self.get_update_info_flag():
139+
self.update_info_all = self.block_update_queue.get()
140+
141+
140142
def forward_end(self):
141143
if self.wakeup_eplb_worker_flag():
142144
moe_load = self.compute_and_set_moe_load(is_clear=True)

vllm_ascend/worker/model_runner_v1.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1246,6 +1246,9 @@ def execute_model(
12461246
sample_indices) = (self._process_reqs(scheduler_output,
12471247
intermediate_tensors))
12481248

1249+
if self.dynamic_eplb:
1250+
self.eplb_updator.take_update_info_from_eplb_process()
1251+
12491252
with ProfileExecuteDuration().capture_async("post process"):
12501253
logits = self.model.compute_logits(hidden_states[sample_indices],
12511254
None)
@@ -1547,6 +1550,7 @@ def _dummy_run(
15471550
if is_profile_run and self.dynamic_eplb:
15481551
self.model.clear_all_moe_loads()
15491552
if not is_compile and not is_profile_run and self.dynamic_eplb:
1553+
self.eplb_updator.take_update_info_from_eplb_process()
15501554
self.eplb_updator.forward_end()
15511555
return hidden_states
15521556

0 commit comments

Comments
 (0)