ADLXPybind
This document describes how to build the Python bindings for ADLX, as well as the environment in which they can be executed.
Documentation to C/Cpp ADLX can be found in https://gpuopen.com/manuals/adlx/adlx-page_interfaces/
1. Building
Supported Operating Systems
- Windows® 11 (32- and 64-bit versions) and up.
Build Tool
- Visual Studio 2022 with C and C++ components for desktop.
Build Prerequisites
- ADLX SDK is installed.
- Python 3.12 is installed.
- pybind11 is installed.
The path to the Python 3.12 installation is set to the PYHOME system environment variable.
Note: The ADLX library is installed along with the AMD display driver.
Build Instructions
- Run Visual Studio 2022.
- Open ~ADLXPybind\ADLXPybind.sln.
- Rebuild the project.
2. Packing into wheel
Note: before packing bindings into wheel please copy compiled ADLX.pyd file to unit test folder: ~ADLXPybind\adlx_tests
and run the unit tests, be sure that all tests passed, infomation how to run unit tests can be found here: ~ADLXPybind\adlx_tests\_readme.txt
- copy ADLX.pyd file into:
~ADLXPybind\build_wheel\adlx - update bidnings verion in file:
~ADLXPybind\build_wheel\libversion.txt - run bat file:
~ADLXPybind\build_wheel\build_wheel.bat - wheel file will be generated in folder:
~ADLXPybind\build_wheel\build_wheel\dist
3. Usage example
- install wheel in your Python environment, example:
$pip install <path_to_wheel> - now you can import and use the bindings:
from typing import List
from adlx import ADLX
def check_tunning_services(system:ADLX.IADLXSystem):
"""Prints if gpu support autotingin
:param system: ADLX System Interface
:type system: ADLX.IADLXSystem
"""
tuning_services: ADLX.IADLXGPUTuningServices = system.GetGPUTuningServices()
gpus: List[ADLX.IADLXGPU] = system.GetGPUs()
for gpu in gpus:
is_supported_auto_tuning = tuning_services.IsSupportedAutoTuning(gpu)
asic_name = gpu.Name()
if is_supported_auto_tuning:
print(f"GPU Auto Tuning is supported on asic: {asic_name}")
else:
print(f"GPU Auto Tuning is NOT supported on asic: {asic_name}")
def main():
adlx: ADLX = ADLX.ADLXHelper()
ret: ADLX.ADLX_RESULT = adlx.Initialize()
assert ret == ADLX.ADLX_RESULT.ADLX_OK
system: ADLX.IADLXSystem = adlx.GetSystemServices()
check_tunning_services(system=system)
ret: ADLX.ADLX_RESULT = adlx.Terminate()
assert ret == ADLX.ADLX_RESULT.ADLX_OK
if __name__ == "__main__":
main()
Contribution process
- Expose the desired API (C++ bind.cpp)
- Write pytest tests for the added API ~ADLXPybind\adlxtest
- Build the
.pydbinary and store it in ~ADLXPybind\adlxtest - Run the new API test and if possible, run regression tests
- Create wheel package, don't forgate to increase version number
- Create a PR in this repo, showing the test case passed
- after PR is approved, deploy the .whl package in the ADLX
Release files for amd-adlx 1.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| amd_adlx-1.0.2-py313-none-win_amd64.whl | Python 3.13 | none | Windows x86-64 | Details |
| amd_adlx-1.0.2-py312-none-win_amd64.whl | Python 3.12 | none | Windows x86-64 | Details |
| amd_adlx-1.0.2-py311-none-win_amd64.whl | Python 3.11 | none | Windows x86-64 | Details |
| amd_adlx-1.0.2-py310-none-win_amd64.whl | Python 3.10 | none | Windows x86-64 | Details |
Total release size: 1.8 MB
Release files / amd_adlx-1.0.2-py313-none-win_amd64.whl
| Download URL | amd_adlx-1.0.2-py313-none-win_amd64.whl |
|---|---|
| Size | 463.6 kB |
| Tags | Python 3.13 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
e4d670ad1cabe4301074557b64ccac95b32c97653d0a9c6b6e0c11be4f0befba
|
|
BLAKE2b-256 checksum How to use checksums |
37fc87f100c050299d2877e81a65209ebf27a64ddbd527854ca0f97b2c332fd2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.10
|
Release files / amd_adlx-1.0.2-py312-none-win_amd64.whl
| Download URL | amd_adlx-1.0.2-py312-none-win_amd64.whl |
|---|---|
| Size | 463.5 kB |
| Tags | Python 3.12 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
5fc0e8bc3bcac26f8063f0c66b6b7cfbb64269af32a02f4b2cc70a4491dd5094
|
|
BLAKE2b-256 checksum How to use checksums |
8fa169c7f04a1b291bdf6251d205df2c41ddbc1c751cec500b708828ad7961b0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.10
|
Release files / amd_adlx-1.0.2-py311-none-win_amd64.whl
| Download URL | amd_adlx-1.0.2-py311-none-win_amd64.whl |
|---|---|
| Size | 456.9 kB |
| Tags | Python 3.11 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
05771800f309540913a9f2e89249be8891d34bcb2b5441cc52f80942cfced116
|
|
BLAKE2b-256 checksum How to use checksums |
aa449c23b6c7bb4d6087395feccd866ba0865616570568d40caaaa645e87b79a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.10
|
Release files / amd_adlx-1.0.2-py310-none-win_amd64.whl
| Download URL | amd_adlx-1.0.2-py310-none-win_amd64.whl |
|---|---|
| Size | 455.8 kB |
| Tags | Python 3.10 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
a6c3fcc8b75faf4dd25b5f884044d94c932dc9cea80519c73fb7dcd7f5539404
|
|
BLAKE2b-256 checksum How to use checksums |
d93e504093aa6aef92417d54e9c3b7fb02ef4459d49ed435123773b1d1a868bc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.10
|