Skip to content

Conversation

keyprocedure
Copy link
Contributor

@keyprocedure keyprocedure commented Mar 31, 2025

Summary

Fixes #9551

Reset ETDumpGen instances in each test iteration to avoid shared state to correctly trigger ET_EXPECT_DEATH when no DataSink is set.

Test plan

buck2 run devtools/etdump/tests:etdump_test --

Copy link

pytorch-bot bot commented Mar 31, 2025

🔗 Helpful Links

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

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

✅ No Failures

As of commit f27d896 with merge base bc3d437 (image):
💚 Looks good so far! There are no failures yet. 💚

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

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Mar 31, 2025
@keyprocedure
Copy link
Contributor Author

@pytorchbot label "topic: not user facing"

@keyprocedure
Copy link
Contributor Author

Hi @Gasoonjia, would you mind taking a look at my changes to confirm they match what you had in mind?

I noticed that the DebugEvent test (starting at line 188) follows the same pattern as LogDelegateIntermediateOutput before I added the additional ET_EXPECT_DEATH checks. Do you think similar checks should be added there as well?

@Gasoonjia
Copy link
Contributor

hi @keyprocedure thanks for your great work!
Yes please update all of them:
https://github.com/pytorch/executorch/blob/main/devtools/etdump/tests/etdump_test.cpp#L214
https://github.com/pytorch/executorch/blob/main/devtools/etdump/tests/etdump_test.cpp#L513
Thanks!

@keyprocedure keyprocedure changed the title Refactor and add ET_EXPECT_DEATH tests to LogDelegateIntermediateOutput Add try-before-set tests for DataSink in DebugEvent and LogDelegateIntermediateOutput Apr 1, 2025
@keyprocedure keyprocedure marked this pull request as ready for review April 1, 2025 03:20

auto buffer_data_sink = BufferDataSink::create(ptr, 2048);
auto buffer_data_sink = BufferDataSink::create(ptr, debug_buf_size);
auto file_data_sink = FileDataSink::create(dump_file_path.c_str());

etdump_gen[i]->create_event_block("test_block");
Copy link
Contributor

Choose a reason for hiding this comment

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

perhapes we can move this line under if (j == 0) to make more structural.

Copy link
Contributor

Choose a reason for hiding this comment

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

same as above!

Copy link
Contributor Author

@keyprocedure keyprocedure Apr 1, 2025

Choose a reason for hiding this comment

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

Good catch! I moved line 544 under the if (j==0) condition

Does the second comment, "same as above", refer to line 209 in the most recently changed file?
It looks like that call creates a target block where values logged via log_evalue in the following lines are appended

Copy link
Contributor

@Gasoonjia Gasoonjia left a comment

Choose a reason for hiding this comment

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

Overall LGTM! Thanks @keyprocedure for your contribution! Will stamp it after ci pass.

@@ -497,36 +515,57 @@ TEST_F(ProfilerETDumpTest, VerifyData) {
}
}

// Triggers ET_EXPECT_DEATH if log_intermediate_output_delegate has no data sink
static void expect_log_intermediate_delegate_death(
Copy link
Contributor

Choose a reason for hiding this comment

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

Love this helper function! Please make it as a protected member function of ProfilerETDumpTest to prohibit misuse. See https://github.com/pytorch/executorch/blob/main/kernels/test/op_split_copy_test.cpp#L94 for an example.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved the helper function, I appreciate the example!


auto buffer_data_sink = BufferDataSink::create(ptr, 2048);
auto buffer_data_sink = BufferDataSink::create(ptr, debug_buf_size);
auto file_data_sink = FileDataSink::create(dump_file_path.c_str());

etdump_gen[i]->create_event_block("test_block");
Copy link
Contributor

Choose a reason for hiding this comment

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

same as above!

@Gasoonjia Gasoonjia merged commit 354c57e into pytorch:main Apr 1, 2025
82 checks passed
@Gasoonjia
Copy link
Contributor

Thanks for your great work! Merged!

kirklandsign pushed a commit that referenced this pull request Apr 11, 2025
…termediateOutput (#9762)

### Summary
Fixes #9551 

Reset ETDumpGen instances in each test iteration to avoid shared state
to correctly trigger ET_EXPECT_DEATH when no DataSink is set.

### Test plan
buck2 run devtools/etdump/tests:etdump_test --

---------

Co-authored-by: Gasoonjia <[email protected]>
@mergennachin mergennachin added the community: contribution PRs coming from community (excluding hardware partners) label Apr 28, 2025
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. community: contribution PRs coming from community (excluding hardware partners) topic: not user facing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Missing try-before-set tests for datasink in etdumpgen tests
4 participants