Skip to content
This repository was archived by the owner on Apr 23, 2021. It is now read-only.

Conversation

denis0x0D
Copy link
Contributor

This CL added op definitions for a few bit operations:

  • OpShiftLeftLogical
  • OpShiftRightArithmetic
  • OpShiftRightLogical
  • OpBitCount
  • OpBitReverse
  • OpNot

Also moved the definition of spv.BitwiseAnd to follow the
lexicographical order.

@antiagainst @MaheshRavishankar can you please take a look? Thanks!

Copy link
Contributor

@antiagainst antiagainst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awsome, thanks @denis0x0D for adding this!

}

static LogicalResult verifyShiftOp(Operation *op) {
return success(op->getOperand(0)->getType() == op->getResult(0)->getType());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Print an error message on failure and also add a test for this? :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@antiagainst oh, sorry, I forgot about an error message;
by the way, it seems like an error could be generated only when manually creating this op with builder, not from parser, because while parsing it reuses baseType https://github.com/tensorflow/mlir/pull/215/files#diff-1a7b8ff4af6a0a814aa170d35a45ba8bR465
please fix me if I'm wrong.
Thanks.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes you are right. Please add a test with the generic assembly form. Thanks! :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@antiagainst thanks for mention generic assembly form! I didn't know about it.

@@ -474,7 +474,13 @@ static void printShiftOp(Operation *op, OpAsmPrinter &printer) {
}

static LogicalResult verifyShiftOp(Operation *op) {
return success(op->getOperand(0)->getType() == op->getResult(0)->getType());
if (op->getOperand(0)->getType() != op->getResult(0)->getType()) {
return op->emitError("expected the same types for the first operand and "
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the same type

if (op->getOperand(0)->getType() != op->getResult(0)->getType()) {
return op->emitError("expected the same types for the first operand and "
"result, but provided ")
<< op->getOperand(0)->getType() << ", "
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/,/and/

This CL added op definitions for a few bit operations:

* OpShiftLeftLogical
* OpShiftRightArithmetic
* OpShiftRightLogical
* OpBitCount
* OpBitReverse
* OpNot

Also moved the definition of spv.BitwiseAnd to follow the
lexicographical order.
@antiagainst
Copy link
Contributor

Bots failure unrelated this this and should be fixed by 7992732.

tensorflow-copybara pushed a commit to tensorflow/tensorflow that referenced this pull request Nov 8, 2019
This CL added op definitions for a few bit operations:

* OpShiftLeftLogical
* OpShiftRightArithmetic
* OpShiftRightLogical
* OpBitCount
* OpBitReverse
* OpNot

Also moved the definition of spv.BitwiseAnd to follow the
lexicographical order.

Closes #215

COPYBARA_INTEGRATE_REVIEW=tensorflow/mlir#215 from denis0x0D:sandbox/bit_ops d9b0852b689ac6c4879a9740b1740a2357f44d24
PiperOrigin-RevId: 279350470
Change-Id: I1697efe42bdeeefe43d140af41279aca7b2c48f8
swift-ci pushed a commit to swiftlang/llvm-project that referenced this pull request Dec 24, 2019
This CL added op definitions for a few bit operations:

* OpShiftLeftLogical
* OpShiftRightArithmetic
* OpShiftRightLogical
* OpBitCount
* OpBitReverse
* OpNot

Also moved the definition of spv.BitwiseAnd to follow the
lexicographical order.

Closes tensorflow/mlir#215

COPYBARA_INTEGRATE_REVIEW=tensorflow/mlir#215 from denis0x0D:sandbox/bit_ops d9b0852b689ac6c4879a9740b1740a2357f44d24
PiperOrigin-RevId: 279350470
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants