{"id":18711157,"url":"https://github.com/rocm/amdmigraphx","last_synced_at":"2026-01-21T22:11:20.010Z","repository":{"id":37249129,"uuid":"130718031","full_name":"ROCm/AMDMIGraphX","owner":"ROCm","description":"AMD's graph optimization engine.","archived":false,"fork":false,"pushed_at":"2025-05-15T22:05:30.000Z","size":163232,"stargazers_count":217,"open_issues_count":394,"forks_count":99,"subscribers_count":36,"default_branch":"develop","last_synced_at":"2025-05-15T23:07:45.421Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://rocm.docs.amd.com/projects/AMDMIGraphX/en/latest/","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ROCm.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2018-04-23T15:29:10.000Z","updated_at":"2025-05-14T19:40:08.000Z","dependencies_parsed_at":"2023-10-16T11:24:29.188Z","dependency_job_id":"43002e3f-ac44-4667-a083-757548811aea","html_url":"https://github.com/ROCm/AMDMIGraphX","commit_stats":{"total_commits":4681,"total_committers":89,"mean_commits":52.59550561797753,"dds":0.6154667806024354,"last_synced_commit":"952a257e3d7d16a1de611b98d9fc6487b819957a"},"previous_names":["rocm/amdmigraphx","rocmsoftwareplatform/amdmigraphx"],"tags_count":64,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ROCm%2FAMDMIGraphX","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ROCm%2FAMDMIGraphX/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ROCm%2FAMDMIGraphX/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ROCm%2FAMDMIGraphX/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ROCm","download_url":"https://codeload.github.com/ROCm/AMDMIGraphX/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254436949,"owners_count":22070947,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-07T12:37:25.292Z","updated_at":"2026-01-21T22:11:20.004Z","avatar_url":"https://github.com/ROCm.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AMD MIGraphX\n\nAMD MIGraphX is AMD's graph inference engine, which accelerates machine learning model inference.\n\n\u003e[!NOTE]\n\u003eThe published documentation is available at [MIGraphX](https://rocm.docs.amd.com/projects/AMDMIGraphX/en/latest/) in an organized, easy-to-read format, with search and a table of contents. The documentation source files reside in the `docs` folder of this repository. As with all ROCm projects, the documentation is open source. For more information on contributing to the documentation, see [Contribute to ROCm documentation](https://rocm.docs.amd.com/en/latest/contribute/contributing.html).\n\n\u003e [!NOTE]\n\u003e You must [install ROCm](https://rocm.docs.amd.com/projects/install-on-linux/en/latest/index.html) before\n\u003e installing MIGraphX.\n\n## Installing from binaries\n\nInstall binaries using:\n\n```bash\nsudo apt update \u0026\u0026 sudo apt install -y migraphx\n```\n\nHeader files and libraries are installed under ``/opt/rocm-\u003cversion\u003e``, where ``\u003cversion\u003e`` is the ROCm\nversion.\n\n## Building from source\n\nYou have three options for building from source:\n\n* [ROCm build tool](#compile-using-the-rocm-build-tool-rbuild): Uses\n  [rbuild](https://github.com/RadeonOpenCompute/rbuild) to install prerequisites, then you can build\n  the libraries with a single command.\n\n* [CMake](#use-cmake-to-build-migraphx): Uses a script to install prerequisites, then you can use\n  CMake to build the source.\n\n* [Docker](#use-docker): Builds a Docker image with all prerequisites installed, then you can build the\n  MIGraphX sources inside a Docker container.\n\n### Build prerequisites\n\nThe following is a list of prerequisites for building MIGraphX.\n\n* [ROCm CMake modules](https://github.com/RadeonOpenCompute/rocm-cmake) **required**\n* [MIOpen](https://github.com/ROCmSoftwarePlatform/MIOpen) for running on the GPU\n* [rocBLAS](https://github.com/ROCmSoftwarePlatform/rocBLAS) for running on the GPU\n* [HIP](https://github.com/ROCm-Developer-Tools/HIP) for running on the GPU\n* [Protobuf](https://github.com/google/protobuf) for reading [onnx](https://github.com/onnx/onnx)\n  files\n* [Half](http://half.sourceforge.net/), an IEEE 754-based half-precision floating point library\n* [pybind11](https://pybind11.readthedocs.io/en/stable/) for python bindings\n* [JSON](https://github.com/nlohmann/json) for model serialization to json string format\n* [MessagePack](https://msgpack.org/index.html) for model serialization to binary format\n* [SQLite3](https://www.sqlite.org/index.html) to create database of kernels' tuning information or run queries on existing database\n\n### Installing the ROCm build tool [rbuild](https://github.com/RadeonOpenCompute/rbuild).\n\n1. Install `rocm-cmake`, `pip3`, `rocblas`, and `miopen-hip`:\n\n    ```bash\n    sudo apt install -y rocm-cmake python3-pip rocblas miopen-hip\n    ```\n\n2. Set up and activate python venv for rbuild:\n    ```bash\n    python3 -m venv venv_rbuild\n    source venv_rbuild/bin/activate\n    ```\n\n3. Install [rbuild](https://github.com/RadeonOpenCompute/rbuild) in the python venv:\n\n    ```bash\n    pip install https://github.com/RadeonOpenCompute/rbuild/archive/master.tar.gz\n    ```\n\n\u003e [!NOTE]\n\u003e You can deactivate the python virtual environment with `deactivate`.\n\n\n### Compile using the ROCm build tool [rbuild](https://github.com/RadeonOpenCompute/rbuild).\n\n1. Follow instructions in [installing rbuild](#installing-the-rocm-build-tool-rbuild)\n\n2. Build MIGraphX source code:\n\n    ```bash\n    rbuild build -d depend -B build -DGPU_TARGETS=$(/opt/rocm/bin/rocminfo | grep -o -m1 'gfx.*')\n    ```\n\n\nOnce completed, all prerequisites are in the `depend` folder and MIGraphX is in the `build` directory.\n\n\u003e [!NOTE]\n\u003e If you get an `rbuild: command not found` error, it's because `rbuild` is installed in `$HOME/.local/bin`,\n\u003e which is not in `PATH`. You can either export PATH as `export PATH=$HOME/.local/bin:$PATH` to add\n\u003e the folder to `PATH`, or add the option `--prefix /usr/local` in the pip3 command when installing `rbuild`.\n\n### Use CMake to build MIGraphX\n\n1. Follow instructions in [installing rbuild](#installing-the-rocm-build-tool)\n\n2. Install the prerequisites:\n\n    ```bash\n    rbuild prepare -d depend\n    ```\n\n    This puts all the prerequisites are in `depend` the folder. They can be used in the `cmake`\n    configuration as `-DCMAKE_PREFIX_PATH=depend`.\n\n    If you have sudo access, as an alternative to the `rbuild` command, you can install the prerequisites\n    in the same way as a Dockerfile, by calling `./tools/install_prereqs.sh`.\n\n    By default, all prerequisites are installed at the default location (`/usr/local`) and are accessible by all\n    users. For the default location, `sudo` is required to run the script. You can also specify a different\n    location using `./tools/install_prereqs.sh $custom_location`.\n\n3. Go to the project folder and create a `build` directory:\n\n    ```bash\n    mkdir build\n    cd build\n    ```\n\n4. Configure CMake. If the prerequisites are installed at the default location `/usr/local`, use:\n\n    ```bash\n    CXX=/opt/rocm/llvm/bin/clang++ cmake .. -DGPU_TARGETS=$(/opt/rocm/bin/rocminfo | grep -o -m1 'gfx.*')\n    ```\n\n    Otherwise, you need to set `-DCMAKE_PREFIX_PATH=$your_loc` to configure CMake.\n\n5. Build MIGraphX source code:\n\n    ```cpp\n    make -j$(nproc)\n    ```\n\n    You can verify this using:\n\n    ```cpp\n    make -j$(nproc) check\n    ```\n\n6. Install MIGraphX libraries:\n\n    ```cpp\n    make install\n    ```\n\n### Use Docker\n\nThe easiest way to set up the development environment is to use Docker.\n\n1. With the Dockerfile, build a Docker image:\n\n    ```bash\n        docker build -t migraphx .\n    ```\n\n2. Enter the development environment using `docker run`:\n\n    ```bash\n        docker run --device='/dev/kfd' --device='/dev/dri' -v=`pwd`:/code/AMDMIGraphX -w /code/AMDMIGraphX --group-add video -it migraphx\n    ```\n\n3. In the Docker container, all required prerequisites are already installed, so you can go to the folder\n    `/code/AMDMIGraphX` and follow the steps (starting from 2) in the\n    [Use CMake to build MIGraphX](#use-cmake-to-build-migraphx).\n\n## Using the MIGraphX Python module\n\nTo use MIGraphX's Python module, you can set `PYTHONPATH` or use the `.deb` package:\n\n* Setting `PYTHONPATH`:\n\n    ```bash\n    export PYTHONPATH=/opt/rocm/lib:$PYTHONPATH\n    ```\n\n* Creating the `deb` package:\n\n    ```bash\n    make package\n    ```\n\n    This provides the path for .deb package.\n\n    To install:\n\n    ```bash\n    dpkg -i \u003cpath_to_deb_file\u003e\n    ```\n\n## Calling MIGraphX APIs\n\nTo use MIGraphX's C/C++ API in your CMake project, you must set `CMAKE_PREFIX_PATH` to the\nMIGraphX installation location and run:\n\n```cmake\nfind_package(migraphx)\ntarget_link_libraries(myApp migraphx::c)\n```\n\nWhere `myApp` is the CMake target in your project.\n\n## Building for development\n\nUsing `rbuild`, you can install the dependencies for development with:\n\n```bash\nrbuild develop -DGPU_TARGETS=$(/opt/rocm/bin/rocminfo | grep -o -m1 'gfx.*')\n```\n\nThis installs development dependencies in the `deps` directory and configures `cmake` to use those\ndependencies in the `build` directory. You can change these directories by passing the `--deps-dir` and\n`--build-dir` flags to the `rbuild` command:\n\n```bash\nrbuild develop --build-dir build_rocm_55 --deps-dir /home/user/deps_dir\n```\n\n## Building the documentation\n\nHTML and PDF documentation can be built using:\n\n`cmake --build . --config Release --target doc` **OR** `make doc`\n\nThis will build a local searchable web site inside the docs/html folder.\n\nDocumentation is built using [Doxygen](http://www.stack.nl/~dimitri/doxygen/download.html) and [rocm-docs-core](https://github.com/RadeonOpenCompute/rocm-docs-core)\n\nRun the steps below to build documentation locally. You can reuse the same venv from [installing rbuild](#installing-the-rocm-build-tool-rbuild).\n\n```bash\ncd docs\n\npip3 install -r sphinx/requirements.txt\n\npython3 -m sphinx -T -E -b html -d _build/doctrees -D language=en . _build/html\n```\n\nDepending on your setup `sudo` may be required for the pip install.\n\n## Formatting the code\n\nAll the code is formatted using clang-format. To format a file, use:\n\n```clang\nclang-format-10 -style=file -i \u003cpath-to-source-file\u003e\n```\n\nAlso, githooks can be installed to format the code per-commit:\n\n```bash\n./.githooks/install\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frocm%2Famdmigraphx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frocm%2Famdmigraphx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frocm%2Famdmigraphx/lists"}