upleb.uk

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

summaryrefslogtreecommitdiff
path: root/runtime/test/vk_pipeline_check.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/test/vk_pipeline_check.cpp')
-rw-r--r--runtime/test/vk_pipeline_check.cpp35
1 files changed, 30 insertions, 5 deletions
diff --git a/runtime/test/vk_pipeline_check.cpp b/runtime/test/vk_pipeline_check.cpp
index 0e39d0f62..3ff89524f 100644
--- a/runtime/test/vk_pipeline_check.cpp
+++ b/runtime/test/vk_pipeline_check.cpp
@@ -7,10 +7,10 @@
7// descriptor-free shaders with the standard push-constant range 7// descriptor-free shaders with the standard push-constant range
8// - ps/vs/ms/gs: graphics pipeline via vkCreateGraphicsPipelines (Vulkan 1.3 dynamic rendering, no render pass) 8// - ps/vs/ms/gs: graphics pipeline via vkCreateGraphicsPipelines (Vulkan 1.3 dynamic rendering, no render pass)
9// paired with minimal partner stubs from <spirv dir>/stubs/ (generated by tools/spirv_stubs.py) 9// paired with minimal partner stubs from <spirv dir>/stubs/ (generated by tools/spirv_stubs.py)
10// VK_EXT_mesh_shader (with meshShaderQueries) and VK_KHR_maintenance8 are always enabled when supported so the 10// VK_EXT_mesh_shader (with meshShaderQueries), VK_KHR_maintenance8 and VK_EXT_transform_feedback are always enabled
11// saved pipeline cache matches the runtime's device key; other optional device extensions are enabled only when 11// when supported so the saved pipeline cache matches the runtime's device key; other optional device extensions are
12// needed by the selected shaders. Shaders whose required features or partner stubs are unavailable are reported as 12// enabled only when needed by the selected shaders. Shaders whose required features or partner stubs are unavailable
13// skipped rather than failed. 13// are reported as skipped rather than failed.
14// [cache.bin] loaded first if it exists (a stopped run resumes: cached pipelines are instant), saved every 14// [cache.bin] loaded first if it exists (a stopped run resumes: cached pipelines are instant), saved every
15// 10 minutes and at the end 15// 10 minutes and at the end
16// --jobs N compile on up to N worker threads (default: half the hardware threads) 16// --jobs N compile on up to N worker threads (default: half the hardware threads)
@@ -30,6 +30,9 @@
30// --cache-feedback count each stage's successful pipelines by VkPipelineCreationFeedback: hits (VALID and 30// --cache-feedback count each stage's successful pipelines by VkPipelineCreationFeedback: hits (VALID and
31// APPLICATION_PIPELINE_CACHE_HIT), no hit reported (VALID only) and unavailable (no VALID bit, or a 31// APPLICATION_PIPELINE_CACHE_HIT), no hit reported (VALID only) and unavailable (no VALID bit, or a
32// pre-1.3 device without VK_EXT_pipeline_creation_feedback). The three add up to the ok count. 32// pre-1.3 device without VK_EXT_pipeline_creation_feedback). The three add up to the ok count.
33// --nv-diagnostics create the device with VK_NV_device_diagnostics_config and the flags the runtime's
34// LEONIDA_DEVICE_FAULT=1 / LEONIDA_AFTERMATH=1 use (shader debug info, resource tracking, automatic
35// checkpoints), to measure what that does to compile times and to cache hits
33// --isolate check in child processes, --isolate-batch modules at a time (default 256), so a module 36// --isolate check in child processes, --isolate-batch modules at a time (default 256), so a module
34// that kills the driver is recorded as failed ("MODULE CRASH") and the pass 37// that kills the driver is recorded as failed ("MODULE CRASH") and the pass
35// goes on. A crashed batch is bisected to the module. Children run one after the other and share 38// goes on. A crashed batch is bisected to the module. Children run one after the other and share
@@ -806,7 +809,7 @@ int main(int argc, char** argv) {
806 unsigned large_parallel = 0; // 0 = by the memory budget 809 unsigned large_parallel = 0; // 0 = by the memory budget
807 double slow = 30.0; 810 double slow = 30.0;
808 std::string stage_filter = "all"; 811 std::string stage_filter = "all";
809 bool cache_feedback = false, isolate = false, iso_child = false; 812 bool cache_feedback = false, isolate = false, iso_child = false, nv_diagnostics = false;
810 size_t isolate_batch = 256; 813 size_t isolate_batch = 256;
811 for (int i = 2; i < argc; i++) { 814 for (int i = 2; i < argc; i++) {
812 std::string a = argv[i]; 815 std::string a = argv[i];
@@ -851,6 +854,7 @@ int main(int argc, char** argv) {
851 else if (a == "--skip-file") valid = !(skip_path = value()).empty(); 854 else if (a == "--skip-file") valid = !(skip_path = value()).empty();
852 else if (a == "--cache-feedback") cache_feedback = true; 855 else if (a == "--cache-feedback") cache_feedback = true;
853 else if (a == "--isolate") isolate = true; 856 else if (a == "--isolate") isolate = true;
857 else if (a == "--nv-diagnostics") nv_diagnostics = true;
854 else if (a == "--isolate-child") iso_child = true; // internal: the parent's child runs 858 else if (a == "--isolate-child") iso_child = true; // internal: the parent's child runs
855 else if (a == "--isolate-batch") { // parsed like the other numbers (#1735); at least one per batch 859 else if (a == "--isolate-batch") { // parsed like the other numbers (#1735); at least one per batch
856 valid = number(isolate_batch); 860 valid = number(isolate_batch);
@@ -1122,6 +1126,7 @@ int main(int argc, char** argv) {
1122 1126
1123 // Query the core and optional device features used by the checker. 1127 // Query the core and optional device features used by the checker.
1124 VkPhysicalDeviceMeshShaderFeaturesEXT mesh{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MESH_SHADER_FEATURES_EXT}; 1128 VkPhysicalDeviceMeshShaderFeaturesEXT mesh{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MESH_SHADER_FEATURES_EXT};
1129 VkPhysicalDeviceTransformFeedbackFeaturesEXT tf{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TRANSFORM_FEEDBACK_FEATURES_EXT};
1125 VkPhysicalDeviceFragmentShaderBarycentricFeaturesKHR bary{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADER_BARYCENTRIC_FEATURES_KHR}; 1130 VkPhysicalDeviceFragmentShaderBarycentricFeaturesKHR bary{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADER_BARYCENTRIC_FEATURES_KHR};
1126 VkPhysicalDeviceFragmentShaderInterlockFeaturesEXT lock{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADER_INTERLOCK_FEATURES_EXT}; 1131 VkPhysicalDeviceFragmentShaderInterlockFeaturesEXT lock{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADER_INTERLOCK_FEATURES_EXT};
1127#ifdef VK_KHR_MAINTENANCE_8_EXTENSION_NAME 1132#ifdef VK_KHR_MAINTENANCE_8_EXTENSION_NAME
@@ -1144,6 +1149,10 @@ int main(int argc, char** argv) {
1144 link(&f12, reinterpret_cast<VkBaseOutStructure*>(&f12), nullptr, true); 1149 link(&f12, reinterpret_cast<VkBaseOutStructure*>(&f12), nullptr, true);
1145 link(&f13, reinterpret_cast<VkBaseOutStructure*>(&f13), nullptr, true); 1150 link(&f13, reinterpret_cast<VkBaseOutStructure*>(&f13), nullptr, true);
1146 const bool ext_mesh = link(&mesh, reinterpret_cast<VkBaseOutStructure*>(&mesh), VK_EXT_MESH_SHADER_EXTENSION_NAME, true); 1151 const bool ext_mesh = link(&mesh, reinterpret_cast<VkBaseOutStructure*>(&mesh), VK_EXT_MESH_SHADER_EXTENSION_NAME, true);
1152 // The runtime's device enables VK_EXT_transform_feedback (transformFeedback, and geometryStreams when the device
1153 // offers it) whenever the extension is present (D3D-302), and a driver makes it part of a pipeline's cache key, so
1154 // the checker enables it too (docs/pipeline_check.md, "The cache and the runtime's device").
1155 link(&tf, reinterpret_cast<VkBaseOutStructure*>(&tf), VK_EXT_TRANSFORM_FEEDBACK_EXTENSION_NAME, true);
1147 const bool ext_bary = link(&bary, reinterpret_cast<VkBaseOutStructure*>(&bary), VK_KHR_FRAGMENT_SHADER_BARYCENTRIC_EXTENSION_NAME, want_bary); 1156 const bool ext_bary = link(&bary, reinterpret_cast<VkBaseOutStructure*>(&bary), VK_KHR_FRAGMENT_SHADER_BARYCENTRIC_EXTENSION_NAME, want_bary);
1148 const bool ext_lock = link(&lock, reinterpret_cast<VkBaseOutStructure*>(&lock), VK_EXT_FRAGMENT_SHADER_INTERLOCK_EXTENSION_NAME, want_lock); 1157 const bool ext_lock = link(&lock, reinterpret_cast<VkBaseOutStructure*>(&lock), VK_EXT_FRAGMENT_SHADER_INTERLOCK_EXTENSION_NAME, want_lock);
1149#ifdef VK_KHR_MAINTENANCE_8_EXTENSION_NAME 1158#ifdef VK_KHR_MAINTENANCE_8_EXTENSION_NAME
@@ -1158,6 +1167,13 @@ int main(int argc, char** argv) {
1158#endif 1167#endif
1159 VkPhysicalDeviceShaderClockFeaturesKHR clock{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_CLOCK_FEATURES_KHR}; 1168 VkPhysicalDeviceShaderClockFeaturesKHR clock{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_CLOCK_FEATURES_KHR};
1160 const bool ext_clock = link(&clock, reinterpret_cast<VkBaseOutStructure*>(&clock), VK_KHR_SHADER_CLOCK_EXTENSION_NAME, want_clock); 1169 const bool ext_clock = link(&clock, reinterpret_cast<VkBaseOutStructure*>(&clock), VK_KHR_SHADER_CLOCK_EXTENSION_NAME, want_clock);
1170 VkPhysicalDeviceDiagnosticsConfigFeaturesNV diag_features{VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DIAGNOSTICS_CONFIG_FEATURES_NV};
1171 const bool ext_diag = link(&diag_features, reinterpret_cast<VkBaseOutStructure*>(&diag_features),
1172 VK_NV_DEVICE_DIAGNOSTICS_CONFIG_EXTENSION_NAME, nv_diagnostics);
1173 if (nv_diagnostics && !ext_diag) {
1174 std::fprintf(stderr, "--nv-diagnostics: the device has no %s\n", VK_NV_DEVICE_DIAGNOSTICS_CONFIG_EXTENSION_NAME);
1175 return 1;
1176 }
1161 const bool ext_exe = link(&exe, reinterpret_cast<VkBaseOutStructure*>(&exe), 1177 const bool ext_exe = link(&exe, reinterpret_cast<VkBaseOutStructure*>(&exe),
1162 VK_KHR_PIPELINE_EXECUTABLE_PROPERTIES_EXTENSION_NAME, !stats_path.empty()); 1178 VK_KHR_PIPELINE_EXECUTABLE_PROPERTIES_EXTENSION_NAME, !stats_path.empty());
1163 if (!stats_path.empty() && !ext_exe) { 1179 if (!stats_path.empty() && !ext_exe) {
@@ -1201,6 +1217,15 @@ int main(int argc, char** argv) {
1201 VkDeviceCreateInfo dci{VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO}; 1217 VkDeviceCreateInfo dci{VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO};
1202 dci.queueCreateInfoCount = 1; dci.pQueueCreateInfos = &qci; dci.pNext = &f2; 1218 dci.queueCreateInfoCount = 1; dci.pQueueCreateInfos = &qci; dci.pNext = &f2;
1203 dci.enabledExtensionCount = uint32_t(enable.size()); dci.ppEnabledExtensionNames = enable.data(); 1219 dci.enabledExtensionCount = uint32_t(enable.size()); dci.ppEnabledExtensionNames = enable.data();
1220 VkDeviceDiagnosticsConfigCreateInfoNV diag_config{VK_STRUCTURE_TYPE_DEVICE_DIAGNOSTICS_CONFIG_CREATE_INFO_NV};
1221 if (ext_diag) {
1222 diag_config.flags = VK_DEVICE_DIAGNOSTICS_CONFIG_ENABLE_SHADER_DEBUG_INFO_BIT_NV |
1223 VK_DEVICE_DIAGNOSTICS_CONFIG_ENABLE_RESOURCE_TRACKING_BIT_NV |
1224 VK_DEVICE_DIAGNOSTICS_CONFIG_ENABLE_AUTOMATIC_CHECKPOINTS_BIT_NV;
1225 diag_config.pNext = dci.pNext;
1226 dci.pNext = &diag_config;
1227 std::printf("device: VK_NV_device_diagnostics_config on (shader debug info, resource tracking, checkpoints)\n");
1228 }
1204 VkDevice dev; 1229 VkDevice dev;
1205 if (VkResult r = vkCreateDevice(pd, &dci, nullptr, &dev)) { std::fprintf(stderr, "vkCreateDevice %d\n", r); return 1; } 1230 if (VkResult r = vkCreateDevice(pd, &dci, nullptr, &dev)) { std::fprintf(stderr, "vkCreateDevice %d\n", r); return 1; }
1206 leonida::SubgroupSizeCaps runtime_subgroups; 1231 leonida::SubgroupSizeCaps runtime_subgroups;