diff options
| author | Solthodox <100046219+Solthodox@users.noreply.github.com> | 2026-11-23 16:55:11 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-11-23 09:55:11 -0600 |
| commit | 9b72d0d2cc81a4c49a0085e0efffa6a6f4e44fdd (patch) | |
| tree | 83229b08cb257c5ea34c3d4423d7e7a6a9197360 /runtime | |
| parent | d231919b88c9ee5aa4da75a4333dfd2da60b6aba (diff) | |
tests: check sparse buffer sharing evidence within each API dump record (#6756)
Squash-merged after diff review of PR #6756 - tests: verify sparse queue-family indices within each buffer record
Diffstat (limited to 'runtime')
| -rw-r--r-- | runtime/test/check_sparse_queue_family.py | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/runtime/test/check_sparse_queue_family.py b/runtime/test/check_sparse_queue_family.py index d77887726..27ebc1f5d 100644 --- a/runtime/test/check_sparse_queue_family.py +++ b/runtime/test/check_sparse_queue_family.py | |||
| @@ -40,26 +40,31 @@ CASE = re.compile(r"^RESULT (LAYER_MAP_(?:DIRECT|COPY|COMPUTE)_COPY_COMPUTE) PAS | |||
| 40 | 40 | ||
| 41 | def check_trace(path: Path, expect_exclusive: bool) -> tuple[int, int]: | 41 | def check_trace(path: Path, expect_exclusive: bool) -> tuple[int, int]: |
| 42 | rows = path.read_text(encoding="utf-8", errors="replace").splitlines() | 42 | rows = path.read_text(encoding="utf-8", errors="replace").splitlines() |
| 43 | seen = [] | 43 | records = 0 |
| 44 | for i, line in enumerate(rows): | 44 | for i, line in enumerate(rows): |
| 45 | if SPARSE_FLAGS not in line: | 45 | if SPARSE_FLAGS not in line: |
| 46 | continue | 46 | continue |
| 47 | tail = "\n".join(rows[i + 1 : i + 13]) | 47 | end = i + 1 |
| 48 | while end < len(rows) and "VkBufferCreateFlags =" not in rows[end] and not CALL_HEAD.match(rows[end]): | ||
| 49 | end += 1 | ||
| 50 | tail = "\n".join(rows[i + 1:end]) | ||
| 48 | mode, count = MODE.search(tail), COUNT.search(tail) | 51 | mode, count = MODE.search(tail), COUNT.search(tail) |
| 49 | if not mode or not count: | 52 | if not mode or not count: |
| 50 | raise AssertionError(f"incomplete API dump sparse VkBuffer at line {i+1}") | 53 | raise AssertionError(f"incomplete API dump sparse VkBuffer at line {i+1}") |
| 51 | inds = tuple(int(index) for _, index in INDICES.findall(tail)) | 54 | sharing, n = mode.group(1), int(count.group(1)) |
| 52 | seen.append((mode.group(1), int(count.group(1)), inds)) | 55 | indices = [(int(slot), int(family)) for slot, family in INDICES.findall(tail)] |
| 53 | if len(seen) < 6 or len(seen) % 2: | 56 | if expect_exclusive: |
| 54 | raise AssertionError(f"insufficient sparse VkBuffer create-info records: {len(seen)}") | 57 | if sharing != "VK_SHARING_MODE_EXCLUSIVE" or n != 0 or indices: |
| 55 | if expect_exclusive: | 58 | raise AssertionError(f"baseline negative control not reproduced at line {i+1}") |
| 56 | assert all(mode == "VK_SHARING_MODE_EXCLUSIVE" and count == 0 | 59 | elif (sharing != "VK_SHARING_MODE_CONCURRENT" or n < 2 or len(indices) != n |
| 57 | for mode, count, _ in seen), f"baseline negative control not reproduced: {set(seen)}" | 60 | or len({slot for slot, _ in indices if slot < n}) != n |
| 58 | else: | 61 | or len({family for _, family in indices}) != n): |
| 59 | assert all(mode == "VK_SHARING_MODE_CONCURRENT" and count >= 2 and len(inds) == count | 62 | raise AssertionError(f"incomplete or non-concurrent sparse buffer at line {i+1}: " |
| 60 | and len(set(inds)) == count | 63 | f"{sharing}, count={n}, indices={indices}") |
| 61 | for mode, count, inds in seen), f"BUG: not all sparse buffers share active families: {set(seen)}" | 64 | records += 1 |
| 62 | return len(seen) // 2, len(seen) | 65 | if records < 6 or records % 2: |
| 66 | raise AssertionError(f"insufficient sparse VkBuffer create-info records: {records}") | ||
| 67 | return records // 2, records | ||
| 63 | 68 | ||
| 64 | 69 | ||
| 65 | def main() -> int: | 70 | def main() -> int: |