Commit 23ef67a7 authored by Scott Thornton's avatar Scott Thornton
Browse files

Merge branch 'master' into onnx_fixes

parents 7e23d5c4 68d69739
......@@ -86,7 +86,6 @@ rocm_enable_clang_tidy(
".*hpp"
EXTRA_ARGS
-DMIGRAPH_USE_CLANG_TIDY
ANALYZE_TEMPORARY_DTORS ON
)
include(ROCMCppCheck)
......
......@@ -21,13 +21,17 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --allow-
doxygen \
gdb \
git \
hcc \
hip_hcc \
hsa-rocr-dev \
hsakmt-roct-dev \
lcov \
libelf-dev \
libncurses5-dev \
libpthread-stubs0-dev \
libnuma-dev \
python \
python-dev \
python-pip \
rocminfo \
rocm-opencl \
rocm-opencl-dev \
software-properties-common \
......@@ -38,8 +42,19 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --allow-
# Install cget
RUN pip install cget
# Install rclone
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 cget -p $PREFIX install hcc,/hcc
# Use hcc
RUN cget -p $PREFIX init --cxx /opt/rocm/bin/hcc
RUN cget -p $PREFIX init --cxx $PREFIX/bin/hcc
# Workaround hip's broken cmake
RUN ln -s $PREFIX /opt/rocm/hip
RUN ln -s $PREFIX /opt/rocm/hcc
# Install dependencies
ADD dev-requirements.txt /dev-requirements.txt
......@@ -49,5 +64,5 @@ RUN cget -p $PREFIX install -f /dev-requirements.txt
ENV LD_LIBRARY_PATH=$PREFIX/lib
# Install doc requirements
# ADD doc/requirements.txt /doc-requirements.txt
# RUN pip install -r /doc-requirements.txt
ADD doc/requirements.txt /doc-requirements.txt
RUN pip install -r /doc-requirements.txt
......@@ -6,7 +6,7 @@ def rocmtestnode(variant, name, body) {
rm -rf build
mkdir build
cd build
CXX=${compiler} CXXFLAGS='-Werror' cmake -DCMAKE_CXX_FLAGS_DEBUG='-g -fno-omit-frame-pointer -fsanitize=undefined -fno-sanitize-recover=undefined' ${flags} ..
CXX=${compiler} CXXFLAGS='-Werror -Wno-fallback' cmake -DCMAKE_CXX_FLAGS_DEBUG='-g -fno-omit-frame-pointer -fsanitize=undefined -fno-sanitize-recover=undefined' ${flags} ..
CTEST_PARALLEL_LEVEL=32 make -j32 all doc check
"""
echo cmd
......@@ -92,10 +92,10 @@ rocmtest tidy: rocmnode('rocmtest') { cmake_build ->
}
}, clang: rocmnode('rocmtest') { cmake_build ->
stage('Clang Debug') {
cmake_build('/opt/rocm/bin/hcc', '-DCMAKE_BUILD_TYPE=debug')
cmake_build('hcc', '-DCMAKE_BUILD_TYPE=debug')
}
stage('Clang Release') {
cmake_build('/opt/rocm/bin/hcc', '-DCMAKE_BUILD_TYPE=release')
cmake_build('hcc', '-DCMAKE_BUILD_TYPE=release')
}
}, gcc: rocmnode('rocmtest') { cmake_build ->
stage('GCC Debug') {
......
......@@ -26,15 +26,16 @@ add_doxygen_doc(
EXTRACT_ALL YES
ENUM_VALUES_PER_LINE 1
FULL_PATH_NAMES YES
PREDEFINED DOXYGEN
)
# include(SphinxDoc)
# add_sphinx_doc(src
# BUILDER html
# OUTPUT_DIR html
# VARS
# breathe_projects.proj=${DOXYGEN_OUTPUT}/xml
# breathe_default_project=proj
# DEPENDS doxygen
# )
include(SphinxDoc)
add_sphinx_doc(src
BUILDER html
OUTPUT_DIR html
VARS
breathe_projects.proj=${DOXYGEN_OUTPUT}/xml
breathe_default_project=proj
DEPENDS doxygen
)
sphinx
breathe==4.9.1
# git+https://github.com/arximboldi/breathe@fix-node-parent
# -*- coding: utf-8 -*-
#
# MIGraph 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
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values have a default; values that are commented out
# serve to show the default.
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
# import os
# import sys
# sys.path.insert(0, os.path.abspath('.'))
# -- General configuration ------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
#
# needs_sphinx = '1.0'
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = ['breathe', 'sphinx.ext.mathjax', 'sphinx.ext.viewcode']
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
# source_suffix = ['.rst', '.md']
source_suffix = '.rst'
# The master toctree document.
master_doc = 'index'
# General information about the project.
project = u'MIGraph'
copyright = u'2018, AMD'
author = u'AMD'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = u'0.1'
# The full version, including alpha/beta/rc tags.
release = u'0.1'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This patterns also effect to html_static_path and html_extra_path
exclude_patterns = []
# The name of the Pygments (syntax highlighting) style to use.
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
# a list of builtin themes.
#
html_theme = 'alabaster'
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#
# html_theme_options = {}
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
# -- Options for HTMLHelp output ------------------------------------------
# Output file base name for HTML help builder.
htmlhelp_basename = 'MIGraphdoc'
# -- Options for LaTeX output ---------------------------------------------
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#
# 'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
#
# 'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
#
# 'preamble': '',
# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
}
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'MIGraph.tex', u'MIGraph Documentation',
u'AMD', '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, 'migraph', u'MIGraph Documentation',
[author], 1)
]
# -- Options for Texinfo output -------------------------------------------
# Grouping the document tree into Texinfo files. List of tuples
# (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.',
'Miscellaneous'),
]
breathe_default_members = ('members', 'undoc-members')
cpp_index_common_prefix = ['migraph::']
.. MIGraph 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!
===================================
.. toctree::
:maxdepth: 2
:caption: Contents:
reference/data
reference/operators
reference/program
reference/targets
reference/pass
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
Data types
==========
shape
-----
.. doxygenstruct:: migraph::shape
literal
-------
.. doxygenstruct:: migraph::literal
argument
--------
.. doxygenstruct:: migraph::argument
raw_data
--------
.. doxygenstruct:: migraph::raw_data
.. doxygenfunction:: migraph::visit_all
tensor_view
-----------
.. doxygenstruct:: migraph::tensor_view
Operators
=========
operation
---------
.. doxygenstruct:: migraph::operation
operators
---------
.. doxygenfile:: operators.hpp
Passes
======
pass
----
.. doxygenstruct:: migraph::pass
dead_code_elimination
---------------------
.. doxygenstruct:: migraph::dead_code_elimination
Program
=======
instruction
-----------
.. doxygenstruct:: migraph::instruction
program
-------
.. doxygenstruct:: migraph::program
Targets
=======
target
------
.. doxygenstruct:: migraph::target
......@@ -10,6 +10,6 @@ target_include_directories(migraph PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOUR
add_subdirectory(onnx)
add_subdirectory(targets/cpu)
if(MIGRAPH_ENABLE_MIOPEN)
add_subdirectory(targets/miopen)
if(MIGRAPH_ENABLE_GPU)
add_subdirectory(targets/gpu)
endif()
......@@ -9,6 +9,17 @@
namespace migraph {
#ifdef DOXYGEN
/// A context is used to store internal data for a `target`. A context is
/// constructed by a target during compilation and passed to the operations
/// during `eval`.
struct context
{
};
#else
/*
* Type-erased interface for:
*
......@@ -177,6 +188,8 @@ inline const ValueType& any_cast(const context& x)
return *y;
}
#endif
} // namespace migraph
#endif
......@@ -13,6 +13,37 @@
namespace migraph {
#ifdef DOXYGEN
/// The operation interface represents an action an instruction will perform. All
/// operation classes must be CopyConstructible.
struct operation
{
/// A unique name identifying the operation
std::string name() const;
/// This is used to compute the resulting shape from an operation. If an
/// operation cannot be run with input shapes, then it should throw an
/// exception.
shape compute_shape(std::vector<shape> input) const;
/**
* @brief This performs the operation's computation
*
* @param ctx This is the context created by the `target` during compilation. Implementations
* can use the target's `context` class rather than the `context` interface class.
* @param output This is the output shape. It is equivalent to running `compute_shape` with each
* `shape` of the `argument`.
* @param input This is the `argument` result from the previous instuction's computation.
* @return Return an `argument` of the result computation. The `shape` of `argument` should be
* the same the `output` shape.
*/
argument compute(context& ctx, shape output, std::vector<argument> input) const;
/// An optional stream operator to print the operation. When this is not
/// implemented, it will just print the operation's name.
friend std::ostream& operator<<(std::ostream& os, const operation& op);
};
#else
namespace operation_stream {
template <class T>
......@@ -250,6 +281,8 @@ inline const ValueType& any_cast(const operation& x)
return *y;
}
#endif
} // namespace migraph
#endif
......@@ -228,13 +228,13 @@ struct pooling
input.lens()[1],
std::size_t(std::max<std::ptrdiff_t>(
1,
std::ceil((input.lens()[2] + 2 * padding[0] - lengths[0]) /
static_cast<float>(stride[0])) +
std::ptrdiff_t(std::ceil((input.lens()[2] + 2 * padding[0] - lengths[0]) /
static_cast<float>(stride[0]))) +
1)),
std::size_t(std::max<std::ptrdiff_t>(
1,
std::ceil((input.lens()[3] + 2 * padding[1] - lengths[1]) /
static_cast<float>(stride[1])) +
std::ptrdiff_t(std::ceil((input.lens()[3] + 2 * padding[1] - lengths[1]) /
static_cast<float>(stride[1]))) +
1)),
}};
}
......
......@@ -11,6 +11,20 @@ namespace migraph {
struct program;
#ifdef DOXYGEN
/// An interface for applying a transformation to the instructions in a
/// `program`
struct pass
{
/// A unique name used to identify the pass
std::string name() const;
/// Run the pass on the program
void apply(program& p) const;
};
#else
/*
* Type-erased interface for:
*
......@@ -199,6 +213,8 @@ inline const ValueType& any_cast(const pass& x)
return *y;
}
#endif
} // namespace migraph
#endif
......@@ -12,7 +12,30 @@
namespace migraph {
struct program;
#ifdef DOXYGEN
/// An interface for a compilation target
struct target
{
/// A unique name used to identify the target
std::string name() const;
/// The transformation passes to be run
/**
* @brief The transformation pass to be run during compilation.
* @details [long description]
*
* @param ctx This is the target-dependent context that is created by `get_context`
* @return The passes to be ran
*/
std::vector<pass> get_passes(context& ctx) const;
/**
* @brief Construct a context for the target.
* @return The context to be used during compilation and execution.
*/
context get_context() const;
};
#else
/*
* Type-erased interface for:
......@@ -216,6 +239,8 @@ inline const ValueType& any_cast(const target& x)
return *y;
}
#endif
} // namespace migraph
#endif
......@@ -20,7 +20,7 @@ add_executable(mnist mnist.cpp)
rocm_clang_tidy_check(mnist)
target_link_libraries(mnist migraph_cpu migraph_onnx)
if(MIGRAPH_ENABLE_MIOPEN)
if(MIGRAPH_ENABLE_GPU)
add_executable(verify_onnx verify_onnx.cpp)
rocm_clang_tidy_check(verify_onnx)
target_link_libraries(verify_onnx migraph_onnx migraph_cpu migraph_miopen)
......
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