tensor-split meta backend fixes - #26502
Conversation
|
@JohannesGaessler @ggerganov |
|
@am17an @JohannesGaessler @gaugarg-nv |
| if (tensor->buffer == nullptr || !ggml_backend_buffer_is_meta(tensor->buffer)) { | ||
| return { GGML_BACKEND_SPLIT_AXIS_MIRRORED, {0}, {1}, 1 }; | ||
| } |
There was a problem hiding this comment.
In which cases does this occur?
There was a problem hiding this comment.
@ggerganov apologies for the delay (traveling). This was the first thing I ran into when I started testing ggml-hexagon on dual-NPU devices with split-mode tensor. One of the CPU fallbacks was hitting this path but I don't recall which model. I think it was Qwen3.5-4B. I don't have access to the dual-NPU device at the moment so I can't quite reproduce the scenario.
It seems that this path might end up calling ggml_backend_meta_get_split_state on the next->src[] that is mapped to the CPU backend.
// Skip MIRRORED nodes that don't consume node
auto skip_unrelated = [&]() {
while (id + 1 < cgraph->n_nodes) {
ggml_tensor * next = cgraph->nodes[id+1];
if (ggml_backend_meta_get_split_state(next, false).axis != GGML_BACKEND_SPLIT_AXIS_MIRRORED) {
break;
}
bool safe = true;
for (int s = 0; s < GGML_MAX_SRC; s++) {
if (next->src[s] == nullptr) {
continue;
}
if (next->src[s] == node) {
safe = false;
break;
}
>>>>>>> if (ggml_backend_meta_get_split_state(next->src[s], false).axis != GGML_BACKEND_SPLIT_AXIS_MIRRORED) {
safe = false;
break;
}
There was a problem hiding this comment.
I think we should take a look at a repro and see if we can reproduce with Metal/CUDA virtual devices.
There was a problem hiding this comment.
@ggerganov sorry for the delay.
I can't seem to reproduce the original failure. So I removed this specific change. If I run into it again I'll start a separate PR.
…_split_state I can't seem to reproduce the original failure in the latest code.
9d74f01 to
fbc8479
Compare
|
Hi, I'm hitting a crash on latest master (929d47a) when using -sm tensor with a Qwen3.8-27B Q4_K_M model on 2x RTX 3080. It works fine on pr-27342 (5ecbe1a). Error: Preceded by: common_fit_params: failed to fit params to free device memory: llama_params_fit is not implemented for SPLIT_MODE_TENSOR, abort Bisect points to: d59d455 tensor-split meta backend fixes (#26502) Repro command: |
|
I can confirm the crash using virtual CUDA devices. @youyoulyz Could you confirm it works with #27433? |
|
I had the same crash. Moving the init after the view_src / view_offs / data assignments seems to fix it, but I'm not 100% sure if that's the correct fix. |
@ggerganov Confirmed it is working, details are in #27433 |
|
@max-krasnyansky Let's revert this for now. I am thinking we need to have |
Ah. Bummer. Ok. I'll try to find a CUDA setup to test on and resubmit after that. |
|
On my dual RTX A5000s, I was able to reproduce a crash at first, but I can also verify that @markun's patch fixed it for me. After that I ran some performance and perplexity tests and did one agentic session, and all seemed well. |
|
@max-krasnyansky if you need more testing on CUDA please let me know! |
|
* backend: propagate buffer usage in meta backend * ggml-meta: make sure to call init_tensor for all new tensors * meta: remove explicit check for meta backend in ggml_backend_meta_get_split_state I can't seem to reproduce the original failure in the latest code.
Overview
Ran into a few issues with the tensor-split meta backend while working on #26501
buffer_usagemodeWe need to see
usage=weightsinggml-hexagonandggml-openclinit_tensorfor the new tensors it creates with the secondary backend bufferThis caused some of the tensors to end up not fully initialized, specifically for
ggml-hexagon(and probably opencl and sycl) the issue was missing
tensor->extrawhich is allocated in init_tensor.We typically rely on the CPU fallback in
ggml-hexagon(at least the embeddings and the lm-head) so it makes sense to allow for those with the tensor-split mode.Requirements