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

Function register_patterns

python/tvm/relax/backend/pattern_registry.py:63–85  ·  view source on GitHub ↗

Register patterns which will be used to partition the DataflowBlock into subgraphs that are supported by external backends. Parameters ---------- patterns: List[Pattern] Patterns to be registered. Patterns that appear later in the list have higher priority when

(patterns: list[Pattern])

Source from the content-addressed store, hash-verified

61
62
63def register_patterns(patterns: list[Pattern]):
64 """
65 Register patterns which will be used to partition the DataflowBlock into
66 subgraphs that are supported by external backends.
67
68 Parameters
69 ----------
70 patterns: List[Pattern]
71 Patterns to be registered. Patterns that appear later in the list have
72 higher priority when partitioning DataflowBlock.
73 """
74 _ensure_cleanup_function_registered()
75
76 entries = []
77 for item in patterns:
78 if isinstance(item, FusionPattern):
79 entries.append(item)
80 elif isinstance(item, tuple):
81 entries.append(FusionPattern(*item))
82 _REGISTERED_PATTERN_NAMES.add(item[0])
83 else:
84 raise TypeError(f"Cannot register type {type(item)} as pattern")
85 _ffi_api.RegisterPatterns(entries)
86
87
88def get_patterns_with_prefix(prefix: str) -> list[FusionPattern]:

Callers 8

nnapi.pyFile · 0.85
patterns.pyFile · 0.85
hipblas.pyFile · 0.85
coreml.pyFile · 0.85
clml.pyFile · 0.85
cublas.pyFile · 0.85
cudnn.pyFile · 0.85
cutlass.pyFile · 0.85

Calls 4

FusionPatternClass · 0.90
appendMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…