upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/runtime/test/vk_harness.cpp
diff options
context:
space:
mode:
authoreIBart0 <gabriel.skaminski@gmail.com>2026-11-21 10:55:05 -0300
committereIBart0 <gabriel.skaminski@gmail.com>2026-11-21 10:55:05 -0300
commite72e13ecfeed9029b363e5a3ede90aa1df31e1f3 (patch)
treec57312f47712c56221b93354c13e73a894807358 /runtime/test/vk_harness.cpp
parent56f023a10a726da20702d4e121656ceda2391d93 (diff)
Vulkan tests: fix AMD vk_store_test bindings, add subgroupSizeControl, add GPU test runner
Diffstat (limited to 'runtime/test/vk_harness.cpp')
-rw-r--r--runtime/test/vk_harness.cpp33
1 files changed, 31 insertions, 2 deletions
diff --git a/runtime/test/vk_harness.cpp b/runtime/test/vk_harness.cpp
index 9835c5469..862deed80 100644
--- a/runtime/test/vk_harness.cpp
+++ b/runtime/test/vk_harness.cpp
@@ -45,11 +45,12 @@ int main(int argc, char** argv) {
45 VkInstance inst = VK_NULL_HANDLE; 45 VkInstance inst = VK_NULL_HANDLE;
46 LOADI(vkCreateInstance); 46 LOADI(vkCreateInstance);
47 VkApplicationInfo app{VK_STRUCTURE_TYPE_APPLICATION_INFO}; 47 VkApplicationInfo app{VK_STRUCTURE_TYPE_APPLICATION_INFO};
48 app.apiVersion = VK_API_VERSION_1_2; 48 app.apiVersion = VK_API_VERSION_1_3;
49 VkInstanceCreateInfo ici{VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO}; 49 VkInstanceCreateInfo ici{VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO};
50 ici.pApplicationInfo = &app; 50 ici.pApplicationInfo = &app;
51 CHECK(vkCreateInstance(&ici, nullptr, &inst)); 51 CHECK(vkCreateInstance(&ici, nullptr, &inst));
52 LOADI(vkEnumeratePhysicalDevices); LOADI(vkGetPhysicalDeviceProperties); 52 LOADI(vkEnumeratePhysicalDevices); LOADI(vkGetPhysicalDeviceProperties);
53 LOADI(vkGetPhysicalDeviceProperties2); LOADI(vkGetPhysicalDeviceFeatures2);
53 LOADI(vkGetPhysicalDeviceQueueFamilyProperties); LOADI(vkGetPhysicalDeviceMemoryProperties); 54 LOADI(vkGetPhysicalDeviceQueueFamilyProperties); LOADI(vkGetPhysicalDeviceMemoryProperties);
54 LOADI(vkCreateDevice); LOADI(vkGetDeviceProcAddr); 55 LOADI(vkCreateDevice); LOADI(vkGetDeviceProcAddr);
55 uint32_t n = 0; 56 uint32_t n = 0;
@@ -62,7 +63,11 @@ int main(int argc, char** argv) {
62 if (p.deviceType == VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU || !pd) pd = d; 63 if (p.deviceType == VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU || !pd) pd = d;
63 } 64 }
64 VkPhysicalDeviceProperties props; vkGetPhysicalDeviceProperties(pd, &props); 65 VkPhysicalDeviceProperties props; vkGetPhysicalDeviceProperties(pd, &props);
65 std::fprintf(stderr, "device: %s\n", props.deviceName); 66 VkPhysicalDeviceSubgroupSizeControlProperties sgProps{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_SIZE_CONTROL_PROPERTIES};
67 VkPhysicalDeviceProperties2 props2{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2};
68 props2.pNext = &sgProps;
69 vkGetPhysicalDeviceProperties2(pd, &props2);
70 std::fprintf(stderr, "device: %s (subgroup %u..%u)\n", props.deviceName, sgProps.minSubgroupSize, sgProps.maxSubgroupSize);
66 uint32_t qn = 0; 71 uint32_t qn = 0;
67 vkGetPhysicalDeviceQueueFamilyProperties(pd, &qn, nullptr); 72 vkGetPhysicalDeviceQueueFamilyProperties(pd, &qn, nullptr);
68 std::vector<VkQueueFamilyProperties> qf(qn); 73 std::vector<VkQueueFamilyProperties> qf(qn);
@@ -109,6 +114,16 @@ int main(int argc, char** argv) {
109 enable.push_back(VK_KHR_MAINTENANCE_8_EXTENSION_NAME); 114 enable.push_back(VK_KHR_MAINTENANCE_8_EXTENSION_NAME);
110 m8.maintenance8 = VK_TRUE; m8.pNext = chain; chain = &m8; 115 m8.maintenance8 = VK_TRUE; m8.pNext = chain; chain = &m8;
111 } 116 }
117 VkPhysicalDeviceVulkan13Features f13q{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_3_FEATURES};
118 VkPhysicalDeviceFeatures2 f2q{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2};
119 f2q.pNext = &f13q;
120 vkGetPhysicalDeviceFeatures2(pd, &f2q);
121 VkPhysicalDeviceVulkan13Features f13{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_3_FEATURES};
122 if (f13q.subgroupSizeControl) {
123 f13.subgroupSizeControl = VK_TRUE;
124 f13.pNext = chain;
125 chain = &f13;
126 }
112 for (auto e : enable) std::fprintf(stderr, "enabled %s\n", e); 127 for (auto e : enable) std::fprintf(stderr, "enabled %s\n", e);
113 VkDeviceCreateInfo dci{VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO}; 128 VkDeviceCreateInfo dci{VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO};
114 dci.queueCreateInfoCount = 1; dci.pQueueCreateInfos = &qci; 129 dci.queueCreateInfoCount = 1; dci.pQueueCreateInfos = &qci;
@@ -186,6 +201,20 @@ int main(int argc, char** argv) {
186 stages[2].stage = VK_SHADER_STAGE_GEOMETRY_BIT; stages[2].module = gsm; stages[2].pName = "main"; 201 stages[2].stage = VK_SHADER_STAGE_GEOMETRY_BIT; stages[2].module = gsm; stages[2].pName = "main";
187 nstages = 3; 202 nstages = 3;
188 } 203 }
204 const char* sg_env = std::getenv("VKH_SUBGROUP_SIZE");
205 const uint32_t req_sg = sg_env ? uint32_t(atoi(sg_env)) : 0;
206 VkPipelineShaderStageRequiredSubgroupSizeCreateInfo reqSg{
207 VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_REQUIRED_SUBGROUP_SIZE_CREATE_INFO};
208 reqSg.requiredSubgroupSize = req_sg;
209 if (req_sg > 0 && f13q.subgroupSizeControl &&
210 req_sg >= sgProps.minSubgroupSize && req_sg <= sgProps.maxSubgroupSize) {
211 if (mesh && (sgProps.requiredSubgroupSizeStages & VK_SHADER_STAGE_MESH_BIT_EXT))
212 stages[0].pNext = &reqSg;
213 else if (gs_path && (sgProps.requiredSubgroupSizeStages & VK_SHADER_STAGE_GEOMETRY_BIT))
214 stages[2].pNext = &reqSg;
215 else if (!mesh && !gs_path && (sgProps.requiredSubgroupSizeStages & VK_SHADER_STAGE_FRAGMENT_BIT))
216 stages[1].pNext = &reqSg;
217 }
189 VkPipelineVertexInputStateCreateInfo vin{VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO}; 218 VkPipelineVertexInputStateCreateInfo vin{VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO};
190 VkPipelineInputAssemblyStateCreateInfo ia{VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO}; 219 VkPipelineInputAssemblyStateCreateInfo ia{VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO};
191 ia.topology = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST; 220 ia.topology = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST;