Skip to content

Conversation

@juncaipeng
Copy link
Collaborator

@juncaipeng juncaipeng commented Dec 11, 2025

Motivation

多个p 服务需要区分发送 kv signal 的管道

Modifications

管道标记使用INFERENCE_MSG_QUEUE_ID

Usage or Command

不变

Accuracy Tests

单侧覆盖

Checklist

  • Add at least a tag in the PR title.
    • Tag list: [[FDConfig],[APIServer],[Engine], [Scheduler], [PD Disaggregation], [Executor], [Graph Optimization], [Speculative Decoding], [RL], [Models], [Quantization], [Loader], [OP], [KVCache], [DataProcessor], [BugFix], [Docs], [CI], [Optimization], [Feature], [Benchmark], [Others], [XPU], [HPU], [GCU], [DCU], [Iluvatar], [Metax]]
    • You can add new tags based on the PR content, but the semantics must be clear.
  • Format your code, run pre-commit before commit.
  • Add unit tests. Please write the reason in this PR if no unit tests.
  • Provide accuracy results.
  • If the current PR is submitting to the release branch, make sure the PR has been submitted to the develop branch, then cherry-pick it to the release branch with the [Cherry-Pick] PR tag.

Copilot AI review requested due to automatic review settings December 11, 2025 12:58
@paddle-bot
Copy link

paddle-bot bot commented Dec 11, 2025

Thanks for your contribution!

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

本PR的目的是为PD分离架构中的多个P服务提供区分KV信号发送管道的能力。之前的实现使用 1024 + rank 作为消息队列ID,现在改为使用环境变量 INFERENCE_MSG_QUEUE_ID 来配置,默认值为1。

主要变更:

  • 移除了基于rank的固定消息队列ID计算方式 (1024 + rank)
  • 引入环境变量 INFERENCE_MSG_QUEUE_ID 来动态配置消息队列ID
  • 统一了XPU和GPU实现中的消息队列ID获取逻辑

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 9 comments.

File Description
custom_ops/xpu_ops/src/ops/remote_cache_kv_ipc.h 将消息队列ID的计算从 1024 + rank 改为从环境变量 INFERENCE_MSG_QUEUE_ID 读取,默认值为1
custom_ops/xpu_ops/src/ops/get_output.cc 同样修改消息队列ID的获取方式,并修复了代码缩进格式
custom_ops/gpu_ops/remote_cache_kv_ipc.h GPU版本的消息队列ID获取方式更新,与XPU版本保持一致
custom_ops/gpu_ops/get_output_ep.cc 更新GetOutputKVSignal函数的消息队列ID获取方式,并统一了代码格式

@codecov-commenter
Copy link

codecov-commenter commented Dec 11, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (develop@510b821). Learn more about missing BASE report.

Additional details and impacted files
@@            Coverage Diff             @@
##             develop    #5514   +/-   ##
==========================================
  Coverage           ?   60.42%           
==========================================
  Files              ?      329           
  Lines              ?    41088           
  Branches           ?     6262           
==========================================
  Hits               ?    24828           
  Misses             ?    14372           
  Partials           ?     1888           
Flag Coverage Δ
GPU 60.42% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

static struct msgdatakv msg_rcv;
static key_t key = ftok("/opt/", msg_queue_id);
static int msgid = msgget(key, IPC_CREAT | 0666);
int msg_queue_id = 1;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

只修改此处

static struct msgdatakv msg_rcv;
static key_t key = ftok("/opt/", msg_queue_id);
static int msgid = msgget(key, IPC_CREAT | 0666);
int msg_queue_id = 1024;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

只修改此处,其他都是format格式化

@Jiang-Jia-Jun Jiang-Jia-Jun merged commit d67388a into PaddlePaddle:develop Dec 12, 2025
16 of 17 checks passed
@juncaipeng juncaipeng deleted the fix_2p_1 branch December 12, 2025 06:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants