Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MegEngine 天元
MegEngine
提交
8d248a6a
MegEngine
项目概览
MegEngine 天元
/
MegEngine
大约 1 年 前同步成功
通知
399
Star
4705
Fork
582
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
MegEngine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
8d248a6a
编写于
6月 23, 2021
作者:
M
Megvii Engine Team
提交者:
huangxinda
7月 19, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(dnn/cuda): fix testcase for fallback nchw qs8 conv
GitOrigin-RevId: 646440db59f0157a3fdbd8061167f9ac04dbd422
上级
894a2407
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
19 addition
and
10 deletion
+19
-10
dnn/src/common/utils.cpp
dnn/src/common/utils.cpp
+2
-1
dnn/src/cuda/conv_bias/conv_nchwqs8.cpp
dnn/src/cuda/conv_bias/conv_nchwqs8.cpp
+7
-3
dnn/test/cuda/conv_bias_int8.cpp
dnn/test/cuda/conv_bias_int8.cpp
+10
-6
未找到文件。
dnn/src/common/utils.cpp
浏览文件 @
8d248a6a
...
@@ -353,7 +353,8 @@ bool megdnn::check_bias_share_in_channel(const TensorLayout& bias,
...
@@ -353,7 +353,8 @@ bool megdnn::check_bias_share_in_channel(const TensorLayout& bias,
format
==
param
::
ConvBias
::
Format
::
NCHW4_NCHW
)
{
format
==
param
::
ConvBias
::
Format
::
NCHW4_NCHW
)
{
share_in_channel
=
(
bias
.
ndim
==
4
&&
bias
[
0
]
==
1
&&
bias
[
2
]
==
1
&&
share_in_channel
=
(
bias
.
ndim
==
4
&&
bias
[
0
]
==
1
&&
bias
[
2
]
==
1
&&
bias
[
3
]
==
1
);
bias
[
3
]
==
1
);
}
else
if
(
format
==
param
::
ConvBias
::
Format
::
NHWC
)
{
}
else
if
(
format
==
param
::
ConvBias
::
Format
::
NHWC
||
format
==
param
::
ConvBias
::
Format
::
NCHW4_NHWC
)
{
share_in_channel
=
(
bias
.
ndim
==
4
&&
bias
[
0
]
==
1
&&
bias
[
1
]
==
1
&&
share_in_channel
=
(
bias
.
ndim
==
4
&&
bias
[
0
]
==
1
&&
bias
[
1
]
==
1
&&
bias
[
2
]
==
1
);
bias
[
2
]
==
1
);
}
else
if
(
format
==
param
::
ConvBias
::
Format
::
NCHW4
||
}
else
if
(
format
==
param
::
ConvBias
::
Format
::
NCHW4
||
...
...
dnn/src/cuda/conv_bias/conv_nchwqs8.cpp
浏览文件 @
8d248a6a
...
@@ -84,8 +84,12 @@ ConvBiasForwardImpl::AlgoFallbackNCHWQS8::get_subopr_list(
...
@@ -84,8 +84,12 @@ ConvBiasForwardImpl::AlgoFallbackNCHWQS8::get_subopr_list(
inner_dst_layout
,
inner_bias_layout
,
inner_z_layout
);
inner_dst_layout
,
inner_bias_layout
,
inner_z_layout
);
Param
inner_conv_param
=
o
->
param
();
Param
inner_conv_param
=
o
->
param
();
inner_conv_param
.
format
=
Param
::
Format
::
NCHW4
;
if
(
layouts
[
4
].
dtype
.
enumv
()
==
DTypeEnum
::
Float32
)
{
inner_conv_param
.
format
=
Param
::
Format
::
NCHW4_NCHW
;
}
else
{
inner_conv_param
.
format
=
Param
::
Format
::
NCHW4
;
}
std
::
string
param_str
;
std
::
string
param_str
;
Algorithm
::
serialize_write_pod
(
inner_conv_param
,
param_str
);
Algorithm
::
serialize_write_pod
(
inner_conv_param
,
param_str
);
...
@@ -192,9 +196,9 @@ void ConvBiasForwardImpl::AlgoFallbackNCHWQS8::exec(
...
@@ -192,9 +196,9 @@ void ConvBiasForwardImpl::AlgoFallbackNCHWQS8::exec(
inner_conv_param
.
format
=
inner_conv_param
.
format
=
dst_float
?
Param
::
Format
::
NCHW4_NCHW
:
Param
::
Format
::
NCHW4
;
dst_float
?
Param
::
Format
::
NCHW4_NCHW
:
Param
::
Format
::
NCHW4
;
auto
inner_opr
=
args
.
handle
->
create_operator
<
ConvBiasForward
>
();
auto
inner_opr
=
args
.
handle
->
create_operator
<
ConvBiasForward
>
();
inner_opr
->
param
()
=
inner_conv_param
;
set_execution_policy
<
ConvBiasForward
,
ConvBiasForward
*>
(
args
.
opr
,
set_execution_policy
<
ConvBiasForward
,
ConvBiasForward
*>
(
args
.
opr
,
inner_opr
.
get
());
inner_opr
.
get
());
inner_opr
->
param
()
=
inner_conv_param
;
relayout_nchw_nchw4
->
exec
(
*
args
.
src_tensor
,
inner_src
,
{});
relayout_nchw_nchw4
->
exec
(
*
args
.
src_tensor
,
inner_src
,
{});
relayout_weight
->
exec
(
*
args
.
filter_tensor
,
inner_weight
,
{});
relayout_weight
->
exec
(
*
args
.
filter_tensor
,
inner_weight
,
{});
...
...
dnn/test/cuda/conv_bias_int8.cpp
浏览文件 @
8d248a6a
...
@@ -701,9 +701,11 @@ TEST_F(CUDA, CONV_BIAS_INT8_CHWN4_UNROLL_WIDTH_TENSORCORE_1x1_ALGO_2) {
...
@@ -701,9 +701,11 @@ TEST_F(CUDA, CONV_BIAS_INT8_CHWN4_UNROLL_WIDTH_TENSORCORE_1x1_ALGO_2) {
TEST_F
(
CUDA
,
FALLBACK_CONV_QS8
)
{
TEST_F
(
CUDA
,
FALLBACK_CONV_QS8
)
{
require_compute_capability_eq
(
7
,
5
);
require_compute_capability_eq
(
7
,
5
);
Checker
<
ConvBiasForward
>
checker
(
handle_cuda
());
Checker
<
ConvBiasForward
>
checker
(
handle_cuda
());
auto
check
=
[
&
checker
](
const
std
::
string
&&
algo
)
{
auto
check
=
[
&
checker
](
const
std
::
string
&&
algo
,
const
std
::
string
&&
sub_algo
)
{
checker
.
set_before_exec_callback
(
checker
.
set_before_exec_callback
(
conv_bias
::
ConvBiasAlgoChecker
<
ConvBiasForward
>
(
algo
.
c_str
()));
conv_bias
::
ConvBiasAlgoChecker
<
ConvBiasForward
>
(
{
algo
.
c_str
(),
{
sub_algo
.
c_str
()}}));
UniformIntRNG
rng
{
-
3
,
3
};
UniformIntRNG
rng
{
-
3
,
3
};
UniformIntRNG
bias_rng
{
-
50
,
50
};
UniformIntRNG
bias_rng
{
-
50
,
50
};
checker
.
set_rng
(
0
,
&
rng
)
checker
.
set_rng
(
0
,
&
rng
)
...
@@ -733,15 +735,17 @@ TEST_F(CUDA, FALLBACK_CONV_QS8) {
...
@@ -733,15 +735,17 @@ TEST_F(CUDA, FALLBACK_CONV_QS8) {
{},
{},
{}});
{}});
};
};
check
(
"FALLBACK_CONV_NCHW_QS8"
);
check
(
"FALLBACK_CONV_NCHW_QS8"
,
"INT8_NCHW4_DOTPROD_IMPLICIT_GEMM"
);
}
}
TEST_F
(
CUDA
,
FALLBACK_CONV_QS8_F32
)
{
TEST_F
(
CUDA
,
FALLBACK_CONV_QS8_F32
)
{
require_compute_capability_eq
(
7
,
5
);
require_compute_capability_eq
(
7
,
5
);
Checker
<
ConvBiasForward
>
checker
(
handle_cuda
());
Checker
<
ConvBiasForward
>
checker
(
handle_cuda
());
auto
check
=
[
&
checker
](
const
std
::
string
&&
algo
)
{
auto
check
=
[
&
checker
](
const
std
::
string
&&
algo
,
const
std
::
string
&&
sub_algo
)
{
checker
.
set_before_exec_callback
(
checker
.
set_before_exec_callback
(
conv_bias
::
ConvBiasAlgoChecker
<
ConvBiasForward
>
(
algo
.
c_str
()));
conv_bias
::
ConvBiasAlgoChecker
<
ConvBiasForward
>
(
{
algo
.
c_str
(),
{
sub_algo
.
c_str
()}}));
UniformIntRNG
rng
{
-
3
,
3
};
UniformIntRNG
rng
{
-
3
,
3
};
UniformFloatRNG
bias_rng
{
-
50.
f
,
50.
f
};
UniformFloatRNG
bias_rng
{
-
50.
f
,
50.
f
};
checker
.
set_rng
(
0
,
&
rng
)
checker
.
set_rng
(
0
,
&
rng
)
...
@@ -771,7 +775,7 @@ TEST_F(CUDA, FALLBACK_CONV_QS8_F32) {
...
@@ -771,7 +775,7 @@ TEST_F(CUDA, FALLBACK_CONV_QS8_F32) {
{},
{},
{}});
{}});
};
};
check
(
"FALLBACK_CONV_NCHW_QS8"
);
check
(
"FALLBACK_CONV_NCHW_QS8"
,
"INT8_NCHW4_DOTPROD_IMPLICIT_GEMM"
);
}
}
TEST_F
(
CUDA
,
CUTLASS_CONV_BIAS_INT8_WEIGHT_PREPROCESS
)
{
TEST_F
(
CUDA
,
CUTLASS_CONV_BIAS_INT8_WEIGHT_PREPROCESS
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录