Skip to content

Replace JNI dtype maps with constexpr functions#21002

Draft
cyyever wants to merge 1 commit into
pytorch:mainfrom
cyyever:constexpr-extension
Draft

Replace JNI dtype maps with constexpr functions#21002
cyyever wants to merge 1 commit into
pytorch:mainfrom
cyyever:constexpr-extension

Conversation

@cyyever

@cyyever cyyever commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

The two const unordered_maps in jni_layer_constants.h were static-initialized and heap-allocated in every including TU; replace them with constexpr switch functions (round-trip verified via static_assert). Also make Stats::SCALING_FACTOR_UNITS_PER_SECOND static constexpr so it no longer occupies space in every instance and stops blocking copy-assignment.

Authored with Claude.

@pytorch-bot

pytorch-bot Bot commented Jul 17, 2026

Copy link
Copy Markdown

🔗 Helpful Links

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

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

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 Jul 17, 2026
@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.

@cyyever
cyyever marked this pull request as draft July 17, 2026 02:43
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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant