(entry_func_name)
| 130 | @pytest.mark.skipif(not env.has_gpu(), reason="need gpu") |
| 131 | @requires_tensorrt_runtime |
| 132 | def 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 |
nothing calls this directly
no test coverage detected
searching dependent graphs…