@@ -3506,6 +3506,10 @@ struct llm_build_context {
3506
3506
3507
3507
llama_buffer & buf_compute;
3508
3508
3509
+ #if defined(GGML_USE_KOMPUTE)
3510
+ ggml_kompute_context * ctx_kompute;
3511
+ #endif
3512
+
3509
3513
struct ggml_context * ctx0 = nullptr ;
3510
3514
3511
3515
// TODO: consider making the entire interface noexcept
@@ -3535,7 +3539,11 @@ struct llm_build_context {
3535
3539
kv_head (worst_case ? n_ctx - n_tokens : kv_self.head),
3536
3540
do_rope_shift (worst_case || kv_self.has_shift),
3537
3541
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
+ {
3539
3547
GGML_ASSERT (!!kv_self.ctx );
3540
3548
3541
3549
// all initializations should be done in init()
@@ -3662,15 +3670,15 @@ struct llm_build_context {
3662
3670
ggml_build_forward_expand (gf, cur);
3663
3671
3664
3672
#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);
3668
3676
} 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);
3672
3680
if (K_shift) {
3673
- ggml_vk_h2d_tensor (lctx. ctx_kompute , K_shift);
3681
+ ggml_vk_h2d_tensor (ctx_kompute, K_shift);
3674
3682
}
3675
3683
}
3676
3684
}
@@ -3907,15 +3915,15 @@ struct llm_build_context {
3907
3915
ggml_build_forward_expand (gf, cur);
3908
3916
3909
3917
#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);
3913
3921
} 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);
3917
3925
if (K_shift) {
3918
- ggml_vk_h2d_tensor (lctx. ctx_kompute , K_shift);
3926
+ ggml_vk_h2d_tensor (ctx_kompute, K_shift);
3919
3927
}
3920
3928
}
3921
3929
}
0 commit comments