Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
5f53211
feat(agc): tag each host import with its requester
EagleBearerYS Oct 15, 2026
ae9a520
feat(agc): print the host import counts at shutdown
EagleBearerYS Oct 15, 2026
d6a374a
test(agc): read the overhang surfaces after FlushGpuWrites
EagleBearerYS Oct 15, 2026
a24aafb
perf(agc): import adjacent registered ranges as aligned power-of-two …
EagleBearerYS Oct 15, 2026
4a84bbf
perf(agc): remember budget refusals until the budget frees
EagleBearerYS Oct 15, 2026
98c72e9
perf(agc): take the host import budget from the device's memory budget
EagleBearerYS Oct 15, 2026
b8a33ab
test(agc): register the write-back block test apart from the split wr…
EagleBearerYS Oct 15, 2026
f036140
Merge branch 'perf/agc-host-import-aligned-blocks' into perf/agc-host…
EagleBearerYS Oct 15, 2026
9c308c7
fix(agc): drop the expand import requester that no path uses
EagleBearerYS Oct 15, 2026
9c4bb70
Merge branch 'perf/agc-host-import-aligned-blocks' into perf/agc-host…
EagleBearerYS Oct 15, 2026
ac9ccfb
fix(agc): keep the host import budget off the device report until an …
EagleBearerYS Oct 15, 2026
a792802
fix(agc): keep a host heap report with no room from turning off refus…
EagleBearerYS Oct 16, 2026
4cceec1
Merge main into perf/agc-host-import-aligned-blocks
EagleBearerYS Oct 16, 2026
18ef6b2
Merge branch 'perf/agc-host-import-aligned-blocks' into perf/agc-host…
EagleBearerYS Oct 16, 2026
f03efae
Merge main into perf/agc-host-import-aligned-blocks
EagleBearerYS Oct 17, 2026
e60ca87
Merge branch 'perf/agc-host-import-aligned-blocks' into perf/agc-host…
EagleBearerYS Oct 17, 2026
978ce35
Merge main into perf/agc-host-import-aligned-blocks
EagleBearerYS Oct 17, 2026
287dd14
Merge branch 'perf/agc-host-import-aligned-blocks' into perf/agc-host…
EagleBearerYS Oct 17, 2026
399cc69
Merge main into perf/agc-host-import-aligned-blocks
EagleBearerYS Oct 18, 2026
1b304c8
test(agc): keep the copy lifetime test's two ranges out of one aligne…
EagleBearerYS Oct 18, 2026
698491c
Merge perf/agc-host-import-aligned-blocks into perf/agc-host-import-b…
EagleBearerYS Oct 18, 2026
0b84427
Merge main into perf/agc-host-import-aligned-blocks
EagleBearerYS Oct 18, 2026
82cf694
Merge perf/agc-host-import-aligned-blocks into perf/agc-host-import-b…
EagleBearerYS Oct 18, 2026
e100002
Merge main into perf/agc-host-import-aligned-blocks
EagleBearerYS Oct 18, 2026
50a8db2
Merge main into perf/agc-host-import-blocks
EagleBearerYS Oct 18, 2026
03fab5c
Merge main into perf/agc-host-import-blocks
EagleBearerYS Oct 19, 2026
4bbb952
Merge main into perf/agc-host-import-aligned-blocks
EagleBearerYS Oct 19, 2026
abf42b2
Merge main into perf/agc-host-import-blocks
EagleBearerYS Oct 19, 2026
af6f2ec
Merge main into perf/agc-host-import-aligned-blocks
EagleBearerYS Oct 19, 2026
3a9bc81
Merge main into perf/agc-host-import-blocks
EagleBearerYS Oct 19, 2026
0644811
Merge main into perf/agc-host-import-aligned-blocks
EagleBearerYS Oct 19, 2026
33bbd08
Merge main into pr-6457
oneandonlydean Oct 19, 2026
fe5c276
Merge main into pr-6457
oneandonlydean Oct 19, 2026
2e329d1
Merge main into pr-6479 via the rebased #6457
oneandonlydean Oct 19, 2026
a48e28a
Merge main into pr-6457
oneandonlydean Oct 19, 2026
f879cd7
Merge main into pr-6479
oneandonlydean Oct 19, 2026
f3751e9
Merge main into pr-6457
oneandonlydean Oct 19, 2026
1d8d67f
x
oneandonlydean Oct 19, 2026
e42de06
Merge main into pr-6457
oneandonlydean Oct 19, 2026
cda9264
Merge main into pr-6479 via the rebased #6457
oneandonlydean Oct 19, 2026
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
6 changes: 6 additions & 0 deletions core/libs/prx/libSceAgcDriver/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1390,6 +1390,12 @@ if(BUILD_TESTING)
set_tests_properties(agc_copied_direct_ordering PROPERTIES ENVIRONMENT_MODIFICATION
"PATH=path_list_prepend:$<TARGET_FILE_DIR:libc>")
endif()
add_test(NAME agc_storage_writeback_blocks COMMAND agc_driver_recorder_tests --writeback-blocks-only)
set_tests_properties(agc_storage_writeback_blocks PROPERTIES SKIP_RETURN_CODE 77 TIMEOUT 30 ENVIRONMENT "APS5_PIN_WAIT_MS=3000")
if(WIN32)
set_tests_properties(agc_storage_writeback_blocks PROPERTIES ENVIRONMENT_MODIFICATION
"PATH=path_list_prepend:$<TARGET_FILE_DIR:libc>")
endif()
add_test(NAME agc_recorder_read_list COMMAND agc_driver_recorder_tests --read-list-only)
set_tests_properties(agc_recorder_read_list PROPERTIES SKIP_RETURN_CODE 77 TIMEOUT 30)
add_test(NAME agc_space_pending_writes COMMAND agc_driver_recorder_tests --space-pending-writes-only)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ void Driver::stop() {
CloseRegistrationPreparation();
Graphics::StopPipelineLibraryWorker();
std::lock_guard gpuLock(GuestMemory::GpuMutex());
Graphics::ReportHostImports();
device.Reset();
replacedDevices.clear();
Graphics::FlushPipelineJournal();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "BdaAbi.hpp"
#include "prx/libc/include/GuestAllocations.hpp"
#include <algorithm>
#include <array>
#include <cstddef>
#include <cstdint>
#include <limits>
Expand Down Expand Up @@ -73,15 +74,40 @@ ImportProbe ProbeDmaBufImportWriteProtection(const Context& context);
ImportWatch PrepareImportWatch(const Context& context);
void SetImportWatch(const Context& context, ImportWatch watch);

enum class ImportRequester : std::uint8_t { Map, Build, Access, Join, Segment };
inline constexpr std::size_t ImportRequesterCount = 5;

struct HostImportRequesterCounts {
std::uint64_t made = 0;
std::uint64_t madeBytes = 0;
std::uint64_t refused = 0;
std::uint64_t refusedBytes = 0;
std::uint64_t failed = 0;
std::uint64_t remembered = 0;
};

struct HostImportCounts {
std::uint64_t live = 0;
std::uint64_t liveBytes = 0;
std::array<HostImportRequesterCounts, ImportRequesterCount> requesters{};
};

const char* ImportRequesterName(ImportRequester requester);
HostImportCounts HostImportCounters();
std::string FormatHostImportCounts(const HostImportCounts& counts);
void ReportHostImports();

// The host import of the registered allocation containing [address, address + bytes), made on demand
// (alignment and budget permitting), or null. Bytes at `address` are at `HostImportOffset(*import,
// address)` in the import's buffer.
const HostImport* HostImportFor(const Context& context, std::uint64_t address, std::size_t bytes);
const HostImport* HostImportFor(const Context& context, std::uint64_t address, std::size_t bytes, ImportRequester requester = ImportRequester::Access);
const HostImport* ExistingHostImportFor(const Context& context, std::uint64_t address, std::size_t bytes);
void SetHostImportWindow(std::uint64_t bytes);
// Tests: the window of one large registered range (64 MiB) and the import budget (0: the configured one).
void SetHostImportRangeWindow(std::uint64_t bytes);
void SetHostImportBudget(std::uint64_t bytes);
std::uint64_t HostImportBudgetFor(const VkPhysicalDeviceMemoryProperties& memory, const VkPhysicalDeviceMemoryBudgetPropertiesEXT* reported, std::uint64_t configured, std::uint64_t liveBytes);
std::uint64_t HostImportBudgetWith(std::uint64_t configured, bool set, std::uint64_t reported, bool allocationFailed, std::uint64_t ceiling);
void SetAddressCopyLimit(std::uint64_t bytes);
void SetHostImportDeferredSettles(bool enabled);
// The larger of 6 GiB and half the physical memory, at most the largest host heap less the larger of 2 GiB and half
Expand Down
384 changes: 317 additions & 67 deletions core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2923,7 +2923,7 @@ std::vector<StorageTexture::ImportSegment> StorageTexture::importSegments() cons
for (const auto& piece : pieces) {
const auto from = std::max(piece.address, begin);
const auto to = std::min(piece.address + piece.bytes, end);
const auto* import = HostImportFor(context, from, static_cast<std::size_t>(to - from));
const auto* import = HostImportFor(context, from, static_cast<std::size_t>(to - from), ImportRequester::Segment);
if (import == nullptr) return {};
if (!segments.empty() && segments.back().import == import) segments.back().end = to;
else if (!segments.empty() && unitAligned && from % 65536 != 0) return {};
Expand Down
Loading
Loading