diff --git a/arch/qwen4exp_fp8/qwen4exp_fp8.cpp b/arch/qwen4exp_fp8/qwen4exp_fp8.cpp index 27ef3467..d5cca086 100644 --- a/arch/qwen4exp_fp8/qwen4exp_fp8.cpp +++ b/arch/qwen4exp_fp8/qwen4exp_fp8.cpp @@ -273,6 +273,10 @@ static int declare(RadBuilder* b, const RadModelMeta* meta, const RadBuildCtx* c * real max_tok (RadBuildCtx::shape_probe). */ static thread_local Model probe_model; Model& m = ctx->shape_probe ? probe_model : g_model[ctx->rank]; + /* The reset drops the pinned window copy (pipe_bounds); free it first -- a re-declare of the + * same rank (every rebuild, every test case) otherwise overwrites the pointer and leaks the + * pin. The copy is read only by a step's memcpys, and no step runs across a declare. */ + if (m.pipe_cu_h) rad_dev_free(m.pipe_cu_h, RAD_MEM_HOST_PINNED); m = Model{}; m.nm = Names(ctx->scope ? ctx->scope : ""); Names& nm = m.nm;