-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sum of Absolute Differences Benchmark #22
base: master
Are you sure you want to change the base?
Conversation
2. Cleaned up the host code from having multiple matrix dimensions 3. Added README
2. Added safeguard against result dimensions not being a multiplicant of tile group dimensions
int __attribute__ ((noinline)) sum_abs_diff_single_work_per_tile (int *REF, int *FRAME, int *RES, | ||
uint32_t ref_height, uint32_t ref_width, | ||
uint32_t frame_height, uint32_t frame_width, | ||
uint32_t res_height, uint32_t res_width) { | ||
|
||
int start_y = __bsg_tile_group_id_y * bsg_tiles_Y + bsg_y; | ||
int end_y = MIN (start_y + frame_height, res_height); | ||
int start_x = __bsg_tile_group_id_x * bsg_tiles_X + bsg_x; | ||
int end_x = MIN (start_x + frame_width, res_width); | ||
|
||
|
||
int sad = 0; | ||
for (int y = start_y; y < end_y; y ++) { | ||
for (int x = start_x; x < end_x; x ++) { | ||
sad += ABS ( (REF[y * ref_width + x] - FRAME[(y - start_y) * frame_width + (x - start_x)]) ); | ||
} | ||
} | ||
|
||
RES[start_y * res_width + start_x] = sad; | ||
return 0; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I said in the meeting - if you use templates for the input datatype you won't have binary bloat. I think it's worth your time to do this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you're worried about namespace collision you can do:
namespace v0{
// Kernel source
}
And then in the kernel.cpp file:
using namespace v0;
/******************************************************************************/ | ||
/* Runs the sum ob absolute differences kernel between a reference and a */ | ||
/* frame image (represented by 3D RGB pixel matrixes) */ | ||
/******************************************************************************/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two comments:
- ob -> of
- The comment boxes are hard to maintain and add a lot of whitespace. Can you make them a single comment (i.e.
/******************************************************************************
* Runs the sum ob absolute differences kernel between a reference and a
* frame image (represented by 3D RGB pixel matrixes)
******************************************************************************/
or
// *****************************************************************************
// Runs the sum ob absolute differences kernel between a reference and a
// frame image (represented by 3D RGB pixel matrixes)
// *****************************************************************************
To compare against the "SAD" testbench in the IMPACT Parboil benchmark.