Skip to content

[Backend Tester] Reduce log verbosity / spam #13312

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

Open
wants to merge 12 commits into
base: gh/GregoryComer/122/head
Choose a base branch
from

Conversation

GregoryComer
Copy link
Member

@GregoryComer GregoryComer commented Aug 12, 2025

When running tests, deprecation warnings for export_for_training and "internal consistency verification was requested but not available" create a large amount of spam in the CLI and drown out actual test info during the run. Neither warning is particularly useful. I've suppressed the the export_for_training warning in the backend tester only and switched the tester to not request internal consistency verification since it's not compiled into pybindings by default. This gives much cleaner CLI output.

Before:

test_add_dtype_float32_xnnpack_static_int8_per_channel (test_add.Add.test_add_dtype_float32_xnnpack_static_int8_per_channel) ... /home/gregory/src/executorch/src/executorch/backends/test/harness/stages/quantize.py:50: FutureWarning: `torch.export.export_for_training` is deprecated and will be removed in PyTorch 2.10. Please use `torch.export.export` instead, which is functionally equivalent.
  captured_graph = export_for_training(artifact, inputs, strict=True).module()
/home/gregory/miniconda3/envs/executorch/lib/python3.12/site-packages/torchao/quantization/pt2e/utils.py:818: FutureWarning: `torch.export.export_for_training` is deprecated and will be removed in PyTorch 2.10. Please use `torch.export.export` instead, which is functionally equivalent.
  aten_pattern = torch.export.export_for_training(
/home/gregory/miniconda3/envs/executorch/lib/python3.12/site-packages/torchao/quantization/pt2e/utils.py:818: FutureWarning: `torch.export.export_for_training` is deprecated and will be removed in PyTorch 2.10. Please use `torch.export.export` instead, which is functionally equivalent.
  aten_pattern = torch.export.export_for_training(
/home/gregory/miniconda3/envs/executorch/lib/python3.12/site-packages/torchao/quantization/pt2e/utils.py:818: FutureWarning: `torch.export.export_for_training` is deprecated and will be removed in PyTorch 2.10. Please use `torch.export.export` instead, which is functionally equivalent.
  aten_pattern = torch.export.export_for_training(
/home/gregory/miniconda3/envs/executorch/lib/python3.12/site-packages/torchao/quantization/pt2e/utils.py:818: FutureWarning: `torch.export.export_for_training` is deprecated and will be removed in PyTorch 2.10. Please use `torch.export.export` instead, which is functionally equivalent.
... (it logs like 20x per test)

After:

test_add_dtype_float32_xnnpack (test_add.Add.test_add_dtype_float32_xnnpack) ... ok
test_add_dtype_float32_xnnpack_static_int8_per_channel (test_add.Add.test_add_dtype_float32_xnnpack_static_int8_per_channel) ... ok
test_add_f32_alpha_xnnpack (test_add.Add.test_add_f32_alpha_xnnpack) ... ok
test_add_f32_alpha_xnnpack_static_int8_per_channel (test_add.Add.test_add_f32_alpha_xnnpack_static_int8_per_channel) ... ERROR
...

[ghstack-poisoned]
Copy link

pytorch-bot bot commented Aug 12, 2025

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/13312

Note: Links to docs will display an error until the docs builds have been completed.

❌ 3 New Failures, 1 Unrelated Failure

As of commit c583fa1 with merge base d7ecd87 (image):

NEW FAILURES - The following jobs have failed:

BROKEN TRUNK - The following job failed but were present on the merge base:

👉 Rebase onto the `viable/strict` branch to avoid these failures

This comment was automatically generated by Dr. CI and updates every 15 minutes.

[ghstack-poisoned]
GregoryComer added a commit that referenced this pull request Aug 12, 2025
ghstack-source-id: ffceed5
ghstack-comment-id: 3177730920
Pull-Request: #13312
[ghstack-poisoned]
GregoryComer added a commit that referenced this pull request Aug 12, 2025
ghstack-source-id: ffceed5
ghstack-comment-id: 3177730920
Pull-Request: #13312
[ghstack-poisoned]
GregoryComer added a commit that referenced this pull request Aug 12, 2025
ghstack-source-id: bbefbff
ghstack-comment-id: 3177730920
Pull-Request: #13312
@GregoryComer GregoryComer marked this pull request as ready for review August 12, 2025 06:12
@GregoryComer GregoryComer requested a review from cccclai as a code owner August 12, 2025 06:12
[ghstack-poisoned]
[ghstack-poisoned]
@@ -39,7 +40,9 @@ def graph_module(self) -> None:

def run_artifact(self, inputs):
inputs_flattened, _ = tree_flatten(inputs)
executorch_module = _load_for_executorch_from_buffer(self.buffer)
executorch_module = _load_for_executorch_from_buffer(
self.buffer, program_verification=Verification.Minimal
Copy link
Contributor

Choose a reason for hiding this comment

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

what does this do? i.e. Minimal ==> "do the verification but don't print warnings"?

Copy link
Member Author

@GregoryComer GregoryComer Aug 12, 2025

Choose a reason for hiding this comment

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

This doesn't actually cause any change in verification, because the extended verification feature isn't compiled into pybindings by default. So the runtime logs a warning because it was requested but not available. This change updates the code to not ask for extended verification.

Here's the relevant code from the runtime. The "InternalConsistency verification requested but not available " log is the one contributing to log spam.

#if ET_ENABLE_PROGRAM_VERIFICATION
EXECUTORCH_SCOPE_PROF("Program::verify_internal_consistency");
flatbuffers::Verifier verifier(
reinterpret_cast<const uint8_t*>(program_data->data()),
program_data->size());
bool ok = executorch_flatbuffer::VerifyProgramBuffer(verifier);
ET_CHECK_OR_RETURN_ERROR(
ok,
InvalidProgram,
"Verification failed; data may be truncated or corrupt");
#else
ET_LOG(
Info, "InternalConsistency verification requested but not available");
#endif

@@ -249,6 +250,10 @@ def build_test_filter(args: argparse.Namespace) -> TestFilter:
def runner_main():
args = parse_args()

# Suppress deprecation warnings for export_for_training, as it generates a
# lot of log spam. We don't really need the warning here.
warnings.simplefilter("ignore", category=FutureWarning)
Copy link
Contributor

Choose a reason for hiding this comment

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

FYI PyTest has this nice feature where they count same warnings and at the end print warning summary https://docs.pytest.org/en/stable/how-to/capture-warnings.html

Copy link
Member Author

Choose a reason for hiding this comment

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

I want to look at using pytest or another framework once we get the core harness and suite landed. I originally went with unittest, in part, because staying closer to unittest made it easier to run within buck/Meta-internal. But if that constraint is lifted, we can probably leverage pytest for some nicer features without having to make too many code changes.

[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants