Skip to content

Commit d3be919

Browse files
randyh62neon60
authored andcommitted
Add HIP 7.0 changes to documentation
1 parent 4414ede commit d3be919

File tree

8 files changed

+109
-25
lines changed

8 files changed

+109
-25
lines changed

docs/hip-7-changes.rst

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
HIP API 7.0 changes
99
*******************************************************************************
1010

11-
To improve code portability between AMD and NVIDIA GPU programming models specific changes were made to the HIP API in the 7.0 release to simplify cross-platform programming. These changes align HIP C++ even more closely with NVIDIA CUDA. These changes are incompatible with prior releases, and might require recompiling existing HIP applications for use in the 7.0 release, or editing and recompiling code in some cases. In the best case, the change requires no modification of existing applications. These changes were made available in a preview release based on the 6.4.1 release, and as such, hopefully, you have had advanced notice and prepared for the following changes.
11+
To improve code portability between AMD and NVIDIA GPU programming models, changes were made to the HIP API in ROCm 7.0 to simplify cross-platform programming. These changes align HIP C++ even more closely with NVIDIA CUDA. These changes are incompatible with prior releases, and might require recompiling existing HIP applications for use with ROCm 7.0, or editing and recompiling code in some cases. In the best case, the change requires no modification of existing applications. These changes were made available in a preview release based on ROCm 6.4.1 to help you prepare.
1212

1313
Behavior changes in HIP Runtime API
1414
===================================
@@ -163,23 +163,13 @@ Stream capture updates
163163
Restrict stream capture modes
164164
-----------------------------
165165

166-
Stream capture mode has been restricted in HIP APIs through the addition of the macro ``CHECK_STREAM_CAPTURE_SUPPORTED``.
167-
168-
In the HIP enumeration ``hipStreamCaptureMode``, three capture modes were previously supported:
169-
170-
* Global
171-
* ThreadLocal
172-
* Relaxed
173-
174-
As of the 7.0 release, when checking with the ``CHECK_STREAM_CAPTURE_SUPPORTED`` macro the only supported stream capture mode is ``hipStreamCaptureModeRelaxed``. The rest are not supported, and the macro will return ``hipErrorStreamCaptureUnsupported``.
175-
176-
This change matches the behavior of CUDA. There is no impact on any application if stream capture works correctly on the CUDA platform. However, in the HIP runtime the API will return ``hipErrorStreamCaptureUnsupported`` on unsupported stream capture modes.
177-
178-
This update involves the following APIs. They are allowed only in relaxed stream capture mode. Not all three capture modes.
166+
Stream capture mode has been restricted in the following APIs to relaxed (``hipStreamCaptureModeRelaxed``) mode:
179167

180168
* :cpp:func:`hipMallocManaged`
181169
* :cpp:func:`hipMemAdvise`
182170

171+
These APIs are allowed only in relaxed stream capture mode. If the functions are used with stream capture, the HIP runtime the will return ``hipErrorStreamCaptureUnsupported`` on unsupported stream capture modes.
172+
183173
Check stream capture mode
184174
-------------------------
185175

@@ -230,7 +220,7 @@ More conditional checks are added in the API implementation, and the return erro
230220
* If the input stream handle is invalid, the returned error is changed to ``hipErrorContextIsDestroyed`` from ``hipErrorInvalidValue``
231221
* Adds a grid dimension check, if any input global work size dimension is zero, returns ``hipErrorInvalidValue``
232222
* Adds extra shared memory size check, if exceeds the size limit, returns ``hipErrorInvalidValue``
233-
* If the total number of threads per block exceeds the maximum work group limit during a kernel launch, the return value is changed to``hipErrorInvalidConfiguration`` from ``hipErrorInvalidValue``
223+
* If the total number of threads per block exceeds the maximum work group limit during a kernel launch, the return value is changed to ``hipErrorInvalidConfiguration`` from ``hipErrorInvalidValue``
234224

235225
``hipModuleLaunchCooperativeKernel``
236226
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

docs/how-to/hip_porting_guide.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ error code spaces:
2929
General Tips
3030
--------------------------------------------------------------------------------
3131

32+
* ``hipDeviceptr_t`` is a ``void*`` and treated like a raw pointer, while ``CUdevicptr``
33+
is an ``unsigned int`` and treated as a device memory handle.
3234
* Starting to port on an NVIDIA machine is often the easiest approach, as the
3335
code can be tested for functionality and performance even if not fully ported
3436
to HIP.

docs/how-to/hip_rtc.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ alongside options to guide the compilation.
1414

1515
.. note::
1616

17+
* Device code compilation via HIPRTC uses the ``__hip_internal`` namespace instead
18+
of the ``std`` namespace to avoid namespace collision.
1719
* This library can be used for compilation on systems without AMD GPU drivers
1820
installed (offline compilation). However, running the compiled code still
1921
requires both the HIP runtime library and GPU drivers on the target system.
@@ -35,6 +37,11 @@ To use HIPRTC functionality the header needs to be included:
3537
3638
#include <hip/hiprtc.h>
3739
40+
.. note::
41+
42+
Prior to the 7.0 release, the HIP runtime included the hipRTC library. With the 7.0
43+
release, the library is separate and must be specifically included as shown above.
44+
3845
Kernels can be stored in a string:
3946

4047
.. code-block:: cpp
@@ -255,6 +262,13 @@ The full example is below:
255262
HIP_CHECK(hipFree(doutput));
256263
}
257264
265+
.. note::
266+
267+
Some applications define datatypes such as ``int64_t``, ``uint64_t``, ``int32_t``, and ``uint32_t``
268+
that could lead to conflicts when integrating with ``hipRTC``. To resolve these conflicts, these
269+
datatypes are replaced with HIP-specific internal datatypes prefixed with ``__hip``. For example,
270+
``int64_t`` is replaced by ``__hip_int64_t``.
271+
258272
HIPRTC specific options
259273
===============================================================================
260274

docs/how-to/hip_runtime_api/error_handling.rst

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,9 @@ without changing it. To get a human readable version of the errors,
2121

2222
.. note::
2323

24-
:cpp:func:`hipGetLastError` returns the returned error code of the last HIP
25-
runtime API call even if it's ``hipSuccess``, while ``cudaGetLastError``
26-
returns the error returned by any of the preceding CUDA APIs in the same
27-
host thread. :cpp:func:`hipGetLastError` behavior will be matched with
28-
``cudaGetLastError`` in ROCm release 7.0.
24+
:cpp:func:`hipGetLastError` returns the last actual HIP API error caught in the current thread
25+
during the application execution. Prior to ROCm 7.0, ``hipGetLastError`` might also return
26+
``hipSuccess`` or ``hipErrorNotReady`` from the last HIP runtime API call, which are not errors.
2927

3028

3129
Best practices of HIP error handling:

docs/how-to/hip_runtime_api/memory_management/host_memory.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@ C++ application.
108108
:cpp:func:`hipMalloc` and :cpp:func:`hipFree` are blocking calls. However, HIP
109109
also provides non-blocking versions :cpp:func:`hipMallocAsync` and
110110
:cpp:func:`hipFreeAsync`, which require a stream as an additional argument.
111+
For asynchronous memory allocations made with ``hipMallocAsync`` and ``hipMallocFromPoolAsync``
112+
``hipFree`` does not implicitly wait for synchronization, to match the behavior of ``cudaFree``.
111113

112114
.. _pinned_host_memory:
113115

docs/index.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ and kernel language that lets you create portable applications for AMD and
1111
NVIDIA GPUs from a single source code. For more information, see [What is HIP?](./what_is_hip)
1212

1313
```{note}
14-
The 7.0 release of the HIP API includes backward incompatible changes to make it
15-
align more closely with NVIDIA CUDA. These change are incompatible with prior releases,
16-
and may require recompiling existing HIP applications for use in the 7.0 release.
17-
For more information, see [HIP API 7.0 changes](./hip-7-changes).
14+
HIP API 7.0 introduces changes to make it align more closely with NVIDIA CUDA.
15+
These changes are incompatible with prior releases, and might require recompiling
16+
existing HIP applications for use with the ROCm 7.0 release. For more information,
17+
see [HIP API 7.0 changes](./hip-7-changes).
1818
```
1919

2020
Installation instructions are available from:

docs/reference/complex_math_api.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,13 @@ in both single and double precision formats.
4343
Complex Number Functions
4444
========================
4545

46+
.. note::
47+
48+
Changes have been made to small vector constructors for ``hipComplex`` and ``hipFloatComplex``
49+
initialization, such as ``float2`` and ``int4``. If your code previously relied
50+
on a single value to initialize all components within a vector or complex type, you might need
51+
to update your code.
52+
4653
A comprehensive collection of functions for creating and manipulating complex numbers, organized by
4754
functional categories for easy reference.
4855

docs/reference/error_codes.rst

Lines changed: 72 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ returned by HIP API functions to indicate various runtime conditions and errors.
1313

1414
For more details, see :ref:`Error handling functions <error_handling_reference>`.
1515

16+
.. _basic_runtime_errors:
17+
1618
Basic Runtime Errors
1719
====================
1820

@@ -100,6 +102,8 @@ Basic Runtime Errors
100102
If this error is encountered, it generally means the API or feature is not fully supported in the
101103
current version.
102104

105+
.. _memory_management_errors:
106+
103107
Memory Management Errors
104108
========================
105109

@@ -139,6 +143,14 @@ Memory Management Errors
139143
- ``1052``
140144
- Runtime memory call returned error
141145

146+
* - :term:`hipErrorInvalidChannelDescriptor`
147+
- ``911``
148+
- Input for texture object, resource descriptor, or texture descriptor is a NULL pointer or invalid
149+
150+
* - :term:`hipErrorInvalidTexture`
151+
- ``912``
152+
- Texture reference pointer is NULL or invalid
153+
142154
.. glossary::
143155

144156
hipErrorOutOfMemory
@@ -233,6 +245,21 @@ Memory Management Errors
233245
This error differs from ``hipErrorOutOfMemory`` in that it relates to memory operations internal to the HIP
234246
runtime rather than explicit application requests for memory allocation.
235247

248+
hipErrorInvalidChannelDescriptor
249+
250+
This error indicates that an invalid channel descriptor is used to define the format and layout of data
251+
in memory, particularly when working with textures or arrays. This could happen if the descriptor is
252+
incorrectly set up or if it does not match the expected format for the operation being performed.
253+
254+
hipErrorInvalidTexture
255+
256+
The error code is returned when an invalid texture object is used in a function call. This typically
257+
occurs when a texture object is not properly initialized or configured before being used in operations
258+
that require valid texture data. If you encounter this error, it suggests that the texture object
259+
might be missing necessary configuration details or has been corrupted.
260+
261+
.. _device_context_errors:
262+
236263
Device and Context Errors
237264
=========================
238265

@@ -385,6 +412,8 @@ Device and Context Errors
385412
* Custom build environments with mismatched components
386413
* Partial upgrades of the ROCm stack
387414

415+
.. _kernel_launch_errors:
416+
388417
Kernel and Launch Errors
389418
========================
390419

@@ -396,10 +425,18 @@ Kernel and Launch Errors
396425
- Value
397426
- Description
398427

428+
* - :term:`hipErrorInvalidValue``
429+
- ``1``
430+
- Invalid input value
431+
399432
* - :term:`hipErrorInvalidDeviceFunction`
400433
- ``98``
401434
- Invalid device function
402435

436+
* - :term:`hipErrorContextIsDestroyed`
437+
- ``709``
438+
- Invalid stream handle
439+
403440
* - :term:`hipErrorInvalidConfiguration`
404441
- ``9``
405442
- Invalid configuration argument
@@ -446,13 +483,22 @@ Kernel and Launch Errors
446483

447484
.. glossary::
448485

486+
hipErrorInvalidValue
487+
488+
Error returned when a grid dimension check finds any input global work size
489+
dimension is zero, or a shared memory size check finds the size exceeds the size limit.
490+
449491
hipErrorInvalidDeviceFunction
450492

451493
Invalid device function. This error occurs when attempting to use a function that is not a valid device
452494
function or is not available for the current device. Common scenarios include:
453495

454496
* Code compiled for a specific GPU architecture (using ``--offload-arch``) but executed on an different/incompatible GPU
455497

498+
hipErrorContextIsDestroyed
499+
500+
This error is returned when the input stream or input stream handle is invalid.
501+
456502
hipErrorInvalidConfiguration
457503

458504
Invalid configuration argument. This error occurs when the configuration specified for a kernel launch
@@ -507,7 +553,7 @@ Kernel and Launch Errors
507553
hipErrorInvalidKernelFile
508554

509555
Invalid kernel file. This error occurs when the kernel file or module being loaded is corrupted or in
510-
an invalid format.
556+
an invalid format, for example the file name exists but the file size is 0.
511557

512558
hipErrorInvalidImage
513559

@@ -556,6 +602,7 @@ Kernel and Launch Errors
556602

557603
* Launching a cooperative kernel with grid dimensions that exceed hardware limits
558604
* Requesting more resources than available for synchronization across thread blocks
605+
* The shared memory size in bytes exceeds the device local memory size per CU
559606
* Using cooperative groups on hardware with limited support
560607
* Not accounting for cooperative launch limitations in kernel configuration
561608

@@ -577,6 +624,8 @@ Kernel and Launch Errors
577624
normal operation. Additional debugging of the previous failed launch may be required to identify
578625
the root cause.
579626

627+
.. _stream_capture_errors:
628+
580629
Stream Capture Errors
581630
=====================
582631

@@ -624,6 +673,10 @@ Stream Capture Errors
624673
- ``907``
625674
- Operation not permitted on an event last recorded in a capturing stream
626675

676+
* - :term:`hipErrorInvalidResourceHandle`
677+
- ``400``
678+
- Input launch stream is ``NULL`` or is ``hipStreamLegacy``
679+
627680
.. glossary::
628681

629682
hipErrorStreamCaptureUnsupported
@@ -754,6 +807,14 @@ Stream Capture Errors
754807
and cannot be used for host-side synchronization until the capture is complete and the graph
755808
is executed.
756809

810+
hipErrorInvalidResourceHandle
811+
812+
This error is returned when the input launch stream is a NULL pointer, is invalid, or is ``hipStreamLegacy``.
813+
If you encounter this error, you should check the validity of the resource handle being used in your HIP
814+
API calls. Ensure that the handle was correctly obtained and has not been freed or invalidated before use.
815+
816+
.. _profiler_errors:
817+
757818
Profiler Errors
758819
===============
759820

@@ -845,6 +906,8 @@ Profiler Errors
845906
The HIP profiler must be in an active state before it can be stopped. This error is informational
846907
and indicates that the profiler is already in the desired inactive state.
847908

909+
.. _resource_mapping_errors:
910+
848911
Resource Mapping Errors
849912
=======================
850913

@@ -992,6 +1055,8 @@ Resource Mapping Errors
9921055
operation was attempted on a resource that was not mapped as a pointer. Resources must be mapped
9931056
with the appropriate mapping type for the operations that will be performed on them.
9941057

1058+
.. _peer_access_errors:
1059+
9951060
Peer Access Errors
9961061
==================
9971062

@@ -1058,6 +1123,8 @@ Peer Access Errors
10581123
access between peer devices. Not all device combinations support peer access. Compatibility can be
10591124
determined with :cpp:func:`hipDeviceCanAccessPeer()`.
10601125

1126+
.. _system_file_errors:
1127+
10611128
System and File Errors
10621129
======================
10631130

@@ -1183,6 +1250,8 @@ System and File Errors
11831250
This is a catch-all error that may require looking at system logs or using additional
11841251
debugging tools to identify the root cause.
11851252

1253+
.. _graphics_content_errors:
1254+
11861255
Graphics Context Errors
11871256
=======================
11881257

@@ -1216,6 +1285,8 @@ Graphics Context Errors
12161285
instantiated graph update. This error occurs when attempting to update an already instantiated
12171286
graph with changes that are not allowed.
12181287

1288+
.. _hardware_errors:
1289+
12191290
Hardware Errors
12201291
===============
12211292

0 commit comments

Comments
 (0)