"vscode:/vscode.git/clone" did not exist on "3107fda5d0d5c2ee41374466f3088d6cd93d4abf"
Commit 536ec35f authored by Khalique's avatar Khalique
Browse files

Merge branch 'develop' of https://github.com/ROCmSoftwarePlatform/AMDMIGraphX into group_conv

parents 8d258ac4 46b3e7da
CheckOptions:
- 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'
- key: cppcoreguidelines-macro-usage.AllowedRegexp
value: 'DEBUG|FALLTHROUGH|_THROW|_REQUIRES|_DECLARE_|_VISIT_|_GENERATE_|_DETAIL_|_MANAGE_PTR|_MATCHER|DEVICE_SHARED'
- key: modernize-loop-convert.MinConfidence
value: risky
- key: modernize-loop-convert.NamingStyle
value: lower_case
- key: performance-unnecessary-copy-initialization.AllowedTypes
value: 'shape'
- key: performance-unnecessary-value-param.AllowedTypes
value: 'shape'
- key: readability-function-size.BranchThreshold
value: '15'
- key: readability-function-size.LineThreshold
......
......@@ -52,6 +52,7 @@ rocm_enable_clang_tidy(
-clang-analyzer-optin.performance.Padding
-clang-diagnostic-deprecated-declarations
-clang-diagnostic-extern-c-compat
-clang-diagnostic-disabled-macro-expansion
-clang-diagnostic-unused-command-line-argument
-cppcoreguidelines-pro-bounds-array-to-pointer-decay
-cppcoreguidelines-pro-bounds-constant-array-index
......@@ -70,13 +71,12 @@ rocm_enable_clang_tidy(
-hicpp-explicit-conversions
-hicpp-no-array-decay
-hicpp-special-member-functions
-hicpp-uppercase-literal-suffix
-hicpp-use-override
# This check is broken
-hicpp-use-auto
-llvm-header-guard
-llvm-include-order
-misc-macro-parentheses
-modernize-use-auto
-modernize-use-override
-modernize-pass-by-value
-modernize-use-default-member-init
......@@ -84,7 +84,12 @@ rocm_enable_clang_tidy(
-readability-braces-around-statements
-readability-else-after-return
-readability-named-parameter
-readability-uppercase-literal-suffix,
-*-avoid-c-arrays
-*-explicit-constructor
-*-magic-numbers
-*-non-private-member-variables-in-classes
-*-use-auto
-*-use-emplace
-*-use-equals-default
ERRORS
......@@ -94,6 +99,7 @@ rocm_enable_clang_tidy(
".*hpp"
EXTRA_ARGS
-DMIGRAPHX_USE_CLANG_TIDY
"-Dmain\\\\(...\\\\)=main\\\\(__VA_ARGS__\\\\) // NOLINT"
)
include(ROCMCppCheck)
......@@ -124,6 +130,7 @@ rocm_enable_cppcheck(
${CMAKE_CURRENT_SOURCE_DIR}/src/include
${CMAKE_CURRENT_SOURCE_DIR}/src/targets/cpu/include
${CMAKE_CURRENT_SOURCE_DIR}/src/targets/miopen/include
${CMAKE_CURRENT_SOURCE_DIR}/test/include
DEFINE
CPPCHECK=1
)
......
......@@ -50,7 +50,7 @@ RUN pip install cget
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 rclone -b roc-2.0.x -c 757fb492517b80e7c86338af5fc1a43d63cb25a9 https://github.com/RadeonOpenCompute/hcc.git /hcc
RUN cget -p $PREFIX install hcc,/hcc
# Use hcc
......
......@@ -8,7 +8,7 @@ def rocmtestnode(variant, name, body) {
mkdir build
cd build
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 check
"""
echo cmd
sh cmd
......@@ -73,7 +73,7 @@ rocmtest tidy: rocmnode('rocmtest') { cmake_build ->
rm -rf build
mkdir build
cd build
CXX='clang++-5.0' cmake ..
CXX=hcc cmake ..
make -j8 -k analyze
'''
}
......
......@@ -74,7 +74,7 @@
</message>
</rule>
<rule>
<pattern>(fclose|free|hipFree) \(</pattern>
<pattern>(fclose|free|hipFree|hipHostFree|hipFreeArray|hipMemFree|hipStreamDestroy|hipEventDestroy|hipArrayDestroy|hipCtxDestroy|hipDestroyTextureObject|hipDestroySurfaceObject) \(</pattern>
<message>
<id>useManagePointer</id>
<severity>style</severity>
......
pfultz2/rocm-recipes
pcre
danmar/cppcheck@f965e5873 -DHAVE_RULES=1
ROCm-Developer-Tools/HIP@3c7f5dbce24802ec4237e615038daff2909a2e8e
# python/cpython@v3.6.6 -X autotools -H sha256:92aa914572c695c0aeb01b0a214813f414da4b51a371234df514a74761f2bb36
ROCm-Developer-Tools/HIP@fc22ef991ce7cb15821c8ccb4f03cdfc3e7e43cf
python/cpython@v3.6.6 -X autotools -H sha256:92aa914572c695c0aeb01b0a214813f414da4b51a371234df514a74761f2bb36
-f requirements.txt
......@@ -13,7 +13,7 @@ struct match_const_add
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 arg1 = ins->inputs().at(0)->get_literal();
......
......@@ -235,6 +235,7 @@ inline const ValueType& any_cast(const concat_optimization& x)
}
#endif
} // namespace MIGRAPHX_INLINE_NS
} // namespace migraphx
......
......@@ -10,7 +10,7 @@ inline namespace MIGRAPHX_INLINE_NS {
template <typename T>
std::shared_ptr<T> make_shared_array(size_t size)
{
return std::shared_ptr<T>(new T[size], std::default_delete<T[]>());
return std::shared_ptr<T>(new T[size], std::default_delete<T[]>()); // NOLINT
}
} // namespace MIGRAPHX_INLINE_NS
......
......@@ -7,6 +7,24 @@
namespace migraphx {
inline namespace MIGRAPHX_INLINE_NS {
struct unknown
{
std::string op;
std::string name() const { return "unknown:" + op; }
shape compute_shape(std::vector<shape> input) const
{
if(input.empty())
return {};
else
return input.front();
}
friend std::ostream& operator<<(std::ostream& os, const unknown& x)
{
os << x.name();
return os;
}
};
/// Create a program from an onnx file
program parse_onnx(const std::string& name);
......
......@@ -291,7 +291,7 @@ struct transpose
}
std::vector<size_t> output_lens(input_lens.size());
std::vector<size_t> output_strides(input_lens.size());
for(int i = 0; i < output_lens.size(); i++)
for(std::size_t i = 0; i < output_lens.size(); i++)
{
output_lens[i] = input_lens[dims[i]];
output_strides[i] = input_strides[dims[i]];
......@@ -328,7 +328,7 @@ struct concat
std::size_t axis = 0;
std::string name() const { return "concat"; }
std::vector<std::size_t> compute_offsets(const shape& output_shape,
const std::vector<argument> args) const
const std::vector<argument>& args) const
{
std::vector<std::size_t> offsets;
std::vector<std::size_t> offset(args[0].get_shape().lens().size(), 0);
......
......@@ -35,22 +35,22 @@ struct shape
m(uint64_type, uint64_t)
// clang-format on
#define MIGRAPHX_SHAPE_ENUM_TYPES(x, t) x,
#define MIGRAPHX_SHAPE_GENERATE_ENUM_TYPES(x, t) x,
enum type_t
{
MIGRAPHX_SHAPE_VISIT_TYPES(MIGRAPHX_SHAPE_ENUM_TYPES)
MIGRAPHX_SHAPE_VISIT_TYPES(MIGRAPHX_SHAPE_GENERATE_ENUM_TYPES)
};
#undef MIGRAPHX_SHAPE_ENUM_TYPES
#undef MIGRAPHX_SHAPE_GENERATE_ENUM_TYPES
template <class T, class = void>
struct get_type;
#define MIGRAPHX_SHAPE_GET_TYPE(x, t) \
#define MIGRAPHX_SHAPE_GENERATE_GET_TYPE(x, t) \
template <class T> \
struct get_type<t, T> : std::integral_constant<type_t, x> \
{ \
};
MIGRAPHX_SHAPE_VISIT_TYPES(MIGRAPHX_SHAPE_GET_TYPE)
#undef MIGRAPHX_SHAPE_GET_TYPE
MIGRAPHX_SHAPE_VISIT_TYPES(MIGRAPHX_SHAPE_GENERATE_GET_TYPE)
#undef MIGRAPHX_SHAPE_GENERATE_GET_TYPE
template <class T>
struct get_type<const T> : get_type<T>
......@@ -148,10 +148,10 @@ struct shape
{
switch(this->type())
{
#define MIGRAPHX_SHAPE_VISITOR_CASE(x, t) \
#define MIGRAPHX_SHAPE_GENERATE_VISITOR_CASE(x, t) \
case x: v(as<t>()); return;
MIGRAPHX_SHAPE_VISIT_TYPES(MIGRAPHX_SHAPE_VISITOR_CASE)
#undef MIGRAPHX_SHAPE_VISITOR_CASE
MIGRAPHX_SHAPE_VISIT_TYPES(MIGRAPHX_SHAPE_GENERATE_VISITOR_CASE)
#undef MIGRAPHX_SHAPE_GENERATE_VISITOR_CASE
}
MIGRAPHX_THROW("Unknown type");
}
......
......@@ -164,7 +164,7 @@ bool operator!=(const tensor_view<T>& x, const tensor_view<U>& y)
}
template <class T>
tensor_view<T> make_view(shape s, T* data)
tensor_view<T> make_view(const shape& s, T* data)
{
return {s, data};
}
......
......@@ -18,7 +18,7 @@ const std::string& get_type_name()
name = typeid(PrivateMigraphTypeNameProbe).name();
name = name.substr(7);
#else
const char parameter_name[] = "PrivateMigraphTypeNameProbe =";
const char parameter_name[] = "PrivateMigraphTypeNameProbe ="; // NOLINT
name = __PRETTY_FUNCTION__;
......
......@@ -14,7 +14,10 @@
auto reverse_int(unsigned int i)
{
unsigned char c1, c2, c3, c4;
unsigned char c1;
unsigned char c2;
unsigned char c3;
unsigned char c4;
c1 = i & 255u;
c2 = (i >> 8u) & 255u;
c3 = (i >> 16u) & 255u;
......@@ -32,7 +35,9 @@ read_mnist_images(const std::string& full_path, int& number_of_images, int& imag
if(file.is_open())
{
int magic_number = 0, n_rows = 0, n_cols = 0;
int magic_number = 0;
int n_rows = 0;
int n_cols = 0;
file.read(reinterpret_cast<char*>(&magic_number), sizeof(magic_number));
magic_number = reverse_int(magic_number);
......
......@@ -15,26 +15,10 @@
#include <migraphx/ranges.hpp>
#include <migraphx/instruction.hpp>
#include <migraphx/config.hpp>
#include <migraphx/onnx.hpp>
namespace migraphx {
inline namespace MIGRAPHX_INLINE_NS {
struct unknown
{
std::string op;
std::string name() const { return "unknown:" + op; }
shape compute_shape(std::vector<shape> input) const
{
if(input.empty())
return {};
else
return input.front();
}
friend std::ostream& operator<<(std::ostream& os, const unknown& x)
{
os << x.name();
return os;
}
};
struct onnx_parser
{
......@@ -338,7 +322,7 @@ struct onnx_parser
instruction_ref
parse_flatten(const std::string&, attribute_map attributes, std::vector<instruction_ref> args)
{
uint64_t axis = 0;
uint64_t axis = 1;
if(contains(attributes, "axis"))
{
axis = parse_value(attributes.at("axis")).at<int>();
......@@ -413,7 +397,7 @@ struct onnx_parser
}
if(contains(attributes, "beta"))
{
alpha = parse_value(attributes.at("beta")).at<float>();
beta = parse_value(attributes.at("beta")).at<float>();
}
if(contains(attributes, "transA"))
{
......
......@@ -116,7 +116,7 @@ void verify_reduced_program(F f, double tolerance = 80)
{
migraphx::program p = f();
auto n = std::distance(p.begin(), p.end());
for(int i = 0; i < n; i++)
for(std::size_t i = 0; i < n; i++)
{
verify_reduced(f, i, tolerance);
}
......
......@@ -169,10 +169,10 @@ std::string shape::type_string() const
{
switch(this->type())
{
#define MIGRAPHX_SHAPE_TYPE_STRING_CASE(x, t) \
#define MIGRAPHX_SHAPE_GENERATE_TYPE_STRING_CASE(x, t) \
case x: return #x;
MIGRAPHX_SHAPE_VISIT_TYPES(MIGRAPHX_SHAPE_TYPE_STRING_CASE)
#undef MIGRAPHX_SHAPE_TYPE_STRING_CASE
MIGRAPHX_SHAPE_VISIT_TYPES(MIGRAPHX_SHAPE_GENERATE_TYPE_STRING_CASE)
#undef MIGRAPHX_SHAPE_GENERATE_TYPE_STRING_CASE
}
MIGRAPHX_THROW("Invalid type");
}
......
......@@ -171,7 +171,8 @@ struct cpu_im2col
const std::size_t& stride_h = op.stride[0];
const std::size_t& stride_w = op.stride[1];
int kdiv2_h, kdiv2_w;
int kdiv2_h;
int kdiv2_w;
kdiv2_h = kernel_h / 2;
kdiv2_w = kernel_w / 2;
// calculate output sizes
......
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