[llvm] [SPIRV] Support for SPV_INTEL_cluster_attributes extension (PR #131593)

Dmitry Sidorov via llvm-commits llvm-commits at lists.llvm.org
Thu May 15 10:01:26 PDT 2025


================
@@ -1976,6 +1980,38 @@ static void handleMIFlagDecoration(MachineInstr &I, const SPIRVSubtarget &ST,
   buildOpDecorate(DstReg, I, TII, SPIRV::Decoration::FPFastMathMode, {FMFlags});
 }
 
+static void handleFunctionDecoration(MachineInstr &MI, const SPIRVSubtarget &ST,
+                                     const SPIRVInstrInfo &TII,
+                                     SPIRV::ModuleAnalysisInfo &MAI,
+                                     llvm::Module::const_iterator F) {
+  Register FuncReg = MI.getOperand(0).getReg();
+  llvm::SmallVector<std::pair<unsigned int, llvm::MDNode *>> MetaDataList;
+
+  // Add function-level decorations based on metadata
+  F->getAllMetadata(MetaDataList);
+  for (auto &MetaData : MetaDataList) {
+    if (MetaData.second == F->getMetadata("stall_enable") ||
+        MetaData.second == F->getMetadata("stall_free")) {
----------------
MrSidims wrote:

Lets not use internal to https://github.com/intel/llvm metadata. Instead lets use spirv.Decorations metadata defined here: https://github.com/KhronosGroup/SPIRV-LLVM-Translator/blob/main/docs/SPIRVRepresentationInLLVM.rst (note, SPIR-V friendly LLVM IR is used not only in the translator, but also in SPIR-V backend).

https://github.com/llvm/llvm-project/pull/131593


More information about the llvm-commits mailing list