Skip to content

Fix the return types of dot4add_i8packed and dot4add_u8packed. #5

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

Conversation

jimblandy
Copy link
Collaborator

Change the definition of the HLSL dot4add_i8packed and dot4add_u8packed intrinsics in utils/hct/gen_intrin_main.txt to simply spell out the return types, rather than saying that their return type is determined by their third argument.

This prevents DXC from trying to give those functions declarations like

declare i64 @"\01?dot4add_u8packed@hlsl@@YA_JII_J@Z"(i32, i32, i64 signext) #1

which seems to expect a 64-bit third argument and return value.

These functions are not generic, and they have only one overload, so there is no need to use interesting uComponentTypeId values to get the right effects, and HLSLExternalSource::MatchArguments seems to get confused about how to treat argument types that affect the return types.

@jimblandy jimblandy force-pushed the fx-dot4add-packed-return-type branch from 5644b96 to 5f04faf Compare May 2, 2025 02:58
Change the definition of the HLSL `dot4add_i8packed`,
`dot4add_u8packed`, and `dot2add` intrinsics in
`utils/hct/gen_intrin_main.txt` to simply spell out the return types,
rather than saying that their return type is determined by their third
argument.

This prevents DXC from trying to give those functions declarations like

    declare i64 @"\01?dot4add_u8packed@hlsl@@YA_JII_J@Z"(i32, i32, i64 signext) microsoft#1

which seems to expect a 64-bit third argument and return value.

`HLSLExternalSource::MatchArguments` assumes that functions whose
return type depends on their arguments' types will get cleaned up by
`TryEvalInstrinsic`. Unfortunately, the `dot4add` variants cannot be
constant expressions, so this cleanup does not happen for them. But
these functions are not generic, and they have only one overload, so
there is no need to use interesting `uComponentTypeId` values to get
the right effects in the first place.

Fixes microsoft#7400.
@jimblandy jimblandy force-pushed the fx-dot4add-packed-return-type branch from 5f04faf to f895647 Compare May 8, 2025 15:59
@jimblandy
Copy link
Collaborator Author

This has been approved here and merged upstream, so I'm going to merge it here, too.

@jimblandy jimblandy merged commit 09a8c3b into FirefoxGraphics:moz-1.8.2502 May 13, 2025
@jimblandy jimblandy deleted the fx-dot4add-packed-return-type branch May 13, 2025 19:19
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.

2 participants