Skip to content

Add portable rand kernel implementation #11127

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

GregoryComer
Copy link
Member

Summary

Add a portable operator implementation for ATen rand. This is a core op that we previously have not had a kernel for.

Test plan

I've added operator-level tests for rand. It's relatively sparse, but validates that the mean and stdev are reasonably sane, as well as that the operator functions correctly for different dtypes, ranks, and sizes.

Copy link

pytorch-bot bot commented May 25, 2025

🔗 Helpful Links

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

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

❌ 2 New Failures

As of commit d538ff7 with merge base 28cbc2b (image):

NEW FAILURES - The following jobs have failed:

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 May 25, 2025
@GregoryComer GregoryComer added the release notes: ops & kernels Changes to the opset and any new / changed kernel implementations label May 25, 2025
#include <executorch/kernels/portable/cpu/scalar_utils.h>
#include <executorch/runtime/kernel/kernel_includes.h>

#include <random>
Copy link
Contributor

Choose a reason for hiding this comment

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

This may not be available in embedded devices. Foe example, zephyr has different API https://docs.zephyrproject.org/apidoc/latest/group__random__api.html

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, this is generally true, though FYI Scott W has already been using std random for other ops. I'm open to changing it. But we might need to provide implementations as part of the Cortex M workstream.

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. release notes: ops & kernels Changes to the opset and any new / changed kernel implementations
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants