forked from halide/Halide
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/halide/Halide
- Loading branch information
Showing
14 changed files
with
177 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#include <Halide.h> | ||
#include <stdio.h> | ||
|
||
using namespace Halide; | ||
|
||
int main(int argc, char **argv) { | ||
Image<int8_t> im(1697); | ||
|
||
// A strided load with stride two loads a pair of vectors and | ||
// shuffles out the elements like so: | ||
// A0 A1 A2 A3 B0 B1 B2 B3 -> A0 A2 B0 B2 | ||
|
||
// That technique applied to the following would read beyond the | ||
// input, so the second load actually gets pushed backwards (or | ||
// valgrind would complain). | ||
Func f, g; | ||
Var x; | ||
f(x) = im(2*x); | ||
f.compute_root().vectorize(x, 16).bound(x, 0, 849); | ||
|
||
// However, it's safe to apply it to this step, because f is an | ||
// internal allocation, and halide_malloc adds a safety margin. | ||
g(x) = f(2*x); | ||
g.compute_root().vectorize(x, 16).bound(x, 0, 425); // 24 * 2 = 48 < 49 | ||
|
||
//g.compile_to_assembly("/dev/stdout", std::vector<Argument>(), "g"); | ||
|
||
g.realize(425); | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#include <Halide.h> | ||
#include <stdio.h> | ||
|
||
using namespace Halide; | ||
|
||
int main(int argc, char **argv) { | ||
Func f; | ||
Var x, y; | ||
|
||
ImageParam in(Float(32), 2); | ||
ImageParam x_coord(Int(32), 2); | ||
ImageParam y_coord(Int(32), 2); | ||
|
||
f(x, y) = in(x_coord(x, y), y_coord(x, y)); | ||
|
||
f.compile_jit(); | ||
|
||
printf("I should not have reached here\n"); | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#include <Halide.h> | ||
#include <stdio.h> | ||
|
||
using namespace Halide; | ||
|
||
int main(int argc, char **argv) { | ||
Func f; | ||
Var x, y; | ||
|
||
ImageParam in(Float(32), 2); | ||
ImageParam x_coord(Int(32), 2); | ||
ImageParam y_coord(Int(32), 2); | ||
|
||
f(x, y) = 0.0f; | ||
RDom r(0, 100, 0, 100); | ||
f(x_coord(r.x, r.y), y_coord(r.x, r.y)) += in(r.x, r.y); | ||
|
||
f.compile_jit(); | ||
|
||
printf("I should not have reached here\n"); | ||
|
||
return 0; | ||
} |