Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions crisp_audio/src/audio_tower.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -684,8 +684,12 @@ void crisp_audio_free(struct crisp_audio_context* ctx) {
#endif
if (ctx->sched)
ggml_backend_sched_free(ctx->sched);
if (ctx->model_buf)
ggml_backend_buffer_free(ctx->model_buf);
// model_buf came from core_gguf::load_weights, so on a device advertising
// buffer_from_host_ptr it is a view onto a host mmap the backend does not
// own. ggml_backend_buffer_free() alone would leave the weight file mapped
// for the life of the process. The release entry point takes the loader's
// side-map entry and unmaps; it no-ops on a null handle and nulls ours.
core_gguf::release_weight_buffer(ctx->model_buf);
if (ctx->model_ctx)
ggml_free(ctx->model_ctx);
if (ctx->backend_cpu)
Expand Down
2 changes: 1 addition & 1 deletion crisp_lid/src/lid_cld3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -804,7 +804,7 @@ extern "C" void lid_cld3_free(lid_cld3_context* ctx) {
if (!ctx)
return;
if (ctx->buf)
ggml_backend_buffer_free(ctx->buf);
core_gguf::release_weight_buffer(ctx->buf);
if (ctx->gctx)
ggml_free(ctx->gctx);
delete ctx;
Expand Down
2 changes: 1 addition & 1 deletion crisp_punc/src/fireredpunc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -905,7 +905,7 @@ void fireredpunc_free(fireredpunc_context* ctx) {
if (ctx->sched)
ggml_backend_sched_free(ctx->sched);
if (ctx->buf)
ggml_backend_buffer_free(ctx->buf);
core_gguf::release_weight_buffer(ctx->buf);
if (ctx->w_ctx)
ggml_free(ctx->w_ctx);
if (ctx->backend_cpu && ctx->backend_cpu != ctx->backend)
Expand Down
2 changes: 1 addition & 1 deletion crisp_punc/src/pcs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1021,7 +1021,7 @@ void pcs_free(pcs_context* ctx) {
if (ctx->sched)
ggml_backend_sched_free(ctx->sched);
if (ctx->buf)
ggml_backend_buffer_free(ctx->buf);
core_gguf::release_weight_buffer(ctx->buf);
if (ctx->w_ctx)
ggml_free(ctx->w_ctx);
if (ctx->backend_cpu && ctx->backend_cpu != ctx->backend)
Expand Down
4 changes: 2 additions & 2 deletions src/ark_asr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1179,9 +1179,9 @@ extern "C" void ark_asr_free(struct ark_asr_context* ctx) {
if (ctx->kv_ctx)
ggml_free(ctx->kv_ctx);
if (ctx->buf_w)
ggml_backend_buffer_free(ctx->buf_w);
core_gguf::release_weight_buffer(ctx->buf_w);
if (ctx->buf_w_cpu)
ggml_backend_buffer_free(ctx->buf_w_cpu);
core_gguf::release_weight_buffer(ctx->buf_w_cpu);
if (ctx->ctx_w)
ggml_free(ctx->ctx_w);
if (ctx->backend && ctx->backend != ctx->backend_cpu)
Expand Down
2 changes: 1 addition & 1 deletion src/audioseal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ struct audioseal_ctx {
if (ctx_w)
ggml_free(ctx_w);
if (buf_w)
ggml_backend_buffer_free(buf_w);
core_gguf::release_weight_buffer(buf_w);
if (backend && backend != backend_cpu)
ggml_backend_free(backend);
if (backend_cpu)
Expand Down
2 changes: 1 addition & 1 deletion src/bananamind_tts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1315,7 +1315,7 @@ void bananamind_tts_free(struct bananamind_tts_context* ctx) {
if (!ctx)
return;
if (ctx->w_buf)
ggml_backend_buffer_free(ctx->w_buf);
core_gguf::release_weight_buffer(ctx->w_buf);
if (ctx->w_ctx)
ggml_free(ctx->w_ctx);
if (ctx->backend)
Expand Down
2 changes: 1 addition & 1 deletion src/bark_tts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ struct bark_context {
if (ctx_w)
ggml_free(ctx_w);
if (buf_w)
ggml_backend_buffer_free(buf_w);
core_gguf::release_weight_buffer(buf_w);
if (backend && backend != backend_cpu)
ggml_backend_free(backend);
if (backend_cpu)
Expand Down
2 changes: 1 addition & 1 deletion src/beatrice_phone.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ void beatrice_phone_free(beatrice_phone_context* c) {
if (!c)
return;
if (c->buf_w)
ggml_backend_buffer_free(c->buf_w);
core_gguf::release_weight_buffer(c->buf_w);
if (c->ctx_w)
ggml_free(c->ctx_w);
if (c->backend)
Expand Down
2 changes: 1 addition & 1 deletion src/beatrice_pitch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ void beatrice_pitch_free(beatrice_pitch_context* ctx) {
if (!ctx)
return;
if (ctx->buf_w)
ggml_backend_buffer_free(ctx->buf_w);
core_gguf::release_weight_buffer(ctx->buf_w);
if (ctx->ctx_w)
ggml_free(ctx->ctx_w);
if (ctx->backend)
Expand Down
2 changes: 1 addition & 1 deletion src/bert_encoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ extern "C" void bert_encoder_free(struct bert_encoder_context* ctx) {
if (ctx->sched)
ggml_backend_sched_free(ctx->sched);
if (ctx->w_buf)
ggml_backend_buffer_free(ctx->w_buf);
core_gguf::release_weight_buffer(ctx->w_buf);
if (ctx->w_ctx)
ggml_free(ctx->w_ctx);
if (ctx->backend_cpu)
Expand Down
2 changes: 1 addition & 1 deletion src/btc_chords.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ void btc_chords_free(btc_chords_context* ctx) {
if (!ctx)
return;
if (ctx->buf_w)
ggml_backend_buffer_free(ctx->buf_w);
core_gguf::release_weight_buffer(ctx->buf_w);
if (ctx->ctx_w)
ggml_free(ctx->ctx_w);
if (ctx->backend)
Expand Down
2 changes: 1 addition & 1 deletion src/canary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1409,7 +1409,7 @@ extern "C" void canary_free(struct canary_context* ctx) {
ctx->model.pw_q8.free();
ctx->model.qkv_fused.free();
if (ctx->model.buf)
ggml_backend_buffer_free(ctx->model.buf);
core_gguf::release_weight_buffer(ctx->model.buf);
if (ctx->model.ctx)
ggml_free(ctx->model.ctx);
if (ctx->backend && ctx->backend != ctx->backend_cpu)
Expand Down
2 changes: 1 addition & 1 deletion src/canary_ctc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -789,7 +789,7 @@ extern "C" void canary_ctc_free(struct canary_ctc_context* ctx) {
if (ctx->model.ctx_f32)
ggml_free(ctx->model.ctx_f32);
if (ctx->model.buf)
ggml_backend_buffer_free(ctx->model.buf);
core_gguf::release_weight_buffer(ctx->model.buf);
if (ctx->model.ctx)
ggml_free(ctx->model.ctx);
if (ctx->backend_cpu && ctx->backend_cpu != ctx->backend)
Expand Down
4 changes: 2 additions & 2 deletions src/canary_qwen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1332,9 +1332,9 @@ extern "C" void canary_qwen_free(struct canary_qwen_context* ctx) {
ctx->model.pw_q8.free();
ctx->model.qkv_fused.free();
if (ctx->model.buf)
ggml_backend_buffer_free(ctx->model.buf);
core_gguf::release_weight_buffer(ctx->model.buf);
if (ctx->model.buf_cpu)
ggml_backend_buffer_free(ctx->model.buf_cpu);
core_gguf::release_weight_buffer(ctx->model.buf_cpu);
if (ctx->model.ctx)
ggml_free(ctx->model.ctx);
if (ctx->backend && ctx->backend != ctx->backend_cpu)
Expand Down
8 changes: 4 additions & 4 deletions src/chatterbox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -914,11 +914,11 @@ struct chatterbox_context {
if (voice_ctx_w)
ggml_free(voice_ctx_w);
if (voice_buf_w)
ggml_backend_buffer_free(voice_buf_w);
core_gguf::release_weight_buffer(voice_buf_w);
if (ctx_w)
ggml_free(ctx_w);
if (buf_w)
ggml_backend_buffer_free(buf_w);
core_gguf::release_weight_buffer(buf_w);
if (backend && backend != backend_cpu)
ggml_backend_free(backend);
if (backend_cpu)
Expand Down Expand Up @@ -4019,7 +4019,7 @@ static int chatterbox_load_voice_gguf(chatterbox_context* ctx, const char* path)
ctx->voice_ctx_w = nullptr;
}
if (ctx->voice_buf_w) {
ggml_backend_buffer_free(ctx->voice_buf_w);
core_gguf::release_weight_buffer(ctx->voice_buf_w);
ctx->voice_buf_w = nullptr;
}
ctx->voice_tensors.clear();
Expand Down Expand Up @@ -4242,7 +4242,7 @@ static int chatterbox_install_native_voice(chatterbox_context* ctx, const float
ctx->voice_ctx_w = nullptr;
}
if (ctx->voice_buf_w) {
ggml_backend_buffer_free(ctx->voice_buf_w);
core_gguf::release_weight_buffer(ctx->voice_buf_w);
ctx->voice_buf_w = nullptr;
}
ctx->voice_tensors.clear();
Expand Down
4 changes: 2 additions & 2 deletions src/chatterbox_s3gen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -414,9 +414,9 @@ struct chatterbox_s3gen_context {
if (ctx_w)
ggml_free(ctx_w);
if (buf_w)
ggml_backend_buffer_free(buf_w);
core_gguf::release_weight_buffer(buf_w);
if (buf_cpu_w)
ggml_backend_buffer_free(buf_cpu_w);
core_gguf::release_weight_buffer(buf_cpu_w);
if (backend && backend != backend_cpu)
ggml_backend_free(backend);
if (backend_cpu)
Expand Down
2 changes: 1 addition & 1 deletion src/cohere.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2103,7 +2103,7 @@ void cohere_free(struct cohere_context* ctx) {
if (ctx->kv_buf)
ggml_backend_buffer_free(ctx->kv_buf);
if (ctx->model.buf)
ggml_backend_buffer_free(ctx->model.buf);
core_gguf::release_weight_buffer(ctx->model.buf);
if (ctx->ggml_backend)
ggml_backend_free(ctx->ggml_backend);
if (ctx->ggml_backend_cpu && ctx->ggml_backend_cpu != ctx->ggml_backend)
Expand Down
Loading
Loading