mirror of
https://github.com/seedds/nxnative.git
synced 2026-11-25 06:20:08 -10:00
host/nvn: release shader library file mappings after loading
Give Metal allocator-owned dispatch data and unmap each source before loading it. Loose metallibs and packed-image entries share the same path, with prompt descriptor closure and the original content digest preserved. Manifest prewarm still processes its complete lists. Metal retained the old mapping-backed input for the lifetime of its library/functions. With only 32 MiB left for new mappings, a real-Metal Mac loader failed at library 527; owned data loaded all 4,096 libraries (199.88 MiB payload) using malloc-managed space. The equal-load probe costs about 219 MiB more charged memory than mapped input. Checked 655 library-ownership assertions, the focused warmup/archive/ admission/prebuild tests, the Mac host build, all 267 iPhone source compile checks, docs and relevant C/Objective-C lint. Earlier full Isaac and Catherine regressions passed for this loader change; gameplay timing is not claimed. Startup and sustained play on the reporter's iPhone remain unverified, so keep the issue open for that retest. Refs #2965 Co-authored-by: Joseph Hau <[email protected]>
This commit is contained in:
1 parent
75863bdd0a
commit
8c94bd1e53
6 files changed
+119
-12
No files matched your search
@@ -27,6 +27,9 @@ Render conditions, which the host evaluates for every game ([Conditional renderi
|
||||
|
||||
## Memory
|
||||
|
||||
- **Current (issue #2965): host mapping ownership corrected; iPhone retest pending.** On an iPhone 17 Pro Max (A19 Pro, iOS 27.2.1), 1.4.3 packed with `--romfs separate --shader-files` aborted during a 26,456-line startup prewarm. Disabling manifest prewarm reached play but still aborted around 27 minutes. Reporter crash census: startup 257 mmap failures, 449.93 GiB VA / 11,824 regions, 0.82 GiB footprint; later play 25,996 regions and 1.86 GiB footprint. The reported host was `82c354b`, shader chain `5ea15f2c8240`, OS build 24B156. The general fix and its remaining validation are in [Shader library mappings exhaust a restricted task map](../../../docs/reference/memory.md#shader-library-mappings-exhaust-a-restricted-task-map); neither startup nor sustained play has been rechecked on this phone.
|
||||
- **Shader-library ownership measurement (Mac only, 2026-11-20):** a standalone loader retained the first 4,096 metallibs of the local `b-8d8fd1496933.img` (199.88 MiB of payload), without running the game or compiling pipelines. On Apple M6 / macOS 27.2.1 26B131, mapped inputs grew the process by 4,003 VM regions and 6.26 MiB footprint; owned copies grew it by 56 regions and 225.13 MiB footprint. Thus copying saved mapping regions at a cost of about 219 MiB charged memory for this subset. This older local chain is neither the reporter's `5ea15f2c8240` nor a patched-phone validation, and does not establish the game's steady FPS or long-session memory limit.
|
||||
- **Constrained-VA root-cause A/B (Mac only, 2026-11-21):** the same real-Metal loader reserved all currently free VM gaps in its own process except 32 MiB, without overwriting existing mappings or submitting GPU work. The former mapping-backed loader failed at library 527 with `ENOMEM`, at 11.25 MiB footprint; owned inputs completed all 4,096 libraries (199.88 MiB payload), at 235.41 MiB footprint. Malloc served the copies from space it already managed, while retained file mappings consumed the remaining gaps. This supports the ownership fix without an arbitrary prewarm cutoff; the phone's complete startup and sustained-play outcomes remain unverified.
|
||||
- **Current (issue #147): confirmed transient upload-memory bug on the Mac; iOS validation pending.** With update 1.4.3, the corrected issue #70 SDK module, shader chain `dec5ee141a9f` and 30 fps, walking from the Great Sky Island save produced 10.70 GiB peak footprint after about 474 s; a shorter repeat reached 12.81 GiB after about 150 s. Live staging peaked at 4.48 / 5.82 GiB and the open batch at 4.41 / 5.75 GiB, then memory fell back near 4 GiB. The shorter burst logged 3,084.2 MB of uploads in one frame. A temporary 50 ms sampler and the kernel footprint-peak ledger caught peaks missed by the periodic reports and the 8 GiB sampled watchdog. With [bounded batches and upload-completion retirement](../../../docs/reference/memory.md#upload-staging-grows-within-one-rendering-submission), the 220 s shortened route with deferred encoding enabled peaked at 4.24 GiB footprint and 216 MiB live staging, without GPU errors. A 520 s replay of the original input timings peaked at 4.23 GiB / 200 MiB, but landed differently and reached Game Over earlier, so it is not an equivalent traversal comparison. These local results do not establish the cause of the reporter's full-device reboot or rule out longer-term cache growth; the requested save/route, full logs and Jetsam/panic reports are still needed for that comparison.
|
||||
- The NPDM declares 24 MB of system resource, so `IsVirtualAddressMemoryEnabled` is true and the game's memory lives in the alias region. `nninitStartup` also calls `SetHeapSize(0x86000000)` (2.1 GB of the pool as its heap; a 2 GB heap region aborts there with 0xd401). What it can map is bounded by the pool less the heap (1.1 GB).
|
||||
- **Resolved (issue #70):** the resource heaps are address regions in the alias region (2.375 GB here, 64 GB on the Switch). With the SDK's ~1 GB node area at its start, the alias region was used up to +2.25 GB at the first descent from the Great Sky Island with 1.00 GB mapped. The game then took a memory shortage: its frame check (`main+0x1fd32ec`) logs `MSF`, then `R` and `Rf` (reason bits of one resource heap's object), and plays the memory-shortage Blood Moon, which puts Link back at the start. With the node area cut to 62 MB (as Fire Emblem Engage's, Hollow Knight: Silksong's and other builds have it) the high-water mark is +1.75 GB, and no shortage came in 3.7 minutes on the island (it came within a minute in 7 of 8 runs without it).
|
||||
@@ -104,6 +107,7 @@ Game-specific findings. The general host changes they led to are listed under [F
|
||||
|
||||
General host changes first needed here; each applies to every game:
|
||||
|
||||
- **Shader library input ownership (#2965):** [Shader library mappings exhaust a restricted task map](../../../docs/reference/memory.md#shader-library-mappings-exhaust-a-restricted-task-map). Covered by synthetic resource tests and Mac ownership probes; phone validation remains open.
|
||||
- **Resolved in the host: render passes into textures uploaded from their storage** write the storage, and storage-backed textures get render-target use when attached: [Render passes into textures uploaded from their storage](../../../docs/reference/nvn-objects.md#render-passes-into-textures-uploaded-from-their-storage). Covered by `t_readback`; checked on the Mac along the grass route.
|
||||
- [A capture refused after a change to the reflection structs](../../../docs/reference/nvn-objects.md#a-capture-refused-after-a-change-to-the-reflection-structs).
|
||||
|
||||
|
||||
+15
-12
@@ -6775,25 +6775,28 @@ static NSString *lib_digest(const void *p, size_t n) {
|
||||
char hex[33]; for (int i = 0; i < 16; i++) snprintf(hex + 2 * i, 3, "%02x", h[i]);
|
||||
return @(hex);
|
||||
}
|
||||
// Build the library from a .metallib file without permanently occupying a file descriptor: newLibraryWithURL keeps that file open for as long as the library object lives (one per game shader - of the 258 descriptors the iOS app permanently holds in a run, 213 are these,
|
||||
// while the default soft limit of an iOS process is 256; new shaders created in other acts raise it further). Here the file is mapped into memory and closed immediately, and the library is built from the in-memory data; the mapping is released when the library's data object is freed.
|
||||
// The library is tagged with its digest (lib_tag), from the mapped bytes
|
||||
// Metal retains a library's input data while its functions live. Borrowing a file mapping here therefore kept one mapping per distinct library for the run, consuming room
|
||||
// in #2965's restricted iOS task map even with prewarm off. Give Metal owned bytes, then unmap before calling it. Both loose files and image entries follow this ownership rule.
|
||||
// Owned data can use malloc's existing arenas when new file mappings have no gap; the tradeoff is charged memory instead of reclaimable file pages.
|
||||
// The descriptor is closed promptly too: newLibraryWithURL keeps one open per library and exceeded iOS's soft limit of 256. The digest still names the original library bytes.
|
||||
static id<MTLLibrary> lib_from_map(msl_map f, NSError **err) {
|
||||
NSString *tag = lib_digest(f.data, f.size);
|
||||
dispatch_data_t d = dispatch_data_create(f.data, f.size, NULL, DISPATCH_DATA_DESTRUCTOR_DEFAULT);
|
||||
munmap(f.base, f.base_len);
|
||||
if (!d) { if (err) *err = [NSError errorWithDomain:NSPOSIXErrorDomain code:ENOMEM userInfo:nil]; return nil; }
|
||||
return lib_tag([g_dev newLibraryWithData:d error:err], tag);
|
||||
}
|
||||
static id<MTLLibrary> lib_from_file(NSString *path, NSError **err) {
|
||||
int fd = open(path.fileSystemRepresentation, O_RDONLY); struct stat st;
|
||||
if (fd < 0) { // not in the folder: the library's image, whose one descriptor is shared, and only this file's pages are mapped
|
||||
int open_errno = errno; romfs_img *img; const img_ent *x = msl_image_file(path, &img); msl_map f;
|
||||
if (x && msl_image_map(img, x, &f)) {
|
||||
void *base = f.base; size_t base_len = f.base_len;
|
||||
dispatch_data_t d = dispatch_data_create(f.data, f.size, dispatch_get_global_queue(QOS_CLASS_UTILITY, 0), ^{ munmap(base, base_len); });
|
||||
return lib_tag([g_dev newLibraryWithData:d error:err], lib_digest(f.data, f.size));
|
||||
}
|
||||
if (x && msl_image_map(img, x, &f)) return lib_from_map(f, err);
|
||||
if (!x) errno = open_errno;
|
||||
}
|
||||
if (fd < 0 || fstat(fd, &st) || st.st_size <= 0) { if (fd >= 0) close(fd); if (err) *err = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:@{NSLocalizedDescriptionKey: [NSString stringWithFormat:@"cannot open %@", path]}]; return nil; }
|
||||
size_t len = (size_t)st.st_size; void *m = mmap(NULL, len, PROT_READ, MAP_PRIVATE, fd, 0); close(fd);
|
||||
if (m == MAP_FAILED) { if (err) *err = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:@{NSLocalizedDescriptionKey: [NSString stringWithFormat:@"mmap failed %@", path]}]; return nil; }
|
||||
dispatch_data_t d = dispatch_data_create(m, len, dispatch_get_global_queue(QOS_CLASS_UTILITY, 0), ^{ munmap(m, len); });
|
||||
return lib_tag([g_dev newLibraryWithData:d error:err], lib_digest(m, len));
|
||||
size_t len = (size_t)st.st_size; void *m = mmap(NULL, len, PROT_READ, MAP_PRIVATE, fd, 0); int map_errno = errno; close(fd);
|
||||
if (m == MAP_FAILED) { if (err) *err = [NSError errorWithDomain:NSPOSIXErrorDomain code:map_errno userInfo:@{NSLocalizedDescriptionKey: [NSString stringWithFormat:@"mmap failed %@", path]}]; return nil; }
|
||||
return lib_from_map((msl_map){.data = m, .size = len, .base = m, .base_len = len}, err);
|
||||
}
|
||||
// NVN depth mode (nvnDeviceSetDepthMode): every vertex library has two entry points (dmsh_entry.py vs_depth): main0 rewrites z for the GL convention (near = -w, NVN's default),
|
||||
// main0_z leaves z as is (near = 0, which Link's Awakening, 13 Sentinels and Engage set). Loading picks by the mode the game set, so no game needs a setting for it
|
||||
|
||||
@@ -504,6 +504,8 @@ t_pso_bundle: t_pso_bundle.m ../tools/pso_offline.py $(MTL_T_DEP)
|
||||
clang $(CFLAGS) -fobjc-arc -o $@ t_pso_bundle.m $(MTL_T_SRC) $(FW)
|
||||
t_pso_admission: t_pso_admission.m $(MTL_T_DEP)
|
||||
clang $(CFLAGS) -fobjc-arc -o $@ t_pso_admission.m $(MTL_T_SRC) $(FW)
|
||||
t_library_data: t_library_data.m $(MTL_T_DEP)
|
||||
clang $(CFLAGS) -fobjc-arc -o $@ t_library_data.m $(MTL_T_SRC) $(FW)
|
||||
.PHONY: check_t_pso_admission
|
||||
check_t_pso_admission: t_pso_admission
|
||||
@for mode in aggregate fragmented empty unknown map-fail exact ample native; do ./t_pso_admission $$mode || exit $$?; done
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
// Retained library input must outlive its temporary source mapping. A synthetic device keeps every buffer, including on failure; no GPU or game files needed.
|
||||
#import <Metal/Metal.h>
|
||||
#include <sys/mman.h>
|
||||
static void *library_map(void *, size_t, int, int, int, off_t);
|
||||
static int library_unmap(void *, size_t);
|
||||
#define mmap library_map
|
||||
#define munmap library_unmap
|
||||
#include "../nvn/nvn_mtl.m"
|
||||
#undef mmap
|
||||
#undef munmap
|
||||
|
||||
void *front_metal_layer(void) { return NULL; }
|
||||
module_t *module_of(const void *p) { (void)p; return NULL; }
|
||||
module_t *g_mod; int g_nmod;
|
||||
void svc_thread_dump(void) {}
|
||||
uint64_t now_ns(void) { return bp_now(); }
|
||||
|
||||
static int checks, failed, live_maps, reject_library, loose, source_fd;
|
||||
static size_t live_bytes, peak_bytes, map_budget;
|
||||
#define EXPECT(name, want, got) do { checks++; uint64_t w_ = (want), g_ = (got); if (w_ != g_) { failed++; fprintf(stderr, "%s: expected %llu, got %llu\n", name, (unsigned long long)w_, (unsigned long long)g_); } } while (0)
|
||||
static size_t pages(size_t n) { size_t pg = (size_t)getpagesize(); return (n + pg - 1) / pg * pg; }
|
||||
static void *library_map(void *p, size_t n, int prot, int flags, int fd, off_t off) {
|
||||
size_t need = pages(n);
|
||||
if (need > map_budget || live_bytes > map_budget - need) { errno = ENOMEM; return MAP_FAILED; }
|
||||
void *v = mmap(p, n, prot, flags, fd, off);
|
||||
if (v != MAP_FAILED) { live_maps++; live_bytes += need; peak_bytes = MAX(peak_bytes, live_bytes); source_fd = fd; }
|
||||
return v;
|
||||
}
|
||||
static int library_unmap(void *p, size_t n) {
|
||||
int r = munmap(p, n); if (!r) { live_maps--; live_bytes -= pages(n); } return r;
|
||||
}
|
||||
|
||||
@interface LibraryDevice : NSObject { @public NSMutableArray *data; }
|
||||
@end
|
||||
@implementation LibraryDevice
|
||||
- (id)newLibraryWithData:(dispatch_data_t)d error:(NSError **)error {
|
||||
EXPECT("source mapping gone before Metal retains the data", 0, live_maps);
|
||||
if (loose) EXPECT("loose descriptor closed before entering Metal", -1, fcntl(source_fd, F_GETFD));
|
||||
if (!data) data = [NSMutableArray array]; [data addObject:d];
|
||||
if (reject_library) { if (error) *error = [NSError errorWithDomain:@"fixture" code:1 userInfo:nil]; return nil; }
|
||||
return [NSObject new];
|
||||
}
|
||||
@end
|
||||
|
||||
int main(void) { @autoreleasepool {
|
||||
char tmp[] = "/tmp/t_library_data.XXXXXX"; if (!mkdtemp(tmp)) return 2;
|
||||
NSString *root = @(tmp), *folder = [root stringByAppendingPathComponent:@"msl"], *file = [folder stringByAppendingPathComponent:@"fixture.metallib"];
|
||||
[NSFileManager.defaultManager createDirectoryAtPath:folder withIntermediateDirectories:YES attributes:nil error:nil];
|
||||
NSMutableData *bytes = [NSMutableData dataWithLength:65537];
|
||||
for (NSUInteger i = 0; i < bytes.length; i++) ((uint8_t *)bytes.mutableBytes)[i] = (uint8_t)(i * 17);
|
||||
EXPECT("loose fixture written", 1, [bytes writeToFile:file atomically:YES]);
|
||||
LibraryDevice *dev = [LibraryDevice new]; g_dev = (id)dev;
|
||||
map_budget = pages(bytes.length); loose = 1; // one source mapping fits; retained input buffers must not consume the mapping budget
|
||||
for (int i = 0; i < 128; i++) { @autoreleasepool {
|
||||
id lib = lib_from_file(file, NULL);
|
||||
EXPECT("every library loads under a one-library mapping budget", 1, lib != nil);
|
||||
EXPECT("library keeps its content digest", 1, [objc_getAssociatedObject(lib, &g_lib_tag) isEqual:lib_digest(bytes.bytes, bytes.length)]);
|
||||
} }
|
||||
EXPECT("peak source mappings fit one library", map_budget, peak_bytes);
|
||||
reject_library = 1; NSError *error = nil;
|
||||
EXPECT("Metal load failure returned", 1, lib_from_file(file, &error) == nil && error != nil);
|
||||
EXPECT("failure leaves no source mapping", 0, live_maps); reject_library = 0;
|
||||
map_budget = 0;
|
||||
EXPECT("source mmap failure preserves ENOMEM", 1, lib_from_file(file, &error) == nil && [error.domain isEqual:NSPOSIXErrorDomain] && error.code == ENOMEM);
|
||||
map_budget = pages(bytes.length); loose = 0;
|
||||
|
||||
// The image's unaligned payload must be copied exactly, then its entire page-aligned mapping released.
|
||||
NSString *packer = [[@(__FILE__) stringByDeletingLastPathComponent] stringByAppendingPathComponent:@"../../tools/shader_lib.py"];
|
||||
NSTask *pack = [NSTask new]; pack.executableURL = [NSURL fileURLWithPath:@"/usr/bin/python3"];
|
||||
pack.arguments = @[packer, @"pack", folder];
|
||||
if (![pack launchAndReturnError:nil]) return 2;
|
||||
[pack waitUntilExit]; EXPECT("image packed", 0, pack.terminationStatus);
|
||||
g_msl_dir = folder;
|
||||
id lib = lib_from_file(file, NULL);
|
||||
EXPECT("image library loads under the same budget", 1, lib != nil);
|
||||
EXPECT("image has the same content digest", 1, [objc_getAssociatedObject(lib, &g_lib_tag) isEqual:lib_digest(bytes.bytes, bytes.length)]);
|
||||
EXPECT("no source mappings survive any library", 0, live_maps);
|
||||
[NSFileManager.defaultManager removeItemAtPath:[folder stringByAppendingString:@".img"] error:nil];
|
||||
for (dispatch_data_t d in dev->data) {
|
||||
const void *p = NULL; size_t n = 0; dispatch_data_t mapped = dispatch_data_create_map(d, &p, &n);
|
||||
EXPECT("retained data has exact bytes after source deletion", 1, mapped && n == bytes.length && !memcmp(p, bytes.bytes, n));
|
||||
}
|
||||
romfs_image_close(atomic_exchange(&g_msl_img, NULL)); g_msl_dir = nil; dev->data = nil;
|
||||
EXPECT("missing file reports an error", 1, lib_from_file(file, &error) == nil && error != nil);
|
||||
[NSFileManager.defaultManager removeItemAtPath:root error:nil];
|
||||
printf("t_library_data: %d checks, %d failed\n", checks, failed); return failed != 0;
|
||||
} }
|
||||
@@ -230,6 +230,7 @@ One line per symptom in the [subsystem references](../reference/): what you see
|
||||
- process footprint and Metal allocation grow during stationary gameplay even after readback fences complete; the deferred-release queue and command allocator sizes remain bounded. → [Completion readbacks survive a guest waiter's pool](../reference/memory.md#completion-readbacks-survive-a-guest-waiters-pool)
|
||||
- `footprint` shows `Malloc Large` about the size of `pso_archive/` (the log's `pipeline archive …: N files, … MB`), resident or swapped for the whole run. `MallocStackLogging=1` with `malloc_history <pid> -allBySize` gives `newArchiveWithURL` → `MTL4ArchiveImpl::loadFromURL` → `LoaderGlobalState::loadFile` → `-[NSData initWithContentsOfFile:options:maxLength:error:]` → malloc. → [A pipeline archive on an external drive is read into memory](../reference/memory.md#a-pipeline-archive-on-an-external-drive-is-read-into-memory)
|
||||
- a save load aborts in `pthread_create` or a host `realloc` with the footprint far below the memory limit; turning off Metal 4 pipelines lets the save load. The crash's address-space census, rather than the footprint alone, distinguishes this from the physical-memory limit. → [Pipeline archives exhaust a restricted task map](../reference/memory.md#pipeline-archives-exhaust-a-restricted-task-map)
|
||||
- startup's `Preparing shaders` aborts after many `failed to load shader ... mmap failed` lines, or an on-demand render-pipeline allocation later aborts with `NSMallocException`, despite a low physical footprint. Turning off Metal 4 and pipeline prebuild does not disable manifest prewarm; `DM_PSO_MANIFEST=off` skips startup's list but the reported game still aborted after about 27 minutes. → [Shader library mappings exhaust a restricted task map](../reference/memory.md#shader-library-mappings-exhaust-a-restricted-task-map)
|
||||
- the periodic `residency set up to frame` line shows hundreds of allocations added and removed per 300 frames in a scene where nothing loads: Ocarina of Time, 1,500 (`pool_gpu` 900 of 180 KB, `mrbuf_get` 600 of 0.5 MB), and 650 commits. → [Pool tables and readback buffers made anew each frame](../reference/memory.md#pool-tables-and-readback-buffers-made-anew-each-frame)
|
||||
- with a profile that has `tex_dirty_upload`, a texture in a sparse pool that the game draws into or writes as an image logs `CPU-written texture ser=…` at its first use, and takes its content from its storage. `t_sparse_tiles` crashed at `and unmapped, not drawn: its heap tile goes back` when built with such a profile, and passed with one without the key. → [A texture in a sparse pool came out CPU-written at its first use](../reference/memory.md#a-texture-in-a-sparse-pool-came-out-cpu-written-at-its-first-use)
|
||||
- on an iPhone the app is ended by the system (a jetsam event: no crash report, no `[dm] CRASH` line) once its footprint reaches the limit: about 6 GB on a 12 GB iPhone with the increased memory limit (6,143 MiB measured in LiveContainer), 3.3 GB without it. The log stops mid-frame. → [iOS ends the app once the guest's touched pages reach its memory limit](../reference/memory.md#ios-ends-the-app-once-the-guests-touched-pages-reach-its-memory-limit)
|
||||
|
||||
@@ -589,6 +589,16 @@ The guest address space, heaps, pools, virtual address memory and the allocators
|
||||
- **Check:** `dm/gfx/tests/t_pso_admission.m` drives the real initialization and render/compute fallback with synthetic task maps: aggregate size across all three sources, sufficient total space fragmented into smaller gaps, an empty cache on a tight map, failed task/region queries, an exact fit and ample space, plus the Mac's real map. It checks that rejection never opens an archive or compiler, skips prebuild/hybrids and preserves valid files and stamps. `t_pso_bundle` and `t_pso_archive` cover usable archives and the existing reuse/fallback paths. Phone save-load validation remains open.
|
||||
- **Found on:** [Breath of the Wild](../../dm/games/01007EF00011E000/README.md#open), issue #2444. The exact introducing commit has not been bisected.
|
||||
|
||||
### Shader library mappings exhaust a restricted task map
|
||||
|
||||
- **Symptom:** startup's `Preparing shaders` aborts after many `failed to load shader ... mmap failed` lines, or an on-demand render-pipeline allocation later aborts with `NSMallocException`, despite a low physical footprint. Turning off Metal 4 and pipeline prebuild does not disable manifest prewarm; `DM_PSO_MANIFEST=off` skips startup's list but the reported game still aborted after about 27 minutes.
|
||||
- **Cause:** `lib_from_file` closed each loose library's descriptor but handed Metal dispatch data backed by its file mapping, with `munmap` deferred to the data's destruction. Metal retains that input while its library/functions need it, so each distinct input needed a persistent file mapping. Entries in the packed shader image had the same ownership. New mappings require free VM gaps, even when malloc can still allocate from arenas it already manages; a low physical footprint does not establish that another mapping fits. The host tied long-lived compiler input to the file-mapping lifetime instead of giving it allocator-owned storage.
|
||||
- **Fix:** root-cause fix, general `host` binding (`nvn_mtl.m`): `lib_from_map` gives Metal owned dispatch data and releases the temporary mapping before entering Metal, for loose and packed libraries alike. Prompt descriptor closure and the digest of the original bytes remain. Prewarm still processes its complete lists: no new row cap, VA cutoff, game setting or cache eviction policy. Existing pipeline-archive admission is unchanged.
|
||||
- **Check:** `t_library_data` retains every input data object in a synthetic device. It loads 128 libraries with a mapping budget that fits only one source, verifies that the source mapping and loose descriptor are gone before the device call, and checks exact bytes after source deletion, content digests, packed-image offsets, a failed Metal load and `ENOMEM` from the source map. A separate real-Metal constrained-VA A/B reserves only free gaps in its own process, leaving 32 MiB for new mappings: the former loader fails with `ENOMEM`; the owned-data loader completes the same library set. The game note records inputs, counts and memory costs. This establishes the loading mechanism on the Mac, not complete resolution on the affected iPhone.
|
||||
- **Platform reservations:** a minimal C process without nxnative has the same 385 GiB guard total on Apple Silicon: 1 GiB at the commpage and 384 GiB in the GPU carveout. Apple's published [XNU VM layout](https://github.com/apple-oss-distributions/xnu/blob/f6217f891ac0bb64f3d375211650a4c1ff8ca1ea/osfmk/vm/vm_map.c#L24630) describes those ranges. We should leave them alone. An aggregate phone census does not establish the provenance of every untagged reservation.
|
||||
- **Cost and open validation:** owned input increases charged memory compared with reclaimable file pages. Total shader/pipeline cache growth is not newly bounded. Retest the reporter's large startup list and sustained play beyond the prior abort, recording VA and physical-memory headroom; do not claim that both phone failures are resolved from the Mac stress test. No shader-chain change is needed.
|
||||
- **Found on:** [Tears of the Kingdom](../../dm/games/0100F2C0115B6000/README.md#memory), [issue #2965](https://github.com/seedds/nxnative/issues/2965). Its note records the reported build, device and crash counts; no patched-phone run is claimed.
|
||||
|
||||
### Pool tables and readback buffers made anew each frame
|
||||
|
||||
- **Symptom:** the periodic `residency set up to frame` line shows hundreds of allocations added and removed per 300 frames in a scene where nothing loads: Ocarina of Time, 1,500 (`pool_gpu` 900 of 180 KB, `mrbuf_get` 600 of 0.5 MB), and 650 commits.
|
||||
|
||||
Reference in new issue
Block a user