Skip to content

Always lock workspace in buck builds (#19734)#19734

Open
GregoryComer wants to merge 1 commit into
pytorch:mainfrom
GregoryComer:export-D106026285
Open

Always lock workspace in buck builds (#19734)#19734
GregoryComer wants to merge 1 commit into
pytorch:mainfrom
GregoryComer:export-D106026285

Conversation

@GregoryComer
Copy link
Copy Markdown
Member

@GregoryComer GregoryComer commented May 22, 2026

Summary:

In older versions of the XNNPACK backend, we always locked when accessing the XNNPACK workspace. This gives guarantees that we don't re-size the workspace, even when callers violate thread safety.

In D95475030, an OSS contributor disabled locking when workspace sharing is off. This is safe as long as the caller observes proper thread safety. However, we're seeing some crashes that look like they might be caused by the workspace resizing or freeing during inference.

This diff restores the locking for buck builds in the workspace sharing disabled case as a hardening measure. I've left it enabled in CMake.

Differential Revision: D106026285

@GregoryComer GregoryComer requested a review from digantdesai as a code owner May 22, 2026 00:09
@pytorch-bot
Copy link
Copy Markdown

pytorch-bot Bot commented May 22, 2026

🔗 Helpful Links

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

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

❌ 4 New Failures, 2 Unrelated Failures

As of commit 57d55be with merge base 3b5f777 (image):

NEW FAILURES - The following jobs have failed:

BROKEN TRUNK - The following jobs 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.

@meta-cla meta-cla 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 May 22, 2026
@meta-codesync
Copy link
Copy Markdown
Contributor

meta-codesync Bot commented May 22, 2026

@GregoryComer has exported this pull request. If you are a Meta employee, you can view the originating Diff in D106026285.

@github-actions
Copy link
Copy Markdown

This PR needs a release notes: label

If your change should be included in the release notes (i.e. would users of this library care about this change?), please use a label starting with release notes:. This helps us keep track and include your important work in the next release notes.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "release notes: none"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

@digantdesai
Copy link
Copy Markdown
Contributor

This diff restores the locking for buck builds in the workspace sharing disabled case as a hardening measure. I've left it enabled in CMake.

Curious why bother with the differentiation between buck and cmake?

Summary:

In older versions of the XNNPACK backend, we always locked when accessing the XNNPACK workspace. This gives guarantees that we don't re-size the workspace, even when callers violate thread safety.

In D95475030, an OSS contributor disabled locking when workspace sharing is off. This is safe as long as the caller observes proper thread safety. However, we're seeing some crashes that look like they might be caused by the workspace resizing or freeing during inference.

This diff restores the locking for buck builds in the workspace sharing disabled case as a hardening measure. I've left it enabled in CMake.

Differential Revision: D106026285
@meta-codesync meta-codesync Bot changed the title Always lock workspace in buck builds Always lock workspace in buck builds (#19734) May 22, 2026
@GregoryComer
Copy link
Copy Markdown
Member Author

This diff restores the locking for buck builds in the workspace sharing disabled case as a hardening measure. I've left it enabled in CMake.

Curious why bother with the differentiation between buck and cmake?

An OSS contributor requested we get rid of the locks when not using workspace sharing. I don't think the overhead is high, but I did merge their PR to skip locking in this case. I don't love the fragmentation between buck/cmake, so I'm open to changing it.

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. fb-exported meta-exported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants