Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
gaoqiong
MIGraphX
Commits
b5b03239
Commit
b5b03239
authored
Mar 19, 2019
by
Khalique
Browse files
Merge branch 'develop' of
https://github.com/ROCmSoftwarePlatform/AMDMIGraphX
into rm_identity
parents
de001f3e
8b6a5cda
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
62 additions
and
57 deletions
+62
-57
CMakeLists.txt
CMakeLists.txt
+3
-1
Jenkinsfile
Jenkinsfile
+15
-13
src/include/migraphx/onnx.hpp
src/include/migraphx/onnx.hpp
+0
-18
src/include/migraphx/operators.hpp
src/include/migraphx/operators.hpp
+19
-0
src/include/migraphx/tf.hpp
src/include/migraphx/tf.hpp
+1
-19
src/onnx/onnx.cpp
src/onnx/onnx.cpp
+1
-1
src/py/CMakeLists.txt
src/py/CMakeLists.txt
+6
-1
src/py/migraphx_py.cpp
src/py/migraphx_py.cpp
+14
-1
src/tf/tf.cpp
src/tf/tf.cpp
+1
-1
test/onnx/onnx_test.cpp
test/onnx/onnx_test.cpp
+2
-2
No files found.
CMakeLists.txt
View file @
b5b03239
...
@@ -22,7 +22,7 @@ find_package(ROCM REQUIRED)
...
@@ -22,7 +22,7 @@ find_package(ROCM REQUIRED)
include
(
ROCMSetupVersion
)
include
(
ROCMSetupVersion
)
rocm_setup_version
(
VERSION 0.
1
)
rocm_setup_version
(
VERSION 0.
2
)
option
(
BUILD_SHARED_LIBS
"Build as a shared library"
ON
)
option
(
BUILD_SHARED_LIBS
"Build as a shared library"
ON
)
...
@@ -39,6 +39,8 @@ else()
...
@@ -39,6 +39,8 @@ else()
set
(
MIGRAPHX_ENABLE_GPU Off CACHE BOOL
""
)
set
(
MIGRAPHX_ENABLE_GPU Off CACHE BOOL
""
)
endif
()
endif
()
set
(
MIGRAPHX_ENABLE_TF Off CACHE BOOL
""
)
add_compile_options
(
-std=c++14
)
add_compile_options
(
-std=c++14
)
list
(
APPEND CMAKE_MODULE_PATH
${
CMAKE_CURRENT_SOURCE_DIR
}
/cmake
)
list
(
APPEND CMAKE_MODULE_PATH
${
CMAKE_CURRENT_SOURCE_DIR
}
/cmake
)
...
...
Jenkinsfile
View file @
b5b03239
...
@@ -3,6 +3,7 @@ def rocmtestnode(variant, name, body) {
...
@@ -3,6 +3,7 @@ def rocmtestnode(variant, name, body) {
def
image
=
'migraphxlib'
def
image
=
'migraphxlib'
def
cmake_build
=
{
compiler
,
flags
->
def
cmake_build
=
{
compiler
,
flags
->
def
cmd
=
"""
def
cmd
=
"""
env
ulimit -c unlimited
ulimit -c unlimited
rm -rf build
rm -rf build
mkdir build
mkdir build
...
@@ -20,21 +21,22 @@ def rocmtestnode(variant, name, body) {
...
@@ -20,21 +21,22 @@ def rocmtestnode(variant, name, body) {
}
}
}
}
node
(
name
)
{
node
(
name
)
{
stage
(
"checkout ${variant}"
)
{
withEnv
([
'HSA_ENABLE_SDMA=0'
,
'MIOPEN_DEBUG_GCN_ASM_KERNELS=0'
]
)
{
env
.
HSA_ENABLE_SDMA
=
0
stage
(
"checkout ${variant}"
)
{
checkout
scm
checkout
scm
}
}
stage
(
"image ${variant}"
)
{
stage
(
"image ${variant}"
)
{
try
{
try
{
docker
.
build
(
"${image}"
,
'.'
)
docker
.
build
(
"${image}"
,
'.'
)
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
docker
.
build
(
"${image}"
,
'--no-cache .'
)
docker
.
build
(
"${image}"
,
'--no-cache .'
)
}
}
}
}
withDockerContainer
(
image:
image
,
args:
'--device=/dev/kfd --device=/dev/dri --group-add video --cap-add SYS_PTRACE'
)
{
withDockerContainer
(
image:
image
,
args:
'--device=/dev/kfd --device=/dev/dri --group-add video --cap-add SYS_PTRACE
'
)
{
timeout
(
time:
1
,
unit:
'HOURS
'
)
{
timeout
(
time:
1
,
unit:
'HOURS'
)
{
body
(
cmake_build
)
body
(
cmake_build
)
}
}
}
}
}
}
}
...
...
src/include/migraphx/onnx.hpp
View file @
b5b03239
...
@@ -7,24 +7,6 @@
...
@@ -7,24 +7,6 @@
namespace
migraphx
{
namespace
migraphx
{
inline
namespace
MIGRAPHX_INLINE_NS
{
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
/// Create a program from an onnx file
program
parse_onnx
(
const
std
::
string
&
name
);
program
parse_onnx
(
const
std
::
string
&
name
);
...
...
src/include/migraphx/operators.hpp
View file @
b5b03239
...
@@ -1366,6 +1366,25 @@ struct undefined
...
@@ -1366,6 +1366,25 @@ struct undefined
argument
compute
(
const
shape
&
,
const
std
::
vector
<
argument
>&
)
const
{
return
{{},
nullptr
};
}
argument
compute
(
const
shape
&
,
const
std
::
vector
<
argument
>&
)
const
{
return
{{},
nullptr
};
}
};
};
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
;
}
};
}
// namespace op
}
// namespace op
}
// namespace MIGRAPHX_INLINE_NS
}
// namespace MIGRAPHX_INLINE_NS
}
// namespace migraphx
}
// namespace migraphx
...
...
src/include/migraphx/tf.hpp
View file @
b5b03239
...
@@ -7,25 +7,7 @@
...
@@ -7,25 +7,7 @@
namespace
migraphx
{
namespace
migraphx
{
inline
namespace
MIGRAPHX_INLINE_NS
{
inline
namespace
MIGRAPHX_INLINE_NS
{
struct
unknown
/// Create a program from a tf pb file (default is nhwc format)
{
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_tf
(
const
std
::
string
&
name
,
bool
is_nhwc
);
program
parse_tf
(
const
std
::
string
&
name
,
bool
is_nhwc
);
}
// namespace MIGRAPHX_INLINE_NS
}
// namespace MIGRAPHX_INLINE_NS
...
...
src/onnx/onnx.cpp
View file @
b5b03239
...
@@ -1206,7 +1206,7 @@ struct onnx_parser
...
@@ -1206,7 +1206,7 @@ struct onnx_parser
std
::
vector
<
instruction_ref
>
result
;
std
::
vector
<
instruction_ref
>
result
;
if
(
ops
.
count
(
node
.
op_type
())
==
0
)
if
(
ops
.
count
(
node
.
op_type
())
==
0
)
{
{
result
.
push_back
(
prog
.
add_instruction
(
unknown
{
node
.
op_type
()},
args
));
result
.
push_back
(
prog
.
add_instruction
(
op
::
unknown
{
node
.
op_type
()},
args
));
}
}
else
else
{
{
...
...
src/py/CMakeLists.txt
View file @
b5b03239
...
@@ -12,7 +12,12 @@ if(MIGRAPHX_ENABLE_PYTHON)
...
@@ -12,7 +12,12 @@ if(MIGRAPHX_ENABLE_PYTHON)
C_VISIBILITY_PRESET hidden
C_VISIBILITY_PRESET hidden
CXX_VISIBILITY_PRESET hidden
CXX_VISIBILITY_PRESET hidden
)
)
target_link_libraries
(
migraphx_py PRIVATE migraphx migraphx_onnx migraphx_cpu
)
if
(
MIGRAPHX_ENABLE_TF
)
target_link_libraries
(
migraphx_py PRIVATE migraphx migraphx_tf migraphx_cpu
)
target_compile_definitions
(
migraphx_py PRIVATE -DENABLE_TF
)
else
()
target_link_libraries
(
migraphx_py PRIVATE migraphx migraphx_onnx migraphx_cpu
)
endif
()
if
(
MIGRAPHX_ENABLE_GPU
)
if
(
MIGRAPHX_ENABLE_GPU
)
target_link_libraries
(
migraphx_py PRIVATE migraphx_gpu
)
target_link_libraries
(
migraphx_py PRIVATE migraphx_gpu
)
target_compile_definitions
(
migraphx_py PRIVATE -DHAVE_GPU
)
target_compile_definitions
(
migraphx_py PRIVATE -DHAVE_GPU
)
...
...
src/py/migraphx_py.cpp
View file @
b5b03239
...
@@ -4,8 +4,13 @@
...
@@ -4,8 +4,13 @@
#include <migraphx/program.hpp>
#include <migraphx/program.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/cpu/target.hpp>
#include <migraphx/cpu/target.hpp>
#include <migraphx/onnx.hpp>
#include <migraphx/stringutils.hpp>
#include <migraphx/stringutils.hpp>
#ifdef ENABLE_TF
#include <migraphx/tf.hpp>
#else
#include <migraphx/onnx.hpp>
#endif
#ifdef HAVE_GPU
#ifdef HAVE_GPU
#include <migraphx/gpu/target.hpp>
#include <migraphx/gpu/target.hpp>
#include <migraphx/gpu/hip.hpp>
#include <migraphx/gpu/hip.hpp>
...
@@ -155,8 +160,16 @@ PYBIND11_MODULE(migraphx, m)
...
@@ -155,8 +160,16 @@ PYBIND11_MODULE(migraphx, m)
.
def
(
"__ne__"
,
std
::
not_equal_to
<
migraphx
::
program
>
{})
.
def
(
"__ne__"
,
std
::
not_equal_to
<
migraphx
::
program
>
{})
.
def
(
"__repr__"
,
[](
const
migraphx
::
program
&
p
)
{
return
migraphx
::
to_string
(
p
);
});
.
def
(
"__repr__"
,
[](
const
migraphx
::
program
&
p
)
{
return
migraphx
::
to_string
(
p
);
});
#ifdef ENABLE_TF
m
.
def
(
"parse_tf"
,
&
migraphx
::
parse_tf
,
"Parse tf protobuf (default format is nhwc)"
,
py
::
arg
(
"filename"
),
py
::
arg
(
"is_nhwc"
)
=
true
);
#else
m
.
def
(
"parse_onnx"
,
&
migraphx
::
parse_onnx
);
m
.
def
(
"parse_onnx"
,
&
migraphx
::
parse_onnx
);
#endif
m
.
def
(
"get_target"
,
[](
const
std
::
string
&
name
)
->
migraphx
::
target
{
m
.
def
(
"get_target"
,
[](
const
std
::
string
&
name
)
->
migraphx
::
target
{
if
(
name
==
"cpu"
)
if
(
name
==
"cpu"
)
return
migraphx
::
cpu
::
target
{};
return
migraphx
::
cpu
::
target
{};
...
...
src/tf/tf.cpp
View file @
b5b03239
...
@@ -525,7 +525,7 @@ struct tf_parser
...
@@ -525,7 +525,7 @@ struct tf_parser
}
}
if
(
ops
.
count
(
node
.
op
())
==
0
)
if
(
ops
.
count
(
node
.
op
())
==
0
)
{
{
instructions
[
name
]
=
prog
.
add_instruction
(
unknown
{
node
.
op
()},
args
);
instructions
[
name
]
=
prog
.
add_instruction
(
op
::
unknown
{
node
.
op
()},
args
);
}
}
else
else
{
{
...
...
test/onnx/onnx_test.cpp
View file @
b5b03239
...
@@ -392,8 +392,8 @@ TEST_CASE(unknown_test)
...
@@ -392,8 +392,8 @@ TEST_CASE(unknown_test)
migraphx
::
program
p
;
migraphx
::
program
p
;
auto
l0
=
p
.
add_parameter
(
"0"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
2
,
3
,
4
,
5
}});
auto
l0
=
p
.
add_parameter
(
"0"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
2
,
3
,
4
,
5
}});
auto
l1
=
p
.
add_parameter
(
"1"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
3
,
4
}});
auto
l1
=
p
.
add_parameter
(
"1"
,
migraphx
::
shape
{
migraphx
::
shape
::
float_type
,
{
3
,
4
}});
auto
l2
=
p
.
add_instruction
(
migraphx
::
unknown
{
"Unknown"
},
l0
,
l1
);
auto
l2
=
p
.
add_instruction
(
migraphx
::
op
::
unknown
{
"Unknown"
},
l0
,
l1
);
p
.
add_instruction
(
migraphx
::
unknown
{
"Unknown"
},
l2
);
p
.
add_instruction
(
migraphx
::
op
::
unknown
{
"Unknown"
},
l2
);
auto
prog
=
migraphx
::
parse_onnx
(
"unknown_test.onnx"
);
auto
prog
=
migraphx
::
parse_onnx
(
"unknown_test.onnx"
);
EXPECT
(
p
==
prog
);
EXPECT
(
p
==
prog
);
...
...
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