From 0c13b8ff0e171be2d92df9dae8c75c64587191ce Mon Sep 17 00:00:00 2001 From: Philippe Tillet Date: Fri, 5 Mar 2021 22:33:50 -0500 Subject: [PATCH] [DOCS] Updated and improved docs (#73) --- docs/conf.py | 27 ++++-------- docs/index.rst | 18 ++++---- docs/installation/from-source.rst | 55 +++++++++++++++++++------ docs/installation/index.rst | 16 ------- docs/installation/packaged-binaries.rst | 8 ++++ 5 files changed, 68 insertions(+), 56 deletions(-) delete mode 100644 docs/installation/index.rst create mode 100644 docs/installation/packaged-binaries.rst diff --git a/docs/conf.py b/docs/conf.py index 0aec4f576..fb71ab425 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -21,7 +21,6 @@ # import sys # sys.path.insert(0, os.path.abspath('.')) - # -- General configuration ------------------------------------------------ # If your documentation needs a minimal Sphinx version, state it here. @@ -31,7 +30,8 @@ # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. -extensions = [] +extensions = ['sphinx.ext.autosectionlabel'] +autosectionlabel_prefix_document = True # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] @@ -77,7 +77,6 @@ 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 @@ -110,13 +109,11 @@ html_sidebars = { ] } - # -- Options for HTMLHelp output ------------------------------------------ # Output file base name for HTML help builder. htmlhelp_basename = 'Tritondoc' - # -- Options for LaTeX output --------------------------------------------- latex_elements = { @@ -141,20 +138,14 @@ latex_elements = { # (source start file, target name, title, # author, documentclass [howto, manual, or own class]). latex_documents = [ - (master_doc, 'Triton.tex', 'Triton Documentation', - 'Philippe Tillet', 'manual'), + (master_doc, 'Triton.tex', 'Triton Documentation', 'Philippe Tillet', '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, 'triton', 'Triton Documentation', - [author], 1) -] - +man_pages = [(master_doc, 'triton', 'Triton Documentation', [author], 1)] # -- Options for Texinfo output ------------------------------------------- @@ -162,10 +153,8 @@ man_pages = [ # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ - (master_doc, 'Triton', 'Triton Documentation', - author, 'Triton', 'One line description of project.', - 'Miscellaneous'), + ( + master_doc, 'Triton', 'Triton Documentation', author, 'Triton', 'One line description of project.', + 'Miscellaneous' + ), ] - - - diff --git a/docs/index.rst b/docs/index.rst index d82205b4c..301f5d9ce 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -8,14 +8,14 @@ Welcome to Triton's documentation! .. toctree:: :maxdepth: 1 - :caption: Contents: + :caption: Installation Instructions - installation/index + installation/packaged-binaries + installation/from-source - -Indices and tables -================== - -* :ref:`genindex` -* :ref:`modindex` -* :ref:`search` +.. toctree:: + :maxdepth: 1 + :caption: Tutorials + + Vector Addition + Fused Softmax \ No newline at end of file diff --git a/docs/installation/from-source.rst b/docs/installation/from-source.rst index 117f1076f..021b9a81d 100644 --- a/docs/installation/from-source.rst +++ b/docs/installation/from-source.rst @@ -1,21 +1,52 @@ -*************** +============== From Source -*************** +============== -Triton is a fairly self-contained package and uses its own parser (forked from `wgtcc `_) and LLVM-8.0+ for code generation. ++++++++++++++++ +Python Package ++++++++++++++++ + +You can install the Python package from source by running the following commands: .. code-block:: bash - sudo apt-get install llvm-8-dev - git clone https://github.com/ptillet/triton.git; - cd triton/python/; - python setup.py develop; + sudo apt-get install llvm-10-dev + git clone https://github.com/ptillet/triton.git; + cd triton/python; + pip install -e . -This should take about 15-20 seconds to compile on a modern machine. - -You can then test your installation by running the *einsum.py* example in an environment that contains pytorch: +You can then test your installation by running the unit tests: .. code-block:: bash - cd examples; - python einsum.py \ No newline at end of file + pytest -vs . + +and the benchmarks + +.. code-block:: bash + + cd bench/ + python -m run --with-plots --result-dir /tmp/triton-bench + ++++++++++++++++ +C++ Package ++++++++++++++++ + +Those not interested in Python integration may want to use the internals of Triton (i.e, runtime, parser, codegen, driver, intermediate representation) directly. This can be done by running the following commands: + +.. code-block:: bash + + sudo apt-get install llvm-10-dev + git clone https://github.com/ptillet/triton.git; + mkdir build; + cd build; + cmake ../; + make -j8; + +A custom llvm-config binary can also be provided: + +.. code-block:: bash + + cmake ../ -DLLVM_CONFIG=/path/to/llvm-config + +Note that while direct usage of the C++ API is not officially supported, a usage tutorial can be found `here `_ diff --git a/docs/installation/index.rst b/docs/installation/index.rst deleted file mode 100644 index c9755fbc1..000000000 --- a/docs/installation/index.rst +++ /dev/null @@ -1,16 +0,0 @@ -Installation -============ - -Triton can be installed directly from pip with the following command - -.. code-block:: python - - pip install triton - - -See the information below for more detailed information on custom builds. - -.. toctree:: - :maxdepth: 1 - - from-source diff --git a/docs/installation/packaged-binaries.rst b/docs/installation/packaged-binaries.rst new file mode 100644 index 000000000..fdcddd887 --- /dev/null +++ b/docs/installation/packaged-binaries.rst @@ -0,0 +1,8 @@ +Packaged Binaries +================= + +Triton can be installed directly from pip with the following command + +.. code-block:: python + + pip install triton \ No newline at end of file