-
Notifications
You must be signed in to change notification settings - Fork 6k
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
[Datasets] [Operator Fusion - 5/N] Add metrics collection to data layer. #32749
[Datasets] [Operator Fusion - 5/N] Add metrics collection to data layer. #32749
Conversation
65e4e9d
to
1da6e5e
Compare
1da6e5e
to
7b9c78c
Compare
for block in block_iter: | ||
with stats.iter_format_batch_s.timer() if stats else nullcontext(): | ||
batch = BlockAccessor.for_block(block).to_batch_format(batch_format) | ||
acc = BlockAccessor.for_block(block) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You may want to record the metrics from within BlockAccessor
, e.g., BlockAccessor(block, metrics_sink)
to avoid duplication of code recording metrics and make the code look nicer.
@@ -28,5 +32,7 @@ def fn( | |||
# This causes different behavior between filter and other map-like | |||
# functions. We should revisit and try to get rid of this logic. | |||
yield builder.build() | |||
if metrics_collector is not None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shall we always make this non None?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure! Initially this was going to allow the legacy path to not be ported, but we can always collect the metrics and then drop them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should also add some unit tests for the metrics collector (this is getting large... should we merge metrics util code in a dedicated PR?)
Couple other thoughts on the metrics:
- Should we record only rows copied/sliced/concatenated? It seems more directly related to performance than the number of slices.
- Maybe start with fewer metrics
f9fa7f0
to
e157ad9
Compare
e157ad9
to
1959282
Compare
This PR adds basic metrics collection to the Datasets data layer, focusing on batching and block building. This allows us to capture metrics around data slicing, concatenation, copying, etc.
This PR is partially stacked on changes in #32744. This PR is an e2e instrumentation successor to #33831.
TODOs
num_copies
isn't incremented for slicing, even thoughSimpleBlocks
always copy on.slice()
, even ifcopy=False
.Checks
git commit -s
) in this PR.scripts/format.sh
to lint the changes in this PR.