This is an archive of the discontinued LLVM Phabricator instance.

[MLIR][SPIRVToLLVM] Branch weights support for BranchConditional conversion
ClosedPublic

Authored by georgemitenkov on Jul 27 2020, 7:02 AM.

Details

Summary

Conversion of spv.BranchConditional now supports branch weights
that are mapped to weights vector in llvm.cond_br.

Diff Detail

Event Timeline

georgemitenkov created this revision.Jul 27 2020, 7:02 AM
rriddle added inline comments.Jul 27 2020, 1:18 PM
mlir/lib/Conversion/SPIRVToLLVM/ConvertSPIRVToLLVM.cpp
465

You could construct this with DenseElementsAttr directly(it accepts ArrayRef<Attribute>):

ShapedType weightType = VectorType::get(2, rewriter.getI32Type());
branchWeights = DenseElementsAttr::get(weightType, weights.getValue());
georgemitenkov marked an inline comment as done.

Addressed comments on constructing weights vector.

antiagainst accepted this revision.Jul 28 2020, 4:06 PM
This revision is now accepted and ready to land.Jul 28 2020, 4:06 PM