Skip to content

LLM inference in C/C++

C++ ggml

vulkan: add logging to pipeline compile issues (#29794)

Ruben Ortlamfb4b2737a808
diff --git a/ggml/src/ggml-vulkan/ggml-vulkan.cpp b/ggml/src/ggml-vulkan/ggml-vulkan.cpp
index cbd3697ef9..0c0f64e2b2 100644
--- a/ggml/src/ggml-vulkan/ggml-vulkan.cpp
+++ b/ggml/src/ggml-vulkan/ggml-vulkan.cpp
@@ -689,7 +689,12 @@ static void ggml_vk_create_pipeline_func(vk_device& device, vk_pipeline& pipelin
}
#endif
- pipeline->shader_module = device->device.createShaderModule(shader_module_create_info);
+ try {
+ pipeline->shader_module = device->device.createShaderModule(shader_module_create_info);
+ } catch (const vk::SystemError& e) {
+ std::cerr << "ggml_vulkan: shader module creation failed for " << pipeline->name << ": " << e.what() << std::endl;
+ throw;
+ }
vk::PushConstantRange pcr(
vk::ShaderStageFlagBits::eCompute,
@@ -698,7 +703,12 @@ static void ggml_vk_create_pipeline_func(vk_device& device, vk_pipeline& pipelin
);
vk::PipelineLayoutCreateInfo pipeline_layout_create_info(vk::PipelineLayoutCreateFlags(), device->dsl, pcr);
- pipeline->layout = device->device.createPipelineLayout(pipeline_layout_create_info);
+ try {
+ pipeline->layout = device->device.createPipelineLayout(pipeline_layout_create_info);
+ } catch (const vk::SystemError& e) {
+ std::cerr << "ggml_vulkan: pipeline layout creation failed for " << pipeline->name << ": " << e.what() << std::endl;
+ throw;
+ }
std::vector<vk::SpecializationMapEntry> specialization_entries(specialization_constants.size());
@@ -766,9 +776,8 @@ static void ggml_vk_create_pipeline_func(vk_device& device, vk_pipeline& pipelin
try {
pipeline->pipeline = device->device.createComputePipeline(VK_NULL_HANDLE, compute_pipeline_create_info).value;
} catch (const vk::SystemError& e) {
- std::cerr << "ggml_vulkan: Compute pipeline creation failed for " << pipeline->name << std::endl;
- std::cerr << "ggml_vulkan: " << e.what() << std::endl;
- throw e;
+ std::cerr << "ggml_vulkan: compute pipeline creation failed for " << pipeline->name << ": " << e.what() << std::endl;
+ throw;
}
if (vk_instance.debug_utils_support) {