[PATCH] D116465: [SPIRV 6/6] Add one essential pass and the simplest tests

Ilia Diachkov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 14 15:49:57 PST 2022


iliya-diyachkov added a comment.

In D116465#3321209 <https://reviews.llvm.org/D116465#3321209>, @arsenm wrote:

> In D116465#3320801 <https://reviews.llvm.org/D116465#3320801>, @iliya-diyachkov wrote:
>
>> @arsenm, when you suggested moving GlobalTypesAndRegNum' operations to AsmPrinter, did you implied that we need to insert SPIRVDummyGlobalPass after all SPIRVGISel passes to have whole MIR at the first run of AsmPrinter? Or is there another approach (or some pass configuration) to achieve the correct processing of the whole MIR in AsmPrinter?
>
> If you can emit this global information at the end of the printed module instead of the start, that would be easiest. If you really have to emit it at the top, you may be able to get away with something similar to what AMDGPU does for reporting total register counts used in the presence of indirect function calls. AMDGPUAsmPrinter depends on a module analysis, AMDGPUResourceUsageAnalysis. This effectively forces all functions to be codegened before final emission (which does have an associated compile time / memory cost)

Thanks for the advice, Matt! The SPIR-V specification requires the info at the beginning of the module.

So we need to implement SPIRVModuleAnalysis, make SPIRVAsmPrinter to be depended on it and use the analysis results in the first invocation of AsmPrinter::runOnMachineFunction to output global instructions before all real functions.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D116465/new/

https://reviews.llvm.org/D116465



More information about the llvm-commits mailing list