viz table view (#6743)

* fix matcher with ctx

* current_kernel fix

* add table

* make the right things clickable

* some more init work

* add kernel resizer

* Revert "add kernel resizer"

This reverts commit 035eef37039aa1e848a766a29e3c4e81bbff2bab.

* allow scroll
This commit is contained in:
qazal 2024-09-27 10:26:46 +08:00 committed by GitHub
parent bea7ed5986
commit 98a81b36e1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 7 additions and 5 deletions

View File

@ -704,6 +704,7 @@ class Kernel:
# **** this is the lowerer ****
def linearize(self) -> Kernel:
if TRACK_MATCH_STATS >= 2: _CURRENT_KERNEL.set(self.name)
modified_ast = self.get_optimized_ast()
if DEBUG >= 3:
@ -713,7 +714,6 @@ class Kernel:
print(self.applied_opts)
verify_ast(modified_ast)
if TRACK_MATCH_STATS >= 2: _CURRENT_KERNEL.set(self.name)
self.uops:List[UOp] = linearize_uop(full_graph_rewrite(ast_to_uop(modified_ast, self.opts), self.opts))
if TRACK_MATCH_STATS >= 2: _CURRENT_KERNEL.set(None)
if DEBUG >= 5: print_uops(self.uops)

View File

@ -42,6 +42,7 @@
ul {
padding: 0;
color: #7c7d85;
white-space: nowrap;
cursor: pointer;
}
ul.active {
@ -242,11 +243,11 @@
const kernelList = document.querySelector(".container.kernel-list");
kernelList.innerHTML = "";
kernels.forEach((k, i) => {
kernelUl = Object.assign(document.createElement("ul"), { key: `kernel-${i}`, className: i === currentKernel ? "active" : "" });
const p = Object.assign(document.createElement("p"), {id: `kernel-${k.name}`, innerText: k.name})
kernelUl = Object.assign(document.createElement("ul"), { key: `kernel-${i}`, className: i === currentKernel ? "active" : "", style: "overflow-x: auto; cursor: initial;" });
const p = Object.assign(document.createElement("p"), {id: `kernel-${k.name}`, innerText: k.name, style: "cursor: pointer;"});
kernelUl.appendChild(p)
k.ctxs.forEach((u, j) => {
const rwUl = Object.assign(document.createElement("ul"), { innerText: `${u.filename} - ${u.match_count}`, key: `uop-rewrite-${j}`, className: (j === currentUOp && i == currentKernel) ? "active" : "" })
const rwUl = Object.assign(document.createElement("ul"), { innerText: `${u.filename} - ${u.match_count} - ${u.matcher_name}`, key: `uop-rewrite-${j}`, className: (j === currentUOp && i == currentKernel) ? "active" : "" })
rwUl.style.display = i === currentKernel && expandKernel ? "block" : "none";
rwUl.onclick = (e) => {
e.stopPropagation();

View File

@ -30,7 +30,8 @@ class RewriteLocation:
fp, lineno = ctx.loc
p = r"graph_rewrite\([^,]+,\s*([^>]+)\)"
match = re.search(p, code:=lines(fp)[lineno-1].strip())
return RewriteLocation(f"{fp.split('/')[-1]}:{lineno}", code, match.group(1) if match is not None else None, len(graph_rewrites(ctx)))
return RewriteLocation(f"{fp.split('/')[-1]}:{lineno}", code, match.group(1).split(",")[0] if match is not None else None,
len(graph_rewrites(ctx)))
def to_json(self): return asdict(self)
@dataclass(frozen=True)