Skip to main content

ML SDK VGF Library

Project description

ML SDK VGF Library

The VGF Library is a library that encodes and decodes VGF files. The VGF format covers the entire model use cases. These use cases can be a combination of SPIR-V™ module binary data, their constants, and compute shaders. The library provides a suite of APIs and tools for working with VGF files. The library includes the following:

  • C++ encoder API
  • C++ decoder API
  • C decoder API
  • VGF dumping tool: vgf_dump
  • VGF updating tool: vgf_updater

The encoder provides a simple, high-level API for building up VGF files. It is designed for easy integration into offline tooling.

The decoder is designed to be lightweight and to be included in high-performing programs, for example game engines. Therefore, the decoder does not allocate any dynamic memory on its own. To maintain full control, you must allocate the memory required and provide it to this library. To minimize copies and peak memory requirements, the format also supports mmap read operations on the contents.

VGF Library also provides a dumping tool which is called vgf_dump. vgf_dump prints the content of a VGF file into human-readable JSON format. You can also use vgf_dump to generate scenario file templates. You can use the scenario file templates with the Scenario Runner tool.

The VGF Updater rewrites an existing VGF file to the latest VGF format version supported by the VGF library. The new version of the VGF file is written to the provided output path.

To see the contents of a VGF file in a visual format, you can use the VGF Adapter for Model Explorer, which lets you view the inputs, outputs, constants and SPIR-V™ graphs.

Cloning the repository

To clone the ML SDK VGF Library 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 ML SDK VGF Library and its dependencies, run:

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

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

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

After the repo is initialized, fetch the contents with:

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 VGF Library in <repo_root>/sw/vgf-lib/. You can also find all the dependencies required by the ML SDK VGF Library in <repo_root>/dependencies/.

Building VGF Library from source

The build system must have:

  • CMake 3.22 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 make the build configuration options easily discoverable, we provide a python build script. When you run the script from a git-repo manifest checkout, the script uses default paths and does not require any additional arguments. If you do not use the script, you must specify paths to the dependencies.

To build on the current platform, for example on Linux or Windows®, run the following command:

python3 $SDK_PATH/sw/vgf-lib/scripts/build.py -j $(nproc)

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

python3 $SDK_PATH/sw/vgf-lib/scripts/build.py -j $(nproc) --target-platform aarch64

To enable and run tests, use the --test option. To lint the tests, use the --lint option. 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 option. 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 option, you must add the --package option. The archive is stored in the provided location.

For more command line options, see the help output:

python3 $SDK_PATH/sw/vgf-lib/scripts/build.py --help

PyPI

The ML SDK VGF Library is available on PyPI as the ai-ml-sdk-vgf-library package.

Install:

pip install ai-ml-sdk-vgf-library

License

The ML SDK VGF Library 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_vgf_library-0.9.0-py3-none-win_amd64.whl (583.7 kB view details)

Uploaded Python 3Windows x86-64

ai_ml_sdk_vgf_library-0.9.0-py3-none-macosx_11_0_arm64.whl (315.4 kB view details)

Uploaded Python 3macOS 11.0+ ARM64

File details

Details for the file ai_ml_sdk_vgf_library-0.9.0-py3-none-win_amd64.whl.

File metadata

File hashes

Hashes for ai_ml_sdk_vgf_library-0.9.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 bc4c518dd6641f41bf59f83aee61780a7d3c9621c6a6b2118a871b057b076688
MD5 71f48982b8a8331e3c1be66cc0aa77d1
BLAKE2b-256 2238cca33104688b390e2d8478a0e52ab986fe99b016515033e3d68a75554bba

See more details on using hashes here.

File details

Details for the file ai_ml_sdk_vgf_library-0.9.0-py3-none-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for ai_ml_sdk_vgf_library-0.9.0-py3-none-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0525c5ed7496362013e0e43688817b441fc673fbe5645db2a4130c9c763a79fe
MD5 76738e845859d4c3c18e2807f66659ee
BLAKE2b-256 e623d6e2b525b7813d364e3d83d0e3f91dfdf8ab43cb206f7cbb743ea9200b19

See more details on using hashes here.

File details

Details for the file ai_ml_sdk_vgf_library-0.9.0-py3-none-manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for ai_ml_sdk_vgf_library-0.9.0-py3-none-manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 51a456c9eaca219e8fa0128b335ff897a1f2c11a91e40f01918d8a89a9edeb6a
MD5 bc94dc5eabf5fdac787d972022842d59
BLAKE2b-256 abbdf9a106c2959cb14a9251267a4c1bcb0e03c2c1231706f47f6f107d67b4ab

See more details on using hashes here.

File details

Details for the file ai_ml_sdk_vgf_library-0.9.0-py3-none-manyLinux2014_x86_64.whl.

File metadata

File hashes

Hashes for ai_ml_sdk_vgf_library-0.9.0-py3-none-manyLinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2b2e555ab5cb808ed218dd6eaaa3cf6a25c8677fc66e2fd2f91ff882571611eb
MD5 f8b4d2004889951660c03e33b30efdf4
BLAKE2b-256 b57237843164a4c634ab9efb739bef82b5aeb64c4fca6967047b5967f6b7778b

See more details on using hashes here.

File details

Details for the file ai_ml_sdk_vgf_library-0.9.0-py3-none-manyLinux2014_aarch64.whl.

File metadata

File hashes

Hashes for ai_ml_sdk_vgf_library-0.9.0-py3-none-manyLinux2014_aarch64.whl
Algorithm Hash digest
SHA256 76adb47a8827618bb30d9caa2f6f18935bf2e184e28ab31387a74e0b5417ff09
MD5 e173a44f225ef72c7cec62e244b71d26
BLAKE2b-256 570a81af1bf80b245e64899c01504983a2cccb593aa5facf47ba4447bef5e379

See more details on using hashes here.

File details

Details for the file ai_ml_sdk_vgf_library-0.9.0-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for ai_ml_sdk_vgf_library-0.9.0-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 cf5380fbb4b918461d7bec124c20105042584720ffd3515287d99c6f4b886159
MD5 4a1071a395482bdc591e3daaf330cc21
BLAKE2b-256 8ec11ccecadbd49e4d27221377227f05e485941b7203fba153ae9c56be067331

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