Skip to content

Commit 0753a7f

Browse files
committed
fix: Fix compiler warning about uninitialized inp_pos
This should not have been reachable, but it warns on some compliers Branch: GraniteMoEShared Signed-off-by: Gabe Goodhart <ghart@us.ibm.com>
1 parent 4446994 commit 0753a7f

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/llama-model.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12215,11 +12215,8 @@ struct llm_build_granite : public llm_graph_context {
1221512215

1221612216
inpL = build_inp_embd(model.tok_embd);
1221712217

12218-
// inp_pos - used for rope if enabled
12218+
// inp_pos - built only if rope enabled
1221912219
ggml_tensor * inp_pos;
12220-
if (use_rope) {
12221-
inp_pos = build_inp_pos();
12222-
}
1222312220

1222412221
auto * inp_attn = build_attn_inp_kv_unified();
1222512222

@@ -12262,6 +12259,10 @@ struct llm_build_granite : public llm_graph_context {
1226212259
Vcur = ggml_reshape_3d(ctx0, Vcur, n_embd_head, n_head_kv, n_tokens);
1226312260

1226412261
if (use_rope) {
12262+
12263+
if (!inp_pos) {
12264+
inp_pos = build_inp_pos();
12265+
}
1226512266
ggml_tensor * rope_factors = model.get_rope_factors(n_ctx_per_seq, il);
1226612267
Qcur = ggml_rope_ext(
1226712268
ctx0, Qcur, inp_pos, rope_factors,

0 commit comments

Comments
 (0)