From 1922f87c2f753d8f6630050a7ce8292994c27356 Mon Sep 17 00:00:00 2001 From: Aparna M P Date: Wed, 25 Mar 2026 22:13:12 +0530 Subject: [PATCH] snapdragon: add missing features to WoS scripts to achieve parity with ADB scripts (#20884) * Add missing features to WoS scripts to achieve parity with ADB scripts * Fix line-ending in run-mtmd.ps1 Signed-off-by: Max Krasnyansky --------- Signed-off-by: Max Krasnyansky Co-authored-by: Max Krasnyansky --- scripts/snapdragon/windows/run-bench.ps1 | 12 +++ scripts/snapdragon/windows/run-cli.ps1 | 6 +- scripts/snapdragon/windows/run-completion.ps1 | 6 +- scripts/snapdragon/windows/run-mtmd.ps1 | 74 +++++++++++++++++++ scripts/snapdragon/windows/run-tool.ps1 | 4 + 5 files changed, 100 insertions(+), 2 deletions(-) create mode 100644 scripts/snapdragon/windows/run-mtmd.ps1 diff --git a/scripts/snapdragon/windows/run-bench.ps1 b/scripts/snapdragon/windows/run-bench.ps1 index 21fd063ebe..1957028d1d 100644 --- a/scripts/snapdragon/windows/run-bench.ps1 +++ b/scripts/snapdragon/windows/run-bench.ps1 @@ -20,6 +20,14 @@ if ($null -ne $env:V) { $env:GGML_HEXAGON_VERBOSE=$env:V } +if ($null -ne $env:E) { + $env:GGML_HEXAGON_EXPERIMENTAL=$env:E +} + +if ($null -ne $env:PROF) { + $env:GGML_HEXAGON_PROFILE=$env:PROF; $env:GGML_HEXAGON_OPSYNC=1 +} + if ($null -ne $env:OPMASK) { $env:GGML_HEXAGON_OPMASK=$env:OPMASK } @@ -32,6 +40,10 @@ if ($null -ne $env:NDEV) { $env:GGML_HEXAGON_NDEV=$env:NDEV } +if ($null -ne $env:HB) { + $env:GGML_HEXAGON_HOSTBUF=$env:HB +} + $env:ADSP_LIBRARY_PATH="$basedir\lib" & "$basedir\bin\llama-bench.exe" ` diff --git a/scripts/snapdragon/windows/run-cli.ps1 b/scripts/snapdragon/windows/run-cli.ps1 index 5891c894a9..668c525f5a 100644 --- a/scripts/snapdragon/windows/run-cli.ps1 +++ b/scripts/snapdragon/windows/run-cli.ps1 @@ -44,10 +44,14 @@ if ($null -ne $env:NDEV) { $env:GGML_HEXAGON_NDEV=$env:NDEV } +if ($null -ne $env:HB) { + $env:GGML_HEXAGON_HOSTBUF=$env:HB +} + $env:ADSP_LIBRARY_PATH="$basedir\lib" & "$basedir\bin\llama-cli.exe" ` --no-mmap -m $basedir\..\..\gguf\$model ` --poll 1000 -t 6 --cpu-mask 0xfc --cpu-strict 1 ` - --ctx-size 8192 --ubatch-size 128 -fa on ` + --ctx-size 8192 --ubatch-size 256 -fa on ` -ngl 99 --device $device $cli_opts diff --git a/scripts/snapdragon/windows/run-completion.ps1 b/scripts/snapdragon/windows/run-completion.ps1 index 8a48d2d748..1221330f26 100644 --- a/scripts/snapdragon/windows/run-completion.ps1 +++ b/scripts/snapdragon/windows/run-completion.ps1 @@ -44,10 +44,14 @@ if ($null -ne $env:NDEV) { $env:GGML_HEXAGON_NDEV=$env:NDEV } +if ($null -ne $env:HB) { + $env:GGML_HEXAGON_HOSTBUF=$env:HB +} + $env:ADSP_LIBRARY_PATH="$basedir\lib" & "$basedir\bin\llama-completion.exe" ` --no-mmap -m $basedir\..\..\gguf\$model ` --poll 1000 -t 6 --cpu-mask 0xfc --cpu-strict 1 ` - --ctx-size 8192 --batch-size 128 -fa on ` + --ctx-size 8192 --batch-size 256 -fa on ` -ngl 99 -no-cnv --device $device $cli_opts diff --git a/scripts/snapdragon/windows/run-mtmd.ps1 b/scripts/snapdragon/windows/run-mtmd.ps1 new file mode 100644 index 0000000000..f47d942f5e --- /dev/null +++ b/scripts/snapdragon/windows/run-mtmd.ps1 @@ -0,0 +1,74 @@ +#!/usr/bin/env pwsh + +# Basedir on device +$basedir=".\pkg-snapdragon" + +$cli_opts=$args + +$model="gemma-3-4b-it-Q4_0.gguf" +if ($null -ne $env:M) { + $model=$env:M +} + +$mmproj="mmproj-F16.gguf" +if ($null -ne $env:MMPROJ) { + $mmproj=$env:MMPROJ +} + +$image="" +if ($null -ne $env:IMG) { + $image=$env:IMG +} + +$device="HTP0" +if ($null -ne $env:D) { + $device=$env:D +} + +if ($null -ne $env:V) { + $env:GGML_HEXAGON_VERBOSE=$env:V +} + +# Default experimental to 1 +$env:GGML_HEXAGON_EXPERIMENTAL=1 +if ($null -ne $env:E) { + $env:GGML_HEXAGON_EXPERIMENTAL=$env:E +} + +if ($null -ne $env:SCHED) { + $env:GGML_SCHED_DEBUG=$env:SCHED; $cli_opts="$cli_opts -v" +} + +if ($null -ne $env:PROF) { + $env:GGML_HEXAGON_PROFILE=$env:PROF; $env:GGML_HEXAGON_OPSYNC=1 +} + +if ($null -ne $env:OPMASK) { + $env:GGML_HEXAGON_OPMASK=$env:OPMASK +} + +if ($null -ne $env:NHVX) { + $env:GGML_HEXAGON_NHVX=$env:NHVX +} + +if ($null -ne $env:NDEV) { + $env:GGML_HEXAGON_NDEV=$env:NDEV +} + +if ($null -ne $env:HB) { + $env:GGML_HEXAGON_HOSTBUF=$env:HB +} + +if ($null -ne $env:MTMD_DEVICE) { + $env:MTMD_BACKEND_DEVICE=$env:MTMD_DEVICE +} + +$env:ADSP_LIBRARY_PATH="$basedir\lib" + +& "$basedir\bin\llama-mtmd-cli.exe" ` + --no-mmap -m $basedir\..\..\gguf\$model ` + --mmproj $basedir\..\..\gguf\$mmproj ` + --image $basedir\..\..\gguf\$image ` + --poll 1000 -t 6 --cpu-mask 0xfc --cpu-strict 1 ` + --ctx-size 8192 --ubatch-size 256 -fa on ` + -ngl 99 --device $device -v $cli_opts diff --git a/scripts/snapdragon/windows/run-tool.ps1 b/scripts/snapdragon/windows/run-tool.ps1 index 70094af9bc..78ccd5b21c 100644 --- a/scripts/snapdragon/windows/run-tool.ps1 +++ b/scripts/snapdragon/windows/run-tool.ps1 @@ -50,6 +50,10 @@ if ($null -ne $env:NDEV) { $env:GGML_HEXAGON_NDEV=$env:NDEV } +if ($null -ne $env:HB) { + $env:GGML_HEXAGON_HOSTBUF=$env:HB +} + $env:ADSP_LIBRARY_PATH="$basedir\lib" & "$basedir\bin\$tool" `