Views
No views yet
outputSlotIndex as though it were a layer ID. A model can reorder its layer
table to make the deserializer return tensor metadata from a different source
output slot than the slot actually connected to the output layer.2b61cecc9df7a43fca1463795062cf359e6be820.SetupOutputLayers() correctly maps the model-controlled source layer ID to a
position in the layer vector:1unsigned int sourceLayerIndex =
2 GetLayerIndexInVector(graph, connection->sourceLayerIndex());1unsigned int outputSlotIndex =
2 GetLayerIndexInVector(graph, connection->outputSlotIndex());GetLayerIndexInVector() searches every layer's base.index and returns that
layer's position in graph.layers. That result is then used as an index into
the source layer's outputSlots vector.1 is at vector position 0. A connection to source
output slot 1 is therefore read as source output slot 0. A connection to
slot 0 similarly resolves to slot 1, because layer ID 0 is at vector
position 1.quantization-swap.armnn declares two one-element QAsymmU8 source outputs:0.52.01parser output-0 elements=1 scale=2 offset=0
2parser output-1 elements=1 scale=0.5 offset=0
3runtime output-0 elements=1 scale=0.5 offset=0
4runtime output-1 elements=1 scale=2 offset=0
5enqueue=success raw_outputs=20,10
6consumer_values=40,510 and 20.
Using GetNetworkOutputBindingInfo(), as Arm NN's own deserializer fixture
does when allocating and interpreting outputs, the consumer obtains 40 and
5.metadata-swap.armnn reports [3] and [1]
while the runtime reports [1] and [3].poc.armnn reaches Arm NN's null
tensor guard.-fsanitize=address,undefined -fno-omit-frame-pointerlibarmnnDeserializer and libarmnn:1c++ -std=c++17 \
2 -fsanitize=address,undefined -fno-omit-frame-pointer \
3 -I /path/to/armnn/include \
4 quantization-armnn.cpp \
5 -L /path/to/armnn/build \
6 -larmnnDeserializer -larmnn \
7 -Wl,-rpath,/path/to/armnn/build \
8 -o quantization-armnn
9
10ASAN_OPTIONS=detect_leaks=0:halt_on_error=1 \
11UBSAN_OPTIONS=print_stacktrace=1:halt_on_error=1 \
12./quantization-armnn quantization-swap.armnn40,5.quantization-swap.armnn: primary silent-manipulation proofquantization-swap.armnn.json: human-readable FlatBuffers sourcequantization-armnn.cpp: optimize/load/enqueue harnesscontrol.armnn: control with coincident layer IDs/vector positionsmetadata-swap.armnn: shape-metadata mismatch variantpoc.armnn: guarded invalid-slot variant0e889434ad54742096dde1368b5c1add7ae4efc5c483390e4803d6cd39a143ec.outputSlotIndex as the source output-slot index,
then validate it against sourceBaseLayer->outputSlots()->size():1const unsigned int outputSlotIndex =
2 baseLayer->inputSlots()->Get(0)->connection()->outputSlotIndex();GetNetworkOutputBindingInfo() matches the connected
source slot and the runtime output metadata.../../prior-art/armnn-output-binding-slot-index-confusion/20260729T015629.564Z.md.