(self)
| 336 | |
| 337 | # schedule graph CALL nodes have a link to jump to codegen |
| 338 | def test_link_sched_codegen(self): |
| 339 | with save_viz() as viz: |
| 340 | c1 = Tensor.empty(4, device="NULL").add(1) |
| 341 | c2 = Tensor.empty(8, device="NULL").add(1) |
| 342 | with Context(SCACHE=0): |
| 343 | sched = c1.schedule_linear(c2) |
| 344 | from tinygrad.engine.realize import compile_linear |
| 345 | sched = compile_linear(sched) |
| 346 | with Context(NO_COLOR=0): |
| 347 | prgs = [to_program(si.src[0], Device[c1.device].renderer).arg.name for si in sched.src] |
| 348 | lst = viz.list_items() |
| 349 | sched_idx = next(i for i,l in enumerate(lst) if l["name"].startswith("Schedule")) |
| 350 | viz_kernel = next(i for i,s in enumerate(lst[sched_idx]["steps"]) if s["name"] == "View Kernel Graph") |
| 351 | with Context(NO_COLOR=1): |
| 352 | graph = next(viz.get_details(sched_idx, viz_kernel))["graph"] |
| 353 | call_nodes = [n for n in graph.values() if n["label"].startswith("CALL")] |
| 354 | for i,n in enumerate(call_nodes): |
| 355 | assert n["ref"] is not None |
| 356 | self.assertEqual(lst[n["ref"]]["name"], prgs[i]) |
| 357 | assert ansistrip(prgs[i]) in n["label"], f"CALL must contain kernel name, got {n['label']}" |
| 358 | |
| 359 | def test_link_sched_codegen_beam(self): |
| 360 | with Context(BEAM=2): |
no test coverage detected