Commit 087c205e authored by Paul's avatar Paul
Browse files

Merge from develop

parents a3a9e469 e15b8333
CheckOptions: CheckOptions:
- key: bugprone-unused-return-value.CheckedFunctions - 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' 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 - key: modernize-loop-convert.MinConfidence
value: risky value: risky
- key: modernize-loop-convert.NamingStyle - key: modernize-loop-convert.NamingStyle
value: lower_case value: lower_case
- key: performance-unnecessary-copy-initialization.AllowedTypes
value: 'shape'
- key: performance-unnecessary-value-param.AllowedTypes
value: 'shape'
- key: readability-function-size.BranchThreshold - key: readability-function-size.BranchThreshold
value: '15' value: '15'
- key: readability-function-size.LineThreshold - key: readability-function-size.LineThreshold
......
...@@ -52,6 +52,7 @@ rocm_enable_clang_tidy( ...@@ -52,6 +52,7 @@ rocm_enable_clang_tidy(
-clang-analyzer-optin.performance.Padding -clang-analyzer-optin.performance.Padding
-clang-diagnostic-deprecated-declarations -clang-diagnostic-deprecated-declarations
-clang-diagnostic-extern-c-compat -clang-diagnostic-extern-c-compat
-clang-diagnostic-disabled-macro-expansion
-clang-diagnostic-unused-command-line-argument -clang-diagnostic-unused-command-line-argument
-cppcoreguidelines-pro-bounds-array-to-pointer-decay -cppcoreguidelines-pro-bounds-array-to-pointer-decay
-cppcoreguidelines-pro-bounds-constant-array-index -cppcoreguidelines-pro-bounds-constant-array-index
...@@ -70,13 +71,12 @@ rocm_enable_clang_tidy( ...@@ -70,13 +71,12 @@ rocm_enable_clang_tidy(
-hicpp-explicit-conversions -hicpp-explicit-conversions
-hicpp-no-array-decay -hicpp-no-array-decay
-hicpp-special-member-functions -hicpp-special-member-functions
-hicpp-uppercase-literal-suffix
-hicpp-use-override -hicpp-use-override
# This check is broken # This check is broken
-hicpp-use-auto
-llvm-header-guard -llvm-header-guard
-llvm-include-order -llvm-include-order
-misc-macro-parentheses -misc-macro-parentheses
-modernize-use-auto
-modernize-use-override -modernize-use-override
-modernize-pass-by-value -modernize-pass-by-value
-modernize-use-default-member-init -modernize-use-default-member-init
...@@ -84,7 +84,12 @@ rocm_enable_clang_tidy( ...@@ -84,7 +84,12 @@ rocm_enable_clang_tidy(
-readability-braces-around-statements -readability-braces-around-statements
-readability-else-after-return -readability-else-after-return
-readability-named-parameter -readability-named-parameter
-readability-uppercase-literal-suffix,
-*-avoid-c-arrays
-*-explicit-constructor -*-explicit-constructor
-*-magic-numbers
-*-non-private-member-variables-in-classes
-*-use-auto
-*-use-emplace -*-use-emplace
-*-use-equals-default -*-use-equals-default
ERRORS ERRORS
...@@ -94,6 +99,7 @@ rocm_enable_clang_tidy( ...@@ -94,6 +99,7 @@ rocm_enable_clang_tidy(
".*hpp" ".*hpp"
EXTRA_ARGS EXTRA_ARGS
-DMIGRAPHX_USE_CLANG_TIDY -DMIGRAPHX_USE_CLANG_TIDY
"-Dmain\\\\(...\\\\)=main\\\\(__VA_ARGS__\\\\) // NOLINT"
) )
include(ROCMCppCheck) include(ROCMCppCheck)
...@@ -111,7 +117,9 @@ rocm_enable_cppcheck( ...@@ -111,7 +117,9 @@ rocm_enable_cppcheck(
passedByValue passedByValue
unusedStructMember unusedStructMember
functionStatic functionStatic
functionConst functionConst:*program.*
shadowFunction
shadowVar
definePrefix:*test/include/test.hpp definePrefix:*test/include/test.hpp
FORCE FORCE
INCONCLUSIVE INCONCLUSIVE
...@@ -124,6 +132,7 @@ rocm_enable_cppcheck( ...@@ -124,6 +132,7 @@ rocm_enable_cppcheck(
${CMAKE_CURRENT_SOURCE_DIR}/src/include ${CMAKE_CURRENT_SOURCE_DIR}/src/include
${CMAKE_CURRENT_SOURCE_DIR}/src/targets/cpu/include ${CMAKE_CURRENT_SOURCE_DIR}/src/targets/cpu/include
${CMAKE_CURRENT_SOURCE_DIR}/src/targets/miopen/include ${CMAKE_CURRENT_SOURCE_DIR}/src/targets/miopen/include
${CMAKE_CURRENT_SOURCE_DIR}/test/include
DEFINE DEFINE
CPPCHECK=1 CPPCHECK=1
) )
...@@ -136,6 +145,7 @@ rocm_create_package( ...@@ -136,6 +145,7 @@ rocm_create_package(
DESCRIPTION "AMD's graph optimizer" DESCRIPTION "AMD's graph optimizer"
MAINTAINER "Paul Fultz II <paul.fultz@amd.com>" MAINTAINER "Paul Fultz II <paul.fultz@amd.com>"
LDCONFIG LDCONFIG
PTH
DEPENDS miopen-hip rocblas hip_hcc half DEPENDS miopen-hip rocblas hip_hcc half
) )
......
...@@ -50,7 +50,7 @@ RUN pip install cget ...@@ -50,7 +50,7 @@ RUN pip install cget
RUN pip install https://github.com/pfultz2/rclone/archive/master.tar.gz RUN pip install https://github.com/pfultz2/rclone/archive/master.tar.gz
# Install hcc # 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 RUN cget -p $PREFIX install hcc,/hcc
# Use hcc # Use hcc
......
...@@ -8,10 +8,16 @@ def rocmtestnode(variant, name, body) { ...@@ -8,10 +8,16 @@ def rocmtestnode(variant, name, body) {
mkdir build mkdir build
cd build cd build
CXX=${compiler} CXXFLAGS='-Werror -Wno-fallback' cmake ${flags} .. 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 echo cmd
sh 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) { node(name) {
stage("checkout ${variant}") { stage("checkout ${variant}") {
...@@ -73,7 +79,7 @@ rocmtest tidy: rocmnode('rocmtest') { cmake_build -> ...@@ -73,7 +79,7 @@ rocmtest tidy: rocmnode('rocmtest') { cmake_build ->
rm -rf build rm -rf build
mkdir build mkdir build
cd build cd build
CXX='clang++-5.0' cmake .. CXX=hcc cmake ..
make -j8 -k analyze make -j8 -k analyze
''' '''
} }
...@@ -95,11 +101,16 @@ rocmtest tidy: rocmnode('rocmtest') { cmake_build -> ...@@ -95,11 +101,16 @@ rocmtest tidy: rocmnode('rocmtest') { cmake_build ->
stage('Clang Debug') { stage('Clang Debug') {
// TODO: Enanle integer // TODO: Enanle integer
def sanitizers = "undefined" 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') { stage('Clang Release') {
cmake_build("hcc", "-DCMAKE_BUILD_TYPE=release") cmake_build("hcc", "-DCMAKE_BUILD_TYPE=release")
} }
stage('Clang Release Python 3') {
cmake_build("hcc", "-DCMAKE_BUILD_TYPE=release -DPYTHON_EXECUTABLE=/usr/local/bin/python3")
}
}, gcc5: rocmnode('rocmtest') { cmake_build -> }, gcc5: rocmnode('rocmtest') { cmake_build ->
stage('GCC 5 Debug') { stage('GCC 5 Debug') {
cmake_build("g++-5", "-DCMAKE_BUILD_TYPE=debug") cmake_build("g++-5", "-DCMAKE_BUILD_TYPE=debug")
...@@ -113,6 +124,19 @@ rocmtest tidy: rocmnode('rocmtest') { cmake_build -> ...@@ -113,6 +124,19 @@ rocmtest tidy: rocmnode('rocmtest') { cmake_build ->
def cmake_linker_flags = "-DCMAKE_EXE_LINKER_FLAGS='${linker_flags}' -DCMAKE_SHARED_LINKER_FLAGS='${linker_flags}'" def cmake_linker_flags = "-DCMAKE_EXE_LINKER_FLAGS='${linker_flags}' -DCMAKE_SHARED_LINKER_FLAGS='${linker_flags}'"
// TODO: Add bounds-strict // TODO: Add bounds-strict
def sanitizers = "undefined,address" 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"
'''
} }
} }
...@@ -8,6 +8,7 @@ AMD's graph optimization engine. ...@@ -8,6 +8,7 @@ AMD's graph optimization engine.
* [HIP](https://github.com/ROCm-Developer-Tools/HIP) for running on the GPU * [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 * [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 * [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 ## Installing the dependencies
......
ignore:
- "test/"
...@@ -38,7 +38,15 @@ ...@@ -38,7 +38,15 @@
<message> <message>
<id>definePrefix</id> <id>definePrefix</id>
<severity>style</severity> <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> </message>
</rule> </rule>
<rule> <rule>
...@@ -74,7 +82,7 @@ ...@@ -74,7 +82,7 @@
</message> </message>
</rule> </rule>
<rule> <rule>
<pattern>(fclose|free|hipFree) \(</pattern> <pattern>\\W(fclose|free|hipFree|hipHostFree|hipFreeArray|hipMemFree|hipStreamDestroy|hipEventDestroy|hipArrayDestroy|hipCtxDestroy|hipDestroyTextureObject|hipDestroySurfaceObject) \(</pattern>
<message> <message>
<id>useManagePointer</id> <id>useManagePointer</id>
<severity>style</severity> <severity>style</severity>
......
pfultz2/rocm-recipes pfultz2/rocm-recipes
pcre danmar/cppcheck@681cb7dd909d1bfe41796b7616e43265177b9464 -DHAVE_RULES=1
danmar/cppcheck@f965e5873 -DHAVE_RULES=1 ROCm-Developer-Tools/HIP@fc22ef991ce7cb15821c8ccb4f03cdfc3e7e43cf
ROCm-Developer-Tools/HIP@3c7f5dbce24802ec4237e615038daff2909a2e8e python/cpython@v3.6.6 -X autotools -H sha256:92aa914572c695c0aeb01b0a214813f414da4b51a371234df514a74761f2bb36
# python/cpython@v3.6.6 -X autotools -H sha256:92aa914572c695c0aeb01b0a214813f414da4b51a371234df514a74761f2bb36
-f requirements.txt -f requirements.txt
...@@ -11,6 +11,7 @@ add_library(migraphx ...@@ -11,6 +11,7 @@ add_library(migraphx
eliminate_contiguous.cpp eliminate_contiguous.cpp
eliminate_concat.cpp eliminate_concat.cpp
fwd_conv_batchnorm_rewrite.cpp fwd_conv_batchnorm_rewrite.cpp
rewrite_rnn.cpp
env.cpp env.cpp
generate.cpp generate.cpp
instruction.cpp instruction.cpp
...@@ -35,6 +36,7 @@ target_include_directories(migraphx SYSTEM PUBLIC $<BUILD_INTERFACE:${HALF_INCLU ...@@ -35,6 +36,7 @@ target_include_directories(migraphx SYSTEM PUBLIC $<BUILD_INTERFACE:${HALF_INCLU
set(PACKAGE_DEPENDS) set(PACKAGE_DEPENDS)
add_subdirectory(onnx) add_subdirectory(onnx)
add_subdirectory(py)
add_subdirectory(targets/cpu) add_subdirectory(targets/cpu)
if(MIGRAPHX_ENABLE_GPU) if(MIGRAPHX_ENABLE_GPU)
list(APPEND PACKAGE_DEPENDS MIOpen rocblas) list(APPEND PACKAGE_DEPENDS MIOpen rocblas)
......
...@@ -12,7 +12,7 @@ void auto_contiguous::apply(program& p) const ...@@ -12,7 +12,7 @@ void auto_contiguous::apply(program& p) const
for(auto ins : iterator_for(p)) for(auto ins : iterator_for(p))
{ {
shape s = ins->get_shape(); 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); auto c = p.insert_instruction(std::next(ins), op::contiguous{}, ins);
p.replace_instruction(ins, c); p.replace_instruction(ins, c);
......
...@@ -13,7 +13,7 @@ struct match_const_add ...@@ -13,7 +13,7 @@ struct match_const_add
return match::name("add")(match::args(match::name("@literal"), match::name("@literal"))); return match::name("add")(match::args(match::name("@literal"), match::name("@literal")));
} }
void apply(program& p, match::matcher_result r) const void apply(program& p, const match::matcher_result& r) const
{ {
auto ins = r.result; auto ins = r.result;
auto arg1 = ins->inputs().at(0)->get_literal(); auto arg1 = ins->inputs().at(0)->get_literal();
......
...@@ -41,8 +41,9 @@ void dead_code_elimination::apply(program& p) const ...@@ -41,8 +41,9 @@ void dead_code_elimination::apply(program& p) const
// Skip the last instruction // Skip the last instruction
if(i == last) if(i == last)
break; break;
// Skip instruction with empty shape as output unless its a builtin // Skip instruction with empty shape as output unless its a builtin or undefined
if(i->get_shape().elements() == 0 and not(i->name().front() == '@')) if(i->get_shape().elements() == 0 and not(i->name().front() == '@') and
not(i->name() == "undefined"))
continue; continue;
assert(bidistance(p, i, last) > 0); assert(bidistance(p, i, last) > 0);
fix([&](auto self, auto leaf) { fix([&](auto self, auto leaf) {
......
...@@ -13,8 +13,6 @@ inline namespace MIGRAPHX_INLINE_NS { ...@@ -13,8 +13,6 @@ inline namespace MIGRAPHX_INLINE_NS {
void eliminate_allocation::apply(program& p) const void eliminate_allocation::apply(program& p) const
{ {
assert(alignment > 0); assert(alignment > 0);
if(!enabled(MIGRAPHX_DISABLE_MEMORY_COLORING{}))
return;
std::size_t n = 0; std::size_t n = 0;
std::vector<std::pair<instruction_ref, std::size_t>> allocs; std::vector<std::pair<instruction_ref, std::size_t>> allocs;
...@@ -27,6 +25,8 @@ void eliminate_allocation::apply(program& p) const ...@@ -27,6 +25,8 @@ void eliminate_allocation::apply(program& p) const
std::size_t padding = (alignment - (size % alignment)) % alignment; std::size_t padding = (alignment - (size % alignment)) % alignment;
n += size + padding; n += size + padding;
} }
if(n > 0)
{
auto mem = p.add_parameter("memory", shape{shape::int8_type, {n}}); auto mem = p.add_parameter("memory", shape{shape::int8_type, {n}});
for(auto&& pp : allocs) for(auto&& pp : allocs)
{ {
...@@ -35,6 +35,7 @@ void eliminate_allocation::apply(program& p) const ...@@ -35,6 +35,7 @@ void eliminate_allocation::apply(program& p) const
auto offset = pp.second; auto offset = pp.second;
p.replace_instruction(ins, op::load{s, offset}, mem); p.replace_instruction(ins, op::load{s, offset}, mem);
} }
}
} }
} // namespace MIGRAPHX_INLINE_NS } // namespace MIGRAPHX_INLINE_NS
......
...@@ -36,14 +36,17 @@ void eliminate_concat::apply(program& p) const ...@@ -36,14 +36,17 @@ void eliminate_concat::apply(program& p) const
// Where are the allocations for the tensors to be concatenated? // Where are the allocations for the tensors to be concatenated?
std::vector<instruction_ref> allocations; std::vector<instruction_ref> allocations;
for(auto ins2 = ins->inputs().begin(); ins2 != ins->inputs().end() - 1; ins2++) std::transform(
{ ins->inputs().begin(),
auto last2 = (*ins2)->inputs().back(); std::prev(ins->inputs().end()),
if(last2->name() == concat_opt.allocate()) std::back_inserter(allocations),
{ [&](instruction_ref x) { return instruction::get_output_alias(x, true); });
allocations.push_back(last2);
} if(std::any_of(allocations.begin(), allocations.end(), [&](auto x) {
} return x->name() != concat_opt.allocate();
}))
continue;
// Need to sort the allocations, so that we know where to // Need to sort the allocations, so that we know where to
// insert the "super"-allocation // insert the "super"-allocation
std::sort( std::sort(
...@@ -53,13 +56,13 @@ void eliminate_concat::apply(program& p) const ...@@ -53,13 +56,13 @@ void eliminate_concat::apply(program& p) const
// Move "super" allocation to the front // Move "super" allocation to the front
auto first = allocations.front(); auto first = allocations.front();
auto super = p.move_instruction(last, first); auto super = p.move_instruction(last, first);
// Replace each allocation with a load
std::size_t offset = 0; std::size_t offset = 0;
for(auto x : allocations) for(auto alloc : allocations)
{ {
migraphx::op::load op{x->get_shape(), offset}; op::load op{alloc->get_shape(), offset};
// migraphx::op::load op{x->get_shape(), 0}; p.replace_instruction(alloc, op, {super});
p.replace_instruction(x, op, {super}); offset += alloc->get_shape().bytes();
offset += x->get_shape().bytes();
} }
std::vector<instruction_ref> args = {super}; std::vector<instruction_ref> args = {super};
std::copy(ins->inputs().begin(), ins->inputs().end() - 1, std::back_inserter(args)); std::copy(ins->inputs().begin(), ins->inputs().end() - 1, std::back_inserter(args));
......
...@@ -27,6 +27,13 @@ void eliminate_contiguous::apply(program& p) const ...@@ -27,6 +27,13 @@ void eliminate_contiguous::apply(program& p) const
{ {
for(auto ins : iterator_for(p)) for(auto ins : iterator_for(p))
{ {
// skip the reshape operator for now, since there is a bug
// for the transpose followed by a reshape
if(ins->name() == "reshape")
{
continue;
}
// Make a copy so we can modify it while we iterate // Make a copy so we can modify it while we iterate
auto args = ins->inputs(); auto args = ins->inputs();
for(auto arg : ins->inputs()) for(auto arg : ins->inputs())
......
...@@ -5,6 +5,10 @@ ...@@ -5,6 +5,10 @@
namespace migraphx { namespace migraphx {
inline namespace MIGRAPHX_INLINE_NS { inline namespace MIGRAPHX_INLINE_NS {
// Forward declare any_cast
template <class T>
const T& any_cast(const T&);
namespace detail { namespace detail {
template <class U> template <class U>
......
...@@ -15,11 +15,19 @@ struct check_context ...@@ -15,11 +15,19 @@ struct check_context
std::string name() const { return "check_context"; } std::string name() const { return "check_context"; }
shape compute_shape(const std::vector<shape>&) const { return {}; } shape compute_shape(const std::vector<shape>&) const { return {}; }
argument compute(context& ctx, const shape&, const std::vector<argument>&) const argument compute(context& ctx, const shape&, const std::vector<argument>&) const
{
this->check(ctx);
return {};
}
void finalize(context& ctx, const shape&, const std::vector<shape>&) const
{
this->check(ctx);
}
void check(context& ctx) const
{ {
T* x = any_cast<T>(&ctx); T* x = any_cast<T>(&ctx);
if(x == nullptr) if(x == nullptr)
MIGRAPHX_THROW(std::string("Unexpected context type: ") + ctx.type_id().name()); MIGRAPHX_THROW(std::string("Unexpected context type: ") + ctx.type_id().name());
return {};
} }
}; };
......
...@@ -119,6 +119,13 @@ struct concat_optimization ...@@ -119,6 +119,13 @@ struct concat_optimization
return (*this).private_detail_te_get_handle().get_concat(op); return (*this).private_detail_te_get_handle().get_concat(op);
} }
friend bool is_shared(const concat_optimization& private_detail_x,
const concat_optimization& private_detail_y)
{
return private_detail_x.private_detail_te_handle_mem_var ==
private_detail_y.private_detail_te_handle_mem_var;
}
private: private:
struct private_detail_te_handle_base_type struct private_detail_te_handle_base_type
{ {
...@@ -235,6 +242,7 @@ inline const ValueType& any_cast(const concat_optimization& x) ...@@ -235,6 +242,7 @@ inline const ValueType& any_cast(const concat_optimization& x)
} }
#endif #endif
} // namespace MIGRAPHX_INLINE_NS } // namespace MIGRAPHX_INLINE_NS
} // namespace migraphx } // namespace migraphx
......
...@@ -95,7 +95,13 @@ struct context ...@@ -95,7 +95,13 @@ struct context
void finish() const void finish() const
{ {
assert((*this).private_detail_te_handle_mem_var); assert((*this).private_detail_te_handle_mem_var);
return (*this).private_detail_te_get_handle().finish(); (*this).private_detail_te_get_handle().finish();
}
friend bool is_shared(const context& private_detail_x, const context& private_detail_y)
{
return private_detail_x.private_detail_te_handle_mem_var ==
private_detail_y.private_detail_te_handle_mem_var;
} }
private: private:
...@@ -136,7 +142,7 @@ struct context ...@@ -136,7 +142,7 @@ struct context
const std::type_info& type() const override { return typeid(private_detail_te_value); } const std::type_info& type() const override { return typeid(private_detail_te_value); }
void finish() const override { return private_detail_te_value.finish(); } void finish() const override { private_detail_te_value.finish(); }
PrivateDetailTypeErasedT private_detail_te_value; PrivateDetailTypeErasedT private_detail_te_value;
}; };
......
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