Skip to content

Dot product bugfix to include more floating point types#1578

Merged
svenvh merged 3 commits intoKhronosGroup:mainfrom
Quetzonarch:integer-dot-product-bugfix
Aug 22, 2022
Merged

Dot product bugfix to include more floating point types#1578
svenvh merged 3 commits intoKhronosGroup:mainfrom
Quetzonarch:integer-dot-product-bugfix

Conversation

@Quetzonarch
Copy link
Contributor

This is a bugfix for my previous change ( #1174 ) regarding the integer dot product translation.

Slightly changed the check for Dot call in OCLToSPIRV to include more floating point types, as some were omitted by mistake.

Slightly changed the check for Dot call to include more floating point
types. Bugfix for previous change regarding integer dot product.
Copy link
Member

@svenvh svenvh left a comment

Choose a reason for hiding this comment

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

Slightly changed the check for Dot call in OCLToSPIRV to include more floating point types, as some were omitted by mistake.

I suppose you mean that any floating point type should be handled as before? It would be great if you could add a test case that was translated incorrectly after #1174 and is fixed with this change.

(CI.getOperand(0)->getType()->isFloatTy() ||
CI.getOperand(1)->getType()->isDoubleTy())) {
(!CI.getOperand(0)->getType()->isVectorTy() &&
!CI.getOperand(0)->getType()->isIntegerTy())) {
Copy link
Member

Choose a reason for hiding this comment

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

Wondering if just CI.getOperand(0)->getType()->isFPOrFPVectorTy() is sufficient?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

From what I understand this visitCallDot is meant to translate dot with scalar floating point arguments (but not vectors) into FMul. Because of that FPVectors shouldn't pass this check but instead stay as calls to dot.

Copy link
Contributor

Choose a reason for hiding this comment

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

isFloatingPointTy()?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, that might be a good idea

Added test case using the half dot to the bugfix.
@Quetzonarch
Copy link
Contributor Author

I've added a test case which uses the dot call with scalar half arguments. This should be translated into FMul but because of my previous change it would be translated into an integer dot (DotKHR). This is what I was mainly aiming to fix with this update.

Switched the visitCallDot check to use isFloatingPointTy for scalar
floating point operands.
@svenvh svenvh merged commit 71e01b5 into KhronosGroup:main Aug 22, 2022
Quetzonarch added a commit to Quetzonarch/SPIRV-LLVM-Translator that referenced this pull request Aug 22, 2022
…#1578)

Switched the visitCallDot check to use isFloatingPointTy for scalar
floating point operands. Bugfix for previous change regarding
integer dot product.
Quetzonarch added a commit to Quetzonarch/SPIRV-LLVM-Translator that referenced this pull request Aug 22, 2022
…#1578)

Switched the visitCallDot check to use isFloatingPointTy for scalar
floating point operands. Bugfix for previous change regarding
integer dot product.
Quetzonarch added a commit to Quetzonarch/SPIRV-LLVM-Translator that referenced this pull request Aug 22, 2022
…#1578)

Switched the visitCallDot check to use isFloatingPointTy for scalar
floating point operands. Bugfix for previous change regarding
integer dot product.
Quetzonarch added a commit to Quetzonarch/SPIRV-LLVM-Translator that referenced this pull request Aug 22, 2022
…#1578)

Switched the visitCallDot check to use isFloatingPointTy for scalar
floating point operands. Bugfix for previous change regarding
integer dot product.
svenvh pushed a commit that referenced this pull request Aug 23, 2022
Switched the visitCallDot check to use isFloatingPointTy for scalar
floating point operands. Bugfix for previous change regarding
integer dot product.
svenvh pushed a commit that referenced this pull request Aug 23, 2022
Switched the visitCallDot check to use isFloatingPointTy for scalar
floating point operands. Bugfix for previous change regarding
integer dot product.
svenvh pushed a commit that referenced this pull request Aug 23, 2022
Switched the visitCallDot check to use isFloatingPointTy for scalar
floating point operands. Bugfix for previous change regarding
integer dot product.
svenvh pushed a commit that referenced this pull request Aug 23, 2022
Switched the visitCallDot check to use isFloatingPointTy for scalar
floating point operands. Bugfix for previous change regarding
integer dot product.
svenvh pushed a commit to svenvh/SPIRV-LLVM-Translator that referenced this pull request Sep 2, 2022
…#1578)

Switched the visitCallDot check to use isFloatingPointTy for scalar
floating point operands. Bugfix for previous change regarding
integer dot product.

(cherry picked from commit 71e01b5)
MrSidims pushed a commit that referenced this pull request Sep 4, 2022
Switched the visitCallDot check to use isFloatingPointTy for scalar
floating point operands. Bugfix for previous change regarding
integer dot product.

(cherry picked from commit 71e01b5)

Co-authored-by: Jakub Czarnecki <jakub.czarnecki@intel.com>
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.

4 participants