Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
WIP

WIP

WIP
  • Loading branch information
neon60 committed May 26, 2024
1 parent 3797306 commit 64c36dc
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 51 deletions.
1 change: 1 addition & 0 deletions .wordlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ frontends
gedit
GPGPU
hardcoded
HC
HIP's
hipcc
hipexamine
Expand Down
14 changes: 7 additions & 7 deletions docs/how-to/debugging.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ can use ltrace to visualize the runtime behavior of the entire ROCm software sta

Here's a simple command-line example that uses ltrace to trace HIP APIs and output:

.. code-block:: console
.. code-block:: console
$ ltrace -C -e "hip*" ./hipGetChanDesc
hipGetChanDesc->hipCreateChannelDesc(0x7ffdc4b66860, 32, 0, 0) = 0x7ffdc4b66860
Expand All @@ -36,7 +36,7 @@ Here's a simple command-line example that uses ltrace to trace HIP APIs and outp
Here's another example that uses ltrace to trace hsa APIs and output:

.. code-block:: console
.. code-block:: console
$ ltrace -C -e "hsa*" ./hipGetChanDesc
libamdhip64.so.4->hsa_init(0, 0x7fff325a69d0, 0x9c80e0, 0 <unfinished ...>
Expand Down Expand Up @@ -99,7 +99,7 @@ For details, see (https://github.com/ROCm/ROCgdb).

Below is a sample how to use ROCgdb run and debug HIP application, ROCgdb is installed with ROCM package in the folder /opt/rocm/bin.

.. code-block:: console
.. code-block:: console
$ export PATH=$PATH:/opt/rocm/bin
$ rocgdb ./hipTexObjPitch
Expand Down Expand Up @@ -132,7 +132,7 @@ Debugging HIP applications
The following Linux example shows how to get useful information from the debugger while running a
simple memory copy test, which caused a segmentation fault issue.

.. code-block:: console
.. code-block:: console
test: simpleTest2<?> numElements=4194304 sizeElements=4194304 bytes
Segmentation fault (core dumped)
Expand Down Expand Up @@ -231,13 +231,13 @@ For systems with multiple devices, you can choose to make only certain device(s)
``HIP_VISIBLE_DEVICES`` (or ``CUDA_VISIBLE_DEVICES`` on an NVIDIA platform). Once enabled, HIP can
only view devices that have indices present in the sequence. For example:

.. code-block:: console
.. code-block:: console
$ HIP_VISIBLE_DEVICES=0,1
Or in the application:

.. code-block:: cpp
.. code-block:: cpp
if (totalDeviceNum > 2) {
setenv("HIP_VISIBLE_DEVICES", "0,1,2", 1);
Expand Down Expand Up @@ -375,7 +375,7 @@ General debugging tips
* ``gdb --args`` can be used to pass the executable and arguments to ``gdb``.
* You can set environment variables (``set env``) from within GDB on Linux:

.. code-block:: bash
.. code-block:: bash
(gdb) set env AMD_SERIALIZE_KERNEL 3
Expand Down
10 changes: 5 additions & 5 deletions docs/how-to/hip_porting_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ info: TOTAL-converted 89 CUDA->HIP refs( dev:3 mem:32 kern:2 builtin:37 math:0 s

hipexamine-perl scans each code file (cpp, c, h, hpp, etc.) found in the specified directory:

* Files with no CUDA code (ie `kmeans.h`) print one line summary just listing the source file name.
* Files with no CUDA code (`kmeans.h`) print one line summary just listing the source file name.
* Files with CUDA code print a summary of what was found - for example the `kmeans_cuda_kernel.cu` file:

```shell
Expand Down Expand Up @@ -318,14 +318,14 @@ Applications with these interfaces should use the default libstdc++ linking.
Applications which are compiled entirely with hipcc, and which benefit from advanced C++ features not supported in libstdc++, and which do not require portability to NVCC, may choose to use libc++.
### HIP Headers (hip_runtime.h, hip_runtime_api.h)
### HIP Headers (`hip_runtime.h`, `hip_runtime_api.h`)
The hip_runtime.h and hip_runtime_api.h files define the types, functions and enumerations needed to compile a HIP program:
The `hip_runtime.h` and `hip_runtime_api.h` files define the types, functions and enumerations needed to compile a HIP program:
* `hip_runtime_api.h`: defines all the HIP runtime APIs (e.g., `hipMalloc`) and the types required to call them. A source file that is only calling HIP APIs but neither defines nor launches any kernels can include `hip_runtime_api.h`. hip_runtime_api.h uses no custom hc language features and can be compiled using a standard C++ compiler.
* `hip_runtime_api.h`: defines all the HIP runtime APIs (e.g., `hipMalloc`) and the types required to call them. A source file that is only calling HIP APIs but neither defines nor launches any kernels can include `hip_runtime_api.h`. `hip_runtime_api.h` uses no custom Heterogeneous Compute (HC) language features and can be compiled using a standard C++ compiler.
* `hip_runtime.h`: included in `hip_runtime_api.h`. It additionally provides the types and defines required to create and launch kernels. hip_runtime.h can be compiled using a standard C++ compiler but will expose a subset of the available functions.
CUDA has slightly different contents for these two files. In some cases you may need to convert hipified code to include the richer hip_runtime.h instead of hip_runtime_api.h.
CUDA has slightly different contents for these two files. In some cases you may need to convert hipified code to include the richer `hip_runtime.h` instead of `hip_runtime_api.h`.
### Using a Standard C++ Compiler
Expand Down
30 changes: 15 additions & 15 deletions docs/install/build.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ Before building and running HIP, make sure drivers and prebuilt packages are ins
You also need to install Python 3, which includes the ``CppHeaderParser`` package.
Install Python 3 using the following command:

.. code-block:: shell
.. code-block:: shell
apt-get install python3
Check and install ``CppHeaderParser`` package using the command:

.. code-block:: shell
.. code-block:: shell
pip3 install CppHeaderParser
Expand All @@ -29,7 +29,7 @@ Building the HIP runtime

Set the repository branch using the variable: ``ROCM_BRANCH``. For example, for ROCm 6.1, use:

.. code-block:: shell
.. code-block:: shell
export ROCM_BRANCH=rocm-6.1.x
Expand All @@ -49,7 +49,7 @@ Set the repository branch using the variable: ``ROCM_BRANCH``. For example, for
``hipother`` provides files required to support the HIP back-end implementation on some non-AMD platforms,
like NVIDIA.

.. code-block:: shell
.. code-block:: shell
git clone -b "$ROCM_BRANCH" https://github.com/ROCm/clr.git
git clone -b "$ROCM_BRANCH" https://github.com/ROCm/hip.git
Expand All @@ -66,15 +66,15 @@ Set the repository branch using the variable: ``ROCM_BRANCH``. For example, for

#. Set the environment variables.

.. code-block:: shell
.. code-block:: shell
export CLR_DIR="$(readlink -f clr)"
export HIP_DIR="$(readlink -f hip)"
#. Build HIP.

.. code-block:: shell
.. code-block:: shell
cd "$CLR_DIR"
mkdir -p build; cd build
Expand Down Expand Up @@ -116,7 +116,7 @@ Set the repository branch using the variable: ``ROCM_BRANCH``. For example, for

Usage:

.. code-block:: shell
.. code-block:: shell
`hip_prof_gen.py [-v] <input HIP API .h file> <patched srcs path> <previous output> [<output>]`
Expand All @@ -131,7 +131,7 @@ Set the repository branch using the variable: ``ROCM_BRANCH``. For example, for

Example usage:

.. code-block:: shell
.. code-block:: shell
hip_prof_gen.py -v -p -t --priv <hip>/include/hip/hip_runtime_api.h \
<hipamd>/src <hipamd>/include/hip/amd_detail/hip_prof_str.h \
Expand All @@ -142,23 +142,23 @@ Set the repository branch using the variable: ``ROCM_BRANCH``. For example, for

#. Get the HIP source code.

.. code-block:: shell
.. code-block:: shell
git clone -b "$ROCM_BRANCH" https://github.com/ROCm/clr.git
git clone -b "$ROCM_BRANCH" https://github.com/ROCm/hip.git
git clone -b "$ROCM_BRANCH" https://github.com/ROCm/hipother.git
#. Set the environment variables.

.. code-block:: shell
.. code-block:: shell
export CLR_DIR="$(readlink -f clr)"
export HIP_DIR="$(readlink -f hip)"
export HIP_OTHER="$(readlink -f hipother)"
#. Build HIP.

.. code-block:: shell
.. code-block:: shell
cd "$CLR_DIR"
mkdir -p build; cd build
Expand All @@ -180,13 +180,13 @@ Build HIP tests

* Get HIP tests source code.

.. code-block:: shell
.. code-block:: shell
git clone -b "$ROCM_BRANCH" https://github.com/ROCm/hip-tests.git
* Build HIP tests from source.

.. code-block:: shell
.. code-block:: shell
export HIPTESTS_DIR="$(readlink -f hip-tests)"
cd "$HIPTESTS_DIR"
Expand All @@ -199,14 +199,14 @@ Build HIP tests

To run any single catch test, use this example:

.. code-block:: shell
.. code-block:: shell
cd $HIPTESTS_DIR/build/catch_tests/unit/texture
./TextureTest
* Build a HIP Catch2 standalone test.

.. code-block:: shell
.. code-block:: shell
cd "$HIPTESTS_DIR"
hipcc $HIPTESTS_DIR/catch/unit/memory/hipPointerGetAttributes.cc \
Expand Down
6 changes: 3 additions & 3 deletions docs/install/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Installation

#. Install the NVIDIA driver.

.. code-block:: shell
.. code-block:: shell
sudo apt-get install ubuntu-drivers-common && sudo ubuntu-drivers autoinstall
sudo reboot
Expand All @@ -59,7 +59,7 @@ Installation
#. Install the ``hip-runtime-nvidia`` and ``hip-dev`` packages. This installs the CUDA SDK and HIP
porting layer.

.. code-block:: shell
.. code-block:: shell
apt-get install hip-runtime-nvidia hip-dev
Expand All @@ -74,6 +74,6 @@ Verify your installation

Run ``hipconfig`` in your installation path.

.. code-block:: shell
.. code-block:: shell
/opt/rocm/bin/hipconfig --full
Loading

0 comments on commit 64c36dc

Please sign in to comment.