Skip to content

Commit 5e45a73

Browse files
authored
Merge pull request #3495 from ROCm/docsfor62
Update latest documentation for new design
2 parents 379310e + 45ddca5 commit 5e45a73

11 files changed

+246
-56
lines changed

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
# AMD MIGraphX
22

33
AMD MIGraphX is AMD's graph inference engine, which accelerates machine learning model inference.
4-
To use MIGraphX, you can install the binaries or build from source code. Refer to the following sections
5-
for Ubuntu installation instructions (we'll provide instructions for other Linux distributions in the future).
64

7-
> [!NOTE]
8-
> You must [install ROCm](https://rocm.docs.amd.com/en/latest/deploy/linux/quick_start.html) before
5+
>[!NOTE]
6+
>The published documentation is available at [MIGraphX](https://rocm.docs.amd.com/projects/AMDMIGraphX/en/latest/) in an organized, easy-to-read format, with search and a table of contents. The documentation source files reside in the `docs` folder of this repository. As with all ROCm projects, the documentation is open source. For more information on contributing to the documentation, see [Contribute to ROCm documentation](https://rocm.docs.amd.com/en/latest/contribute/contributing.html).
7+
8+
> [!NOTE]
9+
> You must [install ROCm](https://rocm.docs.amd.com/projects/install-on-linux/en/latest/index.html) before
910
> installing MIGraphX.
1011
1112
## Installing from binaries
@@ -16,7 +17,7 @@ Install binaries using:
1617
sudo apt update && sudo apt install -y migraphx
1718
```
1819

19-
Header files and libraries are installed under `/opt/rocm-<version>`, where `<version>` is the ROCm
20+
Header files and libraries are installed under ``/opt/rocm-<version>``, where ``<version>`` is the ROCm
2021
version.
2122

2223
## Building from source

docs/dev/contributing-to-migraphx.rst

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,22 @@
55
.. _contributing-to-migraphx:
66

77
==========================
8-
Contributing to MIGraphX
8+
Developing for MIGraphX
99
==========================
1010

11-
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.
12-
Here is how some basic operations in the MIGraphX framework are performed.
11+
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.
1312

14-
Performing basic operations
13+
More examples can be found on `the MIGraphX GitHub repository <https://github.com/ROCmSoftwarePlatform/AMDMIGraphX/tree/develop/examples/migraphx>`_.
14+
15+
16+
Adding two literals
1517
----------------------------
1618

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

20-
The following code snippets demonstrate some basic operations using MIGraphX.
21-
22-
Adding literals
23-
******************
22+
We start with a snippet of the simple ``add_two_literals()`` function::
2423

25-
Here is a ``add_two_literals()`` function::
2624

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

5755
Adding Parameters
58-
*******************
56+
----------------------------
5957

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

8886
Handling Tensor Data
89-
**********************
87+
----------------------------
9088

9189
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::
9290

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

134132
Importing From ONNX
135-
**********************
133+
----------------------------
136134

137135
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.
138136
For usage, refer to the ``parse_onnx()`` function below::
139137

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

143-
Sample programs
144-
-----------------
145-
146-
You can find all the MIGraphX examples in the `Examples <https://github.com/ROCmSoftwarePlatform/AMDMIGraphX/tree/develop/examples/migraphx>`_ directory.
147141

148-
Build MIGraphX source code
149-
****************************
142+
Build this example
143+
----------------------------
150144

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

153147
make -j$(nproc) test_ref_dev_examples
154148

155-
This creates an executable file ``test_ref_dev_examples`` in the ``bin/`` of the build directory.
149+
This creates the ``test_ref_dev_examples`` under ``bin/`` in the build directory.
156150

157151
To verify the build, use:
158152

159153
make -j$(nproc) check
160-
161-
For detailed instructions on building MIGraphX from source, refer to the `README <https://github.com/ROCm/AMDMIGraphX#readme>`_ file.

docs/dev/dev_intro.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ Developer Introduction
22
======================
33

44
MIGraphX provides an optimized execution engine for deep learning neural networks.
5+
56
We will cover some simple operations in the MIGraphX framework here.
67
For a quick start guide to using MIGraphX, look in the examples directory: ``https://github.com/ROCmSoftwarePlatform/AMDMIGraphX/tree/develop/examples/migraphx``.
78

docs/index.rst

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,34 +5,41 @@
55
.. _index:
66

77
===========================
8-
AMD MIGraphX documentation
8+
MIGraphX documentation
99
===========================
1010

11-
Welcome to the MIGraphX docs home page! To learn more, see :ref:`what-is-migraphx`.
11+
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:
1212

13-
Our documentation is structured as follows:
13+
* Operator fusion
14+
* Arithmetic simplifications
15+
* Dead-code elimination
16+
* Common subexpression elimination (CSE)
17+
* Constant propagation
18+
19+
After optimization, MIGraphX generates code for AMD GPUs by calling various ROCm libraries to create the fastest combinations of HIP kernels.
20+
21+
The MIGraphX public repository is located at `https://github.com/ROCm/AMDMIGraphX/ <https://github.com/ROCm/AMDMIGraphX/>`_
1422

1523
.. grid:: 2
1624
:gutter: 3
1725

18-
.. grid-item-card:: Reference
26+
.. grid-item-card:: Install
27+
28+
* :doc:`Installing MIGraphX <./install/installing_with_package>`
29+
30+
.. grid-item-card:: Using the MIGraphX API
1931

2032
* :ref:`cpp-api-reference`
2133
* :ref:`python-api-reference`
2234
* :ref:`migraphx-driver`
2335

24-
.. grid-item-card:: Contribution
36+
.. grid-item-card:: Contributing to the MIGraphX code base
2537

26-
* :ref:`contributing-to-migraphx`
38+
* :doc:`Building MIGraphX <./install/building_migraphx>`
39+
* :doc:`Developing for MIGraphX <./dev/contributing-to-migraphx>`
2740

2841
To contribute to the documentation refer to
29-
`Contributing to ROCm <https://rocm.docs.amd.com/en/latest/contribute/contributing.html>`_.
42+
`Contribute to ROCm documentation <https://rocm.docs.amd.com/en/latest/contribute/contributing.html>`_.
3043

3144
Licensing information can be found on the
3245
`Licensing <https://rocm.docs.amd.com/en/latest/about/license.html>`_ page.
33-
34-
Index and search
35-
==================
36-
37-
* :ref:`genindex`
38-
* :ref:`search`
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
.. meta::
2+
:description: Build and install MIGraphX using CMake
3+
:keywords: build, install, MIGraphX, AMD, ROCm, CMake
4+
5+
********************************************************************
6+
Build and install MIGraphX using CMake
7+
********************************************************************
8+
9+
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.
10+
11+
.. note::
12+
13+
This method for building MIGraphX requires using ``sudo``.
14+
15+
16+
1. Install the dependencies:
17+
18+
.. code:: shell
19+
20+
sudo rbuild build -d depend -B build -DGPU_TARGETS=$(/opt/rocm/bin/rocminfo | grep -o -m1 'gfx.*')
21+
22+
.. note::
23+
24+
If ``rbuild`` is not installed on your system, install it with:
25+
26+
.. code:: shell
27+
28+
pip3 install --prefix /usr/local https://github.com/RadeonOpenCompute/rbuild/archive/master.tar.gz
29+
30+
2. Create a build directory and change directory to it:
31+
32+
.. code:: shell
33+
34+
mkdir build
35+
cd build
36+
37+
3. Configure CMake:
38+
39+
.. code:: shell
40+
41+
CXX=/opt/rocm/llvm/bin/clang++ cmake .. -DGPU_TARGETS=$(/opt/rocm/bin/rocminfo | grep -o -m1 'gfx.*')
42+
43+
4. Build MIGraphX source code:
44+
45+
.. code:: shell
46+
47+
make -j$(nproc)
48+
49+
50+
You can verify this using:
51+
52+
.. code:: shell
53+
54+
make -j$(nproc) check
55+
56+
57+
5. Install MIGraphX libraries:
58+
59+
.. code:: shell
60+
61+
make install
62+
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
.. meta::
2+
:description: Installing MIGraphX using Docker
3+
:keywords: install, MIGraphX, AMD, ROCm, Docker
4+
5+
********************************************************************
6+
Installing MIGraphX using Docker
7+
********************************************************************
8+
9+
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.
10+
11+
.. note::
12+
13+
Docker commands are run using ``sudo``.
14+
15+
1. Build the Docker image. This command will install all the prerequisites required to install MIGraphX. Ensure that you are running this in the same directory as ``Dockerfile``.
16+
17+
.. code:: shell
18+
19+
sudo docker build -t migraphx .
20+
21+
22+
2. Create and run the container. Once this command is run, you will be in the ``/code/AMDMIGraphX`` directory of a pseudo-tty.
23+
24+
.. code:: shell
25+
26+
sudo docker run --device='/dev/kfd' --device='/dev/dri' -v=`pwd`:/code/AMDMIGraphX -w /code/AMDMIGraphX --group-add video -it migraphx
27+
28+
3. In the ``/code/AMDMIGraphX``, create a ``build`` directory, then change directory to ``/code/AMDMIGraphX/build``:
29+
30+
.. code:: shell
31+
32+
mkdir build
33+
cd build
34+
35+
36+
4. Configure CMake:
37+
38+
.. code:: shell
39+
40+
CXX=/opt/rocm/llvm/bin/clang++ cmake .. -DGPU_TARGETS=$(/opt/rocm/bin/rocminfo | grep -o -m1 'gfx.*')
41+
42+
4. Build the MIGraphX libraries:
43+
44+
.. code:: shell
45+
46+
make -j$(nproc)
47+
48+
5. Install the libraries:
49+
50+
.. code:: shell
51+
52+
make install
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
.. meta::
2+
:description: Build and install MIGraphX using rbuild
3+
:keywords: build, install, MIGraphX, AMD, ROCm, rbuild
4+
5+
********************************************************************
6+
Build and install MIGraphX using rbuild
7+
********************************************************************
8+
9+
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.
10+
11+
.. note::
12+
13+
This method for building MIGraphX requires using ``sudo``.
14+
15+
1. Install `rocm-cmake`, `pip3`, `rocblas`, and `miopen-hip`:
16+
17+
.. code:: shell
18+
19+
sudo apt install -y rocm-cmake python3-pip rocblas miopen-hip
20+
21+
2. Install `rbuild <https://github.com/RadeonOpenCompute/rbuild>`_:
22+
23+
.. code:: shell
24+
25+
pip3 install --prefix /usr/local https://github.com/RadeonOpenCompute/rbuild/archive/master.tar.gz
26+
27+
28+
3. Build MIGraphX source code:
29+
30+
.. code:: shell
31+
32+
sudo rbuild build -d depend -B build -DGPU_TARGETS=$(/opt/rocm/bin/rocminfo | grep -o -m1 'gfx.*')

docs/install/building_migraphx.rst

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
.. meta::
2+
:description: Build and install MIGraphX
3+
:keywords: build, install, MIGraphX, AMD, ROCm, rbuild, development, contributing
4+
5+
********************************************************************
6+
Building MIGraphX
7+
********************************************************************
8+
9+
ROCm must be installed prior to building MIGraphX. See `ROCm installation for Linux <https://rocm.docs.amd.com/projects/install-on-linux/en/latest/>`_ for information on ROCm installation on Linux.
10+
11+
.. note::
12+
13+
This method for building MIGraphX requires using ``sudo``.
14+
15+
1. Install `rocm-cmake`, `pip3`, `rocblas`, and `miopen-hip`:
16+
17+
.. code:: shell
18+
19+
sudo apt install -y rocm-cmake python3-pip rocblas miopen-hip
20+
21+
2. Install `rbuild <https://github.com/RadeonOpenCompute/rbuild>`_:
22+
23+
.. code:: shell
24+
25+
pip3 install --prefix /usr/local https://github.com/RadeonOpenCompute/rbuild/archive/master.tar.gz
26+
27+
28+
3. Build MIGraphX source code:
29+
30+
.. code:: shell
31+
32+
sudo rbuild build -d depend -B build -DGPU_TARGETS=$(/opt/rocm/bin/rocminfo | grep -o -m1 'gfx.*')
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
.. meta::
2+
:description: Installing MIGraphX using the package installer
3+
:keywords: install, MIGraphX, AMD, ROCm, package installer
4+
5+
********************************************************************
6+
Installing MIGraphX
7+
********************************************************************
8+
9+
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.
10+
11+
Installing MIGraphX using the package installer is sufficient for users who want to use the MIGraphX API.
12+
13+
If you want to develop for MIGraphX and contribute to the source code, see `Building MIGraphX <https://rocm.docs.amd.com/projects/AMDMIGraphX/en/latest/install/docs/install/building_migraphx.html>`_ and `Developing for MIGraphX <https://rocm.docs.amd.com/projects/AMDMIGraphX/en/latest/dev/contributing-to-migraphx.html>`_
14+
15+
The package installer will install all the prerequisites needed for MIGraphX.
16+
17+
Use the following command to install MIGraphX:
18+
19+
.. code:: shell
20+
21+
sudo apt update && sudo apt install -y migraphx

0 commit comments

Comments
 (0)