"...git@developer.sourcefind.cn:xdb4_94051/vllm.git" did not exist on "21b3671bbc508662561ae95a418a26dbe71db356"
Commit 9aad7df0 authored by Paul's avatar Paul
Browse files

Merge branch 'doc'

parents 9393d7e1 2a63f7ed
...@@ -64,5 +64,5 @@ RUN cget -p $PREFIX install -f /dev-requirements.txt ...@@ -64,5 +64,5 @@ RUN cget -p $PREFIX install -f /dev-requirements.txt
ENV LD_LIBRARY_PATH=$PREFIX/lib ENV LD_LIBRARY_PATH=$PREFIX/lib
# Install doc requirements # Install doc requirements
# ADD doc/requirements.txt /doc-requirements.txt ADD doc/requirements.txt /doc-requirements.txt
# RUN pip install -r /doc-requirements.txt RUN pip install -r /doc-requirements.txt
...@@ -26,15 +26,16 @@ add_doxygen_doc( ...@@ -26,15 +26,16 @@ add_doxygen_doc(
EXTRACT_ALL YES EXTRACT_ALL YES
ENUM_VALUES_PER_LINE 1 ENUM_VALUES_PER_LINE 1
FULL_PATH_NAMES YES FULL_PATH_NAMES YES
PREDEFINED DOXYGEN
) )
# include(SphinxDoc) include(SphinxDoc)
# add_sphinx_doc(src add_sphinx_doc(src
# BUILDER html BUILDER html
# OUTPUT_DIR html OUTPUT_DIR html
# VARS VARS
# breathe_projects.proj=${DOXYGEN_OUTPUT}/xml breathe_projects.proj=${DOXYGEN_OUTPUT}/xml
# breathe_default_project=proj breathe_default_project=proj
# DEPENDS doxygen DEPENDS doxygen
# ) )
sphinx
breathe==4.9.1
# git+https://github.com/arximboldi/breathe@fix-node-parent
# -*- coding: utf-8 -*-
#
# MIGraph documentation build configuration file, created by
# sphinx-quickstart on Thu Jul 19 11:38:13 2018.
#
# 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('.'))
# -- 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.
extensions = ['breathe', 'sphinx.ext.mathjax', 'sphinx.ext.viewcode']
# 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'MIGraph'
copyright = u'2018, AMD'
author = u'AMD'
# 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'0.1'
# The full version, including alpha/beta/rc tags.
release = u'0.1'
# 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 = None
# 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 = []
# 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 = 'alabaster'
# 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']
# -- Options for HTMLHelp output ------------------------------------------
# Output file base name for HTML help builder.
htmlhelp_basename = 'MIGraphdoc'
# -- Options for LaTeX output ---------------------------------------------
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#
# 'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
#
# 'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
#
# 'preamble': '',
# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
}
# 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, 'MIGraph.tex', u'MIGraph Documentation',
u'AMD', 'manual'),
]
# -- Options for manual page output ---------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'migraph', u'MIGraph Documentation',
[author], 1)
]
# -- Options for Texinfo output -------------------------------------------
# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'MIGraph', u'MIGraph Documentation',
author, 'MIGraph', 'One line description of project.',
'Miscellaneous'),
]
breathe_default_members = ('members', 'undoc-members')
cpp_index_common_prefix = ['migraph::']
.. MIGraph documentation master file, created by
sphinx-quickstart on Thu Jul 19 11:38:13 2018.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Welcome to MIGraph's documentation!
===================================
.. toctree::
:maxdepth: 2
:caption: Contents:
reference/data
reference/operators
reference/program
reference/targets
reference/pass
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
Data types
==========
shape
-----
.. doxygenstruct:: migraph::shape
literal
-------
.. doxygenstruct:: migraph::literal
argument
--------
.. doxygenstruct:: migraph::argument
raw_data
--------
.. doxygenstruct:: migraph::raw_data
.. doxygenfunction:: migraph::visit_all
tensor_view
-----------
.. doxygenstruct:: migraph::tensor_view
Operators
=========
operation
---------
.. doxygenstruct:: migraph::operation
operators
---------
.. doxygenfile:: operators.hpp
Passes
======
pass
----
.. doxygenstruct:: migraph::pass
dead_code_elimination
---------------------
.. doxygenstruct:: migraph::dead_code_elimination
Program
=======
instruction
-----------
.. doxygenstruct:: migraph::instruction
program
-------
.. doxygenstruct:: migraph::program
Targets
=======
target
------
.. doxygenstruct:: migraph::target
...@@ -9,6 +9,17 @@ ...@@ -9,6 +9,17 @@
namespace migraph { namespace migraph {
#ifdef DOXYGEN
/// A context is used to store internal data for a `target`. A context is
/// constructed by a target during compilation and passed to the operations
/// during `eval`.
struct context
{
};
#else
/* /*
* Type-erased interface for: * Type-erased interface for:
* *
...@@ -177,6 +188,8 @@ inline const ValueType& any_cast(const context& x) ...@@ -177,6 +188,8 @@ inline const ValueType& any_cast(const context& x)
return *y; return *y;
} }
#endif
} // namespace migraph } // namespace migraph
#endif #endif
...@@ -13,6 +13,37 @@ ...@@ -13,6 +13,37 @@
namespace migraph { namespace migraph {
#ifdef DOXYGEN
/// The operation interface represents an action an instruction will perform. All
/// operation classes must be CopyConstructible.
struct operation
{
/// A unique name identifying the operation
std::string name() const;
/// This is used to compute the resulting shape from an operation. If an
/// operation cannot be run with input shapes, then it should throw an
/// exception.
shape compute_shape(std::vector<shape> input) const;
/**
* @brief This performs the operation's computation
*
* @param ctx This is the context created by the `target` during compilation. Implementations
* can use the target's `context` class rather than the `context` interface class.
* @param output This is the output shape. It is equivalent to running `compute_shape` with each
* `shape` of the `argument`.
* @param input This is the `argument` result from the previous instuction's computation.
* @return Return an `argument` of the result computation. The `shape` of `argument` should be
* the same the `output` shape.
*/
argument compute(context& ctx, shape output, std::vector<argument> input) const;
/// An optional stream operator to print the operation. When this is not
/// implemented, it will just print the operation's name.
friend std::ostream& operator<<(std::ostream& os, const operation& op);
};
#else
namespace operation_stream { namespace operation_stream {
template <class T> template <class T>
...@@ -250,6 +281,8 @@ inline const ValueType& any_cast(const operation& x) ...@@ -250,6 +281,8 @@ inline const ValueType& any_cast(const operation& x)
return *y; return *y;
} }
#endif
} // namespace migraph } // namespace migraph
#endif #endif
...@@ -11,6 +11,20 @@ namespace migraph { ...@@ -11,6 +11,20 @@ namespace migraph {
struct program; struct program;
#ifdef DOXYGEN
/// An interface for applying a transformation to the instructions in a
/// `program`
struct pass
{
/// A unique name used to identify the pass
std::string name() const;
/// Run the pass on the program
void apply(program& p) const;
};
#else
/* /*
* Type-erased interface for: * Type-erased interface for:
* *
...@@ -199,6 +213,8 @@ inline const ValueType& any_cast(const pass& x) ...@@ -199,6 +213,8 @@ inline const ValueType& any_cast(const pass& x)
return *y; return *y;
} }
#endif
} // namespace migraph } // namespace migraph
#endif #endif
...@@ -12,7 +12,30 @@ ...@@ -12,7 +12,30 @@
namespace migraph { namespace migraph {
struct program; #ifdef DOXYGEN
/// An interface for a compilation target
struct target
{
/// A unique name used to identify the target
std::string name() const;
/// The transformation passes to be run
/**
* @brief The transformation pass to be run during compilation.
* @details [long description]
*
* @param ctx This is the target-dependent context that is created by `get_context`
* @return The passes to be ran
*/
std::vector<pass> get_passes(context& ctx) const;
/**
* @brief Construct a context for the target.
* @return The context to be used during compilation and execution.
*/
context get_context() const;
};
#else
/* /*
* Type-erased interface for: * Type-erased interface for:
...@@ -216,6 +239,8 @@ inline const ValueType& any_cast(const target& x) ...@@ -216,6 +239,8 @@ inline const ValueType& any_cast(const target& x)
return *y; return *y;
} }
#endif
} // namespace migraph } // namespace migraph
#endif #endif
...@@ -9,10 +9,23 @@ ...@@ -9,10 +9,23 @@
namespace migraph { namespace migraph {
#ifdef DOXYGEN
/// A context is used to store internal data for a `target`. A context is
/// constructed by a target during compilation and passed to the operations
/// during `eval`.
struct context
{
};
#else
<% <%
interface('context') interface('context')
%> %>
#endif
} // namespace migraph } // namespace migraph
#endif #endif
...@@ -13,6 +13,37 @@ ...@@ -13,6 +13,37 @@
namespace migraph { namespace migraph {
#ifdef DOXYGEN
/// The operation interface represents an action an instruction will perform. All
/// operation classes must be CopyConstructible.
struct operation
{
/// A unique name identifying the operation
std::string name() const;
/// This is used to compute the resulting shape from an operation. If an
/// operation cannot be run with input shapes, then it should throw an
/// exception.
shape compute_shape(std::vector<shape> input) const;
/**
* @brief This performs the operation's computation
*
* @param ctx This is the context created by the `target` during compilation. Implementations
* can use the target's `context` class rather than the `context` interface class.
* @param output This is the output shape. It is equivalent to running `compute_shape` with each
* `shape` of the `argument`.
* @param input This is the `argument` result from the previous instuction's computation.
* @return Return an `argument` of the result computation. The `shape` of `argument` should be
* the same the `output` shape.
*/
argument compute(context& ctx, shape output, std::vector<argument> input) const;
/// An optional stream operator to print the operation. When this is not
/// implemented, it will just print the operation's name.
friend std::ostream& operator<<(std::ostream& os, const operation& op);
};
#else
namespace operation_stream { namespace operation_stream {
template <class T> template <class T>
...@@ -38,6 +69,8 @@ interface('operation', ...@@ -38,6 +69,8 @@ interface('operation',
) )
%> %>
#endif
} // namespace migraph } // namespace migraph
#endif #endif
...@@ -11,6 +11,20 @@ namespace migraph { ...@@ -11,6 +11,20 @@ namespace migraph {
struct program; struct program;
#ifdef DOXYGEN
/// An interface for applying a transformation to the instructions in a
/// `program`
struct pass
{
/// A unique name used to identify the pass
std::string name() const;
/// Run the pass on the program
void apply(program& p) const;
};
#else
<% <%
interface('pass', interface('pass',
virtual('name', returns='std::string', const=True), virtual('name', returns='std::string', const=True),
...@@ -18,6 +32,8 @@ interface('pass', ...@@ -18,6 +32,8 @@ interface('pass',
) )
%> %>
#endif
} // namespace migraph } // namespace migraph
#endif #endif
...@@ -12,7 +12,30 @@ ...@@ -12,7 +12,30 @@
namespace migraph { namespace migraph {
struct program; #ifdef DOXYGEN
/// An interface for a compilation target
struct target
{
/// A unique name used to identify the target
std::string name() const;
/// The transformation passes to be run
/**
* @brief The transformation pass to be run during compilation.
* @details [long description]
*
* @param ctx This is the target-dependent context that is created by `get_context`
* @return The passes to be ran
*/
std::vector<pass> get_passes(context& ctx) const;
/**
* @brief Construct a context for the target.
* @return The context to be used during compilation and execution.
*/
context get_context() const;
};
#else
<% <%
interface('target', interface('target',
...@@ -22,6 +45,8 @@ interface('target', ...@@ -22,6 +45,8 @@ interface('target',
) )
%> %>
#endif
} // namespace migraph } // namespace migraph
#endif #endif
...@@ -239,7 +239,8 @@ def convert_member(d, struct_name): ...@@ -239,7 +239,8 @@ def convert_member(d, struct_name):
'member_const': '', 'member_const': '',
'friend': '', 'friend': '',
'this': '(*this)', 'this': '(*this)',
'using': '' 'using': '',
'brief': ''
} }
args = [] args = []
params = [] params = []
...@@ -266,6 +267,8 @@ def convert_member(d, struct_name): ...@@ -266,6 +267,8 @@ def convert_member(d, struct_name):
member['default'] = t member['default'] = t
elif x == 'using': elif x == 'using':
member['using'] = 'using {};'.format(d[name]['using']) member['using'] = 'using {};'.format(d[name]['using'])
elif x == '__brief__':
member['doc'] = '/// ' + t
elif x.startswith('__') and x.endswith('__'): elif x.startswith('__') and x.endswith('__'):
continue continue
else: else:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment