diff --git a/docs/API_Reference_Guide.rst b/docs/API_Reference_Guide.rst index f21d43c593..22222b0cf0 100644 --- a/docs/API_Reference_Guide.rst +++ b/docs/API_Reference_Guide.rst @@ -1,11 +1,13 @@ +.. meta:: + :description: Composable Kernel documentation and API reference library + :keywords: composable kernel, CK, ROCm, API, documentation -******************* -API Reference Guide -******************* +.. _api-reference: + +******************************************************************** +API reference guide +******************************************************************** -================= -Introduction -================= This document contains details of the APIs for the Composable Kernel (CK) library and introduces some of the key design principles that are used to write new classes that extend CK functionality. @@ -30,7 +32,7 @@ DeviceMem Kernels For Flashattention --------------------------- -The Flashattention algorithm is defined in :cite:t:`dao2022flashattention`. This sections lists +The Flashattention algorithm is defined in :cite:t:`dao2022flashattention`. This section lists the classes that are used in the CK GPU implementation of Flashattention. **Gridwise classes** diff --git a/docs/Contributors_Guide.rst b/docs/Contributors_Guide.rst index 41cb8f1915..b91984357a 100644 --- a/docs/Contributors_Guide.rst +++ b/docs/Contributors_Guide.rst @@ -1,9 +1,14 @@ -=================== -Contributor's Guide -=================== +.. meta:: + :description: Composable Kernel documentation and API reference library + :keywords: composable kernel, CK, ROCm, API, documentation -This chapter explains how to get started contributing to the Composable Kernel project and what are -the contributing rules. +.. _contributing-to: + +******************************************************************** +Contributor's guide +******************************************************************** + +This chapter explains the rules for contributing to the Composable Kernel project, and how to contribute. Getting started =============== @@ -14,23 +19,21 @@ Getting started build the library. You can also find some of this information in the `README file `_ on the project's GitHub page. -#. **Additional reading:** We also recommend reading a `blog post +#. **Additional reading:** The blog post `AMD Composable Kernel library: efficient fused kernels for AI apps with just a few lines of code `_ provides a deeper understanding of the CK library and showcases its performance capabilities. `_ - from the AMD Community portal. It offers a deeper understanding of the library's objectives and - showcases its performance capabilities. + from the AMD Community portal. It offers a deeper understanding of the library's objectives and showcases its performance capabilities. #. **General information:** For broader information about AMD products, consider exploring the `AMD Developer Central portal `_. -How do I contribute +How to contribute =================== -We deeply value contributions from our users. You can make an impact by reporting issues or -proposing code enhancements through pull requests. +You can make an impact by reporting issues or proposing code enhancements through pull requests. Reporting issues ---------------- -We use `Github issues `_ +Use `Github issues `_ to track public bugs and enhancement requests. If you encounter an issue with the library, please check if the problem has already been @@ -59,7 +62,7 @@ issue. All reported issues must include: * How frequently does this issue happen? Does it reproduce every time? Or is it a sporadic issue? -Before sumbitting any issue, ensure you have addressed all relevant questions from the checklist. +Before submitting any issue, ensure you have addressed all relevant questions from the checklist. Creating Pull Requests ---------------------- @@ -68,7 +71,7 @@ You can submit `Pull Requests (PR) on GitHub `_. All contributors are required to develop their changes on a separate branch and then create a -pull requrest to merge their changes into the `develop` branch, which is the default +pull request to merge their changes into the `develop` branch, which is the default development branch in the Composable Kernel project. All external contributors must use their own forks of the project to develop their changes. @@ -99,4 +102,4 @@ When submitting a Pull Request you should: Following the above guidelines ensures a seamless review process and faster assistance from our end. -Thank you for your commitment to enhancing the Composable Kernel project! We look forward to collaborating with you. +Thank you for your commitment to enhancing the Composable Kernel project! diff --git a/docs/Supported_Primitives_Guide.rst b/docs/Supported_Primitives_Guide.rst index 3462283d90..e24acf5656 100644 --- a/docs/Supported_Primitives_Guide.rst +++ b/docs/Supported_Primitives_Guide.rst @@ -1,16 +1,20 @@ -========================== -Supported Primitives Guide -========================== +.. meta:: + :description: Composable Kernel documentation and API reference library + :keywords: composable kernel, CK, ROCm, API, documentation -This document contains details of supported primitives in Composable Kernel (CK). In contrast to the -API Reference Guide, the Supported Primitives Guide is an introduction to the math which underpins -the algorithms implemented in CK. +.. _supported-primitives: + +******************************************************************** +Supported Primitives Guide +******************************************************************** + +This document contains details of supported primitives in Composable Kernel (CK). In contrast to the API Reference Guide, the Supported Primitives Guide is an introduction to the math which underpins the algorithms implemented in CK. ------------ Softmax ------------ -For vectors :math:`x^{(1)}, x^{(2)}, \ldots, x^{(T)}` of size :math:`B` we can decompose the +For vectors :math:`x^{(1)}, x^{(2)}, \ldots, x^{(T)}` of size :math:`B` you can decompose the softmax of concatenated :math:`x = [ x^{(1)}\ | \ \ldots \ | \ x^{(T)} ]` as, .. math:: @@ -27,7 +31,7 @@ where :math:`f(x^{(j)}) = \exp( x^{(j)} - m(x^{(j)}) )` is of size :math:`B` and :math:`z(x^{(j)}) = f(x_1^{(j)})+ \ldots+ f(x_B^{(j)})` is a scalar. For a matrix :math:`X` composed of :math:`T_r \times T_c` tiles, :math:`X_{ij}`, of size -:math:`B_r \times B_c` we can compute the row-wise softmax as follows. +:math:`B_r \times B_c` you can compute the row-wise softmax as follows. For :math:`j` from :math:`1` to :math:`T_c`, and :math:`i` from :math:`1` to :math:`T_r` calculate, diff --git a/docs/dockerhub.rst b/docs/dockerhub.rst index cf420030ff..fb89bef72b 100644 --- a/docs/dockerhub.rst +++ b/docs/dockerhub.rst @@ -1,28 +1,50 @@ -=================== +.. meta:: + :description: Composable Kernel documentation and API reference library + :keywords: composable kernel, CK, ROCm, API, documentation + +.. _docker-hub: + +******************************************************************** CK Docker Hub +******************************************************************** + +Why do I need this? =================== -------------------------------------- -Why do I need this? -------------------------------------- +To make things simpler, and bring Composable Kernel and its dependencies together, +docker images can be found on `Docker Hub `_. Docker images provide a complete image of the OS, the Composable Kernel library, and its dependencies in a single downloadable file. -To make our lives easier and bring Composable Kernel dependencies together, we recommend using -docker images that can be found on `Docker Hub `_. +Refer to `Docker Overview `_ for more information on Docker images and containers. -------------------------------------- -So what is Composable Kernel? -------------------------------------- +Which image is right for me? +============================ -Composable Kernel (CK) library aims to provide a programming model for writing performance critical -kernels for machine learning workloads across multiple architectures including GPUs, CPUs, etc, -through general purpose kernel languages, like HIP C++. +The image naming includes information related to the docker image. +For example ``ck_ub20.04_rocm6.0`` indicates the following: -To get the CK library:: +* ``ck`` - made for running Composable Kernel; +* ``ub20.04`` - based on Ubuntu 20.04; +* ``rocm6.0`` - ROCm platform version 6.0. - git clone https://github.com/ROCmSoftwarePlatform/composable_kernel.git +Download a docker image suitable for your OS and ROCm release, run or start the docker container, and then resume the tutorial from this point. Use the ``docker pull`` command to download the file:: + + docker pull rocm/composable_kernel:ck_ub20.04_rocm6.0 -run a docker container:: +What is inside the image? +------------------------- + +The docker images have everything you need for running CK including: + +* `ROCm `_ +* `CMake `_ +* `Compiler `_ +* `Composable Kernel library `_ + +Running the docker container +============================ + +After downloading the docker image, you can start the container using one of a number of commands. Start with the ``docker run`` command as shown below:: docker run \ -it \ @@ -33,67 +55,47 @@ run a docker container:: rocm/composable_kernel:ck_ub20.04_rocm6.0 \ /bin/bash -and build the CK:: +After starting the bash shell, the docker container current folder is `~/workspace`. The library path is ``~/workspace/composable_kernel``. Navigate to the library to begin the tutorial as explained in :ref:`hello-world`: - mkdir build && cd build - # Need to specify target ID, example below is for gfx908 and gfx90a - cmake \ - -D CMAKE_PREFIX_PATH=/opt/rocm \ - -D CMAKE_CXX_COMPILER=/opt/rocm/bin/hipcc \ - -D CMAKE_CXX_FLAGS="-O3" \ - -D CMAKE_BUILD_TYPE=Release \ - -D GPU_TARGETS="gfx908;gfx90a" \ - .. +.. note:: -and:: + If your current folder is different from `${HOME}`, adjust the line ``-v ${HOME}:/root/workspace`` in the ``docker run`` command to fit your folder structure. - make -j examples tests +Stop and restart the docker image +================================= -To run all the test cases including tests and examples run:: +After finishing the tutorial, or just when you have completed your work session, you can close the docker container, or stop the docker container to restart it at another time. Closing the docker container means that it is still in the active state, and can be resumed from where you left it. Stopping the container closes it, and returns the image to its initial state. - make test +Use the ``Ctrl-D`` option to exit the container, while leaving it active, so you can return to the container in its current state to resume the tutorial, or pickup your project where you left off. -We can also run specific examples or tests like:: +To restart the active container use the ``docker exec`` command to specify the container name and options as follows:: - ./bin/example_gemm_xdl_fp16 - ./bin/test_gemm_fp16 + docker exec -it bash -For more details visit `CK github repository `_, -`CK examples `_, -`even more CK examples `_. +Where: -------------------------------------- -And what is inside? -------------------------------------- +* `exec` is the docker command +* `-it` is the interactive option for `exec` +* `` specifies an active container on the system +* `bash` specifies the command to run in the interactive shell -The docker images have everything you need for running CK including: +.. note:: -* `ROCm `_ -* `CMake `_ -* `Compiler `_ + You can use the ``docker container ls`` command to list the active containers on the system. -------------------------------------- -Which image is right for me? -------------------------------------- +To start a container from the image, use the ``docker start`` command:: -Let's take a look at the image naming, for example ``ck_ub20.04_rocm6.0``. The image specs are: + docker start -* ``ck`` - made for running Composable Kernel; -* ``ub20.04`` - based on Ubuntu 20.04; -* ``rocm6.0`` - ROCm platform version 6.0. +Then use the docker exec command as shown above to start the bash shell. -So just pick the right image for your project dependencies and you're all set. +Use the ``docker stop`` command to stop the container and restore the image to its initial state:: -------------------------------------- -DIY starts here -------------------------------------- + docker stop + +Editing the docker image +======================= -If you need to customize a docker image or just can't stop tinkering, feel free to adjust the +If you want to customize the docker image, edit the `Dockerfile `_ -for your needs. - -------------------------------------- -License -------------------------------------- - -CK is released under the MIT `license `_. +from the GitHub repository to suit your needs. diff --git a/docs/index.rst b/docs/index.rst index 8c4aaa2b3d..5dbd2eb033 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,57 +1,39 @@ -============================ +.. meta:: + :description: Composable Kernel documentation and API reference library + :keywords: composable kernel, CK, ROCm, API, documentation + +.. _composable-kernel: + +******************************************************************** Composable Kernel User Guide -============================ +******************************************************************** ------------- -Introduction ------------- +The Composable Kernel (CK) library provides a programming model for writing performance critical kernels for machine learning workloads across multiple architectures including GPUs and CPUs, through general purpose kernel languages like HIP C++. This document contains instructions for installing, using, and contributing to the Composable Kernel project. To learn more see :ref:`what-is-ck`. -This document contains instructions for installing, using, and contributing to Composable Kernel (CK). +The CK documentation is structured as follows: ------------ -Methodology ------------ +.. card:: Conceptual -Composable Kernel (CK) library aims to provide a programming model for writing performance critical -kernels for machine learning workloads across multiple architectures including GPUs, CPUs, etc, -through general purpose kernel languages, like HIP C++. + * :ref:`what-is-ck` -CK utilizes two concepts to achieve performance portability and code maintainability: +.. card:: Installation -* A tile-based programming model -* Algorithm complexity reduction for complex ML operators, using innovative technique we call - "Tensor Coordinate Transformation". + * :ref:`docker-hub` -.. image:: data/ck_component.png - :alt: CK Components +.. card:: Tutorial --------------- -Code Structure --------------- + * :ref:`hello-world` -Current CK library are structured into 4 layers: +.. card:: API reference -* "Templated Tile Operators" layer -* "Templated Kernel and Invoker" layer -* "Instantiated Kernel and Invoker" layer -* "Wrapper for tensor transform operations" -* "Client API" layer + * :ref:`supported-primitives` + * :ref:`api-reference` + * :ref:`wrapper` -.. image:: data/ck_layer.png - :alt: CK Layers - -Documentation Roadmap -^^^^^^^^^^^^^^^^^^^^^ -The following is a list of CK documents in the suggested reading order: +.. card:: Contributing to CK -.. toctree:: - :maxdepth: 5 - :caption: Contents: - :numbered: + * :ref:`contributing-to` - tutorial_hello_world - dockerhub - wrapper - Supported_Primitives_Guide - API_Reference_Guide - Contributors_Guide +To contribute to the documentation refer to `Contributing to ROCm `_. + +You can find licensing information at the `Licensing `_ page. diff --git a/docs/license.md b/docs/license.md new file mode 100644 index 0000000000..43e471da0e --- /dev/null +++ b/docs/license.md @@ -0,0 +1,2 @@ +```{include} ../LICENSE.md +``` diff --git a/docs/license.rst b/docs/license.rst deleted file mode 100644 index ddb544496e..0000000000 --- a/docs/license.rst +++ /dev/null @@ -1,6 +0,0 @@ -======= -License -======= - -.. include:: ../LICENSE - :literal: diff --git a/docs/sphinx/_toc.yml.in b/docs/sphinx/_toc.yml.in index c37ba29cec..5780674624 100644 --- a/docs/sphinx/_toc.yml.in +++ b/docs/sphinx/_toc.yml.in @@ -1,10 +1,21 @@ -# Anywhere {branch} is used, the branch name will be substituted. -# These comments will also be removed. defaults: numbered: False - maxdepth: 6 root: index subtrees: -- caption: About - entries: - - file: license +- entries: + - file: what-is-ck.rst + title: What is Composable Kernel? + - file: dockerhub.rst + title: Docker Hub + - file: tutorial_hello_world.rst + title: Hello World Tutorial + - file: Supported_Primitives_Guide.rst + title: Supported Primitives + - file: API_Reference_Guide.rst + title: API Reference + - file: wrapper.rst + title: Wrapper + - file: Contributors_Guide.rst + title: Contributing to CK + - file: license.md + title: License diff --git a/docs/tutorial_hello_world.rst b/docs/tutorial_hello_world.rst index 6b8154d462..d89331e579 100644 --- a/docs/tutorial_hello_world.rst +++ b/docs/tutorial_hello_world.rst @@ -1,52 +1,44 @@ -=============== -CK Hello world -=============== +.. meta:: + :description: Composable Kernel documentation and API reference library + :keywords: composable kernel, CK, ROCm, API, documentation -------------------------------------- -Motivation -------------------------------------- +.. _hello-world: -This tutorial is aimed at engineers dealing with artificial intelligence and machine learning who -would like to optimize their pipelines and squeeze every performance drop by adding Composable -Kernel (CK) library to their projects. We would like to make the CK library approachable so -the tutorial is not based on the latest release and doesn't have all the bleeding edge features, -but it will be reproducible now and forever. +******************************************************************** +Hello World Tutorial +******************************************************************** -During this tutorial we will have an introduction to the CK library, we will build it and run some -examples and tests, so to say we will run a "Hello world" example. In future tutorials we will go -in depth and breadth and get familiar with other tools and ways to integrate CK into your project. +This tutorial is for engineers dealing with artificial intelligence and machine learning who +would like to optimize pipelines and improve performance using the Composable +Kernel (CK) library. This tutorial provides an introduction to the CK library. You will build the library and run some examples using a "Hello World" example. -------------------------------------- Description -------------------------------------- +=========== -Modern AI technology solves more and more problems in all imaginable fields, but crafting fast and -efficient workflows is still challenging. CK is one of the tools to make AI heavy lifting as fast -and efficient as possible. CK is a collection of optimized AI operator kernels and tools to create -new ones. The library has components required for majority of modern neural networks architectures -including matrix multiplication, convolution, contraction, reduction, attention modules, variety of -activation functions, fused operators and many more. +Modern AI technology solves more and more problems in a variety of fields, but crafting fast and +efficient workflows is still challenging. CK can make the AI workflow fast +and efficient. CK is a collection of optimized AI operator kernels with tools to create +new kernels. The library has components required for modern neural network architectures +including matrix multiplication, convolution, contraction, reduction, attention modules, a variety of activation functions, and fused operators. -So how do we (almost) reach the speed of light? CK acceleration abilities are based on: +CK library acceleration features are based on: -* Layered structure. -* Tile-based computation model. -* Tensor coordinate transformation. -* Hardware acceleration use. -* Support of low precision data types including fp16, bf16, int8 and int4. +* Layered structure +* Tile-based computation model +* Tensor coordinate transformation +* Hardware acceleration use +* Support of low precision data types including fp16, bf16, int8 and int4 -If you are excited and need more technical details and benchmarking results - read this awesome +If you need more technical details and benchmarking results read the following `blog post `_. -For more details visit our `github repository `_. +To download the library visit the `composable_kernel repository `_. -------------------------------------- Hardware targets -------------------------------------- +================ -CK library fully supports `gfx908` and `gfx90a` GPU architectures and only some operators are -supported for `gfx1030`. Let's check the hardware you have at hand and decide on the target -GPU architecture. +CK library fully supports `gfx908` and `gfx90a` GPU architectures, while only some operators are +supported for `gfx1030` devices. Check your hardware to determine the target GPU architecture. ========== ========= GPU Target AMD GPU @@ -59,47 +51,24 @@ gfx1030 Radeon PRO V620, W6800, W6800X, W6800X Duo, W6900X, RX 6800, RX 6 There are also `cloud options `_ you can find if you don't have an AMD GPU at hand. -------------------------------------- Build the library -------------------------------------- +================= -First let's clone the library and rebase to the tested version:: +This tutorial is based on the use of docker images as explained in :ref:`docker-hub`. Download a docker image suitable for your OS and ROCm release, run or start the docker container, and then resume the tutorial from this point. - git clone https://github.com/ROCmSoftwarePlatform/composable_kernel.git - cd composable_kernel/ - git checkout tutorial_hello_world +.. note:: -To make our lives easier we prepared -`docker images `_ with all the necessary -dependencies. Pick the right image and create a container. In this tutorial we use -``rocm/composable_kernel:ck_ub20.04_rocm6.0`` image, it is based on Ubuntu 20.04 and -ROCm v6.0. + You can also `install ROCm `_ on your system, clone the `Composable Kernel repository `_ on GitHub, and use that to build and run the examples using the commands described below. -If your current folder is ``${HOME}``, start the docker container with:: - - docker run \ - -it \ - --privileged \ - --group-add sudo \ - -w /root/workspace \ - -v ${HOME}:/root/workspace \ - rocm/composable_kernel:ck_ub20.04_rocm6.0 \ - /bin/bash - -If your current folder is different from ``${HOME}``, adjust the line ``-v ${HOME}:/root/workspace`` -to fit your folder structure. - -Inside the docker container current folder is ``~/workspace``, library path is -``~/workspace/composable_kernel``, navigate to the library:: +Both the docker container and GitHub repository include the Composable Kernel library. Navigate to the library:: cd composable_kernel/ -Create and go to the ``build`` directory:: +Create and change to a ``build`` directory:: mkdir build && cd build -In the previous section we talked about target GPU architecture. Once you decide which one is right -for you, run CMake using the right ``GPU_TARGETS`` flag:: +The previous section discussed supported GPU architecture. Once you decide which hardware targets are needed, run CMake using the ``GPU_TARGETS`` flag:: cmake \ -D CMAKE_PREFIX_PATH=/opt/rocm \ @@ -109,26 +78,25 @@ for you, run CMake using the right ``GPU_TARGETS`` flag:: -D BUILD_DEV=OFF \ -D GPU_TARGETS="gfx908;gfx90a;gfx1030" .. -If everything went well the CMake run will end up with:: +If everything goes well the CMake command will return:: -- Configuring done -- Generating done -- Build files have been written to: "/root/workspace/composable_kernel/build" -Finally, we can build examples and tests:: +Finally, you can build examples and tests:: make -j examples tests -If everything is smooth, you'll see:: +When complete you should see:: Scanning dependencies of target tests [100%] Built target tests ---------------------------- Run examples and tests ---------------------------- +====================== -Examples are listed as test cases as well, so we can run all examples and tests with:: +Examples are listed as test cases as well, so you can run all examples and tests with:: ctest @@ -136,38 +104,32 @@ You can check the list of all tests by running:: ctest -N -We can also run them separately, here is a separate example execution:: +You can also run examples separately as shown in the following example execution:: ./bin/example_gemm_xdl_fp16 1 1 1 -The arguments ``1 1 1`` mean that we want to run this example in the mode: verify results with CPU, -initialize matrices with integers and benchmark the kernel execution. You can play around with -these parameters and see how output and execution results change. +The arguments ``1 1 1`` mean that you want to run this example in the mode: verify results with CPU, initialize matrices with integers, and benchmark the kernel execution. You can play around with these parameters and see how output and execution results change. -If everything goes well and you have a device based on `gfx908` or `gfx90a` architecture you should see -something like:: +If you have a device based on `gfx908` or `gfx90a` architecture, and if the example runs as expected, you should see something like:: a_m_k: dim 2, lengths {3840, 4096}, strides {4096, 1} - b_k_n: dim 2, lengths {4096, 4096}, strides {1, 4096} + b_k_n: dim 2, lengths {4096, 4096}, strides {4096, 1} c_m_n: dim 2, lengths {3840, 4096}, strides {4096, 1} - launch_and_time_kernel: grid_dim {480, 1, 1}, block_dim {256, 1, 1} - Warm up 1 time - Start running 10 times... - Perf: 1.10017 ms, 117.117 TFlops, 87.6854 GB/s, DeviceGemmXdl<256, 256, 128, 4, 8, 32, 32, 4, 2> NumPrefetch: 1, LoopScheduler: Default, PipelineVersion: v1 + Perf: 1.08153 ms, 119.136 TFlops, 89.1972 GB/s, DeviceGemm_Xdl_CShuffle LoopScheduler: Interwave, PipelineVersion: v1 -Meanwhile, running it on a `gfx1030` device should result in:: +However, running it on a `gfx1030` device should result in the following:: a_m_k: dim 2, lengths {3840, 4096}, strides {4096, 1} b_k_n: dim 2, lengths {4096, 4096}, strides {1, 4096} c_m_n: dim 2, lengths {3840, 4096}, strides {4096, 1} DeviceGemmXdl<256, 256, 128, 4, 8, 32, 32, 4, 2> NumPrefetch: 1, LoopScheduler: Default, PipelineVersion: v1 does not support this problem -But don't panic, some of the operators are supported on `gfx1030` architecture, so you can run a +Don't worry, some operators are supported on `gfx1030` architecture, so you can run a separate example like:: ./bin/example_gemm_dl_fp16 1 1 1 -and it should result in something nice similar to:: +and it should return something like:: a_m_k: dim 2, lengths {3840, 4096}, strides {1, 4096} b_k_n: dim 2, lengths {4096, 4096}, strides {4096, 1} @@ -182,12 +144,9 @@ and it should result in something nice similar to:: .. note:: - There was a new CMake flag ``DL_KERNELS`` added in the latest versions of CK. If you use one of - the newest versions of the library and do not see the above results when running - ``example_gemm_dl_fp16``, it might be necessary to add ``-D DL_KERNELS=ON`` to your CMake command - in order to build the operators supported on the `gfx1030` architecture. + A new CMake flag ``DL_KERNELS`` has been added to the latest versions of CK. If you do not see the above results when running ``example_gemm_dl_fp16``, you might need to add ``-D DL_KERNELS=ON`` to your CMake command to build the operators supported on the `gfx1030` architecture. -We can also run a separate test:: +You can also run a separate test:: ctest -R test_gemm_fp16 @@ -198,13 +157,9 @@ If everything goes well you should see something like:: 100% tests passed, 0 tests failed out of 1 ------------ Summary ------------ +======= -In this tutorial we took the first look at the Composable Kernel library, built it on your system -and ran some examples and tests. Stay tuned, in the next tutorial we will run kernels with different -configs to find out the best one for your hardware and task. +In this tutorial you took the first look at the Composable Kernel library, built it on your system and ran some examples and tests. In the next tutorial you will run kernels with different configurations to find out the best one for your hardware and task. -P.S.: Don't forget to switch off the cloud instance if you have launched one, you can find better -ways to spend your money for sure! +P.S.: If you are running on a cloud instance, don't forget to switch off the cloud instance. diff --git a/docs/what-is-ck.rst b/docs/what-is-ck.rst new file mode 100644 index 0000000000..f0b51c48f8 --- /dev/null +++ b/docs/what-is-ck.rst @@ -0,0 +1,41 @@ +.. meta:: + :description: Composable Kernel documentation and API reference library + :keywords: composable kernel, CK, ROCm, API, documentation + +.. _what-is-ck: + +******************************************************************** +What is the Composable Kernel library +******************************************************************** + + +Methodology +=========== + +The Composable Kernel (CK) library provides a programming model for writing performance critical kernels for machine learning workloads across multiple architectures including GPUs and CPUs, through general purpose kernel languages like HIP C++. + +CK utilizes two concepts to achieve performance portability and code maintainability: + +* A tile-based programming model +* Algorithm complexity reduction for complex ML operators using an innovative technique called + "Tensor Coordinate Transformation". + +.. image:: data/ck_component.png + :alt: CK Components + + +Code Structure +============== + +The CK library is structured into 4 layers: + +* "Templated Tile Operators" layer +* "Templated Kernel and Invoker" layer +* "Instantiated Kernel and Invoker" layer +* "Client API" layer + +It also includes a simple wrapper component used to perform tensor transform operations more easily and with fewer lines of code. + +.. image:: data/ck_layer.png + :alt: CK Layers + \ No newline at end of file diff --git a/docs/wrapper.rst b/docs/wrapper.rst index da3a79eda8..c050f17caf 100644 --- a/docs/wrapper.rst +++ b/docs/wrapper.rst @@ -1,6 +1,12 @@ -=============== +.. meta:: + :description: Composable Kernel documentation and API reference library + :keywords: composable kernel, CK, ROCm, API, documentation + +.. _wrapper: + +******************************************************************** Wrapper -=============== +******************************************************************** ------------------------------------- Description @@ -11,7 +17,7 @@ Description The wrapper is under development and its functionality is limited. -CK provides a lightweight wrapper for more complex operations implemented in +The CK library provides a lightweight wrapper for more complex operations implemented in the library. It allows indexing of nested layouts using a simple interface (avoiding complex descriptor transformations) and memory access (using Tensor).