[Gpu] Throttle the device-address fault and 3D slice range logs

Little Nightmares wrote 195 thousand "Accessed non-GPU cached memory" lines in
one session and Silent Hill 6800 slice range lines. Both now print the first
occurrences and then only at power-of-two counts, with the count.
This commit is contained in:
ParantezTech 2026-10-02 18:51:38 +03:00
parent 6283b7a802
commit 166a340950
2 changed files with 14 additions and 3 deletions

View File

@ -17,6 +17,7 @@ public sealed unsafe class BdaFaultProcessor : IDisposable
private const uint MaxPageFaults = 1024;
private const ulong PageFaultAreaSize = MaxPageFaults * sizeof(ulong);
private static long _reportedFaults;
private readonly GpuDeviceInfo _device;
private readonly SubmissionScheduler _scheduler;
private readonly GuestBufferCache _cache;
@ -249,7 +250,11 @@ public sealed unsafe class BdaFaultProcessor : IDisposable
if (SharpEmu.HLE.GpuMemory.GuestGpuMemoryHook.Traces(faults[index], _pageSize))
SharpEmu.HLE.GpuMemory.GuestGpuMemoryHook.Trace(faults[index], _pageSize,
$"device-address-fault scan_tick={scanTick} callback_tick={_scheduler.CurrentTick} registered={_cache.IsRegionRegistered(faults[index], _pageSize)} reported_count={(uint)faults[0]} retained_count={count}");
Console.Error.WriteLine($"[GPU][INFO] Accessed non-GPU cached memory at 0x{faults[index]:X16}");
var reported = Interlocked.Increment(ref _reportedFaults);
if (reported <= 16 || (reported & (reported - 1)) == 0)
{
Console.Error.WriteLine($"[GPU][INFO] Accessed non-GPU cached memory at 0x{faults[index]:X16} count={reported}");
}
}
_faultRanges.ForEach((start, size) =>

View File

@ -39,6 +39,8 @@ public readonly record struct TargetViewRange(uint BaseLayer, uint LayerCount, u
public static partial class ImageRequestBuilders
{
private static long _normalizedSliceRanges;
public static uint SampleCount(uint encodedLog2) => encodedLog2 <= 3 ? 1u << (int)encodedLog2 : 0;
// DCC clears use the target's packed clear word; the fixed-clear set is a format allow-list.
@ -132,8 +134,12 @@ public static partial class ImageRequestBuilders
if (volume && view.BaseLayer == 0 && view.LayerCount == depth + 1)
{
view = new TargetViewRange(0, depth, depth);
Console.Error.WriteLine(
$"[LOADER][INFO] normalized an exclusive 3D color-target slice range to depth={depth}");
var normalized = Interlocked.Increment(ref _normalizedSliceRanges);
if (normalized <= 8 || (normalized & (normalized - 1)) == 0)
{
Console.Error.WriteLine(
$"[LOADER][INFO] normalized an exclusive 3D color-target slice range to depth={depth} count={normalized}");
}
}
var tileMode = words.TileMode;
var standard4 = tileMode == GuestTileMode.Standard4KB;