masahi commented on code in PR #16128: URL: https://github.com/apache/tvm/pull/16128#discussion_r1397844561
########## python/tvm/contrib/msc/core/transform/pattern.py: ########## @@ -26,6 +27,27 @@ from tvm.relax.transform import PatternCheckContext from tvm.relax.backend.pattern_registry import register_patterns from tvm.relay.op.contrib.register import register_pattern_table +from tvm.contrib.msc.core.utils.namespace import MSCMap, MSCKey +from tvm.contrib.msc.core import utils as msc_utils + + +def msc_attrs_getter(context: PatternCheckContext, anchor: str = "out") -> Dict[str, str]: + """Get attributes for fused pattern + + Returns + ------- + attrs: dict<str,str> + The extra attributes for msc. + """ + + fused_cnt = MSCMap.get(MSCKey.FUSED_CNT, 0) + unique_name = "msc_fused_" + str(fused_cnt) + if anchor in context.annotated_expr: Review Comment: So what you really need from `PatternCheckContext` is just `annotated_expr`. Please follow my comment in https://github.com/apache/tvm/pull/16128#discussion_r1396423174. The getter function can just ingest `Map<String, Expr>` rather than `PatternCheckContext -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
