]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
vulkan: add workaround for iterator boundary check to fix clang-cl debug build (...
authork.h.lai <redacted>
Wed, 22 May 2024 12:53:21 +0000 (20:53 +0800)
committerGitHub <redacted>
Wed, 22 May 2024 12:53:21 +0000 (14:53 +0200)
CMakeLists.txt

index 9cc60039a8416063876046e7a4e88873c5a45d80..c09d834fb010deefc4712fd18ec2193fa7f3d823 100644 (file)
@@ -505,6 +505,12 @@ if (LLAMA_VULKAN)
 
         add_compile_definitions(GGML_USE_VULKAN)
 
+        # Workaround to the "can't dereference invalidated vector iterator" bug in clang-cl debug build
+        # Posssibly relevant: https://stackoverflow.com/questions/74748276/visual-studio-no-displays-the-correct-length-of-stdvector
+        if (MSVC AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
+            add_compile_definitions(_ITERATOR_DEBUG_LEVEL=0)
+        endif()
+
         if (LLAMA_VULKAN_CHECK_RESULTS)
             add_compile_definitions(GGML_VULKAN_CHECK_RESULTS)
         endif()