Skip to content

Commit f07781e

Browse files
authored
Merge pull request #37 from jpgaribotti/QVAC-6570
QVAC-6570: Force vulkan perf logging through cmake options
2 parents 5545231 + 6501203 commit f07781e

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,9 @@ option(LLAMA_MTMD "llama: multimodal support" ${LLAMA_BUILD_TOOLS})
9090
option(LLAMA_CURL "llama: use libcurl to download model from an URL" ON)
9191
option(LLAMA_LLGUIDANCE "llama-common: include LLGuidance library for structured output in common utils" OFF)
9292

93+
# profiling
94+
option(FORCE_GGML_VK_PERF_LOGGER "Force vk performance logging in ggml" OFF)
95+
9396
# Required for relocatable CMake package
9497
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/build-info.cmake)
9598
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/common.cmake)

ggml/src/ggml-vulkan/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,9 @@ if (Vulkan_FOUND)
9292
target_include_directories(ggml-vulkan PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
9393
target_include_directories(ggml-vulkan PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/vulkan_cpp_wrapper/include")
9494

95+
if (FORCE_GGML_VK_PERF_LOGGER)
96+
add_compile_definitions(FORCE_GGML_VK_PERF_LOGGER)
97+
endif()
9598
# Workaround to the "can't dereference invalidated vector iterator" bug in clang-cl debug build
9699
# Posssibly relevant: https://stackoverflow.com/questions/74748276/visual-studio-no-displays-the-correct-length-of-stdvector
97100
if (MSVC AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang")

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4486,7 +4486,11 @@ static void ggml_vk_instance_init() {
44864486
vk_instance.pfn_vkCmdInsertDebugUtilsLabelEXT = (PFN_vkCmdInsertDebugUtilsLabelEXT) vkGetInstanceProcAddr(vk_instance.instance, "vkCmdInsertDebugUtilsLabelEXT");
44874487
}
44884488

4489+
#ifndef FORCE_GGML_VK_PERF_LOGGER
44894490
vk_perf_logger_enabled = getenv("GGML_VK_PERF_LOGGER") != nullptr;
4491+
#else
4492+
vk_perf_logger_enabled = true;
4493+
#endif
44904494

44914495
std::vector<vk::PhysicalDevice> devices = vk_instance.instance.enumeratePhysicalDevices();
44924496

0 commit comments

Comments
 (0)