aboutsummaryrefslogtreecommitdiff
path: root/libclc
AgeCommit message (Collapse)AuthorFilesLines
2024-06-06[AMDGPU] Add a new target gfx1152 (#94534)Shilei Tian1-1/+1
2024-05-17libclc: remove __attribute__((assume)) for clspv targets (#92126)Romaric Jodin1-2/+1
Instead add a proper attribute in clang, and add convert it to function metadata to keep the information in the IR. The goal is to remove the dependency on __attribute__((assume)) that should have not be there in the first place. Ref https://github.com/llvm/llvm-project/pull/84934
2024-05-14[libclc] Clarify condition expression (NFC)Youngsuk Kim1-1/+1
Closes #91188
2024-05-04Add clarifying parenthesis around non-trivial conditions in ternary ↵luolent1-1/+1
expressions. (#90391) Fixes [#85868](https://github.com/llvm/llvm-project/issues/85868) Parenthesis are added as requested on ternary operators with non trivial conditions. I used this [precedence table](https://en.cppreference.com/w/cpp/language/operator_precedence) for reference, to make sure we get the expected behavior on each change.
2024-04-24[libclc] Use a response file when building on Windows (#89756)Fraser Cormack1-2/+17
We've recently seen the libclc llvm-link invocations become so long that they exceed the character limits on certain platforms. Using a 'response file' should solve this by offloading the list of inputs into a separate file, and using special syntax to pass it to llvm-link. Note that neither the response file nor syntax aren't specific to Windows but we restrict it to that platform regardless. We have the option of expanding it to other platforms in the future.
2024-04-22[libclc] Fix build with Unix Makefiles (#89147)Fraser Cormack1-0/+4
Commit #87622 broke the build. Ninja was happy with creating the output directories as necessary, but Unix Makefiles isn't. Ensure they are always created. Fixes #88626.
2024-04-18[libclc] Provide a more helpful error when tools are missingFraser Cormack1-4/+5
2024-04-18[libclc] Allow building with pre-built toolsFraser Cormack1-6/+27
Building the libclc project in-tree with debug tools can be very slow. This commit adds an option for a user to specify a dierctory from which to import (e.g., release-built) tools. All tools required by the project must be imported from the same location, for simplicity. Original patch downstream authored by @jchlanda.
2024-04-18[libclc] Clarify option help messageFraser Cormack1-1/+1
This should make it more obvious it applies only to libclc.
2024-04-18[libclc] Convert llvm-spirv to imported executableFraser Cormack1-3/+8
This tool now behaves like the others, for consistency.
2024-04-16[libclc] Improve clarity of CMake foreach. NFC.Fraser Cormack1-3/+3
Should be a bit easier to read.
2024-04-16[libclc] Fix dependencies between targetsFraser Cormack1-5/+6
We need file-level - not target-level - dependencies for these custom commands to re-trigger when their dependencies change.
2024-04-16[libclc] Give built bytecode objects a .bc extension. NFCFraser Cormack1-2/+2
2024-04-11[libclc] Refactor build system to allow in-tree builds (#87622)Fraser Cormack11-312/+319
The previous build system was adding custom "OpenCL" and "LLVM IR" languages in CMake to build the builtin libraries. This was making it harder to build in-tree because the tool binaries needed to be present at configure time. This commit refactors the build system to use custom commands to build the bytecode files one by one, and link them all together into the final bytecode library. It also enables in-tree builds by aliasing the clang/llvm-link/etc. tool targets to internal targets, which are imported from the LLVM installation directory when building out of tree. Diffing (with llvm-diff) all of the final bytecode libraries in an out-of-tree configuration against those built using the current tip system shows no changes. Note that there are textual changes to metadata IDs which confuse regular diff, and that llvm-diff 14 and below may show false-positives. This commit also removes a file listed in one of the SOURCEs which didn't exist and which was preventing the use of ENABLE_RUNTIME_SUBNORMAL when configuring CMake.
2024-04-08[libclc] Fix more spirv build dependenciesFraser Cormack1-1/+1
The last fix was incomplete.
2024-04-08[libclc] Fix spirv build dependenciesFraser Cormack1-1/+1
These were accidentally broken in 61efea7. Thanks to @mgorny and @rjodinchr for spotting this.
2024-04-08[libclc] Restore linking against dynamic libLLVM for out-of-tree buildsFraser Cormack1-1/+5
This fixes a regression where building against an installation without the static libraries would fail. This just reinstates the old behaviour for out-of-tree builds, assuming that in-tree builds (which still aren't officially supported) will have the static libraries available. We can refine this as we move towards supporting in-tree builds.
2024-04-04[libclc] Use VERSION_GREATER_EQUAL where appropriate. NFCFraser Cormack1-7/+7
This was added in CMake 3.7, which might explain why it wasn't used before. Also reformat a couple of comments.
2024-04-04[libclc] Fix a couple of issues preventing in-tree builds (#87505)Fraser Cormack1-46/+56
libclc is mentioned in the list of LLVM_ENABLE_PROJECTS but it isn't actually possible to build it in-tree for various reasons. Users currently have to build it via LLVM_ENABLE_EXTERNAL_PROJECTS, which isn't very well documented. We can't properly build in-tree because the current system needs to "see" clang and other tools at CMake configuration time. The general idea is that we could fix this in the future by moving the compilation and linking of bitcode libraries to custom commands, which would remove the dependency on CMake configuration and would allow us to build libclc after clang and other tools are built in-tree. Since that's a bigger change, it is being left for later. Note that with this commit it's *still* not possible to properly build in-tree - this commit just fixes a few little things that are in the way. We are now able to build in-tree in the sense that it can be built as a regular LLVM sub-project, but the tools it uses to compile the libraries are still picked up from a pre-existing installation of LLVM, and not from tools built during the same build as libclc. The things fixed by this commit include: * Its use of CMAKE_SOURCE_DIR (i.e., assuming it was the top-level project) * These have been converted to PROJECT_SOURCE_DIR - should have no consequences for out-of-tree builds. * Its prepare_builtins tool insisting on linking against the dynamic LLVM.so. * This has been turned from an "llvm executable" into an "llvm utility" which links against the static libraries. * It was also missing a link component for the IRReader library. * Assuming an output path for its builtin libraries (dependent on the working directory) * This has been changed to query CMake for the library target's output file. * The spirv-mesa3d and spirv64-mesa3d targets were enabled by default (or when asking to build 'all' libclc targets), when they require llvm-spirv as an external dependency. * They are now only built when the user explicitly asks for them, or when llvm-spirv is available and the user asks for 'all'.
2024-03-28[libclc] Track dependencies through dependency files (#86965)Fraser Cormack1-0/+1
This commit fixes the problem of missing build dependencies between libclc source files and their various includes (namely headers and .inc files). We would like to do this with compiler-generated dependency files because then the dependencies are accurate and there are no false positives, leading to unnecessary rebuilds. This is how regular C/C++ dependencies are usually tracked by CMake. Note that this variable is an internal API so is not guaranteed to work, but then again *all* of CMake's support for new languages (which we use for CLC/LL languages) is an internal API. On balance this change is probably worth it due to how minimally invasive it is. It should work with all supported compilers and CMake generators.
2024-03-28[libclc] Make CMake messages better fit into LLVM (#86945)Fraser Cormack1-10/+9
The libclc project is currently only properly supported as an external project. However, when trying to get it to also build in-tree, the CMake configuration messages it outputs stand out amongst the rest of the LLVM projects and sub-projects. This commit makes all messages clear that they belong to the libclc project, as well as turning them into 'STATUS' messages where appropriate.
2024-03-18[libclc] Convert tabs to spaces in CMake (#85634)Fraser Cormack3-222/+206
Having a mix of tabs and spaces makes the diff of any changes to the build system noisier than necessary. This commit unifies them to two spaces. This includes some minor cosmetic changes such as with joining things on one line where appropriate. There are other files in libclc which have tabs but those haven't been touched at this time. Those could come at another time if desired, though they might be more contentious as the project isn't clang-formatted at all and so that might invite larger discussions around formatting.
2024-03-14libclc: clspv: update gen_convert.cl for clspv (#66902)Romaric Jodin2-28/+116
Add a clspv switch in gen_convert.cl This is needed as Vulkan SPIR-V does not respect the assumptions needed to have the generic convert.cl compliant on many platforms. It is needed because of the conversion of TYPE_MAX and TYPE_MIN. Depending on the platform the behaviour can vary, but most of them just do not convert correctly those 2 values. Because of that, we also need to avoid having explicit function for simple conversions because it allows llvm to optimise the code, thus removing some of the added checks that are in fact needed.
2024-01-22libclc: add missing AMD gfx symlinks (#78884)Zoltán Böszörményi1-11/+9
Fixes #44186 --------- Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com>
2024-01-09libclc: generic: add half implementation for erf/erfc (#66901)Romaric Jodin2-0/+24
libclc does not have a half implementation for erf/erfc Add one based on the float implementation by extending the input and truncating the output.
2023-10-03[LIBCLC] Teach prepare-builtins how to handle text based IR (#66993)Jakub Chlanda1-15/+22
2023-08-31libclc: Fix signed integer underflow in abs_diffFraser Cormack1-1/+3
We noticed this same issue in our own implementation of abs_diff, and the same issue also came up in the abs_diff reference function in the OpenCL CTS. Reviewed By: rjodinchr Differential Revision: https://reviews.llvm.org/D159275
2023-05-27Reland "[CMake] Bumps minimum version to 3.20.0.Mark de Wever1-1/+1
This reverts commit d763c6e5e2d0a6b34097aa7dabca31e9aff9b0b6. Adds the patch by @hans from https://github.com/llvm/llvm-project/issues/62719 This patch fixes the Windows build. d763c6e5e2d0a6b34097aa7dabca31e9aff9b0b6 reverted the reviews D144509 [CMake] Bumps minimum version to 3.20.0. This partly undoes D137724. This change has been discussed on discourse https://discourse.llvm.org/t/rfc-upgrading-llvms-minimum-required-cmake-version/66193 Note this does not remove work-arounds for older CMake versions, that will be done in followup patches. D150532 [OpenMP] Compile assembly files as ASM, not C Since CMake 3.20, CMake explicitly passes "-x c" (or equivalent) when compiling a file which has been set as having the language C. This behaviour change only takes place if "cmake_minimum_required" is set to 3.20 or newer, or if the policy CMP0119 is set to new. Attempting to compile assembly files with "-x c" fails, however this is workarounded in many cases, as OpenMP overrides this with "-x assembler-with-cpp", however this is only added for non-Windows targets. Thus, after increasing cmake_minimum_required to 3.20, this breaks compiling the GNU assembly for Windows targets; the GNU assembly is used for ARM and AArch64 Windows targets when building with Clang. This patch unbreaks that. D150688 [cmake] Set CMP0091 to fix Windows builds after the cmake_minimum_required bump The build uses other mechanism to select the runtime. Fixes #62719 Reviewed By: #libc, Mordante Differential Revision: https://reviews.llvm.org/D151344
2023-05-25[NFC][Py Reformat] Reformat python files in the rest of the dirsTobias Hieta1-219/+313
This is an ongoing series of commits that are reformatting our Python code. This catches the last of the python files to reformat. Since they where so few I bunched them together. Reformatting is done with `black`. If you end up having problems merging this commit because you have made changes to a python file, the best way to handle that is to run git checkout --ours <yourfile> and then reformat it with black. If you run into any problems, post to discourse about it and we will try to help. RFC Thread below: https://discourse.llvm.org/t/rfc-document-and-standardize-python-code-style Reviewed By: jhenderson, #libc, Mordante, sivachandra Differential Revision: https://reviews.llvm.org/D150784
2023-05-22[libclc] Fix linking against libLLVMSupportThomas Debesse1-0/+1
Fixes https://github.com/llvm/llvm-project/issues/62018.
2023-05-17Revert "Reland "[CMake] Bumps minimum version to 3.20.0.""Nico Weber1-1/+1
This reverts commit 65429b9af6a2c99d340ab2dcddd41dab201f399c. Broke several projects, see https://reviews.llvm.org/D144509#4347562 onwards. Also reverts follow-up commit "[OpenMP] Compile assembly files as ASM, not C" This reverts commit 4072c8aee4c89c4457f4f30d01dc9bb4dfa52559. Also reverts fix attempt "[cmake] Set CMP0091 to fix Windows builds after the cmake_minimum_required bump" This reverts commit 7d47dac5f828efd1d378ba44a97559114f00fb64.
2023-05-13Reland "[CMake] Bumps minimum version to 3.20.0."Mark de Wever1-1/+1
The owner of the last two failing buildbots updated CMake. This reverts commit e8e8707b4aa6e4cc04c0cffb2de01d2de71165fc.
2023-05-09libclc: clspv: fix fma, add vstore and fix inlining issuesKévin Petit6-124/+298
https://reviews.llvm.org/D147773 Patch by Romaric Jodin <rjodin@google.com>
2023-05-06Revert "Reland "[CMake] Bumps minimum version to 3.20.0.""Mark de Wever1-1/+1
Unfortunatly not all buildbots are updated. This reverts commit ffb807ab5375b3f78df198dc5d4302b3b552242f.
2023-05-06Reland "[CMake] Bumps minimum version to 3.20.0."Mark de Wever1-1/+1
All build bots should be updated now. This reverts commit 44d38022ab29a3156349602733b3459df5beef93.
2023-04-15Revert "Revert "Revert "[CMake] Bumps minimum version to 3.20.0."""Mark de Wever1-1/+1
This reverts commit 1ef4c3c859728008cf707cad8d67f45ae5070ae1. Two buildbots still haven't been updated.
2023-04-15Revert "Revert "[CMake] Bumps minimum version to 3.20.0.""Mark de Wever1-1/+1
This reverts commit 92523a35a827539db8557bbc3ecab7f9ea3f6ade. Reland to see whether CIs are updated.
2023-03-18Revert "Reland "[CMake] Bumps minimum version to 3.20.0.""Mark de Wever1-1/+1
This reverts commit a72165e5df59032cdd54dcb18155f2630d73abd1. Some buildbots have not been updated yet.
2023-03-18Reland "[CMake] Bumps minimum version to 3.20.0."Mark de Wever1-1/+1
This reverts commit 92523a35a827539db8557bbc3ecab7f9ea3f6ade. Test whether all CI runners are updated.
2023-03-04Revert "[CMake] Bumps minimum version to 3.20.0."Mark de Wever1-1/+1
Some build bots have not been updated to the new minimal CMake version. Reverting for now and ping the buildbot owners. This reverts commit 44c6b905f8527635e49bb3ea97dea315f92d38ec.
2023-03-04[CMake] Bumps minimum version to 3.20.0.Mark de Wever1-1/+1
This partly undoes D137724. This change has been discussed on discourse https://discourse.llvm.org/t/rfc-upgrading-llvms-minimum-required-cmake-version/66193 Note this does not remove work-arounds for older CMake versions, that will be done in followup patches. Reviewed By: mehdi_amini, MaskRay, ChuanqiXu, to268, thieta, tschuett, phosek, #libunwind, #libc_vendors, #libc, #libc_abi, sivachandra, philnik, zibi Differential Revision: https://reviews.llvm.org/D144509
2023-02-14libclc: add clspv to targets exempt from alwaysinlineKévin Petit1-2/+4
https://reviews.llvm.org/D132362 Patch by: Aaron Greig <aaron.greig@codeplay.com>
2023-02-14libclc: add generated convert.cl to clspv/clspv64 targetsKévin Petit1-3/+3
https://reviews.llvm.org/D136772 Patch by: Aaron Greig <aaron.greig@codeplay.com>
2023-02-14libclc: add more generic implementations to clspv SOURCESKévin Petit1-2/+39
https://reviews.llvm.org/D134887 Patch by: Aaron Greig <aaron.greig@codeplay.com>
2023-02-13libclc: remove sqrt/rsqrt from clspv SOURCESKévin Petit1-3/+0
https://reviews.llvm.org/D134040 Patch by: Aaron Greig <aaron.greig@codeplay.com>
2023-01-27libclc: Fix building against an llvm build directoryTom Stellard1-1/+4
Reviewed By: thieta Differential Revision: https://reviews.llvm.org/D142718
2023-01-27libclc: Set CMAKE_CXX_STANDARD to 17 to match llvmTom Stellard1-0/+2
Reviewed By: thieta Differential Revision: https://reviews.llvm.org/D142720
2022-12-29libclc: Add parentheses to silence warningMatt Arsenault1-1/+1
Fixes #59209
2022-11-22libclc: Use cmake files instead of llvm-configTom Stellard2-72/+28
Reviewed By: mgorny Differential Revision: https://reviews.llvm.org/D137854
2022-08-31[libclc] Quote addition of CLC/LLAsm flagsNikita Popov1-2/+2
Otherwise cmake will insert a semicolon if flags are already set. Differential Revision: https://reviews.llvm.org/D131490