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

Function test_tensorrt_only

tests/python/relax/test_transform_codegen_pass.py:132–157  ·  view source on GitHub ↗
(entry_func_name)

Source from the content-addressed store, hash-verified

130@pytest.mark.skipif(not env.has_gpu(), reason="need gpu")
131@requires_tensorrt_runtime
132def test_tensorrt_only(entry_func_name):
133 mod, inputs, expected = setup_test()
134
135 if entry_func_name != "main":
136 mod[entry_func_name] = mod
137 del mod["main"]
138
139 # Define patterns that we want to offload to byoc
140 # This test will offload entire model
141 # Thus, define patterns for both `multiply` and `add` ops
142 patterns = [
143 ("tensorrt.multiply", is_op("relax.multiply")(wildcard(), wildcard())),
144 ("tensorrt.add", is_op("relax.add")(wildcard(), wildcard())),
145 ]
146
147 new_mod = tvm.transform.Sequential(
148 [
149 relax.transform.FuseOpsByPattern(patterns),
150 relax.transform.MergeCompositeFunctions(),
151 relax.transform.RunCodegen(),
152 ]
153 )(mod)
154
155 ex0 = tvm.compile(new_mod, target, params={})
156 # Sanity check for the correctness and roundtrip
157 check_roundtrip(ex0, dev, inputs, expected, entry_func_name)
158
159
160@pytest.mark.gpu

Callers

nothing calls this directly

Calls 5

is_opFunction · 0.90
wildcardFunction · 0.90
setup_testFunction · 0.85
check_roundtripFunction · 0.85
compileMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…