15#include "llvm/ADT/APFloat.h"
16#include "llvm/ADT/TypeSwitch.h"
29 val = valOr->convertToDouble();
34 std::optional<int64_t> &val) {
50 std::optional<int64_t> val) {
56#include "mlir/Dialect/Quant/IR/QuantDialectBytecode.cpp.inc"
59struct QuantDialectBytecodeInterface :
public BytecodeDialectInterface {
60 QuantDialectBytecodeInterface(Dialect *dialect)
61 : BytecodeDialectInterface(dialect) {}
66 Attribute readAttribute(DialectBytecodeReader &reader)
const override {
70 LogicalResult writeAttribute(Attribute attr,
71 DialectBytecodeWriter &writer)
const override {
72 return ::writeAttribute(attr, writer);
78 Type readType(DialectBytecodeReader &reader)
const override {
82 LogicalResult writeType(Type type,
83 DialectBytecodeWriter &writer)
const override {
84 return ::writeType(type, writer);
90 dialect->addInterfaces<QuantDialectBytecodeInterface>();
This class defines a virtual interface for reading a bytecode stream, providing hooks into the byteco...
virtual LogicalResult readBool(bool &result)=0
Read a bool from the bytecode.
virtual LogicalResult readSignedVarInt(int64_t &result)=0
Read a signed variable width integer.
virtual FailureOr< APFloat > readAPFloatWithKnownSemantics(const llvm::fltSemantics &semantics)=0
Read an APFloat that is known to have been encoded with the given semantics.
This class defines a virtual interface for writing to a bytecode stream, providing hooks into the byt...
virtual void writeSignedVarInt(int64_t value)=0
Write a signed variable width integer to the output stream.
virtual void writeOwnedBool(bool value)=0
Write a bool to the output stream.
void addBytecodeInterface(QuantDialect *dialect)
Add the interfaces necessary for encoding the quantization dialect components in bytecode.
Include the generated interface declarations.