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

Merged
merged 122 commits into from
Jun 9, 2025
Merged

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.

swolchok added 30 commits March 18, 2025 17:32
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
@swolchok swolchok temporarily deployed to upload-benchmark-results May 29, 2025 00:47 — with GitHub Actions Inactive
@swolchok swolchok temporarily deployed to upload-benchmark-results May 29, 2025 00:48 — with GitHub Actions Inactive
@swolchok swolchok temporarily deployed to upload-benchmark-results May 29, 2025 02:33 — with GitHub Actions Inactive
@swolchok swolchok temporarily deployed to upload-benchmark-results May 29, 2025 02:36 — with GitHub Actions Inactive
@kimishpatel
Copy link
Contributor

wait what? I dont get why is it 16?

swolchok added 6 commits May 29, 2025 12:23
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[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

swolchok added 6 commits June 9, 2025 12:04
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
Base automatically changed from gh/swolchok/395/head to main June 9, 2025 20:23
@swolchok swolchok merged commit 3a4ec6e into main Jun 9, 2025
97 of 186 checks passed
@swolchok swolchok deleted the gh/swolchok/440/head branch June 9, 2025 20:27
JacobSzwejbka added a commit that referenced this pull request Jun 10, 2025
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