Test code generation for the example NPU backend
()
| 203 | |
| 204 | @example_npu_enabled |
| 205 | def test_example_npu_codegen(): |
| 206 | """Test code generation for the example NPU backend""" |
| 207 | import tvm.relax.backend.contrib.example_npu # noqa: F401 |
| 208 | |
| 209 | mod = MatmulReLU |
| 210 | patterns = get_patterns_with_prefix("example_npu") |
| 211 | |
| 212 | # Partition and generate code |
| 213 | partitioned_mod = FuseOpsByPattern(patterns, bind_constants=False, annotate_codegen=True)(mod) |
| 214 | partitioned_mod = MergeCompositeFunctions()(partitioned_mod) |
| 215 | partitioned_mod = RunCodegen()(partitioned_mod) |
| 216 | |
| 217 | assert partitioned_mod is not None |
| 218 | |
| 219 | # The module should now contain external function calls |
| 220 | main_func = partitioned_mod["main"] |
| 221 | assert main_func is not None |
| 222 | |
| 223 | |
| 224 | @example_npu_enabled |
no test coverage detected
searching dependent graphs…