diff options
| author | Konstantin <const@const.me> | 2023-01-22 12:30:54 +0100 |
|---|---|---|
| committer | Konstantin <const@const.me> | 2023-01-22 12:30:54 +0100 |
| commit | 8fa57f680f002f4f636da687e40e21225f1ee392 (patch) | |
| tree | 15c9ad0828b1bb1d706fba9ab8192715ef30e7de /Whisper/ML/MlContext.cpp | |
| parent | cacec67bb649702db7a877de1b6482a46123f175 (diff) | |
GPU performance, optimized away a few shader dispatches
Diffstat (limited to 'Whisper/ML/MlContext.cpp')
| -rw-r--r-- | Whisper/ML/MlContext.cpp | 15 |
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(); |
