news 2026/7/15 9:22:29

CANN / hcomm 实验性NIC插件指南

作者头像

张小明

前端开发工程师

1.2k 24
文章封面图
CANN / hcomm 实验性NIC插件指南

HCOMM Experimental NIC Plugin Guide

【免费下载链接】hcommHCOMM(Huawei Communication)是HCCL的通信基础库,提供通信域以及通信资源的管理能力。项目地址: https://gitcode.com/cann/hcomm

Overview

The HCOMM Experimental NIC Plugin extends the host-side NIC communication implementation in general server scenarios. The plugin is built and deployed as an independent.sofile. When creating a HOST endpoint or channel, HCOMM searches for registered plugins based onEndpointDesc.protocol. If a matching plugin protocol is found, the plugin implementation is used. Otherwise, the original built-in implementation is used.

This directory provides two example plugins:

PluginArtifactRegistered Protocol
HOST RoCE pluginlibhcomm_cpu_roce_plugin.soCOMM_PROTOCOL_ROCE
HOST UB pluginlibhcomm_cpu_ub_plugin.soCOMM_PROTOCOL_UBC_TP,COMM_PROTOCOL_UBC_CTP

Building and Packaging

Before compiling, complete the dependency installation, CANN software package installation, and environment variable configuration as described indocs/en/build/build.md.

After navigating to the repository root directory, execute the following command to compile the host package with experimental plugins enabled:

bash build.sh --pkg --experimental

To compile both the host and device packages:

bash build.sh --pkg --full --experimental

If the compilation environment does not have network access, download the third-party dependency packages in a networked environment, upload them to the compilation environment, and specify the dependency package path using--cann_3rd_lib_path:

bash build.sh --pkg --experimental --cann_3rd_lib_path={your_3rd_party_path}

After compilation, the HCOMM software package is generated in thebuild_outdirectory at the repository root:

./build_out/cann-hcomm_<version>_linux-<arch>.run

<version>is the software version number, and<arch>is the system architecture, for example,x86_64oraarch64.

Installation and Deployment

Install the compiled HCOMM software package:

bash ./build_out/cann-hcomm_<version>_linux-<arch>.run --full

Replace the package name in the command with the actual generated file name. After installation, the experimental plugins are installed in the HCOMM plugin directory:

${ASCEND_HOME_PATH}/hcomm_plugin/libhcomm_cpu_roce_plugin.so ${ASCEND_HOME_PATH}/hcomm_plugin/libhcomm_cpu_ub_plugin.so

For manual debugging, you can also copy the plugin.sofiles directly to the${ASCEND_HOME_PATH}/hcomm_plugin/directory.

Signature Verification Notes

Host-only plugin usage does not involve device package signature verification. If you compile and install the--fullpackage and run on-board tests, refer todocs/en/build/build.mdfor the steps to disable signature verification.

Enabling at Runtime

Before running, load the CANN or HCOMM environment variables. For the default installation path, execute:

source /usr/local/Ascend/cann/set_env.sh

For a specified installation path, execute:

source ${install_path}/cann/set_env.sh

The plugin loading rules are as follows:

  • WhenASCEND_HOME_PATHis not empty, HCOMM scans${ASCEND_HOME_PATH}/hcomm_plugin/*.so.
  • WhenASCEND_HOME_PATHis empty, HCOMM reads the plugin path specified byHCOMM_NIC_PLUGIN_SO.
  • HCOMM_NIC_PLUGIN_SOsupports multiple.sopaths separated by colons.

Example:

export HCOMM_NIC_PLUGIN_SO=/path/to/libhcomm_cpu_roce_plugin.so:/path/to/libhcomm_cpu_ub_plugin.so

Business code does not need to call plugin interfaces directly. When HCOMM creates a HOST endpoint throughHcommEndpointCreate, it searches for plugins based onEndpointDesc.protocol. If the protocol is registered by a plugin, subsequent endpoint, channel, and data plane interfaces are dispatched to the pluginops. If no matching plugin is found, the original built-in path is used.

Usage Conditions and Limitations

  • The plugin only applies to endpoints whereEndpointDesc.loc.locType == ENDPOINT_LOC_TYPE_HOST.
  • The current example plugins target general server host-only scenarios.
  • The current loader skips plugin loading when it detects that the number of runtime devices is non-zero.
  • When multiple plugins register the same protocol, the later-loaded plugin overrides the earlier one.
  • The plugin ABI must match the magic word, version, and size defined inHcommNicPluginInfo,HcommNicEndpointOps, andHcommNicChannelOps.

Custom Plugin Development Entry Points

Custom plugins need to export the following C ABI symbols:

const HcommNicPluginInfo *HcommNicPluginGetInfo(void); int32_t HcommNicPluginCreateEndpoint( const EndpointDesc *endpointDesc, void **outCtx, HcommNicEndpointOps **outOps); int32_t HcommNicPluginCreateChannel( void *epCtx, const HcommChannelDesc *channelDesc, void **outCtx, HcommNicChannelOps **outOps);

Development requirements:

  • Declare the plugin name and supportedCommProtocolinHcommNicPluginInfo.
  • FillHcommNicEndpointOpsfor the endpoint, implementing interfaces such as initialization, memory registration, export, import, and destroy.
  • FillHcommNicChannelOpsfor the channel, implementing interfaces such as initialization, status query, read, write, notify, fence, and destroy.
  • Ensure the magic word, version, and size in the ABI header match the definitions inhcomm_nic_plugin.h.

For reference, see the following files:

  • host_roce_plugin.cc: HOST RoCE plugin entry point.
  • host_ub_plugin.cc: HOST UB plugin entry point.
  • nic_plugin_ops.h: Example plugin ops adaptation template.
  • plugin_core.cc: Plugin common auxiliary logic.

Troubleshooting

If the plugin does not take effect, check the following items in order:

  1. Confirm that--experimentalwas added during the build and that the plugin.sois included in the software package.
  2. Confirm that the plugin.sois installed in${ASCEND_HOME_PATH}/hcomm_plugin/.
  3. Confirm thatASCEND_HOME_PATHorHCOMM_NIC_PLUGIN_SOis set according to the current loading rules.
  4. Confirm that the business creates a HOST endpoint, that is,EndpointDesc.loc.locType == ENDPOINT_LOC_TYPE_HOST.
  5. Confirm thatEndpointDesc.protocolis registered in the pluginHcommNicPluginInfo.protocols.
  6. Check the runtime log for the[NicPlugin]keyword to see whether the plugin was scanned, loaded, and its protocol registered.

【免费下载链接】hcommHCOMM(Huawei Communication)是HCCL的通信基础库,提供通信域以及通信资源的管理能力。项目地址: https://gitcode.com/cann/hcomm

创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考

版权声明: 本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若内容造成侵权/违法违规/事实不符,请联系邮箱:809451989@qq.com进行投诉反馈,一经查实,立即删除!
网站建设 2026/7/15 9:20:51

SM320C6748-HIREL串行通信外设深度解析:I2C、UART与USB2.0 OTG寄存器级实战

1. 项目概述与核心价值在嵌入式系统开发&#xff0c;尤其是基于德州仪器&#xff08;TI&#xff09;C6000系列DSP的复杂应用中&#xff0c;深入理解芯片外设的寄存器级工作原理和电气特性&#xff0c;是驱动工程师从“能用”走向“精通”的必经之路。今天&#xff0c;我们就以T…

作者头像 李华
网站建设 2026/7/15 9:20:36

模板驱动文档自动化:从填空题到内容工业化

1. 项目概述&#xff1a;用模板把文档生产变成“填空题” 你有没有过这种体验&#xff1a;每周要交三份客户方案&#xff0c;每份结构雷同——封面、目录、痛点分析、解决方案、报价页、服务承诺——但每次都要从零新建Word、手动调格式、反复核对页眉页脚、导出PDF前还要检查一…

作者头像 李华
网站建设 2026/7/15 9:18:41

彻底解决C++运行库安装错误代码5:从原理到实战的完整指南

1. 项目概述&#xff1a;当专业软件安装遇上C运行库“拦路虎”如果你是一名设计师、建模师或工程师&#xff0c;在满怀期待地安装AutoCAD、Maya或3ds Max这类行业核心生产力工具时&#xff0c;屏幕上突然弹出一个关于“Microsoft Visual C 2010 Redistributable”或“2013 Redi…

作者头像 李华
网站建设 2026/7/15 9:18:20

CVE-2019-11043:从PATH_INFO空值到PHP-FPM内存下溢的RCE漏洞深度剖析

1. 漏洞背景与影响范围 CVE-2019-11043是一个影响PHP-FPM&#xff08;FastCGI进程管理器&#xff09;的远程代码执行漏洞。这个漏洞的核心在于Nginx与PHP-FPM交互时对 PATH_INFO 参数的处理缺陷&#xff0c;攻击者可以通过精心构造的HTTP请求触发内存下溢&#xff0c;最终实现…

作者头像 李华