Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MegEngine 天元
MegEngine
提交
2dc91900
MegEngine
项目概览
MegEngine 天元
/
MegEngine
接近 2 年 前同步成功
通知
414
Star
4708
Fork
583
代码
文件
提交
分支
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看板
提交
2dc91900
编写于
7月 29, 2020
作者:
M
Megvii Engine Team
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(fastrun/persistent_cache): fix fastrun crash
GitOrigin-RevId: b3f7bdf7dc1942a9b012f6b1575cb0a4759cb1b9
上级
a9e7a670
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
5 addition
and
4 deletion
+5
-4
src/core/impl/utils/persistent_cache.cpp
src/core/impl/utils/persistent_cache.cpp
+3
-3
src/core/include/megbrain/utils/persistent_cache.h
src/core/include/megbrain/utils/persistent_cache.h
+2
-1
未找到文件。
src/core/impl/utils/persistent_cache.cpp
浏览文件 @
2dc91900
...
...
@@ -176,11 +176,9 @@ AlgoChooserProfileCache::get(const Key &key) {
auto
entry_len
=
read_uint32
();
mgb_assert
(
buf
+
entry_len
<=
buf_end
);
int
rep
;
auto
nr
=
sscanf
(
reinterpret_cast
<
const
char
*>
(
buf
),
ENTRY_FMT
,
&
rep
,
&
i
.
time
,
&
i
.
workspace
);
&
i
.
reproducible
,
&
i
.
time
,
&
i
.
workspace
);
mgb_assert
(
nr
==
3
);
i
.
reproducible
=
rep
;
buf
+=
entry_len
;
}
mgb_assert
(
buf
==
buf_end
);
...
...
@@ -228,6 +226,8 @@ void AlgoChooserProfileCache::put(const Key &key, Result &result) {
val
.
resize
(
pos
+
SPR_SIZE
);
uint32_t
nr
=
snprintf
(
&
val
[
pos
],
SPR_SIZE
,
ENTRY_FMT
,
i
.
reproducible
,
i
.
time
,
i
.
workspace
);
//! for memory boundary failed, snprintf ret do not contain \0
nr
+=
1
;
mgb_assert
(
nr
<
SPR_SIZE
);
memcpy
(
&
val
[
pos
-
sizeof
(
uint32_t
)],
&
nr
,
sizeof
(
nr
));
val
.
resize
(
pos
+
nr
);
...
...
src/core/include/megbrain/utils/persistent_cache.h
浏览文件 @
2dc91900
...
...
@@ -100,7 +100,8 @@ namespace mgb {
struct
ResultEntry
{
std
::
string
algo
;
//! identifier of the algorithm
bool
reproducible
;
//! whether algorithm is reproducible
//! sscanf will up bool as int
int
reproducible
;
//! whether algorithm is reproducible
double
time
;
//! execution time in seconds
size_t
workspace
;
//! workspace in bytes
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录