Test that all expected patterns are registered
()
| 107 | |
| 108 | |
| 109 | def test_example_npu_patterns_registered(): |
| 110 | """Test that all expected patterns are registered""" |
| 111 | import tvm.relax.backend.contrib.example_npu # noqa: F401 |
| 112 | |
| 113 | patterns = get_patterns_with_prefix("example_npu") |
| 114 | pattern_names = {p.name for p in patterns} |
| 115 | |
| 116 | # Core patterns that should always be available |
| 117 | core_patterns = { |
| 118 | "example_npu.dense", |
| 119 | "example_npu.matmul", |
| 120 | "example_npu.conv1d", |
| 121 | "example_npu.conv2d", |
| 122 | "example_npu.max_pool2d", |
| 123 | } |
| 124 | |
| 125 | assert core_patterns.issubset(pattern_names), ( |
| 126 | f"Missing core patterns: {core_patterns - pattern_names}" |
| 127 | ) |
| 128 | |
| 129 | # Check that at least some activation patterns are available |
| 130 | activation_patterns = {name for name in pattern_names if "relu" in name or "sigmoid" in name} |
| 131 | assert len(activation_patterns) > 0, "No activation patterns found" |
| 132 | |
| 133 | |
| 134 | @example_npu_enabled |
no test coverage detected
searching dependent graphs…