1
0
Fork 0
tinyrocs/docs/_source/toolchain-head.rst

218 lines
4.8 KiB
ReStructuredText

==============
Toolchain HEAD
==============
The main GPU toolchain is built from AMD upstream ROCm sources.
A build of all the sources requires building LLVM (``clang``)
and the various ROCm libraries and applications.
There is a bit of a chicken and egg problem with getting the libraries
and compilers built.
AMD's ROCm source repositories contain most of the toolchain software
that needs to be built. Note, there are many equivalent packages in
Debian's main free repository, but they are older versions than needed
(including in unstable sid).
The ``amdgpu`` module is in the Linux kernel source.
See "Operating System" about building that.
It is not required to use this toolchain to build the kernel module.
The stock Debian gcc is used for the kernel module.
Ug
--
Most of the ROCm repositories have a ``rocm-6.0.0`` tag.
I was unable to build everything using this tag in all repos.
The main issue is building the ``device-libs``, HIP, and ``hipcc``.
AMD has moved these builds under their LLVM repo. But this occurred
after tag ``rocm-6.0.0``. To build with that tag, there are a separate
ROCm device-libs, HIP, and HIPCC repos, but this fails to build all
required packages/files, afaict.
To get everything to build, I used the ``amd-stg-open`` tag in
LLVM, and the latest ``HEAD`` in the main branch (usually ``main`` or ``develop``)
in the other repos. For ``clr`` (OpenCL), the ``rocm-6.0.0`` tag
was used.
Latest upstream as of this is ``6.0.2``.
LLVM
----
.. literalinclude:: _static/toolchain/rocm-head/build-llvm.sh
:language: bash
rocm-core
---------
Build ``rocm-core``.
.. literalinclude:: _static/toolchain/rocm-head/build-rocm-core.sh
:language: bash
rocm-cmake
----------
Build ``rocm-cmake``.
.. literalinclude:: _static/toolchain/rocm-head/build-rocm-cmake.sh
:language: bash
amd-smi
-------
Build ``amd-smi``.
.. literalinclude:: _static/toolchain/rocm-head/build-amd-smi.sh
:language: bash
After LLVM is built above, and the other packages, in particular
``rocm-core``, perhaps ``device-libs`` can be built.
In this build, the ``device-libs`` being used is the one in AMD's LLVM
fork, it isn't AMD's separate repo for device libs.
* ``amd/hipcc`` --- HIP CC compiler (clang wrapper).
* ``amd/device-libs`` --- AMD device libs.
* ``amd/comgr`` --- Code Object Manager.
device-libs
-----------
Build ``device-libs``.
.. literalinclude:: _static/toolchain/rocm-head/build-device-libs.sh
:language: bash
roct-thunk-interface
--------------------
Build ``roct-thunk-interface``.
.. literalinclude:: _static/toolchain/rocm-head/build-roct-thunk-interface.sh
:language: bash
rocr-runtime
------------
Build ``rocr-runtime``.
Needs hsakmtConfig.cmake from ROCT-Thunk-Interface first.
.. literalinclude:: _static/toolchain/rocm-head/build-rocr-runtime.sh
:language: bash
For some reason, this is installing headers to ``/usr/hsa`` instead of
``/opt/rocm``. It is ignoring the ``PREFIX``. Workaround...
comgr
-----
Build ``comgr``.
Needs AMD device-libs built first.
Needs hsa-runtime64Config.cmake first from ROCR-Runtime
.. literalinclude:: _static/toolchain/rocm-head/build-comgr.sh
:language: bash
hipcc
-----
hipcc.
.. literalinclude:: _static/toolchain/rocm-head/build-hipcc.sh
:language: bash
rocminfo
--------
Yes, ``rocminfo``
.. literalinclude:: _static/toolchain/rocm-head/build-rocminfo.sh
:language: bash
rocm-bandwidth-test
-------------------
``rocm-bandwidth-test``.
.. literalinclude:: _static/toolchain/rocm-head/build-rocm-bandwidth-test.sh
:language: bash
LLVM Second Pass
----------------
Rebuilding LLVM with itself, with more features.
.. literalinclude:: _static/toolchain/rocm-head/build-llvm-second.sh
:language: bash
clr
---
OpenCL and more.
.. literalinclude:: _static/toolchain/rocm-head/build-clr.sh
:language: bash
rocBLAS
-------
Needed before hipBLAS.
Set up this once:
.. code-block:: sh
# XXX total cruft...
# sh: 1: /opt/rocm/llvm/bin/clang: not found
sudo mkdir /opt/rocm/llvm
cd /opt/rocm/llvm
sudo ln -s /usr/bin/ .
# more cruft XXX fix paths
sudo ln -s /usr/bin/rocm_agent_enumerator /opt/rocm/bin/
.. literalinclude:: _static/toolchain/rocm-head/build-rocblas.sh
:language: bash
rocprim
-------
``rocprim``.
.. literalinclude:: _static/toolchain/rocm-head/build-rocprim.sh
:language: bash
rocsparse
---------
``rocsparse``.
.. literalinclude:: _static/toolchain/rocm-head/build-rocsparse.sh
:language: bash
rocsolver
---------
``rocsolver`` for hipBLAS.
.. literalinclude:: _static/toolchain/rocm-head/build-rocsolver.sh
:language: bash
hipBLAS
-------
``hipBLAS`` plz.
.. literalinclude:: _static/toolchain/rocm-head/build-hipblas.sh
:language: bash
HOLD
----
Don't upgrade over these files. Debian has higher epochs.
``apt-mark hold hipcc llvm rocm-cmake rocm-device-libs rocminfo``