Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle-Lite
提交
83ba1b39
P
Paddle-Lite
项目概览
PaddlePaddle
/
Paddle-Lite
通知
331
Star
4
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
271
列表
看板
标记
里程碑
合并请求
78
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle-Lite
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
271
Issue
271
列表
看板
标记
里程碑
合并请求
78
合并请求
78
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
83ba1b39
编写于
3月 26, 2019
作者:
qnqinan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
clean interrupt signal at the beginning of bypass in FPGA track
上级
087d3fe6
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
13 addition
and
21 deletion
+13
-21
src/fpga/V1/pe.cpp
src/fpga/V1/pe.cpp
+8
-1
src/fpga/common/driver.cpp
src/fpga/common/driver.cpp
+5
-20
未找到文件。
src/fpga/V1/pe.cpp
浏览文件 @
83ba1b39
...
...
@@ -13,6 +13,7 @@ See the License for the specific language governing permissions and
limitations under the License. */
#include "fpga/common/pe.h"
#include "common/enforce.h"
#include "common/types.h"
#include "fpga/V1/filter.h"
#include "fpga/V1/image.h"
...
...
@@ -296,6 +297,7 @@ int ComputeBasicConv(const struct ConvArgs &args) {
g_fpgainfo
.
pe_data
->
pes
[
PE_IDX_CONV
]
->
status
=
ERROR
;
ret
=
-
EIO
;
DLOG
<<
"Conv Wait Irq Timeout!"
;
PADDLE_MOBILE_ENFORCE
(
0
,
"Conv Wait Irq Timeout"
);
}
output_scale
=
reg_readq
(
REG_SCALE_PARAMETER
);
output_scale
=
(
output_scale
<<
32
)
|
(
output_scale
>>
32
);
...
...
@@ -447,6 +449,7 @@ int ComputeFpgaPool(const struct PoolingArgs &args) {
g_fpgainfo
.
pe_data
->
pes
[
PE_IDX_POOLING
]
->
status
=
ERROR
;
ret
=
-
EIO
;
DLOG
<<
"Pooling Wait Irq Timeout!"
;
PADDLE_MOBILE_ENFORCE
(
0
,
"Pooling Wait Irq Timeout!"
);
}
DLOG
<<
"after reg poll"
;
...
...
@@ -529,6 +532,7 @@ int ComputeFpgaEWAdd(const struct EWAddArgs &args) {
g_fpgainfo
.
pe_data
->
pes
[
PE_IDX_EW
]
->
status
=
ERROR
;
ret
=
-
EIO
;
DLOG
<<
"EW Wait Irq Timeout!"
;
PADDLE_MOBILE_ENFORCE
(
0
,
"EW Wait Irq Timeout!"
);
}
output_scale
=
reg_readq
(
REG_SCALE_PARAMETER
);
...
...
@@ -561,6 +565,7 @@ int PerformBypass(const struct BypassArgs &args) {
<<
" out_scale_address:"
<<
args
.
output
.
scale_address
;
#endif
#ifdef PADDLE_MOBILE_ZU5
uint64_t
bypass_interrupt
=
reg_readq
(
REG_INTERRUPT
);
uint64_t
output_scale
=
0
;
uint64_t
timer_cnt
=
0
;
uint64_t
cmd
=
0
;
...
...
@@ -666,12 +671,13 @@ int PerformBypass(const struct BypassArgs &args) {
reg_writeq
(
output_address_phy
,
REG_CONVERT_DST_ADDR
);
reg_writeq
(
datalen
,
REG_CONVERT_LENGTH
);
reg_writeq
(
cmd
,
REG_CONVERT_CMD
);
// exit(-1);
DLOG
<<
"before reg poll"
;
if
(
0
!=
fpga_regpoll
(
REG_INTERRUPT
,
INTERRUPT_BYPASS
,
PE_IRQ_TIMEOUT
))
{
g_fpgainfo
.
pe_data
->
pes
[
PE_IDX_BYPASS
]
->
status
=
ERROR
;
ret
=
-
EIO
;
DLOG
<<
"BYPASS Wait Irq Timeout!"
;
PADDLE_MOBILE_ENFORCE
(
0
,
"BYPASS Wait Irq Timeout!"
);
}
DLOG
<<
"after reg poll"
;
...
...
@@ -1052,6 +1058,7 @@ int ComputeDWConv(const struct DWconvArgs &args) {
g_fpgainfo
.
pe_data
->
pes
[
PE_IDX_POOLING
]
->
status
=
ERROR
;
ret
=
-
EIO
;
DLOG
<<
"Pooling Wait Irq Timeout!"
;
PADDLE_MOBILE_ENFORCE
(
0
,
"DWConv Wait Irq Timeout"
);
}
DLOG
<<
"after reg poll"
;
...
...
src/fpga/common/driver.cpp
浏览文件 @
83ba1b39
...
...
@@ -51,11 +51,7 @@ int open_memdevice() {
return
g_fpgainfo
.
fd_mem
;
}
void
pl_reset
()
{
// DLOG << "PL RESET";
usleep
(
100
*
1000
);
}
void
pl_reset
()
{
usleep
(
100
*
1000
);
}
void
setup_pe
(
struct
pe_data_s
*
pe_data
,
struct
fpga_pe
*
pe
,
char
const
*
type_name
,
int
pe_idx
)
{
...
...
@@ -77,7 +73,7 @@ void pl_init() {
pe_data
=
(
struct
pe_data_s
*
)
malloc
(
sizeof
(
struct
pe_data_s
));
if
(
pe_data
==
nullptr
)
{
DLOG
<<
"pe_data malloc error!"
;
std
::
cout
<<
"pe_data malloc error!"
<<
std
::
endl
;
return
;
}
memset
(
pe_data
,
0
,
sizeof
(
struct
pe_data_s
));
...
...
@@ -165,7 +161,7 @@ uint64_t vaddr_to_paddr_driver(void *address) {
if
(
iter
!=
g_fpgainfo
.
fpga_vaddr2paddr_map
.
end
())
{
paddr
=
iter
->
second
;
}
else
{
DLOG
<<
"Invalid pointer: "
<<
address
;
std
::
cout
<<
"Invalid pointer: "
<<
address
<<
std
::
endl
;
}
return
paddr
;
...
...
@@ -191,7 +187,7 @@ void *fpga_reg_free(void *ptr) {
g_fpgainfo
.
fpga_addr2size_map
.
erase
(
iter
);
munmap
(
ptr
,
size
);
}
else
{
DLOG
<<
"Invalid pointer"
<<
ptr
;
std
::
cout
<<
"Invalid pointer"
<<
ptr
<<
std
::
endl
;
}
}
...
...
@@ -205,9 +201,6 @@ void *fpga_malloc_driver(size_t size) {
int
i
=
0
;
struct
MemoryVM2PHYArgs
args
;
struct
MemoryCacheArgs
args_c
;
// memory_request(g_fpgainfo.memory_info, size, &phy_addr);
ret
=
mmap64
(
nullptr
,
size
,
PROT_READ
|
PROT_WRITE
,
MAP_SHARED
,
g_fpgainfo
.
fd_mem
,
FPGA_MEM_PHY_ADDR
);
PADDLE_MOBILE_ENFORCE
(
ret
!=
(
void
*
)
-
1
,
"Should not be -1"
);
...
...
@@ -233,16 +226,12 @@ void fpga_free_driver(void *ptr) {
size
=
iter
->
second
;
g_fpgainfo
.
fpga_addr2size_map
.
erase
(
iter
);
munmap
(
ptr
,
size
);
// p_addr = vaddr_to_paddr_driver(ptr);
// pos = (p_addr - g_fpgainfo.memory_info->mem_start) / FPGA_PAGE_SIZE;
auto
iter
=
g_fpgainfo
.
fpga_vaddr2paddr_map
.
find
(
ptr
);
if
(
iter
!=
g_fpgainfo
.
fpga_vaddr2paddr_map
.
end
())
{
g_fpgainfo
.
fpga_vaddr2paddr_map
.
erase
(
iter
);
}
}
else
{
DLOG
<<
"Invalid pointer"
<<
ptr
;
std
::
cout
<<
"Invalid pointer"
<<
ptr
<<
std
::
endl
;
}
}
...
...
@@ -295,10 +284,7 @@ int open_device_driver() {
g_fpgainfo
.
FpgaRegVirAddr
=
(
uint64_t
*
)
fpga_reg_malloc
(
FPGA_REG_SIZE
);
// NOLINT
// fpga_memory_add();
pl_init
();
return
ret
;
}
...
...
@@ -306,7 +292,6 @@ int close_device_driver() {
pl_destroy
();
fpga_reg_free
(
g_fpgainfo
.
FpgaRegVirAddr
);
memory_release
(
g_fpgainfo
.
memory_info
);
return
0
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录