[all-commits] [llvm/llvm-project] 88e2bb: [clang][SPIR-V] Add support for AMDGCN flavoured S...

Alex Voicu via All-commits all-commits at lists.llvm.org
Fri Jun 7 03:50:45 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 88e2bb40921f35663e16e45514de20018615c36f
      https://github.com/llvm/llvm-project/commit/88e2bb40921f35663e16e45514de20018615c36f
  Author: Alex Voicu <alexandru.voicu at amd.com>
  Date:   2024-06-07 (Fri, 07 Jun 2024)

  Changed paths:
    M clang/lib/Basic/Targets.cpp
    M clang/lib/Basic/Targets/SPIR.cpp
    M clang/lib/Basic/Targets/SPIR.h
    M clang/lib/CodeGen/CGBuiltin.cpp
    M clang/test/CodeGen/target-data.c
    A clang/test/CodeGenCUDA/builtins-spirv-amdgcn.cu
    A clang/test/CodeGenCUDA/builtins-unsafe-atomics-spirv-amdgcn-gfx90a.cu
    M clang/test/CodeGenCUDA/long-double.cu
    A clang/test/CodeGenCUDA/spirv-amdgcn-bf16.cu
    A clang/test/CodeGenCXX/spirv-amdgcn-float16.cpp
    M clang/test/CodeGenHIP/hipspv-addr-spaces.cpp
    A clang/test/CodeGenHIP/spirv-amdgcn-ballot.cpp
    A clang/test/CodeGenHIP/spirv-amdgcn-dpp-const-fold.hip
    A clang/test/CodeGenHIP/spirv-amdgcn-half.hip
    M clang/test/CodeGenOpenCL/amdgcn-flat-scratch-name.cl
    M clang/test/CodeGenOpenCL/builtins-amdgcn-gfx10.cl
    M clang/test/CodeGenOpenCL/builtins-amdgcn-gfx11.cl
    M clang/test/CodeGenOpenCL/builtins-amdgcn-vi.cl
    M clang/test/CodeGenOpenCL/builtins-amdgcn.cl
    M clang/test/CodeGenOpenCL/inline-asm-amdgcn.cl
    M clang/test/Preprocessor/hash_builtin.cpp
    M clang/test/Preprocessor/predefined-macros-no-warnings.c
    M clang/test/Preprocessor/predefined-macros.c
    A clang/test/Sema/builtin-spirv-amdgcn-atomic-inc-dec-failure.cpp
    A clang/test/Sema/inline-asm-validate-spirv-amdgcn.cl
    M clang/test/SemaCUDA/allow-int128.cu
    M clang/test/SemaCUDA/amdgpu-f128.cu
    M clang/test/SemaCUDA/float16.cu
    M clang/test/SemaCUDA/fp16-arg-return.cu
    A clang/test/SemaCUDA/spirv-amdgcn-atomic-ops.cu
    M clang/test/SemaOpenCL/builtins-amdgcn-error-gfx908-param.cl
    M clang/test/SemaOpenCL/builtins-amdgcn-error-gfx90a-param.cl
    M clang/test/SemaOpenCL/builtins-amdgcn-error-gfx940-param.cl
    M llvm/docs/SPIRVUsage.rst
    M llvm/lib/Target/SPIRV/SPIRVTargetMachine.cpp
    M llvm/lib/TargetParser/TargetParser.cpp
    M llvm/test/CodeGen/SPIRV/extensions/SPV_KHR_subgroup_rotate/subgroup-rotate.ll
    M llvm/test/CodeGen/SPIRV/passes/SPIRVEmitIntrinsics-no-divergent-spv_assign_ptr_type.ll
    M llvm/test/CodeGen/SPIRV/passes/SPIRVEmitIntrinsics-no-duplicate-spv_assign_type.ll
    M llvm/test/CodeGen/SPIRV/transcoding/builtin_vars_arithmetics.ll
    M llvm/test/CodeGen/SPIRV/transcoding/sub_group_non_uniform_vote.ll

  Log Message:
  -----------
  [clang][SPIR-V] Add support for AMDGCN flavoured SPIRV (#89796)

This change seeks to add support for vendor flavoured SPIRV - more
specifically, AMDGCN flavoured SPIRV. The aim is to generate SPIRV that
carries some extra bits of information that are only usable by AMDGCN
targets, forfeiting absolute genericity to obtain greater expressiveness
for target features:

- AMDGCN inline ASM is allowed/supported, under the assumption that the
[SPV_INTEL_inline_assembly](https://github.com/intel/llvm/blob/sycl/sycl/doc/design/spirv-extensions/SPV_INTEL_inline_assembly.asciidoc)
extension is enabled/used
- AMDGCN target specific builtins are allowed/supported, under the
assumption that e.g. the `--spirv-allow-unknown-intrinsics` option is
enabled when using the downstream translator
- the featureset matches the union of AMDGCN targets' features
- the datalayout string is overspecified to affix both the program
address space and the alloca address space, the latter under the
assumption that the
[SPV_INTEL_function_pointers](https://github.com/intel/llvm/blob/sycl/sycl/doc/design/spirv-extensions/SPV_INTEL_function_pointers.asciidoc)
extension is enabled/used, case in which the extant SPIRV datalayout
string would lead to pointers to function pointing to the private
address space, which would be wrong.

Existing AMDGCN tests are extended to cover this new target. It is
currently dormant / will require some additional changes, but I thought
I'd rather put it up for review to get feedback as early as possible. I
will note that an alternative option is to place this under AMDGPU, but
that seems slightly less natural, since this is still SPIRV, albeit
relaxed in terms of preconditions & constrained in terms of
postconditions, and only guaranteed to be usable on AMDGCN targets (it
is still possible to obtain pristine portable SPIRV through usage of the
flavoured target, though).



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list