jeffbolznv commited on
Commit
d4f6b2c
·
1 Parent(s): 72c6f1d

vulkan: Catch pipeline creation failure and print an error message (llama/11436)

Browse files

* 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

ggml/src/ggml-vulkan/ggml-vulkan.cpp CHANGED
@@ -774,12 +774,12 @@ static uint32_t compile_count = 0;
774
  static std::mutex compile_count_mutex;
775
  static std::condition_variable compile_count_cond;
776
 
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 << ")");
783
  GGML_ASSERT(parameter_count > 0);
784
  GGML_ASSERT(wg_denoms[0] > 0 && wg_denoms[1] > 0 && wg_denoms[2] > 0); // NOLINT
785
 
@@ -864,7 +864,13 @@ static void ggml_vk_create_pipeline_func(vk_device& device, vk_pipeline& pipelin
864
  compute_pipeline_create_info.setPNext(&rci);
865
  }
866
 
867
- pipeline->pipeline = device->device.createComputePipeline(VK_NULL_HANDLE, compute_pipeline_create_info).value;
 
 
 
 
 
 
868
  pipeline->compiled = true;
869
 
870
  {
@@ -1560,8 +1566,8 @@ static void ggml_vk_load_shaders(vk_device& device) {
1560
  }
1561
  compile_count++;
1562
  }
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));
1565
  };
1566
 
1567
  #if defined(VK_NV_cooperative_matrix2) && defined(GGML_VULKAN_COOPMAT2_GLSLC_SUPPORT)
 
774
  static std::mutex compile_count_mutex;
775
  static std::condition_variable compile_count_cond;
776
 
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 << ")");
783
  GGML_ASSERT(parameter_count > 0);
784
  GGML_ASSERT(wg_denoms[0] > 0 && wg_denoms[1] > 0 && wg_denoms[2] > 0); // NOLINT
785
 
 
864
  compute_pipeline_create_info.setPNext(&rci);
865
  }
866
 
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
+ }
874
  pipeline->compiled = true;
875
 
876
  {
 
1566
  }
1567
  compile_count++;
1568
  }
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));
1571
  };
1572
 
1573
  #if defined(VK_NV_cooperative_matrix2) && defined(GGML_VULKAN_COOPMAT2_GLSLC_SUPPORT)