tools: --shard balances by file size, so the parallel stage waits for nobody (output byte-identical) #57
Open
github-bot
wants to merge 2 commits from
github-bot/gh-57 into main
AGit
pull from: github-bot/gh-57
merge into: github:main
github:main
github:docs/animation-merge-remnants
github:docs/story-dedup-and-cli
github:docs/restofworld-merge-remnants
github:docs/gamedata-dedup-tables
github:docs/textures-bcpack-tables-and-cli
github:docs/exe-fail-fast-shims-sync
github:fix/address-guard-wraparound-parity
github:fix/cvt-f16-denorm-and-clamp
github:docs/pso-cache-scope-note
github:docs/viewer-readme
github:docs/textures-arrays-dds-preview
github:docs/conformance-readme-status
github:fix/docs-validators-fences-urls
github:claude/loop-total
github:claude/pops-collision-seed
github:claude/dstorage-hold-page-reads
github:claude/host-image-copy-switch
github:feat/gdk-lifecycle-window-hook
github:claude/d16s8-uav-nvidia-fallback
github:feat/mfplat-offline-shim
github:claude/gameinput-slow-reader
github:fix/rt-null-barrier-clear
github:claude/depth-resolve-sample-positions
github:integration/palmetto-parity
github:claude/valu-literal-sext
github:claude/slot74-pool-handle
github:claude/rgb9e5-uint-alias-view
github:claude/fssm-root-layout-tables
github:feat/gdk-speech-display-lifecycle
github:asset-audio-skip-current
github:qemmhd/old-9940-rectangle-quad-lists
github:feat/ws2-offline-shim
github:qemmhd/rt-d16-unorm-uav
github:feat/xs-device-stops-7-9
github:qemmhd/rt-depth-same-base-shapes
github:qemmhd/rt-lazy-attachment-variant
github:feat/acphal-xma2-decoder
github:asset-audio-skip
github:codex/coord-claim-check-20261124-7e48
github:feat/xs-frame-pacing-presentx
github:feat/xs-device-vm-options
github:old-pr/9844
github:old-pr/9978
github:old-pr/9815
github:old-pr/10057
github:old-pr/9874
github:old-pr/9965
github:old-pr/9863
github:old-pr/10068
github:old-pr/10066
github:old-pr/10067
github:old-pr/10007
github:old-pr/10061
github:old-pr/10065
github:old-pr/10059
github:old-pr/10063
github:old-pr/10055
github:old-pr/10062
github:old-pr/10042
github:old-pr/10041
github:old-pr/10049
github:old-pr/10047
github:old-pr/10046
github:old-pr/10045
github:old-pr/10056
github:old-pr/10043
github:old-pr/10036
github:old-pr/10034
github:old-pr/9984
github:old-pr/10052
github:old-pr/10038
github:old-pr/10033
github:old-pr/10028
github:old-pr/10050
github:old-pr/9891
github:old-pr/9889
github:old-pr/10051
github:old-pr/10019
github:old-pr/10027
github:old-pr/10029
github:old-pr/10031
github:old-pr/10026
github:old-pr/9941
github:old-pr/10030
github:old-pr/10040
github:old-pr/9990
github:old-pr/10021
github:old-pr/9962
github:old-pr/10022
github:old-pr/10020
github:old-pr/10015
github:old-pr/10025
github:old-pr/9886
github:old-pr/10048
github:old-pr/10014
github:old-pr/10011
github:old-pr/9861
github:old-pr/10010
github:old-pr/10008
github:old-pr/9860
github:old-pr/10006
github:old-pr/9920
github:old-pr/9995
github:old-pr/10000
github:old-pr/10016
github:old-pr/10004
github:old-pr/10023
github:old-pr/9982
github:old-pr/9981
github:old-pr/9983
github:old-pr/9970
github:old-pr/9969
github:old-pr/9968
github:old-pr/9971
github:old-pr/9972
github:old-pr/9942
github:old-pr/9963
github:old-pr/9960
github:old-pr/9964
github:old-pr/9985
github:old-pr/9973
github:old-pr/9862
github:old-pr/9953
github:old-pr/10017
github:old-pr/9952
github:old-pr/9955
github:old-pr/9946
github:old-pr/9954
github:old-pr/9938
github:old-pr/9956
github:old-pr/9856
github:old-pr/9947
github:old-pr/9924
github:old-pr/9961
github:old-pr/9927
github:old-pr/9979
github:old-pr/10032
github:old-pr/9926
github:old-pr/5237
github:old-pr/9951
github:old-pr/9931
github:old-pr/9902
github:old-pr/9921
github:old-pr/9994
github:old-pr/9775
github:old-pr/9768
github:old-pr/9905
github:old-pr/9936
github:old-pr/9901
github:old-pr/9904
github:old-pr/9906
github:old-pr/9988
github:old-pr/9908
github:old-pr/9909
github:old-pr/9911
github:old-pr/9912
github:old-pr/9913
github:old-pr/9887
github:old-pr/9916
github:old-pr/9919
github:old-pr/9925
github:old-pr/9933
github:old-pr/9935
github:old-pr/9918
github:old-pr/9879
github:old-pr/9880
github:old-pr/9881
github:old-pr/9996
github:old-pr/9876
github:old-pr/9892
github:old-pr/9899
github:old-pr/9915
github:old-pr/9914
github:old-pr/9872
github:old-pr/9869
github:old-pr/9866
github:old-pr/9819
github:old-pr/10012
github:old-pr/9857
github:old-pr/9893
github:old-pr/9897
github:old-pr/9928
github:old-pr/9868
github:old-pr/9917
github:old-pr/9940
github:old-pr/9873
github:old-pr/9816
github:old-pr/10009
github:old-pr/9900
github:old-pr/9966
github:old-pr/9859
github:old-pr/9843
github:old-pr/9991
github:old-pr/10058
github:old-pr/9883
github:old-pr/9838
github:old-pr/9835
github:old-pr/9959
github:old-pr/9895
github:old-pr/9837
github:old-pr/9858
github:old-pr/9865
github:old-pr/9864
github:old-pr/9840
github:old-pr/9820
github:old-pr/4669
github:old-pr/9848
github:old-pr/9850
github:old-pr/9810
github:old-pr/9799
github:old-pr/9853
github:old-pr/9875
github:old-pr/9831
github:old-pr/9796
github:old-pr/9801
github:old-pr/9813
github:old-pr/9794
github:old-pr/7417
github:old-pr/9781
github:old-pr/9806
github:old-pr/9958
github:old-pr/9809
github:old-pr/9791
github:old-pr/9792
github:old-pr/10053
github:old-pr/9784
github:old-pr/9789
github:old-pr/9849
github:old-pr/9846
github:old-pr/9773
github:old-pr/9785
github:old-pr/9803
github:old-pr/9826
github:old-pr/9839
github:old-pr/9922
github:old-pr/9948
github:old-pr/7189
github:old-pr/9957
github:old-pr/9823
github:old-pr/9807
github:old-pr/9851
github:old-pr/9774
github:old-pr/9830
github:old-pr/9836
github:old-pr/9822
github:old-pr/9783
github:old-pr/9833
github:old-pr/9890
github:old-pr/9770
github:old-pr/9769
github:old-pr/9772
github:old-pr/9787
github:old-pr/9852
github:old-pr/9834
github:old-pr/9845
github:old-pr/9871
github:old-pr/9771
github:old-pr/9776
github:old-pr/10005
github:old-pr/9949
github:old-pr/9923
github:old-pr/9805
github:old-pr/9829
github:old-pr/9790
github:old-pr/9827
github:old-pr/9929
github:old-pr/9855
github:old-pr/9934
github:old-pr/9907
github:old-pr/9910
github:old-pr/9779
github:old-pr/9780
github:old-pr/9885
github:old-pr/9882
github:old-pr/9877
github:old-pr/9998
github:old-pr/4251
github:old-pr/9987
github:old-pr/9989
github:old-pr/9950
github:old-pr/9777
github:old-pr/10044
github:old-pr/9884
github:old-pr/2906
github:old-pr/5076
github:old-pr/9937
github:old-pr/9986
github:old-pr/3014
github:old-pr/9943
github:old-pr/9939
github:old-pr/4682
github:old-pr/4765
No reviewers
Labels
Clear labels
accessibility
Barrier affecting people with disabilities
bug
Something isn't working
documentation
Improvements or additions to documentation
duplicate
This issue or pull request already exists
enhancement
New feature or request
good first issue
Good for newcomers
help wanted
Extra attention is needed
invalid
This doesn't seem right
missing claim
Needs a claim in #14
needs rebase
Conflicts with the base branch: rebase it on main
question
Further information is requested
wontfix
This will not be worked on
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
missing claim
needs rebase
question
wontfix
Milestone
Clear milestone
No items
No milestone
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".
No due date set.
Dependencies
No dependencies set
Reference
github/ubiquitarianism--leonida!57
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-57"
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?
@Andretuta on GitHub · 2026-11-24 02:09 UTC · original
ubiquitarianism:old-pr/9779→main· +115 −3 · 2 files · 2 commits · draftOriginal description (mentions and
#Nreferences are disabled; the numbers refer to the old repository):The parallel translation stage waits for its slowest shard, and the split ignores size. This balances the shards on input size; on a real 247-listing run the shards come out level and every output stays byte-identical.
--shard i/ntookfiles[index::count]— round-robin over the name-sorted list, which balances nothing when shaders differ in size.shard_bucket()sorts by file size, largest first, and gives each file to the lightest bucket so far; a shard translates its own bucket. Every shard derives the same partition from the same directory listing, so the processes still do not talk to each other,make_game.pyand the--shard i/ninterface are unchanged, and each bucket is still handed out in name order.Measured
Independent run by
@nicolasaboschon 247 listings, four--shard i/4runs plus--mergeagainst one unsharded run:.spvfiles on both sides, all 258 byte-identical; merge has 247 entries;And on the real 26,503-listing corpus by
@exotiquee: round-robin is already within 2.6% of even at 8 shards and 6.8% at 16, so the honest expected gain there is 0-7%, growing with the shard count; the change levels the tail rather than rescaling the stage. That correction is in this description on purpose — the synthetic corpus I first measured on was skewed far more than the real one, and its 17-26% is not the claim.A size that cannot be read stops the shard
Reported by
@Zhenyettta: with a weight of 0 for one unreadable file, two shards can take the same shader while a third falls out of every bucket. Each shard derives the partition alone, so the one thing that must not happen is a shard placing a file by a number the others do not have.shard_bucket()now raises with the path and the advice to run the shard again.Tests
tests/test_rdna2spirv_shard.py(5): the buckets are disjoint and complete for 1/2/3/4/8/16 shards, the same partition in every process, name order inside a bucket, a skewed listing beatsfiles[::n]at 2/4/8 shards, one shard takes everything, and an unreadable size is refused.--mergeandtest_rdna2spirv_merge.pyare unchanged. Independent runs also confirm resume:make_game.translate's plan includestranslator_digest(), so parts from the old bucketing are never merged with new ones.cc
@ItsNotRexed@KoertLichtendonkChecklist
docs/design.md. (Not applicable: same shaders, translated by a different process.)files[index::count] balanced nothing. Shaders differ in size by two orders of magnitude, so a round-robin split can hand one shard most of the work while every other process waits for it, and the stage is as slow as its heaviest shard. shard_bucket() sorts by file size (largest first) and gives each file to the lightest bucket so far, then a shard takes its own bucket. Every shard computes the same partition from the same directory listing, so the processes still do not talk to each other, and each bucket is handed out in name order. Measured on a synthetic corpus shaped like the real one (96 shaders of 200 instructions, 16 of 2,000, 6 of 12,000; largest 10% of the total; per-file time measured, then makespan over the buckets): shards round-robin shard_bucket gain 2 2.15s 2.15s 1.00x 4 1.28s 1.09s 1.17x 8 0.65s 0.55s 1.18x 16 0.53s 0.42s 1.26x The corpus is synthetic: what the real skew is has to be measured with game data, which is why the change keeps the interface (--shard i/n) and the fallback (a file whose size cannot be read is scheduled, with weight 0) intact. tests/test_rdna2spirv_shard.py checks the partition (disjoint, complete, deterministic, name order within a bucket), that a skewed listing beats round-robin at every shard count, and that an unreadable file is not dropped.@wavehs on GitHub · 2026-11-24 02:38 UTC · original
macOS arm64 verification (Apple M3 Pro) — the size-balanced partition is deterministic, measurably better on this repo's own listings, and the tests bite
Head
ff80152d2(2 commits, branch base1cc6e3c12: 1,250 commits behindmain), merged ontomain(9ec34cdff) asc6b46bfe4cleanly. 2 files +115/−3. Host: macOS 27.2.1, Apple M3 Pro (arm64), CPython 3.15.2, llvm-mc 23.1.5, MoltenVK 1.4.0, KosmicKrisp (Mesa 26.3.0).Because the branch predates a lot of
main, I checked that the merge did not smuggle anything back:git diff ubi/main c6b46bfe4 -- tools/rdna2spirv.pyis exactly the newshard_bucket, the two-line caller change and the help text — main's 1,250 later commits are intact in the merged tree.c6b46bfe4main9ec34cdfftests/test_rdna2spirv_shard.pyrdna2spirv.py: 5 errorsscripts/run_semantic_tests.py tests/semantictest_exec_computed,test_image_atomics_guardrun_gpu_tests.pyall cases, MoltenVKrun_gpu_tests.pyall cases, KosmicKrispThe GPU rows are identical to
mainline for line on both drivers after normalising work paths, as expected for a partitioning change; the disk build from the previous merge is reused, the translator is this merge's.Negative controls, two of them. (1) Main's
rdna2spirv.pywith the new test file: 5 errors, allAttributeError: module 'rdna2spirv' has no attribute 'shard_bucket'. (2) That only proves the name exists, so I substituted the oldfiles[index::count]into the same assertions the test makes, on its own skewed corpus: the size-based span is 6000 at 2, 4 and 8 shards, the round-robin span is 6300/6150/6120, and the test'sassertLess(span, round_robin)fails for the round-robin version at every shard count. So the test catches a regression to the old split, not just a missing function.Measured on real listings, not the synthetic ones. The repo's 104 semantic fixture listings (247,985 bytes, largest 9.1% of the total — close to the PR's 11% case):
At 12 shards the old split gives one process the 22,484-byte listing alone and another 6,000 bytes, which is exactly the "everyone waits for the biggest shard" case the PR describes; the new one is within 10%. The PR's 1.18x/1.30x at 4/8 shards is the same direction and magnitude.
Wiring checked end to end:
tools/rdna2spirv.py tests/semantic/fixtures/disasm --out … --shard i/4 --limit 40reports 9, 10, 10 and 11 shaders. That is exactlyshard_bucket's buckets over the same 40 files (18,572 / 18,449 / 18,270 / 18,393 bytes), wherefiles[i::4]would be 10/10/10/10 — so the call site really uses the partition, not only the function. (Those fixtures then fail to translate for an unrelated, expected reason: they have no FSSM or shader container, so I am quoting the counts, not translations.)The code is right for the way shards run. Every process re-lists the directory, sorts by
(-size, path), and breaks load ties by bucket index, so the partitions agree without the processes talking; the returned bucket is sorted again, keeping "handed out in name order".min(range(count), …)per file is O(files × shards): 26,503 × 12 is nothing next to the translation. RaisingOSErrorinstead of a 0 weight is the right call given that a disagreement silently produces a corpus with a file twice and one missing — and the message names the file and says to retry. One limit worth knowing: the CLI cannot easily reach that path (a dangling.ssymlink is dropped by the file discovery before the partition), so the unit test is the whole cover; that is fine, not a defect.Two small notes, neither blocking:
--limitis still applied before the partition (files = files[:a.limit]then shard), so--limit N --shard i/nmeans "the first N listings, split", which is what it meant before. Worth keeping that sentence in mind if the flag's help is ever expanded.make_game.pyrun at 4 and 8 shards before/after (the 80-minute figure indocs/pipeline_check.md:450) would turn the 1.18x/1.30x into a number from the 26k corpus.No game files. AI-assisted.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.