[all-commits] [llvm/llvm-project] 43222b: [SPIR-V] Do not use OpenCL metadata for ptr elemen...

Michal Paszkowski via All-commits all-commits at lists.llvm.org
Sun Mar 3 22:39:10 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 43222bd3091db5403e3320d23a241a534c1eefec
      https://github.com/llvm/llvm-project/commit/43222bd3091db5403e3320d23a241a534c1eefec
  Author: Michal Paszkowski <michal at paszkowski.org>
  Date:   2024-03-03 (Sun, 03 Mar 2024)

  Changed paths:
    M llvm/lib/Target/SPIRV/SPIRVBuiltins.cpp
    M llvm/lib/Target/SPIRV/SPIRVBuiltins.h
    M llvm/lib/Target/SPIRV/SPIRVCallLowering.cpp
    M llvm/lib/Target/SPIRV/SPIRVEmitIntrinsics.cpp
    M llvm/lib/Target/SPIRV/SPIRVGlobalRegistry.cpp
    M llvm/lib/Target/SPIRV/SPIRVMetadata.cpp
    M llvm/lib/Target/SPIRV/SPIRVMetadata.h
    M llvm/lib/Target/SPIRV/SPIRVPreLegalizer.cpp
    M llvm/lib/Target/SPIRV/SPIRVUtils.cpp
    M llvm/lib/Target/SPIRV/SPIRVUtils.h
    M llvm/test/CodeGen/SPIRV/function/alloca-load-store.ll
    M llvm/test/CodeGen/SPIRV/half_no_extension.ll
    M llvm/test/CodeGen/SPIRV/instructions/undef-nested-composite-store.ll
    M llvm/test/CodeGen/SPIRV/instructions/undef-simple-composite-store.ll
    M llvm/test/CodeGen/SPIRV/opaque_pointers.ll
    M llvm/test/CodeGen/SPIRV/opencl/basic/get_global_offset.ll
    R llvm/test/CodeGen/SPIRV/opencl/metadata/kernel_arg_type_function_metadata.ll
    R llvm/test/CodeGen/SPIRV/opencl/metadata/kernel_arg_type_module_metadata.ll
    M llvm/test/CodeGen/SPIRV/opencl/vload2.ll
    A llvm/test/CodeGen/SPIRV/opencl/vstore2.ll
    A llvm/test/CodeGen/SPIRV/passes/SPIRVEmitIntrinsics-TargetExtType-arg-no-spv_assign_type.ll
    A llvm/test/CodeGen/SPIRV/passes/SPIRVEmitIntrinsics-no-divergent-spv_assign_ptr_type.ll
    A llvm/test/CodeGen/SPIRV/passes/SPIRVEmitIntrinsics-no-duplicate-spv_assign_type.ll
    M llvm/test/CodeGen/SPIRV/pointers/getelementptr-kernel-arg-char.ll
    A llvm/test/CodeGen/SPIRV/pointers/kernel-argument-builtin-vload-type-discrapency.ll
    A llvm/test/CodeGen/SPIRV/pointers/kernel-argument-pointer-type-deduction-mismatch.ll
    A llvm/test/CodeGen/SPIRV/pointers/kernel-argument-pointer-type-deduction-no-metadata.ll
    A llvm/test/CodeGen/SPIRV/pointers/ptr-argument-byref.ll
    A llvm/test/CodeGen/SPIRV/pointers/ptr-argument-byval.ll
    A llvm/test/CodeGen/SPIRV/pointers/store-operand-ptr-to-struct.ll
    A llvm/test/CodeGen/SPIRV/pointers/two-bitcast-or-param-users.ll
    R llvm/test/CodeGen/SPIRV/pointers/two-bitcast-users.ll
    M llvm/test/CodeGen/SPIRV/pointers/two-subsequent-bitcasts.ll
    M llvm/test/CodeGen/SPIRV/sitofp-with-bool.ll
    M llvm/test/CodeGen/SPIRV/transcoding/OpenCL/atomic_cmpxchg.ll
    M llvm/test/CodeGen/SPIRV/transcoding/OpenCL/atomic_legacy.ll
    M llvm/test/CodeGen/SPIRV/transcoding/spirv-private-array-initialization.ll
    M llvm/test/CodeGen/SPIRV/uitofp-with-bool.ll

  Log Message:
  -----------
  [SPIR-V] Do not use OpenCL metadata for ptr element type resolution (#82678)

This pull request aims to remove any dependency on OpenCL/SPIR-V type
information in LLVM IR metadata. While, using metadata might simplify
and prettify the resulting SPIR-V output (and restore some of the
information missed in the transformation to opaque pointers), the
overall methodology for resolving kernel parameter types is highly
inefficient.

The high-level strategy is to assign kernel parameter types in this order:

1. Resolving the types using builtin function calls as mangled names
must contain type information or by looking up builtin definition in
SPIRVBuiltins.td. Then:

- Assigning the type temporarily using an intrinsic and later setting
the right SPIR-V type in SPIRVGlobalRegistry after IRTranslation
 - Inserting a bitcast
2. Defaulting to LLVM IR types (in case of pointers the generic i8*
type or types from byval/byref attributes)

In case of type incompatibility (e.g. parameter defined initially as
sampler_t and later used as image_t) the error will be found early on
before IRTranslation (in the SPIRVEmitIntrinsics pass).



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