This commit is contained in:
Chranos
2026-02-04 17:39:32 +08:00
parent 8511fe8530
commit 79dfc69789
299 changed files with 55927 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
SPHINXPROJ = Torch-MLU-Ops ReleaseNotes
SOURCEDIR = .
BUILDDIR = build
# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
.PHONY: help Makefile
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

View File

@@ -0,0 +1,84 @@
Release Notes写作注意事项
--------------------------------
* overview文件夹下的overview.rst用来写模块概述简单描述该模块的定义、作用等内容。
* 如果写新增版本的releasenotes请先按版本号新建文件夹比如新增了0.1.1版本,则新建文件夹并命名为 ``0.1.1``,在 ``0.1.1`` 文件夹下新建文件index.rst建议将之前版本的index.rst copy过来直接修改。
* 将新增文件添加到工程根目录下的 ``index.rst`` 主索引文件中,否则新增内容将无法包含在最终文档中。
* 按照rst语法、release notes写作规范写变更内容。
* release notes写代码的修改、变更等相关内容和文档的更新历史没直接关系。文档的“更新历史”只写与文档相关的变更。
* 执行 ``./makelatexpdf.sh`` 编译文档。
Release Notes写作规范
------------------------
**特性变更:**
如何写:
* 该章节包含新增特性、删除特性以及修改特性。新增算子、新增接口、删除算子、删除接口以及算子和接口的修改变动,都在该章节详细描述。
* 用无序列表的方式详细描述每一项内容。
* 修改部分要详细描述修改原因,修改能带来什么样的好处。 删除部分也要说明删除原因。:
举例如下:
- 新增xxx特性支持xxx视频的播放。
- 删除xxx特性因为xxx特性为临时方案目前已被YYY特性取代因此删除xxx临时特性。
- 新增x1、x2算子以支持xxx功能。
**已修复问题:**
如何写:
第一个版本的Release notes该章节无需写作。后续版本已解决的遗留问题要在该章节描述。
已修复问题至少要描述清楚两点:
1.解决了什么问题;
2.因为解决该问题做了什么样的修改。
可以按以下句式:
* 通过修改xxx修复了xxx问题
**已知遗留问题:**
如何写:
* 该章节描述在该版本还存在的问题,或者已给用户承诺的暂时未达标的规格要求。
* 如果有多个遗留问题,每个遗留问题用无序列表的方式描述,祥见下面的举例。
* 该部分内容必须包含“现象:”、“原因:”、“影响:”、“规避措施:”四个部分,可参见下面的举例。
举例如下:
* 080p分辨率以上的视频问题件无法播放。
**现象:**
详细描述出现该问题后的现象。该现象是用户可以直接看到的,不是问题本身的描述。比如:
当播放1080p以上分辨率的视频文件时会出现卡段或掉帧的现象导致视频播放失败。
**原因:**
描述出现该问题的原因,或者用户如何操作才会导致该问题,比如:
当前采用的VPU不支持1080p视频文件的播放。
**影响:**
详细说明该问题对用户可能造成的影响,比如:
该问题会导致无法播放1080p分辨率以上的视频文件。
**规避措施:**
对该问题有无规避措施。如果无规避措,直接写“无规避措施”,如果有规避措施,详细描述该问题的规避措施.比如:
无。
**注意:**
在上一版本记录的已知遗留问题,如果在当前版本依然存在,在当前版本需要继续记录。

View File

@@ -0,0 +1,5 @@
@import url("theme.css");
.wy-nav-content {
max-width: 100%;
}

View File

@@ -0,0 +1,165 @@
{
"package": [
"\\\\usepackage{amsmath}",
"\\\\usepackage[table]{xcolor}",
"\\\\usepackage{eso-pic}",
"\\\\usepackage{wallpaper}",
"%\\\\usepackage{titlesec}",
"\\\\usepackage{tocbibind}",
"% \\\\usepackage{draftwatermark}",
"\\\\usepackage{enumitem}",
"\\\\usepackage{tcolorbox}",
"\\\\usepackage{listings}",
"\\\\usepackage{framed}",
"\\\\usepackage{color}",
"\\\\usepackage{multirow}",
"% \\\\usepackage[justification=centering]{caption}"
],
"replacepackage": {
"comment": "该章节内容是为了替换现有tex里面包的配置左边为tex文件现有内容右边是替换内容。",
"\\\\usepackage{hyperref}": "\\\\usepackage[bookmarksnumbered=true]{hyperref}",
"\\\\sphinxtableofcontents":
"\\\\ThisURCornerWallPaper{1}{chapterbkpaper.pdf}\n\\\\sphinxtableofcontents",
"\\\\chapter{([\\s\\S].*)}":
"\\\\chapter{\\1}\n\\\\ThisURCornerWallPaper{1}{chapterbkpaper.pdf}",
"\\\\listoffigures": "\\\\ThisURCornerWallPaper{1}{chapterbkpaper.pdf}\n\\\\listoffigures",
"\\\\listoftables":
"\\\\newpage\n\\\\ThisURCornerWallPaper{1}{chapterbkpaper.pdf}\n\\\\listoftables",
"\\\\footnotesize\\\\raggedright\\\\printindex":
"% \\\\footnotesize\\\\raggedright\\\\printindex",
"\\\\begin{itemize}": "\\\\begin{itemize}[leftmargin=*]",
"\\\\begin{enumerate}": "\\\\begin{enumerate}[leftmargin=*]",
"\\\\setmainfont{FreeSerif}\\[[\\s\\S]*?\\]": "",
"\\\\setsansfont{FreeSans}\\[[\\s\\S]*?\\]": "",
"\\\\setmonofont{FreeMono}\\[[\\s\\S]*?\\]": "",
"Extension([\\s\\S]*?)= .otf,": "Extension = ,",
"\\\\sphinxtoprule": "\\\\hline",
"\\\\sphinxmidrule": "\\\\hline",
"\\\\sphinxbottomrule": "\\\\hline",
"\\\\sphinxhline": "\\\\hline",
"\\\\sphinxhyphen": "{sphinx:5.3.0}\\\\PYGZhy",
"\\\\begin{sphinxalltt}": "\\\\begin{sphinxVerbatim}[commandchars=\\\\\\\\\\\\{\\}]",
"\\\\end{sphinxalltt}": "\\\\end{sphinxVerbatim}",
"\\\\begin{sphinxadmonition}{note}{注解:}":
"\\\\begin{tcolorbox}[colframe={noteframecolor},colback={notebackcolor},coltitle=white,fonttitle=\\\\bfseries,title=注解:]",
"\\\\begin{sphinxadmonition}{note}{备注:}":
"\\\\begin{tcolorbox}[colframe={noteframecolor},colback={notebackcolor},coltitle=white,fonttitle=\\\\bfseries,title=注解:]",
"\\\\begin{sphinxadmonition}{warning}{警告:}":
"\\\\begin{tcolorbox}[colframe={warningframecolor},colback={warningbackcolor},coltitle=white,fonttitle=\\\\bfseries,title=警告:]",
"\\\\begin{sphinxadmonition}{tip}{小技巧:}":
"\\\\begin{tcolorbox}[colframe={noteframecolor},colback={notebackcolor},coltitle=white,fonttitle=\\\\bfseries,title=小技巧:]",
"\\\\begin{sphinxadmonition}{attention}{注意:}":
"\\\\begin{tcolorbox}[colframe={warningframecolor},colback={warningbackcolor},coltitle=white,fonttitle=\\\\bfseries,title=注意:]",
"\\\\begin{sphinxadmonition}{hint}{提示:}":
"\\\\begin{tcolorbox}[colframe={hintframecolor},colback={hintbackcolor},coltitle=white,fonttitle=\\\\bfseries,title=提示:]",
"\\\\end{sphinxadmonition}": "\\\\end{tcolorbox}",
"\\\\begin{sphinxadmonition}{note}{Note:}":
"\\\\begin{tcolorbox}[colframe={noteframecolor},colback={notebackcolor},coltitle=white,fonttitle=\\\\bfseries,title=Note:]",
"\\\\begin{sphinxadmonition}{warning}{Warning:}":
"\\\\begin{tcolorbox}[colframe={warningframecolor},colback={warningbackcolor},coltitle=white,fonttitle=\\\\bfseries,title=Warning:]",
"\\\\begin{sphinxadmonition}{tip}{Tip:}":
"\\\\begin{tcolorbox}[colframe={noteframecolor},colback={notebackcolor},coltitle=white,fonttitle=\\\\bfseries,title=Tip:]",
"\\\\begin{sphinxadmonition}{attention}{Attention:}":
"\\\\begin{tcolorbox}[colframe={warningframecolor},colback={warningbackcolor},coltitle=white,fonttitle=\\\\bfseries,title=Attention:]",
"\\\\begin{sphinxadmonition}{hint}{Hint:}":
"\\\\begin{tcolorbox}[colframe={hintframecolor},colback={hintbackcolor},coltitle=white,fonttitle=\\\\bfseries,title=Hint:]"
},
"customoptions": [
"% \\\\numberwithin{figure}{chapter}",
"% \\\\numberwithin{table}{chapter}",
"\\\\titleformat{\\\\chapter}{\\\\raggedleft\\\\huge\\\\bfseries\\\\color{white}}{\\\\thechapter}{0.5em}{}",
"\\\\titlespacing{\\\\chapter}{0pt}{50pt}{25pt}",
"\\\\definecolor{noteframecolor}{RGB}{91,163,235}",
"\\\\definecolor{notebackcolor}{RGB}{222,237,251}",
"\\\\definecolor{warningframecolor}{RGB}{235,162,28}",
"\\\\definecolor{warningbackcolor}{RGB}{255,247,236}",
"\\\\definecolor{hintframecolor}{RGB}{70,193,196}",
"\\\\definecolor{hintbackcolor}{RGB}{226,254,249}",
"\\\\definecolor{camblue}{RGB}{0,89,196}",
"% \\\\SetWatermarkText{Cambricon}",
"% \\\\SetWatermarkLightness{0.9}",
"% \\\\SetWatermarkScale{1}",
"\\\\renewcommand{\\\\labelitemi}{$\\\\vcenter{\\\\hbox{\\\\scriptsize$\\\\bullet$}}$}",
"\\\\definecolor{shadecolor}{RGB}{220,220,220}"
],
"isfiguretabletoc": {
"comment": "插图目录英文List of Figures;表格目录英文List of Tables.",
"isfigurestoc": false,
"istablestoc": false,
"figurestoc": [
"\\\\renewcommand\\\\listfigurename{插\\ 图\\ 目\\ 录}",
"\\\\listoffigures"
],
"tablestoc": [
"\\\\renewcommand\\\\listtablename{表\\ 格\\ 目\\ 录}",
"\\\\listoftables"
]
},
"tables": {
"comment":
"isname:true-根据表格的name属性查找表格false-根据表格的标题查找表格。isnewpage:true-强制在新页生成表格false-默认。ispartial:true-采用部分匹配查找表格false-精确匹配查找表格isLongTable:true-强制设置为长表格false-不设置长表格。isVertical:true-对第一列进行渲染false-不对第一列进行渲染。isCusHeadtrue-对第一行进行渲染false-不对第一行进行渲染。",
"isname": false,
"rowtype": "",
"headtype": "{camblue!100}",
"headfontcolor": "\\textbf{\\textcolor{white}{}}",
"styles": [
{
"align": "centering",
"caption": "分区信息xxxxx",
"captionalign": "left",
"isLongTable": true,
"isVertical": false,
"isCusHead": true,
"isnewpage": true,
"ispartial": true
},
{
"align": "centering",
"caption": "版本记录",
"captionalign": "left",
"isLongTable": false,
"isVertical": true,
"isCusHead": false,
"ispartial": true
}
]
},
"image": {
"styles": [
{
"name": "",
"align": "",
"caption": ""
}
]
},
"sensitivewords": [
"安防",
"监听",
"stream",
"hisi",
"展讯",
"英伟达",
"nvidia",
"讯飞",
"展锐",
"c10",
"c20",
"IK",
"AH",
"US",
"MLU320"
],
"ignorewarndes": [
"该字段已废弃不再使用,但不能删掉,否则会导致编译错误!"
],
"ignorewarnkey": [
"sdk_memory.rst && 文档没有加入到任何目录树中",
"sdk_memory.rst && document isn't included in any toctree",
"Package hyperref Warning",
"LaTeX Font Warning",
"Package cmap Warning",
"Package xeCJK Warning"
]
}

View File

@@ -0,0 +1,313 @@
# -*- coding: utf-8 -*-
#
# TensorFlow V1.10 documentation build configuration file, created by
# sphinx-quickstart on Tue Apr 23 18:33:05 2019.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
# import os
# import sys
# sys.path.insert(0, os.path.abspath('.'))
from __future__ import print_function
# -- General configuration ------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
#
# needs_sphinx = '1.0'
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
#import sys
#reload(sys)
#sys.setdefaultencoding('utf-8')
extensions = []
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
# source_suffix = ['.rst', '.md']
source_suffix = '.rst'
# The master toctree document.
master_doc = 'index'
# General information about the project.
project = u'寒武纪Torch-MLU-Ops版本说明书'
copyright = u'2024, Cambricon'
author = u''
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = u''
# The full version, including alpha/beta/rc tags.
release = u''
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language ='zh_CN'
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This patterns also effect to html_static_path and html_extra_path
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', 'README.rst']
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = False
# -- Options for HTML output ----------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'sphinx_rtd_theme'
html_copy_source = False
html_css_files = [
'custom.css',
]
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#
# html_theme_options = {}
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
# Custom sidebar templates, must be a dictionary that maps document names
# to template names.
#
# This is required for the alabaster theme
# refs: http://alabaster.readthedocs.io/en/latest/installation.html#sidebars
html_sidebars = {
'**': [
'relations.html', # needs 'show_related': True theme option to display
'searchbox.html',
]
}
# -- Options for HTMLHelp output ------------------------------------------
# Output file base name for HTML help builder.
htmlhelp_basename = 'release notes'
# -- Options for LaTeX output ---------------------------------------------
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'Cambricon-Torch-MLU-Ops-Release-notes-CN.tex', u'寒武纪Torch-MLU-Ops版本说明书',
author, 'manual'),
]
# -- Options for manual page output ---------------------------------------
# xelatex 作为 latex 渲染引擎,因为可能有中文渲染
latex_engine = 'xelatex'
# 如果没有使用自定义封面,可以加上封面 logo。这里可以是 pdf 或者 pngjpeg 等
latex_logo = "./logo.png"
latex_show_urls = 'footnote'
latex_use_latex_multicolumn = True
latex_use_xindy = False
# 主要的配置,用于控制格式等
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#
'papersize': 'a4paper',
# The font size ('10pt', '11pt' or '12pt').
#
# 'pointsize': '8pt',
'inputenc': '',
'utf8extra': '',
'figure_align': 'H',
'releasename':"",
'sphinxsetup': '''
verbatimwithframe=false,
verbatimwrapslines=true,
VerbatimColor={RGB}{220,220,220},
verbatimhintsturnover=false,
''',
'fontpkg':'''
% 设置字体
\\usepackage{xeCJK}
\\usepackage{fontspec}
\\CJKsetecglue{\\hskip0.08em plus0.01em minus 0.01em}
\\defaultfontfeatures[\\rmfamily,\\sffamily,\\ttfamily]{}
\\setCJKmainfont{Noto Sans CJK SC}[AutoFakeSlant]
\\setCJKsansfont{Noto Sans CJK SC}[AutoFakeSlant]
\\setCJKmonofont{Noto Sans Mono CJK SC}[AutoFakeSlant]
\\setmainfont{Noto Sans CJK SC}[AutoFakeSlant]
''',
# Additional stuff for the LaTeX preamble.
'preamble': '''
\\addto\\captionsenglish{\\renewcommand{\\chaptername}{}}
\\LTcapwidth=400pt
%清除 latex headheight small错误编译告警
\\setlength{\\headheight}{14.0pt}
% 段首缩进 2 格
%\\usepackage{indentfirst}
%\\setlength{\\parindent}{2em}
\\usepackage{setspace}
% 1.5 倍行间距
\\renewcommand{\\baselinestretch}{1.5}
% 表格里的行间距
\\renewcommand{\\arraystretch}{1.5}
% list 列表的缩进对齐
\\usepackage{enumitem}
\\setlist{nosep}
% 表格类的宏包
\\usepackage{threeparttable}
\\usepackage{array}
\\usepackage{booktabs}
% fancy 页眉页脚
\\usepackage{fancyhdr}
\\pagestyle{fancy}
% 在 sphinx 生成的 tex 文件里normal 是指普通页面(每一个章节里,除了第一页外剩下的页面)
% 页眉LleftRrightEevenOodd
% 奇数页面:左边是 leftmark章号和章名称右边是 rightmark节号与节名称
% 偶数页面:左边是 rightmark节号与节名称右边是 leftmark章号和章名称
% textsl 是字体slanted shape对于英语而言某种斜体。但是不同于 textit 的 italic shape
% 左页脚:版权信息
% 右页脚:页码数
% rulewidth页眉和页脚附近的横线的粗细当设置为 0pt 时,就没有该横线
%
\\fancypagestyle{normal} {
\\fancyhf{}
\\fancyhead{}
\\fancyhead[LE,RO]{\\textsl{\\rightmark}}
\\fancyhead[LO,RE]{\\textsl{\\leftmark}}
\\lfoot{Copyright © 2024 Cambricon Corporation.}
\\rfoot{\\thepage}
\\renewcommand{\\headrulewidth}{0.4pt}
\\renewcommand{\\footrulewidth}{0.4pt}
}
% 在 sphinx 生成的 tex 文件里plain 是指每个章节的第一页等
\\fancypagestyle{plain} {
\\fancyhf{}
% left head 还可以内嵌图片,图片可以是 pdfpngjpeg 等
% \\lhead{\\includegraphics[height=40pt]{cn_tm.pdf}}
\\lhead{\\large\\textcolor[rgb]{0.1804,0.4588,0.7137}{Cambricon®}}
\\lfoot{Copyright © 2024 Cambricon Corporation.}
\\rfoot{\\thepage}
\\renewcommand{\\headrulewidth}{0.4pt}
\\renewcommand{\\footrulewidth}{0.4pt}
}
''',
#
'printindex': r'\footnotesize\raggedright\printindex',
# 移除空白页面
'extraclassoptions': 'openany,oneside',
# 如果需要用 latex 自已做封面,可以使用 maketitle
# 下面这个封面的例子来自于互联网
# 'maketitle': r'''
# \pagenumbering{Roman} %%% to avoid page 1 conflict with actual page 1
#
# \begin{titlepage}
# \centering
#
# \vspace*{40mm} %%% * is used to give space from top
# \textbf{\Huge {Sphinx format for Latex and HTML}}
#
# \vspace{0mm}
# \begin{figure}[!h]
# \centering
# \includegraphics[width=0.8\textwidth]{cn.png}
# \end{figure}
#
# % \vspace{0mm}
# % \Large \textbf{{Meher Krishna Patel}}
#
# % \small Created on : Octorber, 2017
#
# % \vspace*{0mm}
# % \small Last updated : \MonthYearFormat\today
#
#
# %% \vfill adds at the bottom
# % \vfill
# % \small \textit{More documents are freely available at }{\href{http://pythondsp.readthedocs.io/en/latest/pythondsp/toc.html}{PythonDSP}}
# \end{titlepage}
#
# \clearpage
# \pagenumbering{roman}
# \tableofcontents
# \listoffigures
# \listoftables
# \clearpage
# \pagenumbering{arabic}
#
# ''',
#
} # latex_elements
import os.path as osp
import sys
import traceback
try:
# conf_callback.py一般和conf.py放在同一目录下即可如果有特殊需求请根据conf_callback.py的实际路径进行修改。
if osp.exists(osp.join(osp.dirname(__file__), r'./conf_callback.py')):
sys.path.append(osp.join(osp.dirname(__file__), '.'))
else:
sys.path.append(osp.join(osp.dirname(__file__), '../'))
from conf_callback import *
except Exception as e:
# 如果出现了异常,请检查上面默认配置的两个路径是否满足要求,如果不满足要求,请修改上面的路径直到没异常发生。
print(e)
traceback.print_exc()

View File

@@ -0,0 +1,319 @@
#!/usr/bin/python
# -*- coding: UTF-8
from __future__ import print_function
# sphinx事件回调函数
#如果copy到conf.py文件中只copy下面的代码即可。
import os
import os.path as osp
import sys
import importlib
import traceback
import datetime as dt
import locale
#如果文档编译失败,请检查下面默认的路径是否正确,请根据实际路径进行修改
if osp.exists(osp.join(osp.dirname(__file__), './parsejson.py')):
sys.path.append(osp.join(osp.dirname(__file__), '.'))
else:
sys.path.append(osp.join(osp.dirname(__file__), '../'))
cusdirect = None
extpathisexist = False # ./_ext/customdirective.py是否存在的标志用于设置指令扩展
extpath = osp.join(osp.dirname(__file__), './_ext')
if osp.exists(extpath):
# 自定义指令所在路径,加到搜索目录,否则无法使用自定义指令
sys.path.append(extpath)
if osp.exists(osp.join(osp.dirname(__file__),r'./_ext/customdirective.py')):
extpathisexist = True
cusdirect = importlib.import_module('customdirective')
else:
extpath = osp.join(osp.dirname(__file__), '../_ext')
sys.path.append(extpath)
if osp.exists(osp.join(osp.dirname(__file__),r'../_ext/customdirective.py')):
extpathisexist = True
cusdirect = importlib.import_module('customdirective')
import sphinx
import sphinx.errors as sperror
import parsejson
try:
import breathe # 仅为了判断版本号根据breathe版本号添加不同配置
breathe_version = breathe.__version__[:3]
except Exception as e:
breathe_version = ""
warnfile = '' # 告警文件,不包含路径
warnfilepath = '' # 保存告警日志文件,包含完整的路径名
months=['January','February','March','April','May','June','July',
'August','September','October','Novmber','December']
gmaketitle = r'''
\pagenumbering{Roman}
\begin{titlepage}
\centering
\vspace*{40mm}
\textbf{\Huge {%(titlename)s}}
\vspace{10mm}
\textbf{\Large{%(release)s}}
\vfill
\textbf{\large{%(today)s}}
\end{titlepage}
'''
def __ModifyMakeTitle(elementskeys,config):
'''
如果有maketitle变量则修改maketitle的内容
:param config: 配置变量
:return:
'''
#得到封面名称
titlename = config.latex_documents[0][2]
if 'releasename' in elementskeys:
releasename = config.latex_elements['releasename']
else:
releasename = ''
if hasattr(config,'version'):
version = config.version
else:
version = ''
release = releasename +' ' + version
if hasattr(config,'today') and len(config.today) > 0:
today = config.today
else:
todayft = dt.date.today()
if hasattr(config,'language') and config.language=='zh_CN':
today = todayft.strftime('%Y 年 %m 月 %d')
else:
#除中文外,一律用英文时间格式
#得到英文月的全称。
month = months[int(todayft.strftime('%m'))-1]
today = month + todayft.strftime(" %d, %Y")
if len(config.latex_elements['maketitle'].strip())==0:
maketitle = gmaketitle
else:
maketitle = config.latex_elements['maketitle']
#必须转一下,否则赋值不成功
config.latex_elements['maketitle'] = maketitle % {
'titlename': titlename,
'release': release,
'today': today
}
def config_inited_handler(app, config):
# 检查年份是否正确并修改。需配合最新parsejson.py文件使用否则不支持该接口。
# 通用配置的修改放在该位置,否则对配置的修改不生效
try:
# 该函数的第二个参数可以传入版权声明文件相对于conf.py的相对路径自动修改版权声明的年份
# 比如parsejson.CheckCurrentYearAndModify(app,'../source/copyright/cnperf_conpyright.rst')
# 默认路径为“./copyright/copyright.rst”和“./copyright/copyright_zh.rst”或者“./copyright/copyright_en.rst”
# 以上三个路径无需传入
parsejson.CheckCurrentYearAndModify(app)
except Exception as e:
print('------------------')
print(e)
# traceback.print_stack()
traceback.print_exc()
print('------------------')
try:
# print(sphinx.__version__)
# app.require_sphinx('3.5')
keys = config.latex_elements.keys()
if 'sphinxsetup' not in keys:
config.latex_elements['sphinxsetup'] = ''
if "3.5" <= sphinx.__display_version__[:3]:
config.latex_elements['sphinxsetup'] = 'verbatimforcewraps=true,verbatimmaxunderfull=2,' + \
config.latex_elements['sphinxsetup']
if "5.3" <= sphinx.__display_version__[:3]:
config.latex_table_style = ['standard', 'nocolorrows']
config.latex_elements['sphinxsetup'] += 'pre_border-radius=0pt,'
if len(breathe_version) > 0 and "4.3" <= breathe_version:
config.latex_elements['preamble'] += '''
\\renewenvironment{description}
{\\list{}{\\labelwidth=0pt
\\let\\makelabel\\descriptionlabel}}
{\\endlist}
'''
#如果有自定义maketitle则修改maketitle的内容
if 'maketitle' in keys:
__ModifyMakeTitle(keys,config)
# sphinxsetup = config.latex_elements['sphinxsetup']
# print('sphinxversion:%s;sphinxsetup:%s' % (sphinx.__version__,sphinxsetup))
except Exception as e:
# print('sphinxversion:%s %s' % (sphinx.__version__,sphinx.__display_version__[:3]))
pass
def build_finished_handler(app, exception):
if exception != None:
# print(exception)
return
# 判断告警文件是否存在,只有无告警或者告警全是忽略告警才允许继续后续的编译
if warnfilepath != '' and osp.exists(warnfilepath):
# 判断告警文件中是否全是忽略告警
iswarn = parsejson.warn_main(warnfilepath, app)
if iswarn:
# 如果为True则说明有不可忽略的告警报sphinxerror异常停止继续编译
raise sperror.SphinxError('There are alarms, please check the file of %s for details' % warnfile)
return
try:
if app.builder.name == "latex":
selffnlst = app.config.latex_documents
parsejson.Modifylatex_main(app.outdir, selffnlst, app)
except Exception as e:
print('------------------')
print(e)
traceback.print_exc()
# 检查html标题一致性。该接口最好放在该位置主索引文件的标题已经解析出来。
# if app.builder.name == "html":
# result = parsejson.CheckProjectNameIsConsistent(app)
# if result != "":
# raise sperror.SphinxError(result) #带raise的异常如果用except捕捉则在终端打印告警将不能显示为红色字体。
def build_inited_handler(app):
global warnfile
global warnfilepath
print(sys.argv)
args = sys.argv[1:] # 0为sphinx-build需忽略掉
if '-w' in args:
pos = args.index('-w') # 找到-w所在的索引位置
warnfile = args[pos + 1] # 得到告警保存的文件名
# print('warnfile=' + warnfile)
# 根据工作路径,得到文件名的绝对路径
# 当前在build阶段因此工作路径为Makefile所在的目录-w后面的文件保存在基于Makefile的相对路径下
filepath = osp.join(os.getcwd(), warnfile)
warnfilepath = osp.abspath(filepath)
# print('warnfilepath = ' + warnfilepath)
# try:
# # 检查是否有rst_prolog或者rst_epilog替换内容有的话去掉前后空格
# # 仅适用于pdf文件和中文文档英文文档和html不启作用
# checkDocobj = parsejson.clsCheckDocCopyrightYear(app, "")
# if app.builder.name == 'latex' or app.builder.name == 'latexpdf':
# checkDocobj.CheckReplaceContent()
# except Exception as e:
# print('------------------')
# print(e)
# traceback.print_exc()
# print('------------------')
# try:
# # 检查html配置是否符合规范。必须放在这个位置否则app没有builder对象。
# if app.builder.name == "html":
# error = parsejson.CheckHtmlConfigIsCorrect(app)
# if error != "":
# raise sperror.ConfigError(error)
# except Exception as e:
# print('------------------')
# print(e)
# traceback.print_stack()
# traceback.print_exc()
# print('------------------')
def source_read_handler(app, docname, source):
if cusdirect is not None:
cnonlyobj = cusdirect.CNOnlyPro(app, docname, source[0])
source[0] = cnonlyobj.parsecnonlycontent(source[0])
# try:
# 自动添加更新历史代码,默认添加“无内容更新”
# source[0] = parsejson.CheckUpdateHistory(app, docname, source[0])
# except Exception as e:
# print('------------------')
# print(e)
# traceback.print_exc()
# print('------------------')
return source
def doctree_resolved_handle(app, doctree, docname):
"""
删除不需要文件的内容避免编译html的时候还进行编译导致内容泄漏
"""
if not hasattr(app.config, 'enable_exclude_html') or not app.config.enable_exclude_html:
# 默认按sphinx方式编译所有rst文件到html
return
indexname = app.config.master_doc
if docname == indexname:
return
indexdocnames = app.env.toctree_includes[indexname]
isexist = False
# 判断文档是否在索引文件里
if docname not in indexdocnames:
newtoctree = app.env.toctree_includes.copy()
del newtoctree[indexname] # 删除主索引文件,因为无需比较
for key in newtoctree.keys():
values = newtoctree[key]
if docname in values:
isexist = True
# 判断该key是否在主索引文件里面
if key not in indexdocnames:
# 如果不在整个的索引文件里面,删除该文件内容
# doctree.attributes['source']=''
while len(doctree.children) > 0:
doctree.remove(doctree.children[0])
# 删除标题否则html页面还有标题还需要维护标题
for node in app.env.titles[docname].children:
app.env.titles[docname].remove(node)
if not isexist:
# 文档不在toctree字典里直接删除内容
while len(doctree.children) > 0:
doctree.remove(doctree.children[0])
# 删除标题否则html页面还有标题还需要维护标题
for node in app.env.titles[docname].children:
app.env.titles[docname].remove(node)
def setup(app):
"""
该函数中的路径都是相对于工程builder环境的路径而不是相对于conf.py所在的路径
该函数外面的相对路径是相对于conf.py的路径没有问题。
比如./_ext相对路径是相对于工程的路径因此如果使用abspath得到绝对路径会得到~/m0_docs/_ext/,
而不是~ / mo_docs / source / _ext。
因此该路径下对路径的判断最好转化为绝对路径判断,否则可能会判断失败。
:param app:
:return:
"""
app.connect('config-inited', config_inited_handler)
app.connect('build-finished', build_finished_handler)
app.connect('builder-inited', build_inited_handler)
app.connect('source-read', source_read_handler)
app.connect('doctree-resolved', doctree_resolved_handle)
app.add_config_value('chapterbkpaper_image', '', 'env', [str])
# 是否排除未添加到index的html文件。在编译html时sphinx默认会将所有rst文件都生成html因此可能会造成部分内容的泄露。
# 为了删除这部分内容设置该变量。如果置为True的话将删除不在index.rst里面的html的内容。
# 默认为false不做处理以增加编译效率。
# 建议还是将不参与编译的rst文件放到exclude_patterns变量内放到该变量后rst不参与编译能提高编译效率。
app.add_config_value('enable_exclude_html', False, 'env', [bool])
#配置版权声明文件完整路径,实现版权声明文件年份的自动修改。
#parsejson.CheckCurrentYearAndModify如果该函数中传入了版权声明的全路径则以该函数中传入的为准
#在该处又增加了一个配置值,是为了配置和代码解偶,为了兼容性,保留了原来的配置方式
app.add_config_value('copyfile_path', '', 'env', [str])
#在conf.py中配置的conf.json路径为了实现conf.json配置的灵活处理
app.add_config_value('confjson_path', '', 'env', [str])
if extpathisexist:
app.setup_extension('customdirective')

View File

@@ -0,0 +1,10 @@
寒武纪Torch-MLU-Ops版本说明书
===========================================
.. toctree::
:maxdepth: 4
:caption: 目录
./overview/overview
./version

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

View File

@@ -0,0 +1,5 @@
#! /bin/bash
make clean
make latexpdf
make html&&zip -qr -P"Cambricon" build/torch_mlu_ops_release_notes_html.zip build/html

View File

@@ -0,0 +1,5 @@
概述
====================
Torch-MLU-Ops是寒武纪设计和开发的PyTorch第三方算子库。对于使用PyTorch框架的开发者通过Torch-MLU-Ops能够便捷地使用这些自定义算子进行算子的集成、评测和业务部署。

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,220 @@
V1.3.2
===================
特性变更
-----------------
- 废弃原legacy目录下的BangTransformer大模型推理网络性能评测代码。
- ``fused_layer_norm````fused_rms_norm`` 的输入和输出支持更多的 ``stride`` 组合。
已修复问题
---------------------
无。
已知遗留问题
--------------
无。
V1.3.1
===================
特性变更
-----------------
- ``smooth_quant_group_gemm````fused_moe`` 算子支持w4w8混合量化。
- ``reshape_paged_cache`` 算子支持 ``v````v_cache`` 传入None。
- ``quant_to_paged_cache`` 算子支持 ``v````v_cache````v_cache_quant_scale`` 传入None。
- ``offline_quant_to_paged_cache`` 算子支持 ``v````v_cache_scale`` 传入None。
- ``copy_blocks`` 算子支持 ``v_caches`` 传入None。
- ``moe_softmax_topk`` 支持 ``mask`` 广播及定制化 ``normalize`` 。该算子的 ``Input````Mask`` 必须保证连续。
- ``single_query_cached_kv_attn`` 支持 ``window_size_left``
- 新增 ``dequant_from_paged_cache`` 算子。
- ``dequant_from_linear_cache`` 算子不再支持float32的 ``key````value``
已修复问题
---------------------
无。
已知遗留问题
--------------
无。
V1.3.0
===================
特性变更
-----------------
- ``group_gemm````smooth_quant_group_gemm`` 算子的max_m参数会影响性能其默认值不一定是最佳性能将由参数可选修改成必填参数。
- ``moe_softmax_topk`` 支持mask功能。
- 支持导出算子 ``gen_case`` 功能。
- 新增 ``dequant_from_linear_cache`` 算子。
- ``moe_softmax_topk`` 支持mask广播及定制化normalize。
已修复问题
---------------------
无。
已知遗留问题
--------------
无。
V1.2.3
===================
特性变更
-----------------
- 适配CNToolkit 3.15.X相关特性。
- 不再支持Ubuntu20.04操作系统。
- ``single_query_cached_kv_attn````flash_attention`` 算子支持 ``head_size_qk != head_size_v``
- ``group_gemm````smooth_quant_group_gemm`` 算子支持bias。
- ``matmul`` 删除原位输出参数,增加指定输出类型参数。
已修复问题
---------------------
- ``quant_to_linear_cache`` 算子修复精度问题。
- 修复 ``matmul`` 算子形状推导问题。
- 修复Debug模式下 ``quant_to_linear_cache`` 算子编译问题。
已知遗留问题
--------------
无。
V1.2.2
===================
特性变更
-----------------
- ``smooth_quant_group_gemm````fused_moe`` 支持int4 group量化功能。
- ``allreduce`` 类算子删除 ``act_mode``
- ``weight_only_quant_matmul````smooth_quant_matmul`` 新增控制激活计算方式。
已修复问题
---------------------
无。
已知遗留问题
--------------
无。
V1.2.1
===================
特性变更
-----------------
- ``moe_combine_result`` 算子优化吞吐场景下性能。
- ``quant_to_linear_cache`` 算子新增group量化和int4量化功能。
- 新增 ``moe_cast_gating`` 算子。
- 新增 ``update_out_and_lse`` 算子。
- ``fused_rope`` 算子支持int8/int4 kv cache。
- ``matmul````batch_matmul`` 新增支持trans_a, trans_b。
- 新增 ``single_query_mixed_cached_kv_attn`` 算子。
- ``single_query_cached_kv_attn`` 支持output_lse。
- ``fused_layer_norm````fused_rms_norm`` 支持输出动态量化。
- legacy目录下的BangTransformer网络评测代码仅支持在PyTorch2.1环境下编译和运行。
已修复问题
---------------------
无。
已知遗留问题
--------------
无。
V1.2.0
===================
特性变更
-----------------
- ``moe_softmax_topk`` 算子新增grouped_topk功能。
- ``moe_softmax_topk`` 算子不再支持原位功能。
- ``moe_gen_idx`` 算子不再支持原位功能。
- Torch-MLU-Ops首次支持PyTorch2.5不再支持PyTorch2.3。
- 新增 ``fused_rope`` 算子。
- ``matmul`` 算子新增支持INT8输入。
- 新增 ``batch_matmul`` 算子。
已修复问题
---------------------
无。
已知遗留问题
--------------
无。
V1.1.4
===================
特性变更
-----------------
- 新增 ``offline_quant_to_paged_cache`` 算子。
- 新增 ``moe_gen_idx`` 算子。
- 新增 ``moe_expand_input`` 算子。
- 新增 ``moe_combine_result`` 算子。
- 新增 ``moe_quantize`` 算子。
- 新增 ``moe_softmax_topk`` 算子。
- 删除 ``quant_matmul`` 算子,由 ``smooth_quant_matmul````weight_only_quant_matmul`` 实现其功能。
- ``flash_attention`` 算子新增 ``block_tables`` ``k/v_cache_quant_scale`` 参数。
- ``matmul`` 算子支持激活配置参数。
- ``fused_moe`` 算子支持量化EP。
- 新增 ``moe_active`` 算子。
已修复问题
---------------------
- 修复 ``fused_moe`` 算子通算融合模式的精度问题。
- 修复 ``moe_combine_result`` 算子在EP模式下特定规模下的coredump问题。
- 修复 ``fused_norm`` 算子非连续情况下的精度问题。
已知遗留问题
--------------
无。
V1.1.3
===================
特性变更
-----------------
- BangTransformer更名为Torch-MLU-Ops, 定位PyTorch第三方算子库。对于使用PyTorch框架的开发者通过Torch-MLU-Ops能够便捷地使用这些自定义算子进行算子的集成、评测和业务部署。
- bt_ops的命名空间变化为torch_mlu_ops。
- 原BangTransformer的LLM网络推理评测相关内容被迁移到lagacy目录下进行维护。
- 后续在寒武纪计算卡上的LLM网络推理评测建议使用Cambricon vLLM、Cambricon TGI、Cambricon Stable Diffusion web UI、Cambricon ComfyUI以及Cambricon Diffusers组件。
- Single Query Cached Attention算子支持per_token量化和per_channel量化。
- Fused Moe算子在非量化情况下支持EP模式内部支持group gemm和allreduce并行。
- 提供smooth_quant_matmul_allreduce、matmul_allreduce、flash_attn_sq_mm_allreduce通算融合。
- 更新flash_attention、single_query_cached_kv_attn、fused_rms_norm、fused_layer_norm的接口说明。
已修复问题
---------------------
无。
已知遗留问题
--------------
无。