Creates an affine add expression with ‘lhs’ and ‘rhs’.
Returns the left hand side affine expression of the given affine binary
operation expression.
Returns the right hand side affine expression of the given affine binary
operation expression.
Creates an affine ceildiv expression with ‘lhs’ and ‘rhs’.
Creates an affine constant expression with ‘constant’ in the context.
Returns the value of the given affine constant expression.
Creates an affine dimension expression with ‘position’ in the context.
Returns the position of the given affine dimension expression.
Composes the given map with the given expression.
Prints the affine expression to the standard error stream.
Returns true
if the two affine expressions are equal.
Gets the context that owns the affine expression.
Returns the greatest known integral divisor of this affine expression. The
result is always positive.
Checks whether the given affine expression is an add expression.
Checks whether the given affine expression is binary.
Checks whether the given affine expression is an ceildiv expression.
Checks whether the given affine expression is a constant expression.
Checks whether the given affine expression is a dimension expression.
Checks whether the given affine expression is an floordiv expression.
Checks whether the given affine expression is an mod expression.
Checks whether the given affine expression is an mul expression.
Checks whether the given affine expression is a symbol expression.
Checks whether the given affine expression involves AffineDimExpr
‘position’.
Checks whether the given affine expression is a multiple of ‘factor’.
Checks whether the given affine expression is a pure affine expression, i.e.
mul, floordiv, ceildic, and mod is only allowed w.r.t constants.
Checks whether the given affine expression is made out of only symbols and
constants.
Prints an affine expression by sending chunks of the string representation
and forwarding userData to
callback`. Note that the callback may be called
several times with consecutive chunks of the string.
Creates an affine floordiv expression with ‘lhs’ and ‘rhs’.
Creates an affine map attribute wrapping the given map. The attribute
belongs to the same context as the affine map.
Returns the typeID of an AffineMap attribute.
Returns the affine map wrapped in the given affine map attribute.
Returns the simplified affine map resulting from dropping the symbols that
do not appear in any of the individual maps in affineMaps
.
Asserts that all maps in affineMaps
are normalized to the same number of
dims and symbols.
Takes a callback populateResult
to fill the res
container with value
m
at entry idx
. This allows returning without worrying about ownership
considerations.
Creates a single constant result affine map in the context. The affine map
is owned by the context.
Prints the affine map to the standard error stream.
Creates a zero result affine map with no dimensions or symbols in the
context. The affine map is owned by the context.
Checks if two affine maps are equal.
Creates an affine map with results defined by the given list of affine
expressions. The map resulting map also has the requested number of input
dimensions and symbols, regardless of them being used in the results.
Gets the context that the given affine map was created with
Returns the affine map consisting of the most major numResults
results.
Returns the null AffineMap if the numResults
is equal to zero.
Returns the affineMap
if numResults
is greater or equals to number of
results of the given affine map.
Returns the affine map consisting of the most minor numResults
results.
Returns the null AffineMap if the numResults
is equal to zero.
Returns the affineMap
if numResults
is greater or equals to number of
results of the given affine map.
Returns the number of dimensions of the given affine map.
Returns the number of inputs (dimensions + symbols) of the given affine
map.
Returns the number of results of the given affine map.
Returns the number of symbols of the given affine map.
Returns the result at the given position.
Returns the constant result of the given affine map. The function asserts
that the map has a single constant result.
Returns the affine map consisting of the resultPos
subset.
Checks whether the given affine map is an empty affine map.
Checks whether the given affine map is an identity affine map. The function
asserts that the number of dimensions is greater or equal to the number of
results.
Checks whether the given affine map is a minor identity affine map.
Checks whether the given affine map represents a symbol-less permutation
map.
Checks whether the given affine map represents a subset of a symbol-less
permutation map.
Checks whether the given affine map is a single result constant affine
map.
Creates an identity affine map on the most minor dimensions in the context.
The affine map is owned by the context. The function asserts that the number
of dimensions is greater or equal to the number of results.
Creates an affine map with ‘numDims’ identity in the context. The affine map
is owned by the context.
Creates an affine map with a permutation expression and its size in the
context. The permutation expression is a non-empty vector of integers.
The elements of the permutation vector must be continuous from 0 and cannot
be repeated (i.e. [1,2,0]
is a valid permutation. [2,0]
or [1,1,2]
is
an invalid invalid permutation.) The affine map is owned by the context.
Prints an affine map by sending chunks of the string representation and
forwarding userData to
callback`. Note that the callback may be called
several times with consecutive chunks of the string.
Apply AffineExpr::replace(map
) to each of the results and return a new
new AffineMap with the new results and the specified number of dims and
symbols.
Creates a zero result affine map of the given dimensions and symbols in the
context. The affine map is owned by the context.
Creates an affine mod expression with ‘lhs’ and ‘rhs’.
Creates an affine mul expression with ‘lhs’ and ‘rhs’.
Creates an affine symbol expression with ‘position’ in the context.
Returns the position of the given affine symbol expression.
Creates an instance of AnyQuantizedType with the given parameters in the
same context as storageType
and returns it. The instance is owned by the
context.
Creates an array element containing the given list of elements in the given
context.
Returns pos-th element stored in the given array attribute.
Returns the number of elements stored in the given array attribute.
Returns the typeID of an Array attribute.
Prints the attribute to the standard error stream.
Checks if two attributes are equal.
Gets the context that an attribute was created with.
Gets the dialect of the attribute.
Returns an empty attribute.
Gets the type of this attribute.
Gets the type id of the attribute.
Checks whether the given attribute is an affine map attribute.
Checks whether the given attribute is an array attribute.
Checks whether the given attribute is a bool attribute.
Checks whether the given attribute is a dense array attribute.
Checks whether the given attribute is a dense elements attribute.
Checks whether the given attribute is a dictionary attribute.
Checks whether the given attribute is an elements attribute.
Checks whether the given attribute is a flat symbol reference attribute.
Checks whether the given attribute is a floating point attribute.
Checks whether the given attribute is an integer attribute.
Checks whether the given attribute is an integer set attribute.
Checks whether the given attribute is an opaque attribute.
Checks whether the given attribute is a sparse elements attribute.
Checks whether the given attribute is a sparse_tensor.encoding
attribute.
Checks whether the given attribute is a string attribute.
Checks whether the given attribute is a symbol reference attribute.
Checks whether the given attribute is a type attribute.
Checks whether the given attribute is a unit attribute.
Parses an attribute. The attribute is owned by the context.
Prints an attribute by sending chunks of the string representation and
forwarding userData to
callback`. Note that the callback may be called
several times with consecutive chunks of the string.
Creates a bf16 type in the given context. The type is owned by the
context.
Returns the typeID of an BFloat16 type.
Appends an argument of the specified type to the block. Returns the newly
added argument.
Takes an operation owned by the caller and appends it to the block.
Returns the position of the value in the argument list of its block.
Returns the block in which this value is defined as an argument. Asserts if
the value is not a block argument.
Sets the type of the block argument to the given type.
Creates a new empty block with the given argument types and transfers
ownership to the caller.
Takes a block owned by the caller and destroys it.
Detach a block from the owning region and assume ownership.
Checks whether two blocks handles point to the same block. This does not
perform deep comparison.
Returns pos
-th argument of the block.
Returns the first operation in the block.
Returns the block immediately following the given block in its parent
region.
Returns the number of arguments of the block.
Returns the closest surrounding operation that contains this block.
Returns the region that contains this block.
Returns the terminator operation in the block or null if no terminator.
Inserts an argument of the specified type at a specified index to the block.
Returns the newly added argument.
Takes an operation owned by the caller and inserts it as pos
to the block.
This is an expensive operation that scans the block linearly, prefer
insertBefore/After instead.
Takes an operation owned by the caller and inserts it after the (non-owned)
reference operation in the given block. If the reference is null, prepends
the operation. Otherwise, the reference must belong to the block.
Takes an operation owned by the caller and inserts it before the (non-owned)
reference operation in the given block. If the reference is null, appends
the operation. Otherwise, the reference must belong to the block.
Prints a block by sending chunks of the string representation and
forwarding userData to
callback`. Note that the callback may be called
several times with consecutive chunks of the string.
Creates a bool attribute in the given context with the given value.
Returns the value stored in the given bool attribute.
Creates new printing flags with defaults, intended for customization.
Must be freed with a call to mlirBytecodeWriterConfigDestroy().
Sets the version to emit in the writer config.
Destroys printing flags created with mlirBytecodeWriterConfigCreate.
Creates an instance of CalibratedQuantizedType with the given parameters
in the same context as expressedType
and returns it. The instance is owned
by the context.
Returns the max value of the given calibrated quantized type.
Returns the min value of the given calibrated quantized type.
Creates a complex type with the given element type in the same context as
the element type. The type is owned by the context.
Returns the element type of the given complex type.
Returns the typeID of an Complex type.
Append the contents of the given dialect registry to the registry associated
with the context.
Attaches the diagnostic handler to the context. Handlers are invoked in the
reverse order of attachment until one of them processes the diagnostic
completely. When a handler is invoked it is passed the userData
that was
provided when it was attached. If non-NULL, deleteUserData
is called once
the system no longer needs to call the handler (for instance after the
handler is detached or the context is destroyed). Returns an identifier that
can be used to detach the handler.
Creates an MLIR context and transfers its ownership to the caller.
This sets the default multithreading option (enabled).
Creates an MLIR context, setting the multithreading setting explicitly and
pre-loading the dialects from the provided DialectRegistry.
Creates an MLIR context with an explicit setting of the multithreading
setting and transfers its ownership to the caller.
Takes an MLIR context owned by the caller and destroys it.
Detaches an attached diagnostic handler from the context given its
identifier.
Set threading mode (must be set to false to mlir-print-ir-after-all).
Checks if two contexts are equal.
Returns whether the context allows unregistered dialects.
Returns the number of dialects loaded by the context.
Returns the number of dialects registered with the given context. A
registered dialect will be loaded if needed by the parser.
Gets the dialect instance owned by the given context using the dialect
namespace to identify it, loads (i.e., constructs the instance of) the
dialect if necessary. If the dialect is not registered with the context,
returns null. Use mlirContextLoadDialect to load an unregistered
dialect.
Returns whether the given fully-qualified operation (i.e.
‘dialect.operation’) is registered with the context. This will return true
if the dialect is loaded and the operation is registered within the
dialect.
Eagerly loads all available dialects registered with a context, making
them available for use for IR construction.
Sets whether unregistered dialects are allowed in this context.
Sets the thread pool of the context explicitly, enabling multithreading in
the process. This API should be used to avoid re-creating thread pools in
long-running applications that perform multiple compilations, see
the C++ documentation for MLIRContext for details.
Creates an external MlirPass
that calls the supplied callbacks
using the
supplied userData
. If opName
is empty, the pass is a generic operation
pass. Otherwise it is an operation pass specific to the specified pass name.
Get the size of a dense array.
Create a dense array attribute with the given elements.
Get an element of a dense array.
Returns the pos-th value (flat contiguous indexing) of a specific type
contained by the given dense resource elements attribute.
Creates a dense elements attribute with the given shaped type from elements
of a specific type. Expects the element type of the shaped type to match the
data element type.
Creates a dense elements attribute with the given Shaped type and elements
in the same context as the type.
Returns the pos-th value (flat contiguous indexing) of a specific type
contained by the given dense elements attribute.
Returns the raw data of the given dense elements attribute.
Returns the single replicated value (splat) of a specific type contained by
the given dense elements attribute.
Checks whether the given dense elements attribute contains a single
replicated value (splat).
Creates a dense elements attribute with the given Shaped type and elements
populated from a packed, row-major opaque buffer of contents.
Creates a dense elements attribute that has the same data as the given dense
elements attribute and a different shaped type. The new type must have the
same total number of elements.
Creates a dense elements attribute with the given Shaped type containing a
single replicated element (splat).
Creates a dense elements attribute with the given shaped type from string
elements.
Returns the typeID of an DenseIntOrFPElements attribute.
Returns the location at which the diagnostic is reported.
Returns pos
-th note attached to the diagnostic. Expects pos
to be a
valid zero-based index into the list of notes.
Returns the number of notes attached to the diagnostic.
Returns the severity of the diagnostic.
Prints a diagnostic using the provided callback.
Checks if two dialects that belong to the same context are equal. Dialects
from different contexts will not compare equal.
Returns the context that owns the dialect.
Returns the namespace of the given dialect.
Returns the namespace associated with the provided dialect handle.
Inserts the dialect associated with the provided dialect handle into the
provided dialect registry
Loads the dialect associated with the provided dialect handle.
Registers the dialect associated with the provided dialect handle.
Creates a dialect registry and transfers its ownership to the caller.
Takes a dialect registry owned by the caller and destroys it.
Creates a dictionary attribute containing the given list of elements in the
provided context.
Returns pos-th element of the given dictionary attribute.
Returns the dictionary attribute element with the given name or NULL if the
given name does not exist in the dictionary.
Returns the number of attributes contained in a dictionary attribute.
Returns the typeID of a Dictionary attribute.
Gets the total number of elements in the given elements attribute. In order
to iterate over the attribute, obtain its type, which must be a statically
shaped type and use its sizes to build a multi-dimensional index.
Returns the element at the given rank-dimensional index.
Checks whether the given rank-dimensional index is valid in the given
elements attribute.
Emits an error at the given location through the diagnostics engine. Used
for testing purposes.
Sets the global debugging flag.
Creates an ExecutionEngine for the provided ModuleOp. The ModuleOp is
expected to be “translatable” to LLVM IR (only contains operations in
dialects that implement the LLVMTranslationDialectInterface
). The module
ownership stays with the client and can be destroyed as soon as the call
returns. optLevel
is the optimization level to be used for transformation
and code generation. LLVM passes at optLevel
are run before code
generation. The number and array of paths corresponding to shared libraries
that will be loaded are specified via numPaths
and sharedLibPaths
respectively.
TODO: figure out other options.
Destroy an ExecutionEngine instance.
Dump as an object in fileName
.
Invoke a native function in the execution engine by name with the arguments
and result of the invoked function passed as an array of pointers. The
function must have been tagged with the llvm.emit_c_interface
attribute.
Returns a failure if the execution fails for any reason (the function name
can’t be resolved for instance).
Lookup a native function in the execution engine by name, returns nullptr
if the name can’t be looked-up.
Lookup the wrapper of the native function in the execution engine with the
given name, returns nullptr if the function can’t be looked-up.
Register a symbol with the jit: this symbol will be accessible to the jitted
code.
This signals that the pass has failed. This is only valid to call during
the run
callback of MlirExternalPassCallbacks
.
See Pass::signalPassFailure().
Creates an f16 type in the given context. The type is owned by the
context.
Creates an f32 type in the given context. The type is owned by the
context.
Creates a f64 type in the given context. The type is owned by the
context.
Creates a flat symbol reference attribute in the given context referencing a
symbol identified by the given string.
Returns the referenced symbol as a string reference. The data remains live
as long as the context in which the attribute lives.
Creates an f8E4M3B11FNUZ type in the given context. The type is owned by the
context.
Returns the typeID of an Float8E4M3B11FNUZ type.
Creates an f8E4M3FN type in the given context. The type is owned by the
context.
Returns the typeID of an Float8E4M3FN type.
Creates an f8E4M3FNUZ type in the given context. The type is owned by the
context.
Returns the typeID of an Float8E4M3FNUZ type.
Creates an f8E5M2FNUZ type in the given context. The type is owned by the
context.
Returns the typeID of an Float8E5M2FNUZ type.
Creates an f8E5M2 type in the given context. The type is owned by the
context.
Returns the typeID of an Float8E5M2 type.
Returns the typeID of an Float16 type.
Returns the typeID of an Float32 type.
Returns the typeID of an Float64 type.
Creates a floating point attribute in the given context with the given
double value and double-precision FP semantics.
Same as “mlirFloatAttrDoubleGet”, but if the type is not valid for a
construction of a FloatAttr, returns a null MlirAttribute.
Returns the typeID of a Float attribute.
Returns the value stored in the given floating point attribute, interpreting
the value as double.
Returns the typeID of a TF32 type.
Sets the argument attribute ‘name’ of an argument at index ‘pos’.
Asserts that the operation is a FuncOp.
Creates a function type, mapping a list of input types to result types.
Returns the pos-th input type.
Returns the number of input types.
Returns the number of result types.
Returns the pos-th result type.
Returns the typeID of an Function type.
Checks whether two identifiers are the same.
Gets an identifier with the given string value.
Returns the context associated with this identifier
Gets the string value of the identifier.
Creates an index type in the given context. The type is owned by the
context.
Returns the typeID of an Index type.
Infers the return shaped type components of the operation. Calls callback
with the types of inferred arguments on success. Returns failure otherwise.
Returns the interface TypeID of the InferShapedTypeOpInterface.
Infers the return types of the operation identified by its canonical given
the arguments that will be supplied to its generic builder. Calls callback
with the types of inferred arguments, potentially several times, on success.
Returns failure otherwise.
Returns the interface TypeID of the InferTypeOpInterface.
Creates an integer attribute of the given type with the given integer
value.
Returns the typeID of an Integer attribute.
Returns the value stored in the given integer attribute, assuming the value
is of signless type and fits into a signed 64-bit integer.
Returns the value stored in the given integer attribute, assuming the value
is of signed type and fits into a signed 64-bit integer.
Returns the value stored in the given integer attribute, assuming the value
is of unsigned type and fits into an unsigned 64-bit integer.
Returns the typeID of an IntegerSet attribute.
Prints an integer set to the standard error stream.
Gets or creates a new canonically empty integer set with the give number of
dimensions and symbols in the given context.
Checks if two integer set objects are equal. This is a “shallow” comparison
of two objects. Only the sets with some small number of constraints are
uniqued and compare equal here. Set objects that represent the same integer
set with different constraints may be considered non-equal by this check.
Set difference followed by an (expensive) emptiness check should be used to
check equivalence of the underlying integer sets.
Gets or creates a new integer set in the given context. The set is defined
by a list of affine constraints, with the given number of input dimensions
and symbols, which are treated as either equalities (eqFlags is 1) or
inequalities (eqFlags is 0). Both constraints
and eqFlags
are expected
to point to at least numConstraint
consecutive values.
Returns pos
-th constraint of the set.
Gets the context in which the given integer set lives.
Returns the number of constraints (equalities + inequalities) in the given
set.
Returns the number of dimensions in the given set.
Returns the number of equalities in the given set.
Returns the number of inequalities in the given set.
Returns the number of inputs (dimensions + symbols) in the given set.
Returns the number of symbols in the given set.
Checks whether the given set is a canonical empty set, e.g., the set
returned by mlirIntegerSetEmptyGet.
Returns true
of the pos
-th constraint of the set is an equality
constraint, false
otherwise.
Prints an integer set by sending chunks of the string representation and
forwarding userData to
callback`. Note that the callback may be called
several times with consecutive chunks of the string.
Gets or creates a new integer set in which the values and dimensions of the
given set are replaced with the given affine expressions. dimReplacements
and symbolReplacements
are expected to point to at least as many
consecutive expressions as the given set has dimensions and symbols,
respectively. The new set will have numResultDims
and numResultSymbols
dimensions and symbols, respectively.
Creates a signless integer type of the given bitwidth in the context. The
type is owned by the context.
Returns the typeID of an Integer type.
Returns the bitwidth of an integer type.
Checks whether the given integer type is signed.
Checks whether the given integer type is signless.
Checks whether the given integer type is unsigned.
Creates a signed integer type of the given bitwidth in the context. The type
is owned by the context.
Creates an unsigned integer type of the given bitwidth in the context. The
type is owned by the context.
Retuns true
if the global debugging flag is set, false otherwise.
Creates an llvm.array type.
Creates an llvm.func type.
Creates an llvm.ptr type.
Creates an LLVM literal (unnamed) struct type.
Creates an llmv.void type.
Apply the special region builder for the builtin named Linalg op.
Assert that mlirOp
is a builtin named Linalg op.
Create an LLVM thread pool. This is reexported here to avoid directly
pulling in the LLVM headers directly.
Destroy an LLVM thread pool.
Creates a call site location with a callee and a caller.
Checks if two locations are equal.
Creates an File/Line/Column location owned by the given context.
Creates a location from a location attribute.
Creates a fused location with an array of locations and metadata.
Returns the underlying location attribute of this location.
Gets the context that a location was created with.
Creates a name location owned by the given context. Providing null location
for childLoc is allowed and if childLoc is null location, then the behavior
is the same as having unknown child location.
Prints a location by sending chunks of the string representation and
forwarding userData to
callback`. Note that the callback may be called
several times with consecutive chunks of the string.
Creates a location with unknown position owned by the given context.
Creates a MemRef type with the given rank, shape, memory space and element
type in the same context as the element type. The type has no affine maps,
i.e. represents a default row-major contiguous memref. The type is owned by
the context.
Same as “mlirMemRefTypeContiguousGet” but returns a nullptr wrapping
MlirType on illegal arguments, emitting appropriate diagnostics.
Creates a MemRef type with the given rank and shape, a potentially empty
list of affine layout maps, the given memory space and element type, in the
same context as element type. The type is owned by the context.
Returns the affine map of the given MemRef type.
Same as “mlirMemRefTypeGet” but returns a nullptr-wrapping MlirType o
illegal arguments, emitting appropriate diagnostics.
Returns the layout of the given MemRef type.
Returns the memory space of the given MemRef type.
Returns the typeID of an MemRef type.
Creates a new, empty module and transfers ownership to the caller.
Parses a module from the string and transfers ownership to the caller.
Takes a module owned by the caller and deletes it.
Views the generic operation as a module.
The returned module is null when the input operation was not a ModuleOp.
Gets the body of the module, i.e. the only block it contains.
Gets the context that a module was created with.
Views the module as a generic operation.
Associates an attribute with the name. Takes ownership of neither.
Creates a None type in the given context. The type is owned by the
context.
Returns the typeID of an None type.
Returns an op operand representing the next use of the value, or a null op
operand if there is no next use.
Returns the operand number of an op operand.
Returns the owner operation of an op operand.
Returns whether the op operand is null.
Add a pass and transfer ownership to the provided mlirOpPassManager. If the
pass is not a generic operation pass or matching the type of the provided
PassManager, a new OpPassManager is implicitly nested under the provided
PassManager.
Parse a sequence of textual MLIR pass pipeline elements and add them to the
provided OpPassManager. If parsing fails an error message is reported using
the provided callback.
Nest an OpPassManager under the provided OpPassManager, the nested
passmanager will only run on operations matching the provided name.
The returned OpPassManager will be destroyed when the parent is destroyed.
Do not verify the operation when using custom operation printers.
Creates new printing flags with defaults, intended for customization.
Must be freed with a call to mlirOpPrintingFlagsDestroy().
Destroys printing flags created with mlirOpPrintingFlagsCreate.
Enables the elision of large elements attributes by printing a lexically
valid but otherwise meaningless form instead of the element data. The
largeElementLimit
is used to configure what is considered to be a “large”
ElementsAttr by providing an upper limit to the number of elements.
Enable or disable printing of debug information (based on enable
). If
‘prettyForm’ is set to true, debug information is printed in a more readable
‘pretty’ form. Note: The IR generated with ‘prettyForm’ is not parsable.
Always print operations in the generic form.
Use local scope when printing the operation. This allows for using the
printer in a more localized and thread-safe setting, but may not
necessarily be identical to what the IR will look like when dumping
the full module.
Returns an operation that produced this value as its result. Asserts if the
value is not an op result.
Returns the position of the value in the list of results of the operation
that produced it.
Creates an opaque attribute in the given context associated with the dialect
identified by its namespace. The attribute contains opaque byte data of the
specified length (data need not be null-terminated).
Returns the raw data as a string reference. The data remains live as long as
the context in which the attribute lives.
Returns the namespace of the dialect with which the given opaque attribute
is associated. The namespace string is owned by the context.
Returns the typeID of an Opaque attribute.
Creates an opaque type in the given context associated with the dialect
identified by its namespace. The type contains opaque byte data of the
specified length (data need not be null-terminated).
Returns the raw data as a string reference. The data remains live as long as
the context in which the type lives.
Returns the namespace of the dialect with which the given opaque type
is associated. The namespace string is owned by the context.
Returns the typeID of an Opaque type.
Creates a deep copy of an operation. The operation is not inserted and
ownership is transferred to the caller.
Creates an operation and transfers ownership to the caller.
Note that caller owned child objects are transferred in this call and must
not be further used. Particularly, this applies to any regions added to
the state (the implementation may invalidate any such pointers).
Parses an operation, giving ownership to the caller. If parsing fails a null
operation will be returned, and an error diagnostic emitted.
Takes an operation owned by the caller and destroys it.
Prints an operation to stderr.
Checks whether two operation handles point to the same operation. This does
not perform deep comparison.
Return pos
-th attribute of the operation.
Returns an attribute attached to the operation given its name.
Gets the block that owns this operation, returning null if the operation is
not owned.
Gets the context this operation is associated with
Returns first region attached to the operation.
Gets the location of the operation.
Gets the name of the operation as an identifier.
Returns an operation immediately following the given operation it its
enclosing block.
Returns the number of attributes attached to the operation.
Returns the number of operands of the operation.
Returns the number of regions attached to the given operation.
Returns the number of results of the operation.
Returns the number of successor blocks of the operation.
Returns pos
-th operand of the operation.
Gets the operation that owns this operation, returning null if the operation
is not owned.
Returns pos
-th region attached to the operation.
Returns pos
-th result of the operation.
Returns pos
-th successor of the operation.
Gets the type id of the operation.
Returns null if the operation does not have a registered operation
description.
Returns true
if the given operation implements an interface identified by
its TypeID.
Returns true
if the operation identified by its canonical string name
implements the interface identified by its TypeID in the given context.
Note that interfaces may be attached to operations in some contexts and not
others.
Moves the given operation immediately after the other operation in its
parent block. The given operation may be owned by the caller or by its
current block. The other operation must belong to a block. In any case, the
ownership is transferred to the block of the other operation.
Moves the given operation immediately before the other operation in its
parent block. The given operation may be owner by the caller or by its
current block. The other operation must belong to a block. In any case, the
ownership is transferred to the block of the other operation.
Prints an operation by sending chunks of the string representation and
forwarding userData to
callback`. Note that the callback may be called
several times with consecutive chunks of the string.
Same as mlirOperationPrint but accepts flags controlling the printing
behavior.
Removes an attribute by name. Returns false if the attribute was not found
and true if removed.
Removes the given operation from its parent block. The operation is not
destroyed. The ownership of the operation is transferred to the caller.
Sets an attribute by name, replacing the existing if it exists or
adding a new one otherwise.
Sets the pos
-th operand of the operation.
Replaces the operands of the operation.
Adds a list of components to the operation state.
Enables result type inference for the operation under construction. If
enabled, then the caller must not have called
mlirOperationStateAddResults(). Note that if enabled, the
mlirOperationCreate() call is failable: it will return a null operation
on inference failure and will emit diagnostics.
Constructs an operation state from a name and a location.
Verify the operation and return true if it passes, false if it fails.
Same as mlirOperationPrint but writing the bytecode format.
Same as mlirOperationWriteBytecode but with writer config and returns
failure only if desired bytecode could not be honored.
Parse a textual MLIR pass pipeline and assign it to the provided
OpPassManager. If parsing fails an error message is reported using the
provided callback.
Add a pass and transfer ownership to the provided top-level mlirPassManager.
If the pass is not a generic operation pass or a ModulePass, a new
OpPassManager is implicitly nested under the provided PassManager.
Create a new top-level PassManager with the default anchor.
Create a new top-level PassManager anchored on anchorOp
.
Destroy the provided PassManager.
Enable mlir-print-ir-after-all.
Enable / disable verify-each.
Cast a top-level PassManager to a generic OpPassManager.
Nest an OpPassManager under the top-level PassManager, the nested
passmanager will only run on operations matching the provided name.
The returned OpPassManager will be destroyed when the parent is destroyed.
To further nest more OpPassManager under the newly returned one, see
mlirOpPassManagerNest
below.
Run the provided passManager
on the given op
.
Print a textual MLIR pass pipeline by sending chunks of the string
representation and forwarding userData to
callback`. Note that the
callback may be called several times with consecutive chunks of the string.
Casts from a type based on the expressed type of the given quantized type to
equivalent type based on storage type of the same quantized type.
Casts from a type based on the expressed type of the given type to a
corresponding type based on the given type. Returns a null type if the cast
is not valid.
Casts from a type based on the storage type of the given type to a
corresponding type based on the given type. Returns a null type if the cast
is not valid.
Casts from a type based on a quantized type to a corresponding typed based
on the expressed type. Returns a null type if the cast is not valid.
Casts from a type based on a quantized type to a corresponding typed based
on the storage type. Returns a null type if the cast is not valid.
Returns the maximum possible value stored by a quantized type.
Returns the minimum possible value stored by a quantized type.
Gets the original type approximated by the given quantized type.
Gets the flags associated with the given quantized type.
Returns the element type of the given quantized type as another quantized
type.
Returns the bit flag used to indicate signedness of a quantized type.
Returns the underlying type used to store the values.
Returns the integral bitwidth that the storage type of the given quantized
type can represent exactly.
Returns the maximum value that the storage type of the given quantized type
can take.
Returns the minimum value that the storage type of the given quantized type
can take.
Returns true
if the candidate
type is compatible with the given
quantized type
.
Returns true
if the given type is signed, false
otherwise.
Creates a tensor type of a fixed rank with the given shape, element type,
and optional encoding in the same context as the element type. The type is
owned by the context. Tensor types without any specific encoding field
should assign mlirAttributeGetNull() to this parameter.
Same as “mlirRankedTensorTypeGet” but returns a nullptr wrapping MlirType on
illegal arguments, emitting appropriate diagnostics.
Gets the ‘encoding’ attribute from the ranked tensor type, returning a null
attribute if none.
Returns the typeID of an RankedTensor type.
Takes a block owned by the caller and appends it to the given region.
Creates a new empty region and transfers ownership to the caller.
Takes a region owned by the caller and destroys it.
Checks whether two region handles point to the same region. This does not
perform deep comparison.
Gets the first block in the region.
Returns the region immediately following the given region in its parent
operation.
Takes a block owned by the caller and inserts it at pos
to the given
region. This is an expensive operation that linearly scans the region,
prefer insertAfter/Before instead.
Takes a block owned by the caller and inserts it after the (non-owned)
reference block in the given region. The reference block must belong to the
region. If the reference block is null, prepends the block to the region.
Takes a block owned by the caller and inserts it before the (non-owned)
reference block in the given region. The reference block must belong to the
region. If the reference block is null, appends the block to the region.
Moves the entire content of the source region to the target region.
Appends all upstream dialects and extensions to the dialect registry.
Register all translations to LLVM IR for dialects that can support it.
Register all compiler passes of MLIR.
Returns the dim-th dimension of the given ranked shaped type.
Returns the value indicating a dynamic size in a shaped type. Prefer
mlirShapedTypeIsDynamicSize to direct comparisons with this value.
Returns the value indicating a dynamic stride or offset in a shaped type.
Prefer mlirShapedTypeGetDynamicStrideOrOffset to direct comparisons with
this value.
Returns the element type of the shaped type.
Returns the rank of the given ranked shaped type.
Checks whether the given shaped type is ranked.
Checks whether the given shaped type has a static shape.
Checks wither the dim-th dimension of the given shaped type is dynamic.
Checks whether the given value is used as a placeholder for dynamic sizes
in shaped types.
Checks whether the given value is used as a placeholder for dynamic strides
and offsets in shaped types.
Returns the dense elements attribute containing 64-bit integer indices of
non-null elements in the given sparse elements attribute.
Returns the typeID of a SparseElements attribute.
Returns the dense elements attribute containing the non-null elements in the
given sparse elements attribute.
Creates a sparse elements attribute of the given shape from a list of
indices and a list of associated values. Both lists are expected to be dense
elements attributes with the same number of elements. The list of indices is
expected to contain 64-bit integers. The attribute is created in the same
context as the type.
Creates a sparse_tensor.encoding
attribute with the given parameters.
Returns the coordinate bitwidth of the sparse_tensor.encoding
attribute.
Returns the dimension-to-level mapping of the sparse_tensor.encoding
attribute.
Returns a specified level-type of the sparse_tensor.encoding
attribute.
Returns the position bitwidth of the sparse_tensor.encoding
attribute.
Returns the level-rank of the sparse_tensor.encoding
attribute.
Returns the typeID of a StridedLayout attribute.
Creates a string attribute in the given context containing the given string.
Returns the typeID of a String attribute.
Returns the attribute values as a string reference. The data remains live as
long as the context in which the attribute lives.
Creates a string attribute in the given context containing the given string.
Additionally, the attribute has the given type.
Constructs a string reference from a null-terminated C string. Prefer
mlirStringRefCreate if the length of the string is known.
Returns true if two string references are equal, false otherwise.
Creates a symbol reference attribute in the given context referencing a
symbol identified by the given string inside a list of nested references.
Each of the references in the list must not be nested.
Returns the string reference to the leaf referenced symbol. The data remains
live as long as the context in which the attribute lives.
Returns pos-th reference nested in the given symbol reference attribute.
Returns the number of references nested in the given symbol reference
attribute.
Returns the string reference to the root referenced symbol. The data remains
live as long as the context in which the attribute lives.
Returns the typeID of an SymbolRef attribute.
Creates a symbol table for the given operation. If the operation does not
have the SymbolTable trait, returns a null symbol table.
Destroys the symbol table created with mlirSymbolTableCreate. This does not
affect the operations in the table.
Removes the given operation from the symbol table and erases it.
Returns the name of the attribute used to store symbol names compatible with
symbol tables.
Returns the name of the attribute used to store symbol visibility.
Inserts the given operation into the given symbol table. The operation must
have the symbol trait. If the symbol table already has a symbol with the
same name, renames the symbol being inserted to ensure name uniqueness. Note
that this does not move the operation itself into the block of the symbol
table operation, this should be done separately. Returns the name of the
symbol after insertion.
Looks up a symbol with the given name in the given symbol table and returns
the operation that corresponds to the symbol. If the symbol cannot be found,
returns a null operation.
Attempt to replace all uses that are nested within the given operation
of the given symbol ‘oldSymbol’ with the provided ‘newSymbol’. This does
not traverse into nested symbol tables. Will fail atomically if there are
any unknown operations that may be potential symbol tables.
Walks all symbol table operations nested within, and including, op
. For
each symbol table operation, the provided callback is invoked with the op
and a boolean signifying if the symbols within that symbol table can be
treated as if all uses within the IR are visible to the caller.
allSymUsesVisible
identifies whether all of the symbol uses of symbols
within op
are visible.
Creates a TF32 type in the given context. The type is owned by the
context.
Creates a tuple type that consists of the given list of elemental types. The
type is owned by the context.
Returns the number of types contained in a tuple.
Returns the pos-th type in the tuple type.
Returns the typeID of an Tuple type.
Creates a type attribute wrapping the given type in the same context as the
type.
Returns the typeID of a Type attribute.
Returns the type stored in the given type attribute.
Prints the type to the standard error stream.
Checks if two types are equal.
Gets the context that a type was created with.
Gets the dialect a type belongs to.
Gets the type ID of the type.
Allocates a type id that is valid for the lifetime of the allocator
Creates a type id allocator for dynamic type id creation
Deallocates the allocator and all allocated type ids
ptr
must be 8 byte aligned and unique to a type valid for the duration of
the returned type id’s usage
Checks if two type ids are equal.
Returns the hash value of the type id.
Returns true
if the given type is an AnyQuantizedType.
Checks whether the given type is a bf16 type.
Returns true
if the given type is a CalibratedQuantizedType.
Checks whether the given type is a Complex type.
Checks whether the given type is an f16 type.
Checks whether the given type is an f32 type.
Checks whether the given type is an f64 type.
Checks whether the given type is an f8E4M3B11FNUZ type.
Checks whether the given type is an f8E4M3FN type.
Checks whether the given type is an f8E4M3FNUZ type.
Checks whether the given type is an f8E5M2 type.
Checks whether the given type is an f8E5M2FNUZ type.
Checks whether the given type is a function type.
Checks whether the given type is an index type.
Checks whether the given type is an integer type.
Checks whether the given type is a MemRef type.
Checks whether the given type is a None type.
Checks whether the given type is an opaque type.
Returns true
if the given type is a quantization dialect type.
Checks whether the given type is a ranked tensor type.
Checks whether the given type is a Shaped type.
Checks whether the given type is an TF32 type.
Checks whether the given type is a Tensor type.
Checks whether the given type is a tuple type.
Returns true
if the given type is a UniformQuantizedPerAxisType.
Returns true
if the given type is a UniformQuantizedType.
Checks whether the given type is an UnrankedMemRef type.
Checks whether the given type is an unranked tensor type.
Checks whether the given type is a Vector type.
Parses a type. The type is owned by the context.
Prints a location by sending chunks of the string representation and
forwarding userData to
callback`. Note that the callback may be called
several times with consecutive chunks of the string.
Creates an instance of UniformQuantizedPerAxisType with the given parameters
in the same context as storageType
and returns it. scales
and
zeroPoints
point to nDims
number of elements. The instance is owned
by the context.
Returns the number of axes in the given quantized per-axis type.
Returns the index of the quantized dimension in the given quantized per-axis
type.
Returns pos
-th scale of the given quantized per-axis type.
Returns pos
-th zero point of the given quantized per-axis type.
Returns true
if the given uniform quantized per-axis type is fixed-point.
Creates an instance of UniformQuantizedType with the given parameters in the
same context as storageType
and returns it. The instance is owned by the
context.
Returns the scale of the given uniform quantized type.
Returns the zero point of the given uniform quantized type.
Returns true
if the given uniform quantized type is fixed-point.
Creates a unit attribute in the given context.
Returns the typeID of a Unit attribute.
Creates an Unranked MemRef type with the given element type and in the given
memory space. The type is owned by the context of element type.
Same as “mlirUnrankedMemRefTypeGet” but returns a nullptr wrapping
MlirType on illegal arguments, emitting appropriate diagnostics.
Returns the typeID of an UnrankedMemRef type.
Returns the memory spcae of the given Unranked MemRef type.
Creates an unranked tensor type with the given element type in the same
context as the element type. The type is owned by the context.
Same as “mlirUnrankedTensorTypeGet” but returns a nullptr wrapping MlirType
on illegal arguments, emitting appropriate diagnostics.
Returns the typeID of an UnrankedTensor type.
Prints the value to the standard error stream.
Returns 1 if two values are equal, 0 otherwise.
Returns an op operand representing the first use of the value, or a null op
operand if there are no uses.
Returns the type of the value.
Returns 1 if the value is a block argument, 0 otherwise.
Returns 1 if the value is an operation result, 0 otherwise.
Prints a value by sending chunks of the string representation and
forwarding userData to
callback`. Note that the callback may be called
several times with consecutive chunks of the string.
Prints a value as an operand (i.e., the ValueID).
Replace all uses of ‘of’ value with the ‘with’ value, updating anything in
the IR that uses ‘of’ to use the other value instead. When this returns
there are zero uses of ‘of’.
Creates a vector type of the shape identified by its rank and dimensions,
with the given element type in the same context as the element type. The
type is owned by the context.
Same as “mlirVectorTypeGet” but returns a nullptr wrapping MlirType on
illegal arguments, emitting appropriate diagnostics.
Returns the typeID of an Vector type.