Skip to content

Commit cae35b9

Browse files
use int32_t for n_thread type in public llama.cpp API
1 parent b97bd67 commit cae35b9

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

include/llama.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -304,8 +304,8 @@ extern "C" {
304304
uint32_t n_batch; // logical maximum batch size that can be submitted to llama_decode
305305
uint32_t n_ubatch; // physical maximum batch size
306306
uint32_t n_seq_max; // max number of sequences (i.e. distinct states for recurrent models)
307-
int n_threads; // number of threads to use for generation
308-
int n_threads_batch; // number of threads to use for batch processing
307+
int32_t n_threads; // number of threads to use for generation
308+
int32_t n_threads_batch; // number of threads to use for batch processing
309309

310310
enum llama_rope_scaling_type rope_scaling_type; // RoPE scaling type, from `enum llama_rope_scaling_type`
311311
enum llama_pooling_type pooling_type; // whether to pool (sum) embedding results by sequence id
@@ -844,7 +844,7 @@ extern "C" {
844844
// Set the number of threads used for decoding
845845
// n_threads is the number of threads used for generation (single token)
846846
// n_threads_batch is the number of threads used for prompt and batch processing (multiple tokens)
847-
LLAMA_API void llama_set_n_threads(struct llama_context * ctx, int n_threads, int n_threads_batch);
847+
LLAMA_API void llama_set_n_threads(struct llama_context * ctx, int32_t n_threads, int32_t n_threads_batch);
848848

849849
// Get the number of threads used for generation of a single token.
850850
LLAMA_API int llama_n_threads(struct llama_context * ctx);

src/llama.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19389,7 +19389,7 @@ size_t llama_state_seq_load_file(struct llama_context * ctx, const char * filepa
1938919389
}
1939019390
}
1939119391

19392-
void llama_set_n_threads(struct llama_context * ctx, int n_threads, int n_threads_batch) {
19392+
void llama_set_n_threads(struct llama_context * ctx, int32_t n_threads, int32_t n_threads_batch) {
1939319393
ctx->cparams.n_threads = n_threads;
1939419394
ctx->cparams.n_threads_batch = n_threads_batch;
1939519395
}

0 commit comments

Comments
 (0)