forked from FT_DSP/FT_DSP.gitlink.net
Add DSP operator c interface naming specification doc
This commit is contained in:
parent
14d1419b79
commit
c22b773175
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -0,0 +1,48 @@
|
|||
# DSP算子C接口命名规范
|
||||
|
||||
DSP算子C接口命名规范是为了提高代码的可读性和可维护性,确保所有DSP算子的函数名称都遵循一定的规则和格式。以下是具体的命名规范:
|
||||
|
||||
## 1. 基本原则
|
||||
- **清晰明了**:函数名应清晰地反映其功能或用途。
|
||||
- **一致性**:所有函数名应遵循相同的命名规则,以保持代码的一致性。
|
||||
- **简洁**:避免冗长的命名,但同时要确保足够的信息量。
|
||||
- **蛇形命名**:使用小写字母和下划线(_)分隔单词,例如 `xxx_xxx_xxx`。
|
||||
- **数据类型开头**:函数名算子的数据类型开始,描述该算子是什么数据类型的算子,以第一个输入数据类型确定算子的数据类型算子;例如 `fp_xxx_xxx`、`dp_xxx_xxx` 等。各个数据类型算子命名规则如下:
|
||||
- `hp`:半精度浮点数算子(float16)
|
||||
- `fp`:浮点数算子(float32)
|
||||
- `dp`:双精度浮点数算子(float64)
|
||||
- `i32`:32位整数算子(int32)
|
||||
- `i16`:16位整数算子(int16)
|
||||
- `i8`:8位整数算子(int8)
|
||||
- `c64`:64位复数算子(complex64)
|
||||
- `c128`:128位复数算子(complex128)
|
||||
- **算子名字在中间**:函数名算子的名字在中间,描述该算子是什么功能的。例如 `xxx_add_xxx`、`xxx_mul_xxx` 等。
|
||||
- **存储空间类型结尾**:函数名算子的存储空间类型结尾,描述该算子是在共享或者私有存储空间上操作的;其中`_s` 结尾是共享存储版本,`_p` 结尾是私有存储版本;例如 `xxx_xxx_s`、`xxx_xxx_p` 等。
|
||||
|
||||
## 2. 具体命名示例
|
||||
|
||||
### 2.1 加法算子
|
||||
- **共享存储**:
|
||||
- `fp_add_s` - 表示这是一个在浮点数上操作的加法算子的共享存储版本。
|
||||
- `hp_add_s` - 表示这是一个在半精度浮点数上操作的加法算子的共享存储版本。
|
||||
- `dp_add_s` - 表示这是一个在双精度浮点数上操作的加法算子的共享存储版本。
|
||||
- `i16_add_s` - 表示这是一个在16位整数上操作的加法算子的共享存储版本。
|
||||
- `i32_add_s` - 表示这是一个在32位整数上操作的加法算子的共享存储版本。
|
||||
- `i8_add_s` - 表示这是一个在8位整数上操作的加法算子的共享存储版本。
|
||||
- `c64_add_s` - 表示这是一个在复数(64位)上操作的加法算子的共享存储版本。
|
||||
- `c128_add_s` - 表示这是一个在复数(128位)上操作的加法算子的共享存储版本。
|
||||
- **私有存储**:
|
||||
- `fp_add_p` - 表示这是一个在浮点数上操作的加法算子的私有存储版本。
|
||||
- `hp_add_p` - 表示这是一个在半精度浮点数上操作的加法算子的私有存储版本。
|
||||
- `dp_add_p` - 表示这是一个在双精度浮点数上操作的加法算子的私有存储版本。
|
||||
- `i16_add_p` - 表示这是一个在16位整数上操作的加法算子的私有存储版本。
|
||||
- `i32_add_p` - 表示这是一个在32位整数上操作的加法算子的私有存储版本。
|
||||
- `i8_add_p` - 表示这是一个在8位整数上操作的加法算子的私有存储版本。
|
||||
- `c64_add_p` - 表示这是一个在复数(64位)上操作的加法算子的私有存储版本。
|
||||
- `c128_add_p` - 表示这是一个在复数(128位)上操作的加法算子的私有存储版本。
|
||||
|
||||
## 3. 其他注意事项
|
||||
```{note}
|
||||
对于复合操作,如同时涉及多功能的算子,可以在函数名中适当增加描述性词汇,例如 `xxx_add_sub_xxx` 可以表示一个先加后减的算子。
|
||||
```
|
||||
|
||||
|
|
@ -4,7 +4,7 @@
|
|||
.. toctree::
|
||||
:maxdepth: 1
|
||||
|
||||
|
||||
dsplib_description
|
||||
mindspore
|
||||
signal_scheduling
|
||||
|
||||
|
|
|
|||
|
|
@ -98,6 +98,7 @@
|
|||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="refdoc/index.html">参考资料</a><ul>
|
||||
<li class="toctree-l2"><a class="reference internal" href="refdoc/dsplib_description.html">DSP算子C接口命名规范</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="refdoc/mindspore.html">官方资料</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="refdoc/signal_scheduling.html">MindSpore Signal+ 调度方案</a></li>
|
||||
</ul>
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -0,0 +1,191 @@
|
|||
|
||||
|
||||
<!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接口命名规范 — 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" />
|
||||
|
||||
|
||||
<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>© 版权所有 2025 - 2025, 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>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -22,7 +22,7 @@
|
|||
<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="next" title="DSP算子C接口命名规范" href="dsplib_description.html" />
|
||||
<link rel="prev" title="Log10" href="../functionlib/dsplib/log10.html" />
|
||||
</head>
|
||||
|
||||
|
|
@ -50,6 +50,7 @@
|
|||
<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="current reference internal" href="#">参考资料</a><ul>
|
||||
<li class="toctree-l2"><a class="reference internal" href="dsplib_description.html">DSP算子C接口命名规范</a></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>
|
||||
|
|
@ -84,6 +85,7 @@
|
|||
<h1>参考资料<a class="headerlink" href="#id1" title="此标题的永久链接"></a></h1>
|
||||
<div class="toctree-wrapper compound">
|
||||
<ul>
|
||||
<li class="toctree-l1"><a class="reference internal" href="dsplib_description.html">DSP算子C接口命名规范</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="mindspore.html">官方资料</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="signal_scheduling.html">MindSpore Signal+ 调度方案</a></li>
|
||||
</ul>
|
||||
|
|
@ -95,7 +97,7 @@
|
|||
</div>
|
||||
<footer><div class="rst-footer-buttons" role="navigation" aria-label="页脚">
|
||||
<a href="../functionlib/dsplib/log10.html" class="btn btn-neutral float-left" title="Log10" 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>
|
||||
<a href="dsplib_description.html" class="btn btn-neutral float-right" title="DSP算子C接口命名规范" accesskey="n" rel="next">下一页 <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
|
||||
</div>
|
||||
|
||||
<hr/>
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue