Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
magicwindyyd
mindspore
提交
d22a5976
M
mindspore
项目概览
magicwindyyd
/
mindspore
与 Fork 源项目一致
Fork自
MindSpore / mindspore
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
mindspore
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
d22a5976
编写于
7月 14, 2020
作者:
V
VectorSL
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
gpu fix addn bug and supported list bug
上级
180b3029
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
18 addition
and
8 deletion
+18
-8
mindspore/ccsrc/device/gpu/kernel_info_setter.cc
mindspore/ccsrc/device/gpu/kernel_info_setter.cc
+2
-1
mindspore/ccsrc/kernel/gpu/math/addn_gpu_kernel.h
mindspore/ccsrc/kernel/gpu/math/addn_gpu_kernel.h
+16
-7
未找到文件。
mindspore/ccsrc/device/gpu/kernel_info_setter.cc
浏览文件 @
d22a5976
...
@@ -88,10 +88,11 @@ std::string SupportedTypeList(const CNodePtr &kernel_node) {
...
@@ -88,10 +88,11 @@ std::string SupportedTypeList(const CNodePtr &kernel_node) {
supported_akg_type_list
=
supported_akg_type_list
+
mindspore
::
kernel
::
TypeId2String
(
type
);
supported_akg_type_list
=
supported_akg_type_list
+
mindspore
::
kernel
::
TypeId2String
(
type
);
}
}
supported_type_lists
=
supported_type_lists
+
supported_akg_type_list
+
"], out["
;
supported_type_lists
=
supported_type_lists
+
supported_akg_type_list
+
"], out["
;
supported_akg_type_list
.
clear
();
for
(
auto
type
:
supported_akg_type_out
)
{
for
(
auto
type
:
supported_akg_type_out
)
{
supported_akg_type_list
=
supported_akg_type_list
+
mindspore
::
kernel
::
TypeId2String
(
type
);
supported_akg_type_list
=
supported_akg_type_list
+
mindspore
::
kernel
::
TypeId2String
(
type
);
}
}
supported_type_lists
+=
"]; "
;
supported_type_lists
=
supported_type_lists
+
supported_akg_type_list
+
"]; "
;
}
}
return
supported_type_lists
;
return
supported_type_lists
;
}
}
...
...
mindspore/ccsrc/kernel/gpu/math/addn_gpu_kernel.h
浏览文件 @
d22a5976
...
@@ -21,6 +21,8 @@
...
@@ -21,6 +21,8 @@
#include <vector>
#include <vector>
#include "kernel/gpu/gpu_kernel.h"
#include "kernel/gpu/gpu_kernel.h"
#include "kernel/gpu/gpu_kernel_factory.h"
#include "kernel/gpu/gpu_kernel_factory.h"
#include "kernel/gpu/math/broadcast_gpu_kernel.h"
#include "kernel/gpu/cuda_impl/slice_impl.cuh"
#include "kernel/gpu/kernel_constants.h"
#include "kernel/gpu/kernel_constants.h"
namespace
mindspore
{
namespace
mindspore
{
...
@@ -43,18 +45,26 @@ class AddNGpuFwdKernel : public GpuKernel {
...
@@ -43,18 +45,26 @@ class AddNGpuFwdKernel : public GpuKernel {
const
std
::
vector
<
size_t
>
&
GetWorkspaceSizeList
()
const
override
{
return
workspace_size_list_
;
}
const
std
::
vector
<
size_t
>
&
GetWorkspaceSizeList
()
const
override
{
return
workspace_size_list_
;
}
bool
Launch
(
const
std
::
vector
<
AddressPtr
>
&
inputs
,
const
std
::
vector
<
AddressPtr
>
&
,
bool
Launch
(
const
std
::
vector
<
AddressPtr
>
&
inputs
,
const
std
::
vector
<
AddressPtr
>
&
,
const
std
::
vector
<
AddressPtr
>
&
outputs
,
void
*
)
override
{
const
std
::
vector
<
AddressPtr
>
&
outputs
,
void
*
stream_ptr
)
override
{
if
(
is_null_input_
)
{
if
(
is_null_input_
)
{
return
true
;
return
true
;
}
}
T
*
output_addr
=
GetDeviceAddress
<
T
>
(
outputs
,
0
);
T
*
output_addr
=
GetDeviceAddress
<
T
>
(
outputs
,
0
);
if
(
cudnn_data_type_
==
CUDNN_DATA_INT32
)
{
FillDeviceArray
(
outputs
[
0
]
->
size
/
sizeof
(
T
),
output_addr
,
0.0
f
,
reinterpret_cast
<
cudaStream_t
>
(
stream_ptr
));
}
const
float
alpha
=
1
;
const
float
alpha
=
1
;
const
float
beta
=
0
;
const
float
beta
=
0
;
for
(
size_t
i
=
0
;
i
<
IntToSize
(
num_input_
);
i
++
)
{
for
(
size_t
i
=
0
;
i
<
IntToSize
(
num_input_
);
i
++
)
{
T
*
input_addr
=
GetDeviceAddress
<
T
>
(
inputs
,
i
);
T
*
input_addr
=
GetDeviceAddress
<
T
>
(
inputs
,
i
);
CHECK_CUDNN_RET_WITH_EXCEPT
(
cudnnAddTensor
(
cudnn_handle_
,
&
alpha
,
input_descriptor_
,
input_addr
,
if
(
cudnn_data_type_
==
CUDNN_DATA_INT32
)
{
&
(
i
>
0
?
alpha
:
beta
),
input_descriptor_
,
output_addr
),
NoBroadcast
(
outputs
[
0
]
->
size
/
sizeof
(
T
),
BROADCAST_TYPE_ADD
,
input_addr
,
output_addr
,
output_addr
,
"cudnnAddTensor failed"
);
reinterpret_cast
<
cudaStream_t
>
(
stream_ptr
));
}
else
{
CHECK_CUDNN_RET_WITH_EXCEPT
(
cudnnAddTensor
(
cudnn_handle_
,
&
alpha
,
input_descriptor_
,
input_addr
,
&
(
i
>
0
?
alpha
:
beta
),
input_descriptor_
,
output_addr
),
"cudnnAddTensor failed"
);
}
}
}
return
true
;
return
true
;
}
}
...
@@ -100,9 +110,8 @@ class AddNGpuFwdKernel : public GpuKernel {
...
@@ -100,9 +110,8 @@ class AddNGpuFwdKernel : public GpuKernel {
}
}
void
InitSizeLists
()
override
{
void
InitSizeLists
()
override
{
if
(
!
is_null_input_
)
{
if
(
!
is_null_input_
)
{
CHECK_CUDNN_RET_WITH_EXCEPT
(
CHECK_CUDNN_RET_WITH_EXCEPT
(
cudnnGetTensorSizeInBytes
(
input_descriptor_
,
&
input_size_
),
cudnnGetTensorSizeInBytes
(
input_descriptor_
,
reinterpret_cast
<
size_t
*>
(
&
input_size_
)),
"cudnnGetTensorSizeInBytes failed"
);
"cudnnGetTensorSizeInBytes failed"
);
}
}
for
(
int
i
=
0
;
i
<
num_input_
;
i
++
)
{
for
(
int
i
=
0
;
i
<
num_input_
;
i
++
)
{
input_size_list_
.
push_back
(
input_size_
);
input_size_list_
.
push_back
(
input_size_
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录