Skip to content
Closed
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
8 changes: 5 additions & 3 deletions src/asahi/vulkan/hk_cmd_pool.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,14 @@ struct agx_ptr;
struct hk_device;

/* Command-buffer memory (main/USC/root pools, VDM slabs, Ioto arenas) is
* CPU-cached on single-die AGX3 chips; recording cleans what it wrote before
* submission (hk_cmd_buffer_publish_cached_uploads()). */
* CPU-cached on single-die AGX3 chips except G16G (which keeps write-combined
* command memory); recording cleans what it wrote before submission
* (hk_cmd_buffer_publish_cached_uploads()). */
static inline bool
hk_g17p_cached_cmd_memory(const struct agx_device *dev)
{
return agx_chip_is_agx3_single_die(dev->chip) && util_has_cache_ops();
return agx_chip_is_agx3_single_die(dev->chip) &&
dev->chip != AGX_CHIP_G16G && util_has_cache_ops();
}

struct hk_cmd_pool;
Expand Down
18 changes: 18 additions & 0 deletions src/asahi/vulkan/tests/test-hk-cmd-pending.c
Original file line number Diff line number Diff line change
Expand Up @@ -383,13 +383,31 @@ test_vm_status_mirror_fast_reap(void)
}
}

static void
test_cached_cmd_memory_chip_policy(void)
{
for (int chip = AGX_CHIP_G13G; chip <= AGX_CHIP_UNKNOWN; ++chip) {
const enum agx_chip c = (enum agx_chip)chip;
struct agx_device dev = { .chip = c };
const bool expect_cached =
(c == AGX_CHIP_G15G || c == AGX_CHIP_G15S || c == AGX_CHIP_G15C ||
c == AGX_CHIP_G17P || c == AGX_CHIP_G17G || c == AGX_CHIP_G17S ||
c == AGX_CHIP_G17C) &&
util_has_cache_ops();
assert(hk_g17p_cached_cmd_memory(&dev) == expect_cached);
}
struct agx_device g16g = { .chip = AGX_CHIP_G16G };
assert(!hk_g17p_cached_cmd_memory(&g16g));
}

int
main(void)
{
test_healthy_reuse();
test_lost_quarantine(AGX_CHIP_G17S, false);
test_lost_quarantine(AGX_CHIP_G16G, true);
test_vm_status_mirror_fast_reap();
test_cached_cmd_memory_chip_policy();
puts("hk_cmd_pending: ok");
return 0;
}