Skip to content

v0.2.0 — C ABI v2, full Python parity

Choose a tag to compare

@PogChamper PogChamper released this 02 Jul 09:48

D-FINE-cpp v0.2.0

C ABI v2 and full Python parity with the C++ feature set. Model artifacts are unchanged from
v0.1.0 and re-attached here so every release is self-contained.

C ABI v2 (breaking — one-time)

dfine_options_t gains a leading struct_size field and the intensive-core/preprocessing
options. This is the last planned ABI break: the size-versioning contract (the library reads
at most struct_size bytes; new fields are only ever appended) makes all future growth
backward-compatible. Binaries built against the pre-0.2.0 header must be rebuilt; a zero
struct_size is rejected with a clear error rather than misread.

New surface:

  • dfine_options_t: gpu_decode, own_device_memory, full_pipeline_graph, and letterbox
    preprocessing (resize, letterbox_topleft, letterbox_pad, letterbox_no_upscale).
  • dfine_detector_freeze(det, spec) — warm to peak + lock (zero steady-state allocation);
    captures the full-pipeline CUDA graph when requested. dfine_freeze_spec_t carries
    batch / source size / channel order.
  • dfine_detector_full_graph_active(det) — observability for the single-launch path.
  • dfine_detector_last_timings(det, out) — per-stage wall/CPU times; dispatch_ms is the
    host cost the graph collapses.

Python

Everything above is now reachable from the ctypes bindings: Detector(gpu_decode=, own_device_memory=, full_pipeline_graph=, letterbox=, letterbox_topleft=, letterbox_pad=, letterbox_upscale=), Detector.freeze(batch, src_w=, src_h=, src_is_bgr=),
Detector.full_pipeline_graph_active, Detector.last_timings(). Measured from Python on the
m FP16 0-aux engine: graph active, dispatch_ms ≈ 0.08 per frame.

Also in this release

  • Upstream D-FINE-seg TRT export re-verification recorded in
    docs/impl/DFINE_SEG_TRT_BUG_REPORT.md (the author's own static-b1 flow loses 12.4 AP in
    FP16 and 18.0 AP in FP32 while its ONNX matches torch; this runtime's explicit-deform export
    is the fix).

Validation

C-ABI smoke extended with the v2 contract checks (zero struct_size rejection, freeze(NULL),
re-freeze idempotence, timings fill); byte-parity C++ ↔ C ABI PASS; 14/14 pytests; default-path
detections remain byte-identical to v0.1.0.

Artifacts

Same layout as v0.1.0: dfine_{n,s,m,l,x}[_fp16_st].onnx + .json sidecars + SHA256SUMS +
dfine-0.2.0-py3-none-linux_x86_64.whl (sm_89; needs local TensorRT 10.x + CUDA 12) + demo mp4s.

SONAME

The shared library SONAME moved from libdfine.so.0 to libdfine.so.1 with this ABI break, so
pre-0.2.0 binaries fail at load (clean "cannot open shared object" error) instead of misreading the
new options layout.