vpisarev / ficus

The programming language Ficus
Apache License 2.0
72 stars 9 forks source link

Fix possible out-of-bounds bug in OpConv.fx #18

Closed zihaomu closed 2 years ago

zihaomu commented 2 years ago

Fix possible out-of-bounds bug

vpisarev commented 2 years ago

@zihaomu, this is not a bug. Please, check the condition on the next line:

if (j + 8 > out_width) {
...

this is so-called "Halide trick" of handling loop tails

zihaomu commented 2 years ago

Hi @vpisarev, I get your point now. A very useful trick so that the end of the loop can still use SIMD acceleration. That means there some tails will be computed twice.

And when pbptr is true, it may cause bugs if you still use another trick you told me before (pb_data was saved as Conv's output_data). If pb_data is different from output_data, it works fine.