Beaver. MLIR. CAPI
(beaver v0.4.8)
Copy Markdown
This module ships MLIR's C API. These NIFs are generated from headers in LLVM repo and this repo's headers providing supplemental functions.
MLIR CAPIs might trigger Elixir code execution
Some MLIR CAPIs might trigger Elixir callbacks through a context worker. Their entry points use an asynchronous or dirty-scheduler boundary so a normal BEAM scheduler never waits for a callback that it must itself run. Callback implementations must not synchronously re-enter the same callback attachment.
Here are the list of these MLIR CAPIs and the Elixir code to execute they might trigger:
mlirPassManagerRunOnOp: the MLIR pass implemented in Elixir.mlirTransformApplyNamedSequence: Transform operations implemented in Elixir.mlirOperationVerify,mlirAttributeParseGet,mlirTypeParseGet,mlirModuleCreateParse: native diagnostic collection and any external operation interface reached during parsing or verification.
Summary
Functions
Attach a new FallbackModel for the ConditionallySpeculatable interface to the named operation. The FallbackModel will call the provided callbacks.
Create a conversion pattern that matches the operation with the given rootName, corresponding to mlir::OpConversionPattern.
Register the given dialect as dynamically legal, with a callback to determine per-instance legality for all operations in the dialect. The callback must not be NULL.
Register the given operation as dynamically legal, with a callback to determine per-instance legality. The callback must not be NULL.
Mark the given operation as recursively legal. The optional callback (may be NULL) determines whether a specific instance is recursively legal; a NULL callback marks the operation as unconditionally recursively legal.
Mark unknown operations as dynamically legal, with a callback. The callback must not be NULL.
Attach a new FallbackModel for the MemoryEffectsOpInterface to the named operation. The FallbackModel will call the provided callbacks.
Attach PatternDescriptorOpInterface to the operation with the given name using the provided callbacks.
Attach TransformOpInterface to the operation with the given name using the provided callbacks.
Add a 1:N type conversion function to the given TypeConverter.
Register a 1:N target materialization with the given TypeConverter.
Add a type conversion function to the given TypeConverter.
Register a source materialization with the given TypeConverter. This is invoked when a replacement value must be converted back to its original source type because some uses persist beyond the main conversion.
Register a target materialization with the given TypeConverter. This is invoked when a value must be converted to a target type according to a pattern's type converter.
Schedules callback-bridging work on the context's LLVM pool, outside BEAM scheduler threads. An elastic pool prevents nested pass/rewrite callbacks from starving a pool shared by multiple contexts.
Returns the LLVM version and source revision used to build Beaver. The returned string has static storage duration and must not be freed.
Creates a reusable thread pool that grows beyond its reported parallelism when every worker is blocked by nested synchronous callback work.
See Beaver.MLIR.CAPI.Raw.load_nif/0.
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'.
Returns true if the given affine expression is a null expression. Note
constant zero is not a null expression.
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 tocallback`. Note that the callback may be called
several times with consecutive chunks of the string.
Replace dims[offset ... numDims) by dims[offset + shift ... shift + numDims).
Replace symbols[offset ... numSymbols) by symbols[offset + shift ... shift + numSymbols).
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 an affine map is null.
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 permutation.) The affine map is owned by the context.
Prints an affine map by sending chunks of the string representation and
forwarding userData tocallback`. 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.
Apply a full conversion on the given operation.
Apply a partial conversion on the given operation.
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.
Creates new AsmState, as with AsmState the IR should not be mutated in-between using this state. Must be freed with a call to mlirAsmStateDestroy().
Creates new AsmState from value. Must be freed with a call to mlirAsmStateDestroy().
Destroys printing flags created with mlirAsmStateCreate.
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 complex 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.
Check if the given attribute is a dynamic 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.
Checks whether an attribute is null.
Parses an attribute. The attribute is owned by the context.
Parses an attribute. The attribute is owned by the context.
Prints an attribute by sending chunks of the string representation and
forwarding userData tocallback`. 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 location of the block argument to the given location.
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.
Erase the argument at 'index' and remove it from the argument list.
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 number of predecessor blocks of the block.
Returns the number of successor blocks of the block.
Returns the closest surrounding operation that contains this block.
Returns the region that contains this block.
Returns pos-th predecessor of the block.
WARNING: This getter is more expensive than the others here because
the impl actually iterates the use-def chain (of block operands) anew for
each indexed access.
Returns pos-th successor of the 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.
Checks whether a block is null.
Prints a block by sending chunks of the string representation and
forwarding userData tocallback`. 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 attribute in the given context with the given double real and imaginary values and double-precision FP semantics.
Same as "mlirComplexAttrDoubleGet", but if the type is not valid for a construction of a ComplexAttr, returns a null MlirAttribute.
Same as "mlirComplexAttrDoubleGet", but if the type is not valid for a construction of a ComplexAttr, returns a null MlirAttribute.
Returns the imaginaryvalue stored in the given complex attribute, interpreting the value as double.
Returns the real value stored in the given complex attribute, interpreting the value as double.
Returns the typeID of a Complex attribute.
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.
Returns the speculatability of the given operation. The operation must implement the ConditionallySpeculatable interface.
Returns the interface TypeID of the ConditionallySpeculatable interface.
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.
Gets the dialect instance owned by the given context using the dialect namespace to identify it. If the dialect is not loaded by the context, returns null. Use mlirContextGetOrLoadDialect to load a dialect if it is registered with the context.
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 number of threads of the thread pool of the context when multithreading is enabled. Returns 1 if no multithreading.
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 mlirContextLoad <Name
Gets the thread pool of the context when enabled multithreading, otherwise an assertion is raised.
Checks whether a context is null.
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.
Create a default ConversionConfig.
Destroy the given ConversionConfig.
Enable or disable building materializations during conversion.
Get the folding mode for the given ConversionConfig.
Check if building materializations during conversion is enabled.
Set the folding mode for the given ConversionConfig.
Cast the ConversionPattern to a RewritePattern.
Get the type converter used by this conversion pattern.
Cast the ConversionPatternRewriter to a PatternRewriter
Apply a signature conversion to each block in the given region.
Replace the given operation with multiple value ranges -- one range per
result of op -- and erase it. nRanges must equal the number of results
of op. rangeSizes[i] is the number of values in the i-th range, and
values is the flat concatenation of all ranges (its length is the sum of
rangeSizes[0..nRanges)).
Register the operations of the given dialect as illegal.
Register the given operations as illegal.
Register the operations of the given dialect as legal.
Register the given operations as legal.
Create an empty ConversionTarget.
Destroy the given ConversionTarget.
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. The format of the raw buffer is a densely packed array of values that can be bitcast to the storage format of the element type specified. Types that are not byte aligned will be
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.
Deprecated API. Will be removed in the future.
Returns the typeID of a DenseTypedElements 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.
Check if the given dialect is an extensible dialect.
Checks if the dialect is null.
Creates a dialect registry and transfers its ownership to the caller.
Takes a dialect registry owned by the caller and destroys it.
Checks if the dialect registry is null.
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.
Creates a DistinctAttr with the referenced attribute.
Creates a DominanceInfo for the given operation (typically a FuncOp or ModuleOp). The caller owns the returned object and must destroy it.
Destroys the given DominanceInfo.
Returns true if block A dominates block B.
Returns true if operation A dominates operation B (A == B or A properly dominates B).
Finds the nearest common dominator of blocks A and B. Returns a null block if none exists.
Invalidates all cached dominance information.
Returns true if the given block is reachable from the entry block of its region.
Returns true if block A properly dominates block B.
Returns true if operation A properly dominates operation B.
Returns true if value A dominates operation B (the operation defining A is B or A properly dominates B).
Returns true if value A properly dominates operation B.
Get the dialect that the given dynamic attribute definition belongs to.
Get the name of the given dynamic attribute definition.
Get the type ID of a dynamic attribute definition.
Get a dynamic attribute by instantiating the given attribute definition with the provided attributes.
Get the attribute definition of the given dynamic attribute.
Get the number of parameters in the given dynamic attribute.
Get the parameter at the given index in the provided dynamic attribute.
Attach a dynamic op trait to the given operation name. Note that the operation name must be modeled by dynamic dialect and must be registered. The ownership of the trait will be transferred to the operation name after this call.
Destroy the dynamic op trait.
Get the dynamic op trait that indicates regions are isolated from above.
Get the type ID of the dynamic op trait that indicates regions are isolated from above.
Get the dynamic op trait that indicates the operation is a terminator.
Get the type ID of the dynamic op trait that indicates the operation is a terminator.
Get the dynamic op trait that indicates regions have no terminator.
Get the type ID of the dynamic op trait that indicates regions have no terminator.
Get the dialect that the given dynamic type definition belongs to.
Get the name of the given dynamic type definition.
Get the type ID of a dynamic type definition.
Get a dynamic type by instantiating the given type definition with the provided attributes.
Get the number of parameters in the given dynamic type.
Get the parameter at the given index in the provided dynamic type.
Get the type definition of the given dynamic type.
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.
The enablePIC arguments controls the relocation model, when true the
generated code is emitted as "position independent", making it possible to
save it and reload it as a shared object in another process.
TODO: figure out other options.
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.
The enablePIC arguments controls the relocation model, when true the
generated code is emitted as "position independent", making it possible to
save it and reload it as a shared object in another process.
TODO: figure out other options.
Destroy an ExecutionEngine instance.
Dump as an object in fileName.
Initialize the ExecutionEngine. Global constructors specified by
llvm.mlir.global_ctors will be run. One common scenario is that kernel
binary compiled from gpu.module gets loaded during initialization. Make
sure all symbols are resolvable before initialization by calling
mlirExecutionEngineRegisterSymbol or including shared libraries.
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).
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).
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).
Checks whether an execution engine is null.
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.
Look up a registered attribute definition by attribute name in the given dialect. Note that the dialect must be an extensible dialect.
Look up a registered type definition by type name in the given dialect. Note that the dialect must be an extensible dialect.
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 f4E2M1FN type in the given context. The type is owned by the context.
Returns the typeID of an Float4E2M1FN type.
Creates an f6E2M3FN type in the given context. The type is owned by the context.
Returns the typeID of an Float6E2M3FN type.
Creates an f6E3M2FN type in the given context. The type is owned by the context.
Returns the typeID of an Float6E3M2FN type.
Creates an f8E3M4 type in the given context. The type is owned by the context.
Returns the typeID of an Float8E3M4 type.
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 f8E4M3 type in the given context. The type is owned by the context.
Returns the typeID of an Float8E4M3 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.
Creates an f8E5M3FNU type in the given context. The type is owned by the context.
Returns the typeID of a Float8E5M3FNU type.
Creates an f8E8M0FNU type in the given context. The type is owned by the context.
Returns the typeID of an Float8E8M0FNU 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.
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.
Returns the bitwidth of a floating-point type.
Freeze the given MlirRewritePatternSet to a MlirFrozenRewritePatternSet. Note that the ownership of the input set is transferred into the frozen set after this call.
Destroy the given MlirFrozenRewritePatternSet.
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.
Creates a greedy rewrite driver configuration with default settings.
Destroys a greedy rewrite driver configuration.
Enables or disables constant CSE.
Enables or disables folding during greedy rewriting.
Gets the maximum number of iterations for the greedy rewrite driver.
Gets the maximum number of rewrites within an iteration.
Gets the region simplification level.
Gets the strictness level for the greedy rewrite driver.
Gets whether top-down traversal is used for initial worklist population.
Gets whether constant CSE is enabled.
Gets whether folding is enabled during greedy rewriting.
Sets the maximum number of iterations for the greedy rewrite driver. Use -1 for no limit.
Sets the maximum number of rewrites within an iteration. Use -1 for no limit.
Sets the region simplification level.
Sets the strictness level for the greedy rewrite driver.
Sets whether to use top-down traversal for the initial population of the worklist.
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.
Returns the interface TypeID of the InferShapedTypeOpInterface.
Returns the interface TypeID of the InferTypeOpInterface.
Creates an integer attribute of the given type with the given integer value.
Creates an integer attribute of the given type from an array of 64-bit words. This is useful for creating integer attributes with values with widths larger than 64 bits. Words are in little-endian order (least significant word first). The number of words must match the bit width of the type: numWords = ceil(bitWidth / 64).
Returns the typeID of an Integer attribute.
Returns the bit width of the integer attribute's underlying APInt value. This is useful for determining the size of the integer, especially for values larger than 64 bits.
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 number of 64-bit words that make up the integer attribute's underlying APInt value. For integers < = 64 bits, this returns 1.
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.
Copies the 64-bit words making up the integer attribute's APInt value into the provided buffer. The buffer must have space for at least mlirIntegerAttrGetValueNumWords(attr) elements. Words are stored in little-endian order (least significant word first). The sign information is not encoded in the words themselves; use the type's signedness to interpret the value correctly.
Creates an integer set attribute wrapping the given set. The attribute belongs to the same context as the integer set.
Returns the typeID of an IntegerSet attribute.
Returns the integer set wrapped in the given integer set 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.
Checks whether an integer set is a null object.
Prints an integer set by sending chunks of the string representation and
forwarding userData tocallback`. 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.
Clears all mappings.
Returns true if the mapping contains a mapping for the given block.
Returns true if the mapping contains a mapping for the given operation.
Returns true if the mapping contains a mapping for the given value.
Creates a new empty IRMapping.
Destroys the given IRMapping.
Erases a block mapping.
Erases an operation mapping.
Erases a value mapping.
Checks whether an IRMapping is null.
Looks up a mapped Block. Returns the mapped block, or the input block if no mapping exists.
Looks up a mapped Operation. Returns the mapped operation, or the input operation if no mapping exists.
Looks up a mapped Value. Returns the mapped value, or the input value if no mapping exists.
Looks up a mapped Block. Returns a null MlirBlock if no mapping exists.
Looks up a mapped Operation. Returns a null MlirOperation if no mapping exists.
Looks up a mapped Value. Returns a null MlirValue if no mapping exists.
Maps a Block in the mapping.
Maps an Operation in the mapping.
Maps a Value in the mapping.
Create an IRRewriter and transfer ownership to the caller.
Create an IRRewriter and transfer ownership to the caller. Additionally set the insertion point before the operation.
Takes an IRRewriter owned by the caller and destroys it. It is the responsibility of the user to only pass an IRRewriter class.
Checks if type is set as the current debug type.
Retuns true if the global debugging flag is set, false otherwise.
Apply the special region builder for the builtin named Linalg op.
Assert that mlirOp is a builtin named Linalg op.
Creates an llvm.array type.
Returns the element type of the llvm.array type.
Returns the number of elements in the llvm.array type.
Returns true if the attribute is an LLVM MDConstantAttr.
Returns true if the attribute is an LLVM MDGlobalValueAttr.
Returns true if the attribute is an LLVM MDNodeAttr.
Returns true if the attribute is an LLVM MDStringAttr.
Creates a LLVM CConv attribute.
Creates a LLVM Comdat attribute.
Creates a LLVM DIAnnotation attribute.
Creates a LLVM DIBasicType attribute.
Creates a LLVM DICompileUnit attribute.
Creates a self-referencing LLVM DICompileUnitAttr attribute.
Creates a LLVM DICompositeType attribute.
Creates a self-referencing LLVM DICompositeType attribute.
Creates a LLVM DIDerivedType attribute. Note that dwarfAddressSpace is an
optional field, where MLIR_CAPI_DWARF_ADDRESS_SPACE_NULL indicates null
and non-negative values indicate a value present.
Gets the base type from a LLVM DIDerivedType attribute.
Creates a LLVM DIExpression attribute.
Creates a LLVM DIExpressionElem attribute.
Creates a LLVM DIFileAttr attribute.
Creates a LLVM DIFlags attribute.
Creates a LLVM DIImportedEntityAttr attribute.
Creates a LLVM DILexicalBlock attribute.
Creates a LLVM DILexicalBlockFile attribute.
Creates a LLVM DILocalVariableAttr attribute.
Creates a LLVM DIModuleAttr attribute.
Gets the scope of this DIModuleAttr.
Creates a LLVM DINullType attribute.
Creates a LLVM DISubprogramAttr attribute.
Gets the compile unit from this DISubprogram.
Gets the file from this DISubprogramAttr.
Gets the line from this DISubprogramAttr.
Creates a self-referencing LLVM DISubprogramAttr attribute.
Gets the scope from this DISubprogramAttr.
Gets the scope line from this DISubprogram.
Gets the type from this DISubprogramAttr.
Creates a LLVM DISubroutineTypeAttr attribute.
Creates an llvm.func type.
Returns the pos-th input type.
Returns the number of input types.
Returns the return type of the function type.
Returns the TypeID of an LLVM function type.
Returns true if the function type is variadic.
Creates a LLVM Linkage attribute.
Creates an LLVM MDConstantAttr wrapping an attribute.
Returns the TypeID of MDConstantAttr.
Returns the attribute value of an LLVM MDConstantAttr.
Creates an LLVM MDGlobalValueAttr referencing a symbol-backed global value.
Returns the symbol name of an LLVM MDGlobalValueAttr.
Returns the TypeID of MDGlobalValueAttr.
Creates an LLVM MDNodeAttr.
Returns the number of operands in an LLVM MDNodeAttr.
Returns the operand at the given index of an LLVM MDNodeAttr.
Returns the TypeID of MDNodeAttr.
Creates an LLVM MDStringAttr.
Returns the TypeID of MDStringAttr.
Returns the string value of an LLVM MDStringAttr.
Creates an llvm.ptr type.
Returns address space of llvm.ptr
Returns the positions-th field of the struct. Asserts if the struct is
opaque, not yet initialized or if the position is out of range.
Returns the identifier of the identified struct. Asserts that the struct is identified, i.e., not literal.
Returns the number of fields in the struct. Asserts if the struct is opaque or not yet initialized.
Creates an LLVM identified struct type with no body. If a struct type with this name already exists in the context, returns that type. Use mlirLLVMStructTypeIdentifiedNewGet to create a fresh struct type, potentially renaming it. The body should be set separatelty by calling mlirLLVMStructTypeSetBody, if it isn't set already.
Creates an LLVM identified struct type with no body and a name starting with the given prefix. If a struct with the exact name as the given prefix already exists, appends an unspecified suffix to the name so that the name is unique in context.
Returns true if the type is a literal (unnamed) LLVM struct type.
Returns true is the struct is explicitly opaque (will not have a body) or
uninitialized (will eventually have a body).
Returns true if the struct is packed.
Creates an LLVM literal (unnamed) struct type. This may assert if the fields have types not compatible with the LLVM dialect. For a graceful failure, use the checked version.
Creates an LLVM literal (unnamed) struct type if possible. Emits a diagnostic at the given location and returns null otherwise.
Creates an LLVM literal (unnamed) struct type if possible. Emits a diagnostic at the given location and returns null otherwise.
Sets the body of the identified struct if it hasn't been set yet. Returns whether the operation was successful.
Creates an llmv.void type.
Create a raw_fd_ostream for the given path. This wrapper is needed because std::ostream does not provide the file sharing semantics required on Windows.
Destroy a raw_fd_ostream created with mlirLlvmRawFdOStreamCreate.
Checks if a raw_fd_ostream is null.
Write a string to a raw_fd_ostream created with mlirLlvmRawFdOStreamCreate.
Create an LLVM thread pool. This is reexported here to avoid directly pulling in the LLVM headers directly.
Destroy an LLVM thread pool.
Returns the maximum number of threads in the thread pool.
Loads all IRDL dialects in the provided module, registering the dialects in the module's associated context.
Creates a call site location with a callee and a caller.
Getter for callee of CallSite.
Getter for caller of CallSite.
TypeID Getter for CallSite.
Checks if two locations are equal.
Creates an File/Line/Column location owned by the given context.
Creates an File/Line/Column range location owned by the given context.
Getter for end_column of FileLineColRange.
Getter for end_line of FileLineColRange.
Getter for filename of FileLineColRange.
Getter for start_column of FileLineColRange.
Getter for start_line of FileLineColRange.
TypeID Getter for FileLineColRange.
Creates a location from a location attribute.
Creates a fused location with an array of locations and metadata.
Getter for locations of Fused. Requires pre-allocated memory of #fusedLocations X sizeof(MlirLocation).
Getter for metadata of Fused.
Getter for number of locations fused together.
TypeID Getter for Fused.
Returns the underlying location attribute of this location.
Gets the context that a location was created with.
Checks whether the given location is an CallSite.
Checks whether the given location is an FileLineColRange.
Checks whether the given location is an Fused.
Checks whether the given location is an Name.
Checks whether the given location is an Unknown.
Checks if the location is null.
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.
Getter for childLoc of Name.
Getter for name of Name.
TypeID Getter for Name.
Prints a location by sending chunks of the string representation and
forwarding userData tocallback`. 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.
TypeID Getter for Unknown.
Creates a logical result representing a failure.
Checks if the given logical result represents a failure.
Checks if the given logical result represents a success.
Creates a logical result representing a success.
Creates a memory effect instance without an associated IR entity.
parameters may be a null attribute. The caller owns the returned instance
and must destroy it with mlirMemoryEffectInstanceDestroy.
Creates a memory effect instance associated with a block argument.
blockArgument must wrap a BlockArgument. parameters may be a null
attribute. The caller owns the returned instance and must destroy it with
mlirMemoryEffectInstanceDestroy.
Creates a memory effect instance associated with an operation operand.
parameters may be a null attribute. The caller owns the returned instance
and must destroy it with mlirMemoryEffectInstanceDestroy.
Creates a memory effect instance associated with an operation result.
result must wrap an OpResult. parameters may be a null attribute. The
caller owns the returned instance and must destroy it with
mlirMemoryEffectInstanceDestroy.
Creates a memory effect instance associated with a symbol. symbol must be
a SymbolRefAttr. parameters may be a null attribute. The caller owns the
returned instance and must destroy it with
mlirMemoryEffectInstanceDestroy.
Destroys a memory effect instance created by one of the functions above.
Appends a copy of instance to the given list. This does not take ownership
of instance; the caller remains responsible for destroying it.
Returns the borrowed singleton instance of the allocate memory effect.
Returns the borrowed singleton instance of the free memory effect.
Returns the interface TypeID of the MemoryEffectsOpInterface.
Returns the borrowed singleton instance of the read memory effect.
Returns the borrowed singleton instance of the write memory effect.
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.
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.
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 strides of the MemRef if the layout map is in strided form. Both strides and offset are out params. strides must point to pre-allocated memory of length equal to the rank of the memref.
Returns the typeID of an MemRef type.
Merge the symbols from other into target, potentially renaming them to
avoid conflicts. Private symbols may be renamed during the merge, public
symbols must have at most one declaration. A name conflict in public symbols
is reported as an error before returning a failure.
Note that this clones the other operation unlike the C++ counterpart that
takes ownership.
Creates a new, empty module and transfers ownership to the caller.
Parses a module from the string and transfers ownership to the caller.
Parses a module from file 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.
Checks if two modules are equal.
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.
Compute a hash for the given module.
Checks whether a module is null.
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.
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.
Clones the operation with the given mapping. The mapping is updated with the cloned operation's results and regions.
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). This call can fail under the following conditions, in which case, it will return a null operation and emit diagnostics
Parses an operation, giving ownership to the caller. If parsing fails a null
operation will be returned, and an error diagnostic emitted.
sourceStr may be either the text assembly format, or binary bytecode
format. sourceName is used as the file name of the source; any IR without
locations will get a FileLineColLoc location with sourceName as the file
name.
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.
Deprecated, please use mlirOperationGetInherentAttribute or
mlirOperationGetDiscardableAttribute.
Returns an attribute attached to the operation given its name.
Deprecated, please use mlirOperationGetInherentAttributeByName or
mlirOperationGetDiscardableAttributeByName.
Gets the block that owns this operation, returning null if the operation is not owned.
Gets the context this operation is associated with
Return pos-th discardable attribute of the operation.
Returns a discardable attribute attached to the operation given its name.
Returns first region attached to the operation.
Returns an inherent attribute attached to the operation given its name.
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.
Deprecated, please use mlirOperationGetNumInherentAttributes or
mlirOperationGetNumDiscardableAttributes.
Returns the number of discardable 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.
Returns pos-th OpOperand 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.
Compute a hash for the given operation. Operand and result SSA values are hashed by identity and locations are significant, so equivalent-but-distinct operations hash differently; use mlirOperationStructuralHashValue for a hash that pairs with mlirOperationIsStructurallyEquivalent.
Returns true if this operation defines an inherent attribute with this name.
Note: the attribute can be optional, so
mlirOperationGetInherentAttributeByName can still return a null attribute.
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.
Given an operation 'other' that is within the same parent block, return whether the current operation is before 'other' in the operation list of the parent block. Note: This function has an average complexity of O(1), but worst case may take O(N) where N is the number of operations within the parent block.
Checks whether the underlying operation is null.
Checks whether two operations are structurally equivalent, i.e. they have
the same name, attributes, operand and result types, and recursively
equivalent regions. Operand equivalence is tracked structurally while
recursing into regions, so operands defined inside the compared regions need
not be the exact same SSA values; operands defined outside must be. flags
is a bitwise OR of MlirOperationEquivalenceFlags values.
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.
Checks if the operation name has a trait identified by the given type id.
Prints an operation by sending chunks of the string representation and
forwarding userData tocallback`. 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.
Same as mlirOperationPrint but accepts AsmState controlling the printing behavior as well as caching computed names.
Removes an attribute by name. Returns false if the attribute was not found
and true if removed.
Deprecated, please use mlirOperationRemoveInherentAttributeByName or
mlirOperationRemoveDiscardableAttributeByName.
Removes a discardable 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.
Replace uses of 'of' value with the 'with' value inside the 'op' operation.
Sets an attribute by name, replacing the existing if it exists or
adding a new one otherwise.
Deprecated, please use mlirOperationSetInherentAttributeByName or
mlirOperationSetDiscardableAttributeByName.
Sets a discardable attribute by name, replacing the existing if it exists or
adding a new one otherwise. The new attr Attribute is not allowed to be
null, use mlirOperationRemoveDiscardableAttributeByName to remove an
Attribute instead.
Sets an inherent attribute by name, replacing the existing if it exists. This has no effect if "name" does not match an inherent attribute.
Sets the location of the operation.
Sets the pos-th operand of the operation.
Replaces the operands of the operation.
Set pos-th successor 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.
Computes a hash for the given operation that pairs with
mlirOperationIsStructurallyEquivalent: two operations that are structurally
equivalent under the same flags hash equally. Operands are hashed by
identity, results are not hashed at all, and regions do not participate in
the hash. flags is a bitwise OR of MlirOperationEquivalenceFlags values.
Verify the operation and return true if it passes, false if it fails.
Verify the operation and return true if it passes, false if it fails.
Walks operation op in walkOrder and calls callback on that operation.
*userData is passed to the callback as well and can be used to tunnel some
context or other data into the callback.
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.
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 the value 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.
Enables the elision of large resources strings by omitting them from the
dialect_resources section. The largeResourceLimit is used to configure
what is considered to be a "large" resource by providing an upper limit to
the string size.
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.
Print the name and location, if NamedLoc, as a prefix to the SSA ID.
Skip printing regions.
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.
Create a rewrite pattern that matches the operation with the given rootName, corresponding to mlir::OpRewritePattern.
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 IR printing. The treePrintingPath argument is an optional path to a directory where the dumps will be produced. If it isn't provided then dumps are produced to stderr.
Enable pass statistics.
Enable pass timing.
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.
Checks if a PassManager is null.
Run the provided passManager on the given op.
Returns the interface TypeID of the PatternDescriptorOpInterface.
Cast the PatternRewriter to a RewriterBase
Register a constraint function into the given PDL pattern module.
userData will be provided as an argument to the constraint function.
Register a rewrite function into the given PDL pattern module.
userData will be provided as an argument to the rewrite function.
Push the MlirAttribute into the given MlirPDLResultList.
Push the MlirOperation into the given MlirPDLResultList.
Push the MlirType into the given MlirPDLResultList.
Push the MlirValue into the given MlirPDLResultList.
Cast the MlirPDLValue to an MlirAttribute. Return a null value if the cast fails, just like llvm::dyn_cast.
Cast the MlirPDLValue to an MlirOperation. Return a null value if the cast fails, just like llvm::dyn_cast.
Cast the MlirPDLValue to an MlirType. Return a null value if the cast fails, just like llvm::dyn_cast.
Cast the MlirPDLValue to an MlirValue. Return a null value if the cast fails, just like llvm::dyn_cast.
Creates a PostDominanceInfo for the given operation.
Destroys the given PostDominanceInfo.
Invalidates all cached post-dominance information.
Returns true if block A post-dominates block B.
Returns true if operation A post-dominates operation B.
Returns true if block A properly post-dominates block B.
Returns true if operation A properly post-dominates operation B.
Print a textual MLIR pass pipeline by sending chunks of the string
representation and forwarding userData tocallback`. 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.
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.
Checks whether a region is null.
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.
Add the given MlirRewritePattern into a MlirRewritePatternSet. Note that the ownership of the pattern is transferred to the set after this call.
Create an empty MlirRewritePatternSet.
Destruct the given MlirRewritePatternSet.
Get the context associated with a MlirRewritePatternSet.
This method cancels a pending in-place modification. This can only be
called on operations that were provided to a call to
startOpModification.
Reset the insertion point to no location. Creating an operation without a set insertion point is an error, but this can still be useful when the current insertion point a builder refers to is being removed.
Creates a deep copy of the specified operation.
Clone the blocks that belong to "region" before the given position in another region "parent".
Clones the given operation using the rewriter and the provided IRMapping. The mapping is updated with the results of the cloned operation.
Creates a deep copy of this operation but keep the operation regions empty.
Add new block with 'argTypes' arguments and set the insertion point to the
end of it. The block is placed before 'insertBefore'. locs contains the
locations of the inserted arguments, and should match the size of
argTypes.
Erases a block along with all operations inside it.
Erases an operation that is known to have no uses.
This method is used to signal the end of an in-place modification of the
given operation. This can only be called on operations that were provided
to a call to startOpModification.
Returns the current block of the rewriter.
Get the MLIR context referenced by the rewriter.
Return the block the current insertion point belongs to. Note that the insertion point is not necessarily the end of the block.
Returns the operation right after the current insertion point of the rewriter. A null MlirOperation will be returned
Inline the operations of block 'source' before the operation 'op'. The source block will be deleted and must have no uses. 'argValues' is used to replace the block arguments of 'source' The source block must have no successors. Otherwise, the resulting IR would have unreachable operations.
Move the blocks that belong to "region" before the given position in another region "parent". The two regions must be different. The caller is responsible for creating or updating the operation transferring flow of control to the region and passing it the correct block arguments.
Insert the given operation at the current insertion point and return it.
Inline the operations of block 'source' into the end of block 'dest'. The source block will be deleted and must have no uses. 'argValues' is used to replace the block arguments of 'source' The dest block must have no successors. Otherwise, the resulting IR would have unreachable operation.
Unlink this block and insert it right before existingBlock.
Unlink this operation from its current block and insert it right after
existingOp which may be in the same or another block in the same
function.
Unlink this operation from its current block and insert it right before
existingOp which may be in the same or another block in the same
function.
Find uses of from and replace them with to. Also notify the listener
about every in-place op modification (for every use that was replaced)
and that the from operation is about to be replaced.
Find uses of from and replace them with to. Also notify the listener
about every in-place op modification (for every use that was replaced)
and that the from operation is about to be replaced.
Find uses of from and replace them with to except if the user is
exceptedUser. Also notify the listener about every in-place op
modification (for every use that was replaced).
Find uses of from and replace them with to. Also notify the listener
about every in-place op modification (for every use that was replaced).
Find uses of from and replace them with to. Also notify the listener
about every in-place op modification (for every use that was replaced).
Find uses of from within block and replace them with to. Also notify
the listener about every in-place op modification (for every use that was
replaced). The optional allUsesReplaced flag is set to "true" if all
uses were replaced.
Replace the results of the given (original) operation with the specified new op (replacement). The result types of the two ops must match. The original op is erased.
Replace the results of the given (original) operation with the specified list of values (replacements). The result types of the given op and the replacements must match. The original op is erased.
Restores a previously saved insertion point.
Returns the current insertion point of the rewriter so that it can be restored later with mlirRewriterBaseRestoreInsertionPoint.
Sets the insertion point to the node after the specified operation, which will cause subsequent insertions to go right after it.
Sets the insertion point to the node after the specified value. If value has a defining operation, sets the insertion point to the node after such defining operation. This will cause subsequent insertions to go right after it. Otherwise, value is a BlockArgument. Sets the insertion point to the start of its block.
Sets the insertion point to the specified operation, which will cause subsequent insertions to go right before it.
Sets the insertion point to the end of the specified block.
Sets the insertion point to the start of the specified block.
This method is used to notify the rewriter that an in-place operation
modification is about to happen. A call to this function must be
followed by a call to either finalizeOpModification or
cancelOpModification. This is a minor efficiency win (it avoids creating
a new operation and removing the old one) but also often allows simpler
code in the client.
Sets the current debug type, similarly to -debug-only=type in the
command-line tools. Note that global debug should be enabled for any output
to be produced.
Sets multiple current debug types, similarly to `-debug-only=type1,type2" in the command-line tools. Note that global debug should be enabled for any output to be produced.
Returns the dim-th dimension of the given ranked shaped type.
Returns the value indicating a dynamic size in a shaped type. Prefer mlirShapedTypeIsDynamicSize and mlirShapedTypeIsStaticSize to direct comparisons with this value.
Returns the value indicating a dynamic stride or offset in a shaped type. Prefer mlirShapedTypeIsDynamicStrideOrOffset and mlirShapedTypeIsStaticStrideOrOffset 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 whether 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.
Checks whether the dim-th dimension of the given shaped type is static.
Checks whether the given shaped type dimension value is statically-sized.
Checks whether the given dimension value of a stride or an offset is statically-sized.
Returns the borrowed singleton instance of the default side effect resource.
Simplify an affine expression by flattening and some amount of simple
analysis. This has complexity linear in the number of nodes in 'expr'.
Returns the simplified expression, which is the same as the input expression
if it can't be simplified. When expr is semi-affine, a simplified
semi-affine expression is constructed in the sorted order of dimension and
symbol positions.
Checks if the given string is a valid smt::BVCmpPredicate.
Checks if the given string is a valid smt::IntPredicate.
Creates a smt::BitVectorAttr with the given value and width.
Creates a smt::BVCmpPredicateAttr with the given string.
Creates a smt::IntPredicateAttr with the given string.
Checks if the given attribute is a smt::SMTAttribute.
Creates an array type with the given domain and range types.
Creates a smt::BitVectorType with the given width.
Creates a smt::BoolType.
Creates a smt::IntType.
Creates a smt::FuncType with the given domain and range types.
Creates a smt::SortType with the given identifier and sort parameters.
Checks if the given type is a smt::ArrayType.
Checks if the given type is a smt::BitVectorType.
Checks if the given type is a smt::BoolType.
Checks if the given type is a smt::IntType.
Checks if the given type is any non-func SMT value type.
Checks if the given type is any SMT value type.
Checks if the given type is a smt::FuncType.
Checks if the given type is a smt::SortType.
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 the explicit value of the sparse_tensor.encoding attribute.
Returns the implicit value of the sparse_tensor.encoding attribute.
Returns a specified level-format of the sparse_tensor.encoding attribute.
Returns the level-to-dimension 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 the pointer and length. The pointer need not reference to a null-terminated string.
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.
Returns true if the symbol table is null.
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.
Applies the transformation script starting at the given transform root operation to the given payload operation. The module containing the transform root as well as the transform options should be provided. The transform operation must implement TransformOpInterface and the module must be a ModuleOp. Returns the status of the application.
Applies the transformation script starting at the given transform root operation to the given payload operation. The module containing the transform root as well as the transform options should be provided. The transform operation must implement TransformOpInterface and the module must be a ModuleOp. Returns the status of the application.
Helper to mark operands as consuming handles.
Helper to mark potential modifications to the payload IR.
Helper to mark operands as only reading handles.
Helper to mark potential reads from the payload IR.
Returns the interface TypeID of the TransformOpInterface.
Creates a default-initialized transform options object.
Destroys a transform options object previously created by mlirTransformOptionsCreate.
Enables or disables expensive checks in transform options.
Enables or disables the enforcement of the top-level transform op being single in transform options.
Returns true if the enforcement of the top-level transform op being single is enabled in transform options.
Returns true if expensive checks are enabled in transform options.
Helper to mark results as producing handles.
Set the payload operations for a transform result by iterating over a list.
Set the parameters for a transform result by iterating over a list.
Set the payload values for a transform result by iterating over a list.
Cast the TransformRewriter to a RewriterBase
Emits SMTLIB for the specified module using the provided callback and user data
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.
Append a converted result type to the given 1:N conversion result accumulator.
Convert the given type using the given TypeConverter. This is the 1:1 convenience form: it returns the single converted type, or a null MlirType on failure or if the type converts to anything other than exactly one type (e.g. a 1:N conversion registered via mlirTypeConverterAdd1ToNConversion, or an erasure to zero types).
Create a TypeConverter.
Destroy the given TypeConverter.
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.
Checks whether a type id is null.
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.
Check if the given type is a dynamic 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 f4E2M1FN type.
Checks whether the given type is an f6E2M3FN type.
Checks whether the given type is an f6E3M2FN type.
Checks whether the given type is an f8E3M4 type.
Checks whether the given type is an f8E4M3 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 an f8E5M3FNU type.
Checks whether the given type is an f8E8M0FNU type.
Checks whether the given type is a floating-point 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.
Returns true if the type is an LLVM dialect array type.
Returns true if the type is an LLVM dialect function type.
Returns true if the type is an LLVM dialect pointer type.
Returns true if the type is an LLVM dialect struct 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 a Tensor type.
Checks whether the given type is an TF32 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 UniformQuantizedSubChannel.
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.
Checks whether a type is null.
Parses a type. The type is owned by the context.
Parses a type. The type is owned by the context.
Prints a location by sending chunks of the string representation and
forwarding userData tocallback`. 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 a UniformQuantizedSubChannelType with the given parameters.
The type is owned by the context. scalesAttr and zeroPointsAttr must be
DenseElementsAttrs. quantizedDimensions and blockSizes
point to blockSizeInfoLength number of elements, describing respectively
the quantization axis and corresponding block size.
Returns the block size at the given position.
Returns the number of block sizes provided in type.
Returns the quantized dimension at the given position.
Returns the scales of the quantized type.
Returns the zero-points of the quantized type.
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.
Unlike the typed accessors below, constructs the attribute with a raw data buffer and no type/alignment checking. Use a more strongly typed accessor if possible. If dataIsMutable is false, then an immutable AsmResourceBlob will be created and that passed data contents will be treated as const. If the deleter is non NULL, then it will be called when the data buffer can no longer be accessed (passing userData to it).
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.
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.
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.
Gets the context that a value was created with.
Returns an op operand representing the first use of the value, or a null op operand if there are no uses.
Gets the location of the value.
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.
Returns whether the value is null.
Prints a value by sending chunks of the string representation and
forwarding userData tocallback`. 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 'with' value, updating anything in the IR that uses 'of' to use 'with' instead, except if the user is listed in 'exceptions'. The 'exceptions' parameter is an array of MlirOperation pointers with a length of 'numExceptions'.
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'.
Set the type of the value.
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.
Same as "mlirVectorTypeGet" but returns a nullptr wrapping MlirType on illegal arguments, emitting appropriate diagnostics.
Creates a scalable vector type with the shape identified by its rank and dimensions. A subset of dimensions may be marked as scalable via the corresponding flag list, which is expected to have as many entries as the rank of the vector. The vector is created in the same context as the element type.
Same as "mlirVectorTypeGetScalable" but returns a nullptr wrapping MlirType on illegal arguments, emitting appropriate diagnostics.
Returns the typeID of an Vector type.
Checks whether the "dim"-th dimension of the given vector is scalable.
Checks whether the given vector type is scalable, i.e., has at least one scalable dimension.
Applies the given patterns to the given op by a fast walk-based pattern rewrite driver.
Functions
beaver_raw_conditionally_speculatable_attach_fallback_model(context, operation_name, callback, timeout_ms)
Attach a new FallbackModel for the ConditionallySpeculatable interface to the named operation. The FallbackModel will call the provided callbacks.
beaver_raw_conversion_pattern_add(pattern_set, root_name, benefit, context, type_converter_registration, callback, one_to_n, timeout_ms)
Create a conversion pattern that matches the operation with the given rootName, corresponding to mlir::OpConversionPattern.
Register the given dialect as dynamically legal, with a callback to determine per-instance legality for all operations in the dialect. The callback must not be NULL.
Register the given operation as dynamically legal, with a callback to determine per-instance legality. The callback must not be NULL.
beaver_raw_conversion_target_mark_recursively_legal(registration, operation_name, callback, timeout_ms)
Mark the given operation as recursively legal. The optional callback (may be NULL) determines whether a specific instance is recursively legal; a NULL callback marks the operation as unconditionally recursively legal.
Mark unknown operations as dynamically legal, with a callback. The callback must not be NULL.
Attach a new FallbackModel for the MemoryEffectsOpInterface to the named operation. The FallbackModel will call the provided callbacks.
beaver_raw_pattern_descriptor_op_interface_attach_fallback_model(context, operation_name, populate_patterns_callback, populate_patterns_with_state_callback, timeout_ms)
Attach PatternDescriptorOpInterface to the operation with the given name using the provided callbacks.
beaver_raw_transform_op_interface_attach_fallback_model(context, operation_name, apply_callback, allows_repeated_handle_operands_callback, timeout_ms)
Attach TransformOpInterface to the operation with the given name using the provided callbacks.
Add a 1:N type conversion function to the given TypeConverter.
Register a 1:N target materialization with the given TypeConverter.
Add a type conversion function to the given TypeConverter.
Register a source materialization with the given TypeConverter. This is invoked when a replacement value must be converted back to its original source type because some uses persist beyond the main conversion.
Register a target materialization with the given TypeConverter. This is invoked when a value must be converted to a target type according to a pattern's type converter.
Schedules callback-bridging work on the context's LLVM pool, outside BEAM scheduler threads. An elastic pool prevents nested pass/rewrite callbacks from starving a pool shared by multiple contexts.
Returns the LLVM version and source revision used to build Beaver. The returned string has static storage duration and must not be freed.
Creates a reusable thread pool that grows beyond its reported parallelism when every worker is blocked by nested synchronous callback work.
beaverPassCreate(construct, destruct, initialize, clone, run, passID, name, argument, description, opName, nDependentDialects, dependentDialects, userData)
See Beaver.MLIR.CAPI.Raw.load_nif/0.
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'.
Returns true if the given affine expression is a null expression. Note
constant zero is not a null expression.
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 tocallback`. Note that the callback may be called
several times with consecutive chunks of the string.
Replace dims[offset ... numDims) by dims[offset + shift ... shift + numDims).
Replace symbols[offset ... numSymbols) by symbols[offset + shift ... shift + numSymbols).
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 an affine map is null.
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 permutation.) The affine map is owned by the context.
Prints an affine map by sending chunks of the string representation and
forwarding userData tocallback`. 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.
Apply a full conversion on the given operation.
Apply a partial conversion on the given operation.
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.
Creates new AsmState, as with AsmState the IR should not be mutated in-between using this state. Must be freed with a call to mlirAsmStateDestroy().
Creates new AsmState from value. Must be freed with a call to mlirAsmStateDestroy().
Destroys printing flags created with mlirAsmStateCreate.
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 complex 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.
Check if the given attribute is a dynamic 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.
Checks whether an attribute is null.
Parses an attribute. The attribute is owned by the context.
Parses an attribute. The attribute is owned by the context.
Prints an attribute by sending chunks of the string representation and
forwarding userData tocallback`. 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 location of the block argument to the given location.
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.
Erase the argument at 'index' and remove it from the argument list.
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 number of predecessor blocks of the block.
Returns the number of successor blocks of the block.
Returns the closest surrounding operation that contains this block.
Returns the region that contains this block.
Returns pos-th predecessor of the block.
WARNING: This getter is more expensive than the others here because
the impl actually iterates the use-def chain (of block operands) anew for
each indexed access.
Returns pos-th successor of the 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.
Checks whether a block is null.
Prints a block by sending chunks of the string representation and
forwarding userData tocallback`. 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 attribute in the given context with the given double real and imaginary values and double-precision FP semantics.
Same as "mlirComplexAttrDoubleGet", but if the type is not valid for a construction of a ComplexAttr, returns a null MlirAttribute.
Same as "mlirComplexAttrDoubleGet", but if the type is not valid for a construction of a ComplexAttr, returns a null MlirAttribute.
Returns the imaginaryvalue stored in the given complex attribute, interpreting the value as double.
Returns the real value stored in the given complex attribute, interpreting the value as double.
Returns the typeID of a Complex attribute.
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.
Returns the speculatability of the given operation. The operation must implement the ConditionallySpeculatable interface.
Returns the interface TypeID of the ConditionallySpeculatable interface.
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.
Gets the dialect instance owned by the given context using the dialect namespace to identify it. If the dialect is not loaded by the context, returns null. Use mlirContextGetOrLoadDialect to load a dialect if it is registered with the context.
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 number of threads of the thread pool of the context when multithreading is enabled. Returns 1 if no multithreading.
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 mlirContextLoad <Name
Dialect to load an unregistered dialect.
Gets the thread pool of the context when enabled multithreading, otherwise an assertion is raised.
Checks whether a context is null.
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.
Create a default ConversionConfig.
Destroy the given ConversionConfig.
Enable or disable building materializations during conversion.
Get the folding mode for the given ConversionConfig.
Check if building materializations during conversion is enabled.
Set the folding mode for the given ConversionConfig.
Cast the ConversionPattern to a RewritePattern.
Get the type converter used by this conversion pattern.
Cast the ConversionPatternRewriter to a PatternRewriter
Apply a signature conversion to each block in the given region.
Replace the given operation with multiple value ranges -- one range per
result of op -- and erase it. nRanges must equal the number of results
of op. rangeSizes[i] is the number of values in the i-th range, and
values is the flat concatenation of all ranges (its length is the sum of
rangeSizes[0..nRanges)).
Register the operations of the given dialect as illegal.
Register the given operations as illegal.
Register the operations of the given dialect as legal.
Register the given operations as legal.
Create an empty ConversionTarget.
Destroy the given ConversionTarget.
mlirCreateExternalPass(passID, name, argument, description, opName, nDependentDialects, dependentDialects, callbacks, userData)
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. The format of the raw buffer is a densely packed array of values that can be bitcast to the storage format of the element type specified. Types that are not byte aligned will be:
- For bitwidth > 1: Rounded up to the next byte.
- For bitwidth = 1: Packed into 8bit bytes with bits corresponding to the linear order of the shape type from MSB to LSB, padded to on the right. A raw buffer of a single element (or for 1-bit, a byte of value 0 or 255) will be interpreted as a splat. User code should be prepared for additional, conformant patterns to be identified as splats in the future.
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.
Deprecated API. Will be removed in the future.
Returns the typeID of a DenseTypedElements 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.
Check if the given dialect is an extensible dialect.
Checks if the dialect is null.
Creates a dialect registry and transfers its ownership to the caller.
Takes a dialect registry owned by the caller and destroys it.
Checks if the dialect registry is null.
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.
Creates a DistinctAttr with the referenced attribute.
Creates a DominanceInfo for the given operation (typically a FuncOp or ModuleOp). The caller owns the returned object and must destroy it.
Destroys the given DominanceInfo.
Returns true if block A dominates block B.
Returns true if operation A dominates operation B (A == B or A properly dominates B).
Finds the nearest common dominator of blocks A and B. Returns a null block if none exists.
Invalidates all cached dominance information.
Returns true if the given block is reachable from the entry block of its region.
Returns true if block A properly dominates block B.
Returns true if operation A properly dominates operation B.
Returns true if value A dominates operation B (the operation defining A is B or A properly dominates B).
Returns true if value A properly dominates operation B.
Get the dialect that the given dynamic attribute definition belongs to.
Get the name of the given dynamic attribute definition.
Get the type ID of a dynamic attribute definition.
Get a dynamic attribute by instantiating the given attribute definition with the provided attributes.
Get the attribute definition of the given dynamic attribute.
Get the number of parameters in the given dynamic attribute.
Get the parameter at the given index in the provided dynamic attribute.
Attach a dynamic op trait to the given operation name. Note that the operation name must be modeled by dynamic dialect and must be registered. The ownership of the trait will be transferred to the operation name after this call.
Destroy the dynamic op trait.
Get the dynamic op trait that indicates regions are isolated from above.
Get the type ID of the dynamic op trait that indicates regions are isolated from above.
Get the dynamic op trait that indicates the operation is a terminator.
Get the type ID of the dynamic op trait that indicates the operation is a terminator.
Get the dynamic op trait that indicates regions have no terminator.
Get the type ID of the dynamic op trait that indicates regions have no terminator.
Get the dialect that the given dynamic type definition belongs to.
Get the name of the given dynamic type definition.
Get the type ID of a dynamic type definition.
Get a dynamic type by instantiating the given type definition with the provided attributes.
Get the number of parameters in the given dynamic type.
Get the parameter at the given index in the provided dynamic type.
Get the type definition of the given dynamic type.
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.
The enablePIC arguments controls the relocation model, when true the
generated code is emitted as "position independent", making it possible to
save it and reload it as a shared object in another process.
TODO: figure out other options.
mlirExecutionEngineCreateWithDiagnostics(context, op, optLevel, numPaths, sharedLibPaths, enableObjectDump, enablePIC)
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.
The enablePIC arguments controls the relocation model, when true the
generated code is emitted as "position independent", making it possible to
save it and reload it as a shared object in another process.
TODO: figure out other options.
Destroy an ExecutionEngine instance.
Dump as an object in fileName.
Initialize the ExecutionEngine. Global constructors specified by
llvm.mlir.global_ctors will be run. One common scenario is that kernel
binary compiled from gpu.module gets loaded during initialization. Make
sure all symbols are resolvable before initialization by calling
mlirExecutionEngineRegisterSymbol or including shared libraries.
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).
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).
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).
Checks whether an execution engine is null.
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.
Look up a registered attribute definition by attribute name in the given dialect. Note that the dialect must be an extensible dialect.
Look up a registered type definition by type name in the given dialect. Note that the dialect must be an extensible dialect.
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 f4E2M1FN type in the given context. The type is owned by the context.
Returns the typeID of an Float4E2M1FN type.
Creates an f6E2M3FN type in the given context. The type is owned by the context.
Returns the typeID of an Float6E2M3FN type.
Creates an f6E3M2FN type in the given context. The type is owned by the context.
Returns the typeID of an Float6E3M2FN type.
Creates an f8E3M4 type in the given context. The type is owned by the context.
Returns the typeID of an Float8E3M4 type.
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 f8E4M3 type in the given context. The type is owned by the context.
Returns the typeID of an Float8E4M3 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.
Creates an f8E5M3FNU type in the given context. The type is owned by the context.
Returns the typeID of a Float8E5M3FNU type.
Creates an f8E8M0FNU type in the given context. The type is owned by the context.
Returns the typeID of an Float8E8M0FNU 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.
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.
Returns the bitwidth of a floating-point type.
Freeze the given MlirRewritePatternSet to a MlirFrozenRewritePatternSet. Note that the ownership of the input set is transferred into the frozen set after this call.
Destroy the given MlirFrozenRewritePatternSet.
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.
mlirGPUObjectAttrGetWithKernels(mlirCtx, target, format, objectStrRef, mlirObjectProps, mlirKernelsAttr)
Creates a greedy rewrite driver configuration with default settings.
Destroys a greedy rewrite driver configuration.
Enables or disables constant CSE.
Enables or disables folding during greedy rewriting.
Gets the maximum number of iterations for the greedy rewrite driver.
Gets the maximum number of rewrites within an iteration.
Gets the region simplification level.
Gets the strictness level for the greedy rewrite driver.
Gets whether top-down traversal is used for initial worklist population.
Gets whether constant CSE is enabled.
Gets whether folding is enabled during greedy rewriting.
Sets the maximum number of iterations for the greedy rewrite driver. Use -1 for no limit.
Sets the maximum number of rewrites within an iteration. Use -1 for no limit.
Sets the region simplification level.
Sets the strictness level for the greedy rewrite driver.
Sets whether to use top-down traversal for the initial population of the worklist.
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.
Returns the interface TypeID of the InferShapedTypeOpInterface.
Returns the interface TypeID of the InferTypeOpInterface.
Creates an integer attribute of the given type with the given integer value.
Creates an integer attribute of the given type from an array of 64-bit words. This is useful for creating integer attributes with values with widths larger than 64 bits. Words are in little-endian order (least significant word first). The number of words must match the bit width of the type: numWords = ceil(bitWidth / 64).
Returns the typeID of an Integer attribute.
Returns the bit width of the integer attribute's underlying APInt value. This is useful for determining the size of the integer, especially for values larger than 64 bits.
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 number of 64-bit words that make up the integer attribute's underlying APInt value. For integers < = 64 bits, this returns 1.
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.
Copies the 64-bit words making up the integer attribute's APInt value into the provided buffer. The buffer must have space for at least mlirIntegerAttrGetValueNumWords(attr) elements. Words are stored in little-endian order (least significant word first). The sign information is not encoded in the words themselves; use the type's signedness to interpret the value correctly.
Creates an integer set attribute wrapping the given set. The attribute belongs to the same context as the integer set.
Returns the typeID of an IntegerSet attribute.
Returns the integer set wrapped in the given integer set 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.
Checks whether an integer set is a null object.
Prints an integer set by sending chunks of the string representation and
forwarding userData tocallback`. 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.
Clears all mappings.
Returns true if the mapping contains a mapping for the given block.
Returns true if the mapping contains a mapping for the given operation.
Returns true if the mapping contains a mapping for the given value.
Creates a new empty IRMapping.
Destroys the given IRMapping.
Erases a block mapping.
Erases an operation mapping.
Erases a value mapping.
Checks whether an IRMapping is null.
Looks up a mapped Block. Returns the mapped block, or the input block if no mapping exists.
Looks up a mapped Operation. Returns the mapped operation, or the input operation if no mapping exists.
Looks up a mapped Value. Returns the mapped value, or the input value if no mapping exists.
Looks up a mapped Block. Returns a null MlirBlock if no mapping exists.
Looks up a mapped Operation. Returns a null MlirOperation if no mapping exists.
Looks up a mapped Value. Returns a null MlirValue if no mapping exists.
Maps a Block in the mapping.
Maps an Operation in the mapping.
Maps a Value in the mapping.
Create an IRRewriter and transfer ownership to the caller.
Create an IRRewriter and transfer ownership to the caller. Additionally set the insertion point before the operation.
Takes an IRRewriter owned by the caller and destroys it. It is the responsibility of the user to only pass an IRRewriter class.
Checks if type is set as the current debug type.
Retuns true if the global debugging flag is set, false otherwise.
Apply the special region builder for the builtin named Linalg op.
Assert that mlirOp is a builtin named Linalg op.
Creates an llvm.array type.
Returns the element type of the llvm.array type.
Returns the number of elements in the llvm.array type.
Returns true if the attribute is an LLVM MDConstantAttr.
Returns true if the attribute is an LLVM MDGlobalValueAttr.
Returns true if the attribute is an LLVM MDNodeAttr.
Returns true if the attribute is an LLVM MDStringAttr.
Creates a LLVM CConv attribute.
Creates a LLVM Comdat attribute.
Creates a LLVM DIAnnotation attribute.
Creates a LLVM DIBasicType attribute.
mlirLLVMDICompileUnitAttrGet(ctx, recId, isRecSelf, id, sourceLanguage, file, producer, isOptimized, emissionKind, isDebugInfoForProfiling, nameTableKind, splitDebugFilename, nImportedEntities, importedEntities)
Creates a LLVM DICompileUnit attribute.
Creates a self-referencing LLVM DICompileUnitAttr attribute.
mlirLLVMDICompositeTypeAttrGet(ctx, recId, isRecSelf, tag, name, file, line, scope, baseType, flags, sizeInBits, alignInBits, nElements, elements, dataLocation, rank, allocated, associated, identifier, discriminator)
Creates a LLVM DICompositeType attribute.
Creates a self-referencing LLVM DICompositeType attribute.
mlirLLVMDIDerivedTypeAttrGet(ctx, tag, name, file, line, scope, baseType, sizeInBits, alignInBits, offsetInBits, dwarfAddressSpace, flags, extraData)
Creates a LLVM DIDerivedType attribute. Note that dwarfAddressSpace is an
optional field, where MLIR_CAPI_DWARF_ADDRESS_SPACE_NULL indicates null
and non-negative values indicate a value present.
Gets the base type from a LLVM DIDerivedType attribute.
Creates a LLVM DIExpression attribute.
Creates a LLVM DIExpressionElem attribute.
Creates a LLVM DIFileAttr attribute.
Creates a LLVM DIFlags attribute.
Creates a LLVM DIImportedEntityAttr attribute.
Creates a LLVM DILexicalBlock attribute.
Creates a LLVM DILexicalBlockFile attribute.
Creates a LLVM DILocalVariableAttr attribute.
Creates a LLVM DIModuleAttr attribute.
Gets the scope of this DIModuleAttr.
Creates a LLVM DINullType attribute.
mlirLLVMDIStringTypeAttrGet(ctx, tag, name, sizeInBits, alignInBits, stringLength, stringLengthExp, stringLocationExp, encoding)
mlirLLVMDISubprogramAttrGet(ctx, recId, isRecSelf, id, compileUnit, scope, name, linkageName, file, line, scopeLine, subprogramFlags, type, nRetainedNodes, retainedNodes, nAnnotations, annotations)
Creates a LLVM DISubprogramAttr attribute.
Gets the compile unit from this DISubprogram.
Gets the file from this DISubprogramAttr.
Gets the line from this DISubprogramAttr.
Creates a self-referencing LLVM DISubprogramAttr attribute.
Gets the scope from this DISubprogramAttr.
Gets the scope line from this DISubprogram.
Gets the type from this DISubprogramAttr.
Creates a LLVM DISubroutineTypeAttr attribute.
Creates an llvm.func type.
Returns the pos-th input type.
Returns the number of input types.
Returns the return type of the function type.
Returns the TypeID of an LLVM function type.
Returns true if the function type is variadic.
Creates a LLVM Linkage attribute.
Creates an LLVM MDConstantAttr wrapping an attribute.
Returns the TypeID of MDConstantAttr.
Returns the attribute value of an LLVM MDConstantAttr.
Creates an LLVM MDGlobalValueAttr referencing a symbol-backed global value.
Returns the symbol name of an LLVM MDGlobalValueAttr.
Returns the TypeID of MDGlobalValueAttr.
Creates an LLVM MDNodeAttr.
Returns the number of operands in an LLVM MDNodeAttr.
Returns the operand at the given index of an LLVM MDNodeAttr.
Returns the TypeID of MDNodeAttr.
Creates an LLVM MDStringAttr.
Returns the TypeID of MDStringAttr.
Returns the string value of an LLVM MDStringAttr.
Creates an llvm.ptr type.
Returns address space of llvm.ptr
Returns the positions-th field of the struct. Asserts if the struct is
opaque, not yet initialized or if the position is out of range.
Returns the identifier of the identified struct. Asserts that the struct is identified, i.e., not literal.
Returns the number of fields in the struct. Asserts if the struct is opaque or not yet initialized.
Creates an LLVM identified struct type with no body. If a struct type with this name already exists in the context, returns that type. Use mlirLLVMStructTypeIdentifiedNewGet to create a fresh struct type, potentially renaming it. The body should be set separatelty by calling mlirLLVMStructTypeSetBody, if it isn't set already.
Creates an LLVM identified struct type with no body and a name starting with the given prefix. If a struct with the exact name as the given prefix already exists, appends an unspecified suffix to the name so that the name is unique in context.
Returns true if the type is a literal (unnamed) LLVM struct type.
Returns true is the struct is explicitly opaque (will not have a body) or
uninitialized (will eventually have a body).
Returns true if the struct is packed.
Creates an LLVM literal (unnamed) struct type. This may assert if the fields have types not compatible with the LLVM dialect. For a graceful failure, use the checked version.
Creates an LLVM literal (unnamed) struct type if possible. Emits a diagnostic at the given location and returns null otherwise.
Creates an LLVM literal (unnamed) struct type if possible. Emits a diagnostic at the given location and returns null otherwise.
Sets the body of the identified struct if it hasn't been set yet. Returns whether the operation was successful.
Creates an llmv.void type.
Create a raw_fd_ostream for the given path. This wrapper is needed because std::ostream does not provide the file sharing semantics required on Windows.
path: output file path.binary: controls text vs binary mode.errorCallback: called with an error message on failure (optional).userData: forwarded toerrorCallbackso it can copy the error message into caller-owned storage (e.g., astd::string). On failure, returns a null stream and invokes the optional error callback with the error message.
Destroy a raw_fd_ostream created with mlirLlvmRawFdOStreamCreate.
Checks if a raw_fd_ostream is null.
Write a string to a raw_fd_ostream created with mlirLlvmRawFdOStreamCreate.
Create an LLVM thread pool. This is reexported here to avoid directly pulling in the LLVM headers directly.
Destroy an LLVM thread pool.
Returns the maximum number of threads in the thread pool.
Loads all IRDL dialects in the provided module, registering the dialects in the module's associated context.
Creates a call site location with a callee and a caller.
Getter for callee of CallSite.
Getter for caller of CallSite.
TypeID Getter for CallSite.
Checks if two locations are equal.
Creates an File/Line/Column location owned by the given context.
Creates an File/Line/Column range location owned by the given context.
Getter for end_column of FileLineColRange.
Getter for end_line of FileLineColRange.
Getter for filename of FileLineColRange.
Getter for start_column of FileLineColRange.
Getter for start_line of FileLineColRange.
TypeID Getter for FileLineColRange.
Creates a location from a location attribute.
Creates a fused location with an array of locations and metadata.
Getter for locations of Fused. Requires pre-allocated memory of #fusedLocations X sizeof(MlirLocation).
Getter for metadata of Fused.
Getter for number of locations fused together.
TypeID Getter for Fused.
Returns the underlying location attribute of this location.
Gets the context that a location was created with.
Checks whether the given location is an CallSite.
Checks whether the given location is an FileLineColRange.
Checks whether the given location is an Fused.
Checks whether the given location is an Name.
Checks whether the given location is an Unknown.
Checks if the location is null.
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.
Getter for childLoc of Name.
Getter for name of Name.
TypeID Getter for Name.
Prints a location by sending chunks of the string representation and
forwarding userData tocallback`. 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.
TypeID Getter for Unknown.
Creates a logical result representing a failure.
Checks if the given logical result represents a failure.
Checks if the given logical result represents a success.
Creates a logical result representing a success.
Creates a memory effect instance without an associated IR entity.
parameters may be a null attribute. The caller owns the returned instance
and must destroy it with mlirMemoryEffectInstanceDestroy.
mlirMemoryEffectInstanceCreateForBlockArgument(effect, blockArgument, parameters, stage, effectOnFullRegion, resource)
Creates a memory effect instance associated with a block argument.
blockArgument must wrap a BlockArgument. parameters may be a null
attribute. The caller owns the returned instance and must destroy it with
mlirMemoryEffectInstanceDestroy.
mlirMemoryEffectInstanceCreateForOpOperand(effect, opOperand, parameters, stage, effectOnFullRegion, resource)
Creates a memory effect instance associated with an operation operand.
parameters may be a null attribute. The caller owns the returned instance
and must destroy it with mlirMemoryEffectInstanceDestroy.
mlirMemoryEffectInstanceCreateForOpResult(effect, result, parameters, stage, effectOnFullRegion, resource)
Creates a memory effect instance associated with an operation result.
result must wrap an OpResult. parameters may be a null attribute. The
caller owns the returned instance and must destroy it with
mlirMemoryEffectInstanceDestroy.
mlirMemoryEffectInstanceCreateForSymbol(effect, symbol, parameters, stage, effectOnFullRegion, resource)
Creates a memory effect instance associated with a symbol. symbol must be
a SymbolRefAttr. parameters may be a null attribute. The caller owns the
returned instance and must destroy it with
mlirMemoryEffectInstanceDestroy.
Destroys a memory effect instance created by one of the functions above.
Appends a copy of instance to the given list. This does not take ownership
of instance; the caller remains responsible for destroying it.
Returns the borrowed singleton instance of the allocate memory effect.
Returns the borrowed singleton instance of the free memory effect.
Returns the interface TypeID of the MemoryEffectsOpInterface.
Returns the borrowed singleton instance of the read memory effect.
Returns the borrowed singleton instance of the write memory effect.
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.
mlirMemRefTypeContiguousGetCheckedWithDiagnostics(context, loc, elementType, rank, shape, memorySpace)
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.
mlirMemRefTypeGetCheckedWithDiagnostics(context, loc, elementType, rank, shape, layout, memorySpace)
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 strides of the MemRef if the layout map is in strided form. Both strides and offset are out params. strides must point to pre-allocated memory of length equal to the rank of the memref.
Returns the typeID of an MemRef type.
Merge the symbols from other into target, potentially renaming them to
avoid conflicts. Private symbols may be renamed during the merge, public
symbols must have at most one declaration. A name conflict in public symbols
is reported as an error before returning a failure.
Note that this clones the other operation unlike the C++ counterpart that
takes ownership.
Creates a new, empty module and transfers ownership to the caller.
Parses a module from the string and transfers ownership to the caller.
Parses a module from file 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.
Checks if two modules are equal.
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.
Compute a hash for the given module.
Checks whether a module is null.
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.
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.
Clones the operation with the given mapping. The mapping is updated with the cloned operation's results and regions.
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). This call can fail under the following conditions, in which case, it will return a null operation and emit diagnostics:
- Result type inference is enabled and cannot be performed.
Parses an operation, giving ownership to the caller. If parsing fails a null
operation will be returned, and an error diagnostic emitted.
sourceStr may be either the text assembly format, or binary bytecode
format. sourceName is used as the file name of the source; any IR without
locations will get a FileLineColLoc location with sourceName as the file
name.
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.
Deprecated, please use mlirOperationGetInherentAttribute or
mlirOperationGetDiscardableAttribute.
Returns an attribute attached to the operation given its name.
Deprecated, please use mlirOperationGetInherentAttributeByName or
mlirOperationGetDiscardableAttributeByName.
Gets the block that owns this operation, returning null if the operation is not owned.
Gets the context this operation is associated with
Return pos-th discardable attribute of the operation.
Returns a discardable attribute attached to the operation given its name.
Returns first region attached to the operation.
Returns an inherent attribute attached to the operation given its name.
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.
Deprecated, please use mlirOperationGetNumInherentAttributes or
mlirOperationGetNumDiscardableAttributes.
Returns the number of discardable 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.
Returns pos-th OpOperand 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.
Compute a hash for the given operation. Operand and result SSA values are hashed by identity and locations are significant, so equivalent-but-distinct operations hash differently; use mlirOperationStructuralHashValue for a hash that pairs with mlirOperationIsStructurallyEquivalent.
Returns true if this operation defines an inherent attribute with this name.
Note: the attribute can be optional, so
mlirOperationGetInherentAttributeByName can still return a null attribute.
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.
Given an operation 'other' that is within the same parent block, return whether the current operation is before 'other' in the operation list of the parent block. Note: This function has an average complexity of O(1), but worst case may take O(N) where N is the number of operations within the parent block.
Checks whether the underlying operation is null.
Checks whether two operations are structurally equivalent, i.e. they have
the same name, attributes, operand and result types, and recursively
equivalent regions. Operand equivalence is tracked structurally while
recursing into regions, so operands defined inside the compared regions need
not be the exact same SSA values; operands defined outside must be. flags
is a bitwise OR of MlirOperationEquivalenceFlags values.
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.
Checks if the operation name has a trait identified by the given type id.
Prints an operation by sending chunks of the string representation and
forwarding userData tocallback`. 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.
Same as mlirOperationPrint but accepts AsmState controlling the printing behavior as well as caching computed names.
Removes an attribute by name. Returns false if the attribute was not found
and true if removed.
Deprecated, please use mlirOperationRemoveInherentAttributeByName or
mlirOperationRemoveDiscardableAttributeByName.
Removes a discardable 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.
Replace uses of 'of' value with the 'with' value inside the 'op' operation.
Sets an attribute by name, replacing the existing if it exists or
adding a new one otherwise.
Deprecated, please use mlirOperationSetInherentAttributeByName or
mlirOperationSetDiscardableAttributeByName.
Sets a discardable attribute by name, replacing the existing if it exists or
adding a new one otherwise. The new attr Attribute is not allowed to be
null, use mlirOperationRemoveDiscardableAttributeByName to remove an
Attribute instead.
Sets an inherent attribute by name, replacing the existing if it exists. This has no effect if "name" does not match an inherent attribute.
Sets the location of the operation.
Sets the pos-th operand of the operation.
Replaces the operands of the operation.
Set pos-th successor 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.
Computes a hash for the given operation that pairs with
mlirOperationIsStructurallyEquivalent: two operations that are structurally
equivalent under the same flags hash equally. Operands are hashed by
identity, results are not hashed at all, and regions do not participate in
the hash. flags is a bitwise OR of MlirOperationEquivalenceFlags values.
Verify the operation and return true if it passes, false if it fails.
Verify the operation and return true if it passes, false if it fails.
Walks operation op in walkOrder and calls callback on that operation.
*userData is passed to the callback as well and can be used to tunnel some
context or other data into the callback.
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.
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 the value 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.
Enables the elision of large resources strings by omitting them from the
dialect_resources section. The largeResourceLimit is used to configure
what is considered to be a "large" resource by providing an upper limit to
the string size.
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.
Print the name and location, if NamedLoc, as a prefix to the SSA ID.
Skip printing regions.
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.
mlirOpRewritePatternCreate(rootName, benefit, context, callbacks, userData, nGeneratedNames, generatedNames)
Create a rewrite pattern that matches the operation with the given rootName, corresponding to mlir::OpRewritePattern.
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.
mlirPassManagerEnableIRPrinting(passManager, printBeforeAll, printAfterAll, printModuleScope, printAfterOnlyOnChange, printAfterOnlyOnFailure, flags, treePrintingPath)
Enable IR printing. The treePrintingPath argument is an optional path to a directory where the dumps will be produced. If it isn't provided then dumps are produced to stderr.
Enable pass statistics.
Enable pass timing.
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.
Checks if a PassManager is null.
Run the provided passManager on the given op.
Returns the interface TypeID of the PatternDescriptorOpInterface.
Cast the PatternRewriter to a RewriterBase
Register a constraint function into the given PDL pattern module.
userData will be provided as an argument to the constraint function.
Register a rewrite function into the given PDL pattern module.
userData will be provided as an argument to the rewrite function.
Push the MlirAttribute into the given MlirPDLResultList.
Push the MlirOperation into the given MlirPDLResultList.
Push the MlirType into the given MlirPDLResultList.
Push the MlirValue into the given MlirPDLResultList.
Cast the MlirPDLValue to an MlirAttribute. Return a null value if the cast fails, just like llvm::dyn_cast.
Cast the MlirPDLValue to an MlirOperation. Return a null value if the cast fails, just like llvm::dyn_cast.
Cast the MlirPDLValue to an MlirType. Return a null value if the cast fails, just like llvm::dyn_cast.
Cast the MlirPDLValue to an MlirValue. Return a null value if the cast fails, just like llvm::dyn_cast.
Creates a PostDominanceInfo for the given operation.
Destroys the given PostDominanceInfo.
Invalidates all cached post-dominance information.
Returns true if block A post-dominates block B.
Returns true if operation A post-dominates operation B.
Returns true if block A properly post-dominates block B.
Returns true if operation A properly post-dominates operation B.
Print a textual MLIR pass pipeline by sending chunks of the string
representation and forwarding userData tocallback`. 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.
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.
Checks whether a region is null.
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.
Add the given MlirRewritePattern into a MlirRewritePatternSet. Note that the ownership of the pattern is transferred to the set after this call.
Create an empty MlirRewritePatternSet.
Destruct the given MlirRewritePatternSet.
Get the context associated with a MlirRewritePatternSet.
This method cancels a pending in-place modification. This can only be
called on operations that were provided to a call to
startOpModification.
Reset the insertion point to no location. Creating an operation without a set insertion point is an error, but this can still be useful when the current insertion point a builder refers to is being removed.
Creates a deep copy of the specified operation.
Clone the blocks that belong to "region" before the given position in another region "parent".
Clones the given operation using the rewriter and the provided IRMapping. The mapping is updated with the results of the cloned operation.
Creates a deep copy of this operation but keep the operation regions empty.
Add new block with 'argTypes' arguments and set the insertion point to the
end of it. The block is placed before 'insertBefore'. locs contains the
locations of the inserted arguments, and should match the size of
argTypes.
Erases a block along with all operations inside it.
Erases an operation that is known to have no uses.
This method is used to signal the end of an in-place modification of the
given operation. This can only be called on operations that were provided
to a call to startOpModification.
Returns the current block of the rewriter.
Get the MLIR context referenced by the rewriter.
Return the block the current insertion point belongs to. Note that the insertion point is not necessarily the end of the block.
Returns the operation right after the current insertion point of the rewriter. A null MlirOperation will be returned
Inline the operations of block 'source' before the operation 'op'. The source block will be deleted and must have no uses. 'argValues' is used to replace the block arguments of 'source' The source block must have no successors. Otherwise, the resulting IR would have unreachable operations.
Move the blocks that belong to "region" before the given position in another region "parent". The two regions must be different. The caller is responsible for creating or updating the operation transferring flow of control to the region and passing it the correct block arguments.
Insert the given operation at the current insertion point and return it.
Inline the operations of block 'source' into the end of block 'dest'. The source block will be deleted and must have no uses. 'argValues' is used to replace the block arguments of 'source' The dest block must have no successors. Otherwise, the resulting IR would have unreachable operation.
Unlink this block and insert it right before existingBlock.
Unlink this operation from its current block and insert it right after
existingOp which may be in the same or another block in the same
function.
Unlink this operation from its current block and insert it right before
existingOp which may be in the same or another block in the same
function.
Find uses of from and replace them with to. Also notify the listener
about every in-place op modification (for every use that was replaced)
and that the from operation is about to be replaced.
Find uses of from and replace them with to. Also notify the listener
about every in-place op modification (for every use that was replaced)
and that the from operation is about to be replaced.
Find uses of from and replace them with to except if the user is
exceptedUser. Also notify the listener about every in-place op
modification (for every use that was replaced).
Find uses of from and replace them with to. Also notify the listener
about every in-place op modification (for every use that was replaced).
Find uses of from and replace them with to. Also notify the listener
about every in-place op modification (for every use that was replaced).
Find uses of from within block and replace them with to. Also notify
the listener about every in-place op modification (for every use that was
replaced). The optional allUsesReplaced flag is set to "true" if all
uses were replaced.
Replace the results of the given (original) operation with the specified new op (replacement). The result types of the two ops must match. The original op is erased.
Replace the results of the given (original) operation with the specified list of values (replacements). The result types of the given op and the replacements must match. The original op is erased.
Restores a previously saved insertion point.
Returns the current insertion point of the rewriter so that it can be restored later with mlirRewriterBaseRestoreInsertionPoint.
Sets the insertion point to the node after the specified operation, which will cause subsequent insertions to go right after it.
Sets the insertion point to the node after the specified value. If value has a defining operation, sets the insertion point to the node after such defining operation. This will cause subsequent insertions to go right after it. Otherwise, value is a BlockArgument. Sets the insertion point to the start of its block.
Sets the insertion point to the specified operation, which will cause subsequent insertions to go right before it.
Sets the insertion point to the end of the specified block.
Sets the insertion point to the start of the specified block.
This method is used to notify the rewriter that an in-place operation
modification is about to happen. A call to this function must be
followed by a call to either finalizeOpModification or
cancelOpModification. This is a minor efficiency win (it avoids creating
a new operation and removing the old one) but also often allows simpler
code in the client.
Sets the current debug type, similarly to -debug-only=type in the
command-line tools. Note that global debug should be enabled for any output
to be produced.
Sets multiple current debug types, similarly to `-debug-only=type1,type2" in the command-line tools. Note that global debug should be enabled for any output to be produced.
Returns the dim-th dimension of the given ranked shaped type.
Returns the value indicating a dynamic size in a shaped type. Prefer mlirShapedTypeIsDynamicSize and mlirShapedTypeIsStaticSize to direct comparisons with this value.
Returns the value indicating a dynamic stride or offset in a shaped type. Prefer mlirShapedTypeIsDynamicStrideOrOffset and mlirShapedTypeIsStaticStrideOrOffset 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 whether 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.
Checks whether the dim-th dimension of the given shaped type is static.
Checks whether the given shaped type dimension value is statically-sized.
Checks whether the given dimension value of a stride or an offset is statically-sized.
Returns the borrowed singleton instance of the default side effect resource.
Simplify an affine expression by flattening and some amount of simple
analysis. This has complexity linear in the number of nodes in 'expr'.
Returns the simplified expression, which is the same as the input expression
if it can't be simplified. When expr is semi-affine, a simplified
semi-affine expression is constructed in the sorted order of dimension and
symbol positions.
Checks if the given string is a valid smt::BVCmpPredicate.
Checks if the given string is a valid smt::IntPredicate.
Creates a smt::BitVectorAttr with the given value and width.
Creates a smt::BVCmpPredicateAttr with the given string.
Creates a smt::IntPredicateAttr with the given string.
Checks if the given attribute is a smt::SMTAttribute.
Creates an array type with the given domain and range types.
Creates a smt::BitVectorType with the given width.
Creates a smt::BoolType.
Creates a smt::IntType.
Creates a smt::FuncType with the given domain and range types.
Creates a smt::SortType with the given identifier and sort parameters.
Checks if the given type is a smt::ArrayType.
Checks if the given type is a smt::BitVectorType.
Checks if the given type is a smt::BoolType.
Checks if the given type is a smt::IntType.
Checks if the given type is any non-func SMT value type.
Checks if the given type is any SMT value type.
Checks if the given type is a smt::FuncType.
Checks if the given type is a smt::SortType.
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.
mlirSparseTensorEncodingAttrGet(ctx, lvlRank, lvlTypes, dimToLvl, lvlTodim, posWidth, crdWidth, explicitVal, implicitVal)
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 the explicit value of the sparse_tensor.encoding attribute.
Returns the implicit value of the sparse_tensor.encoding attribute.
Returns a specified level-format of the sparse_tensor.encoding attribute.
Returns the level-to-dimension 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 the pointer and length. The pointer need not reference to a null-terminated string.
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.
Returns true if the symbol table is null.
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.
Applies the transformation script starting at the given transform root operation to the given payload operation. The module containing the transform root as well as the transform options should be provided. The transform operation must implement TransformOpInterface and the module must be a ModuleOp. Returns the status of the application.
mlirTransformApplyNamedSequenceWithDiagnostics(context, payload, transformRoot, transformModule, transformOptions)
Applies the transformation script starting at the given transform root operation to the given payload operation. The module containing the transform root as well as the transform options should be provided. The transform operation must implement TransformOpInterface and the module must be a ModuleOp. Returns the status of the application.
Helper to mark operands as consuming handles.
Helper to mark potential modifications to the payload IR.
Helper to mark operands as only reading handles.
Helper to mark potential reads from the payload IR.
Returns the interface TypeID of the TransformOpInterface.
Creates a default-initialized transform options object.
Destroys a transform options object previously created by mlirTransformOptionsCreate.
Enables or disables expensive checks in transform options.
Enables or disables the enforcement of the top-level transform op being single in transform options.
Returns true if the enforcement of the top-level transform op being single is enabled in transform options.
Returns true if expensive checks are enabled in transform options.
Helper to mark results as producing handles.
Set the payload operations for a transform result by iterating over a list.
Set the parameters for a transform result by iterating over a list.
Set the payload values for a transform result by iterating over a list.
Cast the TransformRewriter to a RewriterBase
mlirTranslateModuleToSMTLIB(param_0, param_1, userData, inlineSingleUseValues, indentLetBody, emitReset)
Emits SMTLIB for the specified module using the provided callback and user data
mlirTranslateOperationToSMTLIB(param_0, param_1, userData, inlineSingleUseValues, indentLetBody, emitReset)
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.
Append a converted result type to the given 1:N conversion result accumulator.
Convert the given type using the given TypeConverter. This is the 1:1 convenience form: it returns the single converted type, or a null MlirType on failure or if the type converts to anything other than exactly one type (e.g. a 1:N conversion registered via mlirTypeConverterAdd1ToNConversion, or an erasure to zero types).
Create a TypeConverter.
Destroy the given TypeConverter.
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.
Checks whether a type id is null.
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.
Check if the given type is a dynamic 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 f4E2M1FN type.
Checks whether the given type is an f6E2M3FN type.
Checks whether the given type is an f6E3M2FN type.
Checks whether the given type is an f8E3M4 type.
Checks whether the given type is an f8E4M3 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 an f8E5M3FNU type.
Checks whether the given type is an f8E8M0FNU type.
Checks whether the given type is a floating-point 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.
Returns true if the type is an LLVM dialect array type.
Returns true if the type is an LLVM dialect function type.
Returns true if the type is an LLVM dialect pointer type.
Returns true if the type is an LLVM dialect struct 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 a Tensor type.
Checks whether the given type is an TF32 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 UniformQuantizedSubChannel.
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.
Checks whether a type is null.
Parses a type. The type is owned by the context.
Parses a type. The type is owned by the context.
Prints a location by sending chunks of the string representation and
forwarding userData tocallback`. Note that the callback may be called
several times with consecutive chunks of the string.
mlirUniformQuantizedPerAxisTypeGet(flags, storageType, expressedType, nDims, scales, zeroPoints, quantizedDimension, storageTypeMin, storageTypeMax)
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.
mlirUniformQuantizedSubChannelTypeGet(flags, storageType, expressedType, scalesAttr, zeroPointsAttr, blockSizeInfoLength, quantizedDimensions, blockSizes, storageTypeMin, storageTypeMax)
Creates a UniformQuantizedSubChannelType with the given parameters.
The type is owned by the context. scalesAttr and zeroPointsAttr must be
DenseElementsAttrs. quantizedDimensions and blockSizes
point to blockSizeInfoLength number of elements, describing respectively
the quantization axis and corresponding block size.
Returns the block size at the given position.
Returns the number of block sizes provided in type.
Returns the quantized dimension at the given position.
Returns the scales of the quantized type.
Returns the zero-points of the quantized type.
mlirUniformQuantizedTypeGet(flags, storageType, expressedType, scale, zeroPoint, storageTypeMin, storageTypeMax)
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.
mlirUnmanagedDenseResourceElementsAttrGet(shapedType, name, data, dataLength, dataAlignment, dataIsMutable, deleter, userData)
Unlike the typed accessors below, constructs the attribute with a raw data buffer and no type/alignment checking. Use a more strongly typed accessor if possible. If dataIsMutable is false, then an immutable AsmResourceBlob will be created and that passed data contents will be treated as const. If the deleter is non NULL, then it will be called when the data buffer can no longer be accessed (passing userData to it).
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.
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.
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.
Gets the context that a value was created with.
Returns an op operand representing the first use of the value, or a null op operand if there are no uses.
Gets the location of the value.
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.
Returns whether the value is null.
Prints a value by sending chunks of the string representation and
forwarding userData tocallback`. 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 'with' value, updating anything in the IR that uses 'of' to use 'with' instead, except if the user is listed in 'exceptions'. The 'exceptions' parameter is an array of MlirOperation pointers with a length of 'numExceptions'.
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'.
Set the type of the value.
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.
Same as "mlirVectorTypeGet" but returns a nullptr wrapping MlirType on illegal arguments, emitting appropriate diagnostics.
Creates a scalable vector type with the shape identified by its rank and dimensions. A subset of dimensions may be marked as scalable via the corresponding flag list, which is expected to have as many entries as the rank of the vector. The vector is created in the same context as the element type.
Same as "mlirVectorTypeGetScalable" but returns a nullptr wrapping MlirType on illegal arguments, emitting appropriate diagnostics.
Returns the typeID of an Vector type.
Checks whether the "dim"-th dimension of the given vector is scalable.
Checks whether the given vector type is scalable, i.e., has at least one scalable dimension.
Applies the given patterns to the given op by a fast walk-based pattern rewrite driver.