Skip to content

LaplacianPyramid/LaplacianReconstruct tests call vxProcessGraph only once, missing stale-output bugs across re-runs #37

Description

@kiritigowda

Summary

test_conformance/test_laplacianpyramid.c calls vxProcessGraph() exactly once per test for both LaplacianPyramid and LaplacianReconstruct. Because of this, the suite cannot detect implementations that compute the result once (e.g. at vxVerifyGraph() time) and then return a stale, cached output on subsequent vxProcessGraph() calls.

This is not a hypothetical gap — it currently hides a real spec violation in the OpenVX sample implementation, tracked at KhronosGroup/OpenVX-sample-impl#59, where vxLaplacianPyramidKernel / vxLaplacianReconstructKernel are no-op stubs and the actual pyramid computation is hoisted into the *Initializer callback (which runs once during verify). The CTS passes regardless, because it never re-processes the graph after mutating the input.

Why the current tests miss it

In both LaplacianPyramid.testGraphProcessing and LaplacianReconstruct.testGraphProcessing the shape is:

ASSERT_VX_OBJECT(node = vxLaplacianPyramidNode(graph, input, laplacian, output), VX_TYPE_NODE);
VX_CALL(vxSetNodeAttribute(node, VX_NODE_BORDER, &border, sizeof(border)));
VX_CALL(vxVerifyGraph(graph));
VX_CALL(vxProcessGraph(graph));   // <-- only one call, then output is compared

The spec (vxProcessGraph, REQ-0606/REQ-0607) requires the graph to be processed against the current input on every call; there is no allowance for skipping execution when an implementation assumes the input is unchanged (callers may mutate input pixels via vxMapImagePatch / vxCopyImagePatch between runs without notifying anything).

Proposed fix

Add a regression test to both LaplacianPyramid and LaplacianReconstruct that:

  1. Verifies the graph once.
  2. Fills the input with value A, vxProcessGraph(), snapshot the output.
  3. Mutates the input to value B (without re-verifying).
  4. vxProcessGraph() again, snapshot the output.
  5. Asserts the two outputs differ.

A spec-compliant implementation recomputes and the outputs differ; a verify-time-caching implementation returns identical bytes and the test fails. For LaplacianPyramid, comparing the residual (lowest-resolution) output image works well, since a constant input maps to a constant residual that tracks the input value. For LaplacianReconstruct, mutating the lowest-resolution input image and comparing the reconstructed output works the same way.

Sketch:

TEST(LaplacianPyramid, testReprocessReflectsInputChange)
{
    /* build graph + node, set border, vxVerifyGraph once */
    fill_input(input, 50);  vxProcessGraph(graph);  c1 = checksum(output);
    fill_input(input, 200); vxProcessGraph(graph);  c2 = checksum(output); /* no re-verify */
    ASSERT(c1 != c2);
}

I've prototyped exactly this against the sample implementation: the fixed kernels pass it, and the current (unfixed) sample fails it — so it correctly gates the bug in KhronosGroup/OpenVX-sample-impl#59.

I'm happy to open a PR with the two tests if that's welcome.

References

Metadata

Metadata

Assignees

Labels

1.3.2bugSomething isn't working

Type

Fields

No fields configured for Bug.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions