FT_DSP.gitlink.net/master/html/refdoc/dsplib_description.html

197 lines
13 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html class="writer-html5" lang="zh-CN">
<head>
<meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>DSP算子C接口命名规范 &mdash; MindSpore Signal+ 使用手册 alpha 文档</title>
<link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=03e43079" />
<link rel="stylesheet" type="text/css" href="../_static/css/theme.css?v=e59714d7" />
<link rel="stylesheet" type="text/css" href="../_static/table.css?v=72b86d3e" />
<link rel="stylesheet" type="text/css" href="../_static/pageviews.css?v=ff0ce7dc" />
<script src="../_static/jquery.js?v=5d32c60e"></script>
<script src="../_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
<script data-url_root="../" id="documentation_options" src="../_static/documentation_options.js?v=595569a8"></script>
<script src="../_static/doctools.js?v=888ff710"></script>
<script src="../_static/sphinx_highlight.js?v=4825356b"></script>
<script src="../_static/translations.js?v=beaddf03"></script>
<script src="../_static/table.js?v=99ed15ba"></script>
<script src="../_static/js/theme.js"></script>
<link rel="index" title="索引" href="../genindex.html" />
<link rel="search" title="搜索" href="../search.html" />
<link rel="next" title="官方资料" href="mindspore.html" />
<link rel="prev" title="参考资料" href="index.html" />
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search" >
<a href="../index.html" class="icon icon-home">
MindSpore Signal+ 使用手册
</a>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="../search.html" method="get">
<input type="text" name="q" placeholder="搜索文档" aria-label="搜索文档" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="导航菜单">
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../quickstart/index.html">快速入门</a></li>
<li class="toctree-l1"><a class="reference internal" href="../appdevelop/index.html">应用开发示例</a></li>
<li class="toctree-l1"><a class="reference internal" href="../functionlib/index.html">算子库支持</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="index.html">参考资料</a><ul class="current">
<li class="toctree-l2 current"><a class="current reference internal" href="#">DSP算子C接口命名规范</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#id1">1. 基本原则</a></li>
<li class="toctree-l3"><a class="reference internal" href="#id2">2. 具体命名示例</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#id3">2.1 加法算子</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="#id4">3. 其他注意事项</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="mindspore.html">官方资料</a></li>
<li class="toctree-l2"><a class="reference internal" href="signal_scheduling.html">MindSpore Signal+ 调度方案</a></li>
</ul>
</li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="移动版导航菜单" >
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="../index.html">MindSpore Signal+ 使用手册</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="页面导航">
<ul class="wy-breadcrumbs">
<li><a href="../index.html" class="icon icon-home" aria-label="Home"></a></li>
<li class="breadcrumb-item"><a href="index.html">参考资料</a></li>
<li class="breadcrumb-item active">DSP算子C接口命名规范</li>
<li class="wy-breadcrumbs-aside">
<a href="../_sources/refdoc/dsplib_description.md.txt" rel="nofollow"> 查看页面源码</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<section id="dspc">
<h1>DSP算子C接口命名规范<a class="headerlink" href="#dspc" title="此标题的永久链接"></a></h1>
<p>DSP算子C接口命名规范是为了提高代码的可读性和可维护性确保所有DSP算子的函数名称都遵循一定的规则和格式。以下是具体的命名规范</p>
<section id="id1">
<h2>1. 基本原则<a class="headerlink" href="#id1" title="此标题的永久链接"></a></h2>
<ul class="simple">
<li><p><strong>清晰明了</strong>:函数名应清晰地反映其功能或用途。</p></li>
<li><p><strong>一致性</strong>:所有函数名应遵循相同的命名规则,以保持代码的一致性。</p></li>
<li><p><strong>简洁</strong>:避免冗长的命名,但同时要确保足够的信息量。</p></li>
<li><p><strong>蛇形命名</strong>使用小写字母和下划线_分隔单词例如 <code class="docutils literal notranslate"><span class="pre">xxx_xxx_xxx</span></code></p></li>
<li><p><strong>数据类型开头</strong>:函数名算子的数据类型开始,描述该算子是什么数据类型的算子,以第一个输入数据类型确定算子的数据类型算子;例如 <code class="docutils literal notranslate"><span class="pre">fp_xxx_xxx</span></code><code class="docutils literal notranslate"><span class="pre">dp_xxx_xxx</span></code> 等。各个数据类型算子命名规则如下:</p>
<ul>
<li><p><code class="docutils literal notranslate"><span class="pre">hp</span></code>:半精度浮点数算子(float16)</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">fp</span></code>:浮点数算子(float32)</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">dp</span></code>:双精度浮点数算子(float64)</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">i32</span></code>32位整数算子(int32)</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">i16</span></code>16位整数算子(int16)</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">i8</span></code>8位整数算子(int8)</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">c64</span></code>64位复数算子(complex64)</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">c128</span></code>128位复数算子(complex128)</p></li>
</ul>
</li>
<li><p><strong>算子名字在中间</strong>:函数名算子的名字在中间,描述该算子是什么功能的。例如 <code class="docutils literal notranslate"><span class="pre">xxx_add_xxx</span></code><code class="docutils literal notranslate"><span class="pre">xxx_mul_xxx</span></code> 等。</p></li>
<li><p><strong>存储空间类型结尾</strong>:函数名算子的存储空间类型结尾,描述该算子是在共享或者私有存储空间上操作的;其中<code class="docutils literal notranslate"><span class="pre">_s</span></code> 结尾是共享存储版本,<code class="docutils literal notranslate"><span class="pre">_p</span></code> 结尾是私有存储版本;例如 <code class="docutils literal notranslate"><span class="pre">xxx_xxx_s</span></code><code class="docutils literal notranslate"><span class="pre">xxx_xxx_p</span></code> 等。</p></li>
</ul>
</section>
<section id="id2">
<h2>2. 具体命名示例<a class="headerlink" href="#id2" title="此标题的永久链接"></a></h2>
<section id="id3">
<h3>2.1 加法算子<a class="headerlink" href="#id3" title="此标题的永久链接"></a></h3>
<ul class="simple">
<li><p><strong>共享存储</strong></p>
<ul>
<li><p><code class="docutils literal notranslate"><span class="pre">fp_add_s</span></code> - 表示这是一个在浮点数上操作的加法算子的共享存储版本。</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">hp_add_s</span></code> - 表示这是一个在半精度浮点数上操作的加法算子的共享存储版本。</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">dp_add_s</span></code> - 表示这是一个在双精度浮点数上操作的加法算子的共享存储版本。</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">i16_add_s</span></code> - 表示这是一个在16位整数上操作的加法算子的共享存储版本。</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">i32_add_s</span></code> - 表示这是一个在32位整数上操作的加法算子的共享存储版本。</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">i8_add_s</span></code> - 表示这是一个在8位整数上操作的加法算子的共享存储版本。</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">c64_add_s</span></code> - 表示这是一个在复数64位上操作的加法算子的共享存储版本。</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">c128_add_s</span></code> - 表示这是一个在复数128位上操作的加法算子的共享存储版本。</p></li>
</ul>
</li>
<li><p><strong>私有存储</strong></p>
<ul>
<li><p><code class="docutils literal notranslate"><span class="pre">fp_add_p</span></code> - 表示这是一个在浮点数上操作的加法算子的私有存储版本。</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">hp_add_p</span></code> - 表示这是一个在半精度浮点数上操作的加法算子的私有存储版本。</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">dp_add_p</span></code> - 表示这是一个在双精度浮点数上操作的加法算子的私有存储版本。</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">i16_add_p</span></code> - 表示这是一个在16位整数上操作的加法算子的私有存储版本。</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">i32_add_p</span></code> - 表示这是一个在32位整数上操作的加法算子的私有存储版本。</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">i8_add_p</span></code> - 表示这是一个在8位整数上操作的加法算子的私有存储版本。</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">c64_add_p</span></code> - 表示这是一个在复数64位上操作的加法算子的私有存储版本。</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">c128_add_p</span></code> - 表示这是一个在复数128位上操作的加法算子的私有存储版本。</p></li>
</ul>
</li>
</ul>
</section>
</section>
<section id="id4">
<h2>3. 其他注意事项<a class="headerlink" href="#id4" title="此标题的永久链接"></a></h2>
<div class="admonition note">
<p class="admonition-title">备注</p>
<p>对于复合操作,如同时涉及多功能的算子,可以在函数名中适当增加描述性词汇,例如 <code class="docutils literal notranslate"><span class="pre">xxx_add_sub_xxx</span></code> 可以表示一个先加后减的算子。</p>
</div>
</section>
</section>
</div>
</div>
<footer><div class="rst-footer-buttons" role="navigation" aria-label="页脚">
<a href="index.html" class="btn btn-neutral float-left" title="参考资料" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> 上一页</a>
<a href="mindspore.html" class="btn btn-neutral float-right" title="官方资料" accesskey="n" rel="next">下一页 <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
</div>
<hr/>
<div role="contentinfo">
<p>&#169; 版权所有 2025 - 2026, NUDT-674。</p>
</div>
利用 <a href="https://www.sphinx-doc.org/">Sphinx</a> 构建,使用的
<a href="https://github.com/readthedocs/sphinx_rtd_theme">主题</a>
<a href="https://readthedocs.org">Read the Docs</a> 开发.
</footer>
</div>
</div>
</section>
</div>
<script>
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
<script src="//cdn.busuanzi.cc/busuanzi/3.6.9/busuanzi.min.js" defer></script>
</body>
</html>