Skip to content

Commit 15c9b7d

Browse files
committed
merge fixup (e16b9fa)
1 parent 15c70ae commit 15c9b7d

File tree

1 file changed

+23
-15
lines changed

1 file changed

+23
-15
lines changed

llama.cpp

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3506,6 +3506,10 @@ struct llm_build_context {
35063506

35073507
llama_buffer & buf_compute;
35083508

3509+
#if defined(GGML_USE_KOMPUTE)
3510+
ggml_kompute_context * ctx_kompute;
3511+
#endif
3512+
35093513
struct ggml_context * ctx0 = nullptr;
35103514

35113515
// TODO: consider making the entire interface noexcept
@@ -3535,7 +3539,11 @@ struct llm_build_context {
35353539
kv_head (worst_case ? n_ctx - n_tokens : kv_self.head),
35363540
do_rope_shift (worst_case || kv_self.has_shift),
35373541
cb (cb),
3538-
buf_compute (lctx.buf_compute) {
3542+
buf_compute (lctx.buf_compute)
3543+
#if defined(GGML_USE_KOMPUTE)
3544+
, ctx_kompute (lctx.ctx_kompute)
3545+
#endif
3546+
{
35393547
GGML_ASSERT(!!kv_self.ctx);
35403548

35413549
// all initializations should be done in init()
@@ -3662,15 +3670,15 @@ struct llm_build_context {
36623670
ggml_build_forward_expand(gf, cur);
36633671

36643672
#if defined(GGML_USE_KOMPUTE)
3665-
if (lctx.ctx_kompute) {
3666-
if (!ggml_vk_has_h2d_all(lctx.ctx_kompute)) {
3667-
ggml_vk_h2d_all(lctx.ctx_kompute);
3673+
if (ctx_kompute) {
3674+
if (!ggml_vk_has_h2d_all(ctx_kompute)) {
3675+
ggml_vk_h2d_all(ctx_kompute);
36683676
} else {
3669-
ggml_vk_h2d_tensor(lctx.ctx_kompute, to_device_tensor);
3670-
ggml_vk_h2d_tensor(lctx.ctx_kompute, inp_pos);
3671-
ggml_vk_h2d_tensor(lctx.ctx_kompute, KQ_mask);
3677+
ggml_vk_h2d_tensor(ctx_kompute, to_device_tensor);
3678+
ggml_vk_h2d_tensor(ctx_kompute, inp_pos);
3679+
ggml_vk_h2d_tensor(ctx_kompute, KQ_mask);
36723680
if (K_shift) {
3673-
ggml_vk_h2d_tensor(lctx.ctx_kompute, K_shift);
3681+
ggml_vk_h2d_tensor(ctx_kompute, K_shift);
36743682
}
36753683
}
36763684
}
@@ -3907,15 +3915,15 @@ struct llm_build_context {
39073915
ggml_build_forward_expand(gf, cur);
39083916

39093917
#if defined(GGML_USE_KOMPUTE)
3910-
if (lctx.ctx_kompute) {
3911-
if (!ggml_vk_has_h2d_all(lctx.ctx_kompute)) {
3912-
ggml_vk_h2d_all(lctx.ctx_kompute);
3918+
if (ctx_kompute) {
3919+
if (!ggml_vk_has_h2d_all(ctx_kompute)) {
3920+
ggml_vk_h2d_all(ctx_kompute);
39133921
} else {
3914-
ggml_vk_h2d_tensor(lctx.ctx_kompute, to_device_tensor);
3915-
ggml_vk_h2d_tensor(lctx.ctx_kompute, inp_pos);
3916-
ggml_vk_h2d_tensor(lctx.ctx_kompute, KQ_mask);
3922+
ggml_vk_h2d_tensor(ctx_kompute, to_device_tensor);
3923+
ggml_vk_h2d_tensor(ctx_kompute, inp_pos);
3924+
ggml_vk_h2d_tensor(ctx_kompute, KQ_mask);
39173925
if (K_shift) {
3918-
ggml_vk_h2d_tensor(lctx.ctx_kompute, K_shift);
3926+
ggml_vk_h2d_tensor(ctx_kompute, K_shift);
39193927
}
39203928
}
39213929
}

0 commit comments

Comments
 (0)