-
Notifications
You must be signed in to change notification settings - Fork 26.3k
[Profiler] Fix ASAN Overflow Issues #140441
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
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/140441
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit 85c0a65 with merge base 3d2dd14 ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
This pull request was exported from Phabricator. Differential Revision: D65835650 |
27a6b19 to
f71bb59
Compare
|
This pull request was exported from Phabricator. Differential Revision: D65835650 |
Summary: It seems like this issues is due to leftover cupti events during warmup staying persistent in the queue during profiling. These events start before our actual time window and therefore have a timestamp lower than our basetime. This makes the delta become negative which results in unsigned overflow. This then creates a large number which later gets sign added which creates the signed overflow. Solution: If a raw timestamp is less than the base timestamp, just mark the process timestamp as -1 so we can mark these events as "to ignore". In Kineto, these events will be filtered as they will be out of range Test Plan: Tested with ASAN and was able to get a reasonable profiler. Also tested basic resnet test and only events in range show up Differential Revision: D65835650
f71bb59 to
85c0a65
Compare
|
This pull request was exported from Phabricator. Differential Revision: D65835650 |
| return [=](approx_time_t t_approx) { | ||
| // See above for why this is more stable than `A * t_approx + B`. | ||
| return (time_t)((double)(t_approx - t0_approx) * scale_factor) + t0; | ||
| return t_approx > t0_approx |
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 could probably do
(time_t)(((double) t_approx - t0_approx) * scale_factor) + t0
without really affecting the precision, since in the original code you're already casting to double.
But if you prefer the current approach that's probably fine too
|
@pytorchbot merge (Initiating merge automatically since Phabricator Diff has merged) |
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
Summary: It seems like this issues is due to leftover cupti events during warmup staying persistent in the queue during profiling. These events start before our actual time window and therefore have a timestamp lower than our basetime. This makes the delta become negative which results in unsigned overflow. This then creates a large number which later gets sign added which creates the signed overflow. Solution: If a raw timestamp is less than the base timestamp, just mark the process timestamp as -1 so we can mark these events as "to ignore". In Kineto, add a special case to ignore timestamps that are negative. Test Plan: Test with ASAN Differential Revision: D65835650 Pull Request resolved: pytorch#140441 Approved by: https://github.com/davidberard98
Summary:
It seems like this issues is due to leftover cupti events during warmup staying persistent in the queue during profiling. These events start before our actual time window and therefore have a timestamp lower than our basetime. This makes the delta become negative which results in unsigned overflow. This then creates a large number which later gets sign added which creates the signed overflow.
Solution: If a raw timestamp is less than the base timestamp, just mark the process timestamp as -1 so we can mark these events as "to ignore". In Kineto, add a special case to ignore timestamps that are negative.
Test Plan: Test with ASAN
Differential Revision: D65835650
cc @robieta @chaekit @guotuofeng @guyang3532 @dzhulgakov @davidberard98 @briancoutinho @sanrise