SPIRV-LLVM-Translator-21.1.2

Introduction to SPIRV-LLVM-Translator

The SPIRV-LLVM-Translator package contains a library and utility for converting between LLVM IR and SPIR-V code. This package currently only supports the OpenCL/Compute version of SPIR-V.

This package is known to build and work properly using an LFS 12.4 platform.

Package Information

SPIRV-LLVM-Translator Dependencies

Required

libxml2-2.15.1, LLVM-21.1.2, and SPIRV-Tools-1.4.328.1

Installation of SPIRV-LLVM-Translator

Prepare SPIRV-LLVM-Translator by running the following commands:

cmake -B build -D CMAKE_INSTALL_PREFIX=/usr          \
      -D CMAKE_BUILD_TYPE=Release                    \
      -D BUILD_SHARED_LIBS=ON                        \
      -D CMAKE_SKIP_INSTALL_RPATH=ON                 \
      -D LLVM_EXTERNAL_SPIRV_HEADERS_SOURCE_DIR=/usr \
      -G Ninja

Now Build the package, issue:

ninja -C build

This package does not come with a test suite.

Now Install, as the root user:

ninja -C build install

Command Explanations

-D BUILD_SHARED_LIBS=ON: This parameter forces building shared versions of the libraries.

-D LLVM_EXTERNAL_SPIRV_HEADERS_SOURCE_DIR=/usr: This parameter allows the build system to use the version of SPIRV-Headers that should have been installed as a dependency of SPIRV-Tools, instead of redownloading an unnecessary copy of the headers.

Contents

Installed Programs: llvm-spirv
Installed Libraries: libLLVMSPIRVLib.so
Installed Directories: /usr/include/LLVMSPIRVLib

Short Descriptions

llvm-spirv

converts between LLVM IR and SPIR-V code

libLLVMSPIRVLib.so

contains functions that convert between LLVM IR and SPIR-V code