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
ee80cee9
Unverified
Commit
ee80cee9
authored
Nov 07, 2018
by
Paul Fultz II
Committed by
GitHub
Nov 07, 2018
Browse files
Merge branch 'master' into gpu_slice_test
parents
6d06226d
f958d56f
Changes
159
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
73 additions
and
26 deletions
+73
-26
src/targets/gpu/include/migraph/gpu/device/contiguous.hpp
src/targets/gpu/include/migraph/gpu/device/contiguous.hpp
+3
-0
src/targets/gpu/include/migraph/gpu/device/mul.hpp
src/targets/gpu/include/migraph/gpu/device/mul.hpp
+3
-0
src/targets/gpu/include/migraph/gpu/eliminate_workspace.hpp
src/targets/gpu/include/migraph/gpu/eliminate_workspace.hpp
+3
-0
src/targets/gpu/include/migraph/gpu/fuse_ops.hpp
src/targets/gpu/include/migraph/gpu/fuse_ops.hpp
+3
-1
src/targets/gpu/include/migraph/gpu/gemm.hpp
src/targets/gpu/include/migraph/gpu/gemm.hpp
+4
-1
src/targets/gpu/include/migraph/gpu/hip.hpp
src/targets/gpu/include/migraph/gpu/hip.hpp
+6
-0
src/targets/gpu/include/migraph/gpu/leaky_relu.hpp
src/targets/gpu/include/migraph/gpu/leaky_relu.hpp
+4
-1
src/targets/gpu/include/migraph/gpu/lowering.hpp
src/targets/gpu/include/migraph/gpu/lowering.hpp
+3
-1
src/targets/gpu/include/migraph/gpu/miopen.hpp
src/targets/gpu/include/migraph/gpu/miopen.hpp
+3
-1
src/targets/gpu/include/migraph/gpu/mul.hpp
src/targets/gpu/include/migraph/gpu/mul.hpp
+4
-1
src/targets/gpu/include/migraph/gpu/pooling.hpp
src/targets/gpu/include/migraph/gpu/pooling.hpp
+4
-1
src/targets/gpu/include/migraph/gpu/relu.hpp
src/targets/gpu/include/migraph/gpu/relu.hpp
+4
-1
src/targets/gpu/include/migraph/gpu/rocblas.hpp
src/targets/gpu/include/migraph/gpu/rocblas.hpp
+3
-1
src/targets/gpu/include/migraph/gpu/softmax.hpp
src/targets/gpu/include/migraph/gpu/softmax.hpp
+4
-1
src/targets/gpu/include/migraph/gpu/target.hpp
src/targets/gpu/include/migraph/gpu/target.hpp
+4
-0
src/targets/gpu/include/migraph/gpu/write_literals.hpp
src/targets/gpu/include/migraph/gpu/write_literals.hpp
+2
-1
src/targets/gpu/leaky_relu.cpp
src/targets/gpu/leaky_relu.cpp
+2
-1
src/targets/gpu/lowering.cpp
src/targets/gpu/lowering.cpp
+10
-12
src/targets/gpu/mul.cpp
src/targets/gpu/mul.cpp
+2
-1
src/targets/gpu/pooling.cpp
src/targets/gpu/pooling.cpp
+2
-1
No files found.
src/targets/gpu/include/migraph/gpu/device/contiguous.hpp
View file @
ee80cee9
...
@@ -2,9 +2,11 @@
...
@@ -2,9 +2,11 @@
#define MIGRAPH_GUARD_MIGRAPHLIB_KERNELS_HPP
#define MIGRAPH_GUARD_MIGRAPHLIB_KERNELS_HPP
#include <migraph/argument.hpp>
#include <migraph/argument.hpp>
#include <migraph/config.hpp>
#include <hip/hip_runtime_api.h>
#include <hip/hip_runtime_api.h>
namespace
migraph
{
namespace
migraph
{
inline
namespace
MIGRAPH_INLINE_NS
{
namespace
gpu
{
namespace
gpu
{
namespace
device
{
namespace
device
{
...
@@ -12,6 +14,7 @@ void contiguous(hipStream_t stream, argument result, argument arg);
...
@@ -12,6 +14,7 @@ void contiguous(hipStream_t stream, argument result, argument arg);
}
// namespace device
}
// namespace device
}
// namespace gpu
}
// namespace gpu
}
// namespace MIGRAPH_INLINE_NS
}
// namespace migraph
}
// namespace migraph
#endif
#endif
src/targets/gpu/include/migraph/gpu/device/mul.hpp
View file @
ee80cee9
...
@@ -3,9 +3,11 @@
...
@@ -3,9 +3,11 @@
#define MIGRAPH_GUARD_RTGLIB_DEVICE_MUL_HPP
#define MIGRAPH_GUARD_RTGLIB_DEVICE_MUL_HPP
#include <migraph/argument.hpp>
#include <migraph/argument.hpp>
#include <migraph/config.hpp>
#include <hip/hip_runtime_api.h>
#include <hip/hip_runtime_api.h>
namespace
migraph
{
namespace
migraph
{
inline
namespace
MIGRAPH_INLINE_NS
{
namespace
gpu
{
namespace
gpu
{
namespace
device
{
namespace
device
{
...
@@ -19,6 +21,7 @@ void mul(hipStream_t stream,
...
@@ -19,6 +21,7 @@ void mul(hipStream_t stream,
}
// namespace device
}
// namespace device
}
// namespace gpu
}
// namespace gpu
}
// namespace MIGRAPH_INLINE_NS
}
// namespace migraph
}
// namespace migraph
#endif
#endif
src/targets/gpu/include/migraph/gpu/eliminate_workspace.hpp
View file @
ee80cee9
...
@@ -3,8 +3,10 @@
...
@@ -3,8 +3,10 @@
#include <string>
#include <string>
#include <migraph/instruction_ref.hpp>
#include <migraph/instruction_ref.hpp>
#include <migraph/config.hpp>
namespace
migraph
{
namespace
migraph
{
inline
namespace
MIGRAPH_INLINE_NS
{
struct
program
;
struct
program
;
namespace
gpu
{
namespace
gpu
{
...
@@ -15,6 +17,7 @@ struct eliminate_workspace
...
@@ -15,6 +17,7 @@ struct eliminate_workspace
void
apply
(
program
&
p
)
const
;
void
apply
(
program
&
p
)
const
;
};
};
}
// namespace gpu
}
// namespace gpu
}
// namespace MIGRAPH_INLINE_NS
}
// namespace migraph
}
// namespace migraph
#endif
#endif
src/targets/gpu/include/migraph/gpu/fuse_ops.hpp
View file @
ee80cee9
...
@@ -2,9 +2,11 @@
...
@@ -2,9 +2,11 @@
#define MIGRAPH_GUARD_RTGLIB_FUSE_OPS_HPP
#define MIGRAPH_GUARD_RTGLIB_FUSE_OPS_HPP
#include <migraph/program.hpp>
#include <migraph/program.hpp>
#include <migraph/config.hpp>
#include <migraph/gpu/context.hpp>
#include <migraph/gpu/context.hpp>
namespace
migraph
{
namespace
migraph
{
inline
namespace
MIGRAPH_INLINE_NS
{
namespace
gpu
{
namespace
gpu
{
...
@@ -16,7 +18,7 @@ struct fuse_ops
...
@@ -16,7 +18,7 @@ struct fuse_ops
};
};
}
// namespace gpu
}
// namespace gpu
}
// namespace MIGRAPH_INLINE_NS
}
// namespace migraph
}
// namespace migraph
#endif
#endif
src/targets/gpu/include/migraph/gpu/gemm.hpp
View file @
ee80cee9
...
@@ -10,6 +10,7 @@
...
@@ -10,6 +10,7 @@
#include <migraph/gpu/miopen.hpp>
#include <migraph/gpu/miopen.hpp>
#include <migraph/gpu/hip.hpp>
#include <migraph/gpu/hip.hpp>
#include <migraph/dfor.hpp>
#include <migraph/dfor.hpp>
#include <migraph/config.hpp>
#include <migraph/gpu/device/contiguous.hpp>
#include <migraph/gpu/device/contiguous.hpp>
#include <migraph/gpu/device/add.hpp>
#include <migraph/gpu/device/add.hpp>
#include <migraph/iterator_for.hpp>
#include <migraph/iterator_for.hpp>
...
@@ -18,6 +19,7 @@
...
@@ -18,6 +19,7 @@
#include <utility>
#include <utility>
namespace
migraph
{
namespace
migraph
{
inline
namespace
MIGRAPH_INLINE_NS
{
namespace
gpu
{
namespace
gpu
{
struct
miopen_gemm
struct
miopen_gemm
...
@@ -27,10 +29,11 @@ struct miopen_gemm
...
@@ -27,10 +29,11 @@ struct miopen_gemm
shape
compute_shape
(
const
std
::
vector
<
shape
>&
inputs
)
const
;
shape
compute_shape
(
const
std
::
vector
<
shape
>&
inputs
)
const
;
argument
argument
compute
(
context
&
ctx
,
const
shape
&
output_shape
,
const
std
::
vector
<
argument
>&
args
)
const
;
compute
(
context
&
ctx
,
const
shape
&
output_shape
,
const
std
::
vector
<
argument
>&
args
)
const
;
int
output_alias
(
const
std
::
vector
<
shape
>&
shapes
)
const
{
return
shapes
.
size
()
-
1
;
}
};
};
}
// namespace gpu
}
// namespace gpu
}
// namespace MIGRAPH_INLINE_NS
}
// namespace migraph
}
// namespace migraph
#endif
#endif
src/targets/gpu/include/migraph/gpu/hip.hpp
View file @
ee80cee9
...
@@ -2,9 +2,11 @@
...
@@ -2,9 +2,11 @@
#define MIGRAPH_GUARD_MIGRAPHLIB_HIP_HPP
#define MIGRAPH_GUARD_MIGRAPHLIB_HIP_HPP
#include <migraph/operators.hpp>
#include <migraph/operators.hpp>
#include <migraph/config.hpp>
#include <utility>
#include <utility>
namespace
migraph
{
namespace
migraph
{
inline
namespace
MIGRAPH_INLINE_NS
{
namespace
gpu
{
namespace
gpu
{
migraph
::
argument
allocate_gpu
(
const
migraph
::
shape
&
s
,
bool
host
=
false
);
migraph
::
argument
allocate_gpu
(
const
migraph
::
shape
&
s
,
bool
host
=
false
);
...
@@ -67,6 +69,7 @@ struct hip_write
...
@@ -67,6 +69,7 @@ struct hip_write
{
{
return
to_gpu
(
args
.
front
());
return
to_gpu
(
args
.
front
());
}
}
int
output_alias
(
const
std
::
vector
<
shape
>&
)
const
{
return
0
;
}
};
};
struct
hip_copy
struct
hip_copy
...
@@ -82,8 +85,11 @@ struct hip_copy
...
@@ -82,8 +85,11 @@ struct hip_copy
copy_to_gpu
(
args
[
0
],
args
[
1
]);
copy_to_gpu
(
args
[
0
],
args
[
1
]);
return
args
[
1
];
return
args
[
1
];
}
}
int
output_alias
(
const
std
::
vector
<
shape
>&
)
const
{
return
1
;
}
};
};
}
// namespace gpu
}
// namespace gpu
}
// namespace MIGRAPH_INLINE_NS
}
// namespace migraph
}
// namespace migraph
#endif
#endif
src/targets/gpu/include/migraph/gpu/leaky_relu.hpp
View file @
ee80cee9
...
@@ -7,6 +7,7 @@
...
@@ -7,6 +7,7 @@
#include <migraph/operators.hpp>
#include <migraph/operators.hpp>
#include <migraph/generate.hpp>
#include <migraph/generate.hpp>
#include <migraph/shape_for_each.hpp>
#include <migraph/shape_for_each.hpp>
#include <migraph/config.hpp>
#include <migraph/gpu/miopen.hpp>
#include <migraph/gpu/miopen.hpp>
#include <migraph/gpu/hip.hpp>
#include <migraph/gpu/hip.hpp>
#include <migraph/dfor.hpp>
#include <migraph/dfor.hpp>
...
@@ -18,6 +19,7 @@
...
@@ -18,6 +19,7 @@
#include <utility>
#include <utility>
namespace
migraph
{
namespace
migraph
{
inline
namespace
MIGRAPH_INLINE_NS
{
namespace
gpu
{
namespace
gpu
{
struct
miopen_leaky_relu
struct
miopen_leaky_relu
...
@@ -27,10 +29,11 @@ struct miopen_leaky_relu
...
@@ -27,10 +29,11 @@ struct miopen_leaky_relu
shape
compute_shape
(
const
std
::
vector
<
shape
>&
inputs
)
const
;
shape
compute_shape
(
const
std
::
vector
<
shape
>&
inputs
)
const
;
argument
argument
compute
(
context
&
ctx
,
const
shape
&
output_shape
,
const
std
::
vector
<
argument
>&
args
)
const
;
compute
(
context
&
ctx
,
const
shape
&
output_shape
,
const
std
::
vector
<
argument
>&
args
)
const
;
int
output_alias
(
const
std
::
vector
<
shape
>&
shapes
)
const
{
return
shapes
.
size
()
-
1
;
}
};
};
}
// namespace gpu
}
// namespace gpu
}
// namespace MIGRAPH_INLINE_NS
}
// namespace migraph
}
// namespace migraph
#endif
#endif
src/targets/gpu/include/migraph/gpu/lowering.hpp
View file @
ee80cee9
...
@@ -2,9 +2,11 @@
...
@@ -2,9 +2,11 @@
#define MIGRAPH_GUARD_RTGLIB_MIOPEN_LOWERING_HPP
#define MIGRAPH_GUARD_RTGLIB_MIOPEN_LOWERING_HPP
#include <migraph/program.hpp>
#include <migraph/program.hpp>
#include <migraph/config.hpp>
#include <migraph/gpu/context.hpp>
#include <migraph/gpu/context.hpp>
namespace
migraph
{
namespace
migraph
{
inline
namespace
MIGRAPH_INLINE_NS
{
namespace
gpu
{
namespace
gpu
{
struct
lowering
struct
lowering
...
@@ -15,7 +17,7 @@ struct lowering
...
@@ -15,7 +17,7 @@ struct lowering
};
};
}
// namespace gpu
}
// namespace gpu
}
// namespace MIGRAPH_INLINE_NS
}
// namespace migraph
}
// namespace migraph
#endif
#endif
src/targets/gpu/include/migraph/gpu/miopen.hpp
View file @
ee80cee9
...
@@ -4,8 +4,10 @@
...
@@ -4,8 +4,10 @@
#include <migraph/manage_ptr.hpp>
#include <migraph/manage_ptr.hpp>
#include <migraph/operators.hpp>
#include <migraph/operators.hpp>
#include <miopen/miopen.h>
#include <miopen/miopen.h>
#include <migraph/config.hpp>
namespace
migraph
{
namespace
migraph
{
inline
namespace
MIGRAPH_INLINE_NS
{
namespace
gpu
{
namespace
gpu
{
using
miopen_handle
=
MIGRAPH_MANAGE_PTR
(
miopenHandle_t
,
miopenDestroy
);
using
miopen_handle
=
MIGRAPH_MANAGE_PTR
(
miopenHandle_t
,
miopenDestroy
);
...
@@ -115,7 +117,7 @@ inline fused_operator_args make_fused_args()
...
@@ -115,7 +117,7 @@ inline fused_operator_args make_fused_args()
}
}
}
// namespace gpu
}
// namespace gpu
}
// namespace MIGRAPH_INLINE_NS
}
// namespace migraph
}
// namespace migraph
#endif
#endif
src/targets/gpu/include/migraph/gpu/mul.hpp
View file @
ee80cee9
...
@@ -7,6 +7,7 @@
...
@@ -7,6 +7,7 @@
#include <migraph/operators.hpp>
#include <migraph/operators.hpp>
#include <migraph/generate.hpp>
#include <migraph/generate.hpp>
#include <migraph/shape_for_each.hpp>
#include <migraph/shape_for_each.hpp>
#include <migraph/config.hpp>
#include <migraph/gpu/miopen.hpp>
#include <migraph/gpu/miopen.hpp>
#include <migraph/gpu/hip.hpp>
#include <migraph/gpu/hip.hpp>
#include <migraph/dfor.hpp>
#include <migraph/dfor.hpp>
...
@@ -18,6 +19,7 @@
...
@@ -18,6 +19,7 @@
#include <utility>
#include <utility>
namespace
migraph
{
namespace
migraph
{
inline
namespace
MIGRAPH_INLINE_NS
{
namespace
gpu
{
namespace
gpu
{
struct
hip_mul
struct
hip_mul
...
@@ -25,10 +27,11 @@ struct hip_mul
...
@@ -25,10 +27,11 @@ struct hip_mul
std
::
string
name
()
const
{
return
"gpu::mul"
;
}
std
::
string
name
()
const
{
return
"gpu::mul"
;
}
shape
compute_shape
(
const
std
::
vector
<
shape
>&
inputs
)
const
;
shape
compute_shape
(
const
std
::
vector
<
shape
>&
inputs
)
const
;
argument
compute
(
context
&
,
const
shape
&
,
const
std
::
vector
<
argument
>&
args
)
const
;
argument
compute
(
context
&
,
const
shape
&
,
const
std
::
vector
<
argument
>&
args
)
const
;
int
output_alias
(
const
std
::
vector
<
shape
>&
shapes
)
const
{
return
shapes
.
size
()
-
1
;
}
};
};
}
// namespace gpu
}
// namespace gpu
}
// namespace MIGRAPH_INLINE_NS
}
// namespace migraph
}
// namespace migraph
#endif
#endif
src/targets/gpu/include/migraph/gpu/pooling.hpp
View file @
ee80cee9
...
@@ -7,6 +7,7 @@
...
@@ -7,6 +7,7 @@
#include <migraph/operators.hpp>
#include <migraph/operators.hpp>
#include <migraph/generate.hpp>
#include <migraph/generate.hpp>
#include <migraph/shape_for_each.hpp>
#include <migraph/shape_for_each.hpp>
#include <migraph/config.hpp>
#include <migraph/gpu/miopen.hpp>
#include <migraph/gpu/miopen.hpp>
#include <migraph/gpu/hip.hpp>
#include <migraph/gpu/hip.hpp>
#include <migraph/dfor.hpp>
#include <migraph/dfor.hpp>
...
@@ -18,6 +19,7 @@
...
@@ -18,6 +19,7 @@
#include <utility>
#include <utility>
namespace
migraph
{
namespace
migraph
{
inline
namespace
MIGRAPH_INLINE_NS
{
namespace
gpu
{
namespace
gpu
{
struct
miopen_pooling
struct
miopen_pooling
...
@@ -29,10 +31,11 @@ struct miopen_pooling
...
@@ -29,10 +31,11 @@ struct miopen_pooling
shape
compute_shape
(
const
std
::
vector
<
shape
>&
inputs
)
const
;
shape
compute_shape
(
const
std
::
vector
<
shape
>&
inputs
)
const
;
argument
argument
compute
(
context
&
ctx
,
const
shape
&
output_shape
,
const
std
::
vector
<
argument
>&
args
)
const
;
compute
(
context
&
ctx
,
const
shape
&
output_shape
,
const
std
::
vector
<
argument
>&
args
)
const
;
int
output_alias
(
const
std
::
vector
<
shape
>&
shapes
)
const
{
return
shapes
.
size
()
-
1
;
}
};
};
}
// namespace gpu
}
// namespace gpu
}
// namespace MIGRAPH_INLINE_NS
}
// namespace migraph
}
// namespace migraph
#endif
#endif
src/targets/gpu/include/migraph/gpu/relu.hpp
View file @
ee80cee9
...
@@ -7,6 +7,7 @@
...
@@ -7,6 +7,7 @@
#include <migraph/operators.hpp>
#include <migraph/operators.hpp>
#include <migraph/generate.hpp>
#include <migraph/generate.hpp>
#include <migraph/shape_for_each.hpp>
#include <migraph/shape_for_each.hpp>
#include <migraph/config.hpp>
#include <migraph/gpu/miopen.hpp>
#include <migraph/gpu/miopen.hpp>
#include <migraph/gpu/hip.hpp>
#include <migraph/gpu/hip.hpp>
#include <migraph/dfor.hpp>
#include <migraph/dfor.hpp>
...
@@ -18,6 +19,7 @@
...
@@ -18,6 +19,7 @@
#include <utility>
#include <utility>
namespace
migraph
{
namespace
migraph
{
inline
namespace
MIGRAPH_INLINE_NS
{
namespace
gpu
{
namespace
gpu
{
struct
miopen_relu
struct
miopen_relu
...
@@ -27,10 +29,11 @@ struct miopen_relu
...
@@ -27,10 +29,11 @@ struct miopen_relu
shape
compute_shape
(
const
std
::
vector
<
shape
>&
inputs
)
const
;
shape
compute_shape
(
const
std
::
vector
<
shape
>&
inputs
)
const
;
argument
argument
compute
(
context
&
ctx
,
const
shape
&
output_shape
,
const
std
::
vector
<
argument
>&
args
)
const
;
compute
(
context
&
ctx
,
const
shape
&
output_shape
,
const
std
::
vector
<
argument
>&
args
)
const
;
int
output_alias
(
const
std
::
vector
<
shape
>&
shapes
)
const
{
return
shapes
.
size
()
-
1
;
}
};
};
}
// namespace gpu
}
// namespace gpu
}
// namespace MIGRAPH_INLINE_NS
}
// namespace migraph
}
// namespace migraph
#endif
#endif
src/targets/gpu/include/migraph/gpu/rocblas.hpp
View file @
ee80cee9
...
@@ -3,9 +3,11 @@
...
@@ -3,9 +3,11 @@
#include <migraph/manage_ptr.hpp>
#include <migraph/manage_ptr.hpp>
#include <migraph/operators.hpp>
#include <migraph/operators.hpp>
#include <migraph/config.hpp>
#include <rocblas.h>
#include <rocblas.h>
namespace
migraph
{
namespace
migraph
{
inline
namespace
MIGRAPH_INLINE_NS
{
namespace
gpu
{
namespace
gpu
{
using
rocblas_handle_ptr
=
MIGRAPH_MANAGE_PTR
(
rocblas_handle
,
rocblas_destroy_handle
);
using
rocblas_handle_ptr
=
MIGRAPH_MANAGE_PTR
(
rocblas_handle
,
rocblas_destroy_handle
);
...
@@ -14,7 +16,7 @@ rocblas_handle_ptr create_rocblas_handle_ptr();
...
@@ -14,7 +16,7 @@ rocblas_handle_ptr create_rocblas_handle_ptr();
rocblas_handle_ptr
create_rocblas_handle_ptr
(
hipStream_t
s
);
rocblas_handle_ptr
create_rocblas_handle_ptr
(
hipStream_t
s
);
}
// namespace gpu
}
// namespace gpu
}
// namespace MIGRAPH_INLINE_NS
}
// namespace migraph
}
// namespace migraph
#endif
#endif
src/targets/gpu/include/migraph/gpu/softmax.hpp
View file @
ee80cee9
...
@@ -7,6 +7,7 @@
...
@@ -7,6 +7,7 @@
#include <migraph/operators.hpp>
#include <migraph/operators.hpp>
#include <migraph/generate.hpp>
#include <migraph/generate.hpp>
#include <migraph/shape_for_each.hpp>
#include <migraph/shape_for_each.hpp>
#include <migraph/config.hpp>
#include <migraph/gpu/miopen.hpp>
#include <migraph/gpu/miopen.hpp>
#include <migraph/gpu/hip.hpp>
#include <migraph/gpu/hip.hpp>
#include <migraph/dfor.hpp>
#include <migraph/dfor.hpp>
...
@@ -18,6 +19,7 @@
...
@@ -18,6 +19,7 @@
#include <utility>
#include <utility>
namespace
migraph
{
namespace
migraph
{
inline
namespace
MIGRAPH_INLINE_NS
{
namespace
gpu
{
namespace
gpu
{
struct
miopen_softmax
struct
miopen_softmax
...
@@ -27,10 +29,11 @@ struct miopen_softmax
...
@@ -27,10 +29,11 @@ struct miopen_softmax
shape
compute_shape
(
const
std
::
vector
<
shape
>&
inputs
)
const
;
shape
compute_shape
(
const
std
::
vector
<
shape
>&
inputs
)
const
;
argument
argument
compute
(
context
&
ctx
,
const
shape
&
output_shape
,
const
std
::
vector
<
argument
>&
args
)
const
;
compute
(
context
&
ctx
,
const
shape
&
output_shape
,
const
std
::
vector
<
argument
>&
args
)
const
;
int
output_alias
(
const
std
::
vector
<
shape
>&
shapes
)
const
{
return
shapes
.
size
()
-
1
;
}
};
};
}
// namespace gpu
}
// namespace gpu
}
// namespace MIGRAPH_INLINE_NS
}
// namespace migraph
}
// namespace migraph
#endif
#endif
src/targets/gpu/include/migraph/gpu/target.hpp
View file @
ee80cee9
...
@@ -2,8 +2,10 @@
...
@@ -2,8 +2,10 @@
#define MIGRAPH_GUARD_MIGRAPHLIB_MIOPEN_TARGET_HPP
#define MIGRAPH_GUARD_MIGRAPHLIB_MIOPEN_TARGET_HPP
#include <migraph/program.hpp>
#include <migraph/program.hpp>
#include <migraph/config.hpp>
namespace
migraph
{
namespace
migraph
{
inline
namespace
MIGRAPH_INLINE_NS
{
namespace
gpu
{
namespace
gpu
{
struct
target
struct
target
...
@@ -12,7 +14,9 @@ struct target
...
@@ -12,7 +14,9 @@ struct target
std
::
vector
<
pass
>
get_passes
(
migraph
::
context
&
gctx
)
const
;
std
::
vector
<
pass
>
get_passes
(
migraph
::
context
&
gctx
)
const
;
migraph
::
context
get_context
()
const
;
migraph
::
context
get_context
()
const
;
};
};
}
// namespace gpu
}
// namespace gpu
}
// namespace MIGRAPH_INLINE_NS
}
// namespace migraph
}
// namespace migraph
#endif
#endif
src/targets/gpu/include/migraph/gpu/write_literals.hpp
View file @
ee80cee9
...
@@ -5,6 +5,7 @@
...
@@ -5,6 +5,7 @@
#include <migraph/gpu/context.hpp>
#include <migraph/gpu/context.hpp>
namespace
migraph
{
namespace
migraph
{
inline
namespace
MIGRAPH_INLINE_NS
{
namespace
gpu
{
namespace
gpu
{
...
@@ -17,7 +18,7 @@ struct write_literals
...
@@ -17,7 +18,7 @@ struct write_literals
};
};
}
// namespace gpu
}
// namespace gpu
}
// namespace MIGRAPH_INLINE_NS
}
// namespace migraph
}
// namespace migraph
#endif
#endif
src/targets/gpu/leaky_relu.cpp
View file @
ee80cee9
...
@@ -5,6 +5,7 @@
...
@@ -5,6 +5,7 @@
#include <utility>
#include <utility>
namespace
migraph
{
namespace
migraph
{
inline
namespace
MIGRAPH_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
...
@@ -33,5 +34,5 @@ argument miopen_leaky_relu::compute(context& ctx,
...
@@ -33,5 +34,5 @@ argument miopen_leaky_relu::compute(context& ctx,
}
}
}
// namespace gpu
}
// namespace gpu
}
// namespace MIGRAPH_INLINE_NS
}
// namespace migraph
}
// namespace migraph
src/targets/gpu/lowering.cpp
View file @
ee80cee9
...
@@ -27,6 +27,7 @@
...
@@ -27,6 +27,7 @@
#include <utility>
#include <utility>
namespace
migraph
{
namespace
migraph
{
inline
namespace
MIGRAPH_INLINE_NS
{
namespace
gpu
{
namespace
gpu
{
struct
miopen_apply
struct
miopen_apply
...
@@ -50,9 +51,9 @@ struct miopen_apply
...
@@ -50,9 +51,9 @@ struct miopen_apply
{
{
check_shape
(
s
,
apply_convolution
(
it
));
check_shape
(
s
,
apply_convolution
(
it
));
}
}
else
if
(
it
->
name
()
==
"
activation
"
)
else
if
(
it
->
name
()
==
"
relu
"
)
{
{
check_shape
(
s
,
apply_
activation
(
it
));
check_shape
(
s
,
apply_
relu
(
it
));
}
}
else
if
(
it
->
name
()
==
"leaky_relu"
)
else
if
(
it
->
name
()
==
"leaky_relu"
)
{
{
...
@@ -131,17 +132,13 @@ struct miopen_apply
...
@@ -131,17 +132,13 @@ struct miopen_apply
ins
,
miopen_pooling
{
op
,
std
::
move
(
pd
)},
ins
->
inputs
().
at
(
0
),
output
);
ins
,
miopen_pooling
{
op
,
std
::
move
(
pd
)},
ins
->
inputs
().
at
(
0
),
output
);
}
}
instruction_ref
apply_
activation
(
instruction_ref
ins
)
instruction_ref
apply_
relu
(
instruction_ref
ins
)
{
{
auto
&&
op
=
any_cast
<
op
::
activation
>
(
ins
->
get_operator
());
auto
ad
=
make_relu
();
auto
ad
=
make_relu
();
if
(
op
.
mode
==
"relu"
)
auto
output
=
insert_allocation
(
ins
,
ins
->
get_shape
());
{
return
prog
->
replace_instruction
(
auto
output
=
insert_allocation
(
ins
,
ins
->
get_shape
());
ins
,
miopen_relu
{
std
::
move
(
ad
)},
ins
->
inputs
().
at
(
0
),
output
);
return
prog
->
replace_instruction
(
ins
,
miopen_relu
{
std
::
move
(
ad
)},
ins
->
inputs
().
at
(
0
),
output
);
}
return
ins
;
}
}
instruction_ref
apply_leaky_relu
(
instruction_ref
ins
)
instruction_ref
apply_leaky_relu
(
instruction_ref
ins
)
...
@@ -224,4 +221,5 @@ struct miopen_apply
...
@@ -224,4 +221,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
}
// namespace migraph
src/targets/gpu/mul.cpp
View file @
ee80cee9
...
@@ -5,6 +5,7 @@
...
@@ -5,6 +5,7 @@
#include <utility>
#include <utility>
namespace
migraph
{
namespace
migraph
{
inline
namespace
MIGRAPH_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
...
@@ -21,5 +22,5 @@ argument hip_mul::compute(context& ctx, const shape&, const std::vector<argument
...
@@ -21,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
}
// namespace migraph
src/targets/gpu/pooling.cpp
View file @
ee80cee9
...
@@ -5,6 +5,7 @@
...
@@ -5,6 +5,7 @@
#include <utility>
#include <utility>
namespace
migraph
{
namespace
migraph
{
inline
namespace
MIGRAPH_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
...
@@ -37,5 +38,5 @@ argument miopen_pooling::compute(context& ctx,
...
@@ -37,5 +38,5 @@ argument miopen_pooling::compute(context& ctx,
}
}
}
// namespace gpu
}
// namespace gpu
}
// namespace MIGRAPH_INLINE_NS
}
// namespace migraph
}
// namespace migraph
Prev
1
…
3
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