"...gpu/git@developer.sourcefind.cn:gaoqiong/migraphx.git" did not exist on "90a37082deb7c2e2a410545352ef344820c67e64"
Commit bc5d7f75 authored by Paul's avatar Paul
Browse files

Merge from develop

parents 47c0854d a5b0afa0
CheckOptions:
- key: bugprone-unused-return-value.CheckedFunctions
value: '::std::async;::std::launder;::std::remove;::std::remove_if;::std::unique;::std::unique_ptr::release;::std::basic_string::empty;::std::vector::empty;::std::find;::std::find_if;::std::find_if_not;::std::all_of;::std::any_of;::std::none_of;::std::count;::std::count_if;::std::mismatch;::std::find_end;::std::find_first_of;::std::adjacent_find;::std::search;::std::search_n;::std::nth_element;::std::lower_bound;::std::upper_bound;::std::binary_search;::std::equal_range;::std::max;::std::max_element;::std::min;::std::min_element;::std::minmax;::std::minmax_element;::std::equal;::std::lexicographical_compare;::std::accumulate;::std::inner_product'
- key: cppcoreguidelines-macro-usage.AllowedRegexp
value: 'DEBUG|FALLTHROUGH|_THROW|_REQUIRES|_DECLARE_|_VISIT_|_GENERATE_|_DETAIL_|_MANAGE_PTR|_MATCHER|DEVICE_SHARED'
- key: modernize-loop-convert.MinConfidence
value: risky
- key: modernize-loop-convert.NamingStyle
value: lower_case
- key: performance-unnecessary-copy-initialization.AllowedTypes
value: 'shape'
- key: performance-unnecessary-value-param.AllowedTypes
value: 'shape'
- key: readability-function-size.BranchThreshold
value: '15'
- key: readability-function-size.LineThreshold
......@@ -104,4 +110,4 @@ CheckOptions:
# - key: readability-identifier-naming.MacroDefinitionCase
# value: UPPER_CASE
# - key: readability-identifier-naming.MacroDefinitionPrefix
# value: MIGRAPH_
# value: MIGRAPHX_
......@@ -17,7 +17,7 @@ else()
set(CMAKE_INSTALL_PREFIX "/opt/rocm" CACHE PATH "")
endif()
project(migraph)
project(migraphx)
find_package(ROCM REQUIRED)
include(ROCMSetupVersion)
......@@ -34,9 +34,9 @@ endif()
if(CMAKE_CXX_COMPILER MATCHES ".*hcc")
message(STATUS "Enable miopen backend")
set(MIGRAPH_ENABLE_GPU On CACHE BOOL "")
set(MIGRAPHX_ENABLE_GPU On CACHE BOOL "")
else()
set(MIGRAPH_ENABLE_GPU Off CACHE BOOL "")
set(MIGRAPHX_ENABLE_GPU Off CACHE BOOL "")
endif()
add_compile_options(-std=c++14)
......@@ -52,6 +52,7 @@ rocm_enable_clang_tidy(
-clang-analyzer-optin.performance.Padding
-clang-diagnostic-deprecated-declarations
-clang-diagnostic-extern-c-compat
-clang-diagnostic-disabled-macro-expansion
-clang-diagnostic-unused-command-line-argument
-cppcoreguidelines-pro-bounds-array-to-pointer-decay
-cppcoreguidelines-pro-bounds-constant-array-index
......@@ -70,13 +71,12 @@ rocm_enable_clang_tidy(
-hicpp-explicit-conversions
-hicpp-no-array-decay
-hicpp-special-member-functions
-hicpp-uppercase-literal-suffix
-hicpp-use-override
# This check is broken
-hicpp-use-auto
-llvm-header-guard
-llvm-include-order
-misc-macro-parentheses
-modernize-use-auto
-modernize-use-override
-modernize-pass-by-value
-modernize-use-default-member-init
......@@ -84,7 +84,12 @@ rocm_enable_clang_tidy(
-readability-braces-around-statements
-readability-else-after-return
-readability-named-parameter
-readability-uppercase-literal-suffix,
-*-avoid-c-arrays
-*-explicit-constructor
-*-magic-numbers
-*-non-private-member-variables-in-classes
-*-use-auto
-*-use-emplace
-*-use-equals-default
ERRORS
......@@ -93,7 +98,8 @@ rocm_enable_clang_tidy(
HEADER_FILTER
".*hpp"
EXTRA_ARGS
-DMIGRAPH_USE_CLANG_TIDY
-DMIGRAPHX_USE_CLANG_TIDY
"-Dmain\\\\(...\\\\)=main\\\\(__VA_ARGS__\\\\) // NOLINT"
)
include(ROCMCppCheck)
......@@ -111,7 +117,9 @@ rocm_enable_cppcheck(
passedByValue
unusedStructMember
functionStatic
functionConst
functionConst:*program.*
shadowFunction
shadowVar
definePrefix:*test/include/test.hpp
FORCE
INCONCLUSIVE
......@@ -124,6 +132,7 @@ rocm_enable_cppcheck(
${CMAKE_CURRENT_SOURCE_DIR}/src/include
${CMAKE_CURRENT_SOURCE_DIR}/src/targets/cpu/include
${CMAKE_CURRENT_SOURCE_DIR}/src/targets/miopen/include
${CMAKE_CURRENT_SOURCE_DIR}/test/include
DEFINE
CPPCHECK=1
)
......@@ -132,11 +141,11 @@ enable_testing()
include(ROCMCreatePackage)
rocm_create_package(
NAME MIGraph
NAME MIGraphX
DESCRIPTION "AMD's graph optimizer"
MAINTAINER "Paul Fultz II <paul.fultz@amd.com>"
LDCONFIG
DEPENDS miopen-hip rocblas hip_hcc
DEPENDS miopen-hip rocblas hip_hcc half
)
add_subdirectory(src)
......
......@@ -50,7 +50,7 @@ RUN pip install cget
RUN pip install https://github.com/pfultz2/rclone/archive/master.tar.gz
# Install hcc
RUN rclone -b sanitizer1 https://github.com/RadeonOpenCompute/hcc.git /hcc
RUN rclone -b roc-2.0.x -c 757fb492517b80e7c86338af5fc1a43d63cb25a9 https://github.com/RadeonOpenCompute/hcc.git /hcc
RUN cget -p $PREFIX install hcc,/hcc
# Use hcc
......
def rocmtestnode(variant, name, body) {
def image = 'migraphlib'
def image = 'migraphxlib'
def cmake_build = { compiler, flags ->
def cmd = """
ulimit -c unlimited
......@@ -8,10 +8,16 @@ def rocmtestnode(variant, name, body) {
mkdir build
cd build
CXX=${compiler} CXXFLAGS='-Werror -Wno-fallback' cmake ${flags} ..
CTEST_PARALLEL_LEVEL=32 make -j32 all doc check
CTEST_PARALLEL_LEVEL=32 make -j32 generate all doc package check
"""
echo cmd
sh cmd
if (compiler == "hcc") {
// Only archive from master or develop
if (env.BRANCH_NAME == "develop" || env.BRANCH_NAME == "master") {
archiveArtifacts artifacts: "build/*.deb", allowEmptyArchive: true, fingerprint: true
}
}
}
node(name) {
stage("checkout ${variant}") {
......@@ -73,7 +79,7 @@ rocmtest tidy: rocmnode('rocmtest') { cmake_build ->
rm -rf build
mkdir build
cd build
CXX='clang++-5.0' cmake ..
CXX=hcc cmake ..
make -j8 -k analyze
'''
}
......@@ -91,11 +97,12 @@ rocmtest tidy: rocmnode('rocmtest') { cmake_build ->
| xargs -n 1 -P 1 -I{} -t sh -c \'clang-format-5.0 -style=file {} | diff - {}\'
'''
}
}, clang: rocmnode('rocmtest') { cmake_build ->
}, clang: rocmnode('vega') { cmake_build ->
stage('Clang Debug') {
// TODO: Enanle integer
def sanitizers = "undefined"
cmake_build("hcc", "-DCMAKE_BUILD_TYPE=debug -DCMAKE_CXX_FLAGS_DEBUG='-g -fno-omit-frame-pointer -fsanitize=${sanitizers} -fno-sanitize-recover=${sanitizers}'")
def debug_flags = "-g -fno-omit-frame-pointer -fsanitize=${sanitizers} -fno-sanitize-recover=${sanitizers}"
cmake_build("hcc", "-DCMAKE_BUILD_TYPE=debug -DMIGRAPHX_ENABLE_PYTHON=Off -DCMAKE_CXX_FLAGS_DEBUG='${debug_flags}'")
}
stage('Clang Release') {
cmake_build("hcc", "-DCMAKE_BUILD_TYPE=release")
......@@ -113,6 +120,19 @@ rocmtest tidy: rocmnode('rocmtest') { cmake_build ->
def cmake_linker_flags = "-DCMAKE_EXE_LINKER_FLAGS='${linker_flags}' -DCMAKE_SHARED_LINKER_FLAGS='${linker_flags}'"
// TODO: Add bounds-strict
def sanitizers = "undefined,address"
cmake_build("g++-7", "-DCMAKE_BUILD_TYPE=debug ${cmake_linker_flags} -DCMAKE_CXX_FLAGS_DEBUG='-g -fno-omit-frame-pointer -fsanitize-address-use-after-scope -fsanitize=${sanitizers} -fno-sanitize-recover=${sanitizers}'")
def debug_flags = "-g -fprofile-arcs -ftest-coverage -fno-omit-frame-pointer -fsanitize-address-use-after-scope -fsanitize=${sanitizers} -fno-sanitize-recover=${sanitizers}"
cmake_build("g++-7", "-DCMAKE_BUILD_TYPE=debug -DMIGRAPHX_ENABLE_PYTHON=Off ${cmake_linker_flags} -DCMAKE_CXX_FLAGS_DEBUG='${debug_flags}'")
}
stage('Codecov') {
env.CODECOV_TOKEN="8545af1c-f90b-4345-92a5-0d075503ca56"
sh '''
cd build
lcov --directory . --capture --output-file coverage.info
lcov --remove coverage.info '/usr/*' --output-file coverage.info
lcov --list coverage.info
curl -s https://codecov.io/bash | bash
echo "Uploaded"
'''
}
}
# MIGraph
# AMD MIGraphX
AMD's library for graph optimizations.
AMD's graph optimization engine.
## Prerequisites
* [ROCm cmake modules](https://github.com/RadeonOpenCompute/rocm-cmake) **required**
......@@ -8,6 +8,7 @@ AMD's library for graph optimizations.
* [HIP](https://github.com/ROCm-Developer-Tools/HIP) for running on the GPU
* [Protobuf](https://github.com/google/protobuf) for reading [onxx](https://github.com/onnx/onnx) files
* [Half](http://half.sourceforge.net/) - IEEE 754-based half-precision floating point library
* [pybind11](https://pybind11.readthedocs.io/en/stable/) - for python bindings
## Installing the dependencies
......@@ -20,7 +21,7 @@ cmake -P install_deps.cmake --prefix /some/local/dir
```
## Building MIGraph from source
## Building MIGraphX from source
## Configuring with cmake
......@@ -105,8 +106,8 @@ Also, githooks can be installed to format the code per-commit:
The easiest way to setup the development environment is to use docker. You can build the top-level docker file:
docker build -t migraph .
docker build -t migraphx .
Then to enter the developement environment use `docker run`:
docker run --device='/dev/kfd' --device='/dev/dri' -v=`pwd`:/data -w /data --group-add video -it migraph
docker run --device='/dev/kfd' --device='/dev/dri' -v=`pwd`:/data -w /data --group-add video -it migraphx
ignore:
- "test/"
......@@ -34,11 +34,19 @@
</rule>
<rule>
<tokenlist>define</tokenlist>
<pattern>define (MIGRAP|[^H]{6})[^H][^_]</pattern>
<pattern>define (MIGRAPH|[^X]{7})[^X][^_]</pattern>
<message>
<id>definePrefix</id>
<severity>style</severity>
<summary>Macros must be prefixed with MIGRAPH_</summary>
<summary>Macros must be prefixed with MIGRAPHX_</summary>
</message>
</rule>
<rule>
<pattern>mutable \w+</pattern>
<message>
<id>MutableVariable</id>
<severity>style</severity>
<summary>Do not create mutable variables.</summary>
</message>
</rule>
<rule>
......@@ -74,7 +82,7 @@
</message>
</rule>
<rule>
<pattern>(fclose|free|hipFree) \(</pattern>
<pattern>\\W(fclose|free|hipFree|hipHostFree|hipFreeArray|hipMemFree|hipStreamDestroy|hipEventDestroy|hipArrayDestroy|hipCtxDestroy|hipDestroyTextureObject|hipDestroySurfaceObject) \(</pattern>
<message>
<id>useManagePointer</id>
<severity>style</severity>
......
pfultz2/rocm-recipes
pcre
danmar/cppcheck@f965e5873 -DHAVE_RULES=1
ROCm-Developer-Tools/HIP@3a41f286203968421c557338d6fb39c36f3c717c
# python/cpython@v3.6.6 -X autotools -H sha256:92aa914572c695c0aeb01b0a214813f414da4b51a371234df514a74761f2bb36
danmar/cppcheck@681cb7dd909d1bfe41796b7616e43265177b9464 -DHAVE_RULES=1
ROCm-Developer-Tools/HIP@fc22ef991ce7cb15821c8ccb4f03cdfc3e7e43cf
python/cpython@v3.6.6 -X autotools -H sha256:92aa914572c695c0aeb01b0a214813f414da4b51a371234df514a74761f2bb36
-f requirements.txt
......@@ -19,7 +19,7 @@ add_doxygen_doc(
CALL_GRAPH YES
CALLER_GRAPH YES
BUILTIN_STL_SUPPORT YES
PROJECT_NAME MIGraph
PROJECT_NAME MIGraphX
SORT_MEMBERS_CTORS_1ST YES
SOURCE_BROWSER YES
GENERATE_TREEVIEW YES
......@@ -32,7 +32,7 @@ add_doxygen_doc(
PREDEFINED DOXYGEN
)
add_custom_target(remove_inline_ns
sed -i "s/MIGRAPH_INLINE_NS:://g" *.xml
sed -i "s/MIGRAPHX_INLINE_NS:://g" *.xml
WORKING_DIRECTORY ${DOXYGEN_OUTPUT}/xml)
add_dependencies(remove_inline_ns doxygen)
......
# -*- coding: utf-8 -*-
#
# MIGraph documentation build configuration file, created by
# MIGraphX 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
......@@ -45,7 +45,7 @@ source_suffix = '.rst'
master_doc = 'index'
# General information about the project.
project = u'MIGraph'
project = u'MIGraphX'
copyright = u'2018, AMD'
author = u'AMD'
......@@ -101,7 +101,7 @@ html_static_path = ['_static']
# -- Options for HTMLHelp output ------------------------------------------
# Output file base name for HTML help builder.
htmlhelp_basename = 'MIGraphdoc'
htmlhelp_basename = 'MIGraphXdoc'
# -- Options for LaTeX output ---------------------------------------------
......@@ -128,7 +128,7 @@ latex_elements = {
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'MIGraph.tex', u'MIGraph Documentation',
(master_doc, 'MIGraphX.tex', u'MIGraphX Documentation',
u'AMD', 'manual'),
]
......@@ -138,7 +138,7 @@ latex_documents = [
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(master_doc, 'migraph', u'MIGraph Documentation',
(master_doc, 'migraphx', u'MIGraphX Documentation',
[author], 1)
]
......@@ -149,13 +149,13 @@ man_pages = [
# (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.',
(master_doc, 'MIGraphX', u'MIGraphX Documentation',
author, 'MIGraphX', 'One line description of project.',
'Miscellaneous'),
]
breathe_default_members = ('members', 'undoc-members')
cpp_index_common_prefix = ['migraph::']
cpp_index_common_prefix = ['migraphx::']
default_role = 'any'
primary_domain = 'cpp'
......
.. MIGraph documentation master file, created by
.. MIGraphX 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!
===================================
Welcome to AMD MIGraphX's documentation!
========================================
.. toctree::
:maxdepth: 3
......
Overview
========
MIGraph provides an optimized execution engine for deep learning neural networks.
MIGraphX provides an optimized execution engine for deep learning neural networks.
Building a program
------------------
A program consists of a set of instructions to be executed when calling `eval <migraph::program::eval>`. Each instruction has an associated `operation <migraph::operation>` which represents the computation to be performed by the instruction.
A program consists of a set 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.
We can start by building a simple program to add two numbers together::
......@@ -15,11 +15,11 @@ We can start by building a simple program to add two numbers together::
instruction_ref two = p.add_literal(2);
p.add_instruction(add{}, one, two);
The `add_literal <migraph::program::add_literal>` function will add an instruction to the program to store a literal number. The `instruction_ref <migraph::instruction_ref>` is a reference to the instruction in the program, which can be used to compose the output of the instruction with another instruction.
The `add_literal <migraphx::program::add_literal>` function will add an instruction to the program to store a literal number. The `instruction_ref <migraphx::instruction_ref>` is a reference to the instruction in the program, which can be used to compose the output of the instruction with another instruction.
After creating the literals, we then create the instruction to add the numbers together. This is done by using the `add{} <migraph::add>` operation class along with the `instruction_ref <migraph::instruction_ref>` for the input arguments of the instruction.
After creating the literals, we then create the instruction to add the numbers together. This is done by using the `add{} <migraphx::add>` operation class along with the `instruction_ref <migraphx::instruction_ref>` for the input arguments of the instruction.
Finally, we can run this `program <migraph::program>` by compiling it for the cpu and then running it with `eval <migraph::program::eval>`::
Finally, we can run this `program <migraphx::program>` by compiling it for the cpu and then running it with `eval <migraphx::program::eval>`::
p.compile(cpu::target{});
argument result = p.eval({});
......@@ -43,7 +43,7 @@ Of course, this program will always produce the same value which is quite uninte
p.add_instruction(add{}, x, two);
p.compile(cpu::target{});
This adds a parameter of type ``int64``, and compiles it for the ``cpu``. To run the program, we need to pass the parameter to it when we call `eval <migraph::program::eval>`::
This adds a parameter of type ``int64``, and compiles it for the ``cpu``. To run the program, we need to pass the parameter to it when we call `eval <migraphx::program::eval>`::
argument result = p.eval({
{"x", literal{1}.get_argument()}
......@@ -52,12 +52,12 @@ This adds a parameter of type ``int64``, and compiles it for the ``cpu``. To run
This will print ``3``.
A parameter is given as an `argument <migraph::argument>`. In this case, the simplest way of creating an `argument <migraph::argument>` is from a `literal <migraph::literal>`.
A parameter is given as an `argument <migraphx::argument>`. In this case, the simplest way of creating an `argument <migraphx::argument>` is from a `literal <migraphx::literal>`.
Tensor data
-----------
In this example we are just creating numbers, but the `shape <migraph::shape>` class can describe multi-dimensional tensors. For example, we can build a simple network with convolution and relu::
In this example we are just creating numbers, but the `shape <migraphx::shape>` class can describe multi-dimensional tensors. For example, we can build a simple network with convolution and relu::
program p;
instruction_ref input = p.add_parameter("x", shape{shape::float_type, {1, 3, 32, 32}});
......@@ -65,7 +65,7 @@ In this example we are just creating numbers, but the `shape <migraph::shape>` c
instruction_ref conv = p.add_instruction(convolution{}, input, weights);
p.add_instruction(activation{"relu"}, conv);
Here we create two parameters for both the ``input`` and ``weights``. In the previous examples, we just created simple literals, however, most programs will take data from already allocated buffers(usually on the GPU). In this case, we can create `argument <migraph::argument>` objects directly from the pointers to the buffers::
Here we create two parameters for both the ``input`` and ``weights``. In the previous examples, we just created simple literals, however, most programs will take data from already allocated buffers(usually on the GPU). In this case, we can create `argument <migraphx::argument>` objects directly from the pointers to the buffers::
// Compile the program
p.compile(gpu::target{});
......@@ -77,12 +77,12 @@ Here we create two parameters for both the ``input`` and ``weights``. In the pre
argument weights_arg{shape{shape::float_type, {1, 3, 32, 32}}, weights};
p.eval({{"x", input_arg}, {"w", weights_arg}})
An `argument <migraph::argument>` can handle memory buffers from either the GPU or the CPU, but when running the `program <migraph::program>`, buffers should be allocated for the corresponding target. That is, when compiling for the CPU, the buffers should be allocated on the CPU, and when compiling for the GPU the buffers should be allocated on the GPU.
An `argument <migraphx::argument>` can handle memory buffers from either the GPU or the CPU, but when running the `program <migraphx::program>`, buffers should be allocated for the corresponding target. That is, when compiling for the CPU, the buffers should be allocated on the CPU, and when compiling for the GPU the buffers should be allocated on the GPU.
Importing from onnx
-------------------
A `program <migraph::program>` can be built directly from an onnx file, which makes it easier to use neural networks directly from other frameworks. In this case, there is an ``parse_onnx`` function::
A `program <migraphx::program>` can be built directly from an onnx file, which makes it easier to use neural networks directly from other frameworks. In this case, there is an ``parse_onnx`` function::
program p = parse_onnx("model.onnx");
p.compile(gpu::target{});
......
......@@ -4,27 +4,27 @@ Data types
shape
-----
.. doxygenstruct:: migraph::shape
.. doxygenstruct:: migraphx::shape
literal
-------
.. doxygenstruct:: migraph::literal
.. doxygenstruct:: migraphx::literal
argument
--------
.. doxygenstruct:: migraph::argument
.. doxygenstruct:: migraphx::argument
raw_data
--------
.. doxygenstruct:: migraph::raw_data
.. doxygenstruct:: migraphx::raw_data
.. doxygenfunction:: migraph::MIGRAPH_INLINE_NS::visit_all
.. doxygenfunction:: migraphx::MIGRAPHX_INLINE_NS::visit_all
tensor_view
-----------
.. doxygenstruct:: migraph::tensor_view
.. doxygenstruct:: migraphx::tensor_view
......@@ -4,7 +4,7 @@ Operators
operation
---------
.. doxygenstruct:: migraph::operation
.. doxygenstruct:: migraphx::operation
operators
---------
......
......@@ -4,44 +4,44 @@ Passes
pass
----
.. doxygenstruct:: migraph::pass
.. doxygenstruct:: migraphx::pass
dead_code_elimination
---------------------
.. doxygenstruct:: migraph::dead_code_elimination
.. doxygenstruct:: migraphx::dead_code_elimination
common_subexpression_elimination
--------------------------------
.. doxygenstruct:: migraph::common_subexpression_elimination
.. doxygenstruct:: migraphx::common_subexpression_elimination
constant_propagate
------------------
.. doxygenstruct:: migraph::constant_propagate
.. doxygenstruct:: migraphx::constant_propagate
eliminate_concat
----------------
.. doxygenstruct:: migraph::eliminate_concat
.. doxygenstruct:: migraphx::eliminate_concat
eliminate_contiguous
--------------------
.. doxygenstruct:: migraph::eliminate_contiguous
.. doxygenstruct:: migraphx::eliminate_contiguous
fwd_conv_batchnorm_rewrite
--------------------------
.. doxygenstruct:: migraph::fwd_conv_batchnorm_rewrite
.. doxygenstruct:: migraphx::fwd_conv_batchnorm_rewrite
simplify_algebra
----------------
.. doxygenstruct:: migraph::simplify_algebra
.. doxygenstruct:: migraphx::simplify_algebra
simplify_reshapes
-----------------
.. doxygenstruct:: migraph::simplify_reshapes
.. doxygenstruct:: migraphx::simplify_reshapes
......@@ -4,21 +4,21 @@ Program
instruction
-----------
.. doxygenstruct:: migraph::instruction
.. doxygenstruct:: migraphx::instruction
instruction_ref
---------------
.. cpp:type:: migraph::instruction_ref
.. cpp:type:: migraphx::instruction_ref
References an instruction in the program.
program
-------
.. doxygenstruct:: migraph::program
.. doxygenstruct:: migraphx::program
parse_onnx
----------
.. doxygenfunction:: migraph::MIGRAPH_INLINE_NS::parse_onnx
.. doxygenfunction:: migraphx::MIGRAPHX_INLINE_NS::parse_onnx
......@@ -4,15 +4,15 @@ Targets
target
------
.. doxygenstruct:: migraph::target
.. doxygenstruct:: migraphx::target
gpu::target
-----------
.. doxygenstruct:: migraph::gpu::target
.. doxygenstruct:: migraphx::gpu::target
cpu::target
-----------
.. doxygenstruct:: migraph::cpu::target
.. doxygenstruct:: migraphx::cpu::target
......@@ -2,7 +2,7 @@
include(ROCMInstallTargets)
include(ROCMPackageConfigHelpers)
add_library(migraph
add_library(migraphx
auto_contiguous.cpp
common_subexpression_elimination.cpp
constant_propagate.cpp
......@@ -11,6 +11,7 @@ add_library(migraph
eliminate_contiguous.cpp
eliminate_concat.cpp
fwd_conv_batchnorm_rewrite.cpp
rewrite_rnn.cpp
env.cpp
generate.cpp
instruction.cpp
......@@ -21,29 +22,30 @@ add_library(migraph
opt/memory_coloring.cpp
opt/memory_coloring_impl.cpp
)
rocm_clang_tidy_check(migraph)
rocm_clang_tidy_check(migraphx)
rocm_install_targets(
TARGETS migraph
TARGETS migraphx
INCLUDE
${CMAKE_CURRENT_SOURCE_DIR}/include
)
find_path(HALF_INCLUDE_DIR half.hpp)
# TODO: Fix the incorrect path
target_include_directories(migraph SYSTEM PUBLIC $<BUILD_INTERFACE:${HALF_INCLUDE_DIR}>)
target_include_directories(migraphx SYSTEM PUBLIC $<BUILD_INTERFACE:${HALF_INCLUDE_DIR}>)
set(PACKAGE_DEPENDS)
add_subdirectory(onnx)
add_subdirectory(py)
add_subdirectory(targets/cpu)
if(MIGRAPH_ENABLE_GPU)
if(MIGRAPHX_ENABLE_GPU)
list(APPEND PACKAGE_DEPENDS MIOpen rocblas)
add_subdirectory(targets/gpu)
endif()
rocm_export_targets(
TARGETS migraph::migraph
NAMESPACE migraph::
TARGETS migraphx::migraphx
NAMESPACE migraphx::
DEPENDS
${PACKAGE_DEPENDS}
)
......
#include <migraph/auto_contiguous.hpp>
#include <migraph/program.hpp>
#include <migraph/instruction.hpp>
#include <migraph/operators.hpp>
#include <migraph/iterator_for.hpp>
#include <migraphx/auto_contiguous.hpp>
#include <migraphx/program.hpp>
#include <migraphx/instruction.hpp>
#include <migraphx/operators.hpp>
#include <migraphx/iterator_for.hpp>
namespace migraph {
inline namespace MIGRAPH_INLINE_NS {
namespace migraphx {
inline namespace MIGRAPHX_INLINE_NS {
void auto_contiguous::apply(program& p) const
{
for(auto ins : iterator_for(p))
{
shape s = ins->get_shape();
if(not s.standard())
if(not s.standard() and s.elements() != 0)
{
auto c = p.insert_instruction(std::next(ins), op::contiguous{}, ins);
p.replace_instruction(ins, c);
......@@ -20,5 +20,5 @@ void auto_contiguous::apply(program& p) const
}
}
} // namespace MIGRAPH_INLINE_NS
} // namespace migraph
} // namespace MIGRAPHX_INLINE_NS
} // namespace migraphx
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