diff options
| author | Darren Wihandi <65404740+fairywreath@users.noreply.github.com> | 2025-01-22 11:58:40 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-01-22 08:58:40 -0800 |
| commit | 18f12ad9c999f672ae7b61878e2242ebb3da94ac (patch) | |
| tree | 76ff4bac892d7055a05df772955d403764727cab /source | |
| parent | 14211ec3c4e56e59f479dbac23123ea61eab7d91 (diff) | |
Use SPIRV integer vector dot product instructions (#6141)
* Use SPIRV integer vector dot product instructions
* fix test
---------
Co-authored-by: Yong He <yonghe@outlook.com>
Diffstat (limited to 'source')
| -rw-r--r-- | source/slang/hlsl.meta.slang | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/source/slang/hlsl.meta.slang b/source/slang/hlsl.meta.slang index 371659fc9..97e2c7be5 100644 --- a/source/slang/hlsl.meta.slang +++ b/source/slang/hlsl.meta.slang @@ -8292,6 +8292,30 @@ T dot(vector<T, N> x, vector<T, N> y) { case hlsl: __intrinsic_asm "dot"; case wgsl: __intrinsic_asm "dot"; + case spirv: + { + spirv_asm + { + OpCapability DotProduct; + OpCapability DotProductInputAll; + OpExtension "SPV_KHR_integer_dot_product"; + }; + + if (__isSignedInt<T>()) + { + return spirv_asm + { + result:$$T = OpSDot $x $y; + }; + } + else + { + return spirv_asm + { + result:$$T = OpUDot $x $y; + }; + } + } default: T result = T(0); for(int i = 0; i < N; ++i) |
