[PATCH] D156297: [SPIRV] Add support for SPV_INTEL_optnone
Paulo Matos via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 26 00:55:25 PDT 2023
pmatos added a comment.
This is a draft patch - I want to discuss somethings inline.
The output for optnone.ll is:
bin/llc -O0 -mtriple=spirv32-unknown-unknown ../llvm/test/CodeGen/SPIRV/optnone.ll -o -
OpCapability Kernel
OpCapability Addresses
OpCapability Linkage
%1 = OpExtInstImport "OpenCL.std"
OpMemoryModel Physical32 OpenCL
OpExecutionMode %4 ContractionOff
OpSource Unknown 0
OpName %4 "_Z3foov"
OpDecorate %4 LinkageAttributes "_Z3foov" Export
%2 = OpTypeVoid
%3 = OpTypeFunction %2
OpCapability OptNoneINTEL ; -- Begin function _Z3foov
OpExtension "�" "�" "�" "�" "�" "�"
%4 = OpFunction %2 DontInline %3
%5 = OpLabel
OpReturn
OpFunctionEnd
OpExtension emits some funky unicode characters, I feel like I am doing this incorrectly but similarly to what's being done in `SPIRVAsmPrinter::outputGlobalRequirements()` :
MCInst Inst;
Inst.setOpcode(SPIRV::OpExtension);
addStringImm(getSymbolicOperandMnemonic(
SPIRV::OperandCategory::ExtensionOperand, Ext),
Inst);
outputMCInst(Inst);
The other issue is that afaiu the OpExtension declaractions need to come up the top of the module. How is this organized in the backend so that I can emit these at the top of the module? Do I need to add these to the module requirements somehow?
================
Comment at: llvm/lib/Target/SPIRV/SPIRVAsmPrinter.cpp:127
+ Inst.setOpcode(SPIRV::OpCapability);
+ Inst.addOperand(MCOperand::createImm(static_cast<unsigned>(
+ SPIRV::Capability::OptNoneINTEL)));
----------------
Is this the best place to issue the instruction or is it preferable to do so during lowering for each function?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D156297/new/
https://reviews.llvm.org/D156297
More information about the llvm-commits
mailing list