-
Notifications
You must be signed in to change notification settings - Fork 169
Open
Description
So I have noticed an over-eager behavior in allocating 10 MB of memory on GPU. I was able to reproduce the behavior with the following code in C language:
#include <vulkan/vulkan.h>
#include <stdio.h>
#include <stdlib.h>
int main() {
VkInstance instance;
VkApplicationInfo appInfo = {
.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO,
.pApplicationName = "VkInstanceTest",
.applicationVersion = VK_MAKE_VERSION(1, 0, 0),
.pEngineName = "NoEngine",
.engineVersion = VK_MAKE_VERSION(1, 0, 0),
.apiVersion = VK_API_VERSION_1_0
};
VkInstanceCreateInfo createInfo = {
.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO,
.pApplicationInfo = &appInfo
};
VkResult result = vkCreateInstance(&createInfo, NULL, &instance);
if (result != VK_SUCCESS) {
fprintf(stderr, "Failed to create Vulkan instance! Error code: %d\n", result);
return EXIT_FAILURE;
}
printf("VkInstance created successfully.\n");
printf("Press Enter to exit...\n");
getchar(); // Wait for user to press Enter
vkDestroyInstance(instance, NULL);
printf("VkInstance destroyed.\n");
return EXIT_SUCCESS;
}
And you can build it by running clang -lvulkan demo.c -o demovulkan assuming that the c file is demo.c. When running with nvtop program which tracks real-time usage of GPU memory, on your AMDVLK, it over-eagerly allocate 10 MB on the GPU without a reason to when VkDevice have yet to be allocated or built when running above code. So if you instead point to using RADV driver, it reports either 0 mb allocation on GPU or not showing up at nvtop at all.
VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/radeon_icd.x86_64.json ./demovulkan
Thanks.
Metadata
Metadata
Assignees
Labels
No labels