forked from modular/modular
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcustom_op_example.bzl
More file actions
37 lines (34 loc) · 1012 Bytes
/
custom_op_example.bzl
File metadata and controls
37 lines (34 loc) · 1012 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
"""Custom Op example helpers to reduce boilerplate in BUILD.bazel file."""
load("//bazel:api.bzl", "modular_py_binary", "modular_run_binary_test")
def custom_op_example_py_binary(
name,
srcs,
create_test = True,
extra_data = [],
**kwargs):
modular_py_binary(
name = name,
srcs = srcs,
data = [
":kernel_sources",
] + extra_data,
imports = ["."],
mojo_deps = [
"//max:compiler",
"//max:layout",
"//max:MOGGKernelAPI",
"//max:tensor",
"@mojo//:std",
],
visibility = ["//visibility:private"],
testonly = True,
**kwargs
)
# Run each example as a simple non-zero-exit-code test.
# The test inherits target_compatible_with from the binary dependency.
if create_test:
modular_run_binary_test(
name = name + ".example-test",
args = [],
binary = name,
)