Moving from 5.0 to 5.1
Holoscan SDK 5.1 adds proof of Tensor and Image port requirements, fact preservation through forwarding operators, and Discover-bound model facts. This page records the compatibility changes for applications built with 5.0. Rebuild native operators and bindings against the same SDK headers and libraries before running them.
Missing-evidence migration policy
Both CompileOptions::missing_tensor_evidence and missing_field_evidence
default to MissingEvidencePolicy::kWarn in 5.1 and 5.2. An accepted connection
with missing evidence has a PORT_CONTRACT_RELAXED diagnostic and every
delivered Tensor or constrained field is checked. A known incompatible
promise and a checker-limit failure remain compile errors under Warn.
Both defaults change to Reject in 5.3. Accepted compiles emit one summary under
the automatic diagnostic logging policy; call log_diagnostics(plan) to list
the affected connections. To require evidence now:
These snippets assume an authored graph; Python also assumes
import holoscan as hs. Strict checks are useful while developing operators
and examples. Describe a producer with produces_tensor()/produces_field(),
forward unchanged facts with preserves()/preserves_field(), or state missing
facts on an external producer through a truthful output override.
The usual 5.0 producer declaration already states memory kind, dtype and rank. The broader 5.1 checks especially affect producers that state only memory kind and a maximum rank, unpooled forwarding outputs and schema ports with undescribed Tensor fields. A pooled connection that 5.0 rejected for missing evidence can now be admitted with a warning; delivery validation still applies. Warn does not promise that an invalid sample will run.
See Tensor contracts for declaration examples and diagnostic remedies.
Output overrides and rendering failures
graph.configure(output).produces_tensor() now refines the setup promise.
Changing a declared memory kind, dtype, rank or stride policy, or widening
declared bounds, fails with GRAPH_TENSOR_OVERRIDE_CONFLICT. Use a converter
for a changed representation; an override describes the producer and does
not transform its samples.
A Holoviz image layer now declares the element type and rank its selected format reads. A known incompatible producer fails compilation. A missing promise follows the migration policy. A delivered Tensor that violates the requirement fails the channel/run, including on a relaxed connection; it is no longer just a logged, dropped Holoviz frame with the run continuing. Validate or filter malformed frames before emission when dropping them is the application’s intended behavior.
Forwarding and inference
Use no-flag preserves(input) for a true relay. Facts authored or derived on
the output remain authoritative. An output owning rank also excludes Bounds
and AxisLayout from the default, including when it restates the same rank.
Select TensorFact::kBounds explicitly only when the complete bounds are
unchanged. Use explicit selections for transformations rather than claiming
that every unstated fact passes through.
InferenceOp loads models at Discover, binds output facts within setup’s
finite backing envelope, and releases models through its Release callback.
Its former stop() override is removed. The inherited virtual Stop hook
still exists, so an application’s subclass override is not inherently a
source error; code depending on model cleanup at Stop must account for the
new lifecycle ownership.
Cross-process consumers use the producer’s setup envelope and delivery validation, not remotely bound Discover facts. If the envelope proves the requirement, no remote lifecycle obligation is needed. Otherwise the missing-evidence policy applies. A consumer binding its own requirement at Discover remains unsupported across processes. Local Discover barriers remain unchanged.
Python compatibility and native rebuilds
holoscan.execution.TensorFactDerivationUpdateDisposition names the enum used
by memory-kind and dtype derivation records. The shipped
TensorMemoryKindDerivationUpdateDisposition name remains an alias to the
same enum; existing comparisons continue to work.
Tensor specs own their alternatives and rank/dtype sets. Replace constexpr
specs with const where the owning type is not a literal type. Rebuild all
C++/CUDA operators and Python extensions because Tensor specs and
CompileOptions have changed layout. Regenerate private plan artifacts
against the same SDK revision.
Root-clock synthesis, inert zero-input contracts and single-input trigger defaults also affect graph authoring. Review time and clocks and temporal contracts when updating timing-sensitive graphs.
5.1 release notes for port contracts
- Tensor and enum-field evidence policies share the 5.3 Reject-default transition. Accepted missing-evidence connections warn automatically and retain structured per-connection diagnostics.
- Equivalent rank-only direct sets and alternative groupings accept a
derived dtype. Mixed low/high rank sets may normalize into fewer plan
forms without changing meaning. Maximum-shape/set conflicts now report
GRAPH_TENSOR_BOUNDED_SHAPE_ALTERNATIVES_CONFLICTbefore source conflicts. - A preservation layout map that the selected facts would exclude rejects at setup instead of being ignored. Missing byte bounds explain output ownership and the explicit Bounds selection.
- Python
Preserverejects explicitly emptyfieldsandaxis_layouts; omit the keyword for its default. Porttensor_specgetters return independent snapshots so mutations cannot change later operator instances. - The shipped Python derivation-enum name remains available as an alias.
These changes apply to the Beta Tensor declaration surface described in API stability. Policy warnings are migration guidance; concrete dtype, rank, field, plane and device checks still determine whether a sample can be delivered.
Channel support-thread placement
Idle Tensor export reclamation adds a maintenance worker to sessions with eligible
cross-process Tensor or Image output publishers, including export-only sessions.
kChannelPump (CHANNEL_PUMP in Python) applies to that worker as well as ingress.
An existing single-CPU binding therefore places both workers on the same CPU;
it no longer isolates ingress from publisher-maintenance callbacks.
When migrating a latency-sensitive application, review the shared binding and choose a CPU set suitable for both workers. Separate ingress and maintenance bindings are not available. Eligible sessions retain maintenance attempts even when no export claim awaits reclamation; the completion-based 10 ms cadence is not a retirement deadline. See thread placement for the current placement policy and idle-export behavior.
Downstream version support
Downstream projects using the new port declarations should require
find_package(holoscan 5.1 REQUIRED) in the same change. A release branch that
continues to target 5.0 may keep its existing declarations and use the 5.1/5.2
Warn defaults when built against those releases. Missing evidence is still
checked on delivery.
C++ consumers can include <holoscan/version.hpp> and test
HOLOSCAN_VERSION_AT_LEAST(5, 1). The installed header also defines
HOLOSCAN_VERSION_MAJOR, HOLOSCAN_VERSION_MINOR, and HOLOSCAN_VERSION_PATCH.
The macros describe the headers used to build the application and compare major
and minor releases, not patch versions. SDK 5.0 has no version header. A release
branch that still supports 5.0 can guard the include before testing a version:
An application may narrow an operator’s field promise with
graph.configure(port).produces_field(), for example when a decoder’s fixed
8-bit configuration emits only NV12 from its declared NV12/P010 family. This
assertion cannot widen the family and is checked on every emit.
Graph tests can use holoscan::testing::strict_compile_options() from
<holoscan/testing/compile_options.hpp>, or
holoscan.testing.strict_compile_options() in Python. Both return fresh options
with Tensor and field missing-evidence policies set to Reject. The Python helper
requires the optional Python testing component; the C++ header ships with Core. Application
examples use the default policies; their tests fail on missing-evidence
warnings.
Python schema inputs now support per-field Tensor requirements through
expects_tensor(spec, field="data"); an Input(Image, tensor_spec=spec) class
attribute selects its single Tensor field. Payload providers must rebuild
against the 5.1 registration headers to use the new callback. The 5.0 registration
ABI has no stability promise; this addition makes no promise for later releases.
Color conversion and default schema fields
ColorSpaceConverterOp with no output_format preserves its input’s encoding
at compile time and runtime. A selected format instead derives its exact
encoding from that Parameter. A null projection uses the input; a failed,
empty or out-of-envelope projection rejects compilation and never falls back.
A schema forwarder can use preserves_fields(input) in C++, or
hs.Preserve(input, fields=hs.ALL_FIELDS) on a Python output. This forwards all
unstated enum fields, including fields added to the generated schema later.
An output’s own promise and explicit field maps take priority, independent of
call order. Tensor facts still require a separate preserves(input) or
hs.Preserve(input) declaration. The input and output must use the same schema.
HolovizOp
These changes apply to the Beta HolovizOp C++ API in holoscan::visualization. The Python
HolovizOp keeps its 5.0 keyword arguments.
Constructor options
HolovizOp takes its trigger and max_input_age in an optional HolovizOpOptions argument.
Name only the fields that you change:
The 5.0 constructor, which takes the trigger and max_input_age as separate arguments, is
deprecated and will be removed in a future release. A direct call to it compiles with a
deprecation warning, so a build that treats warnings as errors fails until it is migrated. The
compiler may not report a call that Graph::op forwards, but each process that uses the
constructor logs one warning at run time.
The constructor now throws holoscan::RuntimeError with ErrorCode::kInvalidArgument for an
invalid declaration, for example an empty or duplicate layer name, a layer field out of range,
or a trigger that names no declared layer. In 5.0 the operator terminated, or the render backend
rejected the layer at start().
LayerTrigger
LayerTrigger is no longer an aggregate. It has a constructor for each way to name the driving
layer: by declared index, by layer name, or by the handle that LayerStack::add_*_layer returns.
The constructors are explicit, so a bare integer is not a trigger: write
HolovizOpOptions{.trigger = LayerTrigger{1}}, not .trigger = 1. The public layer field
remains. HolovizOp::trigger() reports the resolved index in layer however the layer was
named, and HolovizOp::trigger_layer() returns it directly. A handle is checked against the
operator’s own layer stack, so a handle from another stack, or a default-constructed handle,
fails construction instead of selecting whatever layer has the same index.
Side layers between samples
The runtime gives each sample to one activation only. In 5.0, a geometry or text layer that
was not the trigger was therefore drawn only on the frames that brought a new sample: a 30 fps
overlay over a 60 fps camera appeared in about every other frame, whatever the max_input_age.
In 5.1 the operator draws the layer’s last sample again on the frames between samples, as it
does for the new LUT layer, until that sample is older than max_input_age. After that the
layer is skipped, and the other layers keep rendering. Image layers already held their last
frame in 5.0.
Layer declarations
LayerStack::add_*_layerreturns a typedLayerHandleinstead ofvoid. Existing calls that ignore the result still compile.LUTLayerDesc::lut_sizeis the capacity of the color table. A 5.0 declaration with onlylut_size,max_width, andmax_heightstill compiles and, as in 5.0, draws nothing, because it has no color table. Addcolor_lut, or setcolor_lut_inputand connect the<port_name>_color_lutport, to draw the layer.- New fields follow the 5.0 fields of each layer descriptor, so 5.0 positional and designated initializers keep their meaning.