Comments (10)
In you original code, both input and output are 3 dimensional, especially you bound the 3rd dimension of output using output.bound(c, 0, 3)
; so please use 3 dimensions in run.cpp. If you want to reduce the 3rd dimension of input, please change
local_sum(x, y, c) += cast<uint16_t>(in(x+r.x, y+r.y, c)) * weight(r.x+2, r.y+2);
to
local_sum(x, y) += cast<uint16_t>(in(x+r.x, y+r.y, r.z)) * weight(r.x+2, r.y+2);
And also change some other code accordingly. But in that case, it is not in the scope of this issue, so the current issue will be closed.
from halide-hls.
There are several issues in your code. Main reason is your tile size is 1 x 1, and window size is 3 x 3, that makes the maximum size of your image tile -1 x -1. What you should change in your code is:
local_sum(x, y, c) += cast<uint16_t>(in(x+r.x, y+r.y, c)) * weight(r.x+2, r.y+2);
change tolocal_sum(x, y, c) += cast<uint16_t>(in(x+r.x, y+r.y, c)) * weight(r.x+1, r.y+1);
so that the weight is accessed at the right position.hw_output.tile(x, y, xo, yo, xi, yi, 1, 1);
change tohw_output.tile(x, y, xo, yo, xi, yi, 16, 16);
, note 16 is just an example, but you should use a number that larger than the window size.input_buf(x,y,c) = clamped(x,y,c);
get removed, since it is not used.
from halide-hls.
Thank you @xuanyoya for detail description. However, the max(-1)
problem still occur after the modifications. Moreover, I have tried to use different size of input buffer, but it didn't change anything. Is there any other potential problem?
from halide-hls.
@chingyi071 I didn't read your run.cpp file before. But this time, I realized you also have another error in this file. Since you are doing a convolution with window 3 x 3, so the output image size will be smaller than the input image size, you should NOT specify your output image to be:
BufferMinimal<uint8_t> out_native(input.width(),input.height());
BufferMinimal<uint8_t> out_hls(input.width(), input.height());
Instead, change input.width()
and input.height()
to some numbers that smaller than or equal to input.width() - 2
and input.height() - 2
.
Let me know the result. If that passes, I will close this issue.
from halide-hls.
@xuanyoya I modify it but it still fail. But the error message become Error: Output buffer output is accessed at 2, which is beyond the max (-1) in dimension 2
. The original error message is accessed at 0
. I'm not sure whether this phenomenon can help you
from halide-hls.
@chingyi071 Besides, for this kind of errors, you can just try the same program and same schedule with original C backend or with original Halide repo. If you see this error occurs with the original C backend or original Halide repo, then the fastest way for you debug is to post this question on stackoverflow or Halide developer mailing list.
from halide-hls.
Since you are doing repeat_edge as clamped = BoundaryConditions::repeat_edge(input);
, I don't think my previous suggestion is helpful. The change you should make is
BufferMinimal<uint8_t> out_native(input.width(),input.height(), input.channels());
BufferMinimal<uint8_t> out_hls(input.width(), input.height(), input.channels());
Besides, for this line pipeline_hls(input, weight, out_native);
, it should be pipeline_hls(input, weight, out_hls);
from halide-hls.
The dimension of input image will be reduced from 3 to 2 in the function, so I remove input.channels()
in output buffer declaration. I fix the input argument in pipeline_hls()
but it still failed.
from halide-hls.
I didn't see how you reduced the dimension from 3 to 2, and I have tried with my modification, it already passed.
from halide-hls.
@xuanyoya Sorry I just use reduced version of my function. This code does not reduce the dimension. And I pass the test. Thank you very much
from halide-hls.
Related Issues (20)
- Rewrite example apps using Generator HOT 1
- "make run_hls" fails inside Vivado HLS HOT 2
- FFT in Halide-HLS HOT 2
- 'HalideRuntime.h' file not found HOT 13
- Reduction Operation in Halide-HLS HOT 2
- C++11 feature is not included in makefile HOT 5
- Understanding Linebuffer in Halide-HLS HOT 4
- Lookup Tables for Trigonometric Functions HOT 3
- hls_target.cpp without any content HOT 4
- Error occur in removing scheduler HOT 1
- Support out-of-source build with proper cmake file
- Accelerating last function (not hw_output) not possible? HOT 2
- Example Usage of HLS in Application HOT 1
- reinterpret<>() for hls_target.cpp
- Possible bug in generated HLS
- Adopt device interface
- Use Halide::Target to infer HLS code generation
- Add HLS AOT generator test
- Support zero-copy buffer on Zynq
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from halide-hls.