Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ bool ShaderMemory::readWords(void* context, std::uint64_t address, std::uint32_t
std::memcpy(values, page->words.data() + index, bytes);
page->read.SetRun(index, words);
page->recent.SetRun(index, words);
CaptureTotals().reads += words;
if (CaptureProfiled()) CaptureTotals().reads += words;
} else {
for (std::size_t word = 0; word < words; ++word) {
if (!read(context, address + word * sizeof(std::uint32_t), values + word)) return false;
Expand Down
2 changes: 2 additions & 0 deletions core/libs/prx/libSceAgcDriver/tests/ShaderDiskCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1849,6 +1849,8 @@ void verifyPlanRoundTrip() {
const auto bytes = encodedPlan(*plan);
IrResourcePlan decoded;
require(ShaderDiskCache::DecodePlan(bytes, decoded), fixture.name + ": the plan does not decode");
require(decoded.denseValueIds == plan->denseValueIds, fixture.name + ": the cached plan lost dense value indexing");
require(decoded.compact.values.size() == plan->compact.values.size() && decoded.compact.arguments == plan->compact.arguments && decoded.compact.sourceDwords == plan->compact.sourceDwords && decoded.compact.srtReads == plan->compact.srtReads && decoded.compact.conditions == plan->compact.conditions, fixture.name + ": the cached plan lost compact evaluation data");
require(encodedPlan(decoded) == bytes, fixture.name + ": the plan changed in a round trip");
require(samePlan(*plan, decoded), fixture.name + ": the decoded plan differs from the plan in a field or a value");
require(decoded.valueStorage.Size() == plan->valueStorage.Size() && decoded.blockStorage.size() == plan->blockStorage.size(), fixture.name + ": the decoded plan holds another graph");
Expand Down
24 changes: 24 additions & 0 deletions core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1174,6 +1174,30 @@ void verifyImageTableBulkReads() {
const auto captured = memory.Capture(request);
require(captured->snapshot.tables == byWord->snapshot.tables && TableCovered(memory.Regions(), words.data() + 512u, Records * 32u), "image table bulk reads: the shader memory's run reads changed the snapshot or its captured regions");

place(0u, 256u);
AgcDriver::ShaderMemory ranged({});
static_cast<void>(ranged.Capture(request));
static_cast<void>(ranged.TakeRecentRegions());
alignas(4096) static TableGuest narrowGuest;
FillTableSrt(narrowGuest, words.data() + 1016u, 32u, 4u);
const auto narrowData = TableUserData(narrowGuest);
const auto narrowRequest = TableRequest(TableWholeCode, narrowData);
CountingMemory mapped;
require(ranged.Capture(narrowRequest)->snapshot.tables == capture(narrowRequest, mapped, false)->snapshot.tables, "image table bulk reads: an unaligned cached run changed its snapshot");
const auto exactRange = [&](const auto& regions) {
std::uint64_t recorded = 0;
const auto begin = reinterpret_cast<std::uintptr_t>(words.data());
const auto end = begin + sizeof(words);
for (const auto& region : regions) {
const auto first = std::max<std::uint64_t>(begin, region.guestAddress);
const auto last = std::min<std::uint64_t>(end, region.guestAddress + region.bytes.size());
if (last > first) recorded += last - first;
}
return recorded == 4u * 32u && TableCovered(regions, words.data() + 1016u, 4u * 32u);
};
require(exactRange(ranged.TakeRecentRegions()), "image table bulk reads: an unaligned cached run recorded unrelated words");
static_cast<void>(ranged.Capture(narrowRequest));
require(exactRange(ranged.TakeRecentRegions()), "image table bulk reads: a repeated cached run lost or enlarged its recent words");
place(1012u, 4u);
CountingMemory cutWordReads{reinterpret_cast<std::uintptr_t>(words.data() + 1012u), reinterpret_cast<std::uintptr_t>(words.data() + 1044u), reinterpret_cast<std::uintptr_t>(words.data() + 1024u)};
CountingMemory cutRunReads = cutWordReads;
Expand Down