MCPcopy Create free account
hub / github.com/apache/tvm / normalize_prim_func

Function normalize_prim_func

python/tvm/s_tir/dlight/analysis/common_analysis.py:290–323  ·  view source on GitHub ↗

Normalize the primfunc to normal form

(sch: s_tir.Schedule)

Source from the content-addressed store, hash-verified

288
289
290def normalize_prim_func(sch: s_tir.Schedule) -> list[SBlockInfo] | None:
291 """Normalize the primfunc to normal form"""
292 try:
293 result = _normalize_prim_func(sch)
294 if result is None:
295 return None
296 except Exception: # pylint: disable=broad-except
297 return None
298
299 def _iter_kind(i: tirx.IterVar) -> str:
300 return {
301 tirx.IterVar.DataPar: "S",
302 tirx.IterVar.CommReduce: "R",
303 }.get(i.iter_type, "O")
304
305 blocks: list[SBlockInfo] = []
306 for block, loops, iters, is_reduction in zip(*result):
307 blocks.append(
308 SBlockInfo(
309 name=sch.get(block).name_hint,
310 iters=[
311 IterInfo(
312 kind=_iter_kind(iter), # type: ignore
313 var=iter.var,
314 dom=iter.dom.extent,
315 loop_rv=loop,
316 )
317 for loop, iter in zip(loops, iters)
318 ],
319 block_rv=block,
320 reduction_block=is_reduction,
321 )
322 )
323 return blocks
324
325
326def get_sblock_info(sch: s_tir.Schedule, block: s_tir.schedule.SBlockRV) -> SBlockInfo:

Callers 9

my_tile_and_bindFunction · 0.90
applyMethod · 0.85
applyMethod · 0.85
applyMethod · 0.85
applyMethod · 0.85
applyMethod · 0.85
applyMethod · 0.85
applyMethod · 0.85
applyMethod · 0.85

Calls 5

SBlockInfoClass · 0.85
IterInfoClass · 0.85
_iter_kindFunction · 0.70
appendMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…