MCPcopy
hub / github.com/tinygrad/tinygrad / _parse_llvm_tests

Function _parse_llvm_tests

test/amd/test_llvm.py:46–60  ·  view source on GitHub ↗
(text: str, pattern: str)

Source from the content-addressed store, hash-verified

44 'gfx12_asm_wmma_w32.s']
45
46def _parse_llvm_tests(text: str, pattern: str) -> list[tuple[str, bytes]]:
47 tests = []
48 for block in text.split('\n\n'):
49 asm_text, encoding = None, None
50 for line in block.split('\n'):
51 line = line.strip()
52 if not line or line.startswith(('.', ';')): continue
53 if not line.startswith('//'):
54 asm_text = line.split('//')[0].strip() or asm_text
55 if m := re.search(pattern + r'[^:]*:.*?(?:encoding:\s*)?\[(0x[0-9a-f,x\s]+)\]', line, re.I):
56 encoding = m.group(1).replace('0x', '').replace(',', '').replace(' ', '')
57 if asm_text and encoding:
58 try: tests.append((asm_text, bytes.fromhex(encoding)))
59 except ValueError: pass
60 return tests
61
62def _get_tests_uncached(f: str, arch: str) -> list[tuple[str, bytes]]:
63 text = fetch(f"{LLVM_BASE}/{f}").read_bytes().decode('utf-8', errors='ignore')

Callers 1

_get_tests_uncachedFunction · 0.85

Calls 4

splitMethod · 0.80
appendMethod · 0.80
replaceMethod · 0.45
groupMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…