[clang] [llvm] [HLSL][SPIRV][DXIL] Implement `dot4add_i8packed` intrinsic (PR #113623)

Steven Perron via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 29 08:33:21 PDT 2024


================
@@ -1694,6 +1698,84 @@ bool SPIRVInstructionSelector::selectIntegerDot(Register ResVReg,
   return Result;
 }
 
+// Since pre-1.6 SPIRV has no DotProductInput4x8BitPacked implementation,
+// extract the elements of the packed inputs, multiply them and add the result
+// to the accumulator.
----------------
s-perron wrote:

This is less efficient code. We should look to see if the instruction is available by checking if the you are targeting spirv1.6 or higher, or the [SPV_KHR_integer_dot_product](https://htmlpreview.github.io/?https://github.com/KhronosGroup/SPIRV-Registry/blob/main/extensions/KHR/SPV_KHR_integer_dot_product.html) extension is enabled. You can get this information from the `SPIRVSubTarget`. I believe it is a member of `SPIRVInstructionSelector` and it is called `STI`.

`STI->canUseExtension(...)`
`STI->isAtLeastSPIRVVer(...)`

https://github.com/llvm/llvm-project/pull/113623


More information about the cfe-commits mailing list