"vscode:/vscode.git/clone" did not exist on "f7051bf0af4a7918539eae8ddd6ee8e757b8c557"
Commit eea003a5 authored by Paul's avatar Paul
Browse files

s/rtg/migraph

parent 5f1ea74f
...@@ -100,4 +100,4 @@ CheckOptions: ...@@ -100,4 +100,4 @@ CheckOptions:
# - key: readability-identifier-naming.MacroDefinitionCase # - key: readability-identifier-naming.MacroDefinitionCase
# value: UPPER_CASE # value: UPPER_CASE
# - key: readability-identifier-naming.MacroDefinitionPrefix # - key: readability-identifier-naming.MacroDefinitionPrefix
# value: RTG_ # value: MIGRAPH_
cmake_minimum_required(VERSION 3.5) cmake_minimum_required(VERSION 3.5)
project(rtglib) project(migraphlib)
find_package(ROCM REQUIRED) find_package(ROCM REQUIRED)
option( BUILD_SHARED_LIBS "Build as a shared library" ON ) option( BUILD_SHARED_LIBS "Build as a shared library" ON )
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "5.4") if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "5.4")
message(FATAL_ERROR "RTGLib requires at least gcc 5.4") message(FATAL_ERROR "MIGRAPHLib requires at least gcc 5.4")
endif() endif()
endif() endif()
if(CMAKE_CXX_COMPILER MATCHES ".*hcc") if(CMAKE_CXX_COMPILER MATCHES ".*hcc")
message(STATUS "Enable miopen backend") message(STATUS "Enable miopen backend")
set(RTG_ENABLE_MIOPEN On CACHE BOOL "") set(MIGRAPH_ENABLE_MIOPEN On CACHE BOOL "")
else() else()
set(RTG_ENABLE_MIOPEN Off CACHE BOOL "") set(MIGRAPH_ENABLE_MIOPEN Off CACHE BOOL "")
endif() endif()
add_compile_options(-std=c++14) add_compile_options(-std=c++14)
...@@ -85,7 +85,7 @@ rocm_enable_clang_tidy( ...@@ -85,7 +85,7 @@ rocm_enable_clang_tidy(
HEADER_FILTER HEADER_FILTER
".*hpp" ".*hpp"
EXTRA_ARGS EXTRA_ARGS
-DRTG_USE_CLANG_TIDY -DMIGRAPH_USE_CLANG_TIDY
ANALYZE_TEMPORARY_DTORS ON ANALYZE_TEMPORARY_DTORS ON
) )
......
def rocmtestnode(variant, name, body) { def rocmtestnode(variant, name, body) {
def image = 'rtglib' def image = 'migraphlib'
def cmake_build = { compiler, flags -> def cmake_build = { compiler, flags ->
def cmd = """ def cmd = """
rm -rf build rm -rf build
......
...@@ -16,7 +16,7 @@ add_doxygen_doc( ...@@ -16,7 +16,7 @@ add_doxygen_doc(
CALL_GRAPH YES CALL_GRAPH YES
CALLER_GRAPH YES CALLER_GRAPH YES
BUILTIN_STL_SUPPORT YES BUILTIN_STL_SUPPORT YES
PROJECT_NAME RTGLib PROJECT_NAME MIGRAPHLib
SORT_MEMBERS_CTORS_1ST YES SORT_MEMBERS_CTORS_1ST YES
SOURCE_BROWSER YES SOURCE_BROWSER YES
GENERATE_TREEVIEW YES GENERATE_TREEVIEW YES
......
add_library(rtg add_library(migraph
generate.cpp generate.cpp
program.cpp program.cpp
shape.cpp shape.cpp
) )
rocm_clang_tidy_check(rtg) rocm_clang_tidy_check(migraph)
target_include_directories(rtg PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>) target_include_directories(migraph PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
add_subdirectory(onnx) add_subdirectory(onnx)
add_subdirectory(targets/cpu) add_subdirectory(targets/cpu)
if(RTG_ENABLE_MIOPEN) if(MIGRAPH_ENABLE_MIOPEN)
add_subdirectory(targets/miopen) add_subdirectory(targets/miopen)
endif() endif()
#include <rtg/generate.hpp> #include <migraph/generate.hpp>
namespace rtg { namespace migraph {
rtg::argument generate_argument(rtg::shape s, std::mt19937::result_type seed) migraph::argument generate_argument(migraph::shape s, std::mt19937::result_type seed)
{ {
rtg::argument result; migraph::argument result;
s.visit_type([&](auto as) { s.visit_type([&](auto as) {
using type = typename decltype(as)::type; using type = typename decltype(as)::type;
auto v = generate_tensor_data<type>(s, seed); auto v = generate_tensor_data<type>(s, seed);
...@@ -13,4 +13,4 @@ rtg::argument generate_argument(rtg::shape s, std::mt19937::result_type seed) ...@@ -13,4 +13,4 @@ rtg::argument generate_argument(rtg::shape s, std::mt19937::result_type seed)
return result; return result;
} }
} // namespace rtg } // namespace migraph
#ifndef RTG_GUARD_RTGLIB_ARGUMENT_HPP #ifndef MIGRAPH_GUARD_MIGRAPHLIB_ARGUMENT_HPP
#define RTG_GUARD_RTGLIB_ARGUMENT_HPP #define MIGRAPH_GUARD_MIGRAPHLIB_ARGUMENT_HPP
#include <rtg/shape.hpp> #include <migraph/shape.hpp>
#include <rtg/raw_data.hpp> #include <migraph/raw_data.hpp>
#include <functional> #include <functional>
namespace rtg { namespace migraph {
/** /**
* @brief Arguments passed to instructions * @brief Arguments passed to instructions
...@@ -49,6 +49,6 @@ struct argument : raw_data<argument> ...@@ -49,6 +49,6 @@ struct argument : raw_data<argument>
shape m_shape; shape m_shape;
}; };
} // namespace rtg } // namespace migraph
#endif #endif
#ifndef RTG_GUARD_BUILTIN_HPP #ifndef MIGRAPH_GUARD_BUILTIN_HPP
#define RTG_GUARD_BUILTIN_HPP #define MIGRAPH_GUARD_BUILTIN_HPP
#include <rtg/context.hpp> #include <migraph/context.hpp>
#include <rtg/errors.hpp> #include <migraph/errors.hpp>
namespace rtg { namespace migraph {
namespace builtin { namespace builtin {
struct literal struct literal
{ {
std::string name() const { return "@literal"; } std::string name() const { return "@literal"; }
shape compute_shape(std::vector<shape>) const { RTG_THROW("builtin"); } shape compute_shape(std::vector<shape>) const { MIGRAPH_THROW("builtin"); }
argument compute(context&, shape, std::vector<argument>) const { RTG_THROW("builtin"); } argument compute(context&, shape, std::vector<argument>) const { MIGRAPH_THROW("builtin"); }
}; };
struct outline struct outline
{ {
shape s; shape s;
std::string name() const { return "@outline"; } std::string name() const { return "@outline"; }
shape compute_shape(std::vector<shape>) const { RTG_THROW("builtin"); } shape compute_shape(std::vector<shape>) const { MIGRAPH_THROW("builtin"); }
argument compute(context&, shape, std::vector<argument>) const { RTG_THROW("builtin"); } argument compute(context&, shape, std::vector<argument>) const { MIGRAPH_THROW("builtin"); }
}; };
struct param struct param
{ {
std::string parameter; std::string parameter;
std::string name() const { return "@param"; } std::string name() const { return "@param"; }
shape compute_shape(std::vector<shape>) const { RTG_THROW("builtin"); } shape compute_shape(std::vector<shape>) const { MIGRAPH_THROW("builtin"); }
argument compute(context&, shape, std::vector<argument>) const { RTG_THROW("builtin"); } argument compute(context&, shape, std::vector<argument>) const { MIGRAPH_THROW("builtin"); }
friend std::ostream& operator<<(std::ostream& os, const param& op) friend std::ostream& operator<<(std::ostream& os, const param& op)
{ {
os << op.name() << ":" << op.parameter; os << op.name() << ":" << op.parameter;
...@@ -38,6 +38,6 @@ struct param ...@@ -38,6 +38,6 @@ struct param
} // namespace builtin } // namespace builtin
} // namespace rtg } // namespace migraph
#endif #endif
#ifndef RTG_GUARD_CONTEXT_HPP #ifndef MIGRAPH_GUARD_CONTEXT_HPP
#define RTG_GUARD_CONTEXT_HPP #define MIGRAPH_GUARD_CONTEXT_HPP
namespace rtg { namespace migraph {
/* /*
* Type-erased interface for: * Type-erased interface for:
...@@ -171,6 +171,6 @@ inline const ValueType& any_cast(const context& x) ...@@ -171,6 +171,6 @@ inline const ValueType& any_cast(const context& x)
return *y; return *y;
} }
} // namespace rtg } // namespace migraph
#endif #endif
#ifndef RTG_GUARD_RTGLIB_DFOR_HPP #ifndef MIGRAPH_GUARD_MIGRAPHLIB_DFOR_HPP
#define RTG_GUARD_RTGLIB_DFOR_HPP #define MIGRAPH_GUARD_MIGRAPHLIB_DFOR_HPP
namespace rtg { namespace migraph {
// Multidimensional for loop // Multidimensional for loop
inline auto dfor() inline auto dfor()
...@@ -20,6 +20,6 @@ auto dfor(T x, Ts... xs) ...@@ -20,6 +20,6 @@ auto dfor(T x, Ts... xs)
}; };
} }
} // namespace rtg } // namespace migraph
#endif #endif
#ifndef RTG_GUARD_ERASE_HPP #ifndef MIGRAPH_GUARD_ERASE_HPP
#define RTG_GUARD_ERASE_HPP #define MIGRAPH_GUARD_ERASE_HPP
namespace rtg { namespace migraph {
/** /**
* @brief Erase all elements from a container * @brief Erase all elements from a container
...@@ -29,6 +29,6 @@ auto erase_if(R&& r, P&& pred) ...@@ -29,6 +29,6 @@ auto erase_if(R&& r, P&& pred)
return r.erase(std::remove_if(r.begin(), r.end(), pred), r.end()); return r.erase(std::remove_if(r.begin(), r.end(), pred), r.end());
} }
} // namespace rtg } // namespace migraph
#endif #endif
#ifndef RTG_GUARD_ERRORS_HPP #ifndef MIGRAPH_GUARD_ERRORS_HPP
#define RTG_GUARD_ERRORS_HPP #define MIGRAPH_GUARD_ERRORS_HPP
#include <exception> #include <exception>
#include <stdexcept> #include <stdexcept>
#include <string> #include <string>
namespace rtg { namespace migraph {
/// Represents exceptions that can be thrown by rtglib /// Represents exceptions that can be thrown by migraphlib
struct exception : std::runtime_error struct exception : std::runtime_error
{ {
exception(std::string msg = "") : std::runtime_error(msg) {} exception(std::string msg = "") : std::runtime_error(msg) {}
...@@ -41,9 +41,9 @@ inline std::string make_source_context(const std::string& file, int line) ...@@ -41,9 +41,9 @@ inline std::string make_source_context(const std::string& file, int line)
/** /**
* @brief Throw an exception with context information * @brief Throw an exception with context information
*/ */
#define RTG_THROW(...) \ #define MIGRAPH_THROW(...) \
throw rtg::make_exception(rtg::make_source_context(__FILE__, __LINE__), __VA_ARGS__) throw migraph::make_exception(migraph::make_source_context(__FILE__, __LINE__), __VA_ARGS__)
} // namespace rtg } // namespace migraph
#endif #endif
#ifndef MIGRAPH_GUARD_FALLTHROUGH_HPP
#define MIGRAPH_GUARD_FALLTHROUGH_HPP
namespace migraph {
#ifdef __clang__
#define MIGRAPH_FALLTHROUGH [[clang::fallthrough]]
#else
#define MIGRAPH_FALLTHROUGH
#endif
} // namespace migraph
#endif
#ifndef RTG_GUARD_RTGLIB_FLOAT_EQUAL_HPP #ifndef MIGRAPH_GUARD_MIGRAPHLIB_FLOAT_EQUAL_HPP
#define RTG_GUARD_RTGLIB_FLOAT_EQUAL_HPP #define MIGRAPH_GUARD_MIGRAPHLIB_FLOAT_EQUAL_HPP
#include <algorithm> #include <algorithm>
#include <cmath> #include <cmath>
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
#include <iso646.h> #include <iso646.h>
#endif #endif
namespace rtg { namespace migraph {
template <class... Ts> template <class... Ts>
using common_type = typename std::common_type<Ts...>::type; using common_type = typename std::common_type<Ts...>::type;
...@@ -32,6 +32,6 @@ struct float_equal_fn ...@@ -32,6 +32,6 @@ struct float_equal_fn
static constexpr float_equal_fn float_equal{}; static constexpr float_equal_fn float_equal{};
} // namespace rtg } // namespace migraph
#endif #endif
#ifndef RTG_GUARD_RTGLIB_GENERATE_HPP #ifndef MIGRAPH_GUARD_MIGRAPHLIB_GENERATE_HPP
#define RTG_GUARD_RTGLIB_GENERATE_HPP #define MIGRAPH_GUARD_MIGRAPHLIB_GENERATE_HPP
#include <rtg/argument.hpp> #include <migraph/argument.hpp>
#include <random> #include <random>
namespace rtg { namespace migraph {
template <class T> template <class T>
std::vector<T> generate_tensor_data(rtg::shape s, std::mt19937::result_type seed = 0) std::vector<T> generate_tensor_data(migraph::shape s, std::mt19937::result_type seed = 0)
{ {
std::vector<T> result(s.elements()); std::vector<T> result(s.elements());
std::mt19937 engine{seed}; std::mt19937 engine{seed};
...@@ -16,8 +16,8 @@ std::vector<T> generate_tensor_data(rtg::shape s, std::mt19937::result_type seed ...@@ -16,8 +16,8 @@ std::vector<T> generate_tensor_data(rtg::shape s, std::mt19937::result_type seed
return result; return result;
} }
rtg::argument generate_argument(rtg::shape s, std::mt19937::result_type seed = 0); migraph::argument generate_argument(migraph::shape s, std::mt19937::result_type seed = 0);
} // namespace rtg } // namespace migraph
#endif #endif
#ifndef RTG_GUARD_RTGLIB_INSTRUCTION_HPP #ifndef MIGRAPH_GUARD_MIGRAPHLIB_INSTRUCTION_HPP
#define RTG_GUARD_RTGLIB_INSTRUCTION_HPP #define MIGRAPH_GUARD_MIGRAPHLIB_INSTRUCTION_HPP
#include <rtg/literal.hpp> #include <migraph/literal.hpp>
#include <rtg/shape.hpp> #include <migraph/shape.hpp>
#include <rtg/builtin.hpp> #include <migraph/builtin.hpp>
#include <rtg/instruction_ref.hpp> #include <migraph/instruction_ref.hpp>
#include <rtg/erase.hpp> #include <migraph/erase.hpp>
#include <string> #include <string>
namespace rtg { namespace migraph {
shape compute_shape(operation op, std::vector<instruction_ref> args); shape compute_shape(operation op, std::vector<instruction_ref> args);
...@@ -52,7 +52,7 @@ struct instruction ...@@ -52,7 +52,7 @@ struct instruction
{ {
for(auto&& arg : arguments) for(auto&& arg : arguments)
{ {
rtg::erase(arg->output, *this); migraph::erase(arg->output, *this);
} }
} }
...@@ -103,6 +103,6 @@ inline shape compute_shape(operation op, std::vector<instruction_ref> args) ...@@ -103,6 +103,6 @@ inline shape compute_shape(operation op, std::vector<instruction_ref> args)
return op.compute_shape(shapes); return op.compute_shape(shapes);
} }
} // namespace rtg } // namespace migraph
#endif #endif
#ifndef RTG_GUARD_INSTRUCTION_REF_HPP #ifndef MIGRAPH_GUARD_INSTRUCTION_REF_HPP
#define RTG_GUARD_INSTRUCTION_REF_HPP #define MIGRAPH_GUARD_INSTRUCTION_REF_HPP
#include <list> #include <list>
namespace rtg { namespace migraph {
struct instruction; struct instruction;
using instruction_ref = std::list<instruction>::iterator; using instruction_ref = std::list<instruction>::iterator;
} // namespace rtg } // namespace migraph
#endif #endif
#ifndef RTG_GUARD_RTGLIB_LITERAL_HPP #ifndef MIGRAPH_GUARD_MIGRAPHLIB_LITERAL_HPP
#define RTG_GUARD_RTGLIB_LITERAL_HPP #define MIGRAPH_GUARD_MIGRAPHLIB_LITERAL_HPP
#include <rtg/shape.hpp> #include <migraph/shape.hpp>
#include <rtg/argument.hpp> #include <migraph/argument.hpp>
#include <rtg/tensor_view.hpp> #include <migraph/tensor_view.hpp>
#include <rtg/raw_data.hpp> #include <migraph/raw_data.hpp>
namespace rtg { namespace migraph {
/** /**
* @brief Represents a raw literal * @brief Represents a raw literal
...@@ -68,6 +68,6 @@ struct literal : raw_data<literal> ...@@ -68,6 +68,6 @@ struct literal : raw_data<literal>
shape m_shape; shape m_shape;
}; };
} // namespace rtg } // namespace migraph
#endif #endif
#ifndef RTG_GUARD_RTG_MANAGE_PTR_HPP #ifndef MIGRAPH_GUARD_MIGRAPH_MANAGE_PTR_HPP
#define RTG_GUARD_RTG_MANAGE_PTR_HPP #define MIGRAPH_GUARD_MIGRAPH_MANAGE_PTR_HPP
#include <memory> #include <memory>
#include <type_traits> #include <type_traits>
namespace rtg { namespace migraph {
template <class F, F f> // NOLINT template <class F, F f> // NOLINT
struct manage_deleter struct manage_deleter
...@@ -49,8 +49,8 @@ shared<T> share(T p) ...@@ -49,8 +49,8 @@ shared<T> share(T p)
return shared<T>{std::move(p)}; return shared<T>{std::move(p)};
} }
} // namespace rtg } // namespace migraph
#define RTG_MANAGE_PTR(T, F) rtg::manage_ptr<std::remove_pointer_t<T>, decltype(&F), &F> // NOLINT #define MIGRAPH_MANAGE_PTR(T, F) migraph::manage_ptr<std::remove_pointer_t<T>, decltype(&F), &F> // NOLINT
#endif #endif
#ifndef GUARD_MIGRAPHLIB_ONNX_HPP
#define GUARD_MIGRAPHLIB_ONNX_HPP
#include <migraph/program.hpp>
namespace migraph {
program parse_onnx(const std::string& name);
} // namespace migraph
#endif
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