|
1 | | -load("@rules_cc//cc:defs.bzl", "cc_library") |
2 | 1 | load("@bazel_skylib//lib:paths.bzl", "paths") |
| 2 | +load("@rules_cc//cc:defs.bzl", "cc_library") |
3 | 3 |
|
4 | 4 | CPU_CAPABILITY_NAMES = ["DEFAULT", "AVX2"] |
5 | 5 | CAPABILITY_COMPILER_FLAGS = { |
@@ -47,34 +47,37 @@ def intern_build_aten_ops(copts, deps): |
47 | 47 | def generate_aten_impl(ctx): |
48 | 48 | # Declare the entire ATen/ops/ directory as an output |
49 | 49 | ops_dir = ctx.actions.declare_directory("aten/src/ATen/ops") |
50 | | - outputs=[ops_dir] + ctx.outputs.outs |
| 50 | + outputs = [ops_dir] + ctx.outputs.outs |
51 | 51 |
|
52 | 52 | install_dir = paths.dirname(ops_dir.path) |
53 | | - tool_inputs, tool_inputs_manifest = ctx.resolve_tools(tools=[ctx.attr.generator]) |
| 53 | + tool_inputs, tool_inputs_manifest = ctx.resolve_tools(tools = [ctx.attr.generator]) |
54 | 54 | ctx.actions.run_shell( |
55 | | - outputs=outputs, |
56 | | - inputs=ctx.files.srcs, |
57 | | - command=ctx.executable.generator.path + " $@", |
58 | | - arguments=["--source-path", "aten/src/ATen", |
59 | | - "--per-operator-headers", |
60 | | - "--install_dir", install_dir], |
61 | | - tools=tool_inputs, |
62 | | - input_manifests=tool_inputs_manifest, |
63 | | - use_default_shell_env=True, |
| 55 | + outputs = outputs, |
| 56 | + inputs = ctx.files.srcs, |
| 57 | + command = ctx.executable.generator.path + " $@", |
| 58 | + arguments = [ |
| 59 | + "--source-path", |
| 60 | + "aten/src/ATen", |
| 61 | + "--per-operator-headers", |
| 62 | + "--install_dir", |
| 63 | + install_dir, |
| 64 | + ], |
| 65 | + tools = tool_inputs, |
| 66 | + input_manifests = tool_inputs_manifest, |
| 67 | + use_default_shell_env = True, |
64 | 68 | ) |
65 | | - return [DefaultInfo(files=depset(outputs))] |
66 | | - |
| 69 | + return [DefaultInfo(files = depset(outputs))] |
67 | 70 |
|
68 | 71 | generate_aten = rule( |
69 | 72 | implementation = generate_aten_impl, |
70 | 73 | attrs = { |
71 | | - "outs": attr.output_list(), |
72 | | - "srcs": attr.label_list(allow_files=True), |
73 | 74 | "generator": attr.label( |
74 | | - executable=True, |
75 | | - allow_files=True, |
76 | | - mandatory=True, |
77 | | - cfg="exec", |
| 75 | + executable = True, |
| 76 | + allow_files = True, |
| 77 | + mandatory = True, |
| 78 | + cfg = "exec", |
78 | 79 | ), |
79 | | - } |
| 80 | + "outs": attr.output_list(), |
| 81 | + "srcs": attr.label_list(allow_files = True), |
| 82 | + }, |
80 | 83 | ) |
0 commit comments