CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
85 lines
2.9 KiB
ReStructuredText
85 lines
2.9 KiB
ReStructuredText
.. meta::
|
|
:description: Learn how to migrate your frontend code from cuDNN to hipDNN.
|
|
:keywords: hipDNN, ROCm, migrate, cuDNN
|
|
|
|
.. _migrate-cudnn:
|
|
|
|
********************************************
|
|
Migrate NVIDIA CUDA cuDNN projects to hipDNN
|
|
********************************************
|
|
|
|
This topic demonstrates how to migrate a NVIDIA CUDA cuDNN project to hipDNN.
|
|
|
|
Before you begin, ensure hipDNN (ROCm) is installed. See :ref:`prerequisites` for more information.
|
|
|
|
Here's a minimal example of a hipDNN project in ``CMakeLists.txt``:
|
|
|
|
.. code:: cmake
|
|
|
|
project(my_app LANGUAGES CXX)
|
|
set(CMAKE_CXX_STANDARD 17)
|
|
|
|
find_package(hipdnn_frontend CONFIG REQUIRED)
|
|
|
|
add_executable(my_app main.cpp)
|
|
target_link_libraries(my_app PRIVATE hipdnn_frontend)
|
|
|
|
.. tip::
|
|
|
|
See `Working examples in the Porting Guide <https://github.com/ROCm/rocm-libraries/blob/develop/projects/hipdnn/docs/PortingGuide.md#working-examples>`_ for ported code samples.
|
|
|
|
Key differences between cuDNN and hipDNN
|
|
========================================
|
|
|
|
This table provides a high-level overview of the differences between cuDNN and hipDNN:
|
|
|
|
.. list-table::
|
|
:widths: 3 3 3
|
|
:header-rows: 1
|
|
|
|
* - Aspect
|
|
- cuDNN frontend
|
|
- hipDNN frontend
|
|
* - Namespace
|
|
- ``cudnn_frontend``
|
|
- ``hipdnn_frontend``
|
|
* - Handle creation
|
|
- ``cudnnCreate(&handle)``
|
|
- ``hipdnnCreate(&handle``
|
|
* - Handle destruction
|
|
- ``cudnnDestroy(handle)``
|
|
- ``hipdnnDestroy(handle)``
|
|
* - Heuristics modes
|
|
- All cuDNN heuristic modes
|
|
- Currently only ``HeurMode_t::FALLBACK``
|
|
* - Operation support
|
|
- All cuDNN operations
|
|
- See :ref:`plugin-support` for more information.
|
|
* - Device memory utility
|
|
- ``Surface<type>``
|
|
- ``MigratableMemory<type>``
|
|
* - Device memory access
|
|
- ``Surface<type>::devPtr``
|
|
- ``MigratableMemory<type>::deviceData()``
|
|
|
|
See the :ref:`dimension-layouts` section of the Operation Support doccument for operation-specifc hipDNN tensor layout details.
|
|
|
|
Troubleshooting
|
|
===============
|
|
|
|
Error: Missing Heuristic modes A and B
|
|
--------------------------------------
|
|
|
|
The heuristic implementation in hipDNN is not implemented.
|
|
|
|
To fix the problem, use a combination of ``graph::get_ranked_engine_ids()`` and ``graph::set_preferred_engine_id_ext()`` if you need more detailed control over engine selection.
|
|
|
|
Error: Different memory utilities for allocating device memory
|
|
--------------------------------------------------------------
|
|
|
|
The memory utilities are typically consumer dependent and written on an as-needed basis.
|
|
cuDNN provides a surface utility for their samples, for example.
|
|
|
|
To fix the issue, use ``MigratableMemory<type>``, a utility that can automatically migrate data between the host and device (it also works as a stand-in).
|
|
If you want to manage dims/strides more carefully, use the ``Tensor`` utility class. Both of these classes can be found in the ``hipdnn_data_sdk::utilities`` namespace.
|