This guide provides practical information for both using hipDNN components and extending the framework with new functionality.
This section covers how to use the various components of hipDNN in your applications.
The hipDNN frontend provides a C++ header-only API for building and executing operation graphs. For detailed architecture and design information, see the Frontend section in the Design Guide.
- Library includes:
frontend/include/ - Unit tests:
frontend/tests/ - Samples:
samples/
The hipDNN backend is a shared library that provides the core C API for graph execution and plugin management. For comprehensive details about the backend architecture, descriptor types, and workflow, see the Backend section in the Design Guide.
- Public includes:
backend/include/ - Public API tests:
tests/backend/
The hipDNN SDK is a header-only C++ library that provides utilities and interfaces for plugin development. For complete SDK functionality and future roadmap, see the SDK section in the Design Guide.
- Plugin interface definitions:
sdk/include/hipdnn_sdk/plugin/EnginePluginApi.h - Schema files:
sdk/schemas/ - Test utilities (incl. reference implementations):
sdk/tests/test_utilities/ - Logging
sdk/include/hipdnn_sdk/logging/Logger.hpp
hipDNN components can be easily integrated into your CMake projects using the installed package files.
find_package(hipdnn_frontend REQUIRED)
target_link_libraries(your_target PRIVATE hipdnn::frontend)find_package(hipdnn_backend REQUIRED)
target_link_libraries(your_target PRIVATE hipdnn::backend)find_package(hipdnn_sdk REQUIRED)
target_link_libraries(your_plugin PRIVATE hipdnn::sdk)If you use AMD half or bfloat16 types (via the SDK's UtilsFp16.hpp or UtilsBfp16.hpp), you need:
find_package(hip REQUIRED)
enable_language(HIP)
target_link_libraries(your_target hip::host hip::device)Note
📝 If CMake cannot find the packages after installation, ensure your CMAKE_PREFIX_PATH includes the install location. By default on Linux systems, hipDNN CMake files are installed to /opt/rocm/lib/cmake.
hipDNN uses the spdlog header-only library for logging. See the Environment docs for further details.
hipDNN uses FlatBuffers for schema-based data objects to describe graphs and operations.
- Graphs and operations are defined using
.fbsschema files - Attributes marked as
longtypes in graphs are foreign keys to theuidintensor_attributes - Schema files are located in
sdk/schemas/
This section covers how to extend hipDNN with new functionality.
Plugins extend hipDNN to support new or additional implementations of kernel engines, benchmarking, and heuristics. For comprehensive guidance on plugin development, including architecture details, implementation steps, and examples, see the Plugin Development Guide.
Adding a new operation requires coordinated changes across multiple components. Here's the complete workflow:
When adding a completely new operation type (not currently supported in hipDNN), you'll need to:
- Define the operation in the SDK schemas
- Create frontend classes
- Implement the operation in target plugins
If the operation is new to hipDNN, start by defining its data structures:
-
Create Attribute Schema
- Add a new
.fbsfile insdk/schemas/ - Define the operation's attributes (parameters, configurations)
- Example:
sdk/schemas/batchnorm_attributes.fbs
- Add a new
-
Update Graph Schema
- Modify
sdk/schemas/graph.fbs - Add your new attributes to the
NodeAttributesunion - Include your schema file
- Modify
Example:
include "your_operation_attributes.fbs";
union NodeAttributes {
BatchnormInferenceAttributes,
PointwiseAttributes,
...
YourOperationAttributes // Add your new operation
}After updating FlatBuffer schemas, regenerate the C++ headers:
ninja generate_hipdnn_sdk_headersCreate C++ classes to expose the operation to users:
-
Create Node Class
- Add header file in
frontend/include/hipdnn_frontend/node/ - Inherit from the base
Nodeclass - Example:
frontend/include/hipdnn_frontend/node/BatchnormNode.hpp
- Add header file in
-
Create Attribute Classes
- Add corresponding attribute classes in
frontend/include/hipdnn_frontend/attributes/ - These wrap the FlatBuffer-generated structures
- Add corresponding attribute classes in
-
Update Frontend Tests
- Add tests for your new node and attributes
- See examples in
frontend/tests/
Refer to the Plugin Development Guide to implement the operation execution in target plugins.
-
For New Operations:
SDK Schema → Frontend Classes → Plugin Implementation → Tests -
For Existing Operations in New Plugins:
Plugin Implementation → Integration Tests
-
Rebuild hipDNN: After changing hipDNN, you will need to rebuild. See the quick start steps in the build guide, or rebuild the specific targets.
-
Test Your Implementation:
- Unit tests for individual components
- Integration tests for new and untested end-to-end functionality
- Backward Compatibility: Ensure schema changes don't break existing operations
- Plugin Discovery: For example, engine plugins are loaded from
hipdnn_plugins/engines/relative to the backend library - Error Handling: Implement proper error reporting through the plugin API
- Performance: Optimization is critical for facilitating plugin adoption
- Enable logging with environment variables (see Environment Configuration)
- Use integration tests to verify operation behavior
- Check plugin loading with
HIPDNN_LOG_LEVEL=info - For plugin issues, check the default plugin path or use custom paths with
hipdnnSetEnginePluginPaths_ext