MCPcopy Create free account
hub / github.com/FlashSampling/FlashSampling / _validate_insertions

Function _validate_insertions

benchmarking/insert_proton_records.py:204–223  ·  view source on GitHub ↗

Check that we found all expected start/end pairs. Raises on missing scopes.

(insertions: list[tuple[int, str]], filepath: str)

Source from the content-addressed store, hash-verified

202
203
204def _validate_insertions(insertions: list[tuple[int, str]], filepath: str) -> None:
205 """Check that we found all expected start/end pairs. Raises on missing scopes."""
206 texts = [t for _, t in insertions]
207 errors = []
208 for scope in ["kernel", "setup", "mask", "tile-mgmt", "sample", "store"]:
209 has_start = f'start "{scope}"' in texts
210 has_end = f'end "{scope}"' in texts
211 if has_start != has_end:
212 errors.append(
213 f"{filepath}: found {'start' if has_start else 'end'} "
214 f"but not {'end' if has_start else 'start'} for scope {scope!r}"
215 )
216 if not has_start and not has_end:
217 errors.append(f"{filepath}: could not find scope {scope!r}")
218 if errors:
219 raise RuntimeError(
220 "Proton scope insertion failed. Missing scopes indicate the TTGIR "
221 "patterns have changed (compiler renamed variables?).\n"
222 + "\n".join(f" - {e}" for e in errors)
223 )
224
225
226def find_and_process_ttgir(dump_dir: str) -> None:

Callers 1

add_proton_recordsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected