Skip to content

Add mixed integer precision test for op_mul #11206

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: gh/swolchok/395/head
Choose a base branch
from

Conversation

swolchok
Copy link
Contributor

This tests a possibly-surprising result: int8(100) * int8(100) with output type of long is 16 in ATen, even though the output type can hold 10000.

[ghstack-poisoned]
Copy link

pytorch-bot bot commented May 28, 2025

🔗 Helpful Links

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

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

❌ 1 New Failure, 1 Unrelated Failure

As of commit 9573d9f with merge base 71025df (image):

NEW FAILURE - The following job has failed:

FLAKY - The following job failed but was likely due to flakiness present on trunk:

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

@kimishpatel
Copy link
Contributor

wait what? I dont get why is it 16?

[ghstack-poisoned]
@manuelcandales
Copy link
Contributor

wait what? I dont get why is it 16?

because 100 * 100 mod 256 = 16

this is how ATen works, because of functionalization
mul.out(x, y, out=out) must be equivalent to z = mul(x, y); out = z.to(out.dtype)
if x & y are int8, then z is also int8, and so multiplication turns into multiplication modulo 256
this is the downside of functionalization, it is sort of a compromise

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.

4 participants