[all-commits] [llvm/llvm-project] 183b38: [libclc] Split off library build system into helpers

Fraser Cormack via All-commits all-commits at lists.llvm.org
Tue Oct 29 06:11:13 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 183b38eb2261164fdfd6b7deac002edf27a39fe7
      https://github.com/llvm/llvm-project/commit/183b38eb2261164fdfd6b7deac002edf27a39fe7
  Author: Fraser Cormack <fraser at codeplay.com>
  Date:   2024-10-29 (Tue, 29 Oct 2024)

  Changed paths:
    M libclc/CMakeLists.txt
    M libclc/cmake/modules/AddLibclc.cmake

  Log Message:
  -----------
  [libclc] Split off library build system into helpers

This splits off several key parts of the build system into utility
methods. This will be used in upcoming patches to help provide
additional sets of target-specific builtin libraries.

Running llvm-diff on the resulting LLVM bytecode binaries, and regular
diff on SPIR-V binaries, shows no differences before and after this
patch.


  Commit: b2bdd8bd39e90bfe3c66f6d5600468570a77ede6
      https://github.com/llvm/llvm-project/commit/b2bdd8bd39e90bfe3c66f6d5600468570a77ede6
  Author: Fraser Cormack <fraser at codeplay.com>
  Date:   2024-10-29 (Tue, 29 Oct 2024)

  Changed paths:
    M libclc/CMakeLists.txt
    A libclc/clc/include/clc/clcfunc.h
    A libclc/clc/include/clc/clctypes.h
    A libclc/clc/include/clc/geometric/clc_dot.h
    A libclc/clc/include/clc/geometric/clc_dot.inc
    A libclc/clc/include/clc/internal/clc.h
    A libclc/clc/lib/clspv/SOURCES
    A libclc/clc/lib/clspv/dummy.cl
    A libclc/clc/lib/clspv64
    A libclc/clc/lib/generic/SOURCES
    A libclc/clc/lib/generic/geometric/clc_dot.cl
    A libclc/clc/lib/spirv/SOURCES
    A libclc/clc/lib/spirv64/SOURCES
    M libclc/cmake/modules/AddLibclc.cmake
    R libclc/generic/include/clc/clcfunc.h
    R libclc/generic/include/clc/clctypes.h
    M libclc/generic/lib/geometric/dot.cl

  Log Message:
  -----------
  [libclc] Create an internal 'clc' builtins library

Some libclc builtins currently use internal builtins prefixed with
'__clc_' for various reasons, e.g., to avoid naming clashes.

This commit formalizes this concept by starting to isolate the
definitions of these internal clc builtins into a separate
self-contained bytecode library, which is linked into each target's
libclc OpenCL builtins before optimization takes place.

The goal of this step is to allow additional libraries of builtins
that provide entry points (or bindings) that are not written in OpenCL C
but still wish to expose OpenCL-compatible builtins. By moving the
implementations into a separate self-contained library, entry points can
share as much code as possible without going through OpenCL C.

The overall structure of the internal clc library is similar to the
current OpenCL structure, with SOURCES files and targets being able to
override the definitions of builtins as needed. The idea is that the
OpenCL builtins will begin to need fewer target-specific overrides, as
those will slowly move over to the clc builtins instead.

Another advantage of having a separate bytecode library with the CLC
implementations is that we can internalize the symbols when linking it
(separately), whereas currently the CLC symbols make it into the final
builtins library (and perhaps even the final compiled binary).

This patch starts of with 'dot' as it's relatively self-contained, as
opposed to most of the maths builtins which tend to pull in other
builtins.

We can also start to clang-format the builtins as we go, which should
help to modernize the codebase.


Compare: https://github.com/llvm/llvm-project/compare/88e23eb2cfad...b2bdd8bd39e9

To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list