-
Notifications
You must be signed in to change notification settings - Fork 718
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
Dot products on unsigned integer vectors do not use umad #7058
Comments
pow2clk
added a commit
to pow2clk/DirectXShaderCompiler
that referenced
this issue
Jan 13, 2025
Dot products on uint vectors were not using the unsigned mad operations when they were formed using the dot intrinsic though they did when it was the effect of the mul intrinsic. While such operations aren't very common and less common still are the cases where the unsigned variant makes a difference, this was an internal inconsistency as well as with the clang implementation. This corrects the problem using a dummy op for udot similar to how other intrinsics address similar problems to pass the unsigned information to operation lowering. Incidentally adds unsigned notations to all the mul intrinsic entries. This is a non-functional change as any one overload that specifies an unsigned variant will apply for all of them, but it is less confusing than having half of them do it and the other half not. The test verifies the output of a few dot operations with sint, float, and uint types for both dot and mul intrinsics Fixes microsoft#7058
pow2clk
added a commit
to pow2clk/DirectXShaderCompiler
that referenced
this issue
Jan 21, 2025
Dot products on uint vectors were not using the unsigned mad operations when they were formed using the dot intrinsic though they did when it was the effect of the mul intrinsic. While such operations aren't very common and less common still are the cases where the unsigned variant makes a difference, this was an internal inconsistency as well as with the clang implementation. This corrects the problem using a dummy op for udot similar to how other intrinsics address similar problems to pass the unsigned information to operation lowering. Incidentally adds unsigned notations to all the mul intrinsic entries. This is a non-functional change as any one overload that specifies an unsigned variant will apply for all of them, but it is less confusing than having half of them do it and the other half not. The test verifies the output of a few dot operations with sint, float, and uint types for both dot and mul intrinsics Fixes microsoft#7058
pow2clk
added a commit
to pow2clk/DirectXShaderCompiler
that referenced
this issue
Jan 22, 2025
Dot products on uint vectors were not using the unsigned mad operations when they were formed using the dot intrinsic though they did when it was the effect of the mul intrinsic. While such operations aren't very common and less common still are the cases where the unsigned variant makes a difference, this was an internal inconsistency as well as with the clang implementation. This corrects the problem using a dummy op for udot similar to how other intrinsics address similar problems to pass the unsigned information to operation lowering. Incidentally adds unsigned notations to all the mul intrinsic entries. This is a non-functional change as any one overload that specifies an unsigned variant will apply for all of them, but it is less confusing than having half of them do it and the other half not. The test verifies the output of a few dot operations with sint, float, and uint types for both dot and mul intrinsics Fixes microsoft#7058
pow2clk
added a commit
that referenced
this issue
Jan 27, 2025
Dot products on uint vectors were not using the unsigned mad operations when they were formed using the dot intrinsic though they did when it was the effect of the mul intrinsic. While such operations aren't very common and less common still are the cases where the unsigned variant makes a difference, this was an internal inconsistency as well as with the clang implementation. This corrects the problem using a dummy op for udot similar to how other intrinsics address similar problems to pass the unsigned information to operation lowering. Incidentally adds unsigned notations to all the mul intrinsic entries. This is a non-functional change as any one overload that specifies an unsigned variant will apply for all of them, but it is less confusing than having half of them do it and the other half not. The test verifies the output of a few dot operations with sint, float, and uint types for both dot and mul intrinsics Fixes #7058
pow2clk
added a commit
to pow2clk/DirectXShaderCompiler
that referenced
this issue
Jan 27, 2025
Dot products on uint vectors were not using the unsigned mad operations when they were formed using the dot intrinsic though they did when it was the effect of the mul intrinsic. While such operations aren't very common and less common still are the cases where the unsigned variant makes a difference, this was an internal inconsistency as well as with the clang implementation. This corrects the problem using a dummy op for udot similar to how other intrinsics address similar problems to pass the unsigned information to operation lowering. Incidentally adds unsigned notations to all the mul intrinsic entries. This is a non-functional change as any one overload that specifies an unsigned variant will apply for all of them, but it is less confusing than having half of them do it and the other half not. The test verifies the output of a few dot operations with sint, float, and uint types for both dot and mul intrinsics Fixes microsoft#7058 (cherry picked from commit 1fdebc4)
pow2clk
added a commit
that referenced
this issue
Jan 28, 2025
Cherry-pick of #7059 to release-1.8.2502 Dot products on uint vectors were not using the unsigned mad operations when they were formed using the dot intrinsic though they did when it was the effect of the mul intrinsic. While such operations aren't very common and less common still are the cases where the unsigned variant makes a difference, this was an internal inconsistency as well as with the clang implementation. This corrects the problem using a dummy op for udot similar to how other intrinsics address similar problems to pass the unsigned information to operation lowering. Incidentally adds unsigned notations to all the mul intrinsic entries. This is a non-functional change as any one overload that specifies an unsigned variant will apply for all of them, but it is less confusing than having half of them do it and the other half not. The test verifies the output of a few dot operations with sint, float, and uint types for both dot and mul intrinsics Fixes #7058 (cherry picked from commit 1fdebc4)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
When using the
dot
intrinsic to calculate a dot product, the generated code will use a signed mad operator instead of the umad operator that themul
intrinsic uses when it amounts to a dot product.Steps to Reproduce
Just pass unsigned integer vectors of 2 or more elements to the
dot
intrinsic.Switching the defined FUNC between
dot
andmul
in this godbolt link will show the difference in output: https://godbolt.org/z/Pz6a5a38rActual Behavior
You can see that it will change between calling IMad with opcode 48 and UMad with opcode 49.
Environment
The text was updated successfully, but these errors were encountered: