Brian Silverman | 3fec648 | 2020-01-19 17:56:20 -0800 | [diff] [blame] | 1 | def fast_gaussian(sigmas, sizes): |
Austin Schuh | a4f69d6 | 2020-02-28 13:58:14 -0800 | [diff] [blame] | 2 | files = [] |
| 3 | for _, sigma_name, _ in sigmas: |
| 4 | for cols, rows in sizes: |
| 5 | files.append("fast_gaussian_%dx%d_%s" % (cols, rows, sigma_name)) |
| 6 | for _, sigma_name, _ in sigmas: |
| 7 | for cols, rows in sizes: |
| 8 | files.append("fast_gaussian_subtract_%dx%d_%s" % (cols, rows, sigma_name)) |
Brian Silverman | 3fec648 | 2020-01-19 17:56:20 -0800 | [diff] [blame] | 9 | for cols, rows in sizes: |
Austin Schuh | a4f69d6 | 2020-02-28 13:58:14 -0800 | [diff] [blame] | 10 | files.append("fast_subtract_%dx%d" % (cols, rows)) |
Brian Silverman | 3fec648 | 2020-01-19 17:56:20 -0800 | [diff] [blame] | 11 | |
Austin Schuh | a4f69d6 | 2020-02-28 13:58:14 -0800 | [diff] [blame] | 12 | params = struct( |
| 13 | sigmas = sigmas, |
| 14 | sizes = sizes, |
| 15 | ) |
Brian Silverman | 3fec648 | 2020-01-19 17:56:20 -0800 | [diff] [blame] | 16 | |
Austin Schuh | a4f69d6 | 2020-02-28 13:58:14 -0800 | [diff] [blame] | 17 | headers = [f + ".h" for f in files] + [ |
| 18 | "fast_gaussian_all.h", |
| 19 | ] |
| 20 | objects = [f + ".o" for f in files] + [ |
| 21 | "fast_gaussian_runtime.o", |
| 22 | ] |
| 23 | htmls = [f + ".html" for f in files] |
Brian Silverman | 3fec648 | 2020-01-19 17:56:20 -0800 | [diff] [blame] | 24 | |
Austin Schuh | a4f69d6 | 2020-02-28 13:58:14 -0800 | [diff] [blame] | 25 | native.genrule( |
| 26 | name = "generate_fast_gaussian", |
| 27 | tools = [ |
| 28 | ":fast_gaussian_runner", |
| 29 | ], |
| 30 | cmd = " ".join([ |
| 31 | "$(location fast_gaussian_runner)", |
| 32 | "'" + params.to_json() + "'", |
| 33 | # TODO(Brian): This should be RULEDIR once we have support for that. |
| 34 | "$(@D)", |
| 35 | "$(TARGET_CPU)", |
| 36 | ]), |
| 37 | outs = headers + objects + htmls, |
| 38 | restricted_to = [ |
| 39 | "//tools:k8", |
| 40 | "//tools:armhf-debian", |
| 41 | ], |
| 42 | ) |
Brian Silverman | 3fec648 | 2020-01-19 17:56:20 -0800 | [diff] [blame] | 43 | |
Austin Schuh | a4f69d6 | 2020-02-28 13:58:14 -0800 | [diff] [blame] | 44 | native.cc_library( |
| 45 | name = "fast_gaussian_all", |
| 46 | hdrs = ["fast_gaussian_all.h"], |
| 47 | srcs = headers + objects, |
| 48 | deps = [ |
| 49 | "//third_party:halide_runtime", |
| 50 | ], |
| 51 | restricted_to = [ |
| 52 | "//tools:k8", |
| 53 | "//tools:armhf-debian", |
| 54 | ], |
| 55 | ) |