Unverified Commit 02f7405a authored by Paul Fultz II's avatar Paul Fultz II Committed by GitHub
Browse files

Fixes doc generation and cross referencing (#2502)

parent 32f0b028
......@@ -28,7 +28,14 @@ MACRO_EXPANSION = YES
OUTPUT_DIRECTORY = docBin
PREDEFINED = DOXYGEN
PREDEFINED = \
DOXYGEN \
MIGRAPHX_EXPORT= \
MIGRAPHX_API_EXPORT= \
MIGRAPHX_GPU_EXPORT= \
MIGRAPHX_CPU_EXPORT= \
MIGRAPHX_ONNX_EXPORT= \
MIGRAPHX_TF_EXPORT= \
PROJECT_NAME = MIGraphX
......
......@@ -5,26 +5,36 @@ shape
-----
.. doxygenstruct:: migraphx::internal::shape
:members:
:undoc-members:
literal
-------
.. doxygenstruct:: migraphx::internal::literal
:members:
:undoc-members:
argument
--------
.. doxygenstruct:: migraphx::internal::argument
:members:
:undoc-members:
raw_data
--------
.. doxygenstruct:: migraphx::internal::raw_data
:members:
:undoc-members:
.. doxygenfunction:: migraphx::internal::visit_all
.. doxygenfunction:: template<class T, class ...Ts> auto migraphx::internal::visit_all(T &&x, Ts&&... xs)
tensor_view
-----------
.. doxygenstruct:: migraphx::internal::tensor_view
:members:
:undoc-members:
......@@ -18,8 +18,8 @@ Directions for building MIGraphX from source can be found in the main README fil
Adding Two Literals
--------------------
A program is a collection of modules, which are collections of instructions to be executed when calling `eval <migraphx::program::eval>`.
Each instruction has an associated `operation <migraphx::operation>` which represents the computation to be performed by the instruction.
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.
We start with a snippet of the simple ``add_two_literals()`` function::
......@@ -41,14 +41,14 @@ We start with a snippet of the simple ``add_two_literals()`` function::
auto result = p.eval({}).back();
std::cout << "add_two_literals: 1 + 2 = " << result << "\n";
We start by creating a simple ``migraphx::program`` object and then getting a pointer to the main module of it.
We start by creating a simple :cpp:any:`migraphx::program <migraphx::internal::program>` object and then getting a pointer to the main module of it.
The program is a collection of ``modules`` that start executing from the main module, so instructions are added to the modules rather than directly onto the program object.
We then use the `add_literal <migraphx::program::add_literal>` function to add an instruction that stores the literal number ``1`` while returning an `instruction_ref <migraphx::instruction_ref>`.
The returned `instruction_ref <migraphx::instruction_ref>` can be used in another instruction as an input.
We use the same `add_literal <migraphx::program::add_literal>` function to add a ``2`` to the program.
We then use the :cpp:any:`add_literal <migraphx::internal::program::add_literal>` function to add an instruction that stores the literal number ``1`` while returning an :cpp:any:`instruction_ref <migraphx::internal::instruction_ref>`.
The returned :cpp:any:`instruction_ref <migraphx::internal::instruction_ref>` can be used in another instruction as an input.
We use the same :cpp:any:`add_literal <migraphx::internal::program::add_literal>` function to add a ``2`` to the program.
After creating the literals, we then create the instruction to add the numbers together.
This is done by using the `add_instruction <migraphx::program::add_instruction>` function with the ``"add"`` `operation <migraphx::program::operation>` created by `make_op <migraphx::program::make_op>` along with the previous `add_literal` `instruction_ref <migraphx::instruction_ref>` for the input arguments of the instruction.
Finally, we can run this `program <migraphx::program>` by compiling it for the reference target (CPU) and then running it with `eval <migraphx::program::eval>`
This is done by using the :cpp:any:`add_instruction <migraphx::internal::program::add_instruction>` function with the ``"add"`` :cpp:any:`operation <migraphx::internal::program::operation>` created by :cpp:any:`make_op <migraphx::internal::program::make_op>` along with the previous `add_literal` :cpp:any:`instruction_ref <migraphx::internal::instruction_ref>` for the input arguments of the instruction.
Finally, we can run this :cpp:any:`program <migraphx::internal::program>` by compiling it for the reference target (CPU) and then running it with :cpp:any:`eval <migraphx::internal::program::eval>`
The result is then retreived and printed to the console.
We can compile the program for the GPU as well, but the file will have to be moved to the ``test/gpu/`` directory and the correct target must be included::
......@@ -76,8 +76,8 @@ We can modify the program to take an input parameter ``x``, as seen in the ``add
p.compile(migraphx::ref::target{});
This adds a parameter of type ``int32``, and compiles it for the CPU.
To run the program, we need to pass the parameter as a ``parameter_map`` when we call `eval <migraphx::program::eval>`.
We create the ``parameter_map`` by setting the ``x`` key to an `argument <migraphx::argument>` object with an ``int`` data type::
To run the program, we need to pass the parameter as a ``parameter_map`` when we call :cpp:any:`eval <migraphx::internal::program::eval>`.
We create the ``parameter_map`` by setting the ``x`` key to an :cpp:any:`argument <migraphx::internal::argument>` object with an ``int`` data type::
// create a parameter_map object for passing a value to the "x" parameter
std::vector<int> data = {4};
......@@ -92,7 +92,7 @@ We create the ``parameter_map`` by setting the ``x`` key to an `argument <migrap
Handling Tensor Data
---------------------
In the previous examples we have only been dealing with scalars, but the `shape <migraphx::shape>` class can describe multi-dimensional tensors.
In the previous examples we have only been dealing with scalars, but the :cpp:any:`shape <migraphx::internal::shape>` class can describe multi-dimensional tensors.
For example, we can compute a simple convolution::
migraphx::program p;
......@@ -109,7 +109,7 @@ For example, we can compute a simple convolution::
Here we create two parameters for both the ``input`` and ``weights``.
In the previous examples, we created simple literals, however, most programs will take data from allocated buffers (usually on the GPU).
In this case, we can create `argument <migraphx::argument>` objects directly from the pointers to the buffers::
In this case, we can create :cpp:any:`argument <migraphx::internal::argument>` objects directly from the pointers to the buffers::
// Compile the program
p.compile(migraphx::ref::target{});
......@@ -133,8 +133,8 @@ In this case, we can create `argument <migraphx::argument>` objects directly fro
EXPECT(migraphx::verify::verify_rms_range(results_vector, sol));
An `argument <migraphx::argument>` can handle memory buffers from either the GPU or the CPU.
By default when running the `program <migraphx::program>`, buffers are allocated on the corresponding target.
An :cpp:any:`argument <migraphx::internal::argument>` can handle memory buffers from either the GPU or the CPU.
By default when running the :cpp:any:`program <migraphx::internal::program>`, buffers are allocated on the corresponding target.
When compiling for the CPU, the buffers by default will be allocated on the CPU.
When compiling for the GPU, the buffers by default will be allocated on the GPU.
With the option ``offload_copy=true`` set while compiling for the GPU, the buffers will be located on the CPU.
......@@ -143,7 +143,7 @@ With the option ``offload_copy=true`` set while compiling for the GPU, the buffe
Importing From ONNX
--------------------
A `program <migraphx::program>` can be built directly from an onnx file using the MIGraphX ONNX parser.
A :cpp:any:`program <migraphx::internal::program>` can be built directly from an onnx file using the MIGraphX ONNX parser.
This makes it easier to use neural networks directly from other frameworks.
In this case, there is an ``parse_onnx`` function::
......
......@@ -5,6 +5,8 @@ operation
---------
.. doxygenstruct:: migraphx::internal::operation
:members:
:undoc-members:
.. doxygenfunction:: migraphx::internal::is_context_free
......@@ -14,3 +16,5 @@ operators
---------
.. doxygennamespace:: migraphx::internal::op
:members:
:undoc-members:
......@@ -5,63 +5,82 @@ pass
----
.. doxygenstruct:: migraphx::internal::pass
:members:
:undoc-members:
dead_code_elimination
---------------------
.. doxygenstruct:: migraphx::internal::dead_code_elimination
:members:
:undoc-members:
eliminate_common_subexpression
------------------------------
.. doxygenstruct:: migraphx::internal::eliminate_common_subexpression
:members:
:undoc-members:
eliminate_concat
----------------
.. doxygenstruct:: migraphx::internal::eliminate_concat
:members:
:undoc-members:
eliminate_contiguous
--------------------
.. doxygenstruct:: migraphx::internal::eliminate_contiguous
:members:
:undoc-members:
eliminate_identity
------------------
.. doxygenstruct:: migraphx::internal::eliminate_identity
:members:
:undoc-members:
eliminate_pad
-------------
.. doxygenstruct:: migraphx::internal::eliminate_pad
:members:
:undoc-members:
propagate_constant
------------------
.. doxygenstruct:: migraphx::internal::propagate_constant
rewrite_batchnorm
-----------------
.. doxygenstruct:: migraphx::internal::rewrite_batchnorm
:members:
:undoc-members:
rewrite_rnn
-----------
.. doxygenstruct:: migraphx::internal::rewrite_rnn
:members:
:undoc-members:
schedule
--------
.. doxygenstruct:: migraphx::internal::schedule
:members:
:undoc-members:
simplify_algebra
----------------
.. doxygenstruct:: migraphx::internal::simplify_algebra
:members:
:undoc-members:
simplify_reshapes
-----------------
.. doxygenstruct:: migraphx::internal::simplify_reshapes
:members:
:undoc-members:
......@@ -5,6 +5,8 @@ instruction
-----------
.. doxygenstruct:: migraphx::internal::instruction
:members:
:undoc-members:
instruction_ref
---------------
......@@ -17,6 +19,8 @@ program
-------
.. doxygenstruct:: migraphx::internal::program
:members:
:undoc-members:
parse_onnx
----------
......
......@@ -5,14 +5,20 @@ target
------
.. doxygenstruct:: migraphx::internal::target
:members:
:undoc-members:
gpu::target
-----------
.. doxygenstruct:: migraphx::internal::gpu::target
:members:
:undoc-members:
cpu::target
-----------
.. doxygenstruct:: migraphx::internal::cpu::target
:members:
:undoc-members:
......@@ -8,45 +8,65 @@ shape
.. doxygenenum:: migraphx_shape_datatype_t
.. doxygenstruct:: migraphx::shape
:members:
:undoc-members:
argument
--------
.. doxygenstruct:: migraphx::argument
:members:
:undoc-members:
target
------
.. doxygenstruct:: migraphx::target
:members:
:undoc-members:
program
-------
.. doxygenstruct:: migraphx::program_parameter_shapes
:members:
:undoc-members:
.. doxygenstruct:: migraphx::program_parameters
:members:
:undoc-members:
.. doxygenstruct:: migraphx_compile_options
:members:
:undoc-members:
.. doxygenstruct:: migraphx::program
:members:
:undoc-members:
quantize
--------
.. doxygenstruct:: migraphx::quantize_op_names
:members:
:undoc-members:
.. doxygenfunction:: migraphx::quantize_fp16(const program&)
.. doxygenfunction:: migraphx::quantize_fp16(const program&, const quantize_op_names&)
.. doxygenstruct:: migraphx::quantize_int8_options
:members:
:undoc-members:
.. doxygenfunction:: migraphx::quantize_int8
.. doxygenfunction::migraphx::quantize_int8
parse_onnx
----------
.. doxygenstruct:: migraphx::onnx_options
:members:
:undoc-members:
.. doxygenfunction:: migraphx::parse_onnx(const char *)
......@@ -63,16 +83,18 @@ parse_onnx
load
----
.. doxygenstruct:: migraphx_file_options
.. doxygenstruct:: migraphx::file_options
:members:
:undoc-members:
.. doxygenfunction:: migraphx::load(const char *)
.. doxygenfunction:: migraphx::load(const char *, migraphx_file_options)
.. doxygenfunction:: migraphx::load(const char *, const file_options&)
save
----
.. doxygenfunction:: migraphx::save(const program&, const char *)
.. doxygenfunction:: migraphx::save(const program&, const char *, migraphx_file_options)
.. doxygenfunction:: migraphx::save(const program&, const char *, const file_options&)
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