mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 22:45:53 +01:00
[PR #57] tools: --shard balances by file size, so the parallel stage waits for nobody (output byte-identical) #109
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#109
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/57
Author: @Andretuta
Created: 11/24/2026
Status: 🔄 Open
Base:
main← Head:old-pr/9779📝 Commits (2)
30ade56tools: --shard balances by size instead of taking every n-th shaderff80152rdna2spirv: 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
Original 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.)🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.