Skip to content

kyty: device memory cap does not bound VRAM on NVIDIA/Windows; heap-pinned textures are never freed #315

Backlog

Description

@Ryongen
  • VMA heap 0 holds at its cap (budget less min(3 GiB, 1/4), or KYTY_MEMORY_BUDGET_MB), but images past it go to memory type 0 (heap 1, no flags), which NVIDIA 617.42 keeps in VRAM: VMA heap 1 blocks 4168 MiB vs driver heap 1 usage 648 MiB, driver heap 0 usage 8618 MiB with VMA heap 0 at 3999. Optimal-tiled images cannot use any HOST_VISIBLE type (forcing one: VK_ERROR_FEATURE_NOT_PRESENT).
  • ~1.3 GB of device memory is outside VMA (driver/pipelines) and not in the reserve.
  • In the first scene ~95% of live image bytes have heap_refs != 0 (bindless table), 2.5-5.3 GB; GC skips them. Texture and buffer GC age is counted in GC ticks (one per frame); at 0-2 fps nothing ages.
  • Result on 8 GB: the card fills to its size, then Windows demotes; past ~9.5 GB of game usage the device was lost once.
  • Mitigations in feat(kyty): create large block-compressed textures without their top mips under memory pressure #312 (partial BC textures, 2-3 GB) and fix(kyty): back the device address page table only where buffers are registered #313 (page table, 766 MiB). Still open: trigger on driver usage, evict/trim heap-pinned non-BC textures, GC on time or memory instead of frames.

Activity

  1. simnJS commented on Nov 26, 2026

    @simnJS
    Owner

    Thanks, that is a precise report, and it explains why the cap holds on Linux but not on Windows. The cap only limits what the allocator places on the device-local heap. Optimal images that do not fit go to the plain memory type of heap 1, and on Windows the driver is free to keep that in VRAM, so the card fills anyway. Since optimal-tiled images cannot use any host-visible type, the allocator cannot fix that alone: the cache has to give memory back.

    What we would do, in this order (each can be its own PR):

    1. Trigger on what the driver reports: compare heapUsage from VK_EXT_memory_budget for the device-local heap, which also counts the ~1.3 GB outside the allocator, against heapBudget minus the reserve, instead of the allocator's own block sizes.
    2. Age on time as well as on GC ticks: at 0 to 2 fps nothing ages, so a texture or buffer should also age by wall time, or by memory pressure, not only once per frame.
    3. Let the GC evict heap-held images that no recent draw used: an evicted entry is resolved again on its next use. This one touches the image heap, which we are reworking (Call for contributors: AnyKyty architecture v2 — what the GPU writes, the GPU reads (path to playable GPU-driven PS5 games) #168), so please coordinate here before starting it.

    #312 and #313 help on 8 GB cards in the meantime; see the reviews there.

    Would you like to take 1 and 2? Both are self-contained in the texture and buffer caches, and you can test them on Windows, which we cannot easily do.

  2. added
    bug
    area: gpu-memory
    area: windows
    hard
    needs: Windows
    on Nov 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: gpu-memoryarea: windowsbughardneeds: Windows

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions