[all-commits] [llvm/llvm-project] fa2a7a: [SPIR-V] Introduce SPIR-V global entities tracking...

Aleksandr Bezzubikov via All-commits all-commits at lists.llvm.org
Thu Jul 7 08:15:36 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: fa2a7a25c9893b2cee2a4cf4fe92531979ef523e
      https://github.com/llvm/llvm-project/commit/fa2a7a25c9893b2cee2a4cf4fe92531979ef523e
  Author: Aleksandr Bezzubikov <zuban32s at gmail.com>
  Date:   2022-07-07 (Thu, 07 Jul 2022)

  Changed paths:
    M llvm/lib/Target/SPIRV/CMakeLists.txt
    M llvm/lib/Target/SPIRV/SPIRVCallLowering.cpp
    A llvm/lib/Target/SPIRV/SPIRVDuplicatesTracker.cpp
    A llvm/lib/Target/SPIRV/SPIRVDuplicatesTracker.h
    M llvm/lib/Target/SPIRV/SPIRVGlobalRegistry.cpp
    M llvm/lib/Target/SPIRV/SPIRVGlobalRegistry.h
    M llvm/lib/Target/SPIRV/SPIRVInstructionSelector.cpp
    M llvm/lib/Target/SPIRV/SPIRVModuleAnalysis.cpp
    M llvm/lib/Target/SPIRV/SPIRVModuleAnalysis.h
    A llvm/test/CodeGen/SPIRV/transcoding/RelationalOperators.ll
    A llvm/test/CodeGen/SPIRV/transcoding/fcmp.ll

  Log Message:
  -----------
  [SPIR-V] Introduce SPIR-V global entities tracking and deduplication infra.

SPIR-V module typically contains some global entities that were not
global before made it to SPIR-V, e.g. types and constants are not usually
declared globally in LLVM. By design SPIR-V requires such stuff to be declared
once and in the module's global section. Since MIR is not able to represent
such things properly they were generated per-function, and then at the very end
of the backend's pipeline hoisted into some 'meta' function minding possible
duplicates.

New SPIRVDuplicatesTracker keeps mapping of the original LLVM entities such
as types, constant, global variables, etc to their MIR counterparts -
(MachineFunction, Register). Later SPIRVModuleAnalysis (apart from other
thing it's responsible for) performs topological sorting of the
tracker's entries to ensure proper ordering before the hoisting,
and actually performs the hoisting in a duplicates-free manner
by the tracker's nature.

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




More information about the All-commits mailing list