Author: Joseph Huber Date: 2023-01-23T07:15:54-06:00 New Revision: 6f96dadb7a5b1593a0b6348539f66f7e945f2561
URL: https://github.com/llvm/llvm-project/commit/6f96dadb7a5b1593a0b6348539f66f7e945f2561 DIFF: https://github.com/llvm/llvm-project/commit/6f96dadb7a5b1593a0b6348539f66f7e945f2561.diff LOG: [Clang][NFC] Remove documentation and mentions of deleted tools Summary: These tools were deleted since LLVM 15. They are no longer present so we should damnatio memoriae. Added: Modified: clang/lib/Driver/ToolChains/CommonArgs.cpp Removed: clang/docs/ClangNvlinkWrapper.rst clang/docs/ClangOffloadWrapper.rst ################################################################################ diff --git a/clang/docs/ClangNvlinkWrapper.rst b/clang/docs/ClangNvlinkWrapper.rst deleted file mode 100644 index 4e2935b67811c..0000000000000 --- a/clang/docs/ClangNvlinkWrapper.rst +++ /dev/null @@ -1,57 +0,0 @@ -==================== -Clang Nvlink Wrapper -==================== - -.. contents:: - :local: - -.. _clang-nvlink-wrapper: - -Introduction -============ - -This tool works as a wrapper over the ``nvlink`` program. It is required -because ``nvlink`` does not support linking of archive files implicitly. It -transparently passes every input option and object to ``nvlink`` except archive -files. It reads each input archive file to extract the archived cubin files as -temporary files. These temporary (\*.cubin) files are passed to ``nvlink``. - -Use Case -======== - -During linking of heterogeneous device archive libraries with an OpenMP -program, the :doc:`ClangOffloadBundler` creates a device specific archive of -cubin files. Such an archive is then passed to this wrapper tool to extract -cubin files before passing to ``nvlink``. - -Working -======= - -**Inputs** - - A command line generated by the OpenMP-Clang driver targeting NVPTX, - containing a set of flags, cubin object files, and zero or more archive - files. - -Example:: - - clang-nvlink-wrapper main.cubin /tmp/libTest-nvptx-sm_50.a -o main-linked.out - -**Processing** - - 1. From each archive file extract all cubin files as temporary files and - store their names in a list, `CubinFiles`. - 2. Create a new command line, `NVLinkCommand`, such that - * Program is ``nvlink`` - * All input flags are transparently passed on as flags - * All input archive file are replaced with `CubinFiles` - 3. Execute NVLinkCommand - -:: - - 1. Extract (libTest-nvptx-sm_50.a) => /tmp/a.cubin /tmp/b.cubin - 2. nvlink -o a.out-openmp-nvptx64 main.cubin /tmp/a.cubin /tmp/b.cubin - -**Output** - - Output file generated by ``nvlink`` which links all cubin files. diff --git a/clang/docs/ClangOffloadWrapper.rst b/clang/docs/ClangOffloadWrapper.rst deleted file mode 100644 index 9865bad8748aa..0000000000000 --- a/clang/docs/ClangOffloadWrapper.rst +++ /dev/null @@ -1,223 +0,0 @@ -===================== -Clang Offload Wrapper -===================== - -.. contents:: - :local: - -.. _clang-offload-wrapper: - -Introduction -============ - -This tool is used in OpenMP offloading toolchain to embed device code objects -(usually ELF) into a wrapper host llvm IR (bitcode) file. The wrapper host IR -is then assembled and linked with host code objects to generate the executable -binary. See :ref:`image-binary-embedding-execution` for more details. - -Usage -===== - -This tool can be used as follows: - -.. code-block:: console - - $ clang-offload-wrapper -help - OVERVIEW: A tool to create a wrapper bitcode for offload target binaries. - Takes offload target binaries as input and produces bitcode file containing - target binaries packaged as data and initialization code which registers - target binaries in offload runtime. - USAGE: clang-offload-wrapper [options] <input files> - OPTIONS: - Generic Options: - --help - Display available options (--help-hidden for more) - --help-list - Display list of available options (--help-list-hidden for more) - --version - Display the version of this program - clang-offload-wrapper options: - -o <filename> - Output filename - --target=<triple> - Target triple for the output module - -Example -======= - -.. code-block:: console - - clang-offload-wrapper -target host-triple -o host-wrapper.bc gfx90a-binary.out - -.. _openmp-device-binary_embedding: - -OpenMP Device Binary Embedding -============================== - -Various structures and functions used in the wrapper host IR form the interface -between the executable binary and the OpenMP runtime. - -Enum Types ----------- - -:ref:`table-offloading-declare-target-flags` lists diff erent flag for -offloading entries. - - .. table:: Offloading Declare Target Flags Enum - :name: table-offloading-declare-target-flags - - +-------------------------+-------+------------------------------------------------------------------+ - | Name | Value | Description | - +=========================+=======+==================================================================+ - | OMP_DECLARE_TARGET_LINK | 0x01 | Mark the entry as having a 'link' attribute (w.r.t. link clause) | - +-------------------------+-------+------------------------------------------------------------------+ - | OMP_DECLARE_TARGET_CTOR | 0x02 | Mark the entry as being a global constructor | - +-------------------------+-------+------------------------------------------------------------------+ - | OMP_DECLARE_TARGET_DTOR | 0x04 | Mark the entry as being a global destructor | - +-------------------------+-------+------------------------------------------------------------------+ - -Structure Types ---------------- - -:ref:`table-tgt_offload_entry`, :ref:`table-tgt_device_image`, and -:ref:`table-tgt_bin_desc` are the structures used in the wrapper host IR. - - .. table:: __tgt_offload_entry structure - :name: table-tgt_offload_entry - - +---------+------------+------------------------------------------------------------------------------------+ - | Type | Identifier | Description | - +=========+============+====================================================================================+ - | void* | addr | Address of global symbol within device image (function or global) | - +---------+------------+------------------------------------------------------------------------------------+ - | char* | name | Name of the symbol | - +---------+------------+------------------------------------------------------------------------------------+ - | size_t | size | Size of the entry info (0 if it is a function) | - +---------+------------+------------------------------------------------------------------------------------+ - | int32_t | flags | Flags associated with the entry (see :ref:`table-offloading-declare-target-flags`) | - +---------+------------+------------------------------------------------------------------------------------+ - | int32_t | reserved | Reserved, to be used by the runtime library. | - +---------+------------+------------------------------------------------------------------------------------+ - - .. table:: __tgt_device_image structure - :name: table-tgt_device_image - - +----------------------+--------------+----------------------------------------+ - | Type | Identifier | Description | - +======================+==============+========================================+ - | void* | ImageStart | Pointer to the target code start | - +----------------------+--------------+----------------------------------------+ - | void* | ImageEnd | Pointer to the target code end | - +----------------------+--------------+----------------------------------------+ - | __tgt_offload_entry* | EntriesBegin | Begin of table with all target entries | - +----------------------+--------------+----------------------------------------+ - | __tgt_offload_entry* | EntriesEnd | End of table (non inclusive) | - +----------------------+--------------+----------------------------------------+ - - .. table:: __tgt_bin_desc structure - :name: table-tgt_bin_desc - - +----------------------+------------------+------------------------------------------+ - | Type | Identifier | Description | - +======================+==================+==========================================+ - | int32_t | NumDeviceImages | Number of device types supported | - +----------------------+------------------+------------------------------------------+ - | __tgt_device_image* | DeviceImages | Array of device images (1 per dev. type) | - +----------------------+------------------+------------------------------------------+ - | __tgt_offload_entry* | HostEntriesBegin | Begin of table with all host entries | - +----------------------+------------------+------------------------------------------+ - | __tgt_offload_entry* | HostEntriesEnd | End of table (non inclusive) | - +----------------------+------------------+------------------------------------------+ - -Global Variables ----------------- - -:ref:`table-global-variables` lists various global variables, along with their -type and their explicit ELF sections, which are used to store device images and -related symbols. - - .. table:: Global Variables - :name: table-global-variables - - +--------------------------------+---------------------+-------------------------+---------------------------------------------------+ - | Variable | Type | ELF Section | Description | - +================================+=====================+=========================+===================================================+ - | __start_omp_offloading_entries | __tgt_offload_entry | .omp_offloading_entries | Begin symbol for the offload entries table. | - +--------------------------------+---------------------+-------------------------+---------------------------------------------------+ - | __stop_omp_offloading_entries | __tgt_offload_entry | .omp_offloading_entries | End symbol for the offload entries table. | - +--------------------------------+---------------------+-------------------------+---------------------------------------------------+ - | __dummy.omp_offloading.entry | __tgt_offload_entry | .omp_offloading_entries | Dummy zero-sized object in the offload entries | - | | | | section to force linker to define begin/end | - | | | | symbols defined above. | - +--------------------------------+---------------------+-------------------------+---------------------------------------------------+ - | .omp_offloading.device_image | __tgt_device_image | .omp_offloading_entries | ELF device code object of the first image. | - +--------------------------------+---------------------+-------------------------+---------------------------------------------------+ - | .omp_offloading.device_image.N | __tgt_device_image | .omp_offloading_entries | ELF device code object of the (N+1)th image. | - +--------------------------------+---------------------+-------------------------+---------------------------------------------------+ - | .omp_offloading.device_images | __tgt_device_image | .omp_offloading_entries | Array of images. | - +--------------------------------+---------------------+-------------------------+---------------------------------------------------+ - | .omp_offloading.descriptor | __tgt_bin_desc | .omp_offloading_entries | Binary descriptor object (see details below). | - +--------------------------------+---------------------+-------------------------+---------------------------------------------------+ - - -Binary Descriptor for Device Images -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -This object is passed to the offloading runtime at program startup and it -describes all device images available in the executable or shared library. It -is defined as follows: - -.. code-block:: console - - __attribute__((visibility("hidden"))) - extern __tgt_offload_entry *__start_omp_offloading_entries; - __attribute__((visibility("hidden"))) - extern __tgt_offload_entry *__stop_omp_offloading_entries; - static const char Image0[] = { <Bufs.front() contents> }; - ... - static const char ImageN[] = { <Bufs.back() contents> }; - static const __tgt_device_image Images[] = { - { - Image0, /*ImageStart*/ - Image0 + sizeof(Image0), /*ImageEnd*/ - __start_omp_offloading_entries, /*EntriesBegin*/ - __stop_omp_offloading_entries /*EntriesEnd*/ - }, - ... - { - ImageN, /*ImageStart*/ - ImageN + sizeof(ImageN), /*ImageEnd*/ - __start_omp_offloading_entries, /*EntriesBegin*/ - __stop_omp_offloading_entries /*EntriesEnd*/ - } - }; - static const __tgt_bin_desc BinDesc = { - sizeof(Images) / sizeof(Images[0]), /*NumDeviceImages*/ - Images, /*DeviceImages*/ - __start_omp_offloading_entries, /*HostEntriesBegin*/ - __stop_omp_offloading_entries /*HostEntriesEnd*/ - }; - -Global Constructor and Destructor ---------------------------------- - -Global constructor (``.omp_offloading.descriptor_reg()``) registers the library -of images with the runtime by calling ``__tgt_register_lib()`` function. The -cunstructor is explicitly defined in ``.text.startup`` section. -Similarly, global destructor -(``.omp_offloading.descriptor_unreg()``) calls ``__tgt_unregister_lib()`` for -the unregistration and is also defined in ``.text.startup`` section. - -.. _image-binary-embedding-execution: - -Image Binary Embedding and Execution for OpenMP -=============================================== - -For each offloading target, device ELF code objects are generated by ``clang``, -``opt``, ``llc``, and ``lld`` pipeline. These code objects are passed to the -``clang-offload-wrapper``. - - * At compile time, the ``clang-offload-wrapper`` tool takes the following - actions: - - * It embeds the ELF code objects for the device into the host code (see - :ref:`openmp-device-binary_embedding`). - - * At execution time: - - * The global constructor gets run and it registers the device image. diff --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp b/clang/lib/Driver/ToolChains/CommonArgs.cpp index ba7807c799482..822a60c151ff0 100644 --- a/clang/lib/Driver/ToolChains/CommonArgs.cpp +++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp @@ -1961,8 +1961,7 @@ bool tools::SDLSearch(const Driver &D, const llvm::opt::ArgList &DriverArgs, /// Search if a user provided archive file lib<libname>.a exists in any of /// the library paths. If so, add a new command to clang-offload-bundler to /// unbundle this archive and create a temporary device specific archive. Name -/// of this SDL is passed to the llvm-link (for amdgcn) or to the -/// clang-nvlink-wrapper (for nvptx) commands by the driver. +/// of this SDL is passed to the llvm-link tool. bool tools::GetSDLFromOffloadArchive( Compilation &C, const Driver &D, const Tool &T, const JobAction &JA, const InputInfoList &Inputs, const llvm::opt::ArgList &DriverArgs, @@ -2086,17 +2085,6 @@ void tools::AddStaticDeviceLibsLinking(Compilation &C, const Tool &T, Arch, Target, isBitCodeSDL, postClangLink); } -// Wrapper function used for post clang linking of bitcode SDLS for nvptx by -// the CUDA toolchain. -void tools::AddStaticDeviceLibsPostLinking(const Driver &D, - const llvm::opt::ArgList &DriverArgs, - llvm::opt::ArgStringList &CC1Args, - StringRef Arch, StringRef Target, - bool isBitCodeSDL, bool postClangLink) { - AddStaticDeviceLibs(nullptr, nullptr, nullptr, nullptr, D, DriverArgs, - CC1Args, Arch, Target, isBitCodeSDL, postClangLink); -} - // User defined Static Device Libraries(SDLs) can be passed to clang for // offloading GPU compilers. Like static host libraries, the use of a SDL is // specified with the -l command line option. The primary diff erence between @@ -2109,11 +2097,9 @@ void tools::AddStaticDeviceLibsPostLinking(const Driver &D, // compilation. For AMDGPU, these libraries are linked one time // during the application link phase. // -// * Machine-code SDLs: They are archive files. For NVPTX, the archive members -// contain cubin for Nvidia GPUs and are linked one time during the -// link phase by the CUDA SDK linker called nvlink. For AMDGPU, the -// process for machine code SDLs is still in development. But they -// will be linked by the LLVM tool lld. +// * Machine-code SDLs: They are archive files. For AMDGPU, the process for +// machine code SDLs is still in development. But they will be linked +// by the LLVM tool lld. // // * Bundled objects that contain both host and device codes: Bundled objects // may also contain library code compiled from source. For NVPTX, the @@ -2178,10 +2164,9 @@ void tools::AddStaticDeviceLibs(Compilation *C, const Tool *T, } // The search stops as soon as an SDL file is found. The driver then provides - // the full filename of the SDL to the llvm-link or clang-nvlink-wrapper - // command. If no SDL is found after searching each LINKPATH with - // SEARCH-ORDER, it is possible that an archive file lib<libname>.a exists - // and may contain bundled object files. + // the full filename of the SDL to the llvm-link command. If no SDL is found + // after searching each LINKPATH with SEARCH-ORDER, it is possible that an + // archive file lib<libname>.a exists and may contain bundled object files. for (auto SDLName : SDLNames) { // This is the only call to SDLSearch if (!SDLSearch(D, DriverArgs, CC1Args, LibraryPaths, SDLName, Arch, Target, _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits