Page MenuHomePhabricator

[MLIR][SPIRVToLLVM] Implemented conversion for arithmetic ops and 3 bitwise ops.
ClosedPublic

Authored by georgemitenkov on Jun 5 2020, 1:56 PM.

Details

Summary

Following the previous revision D81100, I decided to implement a templated class that would provide conversion patterns for “straightforward” SPIR-V ops into LLVM dialect. Templating allows to abstract away from concrete implementation for each specific op. Those are mainly binary operations. Currently supported and tested ops are:

  • Arithmetic ops: IAdd, ISub, IMul, FAdd, FSub, FMul, FDiv, FNegate, SDiv, SRem and UDiv
  • Bitwise ops: BitwiseAnd, BitwiseOr, BitwiseXor

The implementation relies on SPIRVToLLVMConversion class that makes use of OpConversionPattern.

Diff Detail

Event Timeline

georgemitenkov created this revision.Jun 5 2020, 1:56 PM
Herald added a project: Restricted Project. · View Herald Transcript
antiagainst requested changes to this revision.Jun 9 2020, 5:22 PM

Nice! I just have two minor code change requests.

mlir/include/mlir/Conversion/SPIRVToLLVM/ConvertSPIRVToLLVM.h
26

This field should be private? It should be internal to the conversion pattern right?

mlir/lib/Conversion/SPIRVToLLVM/ConvertSPIRVToLLVM.cpp
36

What about calling it DirectConversionPattern?

This revision now requires changes to proceed.Jun 9 2020, 5:22 PM
georgemitenkov marked 3 inline comments as done.
  • [MLIR][SPIRVToLLVM] Renamed StraightPattern class and made typeConverter protected

Renamed class that handles straightforward conversion from StraightPattern to DirectConversionPattern. Made typeConverter field protected, so it is only visible to SPIRVToLLVMConversion subclasses.

antiagainst accepted this revision.Jun 10 2020, 4:11 PM
This revision is now accepted and ready to land.Jun 10 2020, 4:11 PM
This revision was automatically updated to reflect the committed changes.