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

s/rtg/migraph

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