Skip to content
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

Fix the issue of incorrect External id for non-PyTorch activities #1001

Closed
wants to merge 4 commits into from

Conversation

fwenguang
Copy link
Contributor

Sorry about the incomplete patch addressing the issue of setting the external ID.
I think only the PyTorch activities should set the external id to op.correlationId(), while the external ids for the runtimes and kernels should be set to op.linkedActivity()->correlationId().
However, there may be cases where the linkedActivity() for the runtime or kernel is nullptr (for example, when directly launching a kernel using a pybind mapping interface). In such cases, the external id should be empty, not set to op.correlationId().

int external_id = 0;
if (op.linkedActivity()) {
external_id = op.linkedActivity()->correlationId();
} else if (op.type() == libkineto::ActivityType::CPU_OP ||
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

I think logically this makes sense although I was wondering if instead of having this whitelist of events that set external_id = op.correlationId(), can we just have a blacklist of events where we want to skip (ie. CUDA_RUNTIME/CUDA_KERNEL events). I ask this because there could be a type that we are missing and I would rather have extra information (even if wrong) rather than have a trace missing information.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for your suggestion. Using a blacklist is indeed a more suitable solution.To minimize the impact, I only added the types that I can confirm can be excluded.

Copy link
Contributor

Choose a reason for hiding this comment

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

Awesome, thanks!

@fwenguang
Copy link
Contributor Author

Hi, @aaronenyeshi , could you please take a look at whether this patch is okay?

@sraikund16
Copy link
Contributor

Overall looks reasonable

@facebook-github-bot
Copy link
Contributor

@sraikund16 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@fwenguang has updated the pull request. You must reimport the pull request before landing.

@facebook-github-bot
Copy link
Contributor

@fwenguang has updated the pull request. You must reimport the pull request before landing.

@facebook-github-bot
Copy link
Contributor

@sraikund16 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

1 similar comment
@facebook-github-bot
Copy link
Contributor

@sraikund16 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@sraikund16 merged this pull request in 955af49.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants