Skip to content

[Backend Tester] Report delegation statistics #12846

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

Merged
merged 89 commits into from
Aug 12, 2025
Merged

Conversation

GregoryComer
Copy link
Member

@GregoryComer GregoryComer commented Jul 25, 2025

Report total number of delegated and undelegated nodes and breakdown by operator count.

Example from CoreML add:

Test ID Test Case Backend Delegated Nodes Undelegated Nodes Delegated Ops Undelegated Ops
test_add_dtype_float32_coreml test_add_dtype coreml 1 0 {'aten::add.Tensor': 1} {}
test_add_dtype_float32_coreml_static_int8 test_add_dtype coreml 7 0 {'aten::add.Tensor': 1, 'quantized_decomposed::dequantize_per_tensor': 3, 'quantized_decomposed::quantize_per_tensor': 3} {}

[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
in the test report.
"""
if counter is not None:
return str(dict(sorted(counter.items())))
Copy link
Contributor

Choose a reason for hiding this comment

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

we can make this pretty but OK for now

elapsed = time.perf_counter() - lower_start_time
extra_stats["lower_time"] = timedelta(seconds=elapsed)
except Exception as e:
elapsed = time.perf_counter() - lower_start_time
extra_stats["lower_time"] = timedelta(seconds=elapsed)
return build_result(TestResult.LOWER_FAIL, e)

# Compute delegation statistics. Use the ETRecord to access the edge dialect graph between
Copy link
Contributor

Choose a reason for hiding this comment

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

Curious why do we need to go through ETRecord?

Copy link
Member Author

Choose a reason for hiding this comment

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

This is because we need the graph in between to_edge and to_backend when using to_edge_transform_and_lower in order to see the edge-dialect graph before partitioning. In theory, we have the info with the exported program, but it's aten dialect and pre-decompositions, so it's hard to reason about what's delegated.

With to_edge_transform_and_lower, we don't otherwise have a way to inspect the graph between the edge and lowering steps. ETRecord has effectively the same problem (they need the pre-delegation edge graph), so I'm using it here.

[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
Base automatically changed from gh/GregoryComer/92/head to main August 12, 2025 19:41
[ghstack-poisoned]
@GregoryComer GregoryComer added the release notes: none Do not include this in the release notes label Aug 12, 2025
@GregoryComer GregoryComer merged commit 94f3880 into main Aug 12, 2025
99 of 102 checks passed
@GregoryComer GregoryComer deleted the gh/GregoryComer/93/head branch August 12, 2025 20:10
@zingo
Copy link
Collaborator

zingo commented Aug 13, 2025

As a note: This might have broken the Arm backend testing, we have a fix to be merged soon if testing goes well.
#13370

But seem like a nice thing, would be fun to play with this!

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. release notes: none Do not include this in the release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants