feat(render): establish typed residency policy ledger
Define Slice D's transition and concurrency contract, add generation-safe asset handles and owner leases, and parse the existing cache ceilings through typed runtime budgets. Stale generations cannot release or revive replacements, and worker observations are bounded and coalesced. Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
parent
a564c4b782
commit
1866ea0c6d
8 changed files with 1696 additions and 2 deletions
|
|
@ -1,5 +1,6 @@
|
|||
using System.Collections.Generic;
|
||||
using AcDream.App;
|
||||
using AcDream.App.Rendering.Residency;
|
||||
|
||||
namespace AcDream.App.Tests;
|
||||
|
||||
|
|
@ -11,6 +12,61 @@ namespace AcDream.App.Tests;
|
|||
/// </summary>
|
||||
public sealed class RuntimeOptionsTests
|
||||
{
|
||||
[Fact]
|
||||
public void ResidencyBudgetsPreserveCurrentProductionDefaults()
|
||||
{
|
||||
RuntimeOptions options = RuntimeOptions.Parse(
|
||||
"D:\\dat",
|
||||
_ => null);
|
||||
|
||||
Assert.Equal(ResidencyBudgetOptions.Default, options.ResidencyBudgets);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ResidencyBudgetOverridesAreTypedMebibytesAndCounts()
|
||||
{
|
||||
var values = new Dictionary<string, string?>
|
||||
{
|
||||
["ACDREAM_RESIDENCY_MESH_GPU_MIB"] = "768",
|
||||
["ACDREAM_RESIDENCY_MESH_UNOWNED_ENTRIES"] = "72",
|
||||
["ACDREAM_RESIDENCY_ANIMATION_MIB"] = "48",
|
||||
["ACDREAM_RESIDENCY_ANIMATION_ENTRIES"] = "300",
|
||||
};
|
||||
|
||||
RuntimeOptions options = RuntimeOptions.Parse(
|
||||
"D:\\dat",
|
||||
name => values.GetValueOrDefault(name));
|
||||
|
||||
Assert.Equal(
|
||||
768 * ResidencyBudgetOptions.MiB,
|
||||
options.ResidencyBudgets.ObjectMeshGpuBytes);
|
||||
Assert.Equal(
|
||||
72,
|
||||
options.ResidencyBudgets.ObjectMeshUnownedEntries);
|
||||
Assert.Equal(
|
||||
48 * ResidencyBudgetOptions.MiB,
|
||||
options.ResidencyBudgets.AnimationBytes);
|
||||
Assert.Equal(300, options.ResidencyBudgets.AnimationEntries);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("0")]
|
||||
[InlineData("-1")]
|
||||
[InlineData("bad")]
|
||||
[InlineData("8796093022208")]
|
||||
public void InvalidResidencyBudgetFallsBackToCurrentDefault(string value)
|
||||
{
|
||||
RuntimeOptions options = RuntimeOptions.Parse(
|
||||
"D:\\dat",
|
||||
name => name == "ACDREAM_RESIDENCY_MESH_GPU_MIB"
|
||||
? value
|
||||
: null);
|
||||
|
||||
Assert.Equal(
|
||||
ResidencyBudgetOptions.Default.ObjectMeshGpuBytes,
|
||||
options.ResidencyBudgets.ObjectMeshGpuBytes);
|
||||
}
|
||||
|
||||
private const string AnyDatDir = "C:/Users/test/dats";
|
||||
|
||||
private static Func<string, string?> Env(Dictionary<string, string?> values)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue