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
64 lines
2.2 KiB
ReStructuredText
64 lines
2.2 KiB
ReStructuredText
==========
|
|
KernelInfo
|
|
==========
|
|
|
|
.. contents::
|
|
:local:
|
|
|
|
Introduction
|
|
============
|
|
|
|
This LLVM IR pass reports various statistics for code compiled for GPUs. The
|
|
goal of these statistics is to help identify bad code patterns and ways to
|
|
mitigate them. The pass operates at the LLVM IR level so that it can, in
|
|
theory, support any LLVM-based compiler for programming languages supporting
|
|
GPUs.
|
|
|
|
By default, the pass runs at the end of LTO, and options like
|
|
``-Rpass=kernel-info`` enable its remarks. Example ``opt`` and ``clang``
|
|
command lines appear in the next section.
|
|
|
|
Remarks include summary statistics (e.g., total size of static allocas) and
|
|
individual occurrences (e.g., source location of each alloca). Examples of the
|
|
output appear in tests in `llvm/test/Analysis/KernelInfo`.
|
|
|
|
Example Command Lines
|
|
=====================
|
|
|
|
To analyze a C program as it appears to an LLVM GPU backend at the end of LTO:
|
|
|
|
.. code-block:: shell
|
|
|
|
$ clang -O2 -g -fopenmp --offload-arch=native test.c -foffload-lto \
|
|
-Rpass=kernel-info
|
|
|
|
To analyze specified LLVM IR, perhaps previously generated by something like
|
|
``clang -save-temps -g -fopenmp --offload-arch=native test.c``:
|
|
|
|
.. code-block:: shell
|
|
|
|
$ opt -disable-output test-openmp-nvptx64-nvidia-cuda-sm_70.bc \
|
|
-pass-remarks=kernel-info -passes=kernel-info
|
|
|
|
When specifying an LLVM pass pipeline on the command line, ``kernel-info`` still
|
|
runs at the end of LTO by default. ``-no-kernel-info-end-lto`` disables that
|
|
behavior so you can position ``kernel-info`` explicitly:
|
|
|
|
.. code-block:: shell
|
|
|
|
$ clang -O2 -g -fopenmp --offload-arch=native test.c -foffload-lto \
|
|
-Rpass=kernel-info \
|
|
-Xoffload-linker --lto-newpm-passes='lto<O2>'
|
|
|
|
$ clang -O2 -g -fopenmp --offload-arch=native test.c -foffload-lto \
|
|
-Rpass=kernel-info -mllvm -no-kernel-info-end-lto \
|
|
-Xoffload-linker --lto-newpm-passes='module(kernel-info),lto<O2>'
|
|
|
|
$ opt -disable-output test-openmp-nvptx64-nvidia-cuda-sm_70.bc \
|
|
-pass-remarks=kernel-info \
|
|
-passes='lto<O2>'
|
|
|
|
$ opt -disable-output test-openmp-nvptx64-nvidia-cuda-sm_70.bc \
|
|
-pass-remarks=kernel-info -no-kernel-info-end-lto \
|
|
-passes='module(kernel-info),lto<O2>'
|