- Prerequisites
- Quick Start Guide
- Build Configurations
- Build Targets
- Platform-Specific Instructions
- Troubleshooting
- Verifying Installation
- GPU: AMD GPU with ROCm support
- Operating System:
- Linux: Matching support to TheRock
- Windows: Windows 11 (limited support, see Windows section)
| Dependency | Version | Description |
|---|---|---|
| ROCm | Matching TheRock (ROCm version 7.0+) | AMD GPU programming stack (see TheRock releases) |
| CMake | 3.25.2+ | Build system generator |
| C++ Compiler | C++17 compatible | hipDNN requires C++17 compatible AMD Clang (plugins using device code may require C++20) |
| HIP | Matching TheRock | GPU programming interface (included with ROCm/TheRock) |
| clang-format | 18.x | Code formatting tool |
| clang-tidy | 20.x | Static analysis tool |
| LLVM Tools | 20.x | LLVM tools for code_coverage, and ASAN enabled builds |
| Dependency | Version | Description |
|---|---|---|
| Ninja | 1.12.1+ | Faster build system (recommended) |
| Docker | Latest | For containerized builds |
| Python3 | Latest | For test name validation |
The following libraries are automatically managed by CMake (see Dependencies.cmake):
- FlatBuffers - Serialization library
- Google Test - Unit testing framework
- spdlog - Logging library
Tip
💡 Docker provides a consistent development environment with all dependencies pre-installed. This is the recommended approach for most users. For more details about Docker images, see the Docker README.
-
Clone hipDNN
git clone https://github.com/ROCm/hipDNN.git
-
Build the Development Container
cd hipDNN/dockerfiles/ # For Ubuntu 24.04 using prebuilt tarballs with gfx94X support (recommended) # (see Docker README for other options if needed) docker build -f ./Dockerfile.ubuntu24 -t hipdnn-dev:ubuntu24 .
-
Run the Container
# Replace <path/to/hipDNN> with your hipDNN repository path docker run -it \ -v <path/to/hipDNN>:/workspace/hipDNN \ --privileged \ --rm \ --device=/dev/kfd \ --device=/dev/dri:/dev/dri:rw \ --volume=/dev/dri:/dev/dri:rw \ -v /var/lib/docker:/var/lib/docker \ --group-add video \ --cap-add=SYS_PTRACE \ --security-opt seccomp=unconfined \ hipdnn-dev:ubuntu24
-
Build and Test
cd /workspace/hipDNN mkdir build && cd build cmake -GNinja .. ninja check
-
Install
# Default installation to /opt/rocm sudo ninja install
-
Install ROCm (follow official ROCm installation guide)
-
Clone and Build
git clone https://github.com/ROCm/hipDNN.git cd hipDNN mkdir build && cd build # Configure with Ninja (recommended) cmake -GNinja .. # Build and run tests ninja check # Install sudo ninja install
cmake -GNinja ..cmake -GNinja -DCMAKE_BUILD_TYPE=Debug ..cmake -GNinja -DCODE_COVERAGE=ON ..
ninja code_coverage
# Coverage reports will be generated in build/coverage/cmake -GNinja -DBUILD_ADDRESS_SANITIZER=ON ..
ninja check
# Note: Some HIP-related tests may be skipped due to AddressSanitizer incompatibilitycmake -GNinja -DCMAKE_INSTALL_PREFIX=/custom/install/path ..# Build without plugins
cmake -GNinja -DHIP_DNN_BUILD_PLUGINS=OFF ..
# Build only the backend
cmake -GNinja -DHIP_DNN_BUILD_FRONTEND=OFF ..
# Build without samples
cmake -GNinja -DHIP_DNN_BUILD_SAMPLES=OFF ..Note
📝 Make is supported for all targets. Configure with cmake -G "Unix Makefiles" .. if it is not the default generator in your environment. For parallel builds, use make -j$(nproc) on Linux. Unlike ninja, make does not build in parallel by default.
All targets support parallel builds with ninja:
| Target | Description |
|---|---|
ninja |
Build all components |
ninja check |
Build and run all tests (see Testing) |
ninja check-ctest |
Build and run all tests with CTest |
ninja unit-check |
Build and run exclusively the unit tests and API tests (minimal version of ninja check) |
ninja integration-check |
Build and run exclusively the E2E integration tests (this is the bulk of the testing time) |
ninja install |
Install libraries and headers |
ninja format |
Auto-format all C++ source files |
ninja check_format |
Check code formatting compliance |
ninja code_coverage |
Generate test coverage reports (requires -DCODE_COVERAGE=ON) |
ninja clean |
Clean build artifacts |
ninja validate_test_names |
Validates test names conform to naming rules |
ninja generate_hipdnn_sdk_headers |
Generate C++ headers from schema (.fbs) files |
The standard build instructions above work for all supported Linux distributions. Ensure ROCm is properly installed and configured for your distribution.
Warning
GPU functionality and HIP-related tests are not currently supported on Windows. Only CPU tests can be run.
-
Prerequisites
- Visual Studio 2022 with C++ workload
- TheRock (ROCm Windows port)
- CMake 3.25.2+
- Ninja (recommended)
-
Setup Environment
# Open "x64 Native Tools Command Prompt for VS 2022" # Set HIP platform set HIP_PLATFORM=amd # Clone and build TheRock (see TheRock documentation)
-
Build hipDNN
cd <path\to\hipDNN> mkdir build cd build # Configure without plugins (not supported on Windows) cmake -GNinja -DHIP_DNN_BUILD_PLUGINS=OFF .. # Build and test (CPU tests only) ninja check
-
Path Configuration Add the following to your PATH:
set PATH=<hipDNN_build_dir>\backend\src;<TheRock_dist>\rocm\bin;%PATH%
If using custom paths, you may need to modify ClangToolChain.cmake.
-
Out of memory during build
# Reduce parallel jobs ninja -j4 # or even -j2 for systems with limited RAM
-
Docker GPU access issues
- Ensure ROCm is installed on the host system
- Verify GPU is visible:
rocm-smiorrocminfo - Check user is in
videoandrendergroups:sudo usermod -a -G video,render $USER # Log out and back in for changes to take effect
After installation, verify hipDNN is correctly installed:
-
Check installed files
# Default installation ls /opt/rocm/include/hipdnn* ls /opt/rocm/lib/libhipdnn*
-
Build and run samples
cd samples # See [samples README](../samples/README.md) for detailed instructions
-
Test with a simple program
#include <hipdnn.h> #include <iostream> int main() { size_t version; hipdnnGetVersion(&version); std::cout << "hipDNN version: " << version << std::endl; return 0; }
Compile with:
hipcc TestHipdnn.cpp -lhipdnn -o TestHipdnn ./TestHipdnn