[all-commits] [llvm/llvm-project] 8d27be: [OpenCL] Add global_device and global_host address...

Alexey Bader via All-commits all-commits at lists.llvm.org
Wed Jul 29 07:25:31 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 8d27be8dbaffce0519ac41173d51923fc2524b1b
      https://github.com/llvm/llvm-project/commit/8d27be8dbaffce0519ac41173d51923fc2524b1b
  Author: Alexey Bader <alexey.bader at intel.com>
  Date:   2020-07-29 (Wed, 29 Jul 2020)

  Changed paths:
    M clang/include/clang/AST/Type.h
    M clang/include/clang/Basic/AddressSpaces.h
    M clang/include/clang/Basic/Attr.td
    M clang/include/clang/Basic/AttrDocs.td
    M clang/include/clang/Sema/ParsedAttr.h
    M clang/lib/AST/ASTContext.cpp
    M clang/lib/AST/ItaniumMangle.cpp
    M clang/lib/AST/MicrosoftMangle.cpp
    M clang/lib/AST/TypePrinter.cpp
    M clang/lib/Basic/Targets/AMDGPU.cpp
    M clang/lib/Basic/Targets/NVPTX.h
    M clang/lib/Basic/Targets/SPIR.h
    M clang/lib/Basic/Targets/TCE.h
    M clang/lib/Basic/Targets/X86.h
    M clang/lib/CodeGen/CodeGenModule.cpp
    M clang/lib/Sema/SemaType.cpp
    M clang/test/AST/language_address_space_attribute.cpp
    M clang/test/CodeGenCXX/mangle-address-space.cpp
    M clang/test/CodeGenOpenCL/address-spaces-conversions.cl
    M clang/test/CodeGenOpenCL/address-spaces.cl
    A clang/test/SemaOpenCL/usm-address-spaces-conversions.cl
    M clang/test/SemaTemplate/address_space-dependent.cpp

  Log Message:
  -----------
  [OpenCL] Add global_device and global_host address spaces

This patch introduces 2 new address spaces in OpenCL: global_device and global_host
which are a subset of a global address space, so the address space scheme will be
looking like:

```
generic->global->host
                          ->device
             ->private
             ->local
constant
```

Justification: USM allocations may be associated with both host and device memory. We
want to give users a way to tell the compiler the allocation type of a USM pointer for
optimization purposes. (Link to the Unified Shared Memory extension:
https://github.com/intel/llvm/blob/sycl/sycl/doc/extensions/USM/cl_intel_unified_shared_memory.asciidoc)

Before this patch USM pointer could be only in opencl_global
address space, hence a device backend can't tell if a particular pointer
points to host or device memory. On FPGAs at least we can generate more
efficient hardware code if the user tells us where the pointer can point -
being able to distinguish between these types of pointers at compile time
allows us to instantiate simpler load-store units to perform memory
transactions.

Patch by Dmitry Sidorov.

Reviewed By: Anastasia

Differential Revision: https://reviews.llvm.org/D82174




More information about the All-commits mailing list