[all-commits] [llvm/llvm-project] df122f: [SPIR-V] Change a way SPIR-V Backend API works wit...

Vyacheslav Levytskyy via All-commits all-commits at lists.llvm.org
Tue Jan 28 08:33:34 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: df122fc734ce002632f3bfe8a5fc5010349dba16
      https://github.com/llvm/llvm-project/commit/df122fc734ce002632f3bfe8a5fc5010349dba16
  Author: Vyacheslav Levytskyy <vyacheslav.levytskyy at intel.com>
  Date:   2025-01-28 (Tue, 28 Jan 2025)

  Changed paths:
    M llvm/lib/Target/SPIRV/SPIRVAPI.cpp
    M llvm/lib/Target/SPIRV/SPIRVCommandLine.cpp
    M llvm/lib/Target/SPIRV/SPIRVModuleAnalysis.cpp
    M llvm/lib/Target/SPIRV/SPIRVSubtarget.cpp
    M llvm/lib/Target/SPIRV/SPIRVSubtarget.h
    M llvm/unittests/Target/SPIRV/CMakeLists.txt
    M llvm/unittests/Target/SPIRV/SPIRVAPITest.cpp

  Log Message:
  -----------
  [SPIR-V] Change a way SPIR-V Backend API works with user facing options (#124745)

This PR fixes https://github.com/llvm/llvm-project/issues/124703:
* added a new API call `SPIRVTranslate` that is to replace entirely old
`SPIRVTranslateModule` after existing clients switch into the new
function;
* the new `SPIRVTranslate` doesn't require option parsing, replacing the
`Opts` argument with explicit `CodeGenOptLevel` and `Triple` arguments;
* the old `SPIRVTranslateModule` call is a wrapper for `SPIRVTranslate`,
it doesn't require option parsing either and doesn't hold any logic
inside except for converting string options into `CodeGenOptLevel` and
`Triple` arguments;
* usage of the extensions list is reworked to avoid writes to the global
cl::opt variable `lib/Target/SPIRV/SPIRVSubtarget.cpp::Extensions` --
instead a new class member in SPIRVSubtarget.cpp is implemented that
allows to replace supported extensions after SPIRVSubtarget.cpp is
created;
* both API calls don't require option parsing and don't write to global
cl::opt variables.

Other related/required changes:
* SPIRV::Capability::Shader is marked as an capability of lesser
priority for OpenCL environment (to remediate absence of the
"avoid-spirv-capabilities" command line option in API calls);
* unit tests are updated and extended to cover testing of a newer API
call;
* old API call is marked with TODO to remove it after existing clients
switch into the new function.



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