Skip to content
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

[INTERPRETER] Use acc's dtype as computation dtype in tl.dot #3566

Merged
merged 2 commits into from
Apr 4, 2024

Conversation

tongyuantongyu
Copy link
Contributor

I found with TRITON_INTERPRET=1, tl.dot almost always gives wrong result for INT8 input, due to np.matmul use inputs' dtype as result dtype by default:

>>> a = np.array([[10, 20]], np.int8)
>>> np.matmul(a, a.transpose())
array([[-12]], dtype=int8)
>>> np.matmul(a, a.transpose(), dtype=np.int32)
array([[500]])

@tongyuantongyu tongyuantongyu requested a review from ptillet as a code owner April 4, 2024 15:23
@tongyuantongyu tongyuantongyu force-pushed the interpreter_dot_dtype branch from 2840cc7 to c8388f4 Compare April 4, 2024 15:25
@ThomasRaoux ThomasRaoux requested a review from Jokeren April 4, 2024 16:16
@jlebar
Copy link
Collaborator

jlebar commented Apr 4, 2024

Thank you! Probably we should add a test, or fix an existing one so it catches this bug?

@Jokeren
Copy link
Contributor

Jokeren commented Apr 4, 2024

Yes, please add a test case

@tongyuantongyu
Copy link
Contributor Author

Done. It seems related test cases were deliberately skipped due to this deficiency.

Copy link
Contributor

@Jokeren Jokeren left a comment

Choose a reason for hiding this comment

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

Thanks

@tongyuantongyu
Copy link
Contributor Author

@jlebar jlebar enabled auto-merge (squash) April 4, 2024 17:11
@Jokeren
Copy link
Contributor

Jokeren commented Apr 4, 2024

allowed_dot_input_precisions

It doesn't quite matter. allowed_dot_input_precisions is just a placeholder, not used

@Jokeren
Copy link
Contributor

Jokeren commented Apr 4, 2024

allowed_dot_input_precisions feel free to fix the typo in this PR directly. Maybe the name was changed.

@jlebar jlebar merged commit 84e1cb7 into triton-lang:main Apr 4, 2024
5 checks passed
@tongyuantongyu tongyuantongyu deleted the interpreter_dot_dtype branch April 6, 2024 08:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants