"tools/vscode:/vscode.git/clone" did not exist on "19173aa4370e36cba96ee7049eaaa0dceda5007c"
Commit f85ba189 authored by Khalique Ahmed's avatar Khalique Ahmed
Browse files

Merge branch 'pointwise-nhwc' of...

Merge branch 'pointwise-nhwc' of https://github.com/ROCmSoftwarePlatform/AMDMIGraphX into nhwc_workaround
parents 122ffe97 dfbab16e
...@@ -18,19 +18,8 @@ jobs: ...@@ -18,19 +18,8 @@ jobs:
with: with:
access_token: ${{ github.token }} access_token: ${{ github.token }}
tidy: tidy:
runs-on: ubuntu-20.04 runs-on: ROCM-Ubuntu
steps:
steps:
- name: Free space
uses: jlumbroso/free-disk-space@main
with:
tool-cache: true
android: true
dotnet: true
haskell: true
large-packages: true
swap-storage: true
- uses: actions/checkout@v3 - uses: actions/checkout@v3
# In this step, this action saves a list of existing images, # In this step, this action saves a list of existing images,
...@@ -71,7 +60,7 @@ jobs: ...@@ -71,7 +60,7 @@ jobs:
-DCLANG_TIDY_DEPEND_ON_TARGET=Off \ -DCLANG_TIDY_DEPEND_ON_TARGET=Off \
-DCLANG_TIDY_CACHE=/data/tidy-cache \ -DCLANG_TIDY_CACHE=/data/tidy-cache \
.. ..
make -j2 -k onnx-proto tf-proto tidy make -j$(nproc) -k onnx-proto tf-proto tidy
# GH actions can not update existing cache, as a workaround clear cache and then save it # GH actions can not update existing cache, as a workaround clear cache and then save it
- name: Clear tidy cache before saving - name: Clear tidy cache before saving
...@@ -93,20 +82,8 @@ jobs: ...@@ -93,20 +82,8 @@ jobs:
cppcheck: cppcheck:
runs-on: ubuntu-20.04 runs-on: ROCM-Ubuntu
steps: steps:
- name: Free space
uses: jlumbroso/free-disk-space@main
with:
tool-cache: true
android: true
dotnet: true
haskell: true
large-packages: true
swap-storage: true
- uses: actions/checkout@v3 - uses: actions/checkout@v3
# In this step, this action saves a list of existing images, # In this step, this action saves a list of existing images,
...@@ -142,7 +119,7 @@ jobs: ...@@ -142,7 +119,7 @@ jobs:
-DBUILD_DEV=On \ -DBUILD_DEV=On \
-DROCM_ENABLE_GH_ANNOTATIONS=On \ -DROCM_ENABLE_GH_ANNOTATIONS=On \
.. ..
make -j2 cppcheck make -j$(nproc) cppcheck
# GH actions can not update existing cache, as a workaround clear cache and then save it # GH actions can not update existing cache, as a workaround clear cache and then save it
- name: Clear cppcheck cache before saving - name: Clear cppcheck cache before saving
...@@ -164,18 +141,8 @@ jobs: ...@@ -164,18 +141,8 @@ jobs:
format: format:
runs-on: ubuntu-20.04 runs-on: ROCM-Ubuntu
steps: steps:
- name: Free space
uses: jlumbroso/free-disk-space@main
with:
tool-cache: true
android: true
dotnet: true
haskell: true
large-packages: true
swap-storage: true
- uses: actions/checkout@v3 - uses: actions/checkout@v3
# In this step, this action saves a list of existing images, # In this step, this action saves a list of existing images,
...@@ -224,6 +191,7 @@ jobs: ...@@ -224,6 +191,7 @@ jobs:
haskell: true haskell: true
large-packages: true large-packages: true
swap-storage: true swap-storage: true
docker-images: true
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Set up Python - name: Set up Python
...@@ -253,6 +221,7 @@ jobs: ...@@ -253,6 +221,7 @@ jobs:
haskell: true haskell: true
large-packages: true large-packages: true
swap-storage: true swap-storage: true
docker-images: true
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Set up Python - name: Set up Python
...@@ -292,6 +261,7 @@ jobs: ...@@ -292,6 +261,7 @@ jobs:
haskell: true haskell: true
large-packages: true large-packages: true
swap-storage: true swap-storage: true
docker-images: true
- name : Install rbuild and lld - name : Install rbuild and lld
run: | run: |
...@@ -408,6 +378,7 @@ jobs: ...@@ -408,6 +378,7 @@ jobs:
haskell: true haskell: true
large-packages: true large-packages: true
swap-storage: true swap-storage: true
docker-images: true
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Set up Python - name: Set up Python
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE. # THE SOFTWARE.
##################################################################################### #####################################################################################
cmake_minimum_required(VERSION 3.5) cmake_minimum_required(VERSION 3.15 FATAL_ERROR)
if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}") if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
message(FATAL_ERROR "The binary and source directroy cannot be the same") message(FATAL_ERROR "The binary and source directroy cannot be the same")
...@@ -91,12 +91,6 @@ set(MIGRAPHX_ENABLE_FPGA Off CACHE BOOL "") ...@@ -91,12 +91,6 @@ set(MIGRAPHX_ENABLE_FPGA Off CACHE BOOL "")
set(CMAKE_CXX_STANDARD_DEFAULT "") set(CMAKE_CXX_STANDARD_DEFAULT "")
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-std=c++17>) add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-std=c++17>)
if(${CMAKE_VERSION} VERSION_LESS "3.12.0")
set(CONFIGURE_DEPENDS)
else()
set(CONFIGURE_DEPENDS CONFIGURE_DEPENDS)
endif()
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
include(EnableCompilerWarnings) include(EnableCompilerWarnings)
include(ROCMClangTidy) include(ROCMClangTidy)
......
#####################################################################################
# The MIT License (MIT)
#
# Copyright (c) 2015-2022 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#####################################################################################
if(COMMAND migraphx_generate_export_header)
return()
endif()
include(GenerateExportHeader)
function(migraphx_generate_export_header TARGET)
cmake_parse_arguments(PARSE "" "DIRECTORY" "" ${ARGN})
if(PARSE_DIRECTORY)
set(__directory ${PARSE_DIRECTORY})
else()
string(REPLACE "_" "/" __directory ${TARGET})
string(TOLOWER ${__directory} __directory)
endif()
set(__file_name ${CMAKE_CURRENT_BINARY_DIR}/include/${__directory}/export.h)
generate_export_header(${TARGET} EXPORT_FILE_NAME ${__file_name})
target_include_directories(${TARGET} PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>)
rocm_install(FILES ${__file_name} DESTINATION include/${__directory})
endfunction()
...@@ -151,6 +151,15 @@ argument ...@@ -151,6 +151,15 @@ argument
:rtype: argument :rtype: argument
.. py:function:: create_argument(s, values)
Create an argument of shape s with a set of values.
:param shape s: Shape of argument to create.
:param list values: Values to put in the argument. Must be the same number of elements as the shape.
:rtype: argument
.. py:function:: argument_from_pointer(shape, address) .. py:function:: argument_from_pointer(shape, address)
Create argument from data stored in given address without copy. Create argument from data stored in given address without copy.
......
...@@ -22,6 +22,8 @@ ...@@ -22,6 +22,8 @@
# THE SOFTWARE. # THE SOFTWARE.
##################################################################################### #####################################################################################
include(ExportHeader)
include(ROCMInstallTargets) include(ROCMInstallTargets)
include(ROCMPackageConfigHelpers) include(ROCMPackageConfigHelpers)
include(RegisterOp) include(RegisterOp)
...@@ -128,9 +130,9 @@ register_migraphx_ops( ...@@ -128,9 +130,9 @@ register_migraphx_ops(
contiguous contiguous
convert convert
convolution convolution
convolution_backwards
cosh cosh
cos cos
deconvolution
dequantizelinear dequantizelinear
div div
dot dot
...@@ -252,6 +254,7 @@ target_link_libraries(migraphx PUBLIC Threads::Threads) ...@@ -252,6 +254,7 @@ target_link_libraries(migraphx PUBLIC Threads::Threads)
find_package(nlohmann_json 3.8.0 REQUIRED) find_package(nlohmann_json 3.8.0 REQUIRED)
target_link_libraries(migraphx PRIVATE nlohmann_json::nlohmann_json) target_link_libraries(migraphx PRIVATE nlohmann_json::nlohmann_json)
migraphx_generate_export_header(migraphx)
find_package(PkgConfig) find_package(PkgConfig)
pkg_check_modules(SQLITE3 REQUIRED IMPORTED_TARGET sqlite3) pkg_check_modules(SQLITE3 REQUIRED IMPORTED_TARGET sqlite3)
......
...@@ -32,7 +32,7 @@ inline namespace MIGRAPHX_INLINE_NS { ...@@ -32,7 +32,7 @@ inline namespace MIGRAPHX_INLINE_NS {
struct module; struct module;
struct adjust_allocation struct MIGRAPHX_EXPORT adjust_allocation
{ {
allocation_model model; allocation_model model;
std::string name() const { return "adjust_allocation"; } std::string name() const { return "adjust_allocation"; }
......
...@@ -60,7 +60,7 @@ struct allocation_model ...@@ -60,7 +60,7 @@ struct allocation_model
#ifdef TYPE_ERASED_DECLARATION #ifdef TYPE_ERASED_DECLARATION
// Type-erased interface for: // Type-erased interface for:
struct allocation_model struct MIGRAPHX_EXPORT allocation_model
{ {
// //
std::string name() const; std::string name() const;
......
...@@ -39,7 +39,8 @@ struct stream_race ...@@ -39,7 +39,8 @@ struct stream_race
instruction_ref before; instruction_ref before;
}; };
std::vector<stream_race> analyze_streams(const module& m, const stream_model& strmm); MIGRAPHX_EXPORT std::vector<stream_race> analyze_streams(const module& m,
const stream_model& strmm);
} // namespace MIGRAPHX_INLINE_NS } // namespace MIGRAPHX_INLINE_NS
} // namespace migraphx } // namespace migraphx
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
namespace migraphx { namespace migraphx {
inline namespace MIGRAPHX_INLINE_NS { inline namespace MIGRAPHX_INLINE_NS {
MIGRAPHX_EXPORT
instruction_ref insert_apply_alpha_beta(module& m, instruction_ref insert_apply_alpha_beta(module& m,
instruction_ref pos, instruction_ref pos,
const std::vector<instruction_ref>& args, const std::vector<instruction_ref>& args,
......
...@@ -42,7 +42,7 @@ inline namespace MIGRAPHX_INLINE_NS { ...@@ -42,7 +42,7 @@ inline namespace MIGRAPHX_INLINE_NS {
* or it can be owned by the argument. * or it can be owned by the argument.
* *
*/ */
struct argument : raw_data<argument> struct MIGRAPHX_EXPORT argument : raw_data<argument>
{ {
argument() = default; argument() = default;
...@@ -93,6 +93,16 @@ struct argument : raw_data<argument> ...@@ -93,6 +93,16 @@ struct argument : raw_data<argument>
/// Return the ith element /// Return the ith element
argument element(std::size_t i) const; argument element(std::size_t i) const;
// Keeps the same data ordering as the given container
template <class Iterator>
void fill(Iterator start, Iterator end)
{
assert(std::distance(start, end) <= m_shape.elements());
this->visit([&](auto output) {
std::copy(start, end, output.begin());
});
}
private: private:
void assign_buffer(std::function<char*()> d); void assign_buffer(std::function<char*()> d);
struct data_t struct data_t
...@@ -107,9 +117,9 @@ struct argument : raw_data<argument> ...@@ -107,9 +117,9 @@ struct argument : raw_data<argument>
data_t m_data{}; data_t m_data{};
}; };
std::vector<shape> to_shapes(const std::vector<argument>& args); MIGRAPHX_EXPORT std::vector<shape> to_shapes(const std::vector<argument>& args);
void migraphx_to_value(value& v, const argument& a); MIGRAPHX_EXPORT void migraphx_to_value(value& v, const argument& a);
void migraphx_from_value(const value& v, argument& a); MIGRAPHX_EXPORT void migraphx_from_value(const value& v, argument& a);
} // namespace MIGRAPHX_INLINE_NS } // namespace MIGRAPHX_INLINE_NS
} // namespace migraphx } // namespace migraphx
......
...@@ -33,7 +33,7 @@ inline namespace MIGRAPHX_INLINE_NS { ...@@ -33,7 +33,7 @@ inline namespace MIGRAPHX_INLINE_NS {
struct module; struct module;
struct auto_contiguous struct MIGRAPHX_EXPORT auto_contiguous
{ {
std::string name() const { return "auto_contiguous"; } std::string name() const { return "auto_contiguous"; }
void apply(module& m) const; void apply(module& m) const;
......
...@@ -54,21 +54,26 @@ struct operation; ...@@ -54,21 +54,26 @@ struct operation;
* s0 = (4, 1, 1) and s1 = (3, 4) * s0 = (4, 1, 1) and s1 = (3, 4)
* output_lens = (4, 3, 4) * output_lens = (4, 3, 4)
*/ */
MIGRAPHX_EXPORT
std::vector<std::size_t> compute_broadcasted_lens(std::vector<std::size_t> s0, std::vector<std::size_t> compute_broadcasted_lens(std::vector<std::size_t> s0,
std::vector<std::size_t> s1); std::vector<std::size_t> s1);
MIGRAPHX_EXPORT
std::vector<shape::dynamic_dimension> compute_broadcasted_dyn_dims(shape s0, shape s1); std::vector<shape::dynamic_dimension> compute_broadcasted_dyn_dims(shape s0, shape s1);
MIGRAPHX_EXPORT
shape common_shape(const std::vector<shape>& shapes); shape common_shape(const std::vector<shape>& shapes);
/** /**
* @brief Compute the common (broadcasted) dimensions of a list of fixed shapes * @brief Compute the common (broadcasted) dimensions of a list of fixed shapes
*/ */
MIGRAPHX_EXPORT
std::vector<std::size_t> compute_common_lens(const std::vector<shape>& shapes); std::vector<std::size_t> compute_common_lens(const std::vector<shape>& shapes);
/** /**
* @ brief Compute the common (broadcasted) dynamic dimensions of a list of dynamic shapes * @ brief Compute the common (broadcasted) dynamic dimensions of a list of dynamic shapes
*/ */
MIGRAPHX_EXPORT
std::vector<shape::dynamic_dimension> compute_common_dyn_dims(const std::vector<shape>& shapes); std::vector<shape::dynamic_dimension> compute_common_dyn_dims(const std::vector<shape>& shapes);
/** /**
...@@ -83,11 +88,13 @@ std::vector<shape::dynamic_dimension> compute_common_dyn_dims(const std::vector< ...@@ -83,11 +88,13 @@ std::vector<shape::dynamic_dimension> compute_common_dyn_dims(const std::vector<
* attached to each instruction_ref are considered for broadcasting * attached to each instruction_ref are considered for broadcasting
* @return std::vector<instruction_ref> a modified argument list * @return std::vector<instruction_ref> a modified argument list
*/ */
std::vector<instruction_ref> MIGRAPHX_EXPORT std::vector<instruction_ref>
insert_common_args(module& m, instruction_ref ins, std::vector<instruction_ref> inputs); insert_common_args(module& m, instruction_ref ins, std::vector<instruction_ref> inputs);
MIGRAPHX_EXPORT
std::vector<instruction_ref> add_common_args(module& m, std::vector<instruction_ref> inputs); std::vector<instruction_ref> add_common_args(module& m, std::vector<instruction_ref> inputs);
MIGRAPHX_EXPORT
instruction_ref insert_common_op(module& m, instruction_ref insert_common_op(module& m,
instruction_ref ins, instruction_ref ins,
const operation& op, const operation& op,
...@@ -96,6 +103,7 @@ instruction_ref insert_common_op(module& m, ...@@ -96,6 +103,7 @@ instruction_ref insert_common_op(module& m,
/** /**
* @brief Wrapper for insert_common_args() which inserts operation at the end of the module. * @brief Wrapper for insert_common_args() which inserts operation at the end of the module.
*/ */
MIGRAPHX_EXPORT
instruction_ref add_common_op(module& m, const operation& op, std::vector<instruction_ref> inputs); instruction_ref add_common_op(module& m, const operation& op, std::vector<instruction_ref> inputs);
} // namespace MIGRAPHX_INLINE_NS } // namespace MIGRAPHX_INLINE_NS
......
...@@ -41,7 +41,7 @@ struct src_file ...@@ -41,7 +41,7 @@ struct src_file
std::size_t len() const { return content.second - content.first; } std::size_t len() const { return content.second - content.first; }
}; };
struct src_compiler struct MIGRAPHX_EXPORT src_compiler
{ {
std::string compiler = "c++"; std::string compiler = "c++";
std::string flags = ""; std::string flags = "";
......
...@@ -56,7 +56,7 @@ struct concat_optimization ...@@ -56,7 +56,7 @@ struct concat_optimization
#ifdef TYPE_ERASED_DECLARATION #ifdef TYPE_ERASED_DECLARATION
// Type-erased interface for: // Type-erased interface for:
struct concat_optimization struct MIGRAPHX_EXPORT concat_optimization
{ {
// //
std::string name() const; std::string name() const;
......
...@@ -24,6 +24,8 @@ ...@@ -24,6 +24,8 @@
#ifndef MIGRAPHX_GUARD_CONFIG_HPP #ifndef MIGRAPHX_GUARD_CONFIG_HPP
#define MIGRAPHX_GUARD_CONFIG_HPP #define MIGRAPHX_GUARD_CONFIG_HPP
#include <migraphx/export.h>
#if !defined(MIGRAPHX_USE_CLANG_TIDY) && !defined(DOXYGEN) #if !defined(MIGRAPHX_USE_CLANG_TIDY) && !defined(DOXYGEN)
#ifdef BUILD_DEV #ifdef BUILD_DEV
......
...@@ -80,7 +80,7 @@ void finish_on_context(T&, any_ptr) ...@@ -80,7 +80,7 @@ void finish_on_context(T&, any_ptr)
#ifdef TYPE_ERASED_DECLARATION #ifdef TYPE_ERASED_DECLARATION
// Type-erased interface for: // Type-erased interface for:
struct context struct MIGRAPHX_EXPORT context
{ {
// (optional) // (optional)
value to_value() const; value to_value() const;
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
namespace migraphx { namespace migraphx {
inline namespace MIGRAPHX_INLINE_NS { inline namespace MIGRAPHX_INLINE_NS {
std::string convert_to_json(const std::string& str); MIGRAPHX_EXPORT std::string convert_to_json(const std::string& str);
} // namespace MIGRAPHX_INLINE_NS } // namespace MIGRAPHX_INLINE_NS
} // namespace migraphx } // namespace migraphx
......
...@@ -40,7 +40,7 @@ struct shape; ...@@ -40,7 +40,7 @@ struct shape;
struct cpp_generator_impl; struct cpp_generator_impl;
struct cpp_generator struct MIGRAPHX_EXPORT cpp_generator
{ {
using generate_module_callback = std::function<std::string( using generate_module_callback = std::function<std::string(
instruction_ref, const std::unordered_map<instruction_ref, std::string>&)>; instruction_ref, const std::unordered_map<instruction_ref, std::string>&)>;
...@@ -50,7 +50,7 @@ struct cpp_generator ...@@ -50,7 +50,7 @@ struct cpp_generator
std::string type; std::string type;
}; };
struct function struct MIGRAPHX_EXPORT function
{ {
std::vector<param> params = {}; std::vector<param> params = {};
std::string body = ""; std::string body = "";
......
...@@ -37,7 +37,7 @@ struct program; ...@@ -37,7 +37,7 @@ struct program;
/** /**
* Remove instructions where the output is not used. * Remove instructions where the output is not used.
*/ */
struct dead_code_elimination struct MIGRAPHX_EXPORT dead_code_elimination
{ {
std::string name() const { return "dead_code_elimination"; } std::string name() const { return "dead_code_elimination"; }
void apply(module& m) const; void apply(module& m) const;
......
...@@ -34,15 +34,15 @@ inline namespace MIGRAPHX_INLINE_NS { ...@@ -34,15 +34,15 @@ inline namespace MIGRAPHX_INLINE_NS {
struct module; struct module;
struct dominator_info struct MIGRAPHX_EXPORT dominator_info
{ {
bool strictly_dominate(instruction_ref ins1, instruction_ref ins2); bool strictly_dominate(instruction_ref ins1, instruction_ref ins2);
std::unordered_map<instruction_ref, instruction_ref> ins2idom; std::unordered_map<instruction_ref, instruction_ref> ins2idom;
}; };
dominator_info compute_dominator(module& m); MIGRAPHX_EXPORT dominator_info compute_dominator(module& m);
// dominator_info compute_dominator_naive(const module& m); // MIGRAPHX_EXPORT dominator_info compute_dominator_naive(const module& m);
} // namespace MIGRAPHX_INLINE_NS } // namespace MIGRAPHX_INLINE_NS
} // namespace migraphx } // 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