mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-05 15:58:53 +00:00
Layer split auto: credit the trim's freed VRAM to CUDA0 only, not to the later stages
The search adds what the trim frees to each stage's room for experts. That is right for CUDA0, whose arena holds the dense weights of all layers when the search runs and gives back everything outside its own layers when it reloads trimmed. A later stage has not loaded anything yet when the search runs (its weights load after the split is known) and the search already prices its trimmed weights, so crediting it the bytes a trim would free counted the same bytes twice and handed the card cache room it does not have. split_rules::trim_credit(stage, freed) is the rule (stage 0 gets the freed bytes, the others 0) with a unit check in split_rules_test; generate.cpp calls it where it used trim_frees directly.
This commit is contained in:
1 parent
2f1b77b262
commit
191202132c
3 files changed
+19
-1
No files matched your search
@@ -140,6 +140,15 @@ int main() {
|
||||
CHECK(!floors_exceed_minimum(share_floors({0, 0}, L)));
|
||||
CHECK(!below_floors({}, 48, {}));
|
||||
}
|
||||
// PR #4522: only CUDA0 (stage 0, weights loaded in full when the search runs) is credited what the trim frees; later stages never
|
||||
{
|
||||
const int64_t MiB = 1 << 20;
|
||||
CHECK(trim_credit(0, 2169 * MiB) == 2169 * MiB);
|
||||
CHECK(trim_credit(1, 2169 * MiB) == 0);
|
||||
CHECK(trim_credit(2, 3000 * MiB) == 0);
|
||||
CHECK(trim_credit(0, 0) == 0);
|
||||
CHECK(trim_credit(0, -5) == 0); // trim off: trim_frees is 0 (never negative); a negative figure is no credit
|
||||
}
|
||||
if (failed == 0) std::printf("split_rules_test: ok\n");
|
||||
return failed ? 1 : 0;
|
||||
}
|
||||
Reference in new issue
Block a user