Skip to content

Commit

Permalink
Created an install section; separated build and install into separate…
Browse files Browse the repository at this point in the history
… sections; updated the what is; fixed up landing page; changed the title of 'contributing', smoothed the intro, and added some info from the dev_intro section
  • Loading branch information
spolifroni-amd committed Sep 26, 2024
1 parent aff7f41 commit 56e4151
Show file tree
Hide file tree
Showing 9 changed files with 68 additions and 59 deletions.
36 changes: 14 additions & 22 deletions docs/dev/contributing-to-migraphx.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,22 @@
.. _contributing-to-migraphx:

==========================
Contributing to MIGraphX
Developing for MIGraphX
==========================

This document explains the internal implementation of some commonly used MIGraphX APIs. You can utilize the information provided in this document and other documents under "Contributing to MIGraphX" section to contribute to the MIGraphX API implementation.
Here is how some basic operations in the MIGraphX framework are performed.
This document is intended for anyone who wants to contribute to MIGraphX. This document covers some basic operations that can be used to develop for MIGraphX. The complete source code for the example shown here can be found at `ref_dev_examples.cpp <https://github.com/ROCm/AMDMIGraphX/blob/develop/test/ref_dev_examples.cpp>`_ on the MIGraphX repository.

Performing basic operations
More examples can be found on `the MIGraphX GitHub repository <https://github.com/ROCmSoftwarePlatform/AMDMIGraphX/tree/develop/examples/migraphx>`_.


Adding two literals
----------------------------

A program is a collection of modules, which are collections of instructions to be executed when calling :cpp:any:`eval <migraphx::internal::program::eval>`.
Each instruction has an associated :cpp:any:`operation <migraphx::internal::operation>` which represents the computation to be performed by the instruction.

The following code snippets demonstrate some basic operations using MIGraphX.

Adding literals
******************
We start with a snippet of the simple ``add_two_literals()`` function::

Here is a ``add_two_literals()`` function::

// create the program and get a pointer to the main module
migraphx::program p;
Expand Down Expand Up @@ -55,7 +53,7 @@ To compile the program for the GPU, move the file to ``test/gpu/`` directory and
#include <migraphx/gpu/target.hpp>

Adding Parameters
*******************
----------------------------

While the ``add_two_literals()`` function above demonstrates add operation on constant values ``1`` and ``2``,
the following program demonstrates how to pass a parameter (``x``) to a module using ``add_parameter()`` function .
Expand Down Expand Up @@ -86,7 +84,7 @@ To map the parameter ``x`` to an :cpp:any:`argument <migraphx::internal::argumen
EXPECT(result.at<int>() == 6);

Handling Tensor Data
**********************
----------------------------

The above two examples demonstrate scalar operations. To describe multi-dimensional tensors, use the :cpp:any:`shape <migraphx::internal::shape>` class to compute a simple convolution as shown below::

Expand Down Expand Up @@ -132,30 +130,24 @@ By default, the buffers are allocated on the CPU when compiling for CPU and on t
To locate the buffers on the CPU even when compiling for GPU, set the option ``offload_copy=true``.

Importing From ONNX
**********************
----------------------------

To make it convenient to use neural networks directly from other frameworks, MIGraphX ONNX parser allows you to build a :cpp:any:`program <migraphx::internal::program>` directly from an ONNX file.
For usage, refer to the ``parse_onnx()`` function below::

program p = migraphx::parse_onnx("model.onnx");
p.compile(migraphx::gpu::target{});

Sample programs
-----------------

You can find all the MIGraphX examples in the `Examples <https://github.com/ROCmSoftwarePlatform/AMDMIGraphX/tree/develop/examples/migraphx>`_ directory.

Build MIGraphX source code
****************************
Build this example
----------------------------

To build a sample program `ref_dev_examples.cpp <https://github.com/ROCm/AMDMIGraphX/blob/develop/test/ref_dev_examples.cpp>`_, use:
Build the `ref_dev_examples.cpp <https://github.com/ROCm/AMDMIGraphX/blob/develop/test/ref_dev_examples.cpp>`_ example with this command:

make -j$(nproc) test_ref_dev_examples

This creates an executable file ``test_ref_dev_examples`` in the ``bin/`` of the build directory.
This creates the ``test_ref_dev_examples`` under ``bin/`` in the build directory.

To verify the build, use:

make -j$(nproc) check

For detailed instructions on building MIGraphX from source, refer to the `README <https://github.com/ROCm/AMDMIGraphX#readme>`_ file.
1 change: 1 addition & 0 deletions docs/dev/dev_intro.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ Developer Introduction
======================

MIGraphX provides an optimized execution engine for deep learning neural networks.

We will cover some simple operations in the MIGraphX framework here.
For a quick start guide to using MIGraphX, look in the examples directory: ``https://github.com/ROCmSoftwarePlatform/AMDMIGraphX/tree/develop/examples/migraphx``.

Expand Down
17 changes: 10 additions & 7 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,34 @@
AMD MIGraphX documentation
===========================

Welcome to the MIGraphX docs home page! To learn more, see :ref:`what-is-migraphx`.
AMD MIGraphX is AMD's graph inference engine. This optimized execution engine is useful for deep learning neural networks.

To learn more, see :ref:`what-is-migraphx`.

Our documentation is structured as follows:

.. grid:: 2
:gutter: 3

.. grid-item-card:: Install
.. grid-item-card:: Installating and building

* :doc:`Prerequisites <./install/prerequisites>`
* :doc:`Tested configurations <./install/tested_configurations>`
* :doc:`Install MIGraphX <./install/install>`
* :doc:`Install MIGraphX with the package installer <./install/installing_with_package>`
* :doc:`Build and install MIGraphX with CMake <./install/build_and_install_with_cmake>`
* :doc:`Build and install MIGraphX with rbuild <./install/build_and_install_with_rbuild>`
* :doc:`Build and install MIGraphX with Docker <./install/build_and_install_with_docker>`
* :doc:`Build and install MIGraphX with Docker <./install/build_and_install_with_cmake>`
* :doc:`Build and install MIGraphX with Docker <./install/build_and_install_with_rbuild>`


.. grid-item-card:: Reference

* :ref:`cpp-api-reference`
* :ref:`python-api-reference`
* :ref:`migraphx-driver`

.. grid-item-card:: Contribution
.. grid-item-card:: Developing for MIGraphX

* :ref:`contributing-to-migraphx`


To contribute to the documentation refer to
`Contributing to ROCm <https://rocm.docs.amd.com/en/latest/contribute/contributing.html>`_.
Expand Down
20 changes: 9 additions & 11 deletions docs/install/install.rst
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
.. meta::
:description: Installing MIGraphX
:keywords: install, MIGraphX, AMD, ROCm
:description: Building and Installing MIGraphX using the package installer
:keywords: install, MIGraphX, AMD, ROCm, general

********************************************************************
Installing MIGraphX using binaries
Building and Installing MIGraphX
********************************************************************

ROCm must be installed before installing MIGraphX. See `ROCm installation for Linux <https://rocm.docs.amd.com/projects/install-on-linux/en/latest/>`_ for information on how to install ROCm on Linux.
Installing MIGraphX using `the package installer <https://rocm.docs.amd.com/projects/AMDMIGraphX/en/latest/install/installing_with_package.html>`_ is sufficient for most MIGraphX users.

All prerequisites needed to install MIGraphX are installed when the package install is used.

MIGraphX can be installed using the following command:

.. code:: shell
sudo apt update && sudo apt install -y migraphx
Users who want to use pre-release features or want to contribute to the MIGRaphX project can build MIGraphX from its source code.

There are three ways of building and installing MIGraphX from source code:

1. `Using CMake <https://rocm.docs.amd.com/projects/AMDMIGraphX/en/latest/install/build_and_install_with_cmake.html>`_
2. `Using rbuild <https://rocm.docs.amd.com/projects/AMDMIGraphX/en/latest/install/build_and_install_with_rbuild.html>`_
3. `Using Docker <https://rocm.docs.amd.com/projects/AMDMIGraphX/en/latest/install/build_and_install_with_docker.html>`_
17 changes: 17 additions & 0 deletions docs/install/installing_with_package.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
.. meta::
:description: Installing MIGraphX using the package installer
:keywords: install, MIGraphX, AMD, ROCm, package installer

********************************************************************
Installing MIGraphX using the package installer
********************************************************************

ROCm must be installed before installing MIGraphX. See `ROCm installation for Linux <https://rocm.docs.amd.com/projects/install-on-linux/en/latest/>`_ for information on how to install ROCm on Linux.

The package installer will install all the prerequisites needed for MIGraphX.

Use the following command to install MIGraphX:

.. code:: shell
sudo apt update && sudo apt install -y migraphx
2 changes: 1 addition & 1 deletion docs/install/prerequisites.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ MIGraphX Installation prerequisites

The following components and tools must be installed before MIGraphX can be installed.

The installation steps include installing these dependencies.
The installation steps include information about installing these dependencies.

* `ROCm CMake <https://github.com/RadeonOpenCompute/rocm-cmake>`_
* `MIOpen <https://github.com/ROCmSoftwarePlatform/MIOpen>`_
Expand Down
10 changes: 0 additions & 10 deletions docs/install/tested_configurations.rst

This file was deleted.

14 changes: 8 additions & 6 deletions docs/sphinx/_toc.yml.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@ subtrees:
- caption: Installation
entries:

- file: install/tested_configurations
- file: install/prerequisites
- file: install/install
- file: install/build_and_install_with_cmake
- file: install/build_and_install_with_docker
- file: install/build_and_install_with_rbuild

subtrees:
- entries:
- file: install/installing_with_package
- file: install/build_and_install_with_cmake
- file: install/build_and_install_with_rbuild
- file: install/build_and_install_with_docker

- caption: Reference
entries:
- file: reference/cpp
Expand All @@ -24,7 +26,7 @@ subtrees:
- entries:
- file: reference/driver-options

- caption: Contribution
- caption: Developing for MIGraphX
entries:
- file: dev/contributing-to-migraphx
subtrees:
Expand Down
10 changes: 8 additions & 2 deletions docs/what-is-migraphx.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@
What is MIGraphX?
=====================

AMD MIGraphX is AMD's graph inference engine that accelerates machine learning model inference. The optimized execution engine is useful for deep learning neural networks.
AMD MIGraphX is a graph inference engine and graph compiler. MIGraphX accelerates machine-learning models by leveraging several graph-level transformations and optimizations. These optimizations include:

You can utilize MIGraphX functions using :ref:`C++ APIs <cpp-api-reference>`, :ref:`Python APIs <python-api-reference>`, and the :ref:`command-line tool migraphx-driver <migraphx-driver>`.
* Operator fusion
* Arithmetic simplifications
* Dead-code elimination
* Common subexpression elimination (CSE)
* Constant propagation

After optimization, MIGraphX generates code for AMD GPUs by calling MIOpen or rocBLAS, or by creating HIP kernels. MIGraphX can also target CPUs using DNNL or ZenDNN libraries.

0 comments on commit 56e4151

Please sign in to comment.