mirror of
				https://github.com/ggml-org/llama.cpp.git
				synced 2025-10-30 08:42:00 +00:00 
			
		
		
		
	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
This commit is contained in:
		| @@ -774,12 +774,12 @@ static uint32_t compile_count = 0; | |||||||
| static std::mutex compile_count_mutex; | static std::mutex compile_count_mutex; | ||||||
| static std::condition_variable compile_count_cond; | static std::condition_variable compile_count_cond; | ||||||
|  |  | ||||||
| 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, | 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, | ||||||
|                                          uint32_t parameter_count, uint32_t push_constant_size, std::array<uint32_t, 3> wg_denoms, std::vector<uint32_t> specialization_constants, |                                          uint32_t parameter_count, std::array<uint32_t, 3> wg_denoms, std::vector<uint32_t> specialization_constants, | ||||||
|                                          uint32_t align, bool disable_robustness, bool require_full_subgroups, uint32_t required_subgroup_size) { |                                          bool disable_robustness, bool require_full_subgroups, uint32_t required_subgroup_size) { | ||||||
|     VK_LOG_DEBUG("ggml_vk_create_pipeline(" << device->name << ", " << name << ", " << entrypoint << ", " << parameter_count << ", " << push_constant_size << |     VK_LOG_DEBUG("ggml_vk_create_pipeline(" << device->name << ", " << pipeline->name << ", " << entrypoint << ", " << parameter_count << | ||||||
|                  ", (" << wg_denoms[0] << "," << wg_denoms[1] << "," << wg_denoms[2] << "), specialization_constants, " << align << |                  ", (" << wg_denoms[0] << "," << wg_denoms[1] << "," << wg_denoms[2] << "), specialization_constants, " << | ||||||
|                  ", " << disable_robustness << ", " << require_full_subgroups << ", " << required_subgroup_size << ")"); |                  disable_robustness << ", " << require_full_subgroups << ", " << required_subgroup_size << ")"); | ||||||
|     GGML_ASSERT(parameter_count > 0); |     GGML_ASSERT(parameter_count > 0); | ||||||
|     GGML_ASSERT(wg_denoms[0] > 0 && wg_denoms[1] > 0 && wg_denoms[2] > 0); // NOLINT |     GGML_ASSERT(wg_denoms[0] > 0 && wg_denoms[1] > 0 && wg_denoms[2] > 0); // NOLINT | ||||||
|  |  | ||||||
| @@ -864,7 +864,13 @@ static void ggml_vk_create_pipeline_func(vk_device& device, vk_pipeline& pipelin | |||||||
|         compute_pipeline_create_info.setPNext(&rci); |         compute_pipeline_create_info.setPNext(&rci); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     try { | ||||||
|         pipeline->pipeline = device->device.createComputePipeline(VK_NULL_HANDLE, compute_pipeline_create_info).value; |         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; | ||||||
|  |     } | ||||||
|     pipeline->compiled = true; |     pipeline->compiled = true; | ||||||
|  |  | ||||||
|     { |     { | ||||||
| @@ -1560,8 +1566,8 @@ static void ggml_vk_load_shaders(vk_device& device) { | |||||||
|             } |             } | ||||||
|             compile_count++; |             compile_count++; | ||||||
|         } |         } | ||||||
|         compiles.push_back(std::async(ggml_vk_create_pipeline_func, std::ref(device), std::ref(pipeline), name, spv_size, spv_data, entrypoint, |         compiles.push_back(std::async(ggml_vk_create_pipeline_func, std::ref(device), std::ref(pipeline), spv_size, spv_data, entrypoint, | ||||||
|                                       parameter_count, push_constant_size, wg_denoms, specialization_constants, align, disable_robustness, require_full_subgroups, required_subgroup_size)); |                                       parameter_count, wg_denoms, specialization_constants, disable_robustness, require_full_subgroups, required_subgroup_size)); | ||||||
|     }; |     }; | ||||||
|  |  | ||||||
| #if defined(VK_NV_cooperative_matrix2) && defined(GGML_VULKAN_COOPMAT2_GLSLC_SUPPORT) | #if defined(VK_NV_cooperative_matrix2) && defined(GGML_VULKAN_COOPMAT2_GLSLC_SUPPORT) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Jeff Bolz
					Jeff Bolz