Skip to content

Error out if registering prim ops multiple times #8172

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

Merged
merged 1 commit into from
Feb 4, 2025

Conversation

larryliu0820
Copy link
Contributor

Summary:
Using executorch_ops_check should error out if the dependencies includes 2 libraries of prim_op_registry. For example:

The target //arvr/libraries/wristband/tsn/transformers:TorchstreamTransformerTest depends on both prim_ops_registry and prim_ops_registry_aten. BUCK query:

buck2 uquery "filter('prim_ops_registry(?:_static|_aten)?$', deps(//arvr/libraries/wristband/tsn/transformers:
TorchstreamTransformerTest))"
Buck UI: https://www.internalfb.com/buck2/1401c12c-0ef2-4ba8-8d4e-6b86871d708f
Network: Up: 0B  Down: 0B
Command: uquery.
Time elapsed: 3.6s
fbcode//executorch/kernels/prim_ops:prim_ops_registry
fbcode//executorch/kernels/prim_ops:prim_ops_registry_aten
fbsource//xplat/executorch/kernels/prim_ops:prim_ops_registry
fbsource//xplat/executorch/kernels/prim_ops:prim_ops_registry_aten

This will cause the error like this:

E 00:00:00.032942 executorch:operator_registry.cpp:86] Re-registering aten::sym_size.int, from /data/users/larryliu/fbsource/buck-out/v2/gen/fbsource/cfdc20bd56300721/arvr/libraries/wristband/tsn/transformers/__TorchstreamTransformerTest__/./__TorchstreamTransformerTest__shared_libs_symlink_tree/libexecutorc$
E 00:00:00.033022 executorch:operator_registry.cpp:87] key: (null), is_fallback: true
F 00:00:00.033033 executorch:operator_registry.cpp:111] In function register_kernels(), assert failed (false): Kernel registration failed with error 18, see error log for details.

To catch issues like this, we should error out when user uses executorch_ops_check to debug.

executorch_ops_check(
    name = "my_executorch_test_check",
    deps = [":TorchstreamTransformerTest"],
)

Fixing the internal portion of #8171

Differential Revision: D69090850

Copy link

pytorch-bot bot commented Feb 4, 2025

🔗 Helpful Links

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

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:

❌ 2 New Failures, 2 Unrelated Failures

As of commit 092e032 with merge base 58c725c (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.

@facebook-github-bot facebook-github-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 Feb 4, 2025
@facebook-github-bot
Copy link
Contributor

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

facebook-github-bot pushed a commit that referenced this pull request Feb 4, 2025
Summary:

Using `executorch_ops_check` should error out if the dependencies includes 2 libraries of `prim_op_registry`. For example:

The target `//arvr/libraries/wristband/tsn/transformers:TorchstreamTransformerTest` depends on both `prim_ops_registry` and `prim_ops_registry_aten`. BUCK query:

```
buck2 uquery "filter('prim_ops_registry(?:_static|_aten)?$', deps(//arvr/libraries/wristband/tsn/transformers:
TorchstreamTransformerTest))"
Buck UI: https://www.internalfb.com/buck2/1401c12c-0ef2-4ba8-8d4e-6b86871d708f
Network: Up: 0B  Down: 0B
Command: uquery.
Time elapsed: 3.6s
fbcode//executorch/kernels/prim_ops:prim_ops_registry
fbcode//executorch/kernels/prim_ops:prim_ops_registry_aten
fbsource//xplat/executorch/kernels/prim_ops:prim_ops_registry
fbsource//xplat/executorch/kernels/prim_ops:prim_ops_registry_aten
```

This will cause the error like this:

```
E 00:00:00.032942 executorch:operator_registry.cpp:86] Re-registering aten::sym_size.int, from /data/users/larryliu/fbsource/buck-out/v2/gen/fbsource/cfdc20bd56300721/arvr/libraries/wristband/tsn/transformers/__TorchstreamTransformerTest__/./__TorchstreamTransformerTest__shared_libs_symlink_tree/libexecutorc$
E 00:00:00.033022 executorch:operator_registry.cpp:87] key: (null), is_fallback: true
F 00:00:00.033033 executorch:operator_registry.cpp:111] In function register_kernels(), assert failed (false): Kernel registration failed with error 18, see error log for details.
```

To catch issues like this, we should error out when user uses `executorch_ops_check` to debug.

```
executorch_ops_check(
    name = "my_executorch_test_check",
    deps = [":TorchstreamTransformerTest"],
)
```

Fixing the internal portion of [#8171](#8171)

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

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

@larryliu0820 larryliu0820 changed the title Error out if registering prim ops Error out if registering prim ops multiple times Feb 4, 2025
Copy link
Contributor

@lucylq lucylq left a comment

Choose a reason for hiding this comment

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

Lgtm, thank you!

Summary:

Using `executorch_ops_check` should error out if the dependencies includes 2 libraries of `prim_op_registry`. For example:

The target `//arvr/libraries/wristband/tsn/transformers:TorchstreamTransformerTest` depends on both `prim_ops_registry` and `prim_ops_registry_aten`. BUCK query:

```
buck2 uquery "filter('prim_ops_registry(?:_static|_aten)?$', deps(//arvr/libraries/wristband/tsn/transformers:
TorchstreamTransformerTest))"
Buck UI: https://www.internalfb.com/buck2/1401c12c-0ef2-4ba8-8d4e-6b86871d708f
Network: Up: 0B  Down: 0B
Command: uquery.
Time elapsed: 3.6s
fbcode//executorch/kernels/prim_ops:prim_ops_registry
fbcode//executorch/kernels/prim_ops:prim_ops_registry_aten
fbsource//xplat/executorch/kernels/prim_ops:prim_ops_registry
fbsource//xplat/executorch/kernels/prim_ops:prim_ops_registry_aten
```

This will cause the error like this:

```
E 00:00:00.032942 executorch:operator_registry.cpp:86] Re-registering aten::sym_size.int, from /data/users/larryliu/fbsource/buck-out/v2/gen/fbsource/cfdc20bd56300721/arvr/libraries/wristband/tsn/transformers/__TorchstreamTransformerTest__/./__TorchstreamTransformerTest__shared_libs_symlink_tree/libexecutorc$
E 00:00:00.033022 executorch:operator_registry.cpp:87] key: (null), is_fallback: true
F 00:00:00.033033 executorch:operator_registry.cpp:111] In function register_kernels(), assert failed (false): Kernel registration failed with error 18, see error log for details.
```

To catch issues like this, we should error out when user uses `executorch_ops_check` to debug.

```
executorch_ops_check(
    name = "my_executorch_test_check",
    deps = [":TorchstreamTransformerTest"],
)
```

Fixing the internal portion of [#8171](#8171)

Reviewed By: lucylq

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

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

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 topic: not user facing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants