[llvm] [SPIRV] Support for SPV_INTEL_cluster_attributes extension (PR #131593)
via llvm-commits
llvm-commits at lists.llvm.org
Fri May 16 04:17:37 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")) {
----------------
EbinJose2002 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).
Thanks for the reply. I understand that the use of Intel-specific metadata like stall_enable is discouraged, and the recommendation is to use the !spirv.Decorations metadata.
But I had a few questions:
Should the !spirv.Decorations metadata be expected to already exist in the LLVM IR (i.e., injected by the frontend or via an earlier pass), or am I expected to modify the frontend to emit this?
Alternatively, is it acceptable for me to assume that !spirv.Decorations will be present in the .ll file (e.g., from manually written tests or generated via a pass), and implement the behavior based on its presence?
https://github.com/llvm/llvm-project/pull/131593
More information about the llvm-commits
mailing list