﻿# llama.cpp FastRPC teardown: a 64-bit wrapper cannot repair a narrow function pointer

The b12241 FastRPC close fix preserves handle width through a resolved function pointer; teardown checks matter even after correct inference.

Author: Retrivium team
Updated: 2026-11-15
Canonical URL: https://retrivium.ai/journal/week46-engine-hexagon-fastrpc-close-handle-abi/
Language: en

llama.cpp b12241 fixes truncation of a 64-bit FastRPC handle during close. The upstream analysis finds a dynamically resolved function pointer declared with the wrong handle type even though its wrapper used the correct one. This is an ABI boundary defect that can surface during teardown after useful computation has already succeeded.

## Types must agree across the whole call chain

The PR identifies a correct 64-bit wrapper passing its argument through an incorrectly narrow function-pointer signature. The wrapper’s public type could not protect a value converted at the next call boundary. A review should therefore inspect the resolved pointer declaration and the actual API signature together. Looking only at the exported wrapper would miss the truncation, as would testing handles whose significant bits happen to fit the narrower type.

## Teardown is observable behaviour

The reported symptom is failure of the close operation, not necessarily a wrong tensor result. An inference test that exits immediately after checking generated text can overlook resource-release errors. A proposed lifecycle check opens a session, performs representative work, closes it and verifies the close status. Repeat the lifecycle where practical, watching whether resources remain usable and whether later sessions inherit an earlier cleanup failure.

## Use width-sensitive evidence

Where a unit-test seam permits synthetic handles, include a value with nonzero high bits and verify that the callee receives it unchanged. That directly tests the ABI property without depending on a driver’s incidental handle allocation. On real hardware, preserve the actual close status and platform details. A small numerical handle that closes correctly is not strong evidence that a 64-bit call chain preserves the full range.

## Keep the failure attribution narrow

The release repairs a specific function-pointer declaration in the Hexagon driver interface. It does not establish that every FastRPC cleanup error is handle truncation, nor that unrelated runtime resource leaks disappear. Use the documented error context to decide whether a local report matches. This article reports the upstream diagnosis and proposes lifecycle coverage, without asserting a new device reproduction or a measured change in inference throughput.

## Sources

- [llama.cpp b12241 release](https://github.com/ggml-org/llama.cpp/releases/tag/b12241)
- [llama.cpp pull request #30952](https://github.com/ggml-org/llama.cpp/pull/30952)

## Related reading

- [cudaLaunchKernel arguments: pass addresses of values, not raw device pointers](/journal/fg2-cuda-launch-kernel-argument-address-abi/)
- [Building llama.cpp on Windows with the right backend](/journal/llama-cpp-windows-build/)
