Files
RedBear-OS/local/recipes/dev/libclc/source/www/index.html
T
vasilito f26371ae30 recipes: add libclc as a local Red Bear OS project (Cat 1)
libclc was vendored at recipes/dev/llvm21/source/libclc/ as a
build artifact of the llvm21 fork. This promoted it from an
implicit Mesa dependency (the CLC bitcode Mesa consumes) to a
first-class local project, mirroring how tlc, redbear-*, cub, etc.
are organized per local/AGENTS.md.

Local layout follows the existing in-house pattern:
  recipes/dev/libclc          -> ../../local/recipes/dev/libclc
  local/recipes/dev/libclc/recipe.toml
  local/recipes/dev/libclc/source/   (vendored from llvm-project)

The recipe builds libclc as a host-side CMake project using the
cookbook-sysroot clang21 binary (not the cross-compiler) to compile
OpenCL kernels to .bc bitcode. Output targets are amdgcn, amdgcn-amdhsa,
r600, generic, and spirv — the union that Mesa's clc tool consumes
for the iris/radeonsi/llvmpipe drivers. ptx-nvidiacl and clspv are
excluded because they don't map onto any Mesa hardware driver.

The recipe also wires the cookbook's native-cmake generation with
an override that points CMAKE_C_COMPILER etc. at the cookbook
sysroot's clang-21 binary. This is needed because libclc must
run on the build host (output is bitcode, not a Redox binary),
and the cookbook's default cross-toolchain would link the build
against relibc instead of host glibc.

libclc.pc is installed at usr/lib/pkgconfig/, satisfying Mesa's
dependency('libclc') lookup. The .bc files are installed under
usr/share/clc/, which is what the libclc.pc libexecdir pointer
(libexecdir=<prefix>/share/clc) expects.

This is the prerequisite for re-enabling iris, radeonsi, and the
Intel Vulkan driver in the Mesa recipe (Phase 4-6 of
local/docs/3D-DRIVER-PLAN.md). With libclc available in the
cross-sysroot, mesa's meson '-Dwith_clc -> dependency(libclc)'
resolves and the gallium drivers compile.
2026-07-25 14:29:34 +09:00

54 lines
1.5 KiB
HTML

<html>
<head>
<title>libclc</title>
</head>
<body>
<h1>libclc</h1>
<p>
libclc is an open source, BSD/MIT dual licensed
implementation of the library requirements of the
OpenCL C programming language, as specified by the <a
href="https://www.khronos.org/registry/OpenCL/specs/opencl-1.1.pdf">OpenCL
1.1 Specification</a>. The following sections of the specification
impose library requirements:
<ul>
<li>6.1: Supported Data Types
<li>6.2.3: Explicit Conversions
<li>6.2.4.2: Reinterpreting Types Using as_type() and as_typen()
<li>6.9: Preprocessor Directives and Macros
<li>6.11: Built-in Functions
<li>9.3: Double Precision Floating-Point
<li>9.4: 64-bit Atomics
<li>9.5: Writing to 3D image memory objects
<li>9.6: Half Precision Floating-Point
</ul>
</p>
<p>
libclc is intended to be used with the <a href="https://clang.llvm.org/">Clang</a>
compiler's OpenCL frontend.
</p>
<p>
libclc is designed to be portable and extensible. To this end,
it provides generic implementations of most library requirements,
allowing the target to override the generic implementation at the
granularity of individual functions.
</p>
<p>
libclc currently supports the AMDGCN, and R600 and NVPTX targets, but
support for more targets is welcome.
</p>
<h2>Download</h2>
<tt>git clone https://github.com/llvm/llvm-project.git</tt> (<a href="https://github.com/llvm/llvm-project/tree/libclc">View sources</a>)
<h2>Discourse forums</h2>
<a href="https://discourse.llvm.org/c/runtimes/opencl/65">Runtimes - OpenCL category</a>
</body>
</html>