Pull Request has been successfully merged by CANN-robot.
(Thank you for 可惜春残风雨又's contribution.)变更摘要
本 PR 为机器侧(machine)的 host 控制流缓存(ctrlflow cache)增加 JIT 场景支持:当检测到 value-depend 但相关张量均配置了 CPU 版本(通过 ready_on_host_tensors 指定 [device_name, cpu_name] 配对)时,不再因 disableCtrlFlowCache 跳过缓存构建,而是在模拟执行中把设备张量地址替换为对应 CPU 张量地址后继续构建。为此,ready_on_host_tensors 配置项新增 list[list[string]] 配置形式,并配套扩展了配置解析/校验、Python 绑定、schema 描述及 DyndevFunctionAttribute、DevAscendProgram 等数据结构字段。
主要改动
-
配置项支持双层列表形式:
config_manager_ng.cpp为runtime.ready_on_host_tensors增加std::vector<std::vector<std::string>>的类型名映射(list[list[string]])、类型校验豁免及SetOptionsNg模板实例化;controller.cpp的ConvertPyList支持解析[device_name, cpu_name]形式的双层列表,并对内层长度、元素类型等非法输入抛出type_error;tile_fwk_config_schema.json的配置描述同步更新。 -
新增数据结构字段:
DyndevFunctionAttribute新增readyOnHostCpuPairs(std::vector<std::pair<std::string, std::string>>)字段,DevAscendProgram结构体新增readyOnHostAllCpu字段,用于记录并传递 value-depend 张量的 CPU 配对信息。 -
解析与标记逻辑:
backend.cpp的GetReadyOnHostTensorsSet重写为同时支持list[string]与list[list[string]]两种形式,配对形式会同时校验 device 与 cpu 张量存在性并填充readyOnHostCpuPairs;SetDyndevProgBinary在存在 CPU 配对时置位devProg->readyOnHostAllCpu。 -
host 控制流缓存构建行为调整:
kernel_binary.cpp的DisableHostCtrlFlowCacheBuild改为仅在 value-depend 且并非所有张量都有 CPU 版本时返回跳过;emulation_launcher.cpp在readyOnHostAllCpu置位时继续构建缓存,并在BuildControlFlowCache中建立设备张量索引到 CPU 张量地址的映射,用 CPU 地址替代CONTROL_FLOW_CACHE_BASE_ADDR分配的地址。 -
补充类型错误测试用例:
test_config_options_type_error.py新增针对内层列表长度、元素类型及混合形式的错误消息断言用例。


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.
You can self-configure the PR merge rules for this repository. For more details, please refer to Here.
For more, you also can visit HICANN.
PR Approval Progress
✅ Congratulations! All modules have met the lgtm and approve requirements.
Module Approval Details
| module | lgtm status | approve status |
|---|---|---|
| framework/src/interface/configs | ✅ 尹杰, gaoxingwang (2/2) | ✅ 尹杰 (1/1) |
| framework/src/interface/function | ✅ 尹杰, gaoxingwang (2/2) | ✅ 尹杰 (1/1) |
| framework/src/interface/tensor | ✅ 尹杰, gaoxingwang (2/2) | ✅ 尹杰 (1/1) |
| framework/src/machine | ✅ 尹杰, gaoxingwang (2/2) | ✅ 尹杰 (1/1) |
| repo-cann/pypto | ✅ 尹杰, gaoxingwang (2/2) | ✅ 尹杰 (1/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
qq_52905393, thanks for your pull request. All authors of the commits have signed the CLA. 👍


/approve


The MR can not be merged, because of CodeReview discussion not resolved
If you want to solve this problem, you can click here to do it in the FAQs.


1、支持通过 jit ready_on_host_tensors 配置 npu_name: cpu_name 传入配对关系,算子 kernel 传入值依赖 tensor 对应的 cpu tensor
2、支持传入值依赖 tensor 场景下在 host 侧做 controlflow cache