summaryrefslogtreecommitdiffstats
path: root/Whisper/ML/MlContext.cpp
diff options
context:
space:
mode:
authorKonstantin <const@const.me>2023-01-22 12:30:54 +0100
committerKonstantin <const@const.me>2023-01-22 12:30:54 +0100
commit8fa57f680f002f4f636da687e40e21225f1ee392 (patch)
tree15c9ad0828b1bb1d706fba9ab8192715ef30e7de /Whisper/ML/MlContext.cpp
parentcacec67bb649702db7a877de1b6482a46123f175 (diff)
GPU performance, optimized away a few shader dispatches
Diffstat (limited to 'Whisper/ML/MlContext.cpp')
-rw-r--r--Whisper/ML/MlContext.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/Whisper/ML/MlContext.cpp b/Whisper/ML/MlContext.cpp
index 5a29b85..6eeae09 100644
--- a/Whisper/ML/MlContext.cpp
+++ b/Whisper/ML/MlContext.cpp
@@ -734,6 +734,21 @@ Tensor MlContext::mulMatByRowTiledEx( const Tensor& a, const Tensor& b )
return res;
}
+void MlContext::addRepeatEx( Tensor& dest, const Tensor& pattern, const Tensor& finalAdd )
+{
+ if( !isSameShape( dest, finalAdd ) )
+ throw E_INVALIDARG;
+ assert( dest.getType() == eDataType::FP32 );
+
+ check( cb.update( dest, pattern, finalAdd ) );
+ bindShader( eComputeShader::addRepeatEx );
+ cb.bind();
+
+ Binder bind;
+ bind.bind( pattern, finalAdd, dest );
+ context()->Dispatch( dest.ne[ 1 ], dest.ne[ 2 ], dest.ne[ 3 ] );
+}
+
__m128i MlContext::getMemoryUse() const
{
__m128i v = cb.getMemoryUse();