Skip to content

Commit 2711d02

Browse files
authored
vulkan: Catch pipeline creation failure and print an error message (#11436)
* vulkan: Catch pipeline creation failure and print an error message Also, fix some warnings from my on-demand compile change. * vulkan: fix pipeline creation logging
1 parent f0d4b29 commit 2711d02

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

ggml/src/ggml-vulkan/ggml-vulkan.cpp

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -774,12 +774,12 @@ static uint32_t compile_count = 0;
774774
static std::mutex compile_count_mutex;
775775
static std::condition_variable compile_count_cond;
776776

777-
static void ggml_vk_create_pipeline_func(vk_device& device, vk_pipeline& pipeline, const std::string name, size_t spv_size, const void* spv_data, const std::string entrypoint,
778-
uint32_t parameter_count, uint32_t push_constant_size, std::array<uint32_t, 3> wg_denoms, std::vector<uint32_t> specialization_constants,
779-
uint32_t align, bool disable_robustness, bool require_full_subgroups, uint32_t required_subgroup_size) {
780-
VK_LOG_DEBUG("ggml_vk_create_pipeline(" << device->name << ", " << name << ", " << entrypoint << ", " << parameter_count << ", " << push_constant_size <<
781-
", (" << wg_denoms[0] << "," << wg_denoms[1] << "," << wg_denoms[2] << "), specialization_constants, " << align <<
782-
", " << disable_robustness << ", " << require_full_subgroups << ", " << required_subgroup_size << ")");
777+
static void ggml_vk_create_pipeline_func(vk_device& device, vk_pipeline& pipeline, size_t spv_size, const void* spv_data, const std::string entrypoint,
778+
uint32_t parameter_count, std::array<uint32_t, 3> wg_denoms, std::vector<uint32_t> specialization_constants,
779+
bool disable_robustness, bool require_full_subgroups, uint32_t required_subgroup_size) {
780+
VK_LOG_DEBUG("ggml_vk_create_pipeline(" << device->name << ", " << pipeline->name << ", " << entrypoint << ", " << parameter_count <<
781+
", (" << wg_denoms[0] << "," << wg_denoms[1] << "," << wg_denoms[2] << "), specialization_constants, " <<
782+
disable_robustness << ", " << require_full_subgroups << ", " << required_subgroup_size << ")");
783783
GGML_ASSERT(parameter_count > 0);
784784
GGML_ASSERT(wg_denoms[0] > 0 && wg_denoms[1] > 0 && wg_denoms[2] > 0); // NOLINT
785785

@@ -864,7 +864,13 @@ static void ggml_vk_create_pipeline_func(vk_device& device, vk_pipeline& pipelin
864864
compute_pipeline_create_info.setPNext(&rci);
865865
}
866866

867-
pipeline->pipeline = device->device.createComputePipeline(VK_NULL_HANDLE, compute_pipeline_create_info).value;
867+
try {
868+
pipeline->pipeline = device->device.createComputePipeline(VK_NULL_HANDLE, compute_pipeline_create_info).value;
869+
} catch (const vk::SystemError& e) {
870+
std::cerr << "ggml_vulkan: Compute pipeline creation failed for " << pipeline->name << std::endl;
871+
std::cerr << "ggml_vulkan: " << e.what() << std::endl;
872+
throw e;
873+
}
868874
pipeline->compiled = true;
869875

870876
{
@@ -1560,8 +1566,8 @@ static void ggml_vk_load_shaders(vk_device& device) {
15601566
}
15611567
compile_count++;
15621568
}
1563-
compiles.push_back(std::async(ggml_vk_create_pipeline_func, std::ref(device), std::ref(pipeline), name, spv_size, spv_data, entrypoint,
1564-
parameter_count, push_constant_size, wg_denoms, specialization_constants, align, disable_robustness, require_full_subgroups, required_subgroup_size));
1569+
compiles.push_back(std::async(ggml_vk_create_pipeline_func, std::ref(device), std::ref(pipeline), spv_size, spv_data, entrypoint,
1570+
parameter_count, wg_denoms, specialization_constants, disable_robustness, require_full_subgroups, required_subgroup_size));
15651571
};
15661572

15671573
#if defined(VK_NV_cooperative_matrix2) && defined(GGML_VULKAN_COOPMAT2_GLSLC_SUPPORT)

0 commit comments

Comments
 (0)