Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gaoqiong
MIGraphX
Commits
87d35010
Commit
87d35010
authored
Nov 29, 2018
by
Khalique
Browse files
manual merge
parents
6aebef15
84e7335e
Changes
159
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
64 additions
and
64 deletions
+64
-64
src/targets/gpu/include/migraphx/gpu/target.hpp
src/targets/gpu/include/migraphx/gpu/target.hpp
+4
-4
src/targets/gpu/include/migraphx/gpu/write_literals.hpp
src/targets/gpu/include/migraphx/gpu/write_literals.hpp
+4
-4
src/targets/gpu/leaky_relu.cpp
src/targets/gpu/leaky_relu.cpp
+2
-2
src/targets/gpu/lowering.cpp
src/targets/gpu/lowering.cpp
+2
-2
src/targets/gpu/mul.cpp
src/targets/gpu/mul.cpp
+2
-2
src/targets/gpu/pooling.cpp
src/targets/gpu/pooling.cpp
+2
-2
src/targets/gpu/relu.cpp
src/targets/gpu/relu.cpp
+2
-2
src/targets/gpu/rocblas.cpp
src/targets/gpu/rocblas.cpp
+2
-2
src/targets/gpu/sin.cpp
src/targets/gpu/sin.cpp
+2
-2
src/targets/gpu/softmax.cpp
src/targets/gpu/softmax.cpp
+2
-2
src/targets/gpu/target.cpp
src/targets/gpu/target.cpp
+2
-2
src/targets/gpu/write_literals.cpp
src/targets/gpu/write_literals.cpp
+4
-4
test/CMakeLists.txt
test/CMakeLists.txt
+10
-10
test/eliminate_allocation_test.cpp
test/eliminate_allocation_test.cpp
+1
-1
test/include/basic_ops.hpp
test/include/basic_ops.hpp
+10
-10
test/include/rob.hpp
test/include/rob.hpp
+3
-3
test/include/test.hpp
test/include/test.hpp
+2
-2
test/operation.cpp
test/operation.cpp
+4
-4
test/validate.cpp
test/validate.cpp
+4
-4
No files found.
src/targets/gpu/include/migraphx/gpu/target.hpp
View file @
87d35010
#ifndef MIGRAPH_GUARD_MIGRAPHLIB_MIOPEN_TARGET_HPP
#ifndef MIGRAPH
X
_GUARD_MIGRAPHLIB_MIOPEN_TARGET_HPP
#define MIGRAPH_GUARD_MIGRAPHLIB_MIOPEN_TARGET_HPP
#define MIGRAPH
X
_GUARD_MIGRAPHLIB_MIOPEN_TARGET_HPP
#include <migraphx/program.hpp>
#include <migraphx/program.hpp>
#include <migraphx/config.hpp>
#include <migraphx/config.hpp>
namespace
migraphx
{
namespace
migraphx
{
inline
namespace
MIGRAPH_INLINE_NS
{
inline
namespace
MIGRAPH
X
_INLINE_NS
{
namespace
gpu
{
namespace
gpu
{
struct
target
struct
target
...
@@ -16,7 +16,7 @@ struct target
...
@@ -16,7 +16,7 @@ struct target
};
};
}
// namespace gpu
}
// namespace gpu
}
// namespace MIGRAPH_INLINE_NS
}
// namespace MIGRAPH
X
_INLINE_NS
}
// namespace migraphx
}
// namespace migraphx
#endif
#endif
src/targets/gpu/include/migraphx/gpu/write_literals.hpp
View file @
87d35010
#ifndef MIGRAPH_GUARD_RTGLIB_MIOPEN_WRITE_LITERALS_HPP
#ifndef MIGRAPH
X
_GUARD_RTGLIB_MIOPEN_WRITE_LITERALS_HPP
#define MIGRAPH_GUARD_RTGLIB_MIOPEN_WRITE_LITERALS_HPP
#define MIGRAPH
X
_GUARD_RTGLIB_MIOPEN_WRITE_LITERALS_HPP
#include <migraphx/program.hpp>
#include <migraphx/program.hpp>
#include <migraphx/gpu/context.hpp>
#include <migraphx/gpu/context.hpp>
namespace
migraphx
{
namespace
migraphx
{
inline
namespace
MIGRAPH_INLINE_NS
{
inline
namespace
MIGRAPH
X
_INLINE_NS
{
namespace
gpu
{
namespace
gpu
{
...
@@ -18,7 +18,7 @@ struct write_literals
...
@@ -18,7 +18,7 @@ struct write_literals
};
};
}
// namespace gpu
}
// namespace gpu
}
// namespace MIGRAPH_INLINE_NS
}
// namespace MIGRAPH
X
_INLINE_NS
}
// namespace migraphx
}
// namespace migraphx
#endif
#endif
src/targets/gpu/leaky_relu.cpp
View file @
87d35010
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
#include <utility>
#include <utility>
namespace
migraphx
{
namespace
migraphx
{
inline
namespace
MIGRAPH_INLINE_NS
{
inline
namespace
MIGRAPH
X
_INLINE_NS
{
namespace
gpu
{
namespace
gpu
{
shape
miopen_leaky_relu
::
compute_shape
(
const
std
::
vector
<
shape
>&
inputs
)
const
shape
miopen_leaky_relu
::
compute_shape
(
const
std
::
vector
<
shape
>&
inputs
)
const
...
@@ -34,5 +34,5 @@ argument miopen_leaky_relu::compute(context& ctx,
...
@@ -34,5 +34,5 @@ argument miopen_leaky_relu::compute(context& ctx,
}
}
}
// namespace gpu
}
// namespace gpu
}
// namespace MIGRAPH_INLINE_NS
}
// namespace MIGRAPH
X
_INLINE_NS
}
// namespace migraphx
}
// namespace migraphx
src/targets/gpu/lowering.cpp
View file @
87d35010
...
@@ -35,7 +35,7 @@
...
@@ -35,7 +35,7 @@
#include <functional>
#include <functional>
namespace
migraphx
{
namespace
migraphx
{
inline
namespace
MIGRAPH_INLINE_NS
{
inline
namespace
MIGRAPH
X
_INLINE_NS
{
namespace
gpu
{
namespace
gpu
{
struct
miopen_apply
struct
miopen_apply
...
@@ -271,5 +271,5 @@ struct miopen_apply
...
@@ -271,5 +271,5 @@ struct miopen_apply
void
lowering
::
apply
(
program
&
p
)
const
{
miopen_apply
{
&
p
,
ctx
}.
apply
();
}
void
lowering
::
apply
(
program
&
p
)
const
{
miopen_apply
{
&
p
,
ctx
}.
apply
();
}
}
// namespace gpu
}
// namespace gpu
}
// namespace MIGRAPH_INLINE_NS
}
// namespace MIGRAPH
X
_INLINE_NS
}
// namespace migraphx
}
// namespace migraphx
src/targets/gpu/mul.cpp
View file @
87d35010
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
#include <utility>
#include <utility>
namespace
migraphx
{
namespace
migraphx
{
inline
namespace
MIGRAPH_INLINE_NS
{
inline
namespace
MIGRAPH
X
_INLINE_NS
{
namespace
gpu
{
namespace
gpu
{
shape
hip_mul
::
compute_shape
(
const
std
::
vector
<
shape
>&
inputs
)
const
shape
hip_mul
::
compute_shape
(
const
std
::
vector
<
shape
>&
inputs
)
const
...
@@ -22,5 +22,5 @@ argument hip_mul::compute(context& ctx, const shape&, const std::vector<argument
...
@@ -22,5 +22,5 @@ argument hip_mul::compute(context& ctx, const shape&, const std::vector<argument
}
}
}
// namespace gpu
}
// namespace gpu
}
// namespace MIGRAPH_INLINE_NS
}
// namespace MIGRAPH
X
_INLINE_NS
}
// namespace migraphx
}
// namespace migraphx
src/targets/gpu/pooling.cpp
View file @
87d35010
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
#include <utility>
#include <utility>
namespace
migraphx
{
namespace
migraphx
{
inline
namespace
MIGRAPH_INLINE_NS
{
inline
namespace
MIGRAPH
X
_INLINE_NS
{
namespace
gpu
{
namespace
gpu
{
shape
miopen_pooling
::
compute_shape
(
const
std
::
vector
<
shape
>&
inputs
)
const
shape
miopen_pooling
::
compute_shape
(
const
std
::
vector
<
shape
>&
inputs
)
const
...
@@ -38,5 +38,5 @@ argument miopen_pooling::compute(context& ctx,
...
@@ -38,5 +38,5 @@ argument miopen_pooling::compute(context& ctx,
}
}
}
// namespace gpu
}
// namespace gpu
}
// namespace MIGRAPH_INLINE_NS
}
// namespace MIGRAPH
X
_INLINE_NS
}
// namespace migraphx
}
// namespace migraphx
src/targets/gpu/relu.cpp
View file @
87d35010
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
#include <utility>
#include <utility>
namespace
migraphx
{
namespace
migraphx
{
inline
namespace
MIGRAPH_INLINE_NS
{
inline
namespace
MIGRAPH
X
_INLINE_NS
{
namespace
gpu
{
namespace
gpu
{
shape
miopen_relu
::
compute_shape
(
const
std
::
vector
<
shape
>&
inputs
)
const
shape
miopen_relu
::
compute_shape
(
const
std
::
vector
<
shape
>&
inputs
)
const
...
@@ -34,5 +34,5 @@ argument miopen_relu::compute(context& ctx,
...
@@ -34,5 +34,5 @@ argument miopen_relu::compute(context& ctx,
}
}
}
// namespace gpu
}
// namespace gpu
}
// namespace MIGRAPH_INLINE_NS
}
// namespace MIGRAPH
X
_INLINE_NS
}
// namespace migraphx
}
// namespace migraphx
src/targets/gpu/rocblas.cpp
View file @
87d35010
#include <migraphx/gpu/rocblas.hpp>
#include <migraphx/gpu/rocblas.hpp>
namespace
migraphx
{
namespace
migraphx
{
inline
namespace
MIGRAPH_INLINE_NS
{
inline
namespace
MIGRAPH
X
_INLINE_NS
{
namespace
gpu
{
namespace
gpu
{
rocblas_handle_ptr
create_rocblas_handle_ptr
()
rocblas_handle_ptr
create_rocblas_handle_ptr
()
...
@@ -19,5 +19,5 @@ rocblas_handle_ptr create_rocblas_handle_ptr(hipStream_t s)
...
@@ -19,5 +19,5 @@ rocblas_handle_ptr create_rocblas_handle_ptr(hipStream_t s)
}
}
}
// namespace gpu
}
// namespace gpu
}
// namespace MIGRAPH_INLINE_NS
}
// namespace MIGRAPH
X
_INLINE_NS
}
// namespace migraphx
}
// namespace migraphx
src/targets/gpu/sin.cpp
View file @
87d35010
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
#include <utility>
#include <utility>
namespace
migraphx
{
namespace
migraphx
{
inline
namespace
MIGRAPH_INLINE_NS
{
inline
namespace
MIGRAPH
X
_INLINE_NS
{
namespace
gpu
{
namespace
gpu
{
shape
hip_sin
::
compute_shape
(
const
std
::
vector
<
shape
>&
inputs
)
const
shape
hip_sin
::
compute_shape
(
const
std
::
vector
<
shape
>&
inputs
)
const
...
@@ -22,5 +22,5 @@ argument hip_sin::compute(context& ctx, const shape&, const std::vector<argument
...
@@ -22,5 +22,5 @@ argument hip_sin::compute(context& ctx, const shape&, const std::vector<argument
}
}
}
// namespace gpu
}
// namespace gpu
}
// namespace MIGRAPH_INLINE_NS
}
// namespace MIGRAPH
X
_INLINE_NS
}
// namespace migraphx
}
// namespace migraphx
src/targets/gpu/softmax.cpp
View file @
87d35010
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
#include <utility>
#include <utility>
namespace
migraphx
{
namespace
migraphx
{
inline
namespace
MIGRAPH_INLINE_NS
{
inline
namespace
MIGRAPH
X
_INLINE_NS
{
namespace
gpu
{
namespace
gpu
{
shape
miopen_softmax
::
compute_shape
(
const
std
::
vector
<
shape
>&
inputs
)
const
shape
miopen_softmax
::
compute_shape
(
const
std
::
vector
<
shape
>&
inputs
)
const
...
@@ -33,5 +33,5 @@ argument miopen_softmax::compute(context& ctx,
...
@@ -33,5 +33,5 @@ argument miopen_softmax::compute(context& ctx,
}
}
}
// namespace gpu
}
// namespace gpu
}
// namespace MIGRAPH_INLINE_NS
}
// namespace MIGRAPH
X
_INLINE_NS
}
// namespace migraphx
}
// namespace migraphx
src/targets/gpu/target.cpp
View file @
87d35010
...
@@ -19,7 +19,7 @@
...
@@ -19,7 +19,7 @@
#include <migraphx/gpu/concat_gpu_opt.hpp>
#include <migraphx/gpu/concat_gpu_opt.hpp>
namespace
migraphx
{
namespace
migraphx
{
inline
namespace
MIGRAPH_INLINE_NS
{
inline
namespace
MIGRAPH
X
_INLINE_NS
{
namespace
gpu
{
namespace
gpu
{
std
::
vector
<
pass
>
target
::
get_passes
(
migraphx
::
context
&
gctx
)
const
std
::
vector
<
pass
>
target
::
get_passes
(
migraphx
::
context
&
gctx
)
const
...
@@ -61,5 +61,5 @@ std::string target::name() const { return "miopen"; }
...
@@ -61,5 +61,5 @@ std::string target::name() const { return "miopen"; }
migraphx
::
context
target
::
get_context
()
const
{
return
context
{};
}
migraphx
::
context
target
::
get_context
()
const
{
return
context
{};
}
}
// namespace gpu
}
// namespace gpu
}
// namespace MIGRAPH_INLINE_NS
}
// namespace MIGRAPH
X
_INLINE_NS
}
// namespace migraphx
}
// namespace migraphx
src/targets/gpu/write_literals.cpp
View file @
87d35010
...
@@ -5,10 +5,10 @@
...
@@ -5,10 +5,10 @@
#include <migraphx/env.hpp>
#include <migraphx/env.hpp>
namespace
migraphx
{
namespace
migraphx
{
inline
namespace
MIGRAPH_INLINE_NS
{
inline
namespace
MIGRAPH
X
_INLINE_NS
{
namespace
gpu
{
namespace
gpu
{
MIGRAPH_DECLARE_ENV_VAR
(
MIGRAPH_COPY_LITERALS
)
MIGRAPH
X
_DECLARE_ENV_VAR
(
MIGRAPH
X
_COPY_LITERALS
)
struct
hip_load_literal
struct
hip_load_literal
{
{
...
@@ -33,7 +33,7 @@ void write_literals::apply(program& p) const
...
@@ -33,7 +33,7 @@ void write_literals::apply(program& p) const
{
{
if
(
ins
->
name
()
==
"@literal"
)
if
(
ins
->
name
()
==
"@literal"
)
{
{
if
(
enabled
(
MIGRAPH_COPY_LITERALS
{}))
if
(
enabled
(
MIGRAPH
X
_COPY_LITERALS
{}))
{
{
literal
l
=
ins
->
get_literal
();
literal
l
=
ins
->
get_literal
();
auto
pre
=
p
.
add_literal
(
l
);
auto
pre
=
p
.
add_literal
(
l
);
...
@@ -53,5 +53,5 @@ void write_literals::apply(program& p) const
...
@@ -53,5 +53,5 @@ void write_literals::apply(program& p) const
}
}
}
// namespace gpu
}
// namespace gpu
}
// namespace MIGRAPH_INLINE_NS
}
// namespace MIGRAPH
X
_INLINE_NS
}
// namespace migraphx
}
// namespace migraphx
test/CMakeLists.txt
View file @
87d35010
...
@@ -10,12 +10,12 @@ set(CTEST_PARALLEL_LEVEL ${N} CACHE STRING "CTest parallel level")
...
@@ -10,12 +10,12 @@ set(CTEST_PARALLEL_LEVEL ${N} CACHE STRING "CTest parallel level")
add_custom_target
(
check COMMAND
${
CMAKE_CTEST_COMMAND
}
--output-on-failure -j
${
CTEST_PARALLEL_LEVEL
}
-C
${
CMAKE_CFG_INTDIR
}
--timeout 1500
)
add_custom_target
(
check COMMAND
${
CMAKE_CTEST_COMMAND
}
--output-on-failure -j
${
CTEST_PARALLEL_LEVEL
}
-C
${
CMAKE_CFG_INTDIR
}
--timeout 1500
)
add_custom_target
(
tests
)
add_custom_target
(
tests
)
find_program
(
MIGRAPH_GDB gdb
)
find_program
(
MIGRAPH
X
_GDB gdb
)
if
(
MIGRAPH_GDB
)
if
(
MIGRAPH
X
_GDB
)
set
(
MIGRAPH_TEST_GDB On CACHE BOOL
""
)
set
(
MIGRAPH
X
_TEST_GDB On CACHE BOOL
""
)
else
()
else
()
set
(
MIGRAPH_TEST_GDB Off CACHE BOOL
""
)
set
(
MIGRAPH
X
_TEST_GDB Off CACHE BOOL
""
)
endif
()
endif
()
set
(
SKIP_TESTS
)
set
(
SKIP_TESTS
)
...
@@ -34,8 +34,8 @@ function(add_test_command NAME EXE)
...
@@ -34,8 +34,8 @@ function(add_test_command NAME EXE)
%1
${
ARGN
}
"
)
%1
${
ARGN
}
"
)
add_test
(
NAME
${
NAME
}
COMMAND
${
WINE_CMD
}
cmd /c
"
${
CMAKE_CURRENT_BINARY_DIR
}
/test_
${
NAME
}
.cmd"
$<TARGET_FILE:
${
EXE
}
>
)
add_test
(
NAME
${
NAME
}
COMMAND
${
WINE_CMD
}
cmd /c
"
${
CMAKE_CURRENT_BINARY_DIR
}
/test_
${
NAME
}
.cmd"
$<TARGET_FILE:
${
EXE
}
>
)
else
()
else
()
if
(
MIGRAPH_TEST_GDB
)
if
(
MIGRAPH
X
_TEST_GDB
)
# add_test(NAME ${NAME} COMMAND ${MIGRAPH_GDB}
# add_test(NAME ${NAME} COMMAND ${MIGRAPH
X
_GDB}
# --batch
# --batch
# --return-child-result
# --return-child-result
# -ex "set disable-randomization off"
# -ex "set disable-randomization off"
...
@@ -54,7 +54,7 @@ function(add_test_command NAME EXE)
...
@@ -54,7 +54,7 @@ function(add_test_command NAME EXE)
if(EXISTS
${
TEST_DIR
}
/core)
if(EXISTS
${
TEST_DIR
}
/core)
set(
\$
ENV{UBSAN_OPTIONS} print_stacktrace=1)
set(
\$
ENV{UBSAN_OPTIONS} print_stacktrace=1)
set(
\$
ENV{ASAN_OPTIONS} print_stacktrace=1)
set(
\$
ENV{ASAN_OPTIONS} print_stacktrace=1)
execute_process(COMMAND
${
MIGRAPH_GDB
}
$<TARGET_FILE:
${
EXE
}
>
${
TEST_DIR
}
/core -batch -ex bt)
execute_process(COMMAND
${
MIGRAPH
X
_GDB
}
$<TARGET_FILE:
${
EXE
}
>
${
TEST_DIR
}
/core -batch -ex bt)
endif()
endif()
message(FATAL_ERROR
\"
Test failed
\"
)
message(FATAL_ERROR
\"
Test failed
\"
)
endif()
endif()
...
@@ -95,7 +95,7 @@ foreach(TEST ${TESTS})
...
@@ -95,7 +95,7 @@ foreach(TEST ${TESTS})
rocm_clang_tidy_check
(
test_
${
BASE_NAME
}
)
rocm_clang_tidy_check
(
test_
${
BASE_NAME
}
)
endforeach
()
endforeach
()
if
(
MIGRAPH_ENABLE_GPU
)
if
(
MIGRAPH
X
_ENABLE_GPU
)
# gpu tests
# gpu tests
file
(
GLOB GPU_TESTS gpu/*.cpp
)
file
(
GLOB GPU_TESTS gpu/*.cpp
)
...
@@ -142,7 +142,7 @@ function(test_headers PREFIX)
...
@@ -142,7 +142,7 @@ function(test_headers PREFIX)
string
(
MAKE_C_IDENTIFIER
${
HEADER_REL
}
TEST_NAME
)
string
(
MAKE_C_IDENTIFIER
${
HEADER_REL
}
TEST_NAME
)
get_filename_component
(
BASE_NAME
${
HEADER
}
NAME_WE
)
get_filename_component
(
BASE_NAME
${
HEADER
}
NAME_WE
)
test_header
(
header_
${
TEST_NAME
}
${
PREFIX
}
/
${
BASE_NAME
}
.hpp
)
test_header
(
header_
${
TEST_NAME
}
${
PREFIX
}
/
${
BASE_NAME
}
.hpp
)
if
(
MIGRAPH_ENABLE_GPU
)
if
(
MIGRAPH
X
_ENABLE_GPU
)
target_link_libraries
(
header_
${
TEST_NAME
}
migraphx_gpu
)
target_link_libraries
(
header_
${
TEST_NAME
}
migraphx_gpu
)
endif
()
endif
()
endforeach
()
endforeach
()
...
@@ -150,6 +150,6 @@ endfunction()
...
@@ -150,6 +150,6 @@ endfunction()
test_headers
(
migraphx
${
CMAKE_SOURCE_DIR
}
/src/include/migraphx/*.hpp
)
test_headers
(
migraphx
${
CMAKE_SOURCE_DIR
}
/src/include/migraphx/*.hpp
)
test_headers
(
migraphx/cpu
${
CMAKE_SOURCE_DIR
}
/src/targets/cpu/include/migraphx/cpu/*.hpp
)
test_headers
(
migraphx/cpu
${
CMAKE_SOURCE_DIR
}
/src/targets/cpu/include/migraphx/cpu/*.hpp
)
if
(
MIGRAPH_ENABLE_GPU
)
if
(
MIGRAPH
X
_ENABLE_GPU
)
test_headers
(
migraphx/gpu
${
CMAKE_SOURCE_DIR
}
/src/targets/gpu/include/migraphx/gpu/*.hpp
)
test_headers
(
migraphx/gpu
${
CMAKE_SOURCE_DIR
}
/src/targets/gpu/include/migraphx/gpu/*.hpp
)
endif
()
endif
()
test/eliminate_allocation_test.cpp
View file @
87d35010
...
@@ -103,6 +103,6 @@ TEST_CASE(float_aligned)
...
@@ -103,6 +103,6 @@ TEST_CASE(float_aligned)
int
main
(
int
argc
,
const
char
*
argv
[])
int
main
(
int
argc
,
const
char
*
argv
[])
{
{
setenv
(
"MIGRAPH_DISABLE_MEMORY_COLORING"
,
"1"
,
1
);
setenv
(
"MIGRAPH
X
_DISABLE_MEMORY_COLORING"
,
"1"
,
1
);
test
::
run
(
argc
,
argv
);
test
::
run
(
argc
,
argv
);
}
}
test/include/basic_ops.hpp
View file @
87d35010
...
@@ -10,13 +10,13 @@ struct sum_op
...
@@ -10,13 +10,13 @@ struct sum_op
{
{
migraphx
::
argument
result
;
migraphx
::
argument
result
;
if
(
args
.
size
()
!=
2
)
if
(
args
.
size
()
!=
2
)
MIGRAPH_THROW
(
"Wrong args"
);
MIGRAPH
X
_THROW
(
"Wrong args"
);
if
(
args
[
0
].
get_shape
()
!=
args
[
1
].
get_shape
())
if
(
args
[
0
].
get_shape
()
!=
args
[
1
].
get_shape
())
MIGRAPH_THROW
(
"Wrong args"
);
MIGRAPH
X
_THROW
(
"Wrong args"
);
if
(
args
[
0
].
get_shape
().
lens
().
size
()
!=
1
)
if
(
args
[
0
].
get_shape
().
lens
().
size
()
!=
1
)
MIGRAPH_THROW
(
"Wrong args"
);
MIGRAPH
X
_THROW
(
"Wrong args"
);
if
(
args
[
0
].
get_shape
().
lens
().
front
()
!=
1
)
if
(
args
[
0
].
get_shape
().
lens
().
front
()
!=
1
)
MIGRAPH_THROW
(
"Wrong args"
);
MIGRAPH
X
_THROW
(
"Wrong args"
);
args
[
0
].
visit_at
([
&
](
auto
x
)
{
args
[
0
].
visit_at
([
&
](
auto
x
)
{
args
[
1
].
visit_at
([
&
](
auto
y
)
{
result
=
migraphx
::
literal
{
x
+
y
}.
get_argument
();
});
args
[
1
].
visit_at
([
&
](
auto
y
)
{
result
=
migraphx
::
literal
{
x
+
y
}.
get_argument
();
});
...
@@ -27,7 +27,7 @@ struct sum_op
...
@@ -27,7 +27,7 @@ struct sum_op
migraphx
::
shape
compute_shape
(
std
::
vector
<
migraphx
::
shape
>
inputs
)
const
migraphx
::
shape
compute_shape
(
std
::
vector
<
migraphx
::
shape
>
inputs
)
const
{
{
if
(
inputs
.
size
()
!=
2
)
if
(
inputs
.
size
()
!=
2
)
MIGRAPH_THROW
(
"Wrong inputs"
);
MIGRAPH
X
_THROW
(
"Wrong inputs"
);
return
inputs
.
front
();
return
inputs
.
front
();
}
}
};
};
...
@@ -40,13 +40,13 @@ struct minus_op
...
@@ -40,13 +40,13 @@ struct minus_op
{
{
migraphx
::
argument
result
;
migraphx
::
argument
result
;
if
(
args
.
size
()
!=
2
)
if
(
args
.
size
()
!=
2
)
MIGRAPH_THROW
(
"Wrong args"
);
MIGRAPH
X
_THROW
(
"Wrong args"
);
if
(
args
[
0
].
get_shape
()
!=
args
[
1
].
get_shape
())
if
(
args
[
0
].
get_shape
()
!=
args
[
1
].
get_shape
())
MIGRAPH_THROW
(
"Wrong args"
);
MIGRAPH
X
_THROW
(
"Wrong args"
);
if
(
args
[
0
].
get_shape
().
lens
().
size
()
!=
1
)
if
(
args
[
0
].
get_shape
().
lens
().
size
()
!=
1
)
MIGRAPH_THROW
(
"Wrong args"
);
MIGRAPH
X
_THROW
(
"Wrong args"
);
if
(
args
[
0
].
get_shape
().
lens
().
front
()
!=
1
)
if
(
args
[
0
].
get_shape
().
lens
().
front
()
!=
1
)
MIGRAPH_THROW
(
"Wrong args"
);
MIGRAPH
X
_THROW
(
"Wrong args"
);
args
[
0
].
visit_at
([
&
](
auto
x
)
{
args
[
0
].
visit_at
([
&
](
auto
x
)
{
args
[
1
].
visit_at
([
&
](
auto
y
)
{
result
=
migraphx
::
literal
{
x
-
y
}.
get_argument
();
});
args
[
1
].
visit_at
([
&
](
auto
y
)
{
result
=
migraphx
::
literal
{
x
-
y
}.
get_argument
();
});
...
@@ -57,7 +57,7 @@ struct minus_op
...
@@ -57,7 +57,7 @@ struct minus_op
migraphx
::
shape
compute_shape
(
std
::
vector
<
migraphx
::
shape
>
inputs
)
const
migraphx
::
shape
compute_shape
(
std
::
vector
<
migraphx
::
shape
>
inputs
)
const
{
{
if
(
inputs
.
size
()
!=
2
)
if
(
inputs
.
size
()
!=
2
)
MIGRAPH_THROW
(
"Wrong inputs"
);
MIGRAPH
X
_THROW
(
"Wrong inputs"
);
return
inputs
.
front
();
return
inputs
.
front
();
}
}
};
};
...
...
test/include/rob.hpp
View file @
87d35010
#ifndef MIGRAPH_GUARD_ROB_HPP
#ifndef MIGRAPH
X
_GUARD_ROB_HPP
#define MIGRAPH_GUARD_ROB_HPP
#define MIGRAPH
X
_GUARD_ROB_HPP
#ifdef __clang__
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic push
...
@@ -30,7 +30,7 @@ struct mem_data_ptr
...
@@ -30,7 +30,7 @@ struct mem_data_ptr
using
type
=
T
C
::*
;
using
type
=
T
C
::*
;
};
};
#define MIGRAPH_ROB(name, Type, C, mem)
\
#define MIGRAPH
X
_ROB(name, Type, C, mem) \
struct name##_tag : mem_data_ptr<C, Type> \
struct name##_tag : mem_data_ptr<C, Type> \
{ \
{ \
}; \
}; \
...
...
test/include/test.hpp
View file @
87d35010
...
@@ -7,8 +7,8 @@
...
@@ -7,8 +7,8 @@
#include <unordered_map>
#include <unordered_map>
#include <vector>
#include <vector>
#ifndef MIGRAPH_GUARD_TEST_TEST_HPP
#ifndef MIGRAPH
X
_GUARD_TEST_TEST_HPP
#define MIGRAPH_GUARD_TEST_TEST_HPP
#define MIGRAPH
X
_GUARD_TEST_TEST_HPP
namespace
test
{
namespace
test
{
// NOLINTNEXTLINE
// NOLINTNEXTLINE
...
...
test/operation.cpp
View file @
87d35010
...
@@ -15,13 +15,13 @@ struct simple_operation
...
@@ -15,13 +15,13 @@ struct simple_operation
std
::
string
name
()
const
{
return
"simple"
;
}
std
::
string
name
()
const
{
return
"simple"
;
}
migraphx
::
shape
compute_shape
(
const
std
::
vector
<
migraphx
::
shape
>&
)
const
migraphx
::
shape
compute_shape
(
const
std
::
vector
<
migraphx
::
shape
>&
)
const
{
{
MIGRAPH_THROW
(
"not computable"
);
MIGRAPH
X
_THROW
(
"not computable"
);
}
}
migraphx
::
argument
compute
(
migraphx
::
context
&
,
migraphx
::
argument
compute
(
migraphx
::
context
&
,
const
migraphx
::
shape
&
,
const
migraphx
::
shape
&
,
const
std
::
vector
<
migraphx
::
argument
>&
)
const
const
std
::
vector
<
migraphx
::
argument
>&
)
const
{
{
MIGRAPH_THROW
(
"not computable"
);
MIGRAPH
X
_THROW
(
"not computable"
);
}
}
friend
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
const
simple_operation
&
op
)
friend
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
const
simple_operation
&
op
)
{
{
...
@@ -35,13 +35,13 @@ struct simple_operation_no_print
...
@@ -35,13 +35,13 @@ struct simple_operation_no_print
std
::
string
name
()
const
{
return
"simple"
;
}
std
::
string
name
()
const
{
return
"simple"
;
}
migraphx
::
shape
compute_shape
(
const
std
::
vector
<
migraphx
::
shape
>&
)
const
migraphx
::
shape
compute_shape
(
const
std
::
vector
<
migraphx
::
shape
>&
)
const
{
{
MIGRAPH_THROW
(
"not computable"
);
MIGRAPH
X
_THROW
(
"not computable"
);
}
}
migraphx
::
argument
compute
(
migraphx
::
context
&
,
migraphx
::
argument
compute
(
migraphx
::
context
&
,
const
migraphx
::
shape
&
,
const
migraphx
::
shape
&
,
const
std
::
vector
<
migraphx
::
argument
>&
)
const
const
std
::
vector
<
migraphx
::
argument
>&
)
const
{
{
MIGRAPH_THROW
(
"not computable"
);
MIGRAPH
X
_THROW
(
"not computable"
);
}
}
};
};
...
...
test/validate.cpp
View file @
87d35010
...
@@ -39,10 +39,10 @@ TEST_CASE(incomplete_args)
...
@@ -39,10 +39,10 @@ TEST_CASE(incomplete_args)
EXPECT
(
bool
{
p
.
validate
()
==
ins
});
EXPECT
(
bool
{
p
.
validate
()
==
ins
});
}
}
MIGRAPH_ROB
(
access_ins_arguments
,
MIGRAPH
X
_ROB
(
access_ins_arguments
,
std
::
vector
<
migraphx
::
instruction_ref
>
,
std
::
vector
<
migraphx
::
instruction_ref
>
,
migraphx
::
instruction
,
migraphx
::
instruction
,
arguments
)
arguments
)
TEST_CASE
(
invalid_args
)
TEST_CASE
(
invalid_args
)
{
{
...
...
Prev
1
…
4
5
6
7
8
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment