mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 21:45:54 +01:00
[PR #1261] tools/rdna2spirv: balance --shard by file size and fail fast on stat error (OLD-9779) #1293
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#1293
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/1261
Author: @ambroseautomation
Created: 11/24/2026
Status: 🔄 Open
Base:
main← Head:carry/old-9779-shard-size-balance📝 Commits (2)
533e3fatools: --shard balances by size instead of taking every n-th shaderdaf7362rdna2spirv: a shard stops when it cannot size a file, instead of guessing 0📊 Changes
2 files changed (+115 additions, -3 deletions)
View changed files
➕
tests/test_rdna2spirv_shard.py(+83 -0)📝
tools/rdna2spirv.py(+32 -3)📄 Description
Claimed in the coordination issue as: OLD-9779 (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7144358109)
What and why
Carries forward
old-pr/9779(draft #57, original commit authorpes7preserved across both commits; indexed in #17), rebased cleanly onto currentmain(0b45fdc21).Replaces round-robin
files[index::count]sharding intools/rdna2spirv.pywith deterministic size-balanced greedy bucketing (shard_bucket()):.asmfiles largest-first byos.path.getsizeand assigns each to the lightest bucket so far, then returns the requested shard's bucket in name order — reducing parallel shader-stage makespan on skewed shader corpora while producing byte-identical output and requiring no inter-process coordination.os.path.getsizeraisesOSErrorinstead of silently substituting weight 0 (which could cause two shards to disagree on the partition and produce duplicates/holes on merge).tests/test_rdna2spirv_shard.pycovering partition completeness/disjointness, cross-process determinism, single-shard passthrough, skewed-corpus balance vs. round-robin, and fail-fast behavior on unreadable file sizes.Tested
python -I tests/test_rdna2spirv_shard.py -v: 5 tests, OK.python -m compileall -q make_game.py tools tests: exit 0.python -I tools/rdna2spirv.py --help: exit 0.python -I scripts/check_no_game_data.py tools/rdna2spirv.py tests/test_rdna2spirv_shard.py: exit 0 (no game data).GPUs tested: n/a (CLI sharding logic + stdlib unit tests on Windows 11 Pro 64-bit, Python 3.12.10)
AI-assisted: yes
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (n/a — CLI sharding only, no codegen changes)🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.