-
Notifications
You must be signed in to change notification settings - Fork 260
[spirv] Add bit ops #215
[spirv] Add bit ops #215
Conversation
There was a problem hiding this 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!
lib/Dialect/SPIRV/SPIRVOps.cpp
Outdated
} | ||
|
||
static LogicalResult verifyShiftOp(Operation *op) { | ||
return success(op->getOperand(0)->getType() == op->getResult(0)->getType()); |
There was a problem hiding this comment.
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? :)
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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! :)
There was a problem hiding this comment.
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.
lib/Dialect/SPIRV/SPIRVOps.cpp
Outdated
@@ -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 " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the same type
lib/Dialect/SPIRV/SPIRVOps.cpp
Outdated
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() << ", " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/,/and/
2d1aa72
to
d9b0852
Compare
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.
Bots failure unrelated this this and should be fixed by 7992732. |
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
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
This CL added op definitions for a few bit operations:
Also moved the definition of spv.BitwiseAnd to follow the
lexicographical order.
@antiagainst @MaheshRavishankar can you please take a look? Thanks!