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
da011b99
Commit
da011b99
authored
May 29, 2018
by
Paul
Browse files
Add initial miopen code
parent
f0d27006
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
86 additions
and
0 deletions
+86
-0
src/CMakeLists.txt
src/CMakeLists.txt
+1
-0
src/targets/miopen/CMakeLists.txt
src/targets/miopen/CMakeLists.txt
+14
-0
src/targets/miopen/include/rtg/miopen/miopen_target.hpp
src/targets/miopen/include/rtg/miopen/miopen_target.hpp
+18
-0
src/targets/miopen/miopen_target.cpp
src/targets/miopen/miopen_target.cpp
+53
-0
No files found.
src/CMakeLists.txt
View file @
da011b99
...
...
@@ -8,3 +8,4 @@ target_include_directories(rtg PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_D
add_subdirectory
(
onnx
)
add_subdirectory
(
targets/cpu
)
add_subdirectory
(
targets/miopen
)
src/targets/miopen/CMakeLists.txt
0 → 100644
View file @
da011b99
list
(
APPEND CMAKE_PREFIX_PATH /opt/rocm /opt/rocm/hip /opt/rocm/hcc
)
find_package
(
miopen
)
if
(
NOT TARGET MIOpen
)
message
(
SEND_ERROR
"Cant find miopen"
)
endif
()
add_library
(
rtg_miopen
miopen_target.cpp
)
rocm_clang_tidy_check
(
rtg_miopen
)
target_link_libraries
(
rtg_miopen rtg MIOpen
)
target_include_directories
(
rtg_miopen PUBLIC $<BUILD_INTERFACE:
${
CMAKE_CURRENT_SOURCE_DIR
}
/include>
)
src/targets/miopen/include/rtg/miopen/miopen_target.hpp
0 → 100644
View file @
da011b99
#ifndef RTG_GUARD_RTGLIB_MIOPEN_TARGET_HPP
#define RTG_GUARD_RTGLIB_MIOPEN_TARGET_HPP
#include <rtg/program.hpp>
namespace
rtg
{
namespace
miopen
{
struct
miopen_target
{
std
::
string
name
()
const
;
void
apply
(
program
&
p
)
const
;
};
}
// namespace miopen
}
// namespace rtg
#endif
src/targets/miopen/miopen_target.cpp
0 → 100644
View file @
da011b99
#include <rtg/miopen/miopen_target.hpp>
#include <rtg/manage_ptr.hpp>
#include <miopen/miopen.h>
namespace
rtg
{
namespace
miopen
{
using
miopen_handle
=
RTG_MANAGE_PTR
(
miopenHandle_t
,
miopenDestroy
);
using
tensor_descriptor
=
RTG_MANAGE_PTR
(
miopenTensorDescriptor_t
,
miopenDestroyTensorDescriptor
);
using
convolution_descriptor
=
RTG_MANAGE_PTR
(
miopenConvolutionDescriptor_t
,
miopenDestroyConvolutionDescriptor
);
using
activation_descriptor
=
RTG_MANAGE_PTR
(
miopenActivationDescriptor_t
,
miopenDestroyActivationDescriptor
);
struct
miopen_apply
{
program
*
prog
;
void
apply
()
{
for
(
auto
it
=
prog
->
begin
();
it
!=
prog
->
end
();
it
++
)
{
if
(
it
->
op
.
name
()
==
"convolution"
)
{
apply_convolution
(
it
);
}
else
if
(
it
->
op
.
name
()
==
"activation"
)
{
apply_activation
(
it
);
}
}
}
void
apply_convolution
(
instruction_ref
ins
)
{
// auto&& op = any_cast<convolution>(ins->op);
// prog->replace_instruction(ins, miopen_convolution{op}, ins->arguments);
}
void
apply_activation
(
instruction_ref
ins
)
{
}
};
std
::
string
miopen_target
::
name
()
const
{
return
"miopen"
;
}
void
miopen_target
::
apply
(
program
&
p
)
const
{
miopen_apply
{
&
p
}.
apply
();
}
}
// namespace miopen
}
// namespace rtg
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