MCPcopy Index your code
hub / github.com/apache/tvm / build_arm

Function build_arm

tests/python/codegen/test_target_codegen_cross_llvm.py:65–97  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

63 assert struct.unpack(endian + "h", arr[0x12:0x14])[0] == e_machine
64
65 def build_arm():
66 target = {"kind": "llvm", "mtriple": "armv7-none-linux-gnueabihf"}
67 if not tvm.runtime.enabled("llvm"):
68 print(f"Skip because {target} is not enabled..")
69 return
70 temp = utils.tempdir()
71 f = tvm.tirx.build(AddModule, target=target)
72 path = temp.relpath("myadd.o")
73 f.write_to_file(path)
74 verify_elf(path, 0x28)
75 asm_path = temp.relpath("myadd.asm")
76 f.write_to_file(asm_path)
77 # Do a RPC verification, launch kernel on Arm Board if available.
78 host = os.environ.get("TVM_RPC_ARM_HOST", None)
79 remote = None
80 if host:
81 port = int(os.environ["TVM_RPC_ARM_PORT"])
82 try:
83 remote = rpc.connect(host, port)
84 except RuntimeError as e:
85 pass
86
87 if remote:
88 remote.upload(path)
89 farm = remote.load_module("myadd.o")
90 dev = remote.cpu(0)
91 n = nn
92 a = tvm.runtime.tensor(np.random.uniform(size=n).astype("float32"), dev)
93 b = tvm.runtime.tensor(np.random.uniform(size=n).astype("float32"), dev)
94 c = tvm.runtime.tensor(np.zeros(n, dtype="float32"), dev)
95 farm(a, b, c)
96 tvm.testing.assert_allclose(c.numpy(), a.numpy() + b.numpy())
97 print("Verification finish on remote..")
98
99 build_arm()
100

Callers 1

test_llvm_add_pipelineFunction · 0.85

Calls 14

printFunction · 0.85
verify_elfFunction · 0.85
relpathMethod · 0.80
uniformMethod · 0.80
numpyMethod · 0.80
enabledMethod · 0.45
buildMethod · 0.45
getMethod · 0.45
connectMethod · 0.45
uploadMethod · 0.45
load_moduleMethod · 0.45
cpuMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…