15#include "llvm/ADT/APFloat.h"
28 val = valOr->convertToDouble();
33 std::optional<int64_t> &val) {
49 std::optional<int64_t> val) {
56#include "mlir/Dialect/Quant/IR/QuantDialectBytecode.cpp.inc"
60struct QuantDialectBytecodeInterface :
public BytecodeDialectInterface {
61 QuantDialectBytecodeInterface(Dialect *dialect)
62 : BytecodeDialectInterface(dialect) {}
67 Attribute readAttribute(DialectBytecodeReader &reader)
const override {
71 LogicalResult writeAttribute(Attribute attr,
72 DialectBytecodeWriter &writer)
const override {
73 return ::writeAttribute(attr, writer);
79 Type readType(DialectBytecodeReader &reader)
const override {
83 LogicalResult writeType(Type type,
84 DialectBytecodeWriter &writer)
const override {
85 return ::writeType(type, writer);
91 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.