Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix segfaults in benchmark binaries when setting num_threads > 1 #727

Merged
merged 1 commit into from
Apr 20, 2022

Conversation

CNugteren
Copy link
Contributor

What do these changes do?

The LCE benchmark binaries would often (not always though) segfault when running with more than 1 thread. This was the case both on aarch64 and on x86, and both for BNNs and for regular INT8 networks. However, this issue was only present in the Bazel versions of the binaries and not with the (recently added) CMake versions. That suggested something was wrong in the build scripts and not in the code itself.

This PR changes the Bazel linking settings for the benchmark binaries such that they are in-line with what is done inside TensorFlow itself: https://github.com/tensorflow/tensorflow/blob/master/tensorflow/lite/tools/benchmark/BUILD#L33-L40. With these changes, I could no longer reproduce the segfaults.

How Has This Been Tested?

By running the new benchmark binaries on both x86 and aarch64 a couple of times (with a large number of runs to be sure), with and without XNNPack, e.g.:
bazel-bin/larq_compute_engine/tflite/benchmark/lce_benchmark_model --graph=MobileNetV1_INT8.tflite --num_threads=4 --use_xnnpack=true --num_runs=5000

Benchmark Results

Unchanged.

Related issue number

N/A.

@CNugteren CNugteren requested a review from a team April 20, 2022 07:55
@CNugteren CNugteren added the bug Something isn't working label Apr 20, 2022
@CNugteren CNugteren merged commit 1cb7b1f into main Apr 20, 2022
@CNugteren CNugteren deleted the fix_multithreaded_benchmark_binaries branch April 20, 2022 09:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants