This is an archive of the discontinued LLVM Phabricator instance.

[SPIRV] Add the SPIRV-specific intrinsics, two passes and tests
ClosedPublic

Authored by iliya-diyachkov on Apr 25 2022, 1:47 PM.

Details

Summary

The patch adds the SPIRV-specific intrinsics required to keep information critical to SPIR-V consistency (types, constants, etc.) during translation from IR to MIR. Two related passes have also been added: SPIRVEmitIntrinsics pass inserts calls to SPIR-V intrinsics before IRTranslator, SPIRVPreLegalizer pass utilizes some intrinsic calls to save SPIR-V specific info in SPIR-V instructions and prepares MIR for Legalizer and InstructionSelect passes. Several tests passed with this change were also added.

The issue with opaque pointers was fixed in SPIRVGlobalRegistry.cpp (see the rest of https://reviews.llvm.org/D116464).

Diff Detail

Event Timeline

iliya-diyachkov requested review of this revision.Apr 25 2022, 1:47 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 25 2022, 1:47 PM
iliya-diyachkov retitled this revision from [SPIRV] Add the SPIRV-specific intrinsics and two passes to [SPIRV] Add the SPIRV-specific intrinsics, two passes and tests.Apr 25 2022, 1:57 PM
iliya-diyachkov edited the summary of this revision. (Show Details)
iliya-diyachkov added a reviewer: nikic.
arsenm added inline comments.Apr 25 2022, 2:23 PM
llvm/lib/Target/SPIRV/SPIRVEmitIntrinsics.cpp
59–62

CreateUnaryIntrinsic?

121–122

getFirstInsertionPt?

Fix issues noted by Matt.

iliya-diyachkov marked 2 inline comments as done.Apr 26 2022, 4:06 AM
iliya-diyachkov added inline comments.
llvm/lib/Target/SPIRV/SPIRVEmitIntrinsics.cpp
59–62

Thanks. It doesn't always have a unary argument, so I'm changing it to CreateIntrinsic.

iliya-diyachkov updated this revision to Diff 426188.EditedApr 29 2022, 4:30 PM
iliya-diyachkov marked an inline comment as done.

Fix the issue with data layout mismatch between the SPIR-V backend and clang (https://github.com/llvm/llvm-project/issues/55122).

Fix clang-format issues.

mpaszkowski accepted this revision.May 5 2022, 6:03 AM

Thank you @iliya-diyachkov for the patch and also for fixing the discrepancy in the data layout! The builds seem to be also passing now. LGTM!

This revision is now accepted and ready to land.May 5 2022, 6:03 AM