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
bb390b65
Commit
bb390b65
authored
Nov 28, 2018
by
Shucai Xiao
Browse files
Merge branch 'activationOperators' into addLogExpOperators
parents
adfa1a93
682ad83a
Changes
195
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
52 additions
and
52 deletions
+52
-52
src/targets/gpu/sigmoid.cpp
src/targets/gpu/sigmoid.cpp
+2
-2
src/targets/gpu/sin.cpp
src/targets/gpu/sin.cpp
+2
-2
src/targets/gpu/sinh.cpp
src/targets/gpu/sinh.cpp
+2
-2
src/targets/gpu/softmax.cpp
src/targets/gpu/softmax.cpp
+2
-2
src/targets/gpu/tan.cpp
src/targets/gpu/tan.cpp
+2
-2
src/targets/gpu/tanh.cpp
src/targets/gpu/tanh.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/sigmoid.cpp
View file @
bb390b65
...
...
@@ -5,7 +5,7 @@
#include <utility>
namespace
migraphx
{
inline
namespace
MIGRAPH_INLINE_NS
{
inline
namespace
MIGRAPH
X
_INLINE_NS
{
namespace
gpu
{
shape
miopen_sigmoid
::
compute_shape
(
const
std
::
vector
<
shape
>&
inputs
)
const
...
...
@@ -34,5 +34,5 @@ argument miopen_sigmoid::compute(context& ctx,
}
}
// namespace gpu
}
// namespace MIGRAPH_INLINE_NS
}
// namespace MIGRAPH
X
_INLINE_NS
}
// namespace migraphx
src/targets/gpu/sin.cpp
View file @
bb390b65
...
...
@@ -6,7 +6,7 @@
#include <utility>
namespace
migraphx
{
inline
namespace
MIGRAPH_INLINE_NS
{
inline
namespace
MIGRAPH
X
_INLINE_NS
{
namespace
gpu
{
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
}
}
// namespace gpu
}
// namespace MIGRAPH_INLINE_NS
}
// namespace MIGRAPH
X
_INLINE_NS
}
// namespace migraphx
src/targets/gpu/sinh.cpp
View file @
bb390b65
...
...
@@ -6,7 +6,7 @@
#include <utility>
namespace
migraphx
{
inline
namespace
MIGRAPH_INLINE_NS
{
inline
namespace
MIGRAPH
X
_INLINE_NS
{
namespace
gpu
{
shape
hip_sinh
::
compute_shape
(
const
std
::
vector
<
shape
>&
inputs
)
const
...
...
@@ -22,5 +22,5 @@ argument hip_sinh::compute(context& ctx, const shape&, const std::vector<argumen
}
}
// namespace gpu
}
// namespace MIGRAPH_INLINE_NS
}
// namespace MIGRAPH
X
_INLINE_NS
}
// namespace migraphx
src/targets/gpu/softmax.cpp
View file @
bb390b65
...
...
@@ -5,7 +5,7 @@
#include <utility>
namespace
migraphx
{
inline
namespace
MIGRAPH_INLINE_NS
{
inline
namespace
MIGRAPH
X
_INLINE_NS
{
namespace
gpu
{
shape
miopen_softmax
::
compute_shape
(
const
std
::
vector
<
shape
>&
inputs
)
const
...
...
@@ -33,5 +33,5 @@ argument miopen_softmax::compute(context& ctx,
}
}
// namespace gpu
}
// namespace MIGRAPH_INLINE_NS
}
// namespace MIGRAPH
X
_INLINE_NS
}
// namespace migraphx
src/targets/gpu/tan.cpp
View file @
bb390b65
...
...
@@ -6,7 +6,7 @@
#include <utility>
namespace
migraphx
{
inline
namespace
MIGRAPH_INLINE_NS
{
inline
namespace
MIGRAPH
X
_INLINE_NS
{
namespace
gpu
{
shape
hip_tan
::
compute_shape
(
const
std
::
vector
<
shape
>&
inputs
)
const
...
...
@@ -22,5 +22,5 @@ argument hip_tan::compute(context& ctx, const shape&, const std::vector<argument
}
}
// namespace gpu
}
// namespace MIGRAPH_INLINE_NS
}
// namespace MIGRAPH
X
_INLINE_NS
}
// namespace migraphx
src/targets/gpu/tanh.cpp
View file @
bb390b65
...
...
@@ -5,7 +5,7 @@
#include <utility>
namespace
migraphx
{
inline
namespace
MIGRAPH_INLINE_NS
{
inline
namespace
MIGRAPH
X
_INLINE_NS
{
namespace
gpu
{
shape
miopen_tanh
::
compute_shape
(
const
std
::
vector
<
shape
>&
inputs
)
const
...
...
@@ -34,5 +34,5 @@ argument miopen_tanh::compute(context& ctx,
}
}
// namespace gpu
}
// namespace MIGRAPH_INLINE_NS
}
// namespace MIGRAPH
X
_INLINE_NS
}
// namespace migraphx
src/targets/gpu/target.cpp
View file @
bb390b65
...
...
@@ -19,7 +19,7 @@
#include <migraphx/gpu/concat_gpu_opt.hpp>
namespace
migraphx
{
inline
namespace
MIGRAPH_INLINE_NS
{
inline
namespace
MIGRAPH
X
_INLINE_NS
{
namespace
gpu
{
std
::
vector
<
pass
>
target
::
get_passes
(
migraphx
::
context
&
gctx
)
const
...
...
@@ -61,5 +61,5 @@ std::string target::name() const { return "miopen"; }
migraphx
::
context
target
::
get_context
()
const
{
return
context
{};
}
}
// namespace gpu
}
// namespace MIGRAPH_INLINE_NS
}
// namespace MIGRAPH
X
_INLINE_NS
}
// namespace migraphx
src/targets/gpu/write_literals.cpp
View file @
bb390b65
...
...
@@ -5,10 +5,10 @@
#include <migraphx/env.hpp>
namespace
migraphx
{
inline
namespace
MIGRAPH_INLINE_NS
{
inline
namespace
MIGRAPH
X
_INLINE_NS
{
namespace
gpu
{
MIGRAPH_DECLARE_ENV_VAR
(
MIGRAPH_COPY_LITERALS
)
MIGRAPH
X
_DECLARE_ENV_VAR
(
MIGRAPH
X
_COPY_LITERALS
)
struct
hip_load_literal
{
...
...
@@ -33,7 +33,7 @@ void write_literals::apply(program& p) const
{
if
(
ins
->
name
()
==
"@literal"
)
{
if
(
enabled
(
MIGRAPH_COPY_LITERALS
{}))
if
(
enabled
(
MIGRAPH
X
_COPY_LITERALS
{}))
{
literal
l
=
ins
->
get_literal
();
auto
pre
=
p
.
add_literal
(
l
);
...
...
@@ -53,5 +53,5 @@ void write_literals::apply(program& p) const
}
}
// namespace gpu
}
// namespace MIGRAPH_INLINE_NS
}
// namespace MIGRAPH
X
_INLINE_NS
}
// namespace migraphx
test/CMakeLists.txt
View file @
bb390b65
...
...
@@ -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
(
tests
)
find_program
(
MIGRAPH_GDB gdb
)
find_program
(
MIGRAPH
X
_GDB gdb
)
if
(
MIGRAPH_GDB
)
set
(
MIGRAPH_TEST_GDB On CACHE BOOL
""
)
if
(
MIGRAPH
X
_GDB
)
set
(
MIGRAPH
X
_TEST_GDB On CACHE BOOL
""
)
else
()
set
(
MIGRAPH_TEST_GDB Off CACHE BOOL
""
)
set
(
MIGRAPH
X
_TEST_GDB Off CACHE BOOL
""
)
endif
()
set
(
SKIP_TESTS
)
...
...
@@ -34,8 +34,8 @@ function(add_test_command NAME EXE)
%1
${
ARGN
}
"
)
add_test
(
NAME
${
NAME
}
COMMAND
${
WINE_CMD
}
cmd /c
"
${
CMAKE_CURRENT_BINARY_DIR
}
/test_
${
NAME
}
.cmd"
$<TARGET_FILE:
${
EXE
}
>
)
else
()
if
(
MIGRAPH_TEST_GDB
)
# add_test(NAME ${NAME} COMMAND ${MIGRAPH_GDB}
if
(
MIGRAPH
X
_TEST_GDB
)
# add_test(NAME ${NAME} COMMAND ${MIGRAPH
X
_GDB}
# --batch
# --return-child-result
# -ex "set disable-randomization off"
...
...
@@ -54,7 +54,7 @@ function(add_test_command NAME EXE)
if(EXISTS
${
TEST_DIR
}
/core)
set(
\$
ENV{UBSAN_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()
message(FATAL_ERROR
\"
Test failed
\"
)
endif()
...
...
@@ -95,7 +95,7 @@ foreach(TEST ${TESTS})
rocm_clang_tidy_check
(
test_
${
BASE_NAME
}
)
endforeach
()
if
(
MIGRAPH_ENABLE_GPU
)
if
(
MIGRAPH
X
_ENABLE_GPU
)
# gpu tests
file
(
GLOB GPU_TESTS gpu/*.cpp
)
...
...
@@ -142,7 +142,7 @@ function(test_headers PREFIX)
string
(
MAKE_C_IDENTIFIER
${
HEADER_REL
}
TEST_NAME
)
get_filename_component
(
BASE_NAME
${
HEADER
}
NAME_WE
)
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
)
endif
()
endforeach
()
...
...
@@ -150,6 +150,6 @@ endfunction()
test_headers
(
migraphx
${
CMAKE_SOURCE_DIR
}
/src/include/migraphx/*.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
)
endif
()
test/eliminate_allocation_test.cpp
View file @
bb390b65
...
...
@@ -103,6 +103,6 @@ TEST_CASE(float_aligned)
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/include/basic_ops.hpp
View file @
bb390b65
...
...
@@ -10,13 +10,13 @@ struct sum_op
{
migraphx
::
argument
result
;
if
(
args
.
size
()
!=
2
)
MIGRAPH_THROW
(
"Wrong args"
);
MIGRAPH
X
_THROW
(
"Wrong args"
);
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
)
MIGRAPH_THROW
(
"Wrong args"
);
MIGRAPH
X
_THROW
(
"Wrong args"
);
if
(
args
[
0
].
get_shape
().
lens
().
front
()
!=
1
)
MIGRAPH_THROW
(
"Wrong args"
);
MIGRAPH
X
_THROW
(
"Wrong args"
);
args
[
0
].
visit_at
([
&
](
auto
x
)
{
args
[
1
].
visit_at
([
&
](
auto
y
)
{
result
=
migraphx
::
literal
{
x
+
y
}.
get_argument
();
});
...
...
@@ -27,7 +27,7 @@ struct sum_op
migraphx
::
shape
compute_shape
(
std
::
vector
<
migraphx
::
shape
>
inputs
)
const
{
if
(
inputs
.
size
()
!=
2
)
MIGRAPH_THROW
(
"Wrong inputs"
);
MIGRAPH
X
_THROW
(
"Wrong inputs"
);
return
inputs
.
front
();
}
};
...
...
@@ -40,13 +40,13 @@ struct minus_op
{
migraphx
::
argument
result
;
if
(
args
.
size
()
!=
2
)
MIGRAPH_THROW
(
"Wrong args"
);
MIGRAPH
X
_THROW
(
"Wrong args"
);
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
)
MIGRAPH_THROW
(
"Wrong args"
);
MIGRAPH
X
_THROW
(
"Wrong args"
);
if
(
args
[
0
].
get_shape
().
lens
().
front
()
!=
1
)
MIGRAPH_THROW
(
"Wrong args"
);
MIGRAPH
X
_THROW
(
"Wrong args"
);
args
[
0
].
visit_at
([
&
](
auto
x
)
{
args
[
1
].
visit_at
([
&
](
auto
y
)
{
result
=
migraphx
::
literal
{
x
-
y
}.
get_argument
();
});
...
...
@@ -57,7 +57,7 @@ struct minus_op
migraphx
::
shape
compute_shape
(
std
::
vector
<
migraphx
::
shape
>
inputs
)
const
{
if
(
inputs
.
size
()
!=
2
)
MIGRAPH_THROW
(
"Wrong inputs"
);
MIGRAPH
X
_THROW
(
"Wrong inputs"
);
return
inputs
.
front
();
}
};
...
...
test/include/rob.hpp
View file @
bb390b65
#ifndef MIGRAPH_GUARD_ROB_HPP
#define MIGRAPH_GUARD_ROB_HPP
#ifndef MIGRAPH
X
_GUARD_ROB_HPP
#define MIGRAPH
X
_GUARD_ROB_HPP
#ifdef __clang__
#pragma clang diagnostic push
...
...
@@ -30,7 +30,7 @@ struct mem_data_ptr
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> \
{ \
}; \
...
...
test/include/test.hpp
View file @
bb390b65
...
...
@@ -7,8 +7,8 @@
#include <unordered_map>
#include <vector>
#ifndef MIGRAPH_GUARD_TEST_TEST_HPP
#define MIGRAPH_GUARD_TEST_TEST_HPP
#ifndef MIGRAPH
X
_GUARD_TEST_TEST_HPP
#define MIGRAPH
X
_GUARD_TEST_TEST_HPP
namespace
test
{
// NOLINTNEXTLINE
...
...
test/operation.cpp
View file @
bb390b65
...
...
@@ -15,13 +15,13 @@ struct simple_operation
std
::
string
name
()
const
{
return
"simple"
;
}
migraphx
::
shape
compute_shape
(
const
std
::
vector
<
migraphx
::
shape
>&
)
const
{
MIGRAPH_THROW
(
"not computable"
);
MIGRAPH
X
_THROW
(
"not computable"
);
}
migraphx
::
argument
compute
(
migraphx
::
context
&
,
const
migraphx
::
shape
&
,
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
)
{
...
...
@@ -35,13 +35,13 @@ struct simple_operation_no_print
std
::
string
name
()
const
{
return
"simple"
;
}
migraphx
::
shape
compute_shape
(
const
std
::
vector
<
migraphx
::
shape
>&
)
const
{
MIGRAPH_THROW
(
"not computable"
);
MIGRAPH
X
_THROW
(
"not computable"
);
}
migraphx
::
argument
compute
(
migraphx
::
context
&
,
const
migraphx
::
shape
&
,
const
std
::
vector
<
migraphx
::
argument
>&
)
const
{
MIGRAPH_THROW
(
"not computable"
);
MIGRAPH
X
_THROW
(
"not computable"
);
}
};
...
...
test/validate.cpp
View file @
bb390b65
...
...
@@ -39,10 +39,10 @@ TEST_CASE(incomplete_args)
EXPECT
(
bool
{
p
.
validate
()
==
ins
});
}
MIGRAPH_ROB
(
access_ins_arguments
,
std
::
vector
<
migraphx
::
instruction_ref
>
,
migraphx
::
instruction
,
arguments
)
MIGRAPH
X
_ROB
(
access_ins_arguments
,
std
::
vector
<
migraphx
::
instruction_ref
>
,
migraphx
::
instruction
,
arguments
)
TEST_CASE
(
invalid_args
)
{
...
...
Prev
1
…
6
7
8
9
10
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