Skip to content

Commit

Permalink
GPyramids in A&M go through clockwork flow
Browse files Browse the repository at this point in the history
  • Loading branch information
mcoduoza committed Jun 17, 2024
1 parent 822c97b commit 8d559c4
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 32 deletions.
66 changes: 36 additions & 30 deletions apps/hardware_benchmarks/apps/hdr_plus/hdr_plus_generator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -582,17 +582,29 @@ class HDRPlus : public Halide::Generator<HDRPlus> {
Expr initialGaussWidth[J];
Expr initialGaussHeight[J];

initialGaussWidth[0] = input.width()/2;
initialGaussWidth[1] = input.width()/4;
initialGaussWidth[2] = input.width()/8;
initialGaussWidth[3] = input.width()/16;
initialGaussWidth[4] = input.width()/32;

initialGaussHeight[0] = input.height()/2;
initialGaussHeight[1] = input.height()/4;
initialGaussHeight[2] = input.height()/8;
initialGaussHeight[3] = input.height()/16;
initialGaussHeight[4] = input.height()/32;
// initialGaussWidth[0] = input.width()/2;
// initialGaussWidth[1] = input.width()/4;
// initialGaussWidth[2] = input.width()/8;
// initialGaussWidth[3] = input.width()/16;
// initialGaussWidth[4] = input.width()/32;

initialGaussWidth[0] = 625;
initialGaussWidth[1] = 312;
initialGaussWidth[2] = 156;
initialGaussWidth[3] = 78;
initialGaussWidth[4] = 39;

// initialGaussHeight[0] = input.height()/2;
// initialGaussHeight[1] = input.height()/4;
// initialGaussHeight[2] = input.height()/8;
// initialGaussHeight[3] = input.height()/16;
// initialGaussHeight[4] = input.height()/32;

initialGaussHeight[0] = 560;
initialGaussHeight[1] = 280;
initialGaussHeight[2] = 140;
initialGaussHeight[3] = 70;
initialGaussHeight[4] = 35;


/* Func: gPyramid[J]
Expand All @@ -604,11 +616,6 @@ class HDRPlus : public Halide::Generator<HDRPlus> {
vector<Func> gPyramid(J);
gPyramid[0](x, y, n) = gray(x, y, n);

Func provisional_output;
provisional_output(x, y, c) = gray(x, y, c);
output(x, y, c) = u8(provisional_output(x, y, c));
output.bound(c, 0, 3);

// Maybe try taking this out of the for loop
// for (int j = 1; j < J; j++) {
// // In the google paper, they claim they downsample the bottom level of the pyramid by a factor of 2 and all higher levels by a factor of 4
Expand All @@ -632,10 +639,12 @@ class HDRPlus : public Halide::Generator<HDRPlus> {


// Debugging line
// Func provisional_output;
// provisional_output(x, y, c) = gPyramid[4](x, y, c);
// output(x, y, c) = u8(provisional_output(x, y, c));
// output.bound(c, 0, 3);
Func provisional_output;
provisional_output(x, y, c) = gPyramid[4](x, y, c);
output(x, y, c) = u8(provisional_output(x, y, c));
output.bound(c, 0, 3);
output.bound(x, 0, 39);
output.bound(y, 0, 35);



Expand Down Expand Up @@ -1391,11 +1400,8 @@ class HDRPlus : public Halide::Generator<HDRPlus> {
// alignPyramid[j].compute_at(merge_output, xo);
// }

// const int output_x_size = 40;
// const int output_y_size = 35;

const int output_x_size = 625;
const int output_y_size = 560;
const int output_x_size = 39;
const int output_y_size = 35;


output.bound(x, 0, output_x_size);
Expand All @@ -1413,11 +1419,11 @@ class HDRPlus : public Halide::Generator<HDRPlus> {
provisional_output.compute_at(provisional_output.in(), xo);
provisional_output.store_in(MemoryType::GLB);

// gPyramid[0].compute_at(provisional_output, xo);
// gPyramid[1].compute_at(provisional_output, xo);
// gPyramid[2].compute_at(provisional_output, xo);
// gPyramid[3].compute_at(provisional_output, xo);
// gPyramid[4].compute_at(provisional_output, xo);
gPyramid[0].compute_at(provisional_output, xo);
gPyramid[1].compute_at(provisional_output, xo);
gPyramid[2].compute_at(provisional_output, xo);
gPyramid[3].compute_at(provisional_output, xo);
gPyramid[4].compute_at(provisional_output, xo);

gray.compute_at(provisional_output, xo);
hw_input_copy.compute_at(provisional_output, xo);
Expand Down
4 changes: 2 additions & 2 deletions apps/hardware_benchmarks/apps/hdr_plus/process.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -439,8 +439,8 @@ std::vector<std::string> img_names;


//processor.output = Buffer<uint8_t>(1248, 1120, 3);
//processor.output = Buffer<uint8_t>(40, 35, 3);
processor.output = Buffer<uint8_t>(625, 560, 3);
processor.output = Buffer<uint8_t>(39, 35, 3);
//processor.output = Buffer<uint8_t>(625, 560, 3);

//processor.output = Buffer<uint8_t>(64, 64, 3);

Expand Down

0 comments on commit 8d559c4

Please sign in to comment.