| 2755 | |
| 2756 | |
| 2757 | static int64_t sum_gpu_index(struct ggml_tensor * gpu_index) { |
| 2758 | ggml_context * ctx_aux = ggml_init({ |
| 2759 | /* mem_size */ 1 << 10, |
| 2760 | }); |
| 2761 | |
| 2762 | GGML_ASSERT(ctx_aux); |
| 2763 | |
| 2764 | ggml_cgraph * gf = ggml_new_graph_custom(ctx_aux, 1, false); |
| 2765 | ggml_tensor * sum = ggml_sum(ctx_aux, gpu_index); |
| 2766 | |
| 2767 | ggml_set_name(sum, "gpu_index_sum"); |
| 2768 | ggml_build_forward_expand(gf, sum); |
| 2769 | |
| 2770 | // TODO: +1 worker for GPU under hybrid inference but no use |
| 2771 | // ggml_graph_compute_helper(work_buffer, gf, 2); |
| 2772 | ggml_graph_compute_with_ctx(ctx_aux, gf, 2); |
| 2773 | |
| 2774 | int32_t sum_val = ggml_get_i32_1d(sum, 0); |
| 2775 | |
| 2776 | ggml_free(ctx_aux); |
| 2777 | |
| 2778 | return sum_val; |
| 2779 | } |
| 2780 | |
| 2781 | struct llama_gpu_split_loader { |
| 2782 | int n_tensors = 0; |
no test coverage detected