use unittest helpers in TestTensorMetadata [pr] (#7329)

* use unittest helpers in TestTensorMetadata [pr]

* fix that

* 5 args
This commit is contained in:
qazal
2024-10-28 12:38:30 +02:00
committed by GitHub
parent 96fcc47e27
commit e46edc22aa
3 changed files with 26 additions and 26 deletions

View File

@@ -8,10 +8,10 @@ class ProcessReplayContext:
loc: str
head_sha: str
run_id: Optional[int]
def get_process_replay_ctx() -> Tuple[Dict, ProcessReplayContext]:
def get_process_replay_ctx() -> Tuple[ProcessReplayContext, Dict]:
stack = filter(lambda x: "tinygrad" in x.filename and not any(n in x.filename for n in ["engine/schedule.py", "engine/realize.py", \
"codegen/kernel.py", "unittest"]), traceback.extract_stack()[:-1])
loc = "\n".join(traceback.format_list(stack))
try: head_sha = subprocess.check_output(["git", "rev-parse", "HEAD"]).strip().decode()
except Exception: head_sha = ""
return {k:v.value for k,v in ContextVar._cache.items()}, ProcessReplayContext(loc, head_sha, getenv("GITHUB_RUN_ID") or None)
return ProcessReplayContext(loc, head_sha, getenv("GITHUB_RUN_ID") or None), {k:v.value for k,v in ContextVar._cache.items()}

View File

@@ -29,7 +29,7 @@ if REF == "master": SKIP_PROCESS_REPLAY = True
# *** recreators
def recreate_sched(sink:UOp, ctx:ScheduleItemContext) -> UOp: return full_ast_rewrite(sink, ctx)
def recreate_kernel(ast:UOp, opts:Renderer, applied_opts:List[Opt], name:str) -> str:
def recreate_kernel(ast:UOp, opts:Renderer, applied_opts:List[Opt], name:str, _) -> str:
k = Kernel(ast, opts=opts)
for opt in applied_opts: k.apply_opt(opt)
# NOTE: replay with the captured renderer, not the one in master