8000 [nativert] move recordfunction by dolpm · Pull Request #153088 · pytorch/pytorch · GitHub
[go: up one dir, main page]

Skip to content

[nativert] move recordfunction #153088

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

Closed
wants to merge 1 commit into from
Closed

Conversation

dolpm
Copy link
Contributor
@dolpm dolpm commented May 7, 2025

Summary:
nativert RFC: https://github.com/zhxchen17/rfcs/blob/master/RFC-0043-torch-native-runtime.md

To land the runtime into PyTorch core, we will gradually land logical parts of the code into the Github issue and get each piece properly reviewed.

This diff moves the our function-recording raii wrapper into record_function_ops

Test Plan: CI

Differential Revision: D74284301

@dolpm dolpm requested review from albanD and soulitzer as code owners May 7, 2025 19:34
Copy link
pytorch-bot bot commented May 7, 2025

🔗 Helpful Links

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

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

❗ 1 Active SEVs

There are 1 currently active SEVs. If your PR is affected, please view them below:

❌ 1 Cancelled Job, 1 Unrelated Failure

As of commit 0066a93 with merge base 0104ac0 (image):

CANCELLED JOB - The following job was cancelled. Please retry:

BROKEN TRUNK - The following job failed but were present on the merge base:

👉 Rebase onto the `viable/strict` branch to avoid these failures

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

@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D74284301

@dolpm dolpm added the topic: not user facing topic category label May 7, 2025
@dolpm dolpm force-pushed the export-D74284301 branch from 0f2bd47 to 1157d42 Compare May 8, 2025 05:39
dolpm added a commit to dolpm/pytorch that referenced this pull request May 8, 2025
Summary:

nativert RFC: https://github.com/zhxchen17/rfcs/blob/master/RFC-0043-torch-native-runtime.md

To land the runtime into PyTorch core, we will gradually land logical parts of the code into the Github issue and get each piece properly reviewed.

This diff moves the our function-recording raii wrapper into record_function_ops

Test Plan: CI

Differential Revision: D74284301
@dolpm dolpm force-pushed the export-D74284301 branch from 1157d42 to 6685a19 Compare May 8, 2025 05:41
dolpm added a commit to dolpm/pytorch that referenced this pull request May 8, 2025
Summary:

nativert RFC: https://github.com/zhxchen17/rfcs/blob/master/RFC-0043-torch-native-runtime.md

To land the runtime into PyTorch core, we will gradually land logical parts of the code into the Github issue and get each piece properly reviewed.

This diff moves the our function-recording raii wrapper into record_function_ops

Test Plan: CI

Differential Revision: D74284301
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D74284301

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

This pull request was exported from Phabricator. Differential Revision: D74284301

@dolpm dolpm force-pushed the export-D74284301 branch from 6685a19 to c671c09 Compare May 8, 2025 05:44
dolpm added a commit to dolpm/pytorch that referenced this pull request May 8, 2025
Summary:
Pull Request resolved: pytorch#153088

nativert RFC: https://github.com/zhxchen17/rfcs/blob/master/RFC-0043-torch-native-runtime.md

To land the runtime into PyTorch core, we will gradually land logical parts of the code into the Github issue and get each piece properly reviewed.

This diff moves the our function-recording raii wrapper into record_function_ops

Test Plan: CI

Differential Revision: D74284301
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D74284301

dolpm added a commit to dolpm/pytorch that referenced this pull request May 8, 2025
Summary:
Pull Request resolved: pytorch#153088

nativert RFC: https://github.com/zhxchen17/rfcs/blob/master/RFC-0043-torch-native-runtime.md

To land the runtime into PyTorch core, we will gradually land logical parts of the code into the Github issue and get each piece properly reviewed.

This diff moves the our function-recording raii wrapper into record_function_ops

Test Plan: CI

Differential Revision: D74284301
@dolpm dolpm force-pushed the export-D74284301 branch from c671c09 to 260f14b Compare May 8, 2025 05:48
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D74284301

dolpm added a commit to dolpm/pytorch that referenced this pull request May 8, 2025
Summary:

nativert RFC: https://github.com/zhxchen17/rfcs/blob/master/RFC-0043-torch-native-runtime.md

To land the runtime into PyTorch core, we will gradually land logical parts of the code into the Github issue and get each piece properly reviewed.

This diff moves the our function-recording raii wrapper into record_function_ops

Test Plan: CI

Differential Revision: D74284301
@dolpm dolpm force-pushed the export-D74284301 branch from 260f14b to 302a2bc Compare May 8, 2025 06:21
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D74284301

dolpm added a commit to dolpm/pytorch that referenced this pull request May 8, 2025
Summary:
Pull Request resolved: pytorch#153088

nativert RFC: https://github.com/zhxchen17/rfcs/blob/master/RFC-0043-torch-native-runtime.md

To land the runtime into PyTorch core, we will gradually land logical parts of the code into the Github issue and get each piece properly reviewed.

This diff moves the our function-recording raii wrapper into record_function_ops

Test Plan: CI

Differential Revision: D74284301
@dolpm dolpm force-pushed the export-D74284301 branch from 302a2bc to c6b645d Compare May 8, 2025 06:25
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D74284301

Skylion007
Skylion007 previously approved these changes May 8, 2025
@pytorch-bot pytorch-bot bot added the ciflow/trunk Trigger trunk jobs on your pull request label May 8, 2025
@Skylion007 Skylion007 dismissed their stale review May 8, 2025 14:25

Please move all of nativert to csrc/

@dolpm
Copy link
Contributor Author
dolpm commented May 8, 2025

@Skylion007 this diff doesn't touch torch/nativert :)

@@ -24,4 +26,29 @@ TORCH_API c10::intrusive_ptr<c10::ivalue::Future> _call_end_callbacks_on_fut_new
const c10::intrusive_ptr<PythonRecordFunction>& record,
const c10::intrusive_ptr<c10::ivalue::Future>& fut);

/**
* RAII wrapper that behaves similarly to torch.profiler.record_function.
Copy link
Collaborator

Choose a reason for hiding this comment

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

The profiler API doesn't have such API already?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

not that I could find.

/**
* RAII wrapper that behaves similarly to torch.profiler.record_function.
*/
class RecordFunction {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Isn't this part of libtorch_python? Would nativert depend on libtorch-only or libtorch_python?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

looks like a part of libtorch_core so I think we should be fine.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ok, let's add a test to make sure all of this behave as expected

@zhxchen17 zhxchen17 requested a review from Skylion007 May 9, 2025 16:05
class RecordFunction {
public:
RecordFunction() = delete;
RecordFunction(const RecordFunction&) = default;
Copy link
Collaborator

Choose a reason for hiding this comment

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

These move and copy constructors should be delete.

dolpm added a commit to dolpm/pytorch that referenced this pull request May 11, 2025
Summary:

nativert RFC: https://github.com/zhxchen17/rfcs/blob/master/RFC-0043-torch-native-runtime.md

To land the runtime into PyTorch core, we will gradually land logical parts of the code into the Github issue and get each piece properly reviewed.

This diff moves the our function-recording raii wrapper into record_function_ops

Test Plan: CI

Differential Revision: D74284301
@dolpm dolpm force-pushed the export-D74284301 branch from c6b645d to 69f534d Compare May 11, 2025 23:16
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D74284301

Summary:
Pull Request resolved: pytorch#153088

nativert RFC: https://github.com/zhxchen17/rfcs/blob/master/RFC-0043-torch-native-runtime.md

To land the runtime into PyTorch core, we will gradually land logical parts of the code into the Github issue and get each piece properly reviewed.

This diff moves the our function-recording raii wrapper into record_function_ops

Test Plan: CI

Differential Revision: D74284301
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D74284301

@dolpm dolpm force-pushed the export-D74284301 branch from 69f534d to 0066a93 Compare May 11, 2025 23:26
@zhxchen17 zhxchen17 requested a review from albanD May 13, 2025 19:46
@facebook-github-bot
Copy link
Contributor

@pytorchbot merge -i

(Initiating merge automatically since Phabricator Diff has merged, merging with -i because oss signals were bypassed internally)

@pytorchmergebot
Copy link
Collaborator

Merge failed

Reason: Approvers from one of the following sets are needed:

  • superuser (pytorch/metamates)
  • Core Reviewers (mruberry, lezcano, Skylion007, ngimel, peterbell10, ...)
  • Core Maintainers (soumith, gchanan, ezyang, dzhulgakov, malfet, ...)
Details for Dev Infra team Raised by workflow job

Failing merge rule: Core Maintainers

@jeanschmidt
Copy link
Contributor

Merged internally but no valid OSS approval, closing this PR and jedi unlanding D74284301

dolpm added a commit to dolpm/pytorch that referenced this pull request May 15, 2025
Summary:

nativert RFC: https://github.com/zhxchen17/rfcs/blob/master/RFC-0043-torch-native-runtime.md

To land the runtime into PyTorch core, we will gradually land logical parts of the code into the Github issue and get each piece properly reviewed.

This diff moves the our function-recording raii wrapper into record_function_ops

Test Plan: CI

Reviewed By: zhxchen17

Differential Revision: D74771077
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ciflow/trunk Trigger trunk jobs on your pull request fb-exported topic: not user facing topic category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants
0