Skip to content

Create one bitcode library for AMD and NVPTX #13930

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 14 commits into from

Conversation

MartinWehking
Copy link
Contributor

@MartinWehking MartinWehking commented May 28, 2024

Enable compilation of libdevice for AMD by adding AMDGCN to macro
guarded code parts in libdevice for enabling e.g. standard library
math function.
Add compilation workflow to SYCLLibdevice.cmake for AMD.

Create single bitcode libraries for AMD and NVPTX by compiling each
libdev file into bitcode first, linking these together and running
opt on them.
Strip away metadata by reusing prepare_builtins from libclc and making
the resulting library architecture independent.

Remove NVPTX bundles from the libdev object files and remove any
unbundling action spawned by the Clang driver for the SYCL toolchain
when compiling for the NVPTX backend.

Make the driver link against the single bitcode libraries for AMD and
NVPTX for the SYCL toolchain when device library linkage is not
excluded.

Do not select builtin LLVM intrinsics for AMDGCN by default to ensure
that stdlib functions can be found when linking against libdevice.

Ensure that the clang tests check for the correctness of the new
clang driver actions and check if the driver still links the device
code against the itt device libraries when device library linkage has
been excluded.

Refactor SYCLLibdevice.cmake by creating functions and grouping
e.g. the same compilation flags for a filetype together in one variable.
Reuse these variables and call functions to remove redundancies.

Fix a compilation error of Intel math function libraries for MSVC
when targeting AMD. Include "device.h" before including "device_imf.hpp"
to avoid the inclusion of <type_traits>, which failed with a
redefinition of symbols error.

@MartinWehking MartinWehking force-pushed the devicelib-bitcode-lib branch from c320369 to 6e2cbb0 Compare May 29, 2024 12:57
@MartinWehking MartinWehking force-pushed the devicelib-bitcode-lib branch from 56d6923 to caa8999 Compare June 18, 2024 15:08
@MartinWehking MartinWehking force-pushed the devicelib-bitcode-lib branch from 93282e6 to b408ef7 Compare June 27, 2024 10:16
@MartinWehking MartinWehking force-pushed the devicelib-bitcode-lib branch from be9d4e0 to 5be595b Compare July 11, 2024 14:46
@MartinWehking MartinWehking force-pushed the devicelib-bitcode-lib branch from bf3aea8 to 57f4b8f Compare July 23, 2024 12:04
Martin Wehking added 11 commits August 9, 2024 16:40
Enable compilation of libdevice for AMD by adding AMDGCN to macro
guarded code parts in libdevice for enabling e.g. standard library
math function.
Add compilation workflow to SYCLLibdevice.cmake for AMD.

Create single bitcode libraries for AMD and NVPTX by compiling each
libdev file into bitcode first, linking these together and running
opt on them.
Strip away metadata by reusing prepare_builtins from libclc and making
the resulting library architecture independent.

Remove NVPTX bundles from the libdev object files and remove any
unbundling action spawned by the Clang driver for the SYCL toolchain
when compiling for the NVPTX backend.

Make the driver link against the single bitcode libraries for AMD and
NVPTX for the SYCL toolchain when device library linkage is not
excluded.

Ensure that the clang tests check for the correctness of the new
clang driver actions and check if the driver still links the device
code against the itt device libraries when device library linkage has
been excluded.

Refactor SYCLLibdevice.cmake by creating functions and grouping
e.g. the same compilation flags for a filetype together in one variable.
Reuse these variables and call functions to remove redundancies.

Fix a compilation error of Intel math function libraries for MSVC
when targeting AMD. Include "device.h" before including "device_imf.hpp"
to avoid the inclusion of <type_traits>, which failed with a
redefinition of symbols error.
Do not select builtin LLVM intrinsics for AMDGCN by default.

Previously, these intrinsics were selected by default and prevented
linkage of standard library math functions provided by libdevice.
Test whether SYCL Codegen does not emit llvm intrinsics for
amdgcn-amd-amdhsa and libdevice functions can be correctly linked
later on.
Add the optimizer flags again that were previously removed.
@MartinWehking
Copy link
Contributor Author

This has been superseded by #15048 and #15055

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant