Skip to content

Commit

Permalink
apply code review suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
VyacheslavLevytskyy committed Jan 29, 2025
1 parent 9bbdc4f commit 51425ea
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 17 deletions.
34 changes: 17 additions & 17 deletions third_party/intel/lib/Target/SPIRV/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,30 @@ if(spirv_present_result)
message(STATUS "Found SPIR-V Backend")
add_compile_definitions(LLVM_SPIRV_BACKEND_TARGET_PRESENT)
add_mlir_translation_library(TritonSPIRV
SPIRVTranslation.cpp
SPIRVTranslation.cpp

LINK_COMPONENTS
Core
# spirv backend
SPIRVCodeGen
LINK_COMPONENTS
Core
# spirv backend
SPIRVCodeGen

LINK_LIBS PUBLIC
TritonLLVMIR
# spirv tools
LLVMSPIRVLib
LINK_LIBS PUBLIC
TritonLLVMIR
# spirv tools
LLVMSPIRVLib
)
else()
add_mlir_translation_library(TritonSPIRV
SPIRVTranslation.cpp
SPIRVTranslation.cpp

LINK_COMPONENTS
Core
LINK_COMPONENTS
Core

LINK_LIBS PUBLIC
TritonLLVMIR
# spirv tools
LLVMSPIRVLib
)
LINK_LIBS PUBLIC
TritonLLVMIR
# spirv tools
LLVMSPIRVLib
)
endif()

# Add SPIRV-LLVM-Translator include directory.
Expand Down
15 changes: 15 additions & 0 deletions third_party/intel/lib/Target/SPIRV/SPIRVTranslation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,21 @@ namespace llvm {
using namespace llvm;
using namespace SPIRV;

// TODO: The LLVM SPIR-V backend API has changed in
// https://github.com/llvm/llvm-project/pull/124745 to improve the way SPIR-V
// Backend API works with user facing options and allow for multithreading
// within the host application. This PR in llvm-project breaks existing API
// contract in how options are being interpreted inside the call, and we need to
// update this file accordingly. After this change is visible in the LLVM
// version from cmake/llvm-hash.txt we will need to update the call to
// SPIRVTranslateModule(M, Result, ErrMsg, AllowExtNames, Opts) in a style of
// SPIRVTranslate(M, Result, ErrMsg, {"all"}, CodeGenOptLevel::Aggressive,
// Triple("spirv64v1.6-unknown-unknown")).

// The LLVM SPIR-V backend exposes an API call that translates LLVM module to
// SPIR-V and writes results into a string as binary SPIR-V output, providing
// diagnostics on fail and means of configuring translation
// (https://github.com/llvm/llvm-project/pull/107216).
extern "C" bool
SPIRVTranslateModule(Module *M, std::string &SpirvObj, std::string &ErrMsg,
const std::vector<std::string> &AllowExtNames,
Expand Down

0 comments on commit 51425ea

Please sign in to comment.