mirror of
https://github.com/lemonade-sdk/mac_linuxgpu.git
synced 2026-11-22 23:57:31 -10:00
radv offline test waits for the shader upload; stats split syncobj polls
vkCreateComputePipelines returns once the shader's SDMA copy is submitted; the fixture engine runs it after. The test read the engine counters once and passed only while the driver was slow enough. It now waits up to 10 s for the copy. LIBDRM_MLG_STATS counts zero-timeout SYNCOBJ_WAIT and SYNCOBJ_TIMELINE_WAIT (polls; a failure is "not yet") apart from the waits that may sleep.
This commit is contained in:
1 parent
0c700fd4f3
commit
bffa8423bc
2 files changed
+28
-3
No files matched your search
@@ -143,6 +143,9 @@ struct request_stat {
|
||||
};
|
||||
static struct request_stat request_stats[256];
|
||||
static struct request_stat mmap_stat, munmap_stat;
|
||||
/* Syncobj waits with a zero timeout (polls: a failure is "not yet"),
|
||||
* apart from the ones that may sleep. */
|
||||
static struct request_stat wait_poll_stat, timeline_wait_poll_stat;
|
||||
static int stats_enabled = -1;
|
||||
|
||||
static uint64_t now_ns(void)
|
||||
@@ -223,8 +226,11 @@ static void stats_print(void)
|
||||
snprintf(other, sizeof(other), "request 0x%02x", nr);
|
||||
name = other;
|
||||
}
|
||||
stat_print(name, &request_stats[nr]);
|
||||
stat_print(nr == 0xc3 || nr == 0xca ? (nr == 0xc3 ? "SYNCOBJ_WAIT (may sleep)" :
|
||||
"SYNCOBJ_TIMELINE_WAIT (may sleep)") : name, &request_stats[nr]);
|
||||
}
|
||||
stat_print("SYNCOBJ_WAIT (polls)", &wait_poll_stat);
|
||||
stat_print("SYNCOBJ_TIMELINE_WAIT (polls)", &timeline_wait_poll_stat);
|
||||
stat_print("mmap", &mmap_stat);
|
||||
stat_print("munmap", &munmap_stat);
|
||||
}
|
||||
@@ -241,6 +247,17 @@ static bool stats_on(void)
|
||||
return stats_enabled;
|
||||
}
|
||||
|
||||
static struct request_stat *stat_slot(unsigned long req, const void *arg)
|
||||
{
|
||||
if (req == DRM_IOCTL_SYNCOBJ_WAIT &&
|
||||
!((const struct drm_syncobj_wait *)arg)->timeout_nsec)
|
||||
return &wait_poll_stat;
|
||||
if (req == DRM_IOCTL_SYNCOBJ_TIMELINE_WAIT &&
|
||||
!((const struct drm_syncobj_timeline_wait *)arg)->timeout_nsec)
|
||||
return &timeline_wait_poll_stat;
|
||||
return &request_stats[req & 0xff];
|
||||
}
|
||||
|
||||
int drmIoctl(int fd, unsigned long req, void *arg)
|
||||
{
|
||||
uint64_t start;
|
||||
@@ -250,7 +267,7 @@ int drmIoctl(int fd, unsigned long req, void *arg)
|
||||
return report("request", req, drm_ioctl_fd(fd, req, arg));
|
||||
start = now_ns();
|
||||
r = drm_ioctl_fd(fd, req, arg);
|
||||
stat_add(&request_stats[req & 0xff], now_ns() - start, r != 0);
|
||||
stat_add(stat_slot(req, arg), now_ns() - start, r != 0);
|
||||
return report("request", req, r);
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <vulkan/vulkan.h>
|
||||
|
||||
@@ -296,7 +297,14 @@ int main(int argc, char **argv)
|
||||
VK(vkCreateComputePipelines(device, VK_NULL_HANDLE, 1, &cpi, NULL, &pipeline));
|
||||
cs_fixture_stats(&after);
|
||||
#if defined(__APPLE__) && defined(__aarch64__)
|
||||
/* No CPU-visible VRAM: the shader reached VRAM by an SDMA copy. */
|
||||
/* No CPU-visible VRAM: the shader reached VRAM by an SDMA copy. The
|
||||
* pipeline is created once the copy is submitted; the engine runs it
|
||||
* after (RADV waits for the upload before the shader's first use). */
|
||||
for (int ms = 0; ms < 10000 && !(after.copies > before.copies &&
|
||||
after.sdma_ibs > before.sdma_ibs); ++ms) {
|
||||
usleep(1000);
|
||||
cs_fixture_stats(&after);
|
||||
}
|
||||
CHECK(after.copies > before.copies && after.sdma_ibs > before.sdma_ibs);
|
||||
printf("compute pipeline compiled, uploaded to VRAM by SDMA (%lu copy)\n",
|
||||
after.copies - before.copies);
|
||||
|
||||
Reference in new issue
Block a user