This is an archive of the discontinued LLVM Phabricator instance.

[MLIR][SPIRVToLLVM] Conversion for bitrverse and bitcount ops
ClosedPublic

Authored by georgemitenkov on Jun 22 2020, 1:51 AM.

Details

Summary

Implemented conversion for spv.BitReverse and spv.BitCount. Since ODS generates builders in a different way for LLVM dialect intrinsics, I added attributes to build method in DirectConversionPattern class. The tests for these ops are in bitwise-ops-to-llvm.mlir.

Diff Detail

Event Timeline

georgemitenkov created this revision.Jun 22 2020, 1:51 AM
georgemitenkov edited the summary of this revision. (Show Details)Jun 22 2020, 1:56 AM
ftynse added inline comments.Jun 22 2020, 2:00 AM
mlir/lib/Conversion/SPIRVToLLVM/ConvertSPIRVToLLVM.cpp
76

Should we rather preserve the attributes of the original operation, operation.getAttrs() ? I think it is good practice in general.

georgemitenkov marked an inline comment as done.
  • [MLIR][SPIRVToLLVM] Preserved op attributes in Direct Conversion pattern

Included operation.getAttrs() instead of ArrayRef<NamedAttribute>() in order to preserve the attributes of ops.

ftynse accepted this revision.Jun 23 2020, 5:37 AM
This revision is now accepted and ready to land.Jun 23 2020, 5:37 AM
georgemitenkov marked an inline comment as done.
  • [MLIR][SPIRVToLLVM] Conversion for bitrverse and bitcount ops
  • [MLIR][SPIRVToLLVM] Preserved op attributes in Direct Conversion pattern

Rebased against master to pick up other changes.

Hey @georgemitenkov, could you rebase this against master branch so I can land this? Thanks!

  • [MLIR][SPIRVToLLVM] Conversion for bitrverse and bitcount ops
  • [MLIR][SPIRVToLLVM] Preserved op attributes in Direct Conversion pattern

Rebased against master to add new changes.

This revision was automatically updated to reflect the committed changes.