Skip to content

UPSTREAM PR #18302: vulkan: fix command buffer corruption in ggml_backend_vk_event_wait#667

Open
loci-dev wants to merge 1 commit into
mainfrom
upstream-PR18302-branch_jeffbolznv-fix_event_wait
Open

UPSTREAM PR #18302: vulkan: fix command buffer corruption in ggml_backend_vk_event_wait#667
loci-dev wants to merge 1 commit into
mainfrom
upstream-PR18302-branch_jeffbolznv-fix_event_wait

Conversation

@loci-dev

Copy link
Copy Markdown

Mirrored from ggml-org/llama.cpp#18302

Fixes #18297.

The async download paths that I had been using to test events weren't hitting event_wait, and this bug slipped through.

@loci-review

loci-review Bot commented Dec 22, 2025

Copy link
Copy Markdown

Explore the complete analysis inside the Version Insights

Performance Analysis Summary - PR #667

PR Context: Vulkan backend bug fix for command buffer corruption in ggml_backend_vk_event_wait

Analysis Result

This PR introduces a correctness fix in the Vulkan backend event synchronization path. The changes add proper cleanup of transfer context resources and debug logging to three functions in ggml-vulkan.cpp:

  • ggml_backend_vk_event_record
  • ggml_backend_vk_event_wait
  • ggml_backend_vk_device_event_synchronize

Code Changes:

  • Added ggml_vk_ctx_end(transfer_ctx) call to properly end the transfer context
  • Added ctx->transfer_ctx.reset() to release the context resources
  • Added debug logging statements for event tracking

Performance Impact:
No measurable performance changes detected. The power consumption analysis shows 0% change across all stable binaries. The core inference functions (llama_decode, llama_encode, llama_tokenize) are not modified. Token throughput remains unaffected as this fix operates in the Vulkan backend event synchronization layer, which is outside the primary inference path. The added cleanup operations execute only during event wait operations and introduce negligible overhead compared to GPU command submission latency.

3 similar comments
@loci-review

loci-review Bot commented Dec 22, 2025

Copy link
Copy Markdown

Explore the complete analysis inside the Version Insights

Performance Analysis Summary - PR #667

PR Context: Vulkan backend bug fix for command buffer corruption in ggml_backend_vk_event_wait

Analysis Result

This PR introduces a correctness fix in the Vulkan backend event synchronization path. The changes add proper cleanup of transfer context resources and debug logging to three functions in ggml-vulkan.cpp:

  • ggml_backend_vk_event_record
  • ggml_backend_vk_event_wait
  • ggml_backend_vk_device_event_synchronize

Code Changes:

  • Added ggml_vk_ctx_end(transfer_ctx) call to properly end the transfer context
  • Added ctx->transfer_ctx.reset() to release the context resources
  • Added debug logging statements for event tracking

Performance Impact:
No measurable performance changes detected. The power consumption analysis shows 0% change across all stable binaries. The core inference functions (llama_decode, llama_encode, llama_tokenize) are not modified. Token throughput remains unaffected as this fix operates in the Vulkan backend event synchronization layer, which is outside the primary inference path. The added cleanup operations execute only during event wait operations and introduce negligible overhead compared to GPU command submission latency.

@loci-review

loci-review Bot commented Dec 22, 2025

Copy link
Copy Markdown

Explore the complete analysis inside the Version Insights

Performance Analysis Summary - PR #667

PR Context: Vulkan backend bug fix for command buffer corruption in ggml_backend_vk_event_wait

Analysis Result

This PR introduces a correctness fix in the Vulkan backend event synchronization path. The changes add proper cleanup of transfer context resources and debug logging to three functions in ggml-vulkan.cpp:

  • ggml_backend_vk_event_record
  • ggml_backend_vk_event_wait
  • ggml_backend_vk_device_event_synchronize

Code Changes:

  • Added ggml_vk_ctx_end(transfer_ctx) call to properly end the transfer context
  • Added ctx->transfer_ctx.reset() to release the context resources
  • Added debug logging statements for event tracking

Performance Impact:
No measurable performance changes detected. The power consumption analysis shows 0% change across all stable binaries. The core inference functions (llama_decode, llama_encode, llama_tokenize) are not modified. Token throughput remains unaffected as this fix operates in the Vulkan backend event synchronization layer, which is outside the primary inference path. The added cleanup operations execute only during event wait operations and introduce negligible overhead compared to GPU command submission latency.

@loci-review

loci-review Bot commented Dec 22, 2025

Copy link
Copy Markdown

Explore the complete analysis inside the Version Insights

Performance Analysis Summary - PR #667

PR Context: Vulkan backend bug fix for command buffer corruption in ggml_backend_vk_event_wait

Analysis Result

This PR introduces a correctness fix in the Vulkan backend event synchronization path. The changes add proper cleanup of transfer context resources and debug logging to three functions in ggml-vulkan.cpp:

  • ggml_backend_vk_event_record
  • ggml_backend_vk_event_wait
  • ggml_backend_vk_device_event_synchronize

Code Changes:

  • Added ggml_vk_ctx_end(transfer_ctx) call to properly end the transfer context
  • Added ctx->transfer_ctx.reset() to release the context resources
  • Added debug logging statements for event tracking

Performance Impact:
No measurable performance changes detected. The power consumption analysis shows 0% change across all stable binaries. The core inference functions (llama_decode, llama_encode, llama_tokenize) are not modified. Token throughput remains unaffected as this fix operates in the Vulkan backend event synchronization layer, which is outside the primary inference path. The added cleanup operations execute only during event wait operations and introduce negligible overhead compared to GPU command submission latency.

@loci-dev loci-dev force-pushed the main branch 24 times, most recently from 49ab457 to f221a43 Compare December 26, 2025 01:37
@loci-dev loci-dev force-pushed the main branch 30 times, most recently from 7aa8b1c to 027726b Compare January 1, 2026 13:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants