Skip to main content

ML SDK Scenario Runner

Project description

ML SDK Scenario Runner

The Scenario Runner is an application that executes shader and neural network graph workloads through Vulkan® or the ML extensions for Vulkan®. The Scenario Runner acts as a validation and performance exploration vehicle. The Scenario Runner also acts as a mechanism to define test-cases called scenarios in a declarative way via a JSON description. The Scenario Runner can parse the JSON, load the input stimulus that is described in the JSON, execute the scenario and produce output artifacts.

Cloning the repository

To clone the ML SDK Scenario Runner as a stand-alone repository, you can use regular git clone commands. However, for better management of dependencies and to ensure everything is placed in the appropriate directories, we recommend using the git-repo tool to clone the repository as part of the ML SDK for Vulkan® suite. Repo tool.

For a minimal build and to initialize only the Scenario Runner and its dependencies, run:

repo init -u https://github.com/arm/ai-ml-sdk-manifest -g scenario-runner

Alternatively, to initialize the repo structure for the entire ML SDK for Vulkan®, including the Scenario Runner, run:

repo init -u https://github.com/arm/ai-ml-sdk-manifest -g all

Once the repo is initialized, you can fetch the contents:

repo sync --no-clone-bundle

Cloning on Windows®

To ensure nested submodules do not exceed the maximum long path length, you must enable long paths on Windows®, and you must clone close to the root directory or use a symlink. Make sure to use Git for Windows.

Using PowerShell:

Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" -Name "LongPathsEnabled" -Value 1
git config --global core.longpaths true
git --version # Ensure you are using Git for Windows, for example 2.50.1.windows.1
git clone <git-repo-tool-url>
python <path-to-git-repo>\git-repo\repo init -u <manifest-url> -g all
python <path-to-git-repo>\git-repo\repo sync --no-clone-bundle

Using Git Bash:

cmd.exe "/c reg.exe add \"HKLM\System\CurrentControlSet\Control\FileSystem"" /v LongPathsEnabled /t REG_DWORD /d 1 /f"
git config --global core.longpaths true
git --version # Ensure you are using the Git for Windows, for example 2.50.1.windows.1
git clone <git-repo-tool-url>
python <path-to-git-repo>/git-repo/repo init -u <manifest-url> -g all
python <path-to-git-repo>/git-repo/repo sync --no-clone-bundle

After the sync command completes successfully, you can find the ML SDK Scenario Runner in <repo_root>/sw/scenario-runner/. You can also find all the dependencies required by the ML SDK Scenario Runner in <repo_root>/dependencies/.

Building Scenario Runner from source

The build system must have:

  • CMake 3.25 or later.
  • C/C++ 17 compiler: GCC, or optionally Clang on Linux and MSVC on Windows®.
  • Python 3.10 or later. Required python libraries for building are listed in tooling-requirements.txt.
  • Ninja 1.10 or later.

The following dependencies are also needed:

For the preferred dependency versions see the manifest file.

Building with the script

To build on Linux, run the following command:

SDK_PATH="path/to/sdk"
python3 ${SDK_PATH}/sw/scenario-runner/scripts/build.py -j $(nproc) \
    --flatbuffers-path ${SDK_PATH}/dependencies/flatbuffers \
    --argparse-path ${SDK_PATH}/dependencies/argparse \
    --json-path ${SDK_PATH}/dependencies/json \
    --vulkan-headers-path ${SDK_PATH}/dependencies/Vulkan-Headers \
    --glslang-path ${SDK_PATH}/dependencies/glslang \
    --dxc-path ${SDK_PATH}/dependencies/DirectXShaderCompiler \
    --spirv-headers-path ${SDK_PATH}/dependencies/SPIRV-Headers \
    --spirv-tools-path ${SDK_PATH}/dependencies/SPIRV-Tools \
    --vgf-lib-path ${SDK_PATH}/sw/vgf-lib \
    --gtest-path ${SDK_PATH}/dependencies/googletest

To build on Windows®, run the following command:

$env:SDK_PATH="path\to\sdk"
$cores = [System.Environment]::ProcessorCount
python "$env:SDK_PATH\sw\scenario-runner\scripts\build.py" -j $cores  `
    --flatbuffers-path "$env:SDK_PATH\dependencies\flatbuffers" `
    --argparse-path "$env:SDK_PATH\dependencies\argparse" `
    --json-path "$env:SDK_PATH\dependencies\json" `
    --vulkan-headers-path "$env:SDK_PATH\dependencies\Vulkan-Headers" `
    --glslang-path "$env:SDK_PATH\dependencies\glslang" `
    --dxc-path "$env:SDK_PATH\dependencies\DirectXShaderCompiler" `
    --spirv-headers-path "$env:SDK_PATH\dependencies\SPIRV-Headers" `
    --spirv-tools-path "$env:SDK_PATH\dependencies\SPIRV-Tools" `
    --vgf-lib-path "$env:SDK_PATH\sw\vgf-lib" `
    --gtest-path "$env:SDK_PATH\dependencies\googletest"

To cross compile for AArch64 architecture, you can add the following option:

SDK_PATH="path/to/sdk"
python3 $SDK_PATH/sw/scenario-runner/scripts/build.py -j $(nproc) \
    --flatbuffers-path ${SDK_PATH}/dependencies/flatbuffers \
    --argparse-path ${SDK_PATH}/dependencies/argparse \
    --json-path ${SDK_PATH}/dependencies/json \
    --vulkan-headers-path ${SDK_PATH}/dependencies/Vulkan-Headers \
    --glslang-path ${SDK_PATH}/dependencies/glslang \
    --dxc-path ${SDK_PATH}/dependencies/DirectXShaderCompiler \
    --spirv-headers-path ${SDK_PATH}/dependencies/SPIRV-Headers \
    --spirv-tools-path ${SDK_PATH}/dependencies/SPIRV-Tools \
    --vgf-lib-path ${SDK_PATH}/sw/vgf-lib \
    --gtest-path ${SDK_PATH}/dependencies/googletest \
    --target-platform aarch64

(Experimental) To cross compile for Android™, and build an APK package, you must target Android™, provide the Android™ CMake toolchain, and request the apk package type.

SDK_PATH="path/to/sdk"
ANDROID_NDK_HOME="path/to/android-ndk"
python3 ${SDK_PATH}/sw/scenario-runner/scripts/build.py -j $(nproc) \
    --target-platform android \
    --cmake-toolchain-for-android ${ANDROID_NDK_HOME}/build/cmake/android.toolchain.cmake \
    --flatbuffers-path ${SDK_PATH}/dependencies/flatbuffers \
    --argparse-path ${SDK_PATH}/dependencies/argparse \
    --json-path ${SDK_PATH}/dependencies/json \
    --vulkan-headers-path ${SDK_PATH}/dependencies/Vulkan-Headers \
    --glslang-path ${SDK_PATH}/dependencies/glslang \
    --dxc-path ${SDK_PATH}/dependencies/DirectXShaderCompiler \
    --spirv-headers-path ${SDK_PATH}/dependencies/SPIRV-Headers \
    --spirv-tools-path ${SDK_PATH}/dependencies/SPIRV-Tools \
    --vgf-lib-path ${SDK_PATH}/sw/vgf-lib \
    --package-type apk

The APK build uses the gradle command, so Gradle 8.4 or later must be available on your PATH. The Android™ SDK installation pointed to by ANDROID_HOME should include build-tools;34.0.0 and platforms;android-34, or other compatible versions.

To build with RenderDoc support, add --enable-rdoc. If RenderDoc is installed outside the default search locations, also pass --renderdoc-path <renderdoc-install-root>.

To enable and run tests, use the --test flag. To lint the tests, use the --lint flag. To enable tests and documentation building python dependencies must be installed:

pip install -r requirements.txt
pip install -r tooling-requirements.txt

To build the documentation, use the --doc flag. To build the documentation, you must have sphinx and doxygen installed on your machine.

You can install the build artifacts for this project into a specified location. To install the build artifacts, pass the --install option with the required path.

To create an archive with the build artifacts, you must add --package-type. The archive is stored in the provided location.

For more command line options, consult the program help:

python3 $SDK_PATH/sw/scenario-runner/scripts/build.py --help

Usage

To run a scenario file, use the following command:

./scenario-runner --scenario ${SCENARIO_JSON_FILE}

Where:

  • --scenario: File to load the scenario from. The file must be in JSON format. If the resources in the SCENARIO_JSON_FILE are not specified with absolute paths, their relative paths will be resolved against the parent directory of the SCENARIO_JSON_FILE.

For more details, see the help output:

./scenario-runner --help

For the Android APK package, install the generated APK and start the foreground service with adb:

adb install -r build/scenario-runner-debug.apk

adb shell am start-foreground-service \
    -n com.arm.ai_ml_sdk_scenario_runner/.Main \
    --esa args --scenario,/data/user/0/com.arm.ai_ml_sdk_scenario_runner/scenario.json

PyPI

The ML SDK Scenario Runner is available on PyPI as the ai-ml-sdk-scenario-runner package.

Install:

pip install ai-ml-sdk-scenario-runner

Known Limitations

  • Resources created with Optimal tiling cannot be used with memory aliasing.
  • HLSL lacks support for VK_ARM_tensor at the moment, so tensor resources cannot be used with HLSL shaders.

License

The ML SDK Scenario Runner is distributed under the software licenses in LICENSES directory.

Trademark notice

Arm® is a registered trademarks of Arm Limited (or its subsidiaries) in the US and/or elsewhere.

Khronos®, Vulkan® and SPIR-V™ are registered trademarks of the Khronos® Group.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

ai_ml_sdk_scenario_runner-0.10.0-py3-none-win_amd64.whl (5.1 MB view details)

Uploaded Python 3Windows x86-64

ai_ml_sdk_scenario_runner-0.10.0-py3-none-macosx_11_0_arm64.whl (9.0 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

File details

Details for the file ai_ml_sdk_scenario_runner-0.10.0-py3-none-win_amd64.whl.

File metadata

File hashes

Hashes for ai_ml_sdk_scenario_runner-0.10.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 433ef645fbde38d77b955002bb4f34d2ea03652260a3e45b0d7003f2898976fe
MD5 5e409353d7071c947896667fba84f98d
BLAKE2b-256 10d4391068e679233be55d2e9d7cbd0ee6830d4a145266e54150831e819d5a45

See more details on using hashes here.

File details

Details for the file ai_ml_sdk_scenario_runner-0.10.0-py3-none-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for ai_ml_sdk_scenario_runner-0.10.0-py3-none-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 06ce536e0e032e6f0d68c1c70164e02b6248723b436acbdaabb60ca72124dd66
MD5 ea161e6ece0cc40ddeb7cac651dff62c
BLAKE2b-256 65e27b9956f059538a34b1b8ac848ac214042ea8561ec8fead731567dd26401b

See more details on using hashes here.

File details

Details for the file ai_ml_sdk_scenario_runner-0.10.0-py3-none-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for ai_ml_sdk_scenario_runner-0.10.0-py3-none-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 fbebe5c3b4c4a03f02b1b9f4cd2ac32ac94a7fd4bef7fd92ac41d8d180f4668b
MD5 ab7f060e7c1bab35e7357a815599b982
BLAKE2b-256 5d6e2beb6989c3262e31a34362252eb02e9a4c95136ba957ea1c7d582540ef97

See more details on using hashes here.

File details

Details for the file ai_ml_sdk_scenario_runner-0.10.0-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for ai_ml_sdk_scenario_runner-0.10.0-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 abd1a96838d368b2b4bd773536d7a3e729fb026f34a24d2bba66180a9fb12148
MD5 28f3f587cfa2b2a8e4d7aaabf82f3931
BLAKE2b-256 a7bbfd1ce6cf5ed2212cbe090c0a8f1bdbddcb8dac1f8cbbba06cd4589a4175b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page