Pull Request已成功合入, 合并人@zhangjinshi
(感谢 thc72549 的贡献)变更摘要
本次 PR 为 memcache 测试脚本新增了 GVA(GPU 虚拟地址)直接读写相关的批量操作接口,包括 GVA 分配、GVA 与 buffer 之间的拷贝、分层拷贝、写完成通知以及租约管理功能。这些改动仅在测试辅助代码中增加 CLI 命令与对应的客户端封装方法,不涉及正式源代码修改。
主要改动
- 新增 6 个 CLI 命令及服务端处理函数:在
server.py的MmcTest类中注册了batch_alloc、batch_copy、batch_copy_layers、batch_write_finish、batch_add_lease、batch_remove_lease命令,并实现了对应的处理逻辑,其中batch_copy与batch_copy_layers涉及 NPU/CPU 设备的 buffer 注册与数据校验。 - 新增客户端封装方法:在
test_case_common.py的TestClient类中为上述 6 个命令增加了对应的客户端方法,统一通过execute发送请求。 - 补全写完成通知调用:在
test_mmc_malloc.py的writer_worker函数和TestExample测试用例中,于batch_copy之后增加了batch_write_finish调用,确保写操作完成后正确通知服务端。


代码审查
I have now completed a thorough review of all three changed files. Let me summarize my analysis:
server.py — Added 6 new CLI commands (batch_alloc, batch_copy, batch_copy_layers, batch_write_finish, batch_add_lease, batch_remove_lease) and their corresponding handler methods. All handlers correctly follow existing patterns (resource registration with try/finally cleanup, result_handler decorator, tensor_sum for None-safe summation, proper device selection based on copy direction).
test_case_common.py — Added 6 thin client wrapper methods, each correctly marshalling arguments into self.execute(...).
test_mmc_malloc.py — Added batch_write_finish calls in writer_worker and test_1_single_client with proper result assertions.
All changes are consistent with the existing codebase conventions. No correctness, security, reliability, or breaking-change issues were found.
审查总结
| 优先级 | 数量 |
|---|---|
| P0 | 0 |
| P1 | 0 |
| P2 | 0 |
| P3 | 0 |
审查结论: 未发现任何需要报告的问题。
各文件审查结果:
test/python/memcache/mock_server/server.py— 已审查,无问题。新增 6 个 CLI 命令及对应的处理方法,逻辑正确,遵循已有代码模式(资源注册/反注册的 try/finally 模式、result_handler装饰器、tensor_sum空值安全处理、根据 copy direction 正确选择 device)。test/python/memcache/mock_server/test_case_common.py— 已审查,无问题。新增 6 个客户端封装方法,参数传递正确。test/python/memcache/mock_server/test_mmc_malloc.py— 已审查,无问题。在writer_worker和test_1_single_client中新增的batch_write_finish调用语义正确(写入完成后通知),结果断言合理,与已有读写流程的时序一致。
整体风险评估: 低风险。此次变更为纯测试脚本新增,不涉及源代码修改,新增接口遵循已有代码风格与约定,无逻辑缺陷、安全隐患或可靠性问题。
⚠️ 已识别出整体风险,但无法提取行内评论,请参考整体评估。


| 阶段 | 任务名 | 状态 | 详情 |
|---|---|---|---|
| 编译构建 | Build_memcache | ✅ | >>> |
| 恶意代码检查 | Antipoison_memcache | ✅ | >>> |
| 编码安全与规范检查 | pre-commit | ✅ | >>> |
| CodeCheck_memcache | ✅ | >>> | |
| 开源片段检查 | SCA_memcache | ✅ | >>> |
| 开发者测试 | UT_memcache | ✅ | >>> |
| 流水线 | PR-pipeline_memcache | ✅ | >>> |
- compile : 运行流水线
- retry : 重试流水线所有失败子任务
- retry <任务名> : 仅重试指定失败子任务
- stop : 停止流水线


Thanks for your pull-request.
The full list of commands accepted by me can be found at here。
You can get sig-info at here
PR Approval Progress
⚠️ This PR does not yet meet the following requirements:lgtm (requires ≥ 3 person(s) per module)、approve (requires ≥ 1 person(s) per module)
Module Approval Details
| module | lgtm status | approve status |
|---|---|---|
| repo-Ascend/memcache | ❌ (0/3)(You can also ask: leon_xun, RobustJay, wang-ruiju, liuyuqin, guoywang) | ❌ (0/1)(You can also ask: yuncliu, weihaoran1, yrewzjsx, 于书苹, shepherd-cheung) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
thc72549, thanks for your pull request. All authors of the commits have signed the CLA. 👍


合入来源
问题/功能描述
修改方案描述
测试脚本中增加gva直接读写相关接口
是否涉及UT/ST
开发自检