Skip to content

Benchmarking: wait for scalar bool output_valid on streaming models - #3762

Open
rameshkunasi wants to merge 2 commits into
tensorflow:mainfrom
rameshkunasi:main
Open

rameshkunasi wants to merge 2 commits into
tensorflow:mainfrom
rameshkunasi:main

Conversation

@rameshkunasi

Copy link
Copy Markdown
Contributor

Streaming models that gate feature extraction and classification subgraphs using Framer/Stacker and IF operators return kTfLiteOk with a 0D scalar boolean output_valid tensor set to false while internal circular buffers are warming up.

Update generic_model_benchmark to check for any 0D boolean output tensor and continue invoking until output_valid becomes true before logging steady-state profiler metrics and exiting the benchmark loop.

BUG=n/a

    Streaming models that gate feature extraction and classification subgraphs
    using Framer/Stacker and IF operators return kTfLiteOk with a 0D scalar
    boolean output_valid tensor set to false while internal circular buffers
    are warming up.

    Update generic_model_benchmark to check for any 0D boolean output tensor
    and continue invoking until output_valid becomes true before logging
    steady-state profiler metrics and exiting the benchmark loop.

BUG=n/a
@rameshkunasi
rameshkunasi requested a review from a team as a code owner September 22, 2026 06:22
@rameshkunasi rameshkunasi added the ci:full Triggers the comprehensive cross-platform test suite. label Sep 22, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rameshkunasi These changes are not sufficient to support all models reliably. I suggest adding makefile changes similar to how GENERIC_BENCHMARK_TENSOR_ARENA_SIZE is implemented. Lets call the new makefile var GENERIC_BENCHMARK_STREAMING_OUTPUT and the value it is set to is the MicroInterpreter output tensor index (0, 1, 2, ...). This allows specific builds of the benchmark tool for streaming models.

The IsOutputValid method should be adjusted to use the GENERIC_BENCHMARK_STREAMING_OUTPUT value, and have #if defined(GENERIC_BENCHMARK_STREAMING_OUTPUT) around that method and any use of the method.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rameshkunasi Could you also make this change (not part of your original PR):

    if ((status != kTfLiteOk) && (static_cast<int>(status) != kTfLiteAbort)) {
      MicroPrintf("Model interpreter invocation failed: %d\n", status);
      return -1;
    }

Changed to:

    if (status != kTfLiteOk) {
      if (static_cast<int>(status) == kTfLiteAbort) {
        continue;
      }
      else {
        MicroPrintf("Model interpreter invocation failed: %d\n", status);
        return -1;
      }
    }

@ddavis-2015

Copy link
Copy Markdown
Member

This PR is dependent on PR #3733

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:full Triggers the comprehensive cross-platform test suite.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants