[all-commits] [llvm/llvm-project] 8ac46d: [SPIR-V] Implement builtins for OpIAddCarry/OpISub...

Vyacheslav Levytskyy via All-commits all-commits at lists.llvm.org
Thu Nov 14 06:30:27 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8ac46d6b4f8dff07730c4c0dff20d969efcf14f2
      https://github.com/llvm/llvm-project/commit/8ac46d6b4f8dff07730c4c0dff20d969efcf14f2
  Author: Vyacheslav Levytskyy <vyacheslav.levytskyy at intel.com>
  Date:   2024-11-14 (Thu, 14 Nov 2024)

  Changed paths:
    M llvm/lib/Target/SPIRV/SPIRVBuiltins.cpp
    M llvm/lib/Target/SPIRV/SPIRVBuiltins.td
    M llvm/lib/Target/SPIRV/SPIRVCallLowering.cpp
    M llvm/lib/Target/SPIRV/SPIRVEmitIntrinsics.cpp
    M llvm/lib/Target/SPIRV/SPIRVGlobalRegistry.h
    M llvm/lib/Target/SPIRV/SPIRVISelLowering.cpp
    M llvm/lib/Target/SPIRV/SPIRVInstructionSelector.cpp
    M llvm/lib/Target/SPIRV/SPIRVUtils.cpp
    M llvm/lib/Target/SPIRV/SPIRVUtils.h
    A llvm/test/CodeGen/SPIRV/iaddcarry-builtin.ll
    M llvm/test/CodeGen/SPIRV/instructions/scalar-integer-arithmetic.ll
    A llvm/test/CodeGen/SPIRV/isubborrow-builtin.ll
    M llvm/test/CodeGen/SPIRV/llvm-intrinsics/uadd.with.overflow.ll
    A llvm/test/CodeGen/SPIRV/pointers/phi-valid-operand-types-vs-calllowering-unwrapped.ll
    A llvm/test/CodeGen/SPIRV/pointers/phi-valid-operand-types-vs-calllowering.ll

  Log Message:
  -----------
  [SPIR-V] Implement builtins for OpIAddCarry/OpISubBorrow and improve/fix type inference (#115192)

This PR is to solve several intertwined issues with type inference while
adding support for builtins for OpIAddCarry and OpISubBorrow:
* OpIAddCarry and OpISubBorrow generation in a way of supporting SPIR-V
friendly builtins `__spirv_...` -- introduces a new element to account
for, namely, `ptr sret (%struct) %0` argument that is a place to put a
result of the instruction;
* fix early definition of SPIR-V types during call lowering -- namely,
the goal of the PR is to ensure that correct types are applied to
virtual registers which were used as arguments in call lowering and so
caused early definition of SPIR-V types; reproducers are attached as a
new test cases;
* improve parsing of builtin names (e.g., understand a name of a kind
`"anon<int, int> __spirv_IAddCarry<int, int>(int, int)"` that was
incorrectly parsed as `anon` before the PR);
* improve type inference and fix access to erased from parent after
visit instructions -- before the PR visiting of instructions in
emitintrinsics pass replaced old alloca's, bitcast's, etc. instructions
with a newly generated internal SPIR-V intrinsics and after erasing old
instructions there were still references to them in a postprocessing
working list, while records for newly deduced pointee types were lost;
this PR fixes the issue by adding as consistent wrt. internal data
structures action `SPIRVEmitIntrinsics::replaceAllUsesWith()` that fixes
above mentioned problems;
* LLVM IR add/sub instructions result in logical SPIR-V instructions
when applied to bool type;
* fix validation of pointer types for frexp and lgamma_r,
* fix hardcoded reference to AS0 as a Function storage class in
lib/Target/SPIRV/SPIRVBuiltins.cpp -- now it's
`storageClassToAddressSpace(SPIRV::StorageClass::Function)`,
* re-use the same OpTypeStruct for two identical references to struct's
in arithmetic with overflow instructions.



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