Commit Graph

10 Commits

Author SHA1 Message Date
Alan Baker
21427b8eb8 libclc: Add clspv target to libclc
Add clspv as a new target for libclc. clspv is an open-source compiler that compiles OpenCL C to Vulkan SPIR-V. Compiles for the spir target.

The clspv target differs from the the spirv target in the following ways:
* fma is modified to use uint2 instead of ulong for mantissas. This results in lower performance fma, but provides a implementation that can be used on more Vulkan devices where 64-bit integer support is less common.
* Use of a software implementation of nextafter because the generic implementation depends on nextafter being a defined builtin function for which clspv has no definition.
* Full optimization of the library (-O3) and no conversion to SPIR-V

This library is close to what would be produced by running opt -O3 < builtins.opt.spirv-mesa3d-.bc > builtins.opt.clspv--.bc and continuing the build from that point.

Reviewer: jvesely

Differential Revision: https://reviews.llvm.org/D94013
2021-03-04 00:19:10 -05:00
Aaron Puchert
1c1a810558 libclc: Use find_package to find Python 3 and require it
The script's shebang wants Python 3, so we use FindPython3. The
original code didn't work when an unversioned python was not available.
This is explicitly allowed in PEP 394. ("Distributors may choose to set
the behavior of the python command as follows: python2, python3, not
provide python command, allow python to be configurable by an end user
or a system administrator.")

Also I think it's actually required, so let the configuration fail if we
can't find it.

Lastly remove the shebang, since the script is only run via interpreter
and doesn't have the executable bit set anyway.

Reviewed By: jvesely

Differential Revision: https://reviews.llvm.org/D88366
2020-10-01 22:31:33 +02:00
Dave Airlie
c37145cab1 libclc: Add Mesa/SPIR-V target
Add targets to emit SPIR-V targeted to Mesa's OpenCL support, using
SPIR-V 1.1.

Substantially based on Dave Airlie's earlier work.

libclc: spirv: remove step/smoothstep apis not defined for SPIR-V

libclc: disable inlines for SPIR-V builds

Reviewed By: jvesely, tstellar, jenatali

Differential Revision: https://reviews.llvm.org/D77589
2020-08-17 14:01:46 -07:00
Louis Dionne
afa1afd410 [CMake] Bump CMake minimum version to 3.13.4
This upgrade should be friction-less because we've already been ensuring
that CMake >= 3.13.4 is used.

This is part of the effort discussed on llvm-dev here:

  http://lists.llvm.org/pipermail/llvm-dev/2020-April/140578.html

Differential Revision: https://reviews.llvm.org/D78648
2020-07-22 14:25:07 -04:00
Matt Arsenault
cf4d4e366a libclc: Compile with -nostdlib
This fixes a build error when compiling for amdgcn-amd-amdhsa, which
defaults to trying to link bitcode libraries.
2020-05-28 10:41:31 -04:00
Tom Stellard
174c41defc libclc: Pass system libraries to the linker after llvm libraries
Summary:
The llvm libraries depend on the symbols in the system libaries, so
the system libraries need to be added after.

Reviewers: jvesely

Reviewed By: jvesely

Subscribers: mgorny, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D78535
2020-04-29 15:34:54 -07:00
Daniel Stone
e6bb1d69ec libclc: Fix LLVM library linking on Windows
CMake requires library lists on Windows to be split by semi-colons,
rather than the spaces we get from llvm-config. Fix this by a
substitution on Windows.

reviewer: jvesely
Differential Revision: https://reviews.llvm.org/D77162
2020-04-14 10:03:27 -04:00
Jan Vesely
814fb658ca libclc: cmake configure should depend on file list
This makes sure targets are rebuilt if a file is added or removed.
Reviewer: tstellar
Differential Revision: https://reviews.llvm.org/D74662
2020-02-25 04:43:14 -05:00
Jan Vesely
e25db17104 cmake: Install libraries to DATADIR from GNUInstallDirs
This moves default installation location to /usr/share to match libclc.pc.
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewer: Tom Stellard

llvm-svn: 350565
2019-01-07 20:20:37 +00:00
Jan Vesely
2ce1d090c2 Add cmake build system
Add cmake support for CLC and ll asm language,
the latter includes clang preprocessing stage.
Add ctests to check for external function calls.

v2: fix typos, style

Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Acked-by: Aaron Watry <awatry@gmail.com>
Tested-by: Aaron Watry <awatry@gmail.com>
Acked-by: Vedran Miletić <vedran@miletic.net>
llvm-svn: 347667
2018-11-27 16:07:19 +00:00