diff --git a/llama/compat/906-revert-hip-integrated-flag.patch b/llama/compat/906-revert-hip-integrated-flag.patch new file mode 100644 index 00000000000..b39097fe8fb --- /dev/null +++ b/llama/compat/906-revert-hip-integrated-flag.patch @@ -0,0 +1,50 @@ +MAXUSAI 906: carry upstream's revert of "restore prop.integrated on HIP builds". + +Upstream llama.cpp PR #28604 (d4389a4dd92, 2026-09-08T14:19:53Z) reverts +c7d8722922a (#24233), which set info.devices[id].integrated = prop.integrated on +HIP builds. On an integrated/UMA device that flag changes which buffer types the +HIP backend claims, and upstream issue #28211 root-causes the result as an MMQ +tile-barrier race on gfx115x that produces WRONG OUTPUT with no crash and no +warning, once a decode exceeds n_ubatch. + +WE MISSED THE FIX BY 78 MINUTES. Our payload b10864 is 5d806aa25, 2026-09-08 +13:01:03Z. The revert landed at 14:19:53Z the same day, so ollama v0.34.1 has the +defect and not the fix. + +MEASURED HERE (gfx1151, Radeon 8060S, ROCm 7.2.x), gemma4:31b-it-q4_K_M with the +image-token budget pinned per cell, name_bbox_mean_iou: + + budget 0.32.1/b9888 0.34.1/b10864 + 280 0.612 0.691 + 560 0.713 0.714 + 1120 0.728 0.000 <-- total loss + +Only the top rung fails, and only on the newer payload. prompt_eval_count is +identical between builds on every test, so the grid and token count are unchanged +and the pixels reaching the model are the same -- consistent with corruption +downstream of preprocessing rather than in it. Related upstream reports on this +exact silicon: #27419 (upper image content lost on HIP, Vulkan and CPU correct) +and #28211 (wrong logits past n_ubatch). + +GGML_CUDA_NO_PINNED=1 is NOT a workaround: it reaches the runner and the runner +aborts (signal: aborted, core dumped) on model load. + +Drop this patch when the payload advances past d4389a4dd92. + +Files: ggml/src/ggml-cuda/ggml-cuda.cu +diff --git a/ggml/src/ggml-cuda/ggml-cuda.cu b/ggml/src/ggml-cuda/ggml-cuda.cu +index 0e6601f..38bd4c9 100644 +--- a/ggml/src/ggml-cuda/ggml-cuda.cu ++++ b/ggml/src/ggml-cuda/ggml-cuda.cu +@@ -304,11 +304,7 @@ static ggml_cuda_device_info ggml_cuda_init() { + + info.default_tensor_split[id] = total_vram; + total_vram += device_vram; +-#if defined(GGML_USE_HIP) +- info.devices[id].integrated = prop.integrated; +-#else + info.devices[id].integrated = false; // Temporarily disabled due to issues with corrupted output (e.g. #15034) +-#endif + info.devices[id].nsm = prop.multiProcessorCount; + info.devices[id].smpb = prop.sharedMemPerBlock; + info.devices[id].warp_size = prop.warpSize;