diff --git a/src/mlir/Dialects/Affine.jl b/src/mlir/Dialects/Affine.jl index c3774d385..9ce90aa90 100755 --- a/src/mlir/Dialects/Affine.jl +++ b/src/mlir/Dialects/Affine.jl @@ -83,6 +83,9 @@ In the above example, `%indices:3` conceptually holds the following: %indices_2 = affine.apply #map2()[%linear_index] ``` +In other words, `%0:3 = affine.delinearize_index %x into (B, C)` produces +`%0 = {%x / (B * C), (%x mod (B * C)) / C, %x mod C}`. + The basis may either contain `N` or `N-1` elements, where `N` is the number of results. If there are N basis elements, the first one will not be used during computations, but may be used during analysis and canonicalization to eliminate terms from @@ -98,7 +101,12 @@ That is, the example above could also have been written %0:3 = affine.delinearize_index %linear_index into (244, 244) : index, index ``` -Note that, due to the constraints of affine maps, all the basis elements must +Note that, for symmetry with `getPaddedBasis()`, if `hasOuterBound` is `true` +when one of the `OpFoldResult` builders is called but the first element of the +basis is `nullptr`, that first element is ignored and the builder proceeds as if +there was no outer bound. + +Due to the constraints of affine maps, all the basis elements must be strictly positive. A dynamic basis element being 0 or negative causes undefined behavior. """ @@ -382,6 +390,9 @@ That is, for indices `%idx_0` to `%idx_{N-1}` and basis elements `b_0` sum(i = 0 to N-1) %idx_i * product(j = i + 1 to N-1) B_j ``` +In other words, `%0 = affine.linearize_index [%z, %y, %x] by (Z, Y, X)` +gives `%0 = %x + %y * X + %z * X * Y`, or `%0 = %x + X * (%y + Y * (%z))`. + The basis may either have `N` or `N-1` elements, where `N` is the number of inputs to linearize_index. If `N` inputs are provided, the first one is not used in computation, but may be used during analysis or canonicalization as a bound @@ -390,6 +401,10 @@ on `%idx_0`. If all `N` basis elements are provided, the linearize_index operation is said to \"have an outer bound\". +As a convenience, and for symmetry with `getPaddedBasis()`, ifg the first +element of a set of `OpFoldResult`s passed to the builders of this operation is +`nullptr`, that element is ignored. + If the `disjoint` property is present, this is an optimization hint that, for all `i`, `0 <= %idx_i < B_i` - that is, no index affects any other index, except that `%idx_0` may be negative to make the index as a whole negative. diff --git a/src/mlir/Dialects/Enzyme.jl b/src/mlir/Dialects/Enzyme.jl index 8794b8936..f922304da 100755 --- a/src/mlir/Dialects/Enzyme.jl +++ b/src/mlir/Dialects/Enzyme.jl @@ -69,7 +69,7 @@ function autodiff( ) end -@noinline function batch( +function batch( inputs::Vector{Value}; outputs::Vector{IR.Type}, fn, batch_shape, location=Location() ) op_ty_results = IR.Type[outputs...,] diff --git a/src/mlir/Dialects/Func.jl b/src/mlir/Dialects/Func.jl index 6eb30523c..8b5d4ef57 100755 --- a/src/mlir/Dialects/Func.jl +++ b/src/mlir/Dialects/Func.jl @@ -219,7 +219,7 @@ that contains the operation. # Example ```mlir -func.func @foo() : (i32, f8) { +func.func @foo() -> (i32, f8) { ... return %0, %1 : i32, f8 } diff --git a/src/mlir/Dialects/Gpu.jl b/src/mlir/Dialects/Gpu.jl index 99cde454c..6a7a8615c 100755 --- a/src/mlir/Dialects/Gpu.jl +++ b/src/mlir/Dialects/Gpu.jl @@ -1,10 +1,18 @@ module gpu using ...IR -import ...IR: NamedAttribute, Value, Location, Block, Region, Attribute, create_operation, context, IndexType +import ...IR: + NamedAttribute, + Value, + Location, + Block, + Region, + Attribute, + create_operation, + context, + IndexType import ..Dialects: namedattribute, operandsegmentsizes import ...API - """ `all_reduce` @@ -33,21 +41,32 @@ accumulation as code region. The reduction operation must be one of: If `uniform` flag is set either none or all work items of a workgroup need to execute this op in convergence. """ -function all_reduce(value::Value; result=nothing::Union{Nothing, IR.Type}, op=nothing, uniform=nothing, body::Region, location=Location()) +function all_reduce( + value::Value; + result=nothing::Union{Nothing,IR.Type}, + op=nothing, + uniform=nothing, + body::Region, + location=Location(), +) op_ty_results = IR.Type[] - operands = Value[value, ] - owned_regions = Region[body, ] + operands = Value[value,] + owned_regions = Region[body,] successors = Block[] attributes = NamedAttribute[] !isnothing(result) && push!(op_ty_results, result) !isnothing(op) && push!(attributes, namedattribute("op", op)) !isnothing(uniform) && push!(attributes, namedattribute("uniform", uniform)) - - create_operation( - "gpu.all_reduce", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "gpu.all_reduce", + location; + operands, + owned_regions, + successors, + attributes, results=(length(op_ty_results) == 0 ? nothing : op_ty_results), - result_inference=(length(op_ty_results) == 0 ? true : false) + result_inference=(length(op_ty_results) == 0 ? true : false), ) end @@ -73,21 +92,38 @@ memory accessible both on host and on device. %memref, %token = gpu.alloc async [%dep] host_shared (%width) : memref<64x?xf32, 1> ``` """ -function alloc(asyncDependencies::Vector{Value}, dynamicSizes::Vector{Value}, symbolOperands::Vector{Value}; memref::IR.Type, asyncToken=nothing::Union{Nothing, IR.Type}, hostShared=nothing, location=Location()) - op_ty_results = IR.Type[memref, ] - operands = Value[asyncDependencies..., dynamicSizes..., symbolOperands..., ] +function alloc( + asyncDependencies::Vector{Value}, + dynamicSizes::Vector{Value}, + symbolOperands::Vector{Value}; + memref::IR.Type, + asyncToken=nothing::Union{Nothing,IR.Type}, + hostShared=nothing, + location=Location(), +) + op_ty_results = IR.Type[memref,] + operands = Value[asyncDependencies..., dynamicSizes..., symbolOperands...] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(asyncDependencies), length(dynamicSizes), length(symbolOperands), ])) + push!( + attributes, + operandsegmentsizes([ + length(asyncDependencies), length(dynamicSizes), length(symbolOperands) + ]), + ) !isnothing(asyncToken) && push!(op_ty_results, asyncToken) !isnothing(hostShared) && push!(attributes, namedattribute("hostShared", hostShared)) - - create_operation( - "gpu.alloc", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "gpu.alloc", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end @@ -116,12 +152,16 @@ function barrier(; location=Location()) owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "gpu.barrier", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "gpu.barrier", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end @@ -156,14 +196,21 @@ function binary(; sym_name, offloadingHandler=nothing, objects, location=Locatio operands = Value[] owned_regions = Region[] successors = Block[] - attributes = NamedAttribute[namedattribute("sym_name", sym_name), namedattribute("objects", objects), ] - !isnothing(offloadingHandler) && push!(attributes, namedattribute("offloadingHandler", offloadingHandler)) - - create_operation( - "gpu.binary", location; - operands, owned_regions, successors, attributes, + attributes = NamedAttribute[ + namedattribute("sym_name", sym_name), namedattribute("objects", objects) + ] + !isnothing(offloadingHandler) && + push!(attributes, namedattribute("offloadingHandler", offloadingHandler)) + + return create_operation( + "gpu.binary", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end @@ -192,20 +239,29 @@ exceeds `upper_bound` cause undefined behavior. There is an implicit upper bound of `kMaxDim` (currently uint32_t::max). """ -function block_dim(; result_0=nothing::Union{Nothing, IR.Type}, dimension, upper_bound=nothing, location=Location()) +function block_dim(; + result_0=nothing::Union{Nothing,IR.Type}, + dimension, + upper_bound=nothing, + location=Location(), +) op_ty_results = IR.Type[] operands = Value[] owned_regions = Region[] successors = Block[] - attributes = NamedAttribute[namedattribute("dimension", dimension), ] + attributes = NamedAttribute[namedattribute("dimension", dimension),] !isnothing(result_0) && push!(op_ty_results, result_0) !isnothing(upper_bound) && push!(attributes, namedattribute("upper_bound", upper_bound)) - - create_operation( - "gpu.block_dim", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "gpu.block_dim", + location; + operands, + owned_regions, + successors, + attributes, results=(length(op_ty_results) == 0 ? nothing : op_ty_results), - result_inference=(length(op_ty_results) == 0 ? true : false) + result_inference=(length(op_ty_results) == 0 ? true : false), ) end @@ -228,20 +284,29 @@ takes priority over bounds inferrable from context. There is an implicit upper bound of `kMaxDim` (currently uint32_t::max). """ -function block_id(; result_0=nothing::Union{Nothing, IR.Type}, dimension, upper_bound=nothing, location=Location()) +function block_id(; + result_0=nothing::Union{Nothing,IR.Type}, + dimension, + upper_bound=nothing, + location=Location(), +) op_ty_results = IR.Type[] operands = Value[] owned_regions = Region[] successors = Block[] - attributes = NamedAttribute[namedattribute("dimension", dimension), ] + attributes = NamedAttribute[namedattribute("dimension", dimension),] !isnothing(result_0) && push!(op_ty_results, result_0) !isnothing(upper_bound) && push!(attributes, namedattribute("upper_bound", upper_bound)) - - create_operation( - "gpu.block_id", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "gpu.block_id", + location; + operands, + owned_regions, + successors, + attributes, results=(length(op_ty_results) == 0 ? nothing : op_ty_results), - result_inference=(length(op_ty_results) == 0 ? true : false) + result_inference=(length(op_ty_results) == 0 ? true : false), ) end @@ -262,20 +327,29 @@ is greater than `upper_bound` causes undefined behavior. There is an implicit upper bound of `kMaxClusterDim` (currently 8). """ -function cluster_block_id(; result_0=nothing::Union{Nothing, IR.Type}, dimension, upper_bound=nothing, location=Location()) +function cluster_block_id(; + result_0=nothing::Union{Nothing,IR.Type}, + dimension, + upper_bound=nothing, + location=Location(), +) op_ty_results = IR.Type[] operands = Value[] owned_regions = Region[] successors = Block[] - attributes = NamedAttribute[namedattribute("dimension", dimension), ] + attributes = NamedAttribute[namedattribute("dimension", dimension),] !isnothing(result_0) && push!(op_ty_results, result_0) !isnothing(upper_bound) && push!(attributes, namedattribute("upper_bound", upper_bound)) - - create_operation( - "gpu.cluster_block_id", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "gpu.cluster_block_id", + location; + operands, + owned_regions, + successors, + attributes, results=(length(op_ty_results) == 0 ? nothing : op_ty_results), - result_inference=(length(op_ty_results) == 0 ? true : false) + result_inference=(length(op_ty_results) == 0 ? true : false), ) end @@ -297,20 +371,29 @@ causes undefined behavior. There is an implicit upper bound of `kMaxClusterDim` (currently 8). """ -function cluster_dim_blocks(; result_0=nothing::Union{Nothing, IR.Type}, dimension, upper_bound=nothing, location=Location()) +function cluster_dim_blocks(; + result_0=nothing::Union{Nothing,IR.Type}, + dimension, + upper_bound=nothing, + location=Location(), +) op_ty_results = IR.Type[] operands = Value[] owned_regions = Region[] successors = Block[] - attributes = NamedAttribute[namedattribute("dimension", dimension), ] + attributes = NamedAttribute[namedattribute("dimension", dimension),] !isnothing(result_0) && push!(op_ty_results, result_0) !isnothing(upper_bound) && push!(attributes, namedattribute("upper_bound", upper_bound)) - - create_operation( - "gpu.cluster_dim_blocks", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "gpu.cluster_dim_blocks", + location; + operands, + owned_regions, + successors, + attributes, results=(length(op_ty_results) == 0 ? nothing : op_ty_results), - result_inference=(length(op_ty_results) == 0 ? true : false) + result_inference=(length(op_ty_results) == 0 ? true : false), ) end @@ -332,20 +415,29 @@ undefined behavior. There is an implicit upper bound of `kMaxDim` (currently uint32_t::max). """ -function cluster_dim(; result_0=nothing::Union{Nothing, IR.Type}, dimension, upper_bound=nothing, location=Location()) +function cluster_dim(; + result_0=nothing::Union{Nothing,IR.Type}, + dimension, + upper_bound=nothing, + location=Location(), +) op_ty_results = IR.Type[] operands = Value[] owned_regions = Region[] successors = Block[] - attributes = NamedAttribute[namedattribute("dimension", dimension), ] + attributes = NamedAttribute[namedattribute("dimension", dimension),] !isnothing(result_0) && push!(op_ty_results, result_0) !isnothing(upper_bound) && push!(attributes, namedattribute("upper_bound", upper_bound)) - - create_operation( - "gpu.cluster_dim", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "gpu.cluster_dim", + location; + operands, + owned_regions, + successors, + attributes, results=(length(op_ty_results) == 0 ? nothing : op_ty_results), - result_inference=(length(op_ty_results) == 0 ? true : false) + result_inference=(length(op_ty_results) == 0 ? true : false), ) end @@ -367,20 +459,29 @@ greater than `upper_bound` causes undefined behavior. There is an implicit upper bound of `kMaxDim` (currently uint32_t::max). """ -function cluster_id(; result_0=nothing::Union{Nothing, IR.Type}, dimension, upper_bound=nothing, location=Location()) +function cluster_id(; + result_0=nothing::Union{Nothing,IR.Type}, + dimension, + upper_bound=nothing, + location=Location(), +) op_ty_results = IR.Type[] operands = Value[] owned_regions = Region[] successors = Block[] - attributes = NamedAttribute[namedattribute("dimension", dimension), ] + attributes = NamedAttribute[namedattribute("dimension", dimension),] !isnothing(result_0) && push!(op_ty_results, result_0) !isnothing(upper_bound) && push!(attributes, namedattribute("upper_bound", upper_bound)) - - create_operation( - "gpu.cluster_id", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "gpu.cluster_id", + location; + operands, + owned_regions, + successors, + attributes, results=(length(op_ty_results) == 0 ? nothing : op_ty_results), - result_inference=(length(op_ty_results) == 0 ? true : false) + result_inference=(length(op_ty_results) == 0 ? true : false), ) end @@ -403,20 +504,33 @@ that case, it returns a !gpu.async.token in addition to the environment. %spmat, %token = gpu.create_2to4_spmat async [%dep] {PRUNE_AND_CHECK} %rows, %cols, %mem: memref ``` """ -function create_2to4_spmat(asyncDependencies::Vector{Value}, rows::Value, cols::Value, memref::Value; spMat::IR.Type, asyncToken=nothing::Union{Nothing, IR.Type}, pruneFlag=nothing, location=Location()) - op_ty_results = IR.Type[spMat, ] - operands = Value[asyncDependencies..., rows, cols, memref, ] +function create_2to4_spmat( + asyncDependencies::Vector{Value}, + rows::Value, + cols::Value, + memref::Value; + spMat::IR.Type, + asyncToken=nothing::Union{Nothing,IR.Type}, + pruneFlag=nothing, + location=Location(), +) + op_ty_results = IR.Type[spMat,] + operands = Value[asyncDependencies..., rows, cols, memref] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(asyncToken) && push!(op_ty_results, asyncToken) !isnothing(pruneFlag) && push!(attributes, namedattribute("pruneFlag", pruneFlag)) - - create_operation( - "gpu.create_2to4_spmat", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "gpu.create_2to4_spmat", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end @@ -446,19 +560,46 @@ that case, it returns a !gpu.async.token in addition to the environment. %bRowPos, %bColIdxs, %values : memref, memref, memref ``` """ -function create_bsr(asyncDependencies::Vector{Value}, brows::Value, bcols::Value, bnnz::Value, rBlockSize::Value, cBlockSize::Value, bRowPos::Value, bColIdxs::Value, values::Value; spmat::IR.Type, asyncToken=nothing::Union{Nothing, IR.Type}, location=Location()) - op_ty_results = IR.Type[spmat, ] - operands = Value[asyncDependencies..., brows, bcols, bnnz, rBlockSize, cBlockSize, bRowPos, bColIdxs, values, ] +function create_bsr( + asyncDependencies::Vector{Value}, + brows::Value, + bcols::Value, + bnnz::Value, + rBlockSize::Value, + cBlockSize::Value, + bRowPos::Value, + bColIdxs::Value, + values::Value; + spmat::IR.Type, + asyncToken=nothing::Union{Nothing,IR.Type}, + location=Location(), +) + op_ty_results = IR.Type[spmat,] + operands = Value[ + asyncDependencies..., + brows, + bcols, + bnnz, + rBlockSize, + cBlockSize, + bRowPos, + bColIdxs, + values, + ] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(asyncToken) && push!(op_ty_results, asyncToken) - - create_operation( - "gpu.create_bsr", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "gpu.create_bsr", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end @@ -484,19 +625,33 @@ that case, it returns a !gpu.async.token in addition to the environment. %values : memref, memref ``` """ -function create_coo_aos(asyncDependencies::Vector{Value}, rows::Value, cols::Value, nnz::Value, idxs::Value, values::Value; spmat::IR.Type, asyncToken=nothing::Union{Nothing, IR.Type}, location=Location()) - op_ty_results = IR.Type[spmat, ] - operands = Value[asyncDependencies..., rows, cols, nnz, idxs, values, ] +function create_coo_aos( + asyncDependencies::Vector{Value}, + rows::Value, + cols::Value, + nnz::Value, + idxs::Value, + values::Value; + spmat::IR.Type, + asyncToken=nothing::Union{Nothing,IR.Type}, + location=Location(), +) + op_ty_results = IR.Type[spmat,] + operands = Value[asyncDependencies..., rows, cols, nnz, idxs, values] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(asyncToken) && push!(op_ty_results, asyncToken) - - create_operation( - "gpu.create_coo_aos", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "gpu.create_coo_aos", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end @@ -520,19 +675,34 @@ that case, it returns a !gpu.async.token in addition to the environment. %colIdx, %values : memref, memref, memref ``` """ -function create_coo(asyncDependencies::Vector{Value}, rows::Value, cols::Value, nnz::Value, rowIdxs::Value, colIdxs::Value, values::Value; spmat::IR.Type, asyncToken=nothing::Union{Nothing, IR.Type}, location=Location()) - op_ty_results = IR.Type[spmat, ] - operands = Value[asyncDependencies..., rows, cols, nnz, rowIdxs, colIdxs, values, ] +function create_coo( + asyncDependencies::Vector{Value}, + rows::Value, + cols::Value, + nnz::Value, + rowIdxs::Value, + colIdxs::Value, + values::Value; + spmat::IR.Type, + asyncToken=nothing::Union{Nothing,IR.Type}, + location=Location(), +) + op_ty_results = IR.Type[spmat,] + operands = Value[asyncDependencies..., rows, cols, nnz, rowIdxs, colIdxs, values] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(asyncToken) && push!(op_ty_results, asyncToken) - - create_operation( - "gpu.create_coo", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "gpu.create_coo", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end @@ -559,19 +729,34 @@ that case, it returns a !gpu.async.token in addition to the environment. %rowIdx, %values : memref, memref, memref ``` """ -function create_csc(asyncDependencies::Vector{Value}, rows::Value, cols::Value, nnz::Value, colPos::Value, rowIdxs::Value, values::Value; spmat::IR.Type, asyncToken=nothing::Union{Nothing, IR.Type}, location=Location()) - op_ty_results = IR.Type[spmat, ] - operands = Value[asyncDependencies..., rows, cols, nnz, colPos, rowIdxs, values, ] +function create_csc( + asyncDependencies::Vector{Value}, + rows::Value, + cols::Value, + nnz::Value, + colPos::Value, + rowIdxs::Value, + values::Value; + spmat::IR.Type, + asyncToken=nothing::Union{Nothing,IR.Type}, + location=Location(), +) + op_ty_results = IR.Type[spmat,] + operands = Value[asyncDependencies..., rows, cols, nnz, colPos, rowIdxs, values] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(asyncToken) && push!(op_ty_results, asyncToken) - - create_operation( - "gpu.create_csc", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "gpu.create_csc", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end @@ -598,19 +783,34 @@ that case, it returns a !gpu.async.token in addition to the environment. %colIdx, %values : memref, memref, memref ``` """ -function create_csr(asyncDependencies::Vector{Value}, rows::Value, cols::Value, nnz::Value, rowPos::Value, colIdxs::Value, values::Value; spmat::IR.Type, asyncToken=nothing::Union{Nothing, IR.Type}, location=Location()) - op_ty_results = IR.Type[spmat, ] - operands = Value[asyncDependencies..., rows, cols, nnz, rowPos, colIdxs, values, ] +function create_csr( + asyncDependencies::Vector{Value}, + rows::Value, + cols::Value, + nnz::Value, + rowPos::Value, + colIdxs::Value, + values::Value; + spmat::IR.Type, + asyncToken=nothing::Union{Nothing,IR.Type}, + location=Location(), +) + op_ty_results = IR.Type[spmat,] + operands = Value[asyncDependencies..., rows, cols, nnz, rowPos, colIdxs, values] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(asyncToken) && push!(op_ty_results, asyncToken) - - create_operation( - "gpu.create_csr", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "gpu.create_csr", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end @@ -632,20 +832,31 @@ that case, it returns a !gpu.async.token in addition to the environment. %dmat, %token = gpu.create_dn_tensor async [%dep] %mem, %dims : index, index into memref ``` """ -function create_dn_tensor(asyncDependencies::Vector{Value}, memref::Value, dims::Vector{Value}; dnTensor::IR.Type, asyncToken=nothing::Union{Nothing, IR.Type}, location=Location()) - op_ty_results = IR.Type[dnTensor, ] - operands = Value[asyncDependencies..., memref, dims..., ] +function create_dn_tensor( + asyncDependencies::Vector{Value}, + memref::Value, + dims::Vector{Value}; + dnTensor::IR.Type, + asyncToken=nothing::Union{Nothing,IR.Type}, + location=Location(), +) + op_ty_results = IR.Type[dnTensor,] + operands = Value[asyncDependencies..., memref, dims...] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(asyncDependencies), 1, length(dims), ])) + push!(attributes, operandsegmentsizes([length(asyncDependencies), 1, length(dims)])) !isnothing(asyncToken) && push!(op_ty_results, asyncToken) - - create_operation( - "gpu.create_dn_tensor", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "gpu.create_dn_tensor", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end @@ -669,19 +880,28 @@ that case, it returns a !gpu.async.token. %token = gpu.dealloc async [%dep] %memref : memref<8x64xf32, 1> ``` """ -function dealloc(asyncDependencies::Vector{Value}, memref::Value; asyncToken=nothing::Union{Nothing, IR.Type}, location=Location()) +function dealloc( + asyncDependencies::Vector{Value}, + memref::Value; + asyncToken=nothing::Union{Nothing,IR.Type}, + location=Location(), +) op_ty_results = IR.Type[] - operands = Value[asyncDependencies..., memref, ] + operands = Value[asyncDependencies..., memref] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(asyncToken) && push!(op_ty_results, asyncToken) - - create_operation( - "gpu.dealloc", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "gpu.dealloc", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end @@ -702,19 +922,28 @@ that case, it returns a !gpu.async.token in addition to the environment. %token = gpu.destroy_dn_tensor async [%dep] %dnTensor ``` """ -function destroy_dn_tensor(asyncDependencies::Vector{Value}, dnTensor::Value; asyncToken=nothing::Union{Nothing, IR.Type}, location=Location()) +function destroy_dn_tensor( + asyncDependencies::Vector{Value}, + dnTensor::Value; + asyncToken=nothing::Union{Nothing,IR.Type}, + location=Location(), +) op_ty_results = IR.Type[] - operands = Value[asyncDependencies..., dnTensor, ] + operands = Value[asyncDependencies..., dnTensor] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(asyncToken) && push!(op_ty_results, asyncToken) - - create_operation( - "gpu.destroy_dn_tensor", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "gpu.destroy_dn_tensor", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end @@ -735,19 +964,28 @@ that case, it returns a !gpu.async.token in addition to the environment. %token = gpu.destroy_sp_mat async [%dep] %spmat ``` """ -function destroy_sp_mat(asyncDependencies::Vector{Value}, spmat::Value; asyncToken=nothing::Union{Nothing, IR.Type}, location=Location()) +function destroy_sp_mat( + asyncDependencies::Vector{Value}, + spmat::Value; + asyncToken=nothing::Union{Nothing,IR.Type}, + location=Location(), +) op_ty_results = IR.Type[] - operands = Value[asyncDependencies..., spmat, ] + operands = Value[asyncDependencies..., spmat] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(asyncToken) && push!(op_ty_results, asyncToken) - - create_operation( - "gpu.destroy_sp_mat", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "gpu.destroy_sp_mat", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end @@ -770,17 +1008,21 @@ Examples: ``` """ function dynamic_shared_memory(; resultMemref::IR.Type, location=Location()) - op_ty_results = IR.Type[resultMemref, ] + op_ty_results = IR.Type[resultMemref,] operands = Value[] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "gpu.dynamic_shared_memory", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "gpu.dynamic_shared_memory", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end @@ -853,24 +1095,42 @@ The generic form illustrates the concept Note the non-default memory spaces used in memref types in memory attribution. """ -function func(; function_type, arg_attrs=nothing, res_attrs=nothing, workgroup_attrib_attrs=nothing, private_attrib_attrs=nothing, known_block_size=nothing, known_grid_size=nothing, body::Region, location=Location()) +function func(; + function_type, + arg_attrs=nothing, + res_attrs=nothing, + workgroup_attrib_attrs=nothing, + private_attrib_attrs=nothing, + known_block_size=nothing, + known_grid_size=nothing, + body::Region, + location=Location(), +) op_ty_results = IR.Type[] operands = Value[] - owned_regions = Region[body, ] + owned_regions = Region[body,] successors = Block[] - attributes = NamedAttribute[namedattribute("function_type", function_type), ] + attributes = NamedAttribute[namedattribute("function_type", function_type),] !isnothing(arg_attrs) && push!(attributes, namedattribute("arg_attrs", arg_attrs)) !isnothing(res_attrs) && push!(attributes, namedattribute("res_attrs", res_attrs)) - !isnothing(workgroup_attrib_attrs) && push!(attributes, namedattribute("workgroup_attrib_attrs", workgroup_attrib_attrs)) - !isnothing(private_attrib_attrs) && push!(attributes, namedattribute("private_attrib_attrs", private_attrib_attrs)) - !isnothing(known_block_size) && push!(attributes, namedattribute("known_block_size", known_block_size)) - !isnothing(known_grid_size) && push!(attributes, namedattribute("known_grid_size", known_grid_size)) - - create_operation( - "gpu.func", location; - operands, owned_regions, successors, attributes, + !isnothing(workgroup_attrib_attrs) && + push!(attributes, namedattribute("workgroup_attrib_attrs", workgroup_attrib_attrs)) + !isnothing(private_attrib_attrs) && + push!(attributes, namedattribute("private_attrib_attrs", private_attrib_attrs)) + !isnothing(known_block_size) && + push!(attributes, namedattribute("known_block_size", known_block_size)) + !isnothing(known_grid_size) && + push!(attributes, namedattribute("known_grid_size", known_grid_size)) + + return create_operation( + "gpu.func", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end @@ -913,20 +1173,31 @@ gpu.module @symbol_name2 <#gpu.select_object<1>> [ } ``` """ -function module_(; sym_name, targets=nothing, offloadingHandler=nothing, bodyRegion::Region, location=Location()) +function module_(; + sym_name, + targets=nothing, + offloadingHandler=nothing, + bodyRegion::Region, + location=Location(), +) op_ty_results = IR.Type[] operands = Value[] - owned_regions = Region[bodyRegion, ] + owned_regions = Region[bodyRegion,] successors = Block[] - attributes = NamedAttribute[namedattribute("sym_name", sym_name), ] + attributes = NamedAttribute[namedattribute("sym_name", sym_name),] !isnothing(targets) && push!(attributes, namedattribute("targets", targets)) - !isnothing(offloadingHandler) && push!(attributes, namedattribute("offloadingHandler", offloadingHandler)) - - create_operation( - "gpu.module", location; - operands, owned_regions, successors, attributes, + !isnothing(offloadingHandler) && + push!(attributes, namedattribute("offloadingHandler", offloadingHandler)) + + return create_operation( + "gpu.module", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end @@ -948,20 +1219,29 @@ The `upper_bound` attribute defines an upper bound analogously to the ones on `thread_id` and `block_id`. If one is not set, the bound may be inferred from a combination of `known_block_size` and `known_grid_size`-type annotations. """ -function global_id(; result_0=nothing::Union{Nothing, IR.Type}, dimension, upper_bound=nothing, location=Location()) +function global_id(; + result_0=nothing::Union{Nothing,IR.Type}, + dimension, + upper_bound=nothing, + location=Location(), +) op_ty_results = IR.Type[] operands = Value[] owned_regions = Region[] successors = Block[] - attributes = NamedAttribute[namedattribute("dimension", dimension), ] + attributes = NamedAttribute[namedattribute("dimension", dimension),] !isnothing(result_0) && push!(op_ty_results, result_0) !isnothing(upper_bound) && push!(attributes, namedattribute("upper_bound", upper_bound)) - - create_operation( - "gpu.global_id", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "gpu.global_id", + location; + operands, + owned_regions, + successors, + attributes, results=(length(op_ty_results) == 0 ? nothing : op_ty_results), - result_inference=(length(op_ty_results) == 0 ? true : false) + result_inference=(length(op_ty_results) == 0 ? true : false), ) end @@ -991,20 +1271,29 @@ exceed `upper_bound` cause undefined behavior. There is an implicit upper bound of `kMaxDim` (currently uint32_t::max). """ -function grid_dim(; result_0=nothing::Union{Nothing, IR.Type}, dimension, upper_bound=nothing, location=Location()) +function grid_dim(; + result_0=nothing::Union{Nothing,IR.Type}, + dimension, + upper_bound=nothing, + location=Location(), +) op_ty_results = IR.Type[] operands = Value[] owned_regions = Region[] successors = Block[] - attributes = NamedAttribute[namedattribute("dimension", dimension), ] + attributes = NamedAttribute[namedattribute("dimension", dimension),] !isnothing(result_0) && push!(op_ty_results, result_0) !isnothing(upper_bound) && push!(attributes, namedattribute("upper_bound", upper_bound)) - - create_operation( - "gpu.grid_dim", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "gpu.grid_dim", + location; + operands, + owned_regions, + successors, + attributes, results=(length(op_ty_results) == 0 ? nothing : op_ty_results), - result_inference=(length(op_ty_results) == 0 ? true : false) + result_inference=(length(op_ty_results) == 0 ? true : false), ) end @@ -1022,16 +1311,20 @@ the host after synchronizing with the device kernel completion. """ function host_register(value::Value; location=Location()) op_ty_results = IR.Type[] - operands = Value[value, ] + operands = Value[value,] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "gpu.host_register", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "gpu.host_register", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end @@ -1045,16 +1338,20 @@ This operation may not be supported in every environment, there is not yet a """ function host_unregister(value::Value; location=Location()) op_ty_results = IR.Type[] - operands = Value[value, ] + operands = Value[value,] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "gpu.host_unregister", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "gpu.host_unregister", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end @@ -1073,7 +1370,9 @@ subgroup cause undefined behavior. In the abscence of `upper_bound`, the lane id is still assumed to be non-negative and less than the target-independent `kMaxSubgroupSize` (currently 128). """ -function lane_id(; result=nothing::Union{Nothing, IR.Type}, upper_bound=nothing, location=Location()) +function lane_id(; + result=nothing::Union{Nothing,IR.Type}, upper_bound=nothing, location=Location() +) op_ty_results = IR.Type[] operands = Value[] owned_regions = Region[] @@ -1081,12 +1380,16 @@ function lane_id(; result=nothing::Union{Nothing, IR.Type}, upper_bound=nothing, attributes = NamedAttribute[] !isnothing(result) && push!(op_ty_results, result) !isnothing(upper_bound) && push!(attributes, namedattribute("upper_bound", upper_bound)) - - create_operation( - "gpu.lane_id", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "gpu.lane_id", + location; + operands, + owned_regions, + successors, + attributes, results=(length(op_ty_results) == 0 ? nothing : op_ty_results), - result_inference=(length(op_ty_results) == 0 ? true : false) + result_inference=(length(op_ty_results) == 0 ? true : false), ) end @@ -1187,25 +1490,78 @@ module attributes {gpu.container_module} { } ``` """ -function launch_func(asyncDependencies::Vector{Value}, gridSizeX::Value, gridSizeY::Value, gridSizeZ::Value, blockSizeX::Value, blockSizeY::Value, blockSizeZ::Value, clusterSizeX=nothing::Union{Nothing, Value}; clusterSizeY=nothing::Union{Nothing, Value}, clusterSizeZ=nothing::Union{Nothing, Value}, dynamicSharedMemorySize=nothing::Union{Nothing, Value}, kernelOperands::Vector{Value}, asyncObject=nothing::Union{Nothing, Value}, asyncToken=nothing::Union{Nothing, IR.Type}, kernel, location=Location()) +function launch_func( + asyncDependencies::Vector{Value}, + gridSizeX::Value, + gridSizeY::Value, + gridSizeZ::Value, + blockSizeX::Value, + blockSizeY::Value, + blockSizeZ::Value, + clusterSizeX=nothing::Union{Nothing,Value}; + clusterSizeY=nothing::Union{Nothing,Value}, + clusterSizeZ=nothing::Union{Nothing,Value}, + dynamicSharedMemorySize=nothing::Union{Nothing,Value}, + kernelOperands::Vector{Value}, + asyncObject=nothing::Union{Nothing,Value}, + asyncToken=nothing::Union{Nothing,IR.Type}, + kernel, + location=Location(), +) op_ty_results = IR.Type[] - operands = Value[asyncDependencies..., gridSizeX, gridSizeY, gridSizeZ, blockSizeX, blockSizeY, blockSizeZ, kernelOperands..., ] + operands = Value[ + asyncDependencies..., + gridSizeX, + gridSizeY, + gridSizeZ, + blockSizeX, + blockSizeY, + blockSizeZ, + kernelOperands..., + ] owned_regions = Region[] successors = Block[] - attributes = NamedAttribute[namedattribute("kernel", kernel), ] + attributes = NamedAttribute[namedattribute("kernel", kernel),] !isnothing(clusterSizeX) && push!(operands, clusterSizeX) !isnothing(clusterSizeY) && push!(operands, clusterSizeY) !isnothing(clusterSizeZ) && push!(operands, clusterSizeZ) !isnothing(dynamicSharedMemorySize) && push!(operands, dynamicSharedMemorySize) !isnothing(asyncObject) && push!(operands, asyncObject) - push!(attributes, operandsegmentsizes([length(asyncDependencies), 1, 1, 1, 1, 1, 1, (clusterSizeX==nothing) ? 0 : 1(clusterSizeY==nothing) ? 0 : 1(clusterSizeZ==nothing) ? 0 : 1(dynamicSharedMemorySize==nothing) ? 0 : 1length(kernelOperands), (asyncObject==nothing) ? 0 : 1])) + push!( + attributes, + operandsegmentsizes([ + length(asyncDependencies), + 1, + 1, + 1, + 1, + 1, + 1, + if (clusterSizeX == nothing) + 0 + elseif 1(clusterSizeY == nothing) + 0 + elseif 1(clusterSizeZ == nothing) + 0 + elseif 1(dynamicSharedMemorySize == nothing) + 0 + else + 1length(kernelOperands) + end, + (asyncObject == nothing) ? 0 : 1, + ]), + ) !isnothing(asyncToken) && push!(op_ty_results, asyncToken) - - create_operation( - "gpu.launch_func", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "gpu.launch_func", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end @@ -1241,6 +1597,9 @@ dimensions are present, grouped as follows: - a variadic number of Workgroup memory attributions. - a variadic number of Private memory attributions. +The `kernelFunc` and `kernelModule` attributes are optional and specifies +the kernel name and a module in which the kernel should be outlined. + # Syntax ``` @@ -1314,24 +1673,78 @@ know what value corresponds to threadIdx.x for coalescing). We can recover these properties by analyzing the operations producing values, but it is easier just to have that information by construction. """ -function launch(asyncDependencies::Vector{Value}, gridSizeX::Value, gridSizeY::Value, gridSizeZ::Value, blockSizeX::Value, blockSizeY::Value, blockSizeZ::Value, clusterSizeX=nothing::Union{Nothing, Value}; clusterSizeY=nothing::Union{Nothing, Value}, clusterSizeZ=nothing::Union{Nothing, Value}, dynamicSharedMemorySize=nothing::Union{Nothing, Value}, asyncToken=nothing::Union{Nothing, IR.Type}, body::Region, location=Location()) +function launch( + asyncDependencies::Vector{Value}, + gridSizeX::Value, + gridSizeY::Value, + gridSizeZ::Value, + blockSizeX::Value, + blockSizeY::Value, + blockSizeZ::Value, + clusterSizeX=nothing::Union{Nothing,Value}; + clusterSizeY=nothing::Union{Nothing,Value}, + clusterSizeZ=nothing::Union{Nothing,Value}, + dynamicSharedMemorySize=nothing::Union{Nothing,Value}, + asyncToken=nothing::Union{Nothing,IR.Type}, + kernelFunc=nothing, + kernelModule=nothing, + body::Region, + location=Location(), +) op_ty_results = IR.Type[] - operands = Value[asyncDependencies..., gridSizeX, gridSizeY, gridSizeZ, blockSizeX, blockSizeY, blockSizeZ, ] - owned_regions = Region[body, ] + operands = Value[ + asyncDependencies..., + gridSizeX, + gridSizeY, + gridSizeZ, + blockSizeX, + blockSizeY, + blockSizeZ, + ] + owned_regions = Region[body,] successors = Block[] attributes = NamedAttribute[] !isnothing(clusterSizeX) && push!(operands, clusterSizeX) !isnothing(clusterSizeY) && push!(operands, clusterSizeY) !isnothing(clusterSizeZ) && push!(operands, clusterSizeZ) !isnothing(dynamicSharedMemorySize) && push!(operands, dynamicSharedMemorySize) - push!(attributes, operandsegmentsizes([length(asyncDependencies), 1, 1, 1, 1, 1, 1, (clusterSizeX==nothing) ? 0 : 1(clusterSizeY==nothing) ? 0 : 1(clusterSizeZ==nothing) ? 0 : 1(dynamicSharedMemorySize==nothing) ? 0 : 1])) + push!( + attributes, + operandsegmentsizes([ + length(asyncDependencies), + 1, + 1, + 1, + 1, + 1, + 1, + if (clusterSizeX == nothing) + 0 + elseif 1(clusterSizeY == nothing) + 0 + elseif 1(clusterSizeZ == nothing) + 0 + elseif 1(dynamicSharedMemorySize == nothing) + 0 + else + 1 + end, + ]), + ) !isnothing(asyncToken) && push!(op_ty_results, asyncToken) - - create_operation( - "gpu.launch", location; - operands, owned_regions, successors, attributes, + !isnothing(kernelFunc) && push!(attributes, namedattribute("kernelFunc", kernelFunc)) + !isnothing(kernelModule) && + push!(attributes, namedattribute("kernelModule", kernelModule)) + + return create_operation( + "gpu.launch", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end @@ -1353,19 +1766,29 @@ that case, it returns a !gpu.async.token. %token = gpu.memcpy async [%dep] %dst, %src : memref, memref ``` """ -function memcpy(asyncDependencies::Vector{Value}, dst::Value, src::Value; asyncToken=nothing::Union{Nothing, IR.Type}, location=Location()) +function memcpy( + asyncDependencies::Vector{Value}, + dst::Value, + src::Value; + asyncToken=nothing::Union{Nothing,IR.Type}, + location=Location(), +) op_ty_results = IR.Type[] - operands = Value[asyncDependencies..., dst, src, ] + operands = Value[asyncDependencies..., dst, src] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(asyncToken) && push!(op_ty_results, asyncToken) - - create_operation( - "gpu.memcpy", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "gpu.memcpy", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end @@ -1387,19 +1810,29 @@ that case, it returns a !gpu.async.token. %token = gpu.memset async [%dep] %dst, %value : memref, f32 ``` """ -function memset(asyncDependencies::Vector{Value}, dst::Value, value::Value; asyncToken=nothing::Union{Nothing, IR.Type}, location=Location()) +function memset( + asyncDependencies::Vector{Value}, + dst::Value, + value::Value; + asyncToken=nothing::Union{Nothing,IR.Type}, + location=Location(), +) op_ty_results = IR.Type[] - operands = Value[asyncDependencies..., dst, value, ] + operands = Value[asyncDependencies..., dst, value] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(asyncToken) && push!(op_ty_results, asyncToken) - - create_operation( - "gpu.memset", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "gpu.memset", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end @@ -1418,7 +1851,9 @@ If `upper_bound` is set, executions with more than `upper_bound` subgroups per workgroup cause undefined behavior. There is a default upper bound of `kMaxDim` (currently uint32_t::max). """ -function num_subgroups(; result=nothing::Union{Nothing, IR.Type}, upper_bound=nothing, location=Location()) +function num_subgroups(; + result=nothing::Union{Nothing,IR.Type}, upper_bound=nothing, location=Location() +) op_ty_results = IR.Type[] operands = Value[] owned_regions = Region[] @@ -1426,12 +1861,16 @@ function num_subgroups(; result=nothing::Union{Nothing, IR.Type}, upper_bound=no attributes = NamedAttribute[] !isnothing(result) && push!(op_ty_results, result) !isnothing(upper_bound) && push!(attributes, namedattribute("upper_bound", upper_bound)) - - create_operation( - "gpu.num_subgroups", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "gpu.num_subgroups", + location; + operands, + owned_regions, + successors, + attributes, results=(length(op_ty_results) == 0 ? nothing : op_ty_results), - result_inference=(length(op_ty_results) == 0 ? true : false) + result_inference=(length(op_ty_results) == 0 ? true : false), ) end @@ -1446,16 +1885,20 @@ imposed by one\'s target platform. """ function printf(args::Vector{Value}; format, location=Location()) op_ty_results = IR.Type[] - operands = Value[args..., ] + operands = Value[args...,] owned_regions = Region[] successors = Block[] - attributes = NamedAttribute[namedattribute("format", format), ] - - create_operation( - "gpu.printf", location; - operands, owned_regions, successors, attributes, + attributes = NamedAttribute[namedattribute("format", format),] + + return create_operation( + "gpu.printf", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end @@ -1468,16 +1911,20 @@ by an invocation of the `gpu.func`. """ function return_(operands::Vector{Value}; location=Location()) op_ty_results = IR.Type[] - operands = Value[operands..., ] + operands = Value[operands...,] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "gpu.return", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "gpu.return", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end @@ -1503,21 +1950,36 @@ The matrix arguments can also be associated with one of the following operators: NON_TRANSPOSE, TRANSPOSE, CONJUGATE_TRANSPOSE. The default value is NON_TRANSPOSE. """ -function sddmm_buffer_size(asyncDependencies::Vector{Value}, dnmatA::Value, dnmatB::Value, spmatC::Value; bufferSz::IR.Type, asyncToken=nothing::Union{Nothing, IR.Type}, modeA=nothing, modeB=nothing, computeType, location=Location()) - op_ty_results = IR.Type[bufferSz, ] - operands = Value[asyncDependencies..., dnmatA, dnmatB, spmatC, ] +function sddmm_buffer_size( + asyncDependencies::Vector{Value}, + dnmatA::Value, + dnmatB::Value, + spmatC::Value; + bufferSz::IR.Type, + asyncToken=nothing::Union{Nothing,IR.Type}, + modeA=nothing, + modeB=nothing, + computeType, + location=Location(), +) + op_ty_results = IR.Type[bufferSz,] + operands = Value[asyncDependencies..., dnmatA, dnmatB, spmatC] owned_regions = Region[] successors = Block[] - attributes = NamedAttribute[namedattribute("computeType", computeType), ] + attributes = NamedAttribute[namedattribute("computeType", computeType),] !isnothing(asyncToken) && push!(op_ty_results, asyncToken) !isnothing(modeA) && push!(attributes, namedattribute("modeA", modeA)) !isnothing(modeB) && push!(attributes, namedattribute("modeB", modeB)) - - create_operation( - "gpu.sddmm_buffer_size", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "gpu.sddmm_buffer_size", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end @@ -1543,21 +2005,36 @@ The matrix arguments can also be associated with one of the following operators: NON_TRANSPOSE, TRANSPOSE, CONJUGATE_TRANSPOSE. The default value is NON_TRANSPOSE. """ -function sddmm(asyncDependencies::Vector{Value}, dnmatA::Value, dnmatB::Value, spmatC::Value, buffer::Value; asyncToken=nothing::Union{Nothing, IR.Type}, modeA=nothing, modeB=nothing, computeType, location=Location()) +function sddmm( + asyncDependencies::Vector{Value}, + dnmatA::Value, + dnmatB::Value, + spmatC::Value, + buffer::Value; + asyncToken=nothing::Union{Nothing,IR.Type}, + modeA=nothing, + modeB=nothing, + computeType, + location=Location(), +) op_ty_results = IR.Type[] - operands = Value[asyncDependencies..., dnmatA, dnmatB, spmatC, buffer, ] + operands = Value[asyncDependencies..., dnmatA, dnmatB, spmatC, buffer] owned_regions = Region[] successors = Block[] - attributes = NamedAttribute[namedattribute("computeType", computeType), ] + attributes = NamedAttribute[namedattribute("computeType", computeType),] !isnothing(asyncToken) && push!(op_ty_results, asyncToken) !isnothing(modeA) && push!(attributes, namedattribute("modeA", modeA)) !isnothing(modeB) && push!(attributes, namedattribute("modeB", modeB)) - - create_operation( - "gpu.sddmm", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "gpu.sddmm", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end @@ -1579,19 +2056,31 @@ that case, it returns a `!gpu.async.token` in addition to the environment. : memref, memref, memref ``` """ -function set_csr_pointers(asyncDependencies::Vector{Value}, spmat::Value, positions::Value, coordinates::Value, values::Value; asyncToken=nothing::Union{Nothing, IR.Type}, location=Location()) +function set_csr_pointers( + asyncDependencies::Vector{Value}, + spmat::Value, + positions::Value, + coordinates::Value, + values::Value; + asyncToken=nothing::Union{Nothing,IR.Type}, + location=Location(), +) op_ty_results = IR.Type[] - operands = Value[asyncDependencies..., spmat, positions, coordinates, values, ] + operands = Value[asyncDependencies..., spmat, positions, coordinates, values] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(asyncToken) && push!(op_ty_results, asyncToken) - - create_operation( - "gpu.set_csr_pointers", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "gpu.set_csr_pointers", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end @@ -1604,16 +2093,20 @@ thread-local. """ function set_default_device(devIndex::Value; location=Location()) op_ty_results = IR.Type[] - operands = Value[devIndex, ] + operands = Value[devIndex,] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "gpu.set_default_device", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "gpu.set_default_device", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end @@ -1668,20 +2161,32 @@ For lane `k`, returns the value from lane `(k - 1) % width`. Broadcasts the value from lane 0 to all lanes. """ -function shuffle(value::Value, offset::Value, width::Value; shuffleResult=nothing::Union{Nothing, IR.Type}, valid=nothing::Union{Nothing, IR.Type}, mode, location=Location()) +function shuffle( + value::Value, + offset::Value, + width::Value; + shuffleResult=nothing::Union{Nothing,IR.Type}, + valid=nothing::Union{Nothing,IR.Type}, + mode, + location=Location(), +) op_ty_results = IR.Type[] - operands = Value[value, offset, width, ] + operands = Value[value, offset, width] owned_regions = Region[] successors = Block[] - attributes = NamedAttribute[namedattribute("mode", mode), ] + attributes = NamedAttribute[namedattribute("mode", mode),] !isnothing(shuffleResult) && push!(op_ty_results, shuffleResult) !isnothing(valid) && push!(op_ty_results, valid) - - create_operation( - "gpu.shuffle", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "gpu.shuffle", + location; + operands, + owned_regions, + successors, + attributes, results=(length(op_ty_results) == 0 ? nothing : op_ty_results), - result_inference=(length(op_ty_results) == 0 ? true : false) + result_inference=(length(op_ty_results) == 0 ? true : false), ) end @@ -1705,21 +2210,36 @@ The matrix arguments can also be associated with one of the following operators: NON_TRANSPOSE, TRANSPOSE, CONJUGATE_TRANSPOSE. The default value is NON_TRANSPOSE. """ -function spgemm_copy(asyncDependencies::Vector{Value}, desc::Value, spmatA::Value, spmatB::Value, spmatC::Value; asyncToken=nothing::Union{Nothing, IR.Type}, modeA=nothing, modeB=nothing, computeType, location=Location()) +function spgemm_copy( + asyncDependencies::Vector{Value}, + desc::Value, + spmatA::Value, + spmatB::Value, + spmatC::Value; + asyncToken=nothing::Union{Nothing,IR.Type}, + modeA=nothing, + modeB=nothing, + computeType, + location=Location(), +) op_ty_results = IR.Type[] - operands = Value[asyncDependencies..., desc, spmatA, spmatB, spmatC, ] + operands = Value[asyncDependencies..., desc, spmatA, spmatB, spmatC] owned_regions = Region[] successors = Block[] - attributes = NamedAttribute[namedattribute("computeType", computeType), ] + attributes = NamedAttribute[namedattribute("computeType", computeType),] !isnothing(asyncToken) && push!(op_ty_results, asyncToken) !isnothing(modeA) && push!(attributes, namedattribute("modeA", modeA)) !isnothing(modeB) && push!(attributes, namedattribute("modeB", modeB)) - - create_operation( - "gpu.spgemm_copy", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "gpu.spgemm_copy", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end @@ -1741,19 +2261,28 @@ that case, it returns a `!gpu.async.token` in addition to the environment. %desc, %token = gpu.spgemm_create_descr async [%dep] ``` """ -function spgemm_create_descr(asyncDependencies::Vector{Value}; desc::IR.Type, asyncToken=nothing::Union{Nothing, IR.Type}, location=Location()) - op_ty_results = IR.Type[desc, ] - operands = Value[asyncDependencies..., ] +function spgemm_create_descr( + asyncDependencies::Vector{Value}; + desc::IR.Type, + asyncToken=nothing::Union{Nothing,IR.Type}, + location=Location(), +) + op_ty_results = IR.Type[desc,] + operands = Value[asyncDependencies...,] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(asyncToken) && push!(op_ty_results, asyncToken) - - create_operation( - "gpu.spgemm_create_descr", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "gpu.spgemm_create_descr", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end @@ -1772,19 +2301,28 @@ that case, it returns a `!gpu.async.token` in addition to the environment. %token = gpu.spgemm_destroy_descr async [%dep] %desc ``` """ -function spgemm_destroy_descr(asyncDependencies::Vector{Value}, desc::Value; asyncToken=nothing::Union{Nothing, IR.Type}, location=Location()) +function spgemm_destroy_descr( + asyncDependencies::Vector{Value}, + desc::Value; + asyncToken=nothing::Union{Nothing,IR.Type}, + location=Location(), +) op_ty_results = IR.Type[] - operands = Value[asyncDependencies..., desc, ] + operands = Value[asyncDependencies..., desc] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(asyncToken) && push!(op_ty_results, asyncToken) - - create_operation( - "gpu.spgemm_destroy_descr", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "gpu.spgemm_destroy_descr", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end @@ -1817,21 +2355,42 @@ The matrix arguments can also be associated with one of the following operators: NON_TRANSPOSE, TRANSPOSE, CONJUGATE_TRANSPOSE. The default value is NON_TRANSPOSE. """ -function spgemm_work_estimation_or_compute(asyncDependencies::Vector{Value}, desc::Value, spmatA::Value, spmatB::Value, spmatC::Value, bufferSz::Value, buffer::Value; bufferSzNew::IR.Type, asyncToken=nothing::Union{Nothing, IR.Type}, modeA=nothing, modeB=nothing, computeType, kind, location=Location()) - op_ty_results = IR.Type[bufferSzNew, ] - operands = Value[asyncDependencies..., desc, spmatA, spmatB, spmatC, bufferSz, buffer, ] +function spgemm_work_estimation_or_compute( + asyncDependencies::Vector{Value}, + desc::Value, + spmatA::Value, + spmatB::Value, + spmatC::Value, + bufferSz::Value, + buffer::Value; + bufferSzNew::IR.Type, + asyncToken=nothing::Union{Nothing,IR.Type}, + modeA=nothing, + modeB=nothing, + computeType, + kind, + location=Location(), +) + op_ty_results = IR.Type[bufferSzNew,] + operands = Value[asyncDependencies..., desc, spmatA, spmatB, spmatC, bufferSz, buffer] owned_regions = Region[] successors = Block[] - attributes = NamedAttribute[namedattribute("computeType", computeType), namedattribute("kind", kind), ] + attributes = NamedAttribute[ + namedattribute("computeType", computeType), namedattribute("kind", kind) + ] !isnothing(asyncToken) && push!(op_ty_results, asyncToken) !isnothing(modeA) && push!(attributes, namedattribute("modeA", modeA)) !isnothing(modeB) && push!(attributes, namedattribute("modeB", modeB)) - - create_operation( - "gpu.spgemm_work_estimation_or_compute", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "gpu.spgemm_work_estimation_or_compute", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end @@ -1857,21 +2416,36 @@ is NON_TRANSPOSE. %bufferszs, %token = gpu.spmm_buffer_size async [%dep] %spmatA{TRANSPOSE}, %dnmatB{TRANSPOSE}, %dnmatC : i64 into f32 ``` """ -function spmm_buffer_size(asyncDependencies::Vector{Value}, spmatA::Value, dnmatB::Value, dnmatC::Value; bufferSzs::Vector{IR.Type}, asyncToken=nothing::Union{Nothing, IR.Type}, modeA=nothing, modeB=nothing, computeType, location=Location()) - op_ty_results = IR.Type[bufferSzs..., ] - operands = Value[asyncDependencies..., spmatA, dnmatB, dnmatC, ] +function spmm_buffer_size( + asyncDependencies::Vector{Value}, + spmatA::Value, + dnmatB::Value, + dnmatC::Value; + bufferSzs::Vector{IR.Type}, + asyncToken=nothing::Union{Nothing,IR.Type}, + modeA=nothing, + modeB=nothing, + computeType, + location=Location(), +) + op_ty_results = IR.Type[bufferSzs...,] + operands = Value[asyncDependencies..., spmatA, dnmatB, dnmatC] owned_regions = Region[] successors = Block[] - attributes = NamedAttribute[namedattribute("computeType", computeType), ] + attributes = NamedAttribute[namedattribute("computeType", computeType),] !isnothing(asyncToken) && push!(op_ty_results, asyncToken) !isnothing(modeA) && push!(attributes, namedattribute("modeA", modeA)) !isnothing(modeB) && push!(attributes, namedattribute("modeB", modeB)) - - create_operation( - "gpu.spmm_buffer_size", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "gpu.spmm_buffer_size", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end @@ -1897,22 +2471,40 @@ is NON_TRANSPOSE. %token = gpu.spmm async [%dep] %spmatA{TRANSPOSE}, %dnmatB{TRANSPOSE}, %dnmatC, %buffers : type(\$buffers) into f32 ``` """ -function spmm(asyncDependencies::Vector{Value}, spmatA::Value, dnmatB::Value, dnmatC::Value, buffers::Vector{Value}; asyncToken=nothing::Union{Nothing, IR.Type}, modeA=nothing, modeB=nothing, computeType, location=Location()) +function spmm( + asyncDependencies::Vector{Value}, + spmatA::Value, + dnmatB::Value, + dnmatC::Value, + buffers::Vector{Value}; + asyncToken=nothing::Union{Nothing,IR.Type}, + modeA=nothing, + modeB=nothing, + computeType, + location=Location(), +) op_ty_results = IR.Type[] - operands = Value[asyncDependencies..., spmatA, dnmatB, dnmatC, buffers..., ] + operands = Value[asyncDependencies..., spmatA, dnmatB, dnmatC, buffers...] owned_regions = Region[] successors = Block[] - attributes = NamedAttribute[namedattribute("computeType", computeType), ] - push!(attributes, operandsegmentsizes([length(asyncDependencies), 1, 1, 1, length(buffers), ])) + attributes = NamedAttribute[namedattribute("computeType", computeType),] + push!( + attributes, + operandsegmentsizes([length(asyncDependencies), 1, 1, 1, length(buffers)]), + ) !isnothing(asyncToken) && push!(op_ty_results, asyncToken) !isnothing(modeA) && push!(attributes, namedattribute("modeA", modeA)) !isnothing(modeB) && push!(attributes, namedattribute("modeB", modeB)) - - create_operation( - "gpu.spmm", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "gpu.spmm", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end @@ -1938,20 +2530,34 @@ is NON_TRANSPOSE. %buffersz, %token = gpu.spmv_buffer_size async [%dep] %spmatA{TRANSPOSE}, %dnX, %dnY into f32 ``` """ -function spmv_buffer_size(asyncDependencies::Vector{Value}, spmatA::Value, dnX::Value, dnY::Value; bufferSz::IR.Type, asyncToken=nothing::Union{Nothing, IR.Type}, modeA=nothing, computeType, location=Location()) - op_ty_results = IR.Type[bufferSz, ] - operands = Value[asyncDependencies..., spmatA, dnX, dnY, ] +function spmv_buffer_size( + asyncDependencies::Vector{Value}, + spmatA::Value, + dnX::Value, + dnY::Value; + bufferSz::IR.Type, + asyncToken=nothing::Union{Nothing,IR.Type}, + modeA=nothing, + computeType, + location=Location(), +) + op_ty_results = IR.Type[bufferSz,] + operands = Value[asyncDependencies..., spmatA, dnX, dnY] owned_regions = Region[] successors = Block[] - attributes = NamedAttribute[namedattribute("computeType", computeType), ] + attributes = NamedAttribute[namedattribute("computeType", computeType),] !isnothing(asyncToken) && push!(op_ty_results, asyncToken) !isnothing(modeA) && push!(attributes, namedattribute("modeA", modeA)) - - create_operation( - "gpu.spmv_buffer_size", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "gpu.spmv_buffer_size", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end @@ -1977,20 +2583,34 @@ is NON_TRANSPOSE. %token = gpu.spmv async [%dep] %spmatA{TRANSPOSE}, %dnX, %dnY : memref into bf16 ``` """ -function spmv(asyncDependencies::Vector{Value}, spmatA::Value, dnX::Value, dnY::Value, buffer::Value; asyncToken=nothing::Union{Nothing, IR.Type}, modeA=nothing, computeType, location=Location()) +function spmv( + asyncDependencies::Vector{Value}, + spmatA::Value, + dnX::Value, + dnY::Value, + buffer::Value; + asyncToken=nothing::Union{Nothing,IR.Type}, + modeA=nothing, + computeType, + location=Location(), +) op_ty_results = IR.Type[] - operands = Value[asyncDependencies..., spmatA, dnX, dnY, buffer, ] + operands = Value[asyncDependencies..., spmatA, dnX, dnY, buffer] owned_regions = Region[] successors = Block[] - attributes = NamedAttribute[namedattribute("computeType", computeType), ] + attributes = NamedAttribute[namedattribute("computeType", computeType),] !isnothing(asyncToken) && push!(op_ty_results, asyncToken) !isnothing(modeA) && push!(attributes, namedattribute("modeA", modeA)) - - create_operation( - "gpu.spmv", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "gpu.spmv", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end @@ -2010,19 +2630,31 @@ that case, it returns a `!gpu.async.token` in addition to the environment. %rows, %cols, %nnz, %token = gpu.spmat_get_size async [%dep] %spmatC ``` """ -function spmat_get_size(asyncDependencies::Vector{Value}, spmat::Value; rows::IR.Type, cols::IR.Type, nnz::IR.Type, asyncToken=nothing::Union{Nothing, IR.Type}, location=Location()) - op_ty_results = IR.Type[rows, cols, nnz, ] - operands = Value[asyncDependencies..., spmat, ] +function spmat_get_size( + asyncDependencies::Vector{Value}, + spmat::Value; + rows::IR.Type, + cols::IR.Type, + nnz::IR.Type, + asyncToken=nothing::Union{Nothing,IR.Type}, + location=Location(), +) + op_ty_results = IR.Type[rows, cols, nnz] + operands = Value[asyncDependencies..., spmat] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(asyncToken) && push!(op_ty_results, asyncToken) - - create_operation( - "gpu.spmat_get_size", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "gpu.spmat_get_size", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end @@ -2042,7 +2674,9 @@ Executions where there are more than `upper_bound` subgroups per workgroup cause undefined behavior. There is an implicit upper bound of `kMaxDim` (currently uint32_t::max). """ -function subgroup_id(; result=nothing::Union{Nothing, IR.Type}, upper_bound=nothing, location=Location()) +function subgroup_id(; + result=nothing::Union{Nothing,IR.Type}, upper_bound=nothing, location=Location() +) op_ty_results = IR.Type[] operands = Value[] owned_regions = Region[] @@ -2050,12 +2684,16 @@ function subgroup_id(; result=nothing::Union{Nothing, IR.Type}, upper_bound=noth attributes = NamedAttribute[] !isnothing(result) && push!(op_ty_results, result) !isnothing(upper_bound) && push!(attributes, namedattribute("upper_bound", upper_bound)) - - create_operation( - "gpu.subgroup_id", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "gpu.subgroup_id", + location; + operands, + owned_regions, + successors, + attributes, results=(length(op_ty_results) == 0 ? nothing : op_ty_results), - result_inference=(length(op_ty_results) == 0 ? true : false) + result_inference=(length(op_ty_results) == 0 ? true : false), ) end @@ -2090,21 +2728,33 @@ This op is meant to be used along with `gpu.subgroup_mma_store_matrix` and -> !gpu.mma_matrix<16x16xf16, \"COp\"> ``` """ -function subgroup_mma_compute(opA::Value, opB::Value, opC::Value; res=nothing::Union{Nothing, IR.Type}, a_transpose=nothing, b_transpose=nothing, location=Location()) +function subgroup_mma_compute( + opA::Value, + opB::Value, + opC::Value; + res=nothing::Union{Nothing,IR.Type}, + a_transpose=nothing, + b_transpose=nothing, + location=Location(), +) op_ty_results = IR.Type[] - operands = Value[opA, opB, opC, ] + operands = Value[opA, opB, opC] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(res) && push!(op_ty_results, res) !isnothing(a_transpose) && push!(attributes, namedattribute("a_transpose", a_transpose)) !isnothing(b_transpose) && push!(attributes, namedattribute("b_transpose", b_transpose)) - - create_operation( - "gpu.subgroup_mma_compute", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "gpu.subgroup_mma_compute", + location; + operands, + owned_regions, + successors, + attributes, results=(length(op_ty_results) == 0 ? nothing : op_ty_results), - result_inference=(length(op_ty_results) == 0 ? true : false) + result_inference=(length(op_ty_results) == 0 ? true : false), ) end @@ -2132,17 +2782,21 @@ This op is meant to be used along with `gpu.subgroup_mma_compute`. ``` """ function subgroup_mma_constant_matrix(value::Value; res::IR.Type, location=Location()) - op_ty_results = IR.Type[res, ] - operands = Value[value, ] + op_ty_results = IR.Type[res,] + operands = Value[value,] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "gpu.subgroup_mma_constant_matrix", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "gpu.subgroup_mma_constant_matrix", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end @@ -2166,18 +2820,24 @@ This op is meant to be used along with `gpu.subgroup_mma_compute`. -> !gpu.mma_matrix<16x16xf16, \"COp\"> ``` """ -function subgroup_mma_elementwise(args::Vector{Value}; res::IR.Type, opType, location=Location()) - op_ty_results = IR.Type[res, ] - operands = Value[args..., ] +function subgroup_mma_elementwise( + args::Vector{Value}; res::IR.Type, opType, location=Location() +) + op_ty_results = IR.Type[res,] + operands = Value[args...,] owned_regions = Region[] successors = Block[] - attributes = NamedAttribute[namedattribute("opType", opType), ] - - create_operation( - "gpu.subgroup_mma_elementwise", location; - operands, owned_regions, successors, attributes, + attributes = NamedAttribute[namedattribute("opType", opType),] + + return create_operation( + "gpu.subgroup_mma_elementwise", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end @@ -2209,19 +2869,30 @@ This op is often meant to be used along with `gpu.subgroup_mma_store_matrix` and : memref<32x32xf16, 3>, !gpu.mma_matrix<16x16xf16, \"AOp\"> ``` """ -function subgroup_mma_load_matrix(srcMemref::Value, indices::Vector{Value}; res::IR.Type, leadDimension, transpose=nothing, location=Location()) - op_ty_results = IR.Type[res, ] - operands = Value[srcMemref, indices..., ] +function subgroup_mma_load_matrix( + srcMemref::Value, + indices::Vector{Value}; + res::IR.Type, + leadDimension, + transpose=nothing, + location=Location(), +) + op_ty_results = IR.Type[res,] + operands = Value[srcMemref, indices...] owned_regions = Region[] successors = Block[] - attributes = NamedAttribute[namedattribute("leadDimension", leadDimension), ] + attributes = NamedAttribute[namedattribute("leadDimension", leadDimension),] !isnothing(transpose) && push!(attributes, namedattribute("transpose", transpose)) - - create_operation( - "gpu.subgroup_mma_load_matrix", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "gpu.subgroup_mma_load_matrix", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end @@ -2248,19 +2919,30 @@ gpu.subgroup_mma_store_matrix %D, %sg[%i,%j] : { leadDimension = 32 : i32} : !gpu.mma_matrix<16x16xf16, \"COp\">, memref<32x32xf16, 3> ``` """ -function subgroup_mma_store_matrix(src::Value, dstMemref::Value, indices::Vector{Value}; leadDimension, transpose=nothing, location=Location()) +function subgroup_mma_store_matrix( + src::Value, + dstMemref::Value, + indices::Vector{Value}; + leadDimension, + transpose=nothing, + location=Location(), +) op_ty_results = IR.Type[] - operands = Value[src, dstMemref, indices..., ] + operands = Value[src, dstMemref, indices...] owned_regions = Region[] successors = Block[] - attributes = NamedAttribute[namedattribute("leadDimension", leadDimension), ] + attributes = NamedAttribute[namedattribute("leadDimension", leadDimension),] !isnothing(transpose) && push!(attributes, namedattribute("transpose", transpose)) - - create_operation( - "gpu.subgroup_mma_store_matrix", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "gpu.subgroup_mma_store_matrix", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end @@ -2298,22 +2980,36 @@ The reduction operation must be one of: * Floating point types: `add`, `mul`, `minnumf`, `maxnumf`, `minimumf`, `maximumf` """ -function subgroup_reduce(value::Value; result=nothing::Union{Nothing, IR.Type}, op, uniform=nothing, cluster_size=nothing, cluster_stride=nothing, location=Location()) +function subgroup_reduce( + value::Value; + result=nothing::Union{Nothing,IR.Type}, + op, + uniform=nothing, + cluster_size=nothing, + cluster_stride=nothing, + location=Location(), +) op_ty_results = IR.Type[] - operands = Value[value, ] + operands = Value[value,] owned_regions = Region[] successors = Block[] - attributes = NamedAttribute[namedattribute("op", op), ] + attributes = NamedAttribute[namedattribute("op", op),] !isnothing(result) && push!(op_ty_results, result) !isnothing(uniform) && push!(attributes, namedattribute("uniform", uniform)) - !isnothing(cluster_size) && push!(attributes, namedattribute("cluster_size", cluster_size)) - !isnothing(cluster_stride) && push!(attributes, namedattribute("cluster_stride", cluster_stride)) - - create_operation( - "gpu.subgroup_reduce", location; - operands, owned_regions, successors, attributes, + !isnothing(cluster_size) && + push!(attributes, namedattribute("cluster_size", cluster_size)) + !isnothing(cluster_stride) && + push!(attributes, namedattribute("cluster_stride", cluster_stride)) + + return create_operation( + "gpu.subgroup_reduce", + location; + operands, + owned_regions, + successors, + attributes, results=(length(op_ty_results) == 0 ? nothing : op_ty_results), - result_inference=(length(op_ty_results) == 0 ? true : false) + result_inference=(length(op_ty_results) == 0 ? true : false), ) end @@ -2333,7 +3029,9 @@ undefined behavior. When no `upper_bound` is specified, range analyses and similar machinery assume the default bound of `kMaxSubgroupSize`, currently 128. """ -function subgroup_size(; result=nothing::Union{Nothing, IR.Type}, upper_bound=nothing, location=Location()) +function subgroup_size(; + result=nothing::Union{Nothing,IR.Type}, upper_bound=nothing, location=Location() +) op_ty_results = IR.Type[] operands = Value[] owned_regions = Region[] @@ -2341,12 +3039,16 @@ function subgroup_size(; result=nothing::Union{Nothing, IR.Type}, upper_bound=no attributes = NamedAttribute[] !isnothing(result) && push!(op_ty_results, result) !isnothing(upper_bound) && push!(attributes, namedattribute("upper_bound", upper_bound)) - - create_operation( - "gpu.subgroup_size", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "gpu.subgroup_size", + location; + operands, + owned_regions, + successors, + attributes, results=(length(op_ty_results) == 0 ? nothing : op_ty_results), - result_inference=(length(op_ty_results) == 0 ? true : false) + result_inference=(length(op_ty_results) == 0 ? true : false), ) end @@ -2363,12 +3065,16 @@ function terminator(; location=Location()) owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "gpu.terminator", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "gpu.terminator", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end @@ -2390,20 +3096,29 @@ than or equal to that bound cause undefined behavior. There is an implicit upper bound of `kMaxDim` (currently uint32_t::max). """ -function thread_id(; result_0=nothing::Union{Nothing, IR.Type}, dimension, upper_bound=nothing, location=Location()) +function thread_id(; + result_0=nothing::Union{Nothing,IR.Type}, + dimension, + upper_bound=nothing, + location=Location(), +) op_ty_results = IR.Type[] operands = Value[] owned_regions = Region[] successors = Block[] - attributes = NamedAttribute[namedattribute("dimension", dimension), ] + attributes = NamedAttribute[namedattribute("dimension", dimension),] !isnothing(result_0) && push!(op_ty_results, result_0) !isnothing(upper_bound) && push!(attributes, namedattribute("upper_bound", upper_bound)) - - create_operation( - "gpu.thread_id", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "gpu.thread_id", + location; + operands, + owned_regions, + successors, + attributes, results=(length(op_ty_results) == 0 ? nothing : op_ty_results), - result_inference=(length(op_ty_results) == 0 ? true : false) + result_inference=(length(op_ty_results) == 0 ? true : false), ) end @@ -2440,19 +3155,155 @@ once this op completes. Example usage: gpu.wait [%t0, %t1] ``` """ -function wait(asyncDependencies::Vector{Value}; asyncToken=nothing::Union{Nothing, IR.Type}, location=Location()) +function wait( + asyncDependencies::Vector{Value}; + asyncToken=nothing::Union{Nothing,IR.Type}, + location=Location(), +) op_ty_results = IR.Type[] - operands = Value[asyncDependencies..., ] + operands = Value[asyncDependencies...,] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(asyncToken) && push!(op_ty_results, asyncToken) - - create_operation( - "gpu.wait", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "gpu.wait", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, + ) +end + +""" +`warp_execute_on_lane_0` + +`warp_execute_on_lane_0` is an operation used to bridge the gap between +vector programming and SPMD programming model like GPU SIMT. It allows to +trivially convert a region of vector code meant to run on a multiple threads +into a valid SPMD region and then allows incremental transformation to +distribute vector operations on the threads. + +Any code present in the region would only be executed on first thread/lane +based on the `laneid` operand. The `laneid` operand is an integer ID between +[0, `warp_size`). The `warp_size` attribute indicates the number of lanes in +a warp. + +Operands are vector values distributed on all lanes that may be used by +the single lane execution. The matching region argument is a vector of all +the values of those lanes available to the single active lane. The +distributed dimension is implicit based on the shape of the operand and +argument. the properties of the distribution may be described by extra +attributes (e.g. affine map). + +Return values are distributed on all lanes using laneId as index. The +vector is distributed based on the shape ratio between the vector type of +the yield and the result type. +If the shapes are the same this means the value is broadcasted to all lanes. +In the future the distribution can be made more explicit using affine_maps +and will support having multiple Ids. + +Therefore the `warp_execute_on_lane_0` operations allow to implicitly copy +between lane0 and the lanes of the warp. When distributing a vector +from lane0 to all the lanes, the data are distributed in a block cyclic way. +For example `vector<64xf32>` gets distributed on 32 threads and map to +`vector<2xf32>` where thread 0 contains vector[0] and vector[1]. + +During lowering values passed as operands and return value need to be +visible to different lanes within the warp. This would usually be done by +going through memory. + +The region is *not* isolated from above. For values coming from the parent +region not going through operands only the lane 0 value will be accesible so +it generally only make sense for uniform values. + +# Example +``` +// Execute in parallel on all threads/lanes. +gpu.warp_execute_on_lane_0 (%laneid)[32] { + // Serial code running only on thread/lane 0. + ... +} +// Execute in parallel on all threads/lanes. +``` + +This may be lowered to an scf.if region as below: +``` + // Execute in parallel on all threads/lanes. + %cnd = arith.cmpi eq, %laneid, %c0 : index + scf.if %cnd { + // Serial code running only on thread/lane 0. + ... + } + // Execute in parallel on all threads/lanes. +``` + +When the region has operands and/or return values: +``` +// Execute in parallel on all threads/lanes. +%0 = gpu.warp_execute_on_lane_0(%laneid)[32] +args(%v0 : vector<4xi32>) -> (vector<1xf32>) { +^bb0(%arg0 : vector<128xi32>) : + // Serial code running only on thread/lane 0. + ... + gpu.yield %1 : vector<32xf32> +} +// Execute in parallel on all threads/lanes. +``` + +values at the region boundary would go through memory: +``` +// Execute in parallel on all threads/lanes. +... +// Store the data from each thread into memory and Synchronization. +%tmp0 = memreg.alloc() : memref<128xf32> +%tmp1 = memreg.alloc() : memref<32xf32> +%cnd = arith.cmpi eq, %laneid, %c0 : index +vector.store %v0, %tmp0[%laneid] : memref<128xf32>, vector<4xf32> +some_synchronization_primitive +scf.if %cnd { + // Serialized code running only on thread 0. + // Load the data from all the threads into a register from thread 0. This + // allow threads 0 to access data from all the threads. + %arg0 = vector.load %tmp0[%c0] : memref<128xf32>, vector<128xf32> + ... + // Store the data from thread 0 into memory. + vector.store %1, %tmp1[%c0] : memref<32xf32>, vector<32xf32> +} +// Synchronization and load the data in a block cyclic way so that the +// vector is distributed on all threads. +some_synchronization_primitive +%0 = vector.load %tmp1[%laneid] : memref<32xf32>, vector<32xf32> +// Execute in parallel on all threads/lanes. +``` +""" +function warp_execute_on_lane_0( + laneid::Value, + args::Vector{Value}; + results::Vector{IR.Type}, + warp_size, + warpRegion::Region, + location=Location(), +) + op_ty_results = IR.Type[results...,] + operands = Value[laneid, args...] + owned_regions = Region[warpRegion,] + successors = Block[] + attributes = NamedAttribute[namedattribute("warp_size", warp_size),] + + return create_operation( + "gpu.warp_execute_on_lane_0", + location; + operands, + owned_regions, + successors, + attributes, + results=op_ty_results, + result_inference=false, ) end @@ -2470,16 +3321,20 @@ gpu.yield %f0, %f1 : f32, f32 """ function yield(values::Vector{Value}; location=Location()) op_ty_results = IR.Type[] - operands = Value[values..., ] + operands = Value[values...,] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "gpu.yield", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "gpu.yield", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end diff --git a/src/mlir/Dialects/Llvm.jl b/src/mlir/Dialects/Llvm.jl index b31ef0ee7..fe456ba2a 100755 --- a/src/mlir/Dialects/Llvm.jl +++ b/src/mlir/Dialects/Llvm.jl @@ -1,58 +1,83 @@ module llvm using ...IR -import ...IR: NamedAttribute, Value, Location, Block, Region, Attribute, create_operation, context, IndexType +import ...IR: + NamedAttribute, + Value, + Location, + Block, + Region, + Attribute, + create_operation, + context, + IndexType import ..Dialects: namedattribute, operandsegmentsizes import ...API - - -function ashr(lhs::Value, rhs::Value; res=nothing::Union{Nothing, IR.Type}, isExact=nothing, location=Location()) +function ashr( + lhs::Value, + rhs::Value; + res=nothing::Union{Nothing,IR.Type}, + isExact=nothing, + location=Location(), +) op_ty_results = IR.Type[] - operands = Value[lhs, rhs, ] + operands = Value[lhs, rhs] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(res) && push!(op_ty_results, res) !isnothing(isExact) && push!(attributes, namedattribute("isExact", isExact)) - - create_operation( - "llvm.ashr", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "llvm.ashr", + location; + operands, + owned_regions, + successors, + attributes, results=(length(op_ty_results) == 0 ? nothing : op_ty_results), - result_inference=(length(op_ty_results) == 0 ? true : false) + result_inference=(length(op_ty_results) == 0 ? true : false), ) end - -function add(lhs::Value, rhs::Value; res=nothing::Union{Nothing, IR.Type}, location=Location()) +function add( + lhs::Value, rhs::Value; res=nothing::Union{Nothing,IR.Type}, location=Location() +) op_ty_results = IR.Type[] - operands = Value[lhs, rhs, ] + operands = Value[lhs, rhs] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(res) && push!(op_ty_results, res) - - create_operation( - "llvm.add", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "llvm.add", + location; + operands, + owned_regions, + successors, + attributes, results=(length(op_ty_results) == 0 ? nothing : op_ty_results), - result_inference=(length(op_ty_results) == 0 ? true : false) + result_inference=(length(op_ty_results) == 0 ? true : false), ) end - function addrspacecast(arg::Value; res::IR.Type, location=Location()) - op_ty_results = IR.Type[res, ] - operands = Value[arg, ] + op_ty_results = IR.Type[res,] + operands = Value[arg,] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "llvm.addrspacecast", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "llvm.addrspacecast", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end @@ -86,134 +111,209 @@ llvm.mlir.global @const(42 : i32) : i32 ``` """ function mlir_addressof(; res::IR.Type, global_name, location=Location()) - op_ty_results = IR.Type[res, ] + op_ty_results = IR.Type[res,] operands = Value[] owned_regions = Region[] successors = Block[] - attributes = NamedAttribute[namedattribute("global_name", global_name), ] - - create_operation( - "llvm.mlir.addressof", location; - operands, owned_regions, successors, attributes, + attributes = NamedAttribute[namedattribute("global_name", global_name),] + + return create_operation( + "llvm.mlir.addressof", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - -function alloca(arraySize::Value; res::IR.Type, alignment=nothing, elem_type, inalloca=nothing, location=Location()) - op_ty_results = IR.Type[res, ] - operands = Value[arraySize, ] +function alloca( + arraySize::Value; + res::IR.Type, + alignment=nothing, + elem_type, + inalloca=nothing, + location=Location(), +) + op_ty_results = IR.Type[res,] + operands = Value[arraySize,] owned_regions = Region[] successors = Block[] - attributes = NamedAttribute[namedattribute("elem_type", elem_type), ] + attributes = NamedAttribute[namedattribute("elem_type", elem_type),] !isnothing(alignment) && push!(attributes, namedattribute("alignment", alignment)) !isnothing(inalloca) && push!(attributes, namedattribute("inalloca", inalloca)) - - create_operation( - "llvm.alloca", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "llvm.alloca", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - -function and(lhs::Value, rhs::Value; res=nothing::Union{Nothing, IR.Type}, location=Location()) +function and( + lhs::Value, rhs::Value; res=nothing::Union{Nothing,IR.Type}, location=Location() +) op_ty_results = IR.Type[] - operands = Value[lhs, rhs, ] + operands = Value[lhs, rhs] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(res) && push!(op_ty_results, res) - - create_operation( - "llvm.and", location; - operands, owned_regions, successors, attributes, - results=(length(op_ty_results) == 0 ? nothing : op_ty_results), - result_inference=(length(op_ty_results) == 0 ? true : false) - ) -end - -function cmpxchg(ptr::Value, cmp::Value, val::Value; res=nothing::Union{Nothing, IR.Type}, success_ordering, failure_ordering, syncscope=nothing, alignment=nothing, weak=nothing, volatile_=nothing, access_groups=nothing, alias_scopes=nothing, noalias_scopes=nothing, tbaa=nothing, location=Location()) + return create_operation( + "llvm.and", + location; + operands, + owned_regions, + successors, + attributes, + results=(length(op_ty_results) == 0 ? nothing : op_ty_results), + result_inference=(length(op_ty_results) == 0 ? true : false), + ) +end + +function cmpxchg( + ptr::Value, + cmp::Value, + val::Value; + res=nothing::Union{Nothing,IR.Type}, + success_ordering, + failure_ordering, + syncscope=nothing, + alignment=nothing, + weak=nothing, + volatile_=nothing, + access_groups=nothing, + alias_scopes=nothing, + noalias_scopes=nothing, + tbaa=nothing, + location=Location(), +) op_ty_results = IR.Type[] - operands = Value[ptr, cmp, val, ] + operands = Value[ptr, cmp, val] owned_regions = Region[] successors = Block[] - attributes = NamedAttribute[namedattribute("success_ordering", success_ordering), namedattribute("failure_ordering", failure_ordering), ] + attributes = NamedAttribute[ + namedattribute("success_ordering", success_ordering), + namedattribute("failure_ordering", failure_ordering), + ] !isnothing(res) && push!(op_ty_results, res) !isnothing(syncscope) && push!(attributes, namedattribute("syncscope", syncscope)) !isnothing(alignment) && push!(attributes, namedattribute("alignment", alignment)) !isnothing(weak) && push!(attributes, namedattribute("weak", weak)) !isnothing(volatile_) && push!(attributes, namedattribute("volatile_", volatile_)) - !isnothing(access_groups) && push!(attributes, namedattribute("access_groups", access_groups)) - !isnothing(alias_scopes) && push!(attributes, namedattribute("alias_scopes", alias_scopes)) - !isnothing(noalias_scopes) && push!(attributes, namedattribute("noalias_scopes", noalias_scopes)) + !isnothing(access_groups) && + push!(attributes, namedattribute("access_groups", access_groups)) + !isnothing(alias_scopes) && + push!(attributes, namedattribute("alias_scopes", alias_scopes)) + !isnothing(noalias_scopes) && + push!(attributes, namedattribute("noalias_scopes", noalias_scopes)) !isnothing(tbaa) && push!(attributes, namedattribute("tbaa", tbaa)) - - create_operation( - "llvm.cmpxchg", location; - operands, owned_regions, successors, attributes, - results=(length(op_ty_results) == 0 ? nothing : op_ty_results), - result_inference=(length(op_ty_results) == 0 ? true : false) - ) -end - -function atomicrmw(ptr::Value, val::Value; res=nothing::Union{Nothing, IR.Type}, bin_op, ordering, syncscope=nothing, alignment=nothing, volatile_=nothing, access_groups=nothing, alias_scopes=nothing, noalias_scopes=nothing, tbaa=nothing, location=Location()) + return create_operation( + "llvm.cmpxchg", + location; + operands, + owned_regions, + successors, + attributes, + results=(length(op_ty_results) == 0 ? nothing : op_ty_results), + result_inference=(length(op_ty_results) == 0 ? true : false), + ) +end + +function atomicrmw( + ptr::Value, + val::Value; + res=nothing::Union{Nothing,IR.Type}, + bin_op, + ordering, + syncscope=nothing, + alignment=nothing, + volatile_=nothing, + access_groups=nothing, + alias_scopes=nothing, + noalias_scopes=nothing, + tbaa=nothing, + location=Location(), +) op_ty_results = IR.Type[] - operands = Value[ptr, val, ] + operands = Value[ptr, val] owned_regions = Region[] successors = Block[] - attributes = NamedAttribute[namedattribute("bin_op", bin_op), namedattribute("ordering", ordering), ] + attributes = NamedAttribute[ + namedattribute("bin_op", bin_op), namedattribute("ordering", ordering) + ] !isnothing(res) && push!(op_ty_results, res) !isnothing(syncscope) && push!(attributes, namedattribute("syncscope", syncscope)) !isnothing(alignment) && push!(attributes, namedattribute("alignment", alignment)) !isnothing(volatile_) && push!(attributes, namedattribute("volatile_", volatile_)) - !isnothing(access_groups) && push!(attributes, namedattribute("access_groups", access_groups)) - !isnothing(alias_scopes) && push!(attributes, namedattribute("alias_scopes", alias_scopes)) - !isnothing(noalias_scopes) && push!(attributes, namedattribute("noalias_scopes", noalias_scopes)) + !isnothing(access_groups) && + push!(attributes, namedattribute("access_groups", access_groups)) + !isnothing(alias_scopes) && + push!(attributes, namedattribute("alias_scopes", alias_scopes)) + !isnothing(noalias_scopes) && + push!(attributes, namedattribute("noalias_scopes", noalias_scopes)) !isnothing(tbaa) && push!(attributes, namedattribute("tbaa", tbaa)) - - create_operation( - "llvm.atomicrmw", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "llvm.atomicrmw", + location; + operands, + owned_regions, + successors, + attributes, results=(length(op_ty_results) == 0 ? nothing : op_ty_results), - result_inference=(length(op_ty_results) == 0 ? true : false) + result_inference=(length(op_ty_results) == 0 ? true : false), ) end - function bitcast(arg::Value; res::IR.Type, location=Location()) - op_ty_results = IR.Type[res, ] - operands = Value[arg, ] + op_ty_results = IR.Type[res,] + operands = Value[arg,] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "llvm.bitcast", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "llvm.bitcast", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - -function br(destOperands::Vector{Value}; loop_annotation=nothing, dest::Block, location=Location()) +function br( + destOperands::Vector{Value}; loop_annotation=nothing, dest::Block, location=Location() +) op_ty_results = IR.Type[] - operands = Value[destOperands..., ] + operands = Value[destOperands...,] owned_regions = Region[] - successors = Block[dest, ] + successors = Block[dest,] attributes = NamedAttribute[] - !isnothing(loop_annotation) && push!(attributes, namedattribute("loop_annotation", loop_annotation)) - - create_operation( - "llvm.br", location; - operands, owned_regions, successors, attributes, + !isnothing(loop_annotation) && + push!(attributes, namedattribute("loop_annotation", loop_annotation)) + + return create_operation( + "llvm.br", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end @@ -223,22 +323,39 @@ end Call the specified llvm intrinsic. If the intrinsic is overloaded, use the MLIR function type of this op to determine which intrinsic to call. """ -function call_intrinsic(args::Vector{Value}, op_bundle_operands::Vector{Value}; results=nothing::Union{Nothing, IR.Type}, intrin, fastmathFlags=nothing, op_bundle_sizes, op_bundle_tags=nothing, location=Location()) +function call_intrinsic( + args::Vector{Value}, + op_bundle_operands::Vector{Value}; + results=nothing::Union{Nothing,IR.Type}, + intrin, + fastmathFlags=nothing, + op_bundle_sizes, + op_bundle_tags=nothing, + location=Location(), +) op_ty_results = IR.Type[] - operands = Value[args..., op_bundle_operands..., ] + operands = Value[args..., op_bundle_operands...] owned_regions = Region[] successors = Block[] - attributes = NamedAttribute[namedattribute("intrin", intrin), namedattribute("op_bundle_sizes", op_bundle_sizes), ] - push!(attributes, operandsegmentsizes([length(args), length(op_bundle_operands), ])) + attributes = NamedAttribute[ + namedattribute("intrin", intrin), namedattribute("op_bundle_sizes", op_bundle_sizes) + ] + push!(attributes, operandsegmentsizes([length(args), length(op_bundle_operands)])) !isnothing(results) && push!(op_ty_results, results) - !isnothing(fastmathFlags) && push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) - !isnothing(op_bundle_tags) && push!(attributes, namedattribute("op_bundle_tags", op_bundle_tags)) - - create_operation( - "llvm.call_intrinsic", location; - operands, owned_regions, successors, attributes, + !isnothing(fastmathFlags) && + push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) + !isnothing(op_bundle_tags) && + push!(attributes, namedattribute("op_bundle_tags", op_bundle_tags)) + + return create_operation( + "llvm.call_intrinsic", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end @@ -281,35 +398,72 @@ llvm.call @printf(%0, %1) vararg(!llvm.func) : (!llvm.ptr, i32) llvm.call %1(%0) vararg(!llvm.func) : !llvm.ptr, (i32) -> () ``` """ -function call(callee_operands::Vector{Value}, op_bundle_operands::Vector{Value}; result=nothing::Union{Nothing, IR.Type}, var_callee_type=nothing, callee=nothing, fastmathFlags=nothing, branch_weights=nothing, CConv=nothing, TailCallKind=nothing, memory_effects=nothing, convergent=nothing, no_unwind=nothing, will_return=nothing, op_bundle_sizes, op_bundle_tags=nothing, access_groups=nothing, alias_scopes=nothing, noalias_scopes=nothing, tbaa=nothing, location=Location()) +function call( + callee_operands::Vector{Value}, + op_bundle_operands::Vector{Value}; + result=nothing::Union{Nothing,IR.Type}, + var_callee_type=nothing, + callee=nothing, + fastmathFlags=nothing, + branch_weights=nothing, + CConv=nothing, + TailCallKind=nothing, + memory_effects=nothing, + convergent=nothing, + no_unwind=nothing, + will_return=nothing, + op_bundle_sizes, + op_bundle_tags=nothing, + access_groups=nothing, + alias_scopes=nothing, + noalias_scopes=nothing, + tbaa=nothing, + location=Location(), +) op_ty_results = IR.Type[] - operands = Value[callee_operands..., op_bundle_operands..., ] + operands = Value[callee_operands..., op_bundle_operands...] owned_regions = Region[] successors = Block[] - attributes = NamedAttribute[namedattribute("op_bundle_sizes", op_bundle_sizes), ] - push!(attributes, operandsegmentsizes([length(callee_operands), length(op_bundle_operands), ])) + attributes = NamedAttribute[namedattribute("op_bundle_sizes", op_bundle_sizes),] + push!( + attributes, + operandsegmentsizes([length(callee_operands), length(op_bundle_operands)]), + ) !isnothing(result) && push!(op_ty_results, result) - !isnothing(var_callee_type) && push!(attributes, namedattribute("var_callee_type", var_callee_type)) + !isnothing(var_callee_type) && + push!(attributes, namedattribute("var_callee_type", var_callee_type)) !isnothing(callee) && push!(attributes, namedattribute("callee", callee)) - !isnothing(fastmathFlags) && push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) - !isnothing(branch_weights) && push!(attributes, namedattribute("branch_weights", branch_weights)) + !isnothing(fastmathFlags) && + push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) + !isnothing(branch_weights) && + push!(attributes, namedattribute("branch_weights", branch_weights)) !isnothing(CConv) && push!(attributes, namedattribute("CConv", CConv)) - !isnothing(TailCallKind) && push!(attributes, namedattribute("TailCallKind", TailCallKind)) - !isnothing(memory_effects) && push!(attributes, namedattribute("memory_effects", memory_effects)) + !isnothing(TailCallKind) && + push!(attributes, namedattribute("TailCallKind", TailCallKind)) + !isnothing(memory_effects) && + push!(attributes, namedattribute("memory_effects", memory_effects)) !isnothing(convergent) && push!(attributes, namedattribute("convergent", convergent)) !isnothing(no_unwind) && push!(attributes, namedattribute("no_unwind", no_unwind)) !isnothing(will_return) && push!(attributes, namedattribute("will_return", will_return)) - !isnothing(op_bundle_tags) && push!(attributes, namedattribute("op_bundle_tags", op_bundle_tags)) - !isnothing(access_groups) && push!(attributes, namedattribute("access_groups", access_groups)) - !isnothing(alias_scopes) && push!(attributes, namedattribute("alias_scopes", alias_scopes)) - !isnothing(noalias_scopes) && push!(attributes, namedattribute("noalias_scopes", noalias_scopes)) + !isnothing(op_bundle_tags) && + push!(attributes, namedattribute("op_bundle_tags", op_bundle_tags)) + !isnothing(access_groups) && + push!(attributes, namedattribute("access_groups", access_groups)) + !isnothing(alias_scopes) && + push!(attributes, namedattribute("alias_scopes", alias_scopes)) + !isnothing(noalias_scopes) && + push!(attributes, namedattribute("noalias_scopes", noalias_scopes)) !isnothing(tbaa) && push!(attributes, namedattribute("tbaa", tbaa)) - - create_operation( - "llvm.call", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "llvm.call", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end @@ -329,15 +483,19 @@ llvm.mlir.global internal constant @has_any_comdat(1 : i64) comdat(@__llvm_comda function comdat(; sym_name, body::Region, location=Location()) op_ty_results = IR.Type[] operands = Value[] - owned_regions = Region[body, ] + owned_regions = Region[body,] successors = Block[] - attributes = NamedAttribute[namedattribute("sym_name", sym_name), ] - - create_operation( - "llvm.comdat", location; - operands, owned_regions, successors, attributes, + attributes = NamedAttribute[namedattribute("sym_name", sym_name),] + + return create_operation( + "llvm.comdat", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end @@ -359,32 +517,55 @@ function comdat_selector(; sym_name, comdat, location=Location()) operands = Value[] owned_regions = Region[] successors = Block[] - attributes = NamedAttribute[namedattribute("sym_name", sym_name), namedattribute("comdat", comdat), ] - - create_operation( - "llvm.comdat_selector", location; - operands, owned_regions, successors, attributes, + attributes = NamedAttribute[ + namedattribute("sym_name", sym_name), namedattribute("comdat", comdat) + ] + + return create_operation( + "llvm.comdat_selector", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - -function cond_br(condition::Value, trueDestOperands::Vector{Value}, falseDestOperands::Vector{Value}; branch_weights=nothing, loop_annotation=nothing, trueDest::Block, falseDest::Block, location=Location()) +function cond_br( + condition::Value, + trueDestOperands::Vector{Value}, + falseDestOperands::Vector{Value}; + branch_weights=nothing, + loop_annotation=nothing, + trueDest::Block, + falseDest::Block, + location=Location(), +) op_ty_results = IR.Type[] - operands = Value[condition, trueDestOperands..., falseDestOperands..., ] + operands = Value[condition, trueDestOperands..., falseDestOperands...] owned_regions = Region[] - successors = Block[trueDest, falseDest, ] + successors = Block[trueDest, falseDest] attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([1, length(trueDestOperands), length(falseDestOperands), ])) - !isnothing(branch_weights) && push!(attributes, namedattribute("branch_weights", branch_weights)) - !isnothing(loop_annotation) && push!(attributes, namedattribute("loop_annotation", loop_annotation)) - - create_operation( - "llvm.cond_br", location; - operands, owned_regions, successors, attributes, + push!( + attributes, + operandsegmentsizes([1, length(trueDestOperands), length(falseDestOperands)]), + ) + !isnothing(branch_weights) && + push!(attributes, namedattribute("branch_weights", branch_weights)) + !isnothing(loop_annotation) && + push!(attributes, namedattribute("loop_annotation", loop_annotation)) + + return create_operation( + "llvm.cond_br", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end @@ -435,274 +616,374 @@ Examples: ``` """ function mlir_constant(; res::IR.Type, value, location=Location()) - op_ty_results = IR.Type[res, ] + op_ty_results = IR.Type[res,] operands = Value[] owned_regions = Region[] successors = Block[] - attributes = NamedAttribute[namedattribute("value", value), ] - - create_operation( - "llvm.mlir.constant", location; - operands, owned_regions, successors, attributes, + attributes = NamedAttribute[namedattribute("value", value),] + + return create_operation( + "llvm.mlir.constant", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - -function extractelement(vector::Value, position::Value; res=nothing::Union{Nothing, IR.Type}, location=Location()) +function extractelement( + vector::Value, position::Value; res=nothing::Union{Nothing,IR.Type}, location=Location() +) op_ty_results = IR.Type[] - operands = Value[vector, position, ] + operands = Value[vector, position] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(res) && push!(op_ty_results, res) - - create_operation( - "llvm.extractelement", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "llvm.extractelement", + location; + operands, + owned_regions, + successors, + attributes, results=(length(op_ty_results) == 0 ? nothing : op_ty_results), - result_inference=(length(op_ty_results) == 0 ? true : false) + result_inference=(length(op_ty_results) == 0 ? true : false), ) end - function extractvalue(container::Value; res::IR.Type, position, location=Location()) - op_ty_results = IR.Type[res, ] - operands = Value[container, ] + op_ty_results = IR.Type[res,] + operands = Value[container,] owned_regions = Region[] successors = Block[] - attributes = NamedAttribute[namedattribute("position", position), ] - - create_operation( - "llvm.extractvalue", location; - operands, owned_regions, successors, attributes, + attributes = NamedAttribute[namedattribute("position", position),] + + return create_operation( + "llvm.extractvalue", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - -function fadd(lhs::Value, rhs::Value; res=nothing::Union{Nothing, IR.Type}, fastmathFlags=nothing, location=Location()) +function fadd( + lhs::Value, + rhs::Value; + res=nothing::Union{Nothing,IR.Type}, + fastmathFlags=nothing, + location=Location(), +) op_ty_results = IR.Type[] - operands = Value[lhs, rhs, ] + operands = Value[lhs, rhs] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(res) && push!(op_ty_results, res) - !isnothing(fastmathFlags) && push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) - - create_operation( - "llvm.fadd", location; - operands, owned_regions, successors, attributes, + !isnothing(fastmathFlags) && + push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) + + return create_operation( + "llvm.fadd", + location; + operands, + owned_regions, + successors, + attributes, results=(length(op_ty_results) == 0 ? nothing : op_ty_results), - result_inference=(length(op_ty_results) == 0 ? true : false) + result_inference=(length(op_ty_results) == 0 ? true : false), ) end - -function fcmp(lhs::Value, rhs::Value; res=nothing::Union{Nothing, IR.Type}, predicate, fastmathFlags=nothing, location=Location()) +function fcmp( + lhs::Value, + rhs::Value; + res=nothing::Union{Nothing,IR.Type}, + predicate, + fastmathFlags=nothing, + location=Location(), +) op_ty_results = IR.Type[] - operands = Value[lhs, rhs, ] + operands = Value[lhs, rhs] owned_regions = Region[] successors = Block[] - attributes = NamedAttribute[namedattribute("predicate", predicate), ] + attributes = NamedAttribute[namedattribute("predicate", predicate),] !isnothing(res) && push!(op_ty_results, res) - !isnothing(fastmathFlags) && push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) - - create_operation( - "llvm.fcmp", location; - operands, owned_regions, successors, attributes, + !isnothing(fastmathFlags) && + push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) + + return create_operation( + "llvm.fcmp", + location; + operands, + owned_regions, + successors, + attributes, results=(length(op_ty_results) == 0 ? nothing : op_ty_results), - result_inference=(length(op_ty_results) == 0 ? true : false) + result_inference=(length(op_ty_results) == 0 ? true : false), ) end - -function fdiv(lhs::Value, rhs::Value; res=nothing::Union{Nothing, IR.Type}, fastmathFlags=nothing, location=Location()) +function fdiv( + lhs::Value, + rhs::Value; + res=nothing::Union{Nothing,IR.Type}, + fastmathFlags=nothing, + location=Location(), +) op_ty_results = IR.Type[] - operands = Value[lhs, rhs, ] + operands = Value[lhs, rhs] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(res) && push!(op_ty_results, res) - !isnothing(fastmathFlags) && push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) - - create_operation( - "llvm.fdiv", location; - operands, owned_regions, successors, attributes, + !isnothing(fastmathFlags) && + push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) + + return create_operation( + "llvm.fdiv", + location; + operands, + owned_regions, + successors, + attributes, results=(length(op_ty_results) == 0 ? nothing : op_ty_results), - result_inference=(length(op_ty_results) == 0 ? true : false) + result_inference=(length(op_ty_results) == 0 ? true : false), ) end - -function fmul(lhs::Value, rhs::Value; res=nothing::Union{Nothing, IR.Type}, fastmathFlags=nothing, location=Location()) +function fmul( + lhs::Value, + rhs::Value; + res=nothing::Union{Nothing,IR.Type}, + fastmathFlags=nothing, + location=Location(), +) op_ty_results = IR.Type[] - operands = Value[lhs, rhs, ] + operands = Value[lhs, rhs] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(res) && push!(op_ty_results, res) - !isnothing(fastmathFlags) && push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) - - create_operation( - "llvm.fmul", location; - operands, owned_regions, successors, attributes, + !isnothing(fastmathFlags) && + push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) + + return create_operation( + "llvm.fmul", + location; + operands, + owned_regions, + successors, + attributes, results=(length(op_ty_results) == 0 ? nothing : op_ty_results), - result_inference=(length(op_ty_results) == 0 ? true : false) + result_inference=(length(op_ty_results) == 0 ? true : false), ) end - -function fneg(operand::Value; res=nothing::Union{Nothing, IR.Type}, fastmathFlags=nothing, location=Location()) +function fneg( + operand::Value; + res=nothing::Union{Nothing,IR.Type}, + fastmathFlags=nothing, + location=Location(), +) op_ty_results = IR.Type[] - operands = Value[operand, ] + operands = Value[operand,] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(res) && push!(op_ty_results, res) - !isnothing(fastmathFlags) && push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) - - create_operation( - "llvm.fneg", location; - operands, owned_regions, successors, attributes, + !isnothing(fastmathFlags) && + push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) + + return create_operation( + "llvm.fneg", + location; + operands, + owned_regions, + successors, + attributes, results=(length(op_ty_results) == 0 ? nothing : op_ty_results), - result_inference=(length(op_ty_results) == 0 ? true : false) + result_inference=(length(op_ty_results) == 0 ? true : false), ) end - function fpext(arg::Value; res::IR.Type, location=Location()) - op_ty_results = IR.Type[res, ] - operands = Value[arg, ] + op_ty_results = IR.Type[res,] + operands = Value[arg,] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "llvm.fpext", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "llvm.fpext", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function fptosi(arg::Value; res::IR.Type, location=Location()) - op_ty_results = IR.Type[res, ] - operands = Value[arg, ] + op_ty_results = IR.Type[res,] + operands = Value[arg,] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "llvm.fptosi", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "llvm.fptosi", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function fptoui(arg::Value; res::IR.Type, location=Location()) - op_ty_results = IR.Type[res, ] - operands = Value[arg, ] + op_ty_results = IR.Type[res,] + operands = Value[arg,] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "llvm.fptoui", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "llvm.fptoui", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function fptrunc(arg::Value; res::IR.Type, location=Location()) - op_ty_results = IR.Type[res, ] - operands = Value[arg, ] + op_ty_results = IR.Type[res,] + operands = Value[arg,] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "llvm.fptrunc", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "llvm.fptrunc", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - -function frem(lhs::Value, rhs::Value; res=nothing::Union{Nothing, IR.Type}, fastmathFlags=nothing, location=Location()) +function frem( + lhs::Value, + rhs::Value; + res=nothing::Union{Nothing,IR.Type}, + fastmathFlags=nothing, + location=Location(), +) op_ty_results = IR.Type[] - operands = Value[lhs, rhs, ] + operands = Value[lhs, rhs] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(res) && push!(op_ty_results, res) - !isnothing(fastmathFlags) && push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) - - create_operation( - "llvm.frem", location; - operands, owned_regions, successors, attributes, + !isnothing(fastmathFlags) && + push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) + + return create_operation( + "llvm.frem", + location; + operands, + owned_regions, + successors, + attributes, results=(length(op_ty_results) == 0 ? nothing : op_ty_results), - result_inference=(length(op_ty_results) == 0 ? true : false) + result_inference=(length(op_ty_results) == 0 ? true : false), ) end - -function fsub(lhs::Value, rhs::Value; res=nothing::Union{Nothing, IR.Type}, fastmathFlags=nothing, location=Location()) +function fsub( + lhs::Value, + rhs::Value; + res=nothing::Union{Nothing,IR.Type}, + fastmathFlags=nothing, + location=Location(), +) op_ty_results = IR.Type[] - operands = Value[lhs, rhs, ] + operands = Value[lhs, rhs] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(res) && push!(op_ty_results, res) - !isnothing(fastmathFlags) && push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) - - create_operation( - "llvm.fsub", location; - operands, owned_regions, successors, attributes, + !isnothing(fastmathFlags) && + push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) + + return create_operation( + "llvm.fsub", + location; + operands, + owned_regions, + successors, + attributes, results=(length(op_ty_results) == 0 ? nothing : op_ty_results), - result_inference=(length(op_ty_results) == 0 ? true : false) + result_inference=(length(op_ty_results) == 0 ? true : false), ) end - function fence(; ordering, syncscope=nothing, location=Location()) op_ty_results = IR.Type[] operands = Value[] owned_regions = Region[] successors = Block[] - attributes = NamedAttribute[namedattribute("ordering", ordering), ] + attributes = NamedAttribute[namedattribute("ordering", ordering),] !isnothing(syncscope) && push!(attributes, namedattribute("syncscope", syncscope)) - - create_operation( - "llvm.fence", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "llvm.fence", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - -function freeze(val::Value; res=nothing::Union{Nothing, IR.Type}, location=Location()) +function freeze(val::Value; res=nothing::Union{Nothing,IR.Type}, location=Location()) op_ty_results = IR.Type[] - operands = Value[val, ] + operands = Value[val,] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(res) && push!(op_ty_results, res) - - create_operation( - "llvm.freeze", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "llvm.freeze", + location; + operands, + owned_regions, + successors, + attributes, results=(length(op_ty_results) == 0 ? nothing : op_ty_results), - result_inference=(length(op_ty_results) == 0 ? true : false) + result_inference=(length(op_ty_results) == 0 ? true : false), ) end @@ -733,19 +1014,34 @@ Examples: : (!llvm.ptr) -> !llvm.ptr, !llvm.struct<(i32, f32)> ``` """ -function getelementptr(base::Value, dynamicIndices::Vector{Value}; res::IR.Type, rawConstantIndices, elem_type, inbounds=nothing, location=Location()) - op_ty_results = IR.Type[res, ] - operands = Value[base, dynamicIndices..., ] - owned_regions = Region[] - successors = Block[] - attributes = NamedAttribute[namedattribute("rawConstantIndices", rawConstantIndices), namedattribute("elem_type", elem_type), ] +function getelementptr( + base::Value, + dynamicIndices::Vector{Value}; + res::IR.Type, + rawConstantIndices, + elem_type, + inbounds=nothing, + location=Location(), +) + op_ty_results = IR.Type[res,] + operands = Value[base, dynamicIndices...] + owned_regions = Region[] + successors = Block[] + attributes = NamedAttribute[ + namedattribute("rawConstantIndices", rawConstantIndices), + namedattribute("elem_type", elem_type), + ] !isnothing(inbounds) && push!(attributes, namedattribute("inbounds", inbounds)) - - create_operation( - "llvm.getelementptr", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "llvm.getelementptr", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end @@ -776,13 +1072,19 @@ function mlir_global_ctors(; ctors, priorities, location=Location()) operands = Value[] owned_regions = Region[] successors = Block[] - attributes = NamedAttribute[namedattribute("ctors", ctors), namedattribute("priorities", priorities), ] - - create_operation( - "llvm.mlir.global_ctors", location; - operands, owned_regions, successors, attributes, + attributes = NamedAttribute[ + namedattribute("ctors", ctors), namedattribute("priorities", priorities) + ] + + return create_operation( + "llvm.mlir.global_ctors", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end @@ -810,13 +1112,19 @@ function mlir_global_dtors(; dtors, priorities, location=Location()) operands = Value[] owned_regions = Region[] successors = Block[] - attributes = NamedAttribute[namedattribute("dtors", dtors), namedattribute("priorities", priorities), ] - - create_operation( - "llvm.mlir.global_dtors", location; - operands, owned_regions, successors, attributes, + attributes = NamedAttribute[ + namedattribute("dtors", dtors), namedattribute("priorities", priorities) + ] + + return create_operation( + "llvm.mlir.global_dtors", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end @@ -917,47 +1225,85 @@ Examples: llvm.mlir.global private constant @y(dense<1.0> : tensor<8xf32>) { alignment = 32 : i64 } : !llvm.array<8 x f32> ``` """ -function mlir_global(; global_type, constant=nothing, sym_name, linkage, dso_local=nothing, thread_local_=nothing, externally_initialized=nothing, value=nothing, alignment=nothing, addr_space=nothing, unnamed_addr=nothing, section=nothing, comdat=nothing, dbg_exprs=nothing, visibility_=nothing, initializer::Region, location=Location()) +function mlir_global(; + global_type, + constant=nothing, + sym_name, + linkage, + dso_local=nothing, + thread_local_=nothing, + externally_initialized=nothing, + value=nothing, + alignment=nothing, + addr_space=nothing, + unnamed_addr=nothing, + section=nothing, + comdat=nothing, + dbg_exprs=nothing, + visibility_=nothing, + initializer::Region, + location=Location(), +) op_ty_results = IR.Type[] operands = Value[] - owned_regions = Region[initializer, ] + owned_regions = Region[initializer,] successors = Block[] - attributes = NamedAttribute[namedattribute("global_type", global_type), namedattribute("sym_name", sym_name), namedattribute("linkage", linkage), ] + attributes = NamedAttribute[ + namedattribute("global_type", global_type), + namedattribute("sym_name", sym_name), + namedattribute("linkage", linkage), + ] !isnothing(constant) && push!(attributes, namedattribute("constant", constant)) !isnothing(dso_local) && push!(attributes, namedattribute("dso_local", dso_local)) - !isnothing(thread_local_) && push!(attributes, namedattribute("thread_local_", thread_local_)) - !isnothing(externally_initialized) && push!(attributes, namedattribute("externally_initialized", externally_initialized)) + !isnothing(thread_local_) && + push!(attributes, namedattribute("thread_local_", thread_local_)) + !isnothing(externally_initialized) && + push!(attributes, namedattribute("externally_initialized", externally_initialized)) !isnothing(value) && push!(attributes, namedattribute("value", value)) !isnothing(alignment) && push!(attributes, namedattribute("alignment", alignment)) !isnothing(addr_space) && push!(attributes, namedattribute("addr_space", addr_space)) - !isnothing(unnamed_addr) && push!(attributes, namedattribute("unnamed_addr", unnamed_addr)) + !isnothing(unnamed_addr) && + push!(attributes, namedattribute("unnamed_addr", unnamed_addr)) !isnothing(section) && push!(attributes, namedattribute("section", section)) !isnothing(comdat) && push!(attributes, namedattribute("comdat", comdat)) !isnothing(dbg_exprs) && push!(attributes, namedattribute("dbg_exprs", dbg_exprs)) !isnothing(visibility_) && push!(attributes, namedattribute("visibility_", visibility_)) - - create_operation( - "llvm.mlir.global", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "llvm.mlir.global", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - -function icmp(lhs::Value, rhs::Value; res=nothing::Union{Nothing, IR.Type}, predicate, location=Location()) +function icmp( + lhs::Value, + rhs::Value; + res=nothing::Union{Nothing,IR.Type}, + predicate, + location=Location(), +) op_ty_results = IR.Type[] - operands = Value[lhs, rhs, ] + operands = Value[lhs, rhs] owned_regions = Region[] successors = Block[] - attributes = NamedAttribute[namedattribute("predicate", predicate), ] + attributes = NamedAttribute[namedattribute("predicate", predicate),] !isnothing(res) && push!(op_ty_results, res) - - create_operation( - "llvm.icmp", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "llvm.icmp", + location; + operands, + owned_regions, + successors, + attributes, results=(length(op_ty_results) == 0 ? nothing : op_ty_results), - result_inference=(length(op_ty_results) == 0 ? true : false) + result_inference=(length(op_ty_results) == 0 ? true : false), ) end @@ -971,96 +1317,170 @@ written, or referenced. Attempting to define or reference any symbol or any global behavior is considered undefined behavior at this time. """ -function inline_asm(operands::Vector{Value}; res=nothing::Union{Nothing, IR.Type}, asm_string, constraints, has_side_effects=nothing, is_align_stack=nothing, asm_dialect=nothing, operand_attrs=nothing, location=Location()) +function inline_asm( + operands::Vector{Value}; + res=nothing::Union{Nothing,IR.Type}, + asm_string, + constraints, + has_side_effects=nothing, + is_align_stack=nothing, + asm_dialect=nothing, + operand_attrs=nothing, + location=Location(), +) op_ty_results = IR.Type[] - operands = Value[operands..., ] + operands = Value[operands...,] owned_regions = Region[] successors = Block[] - attributes = NamedAttribute[namedattribute("asm_string", asm_string), namedattribute("constraints", constraints), ] + attributes = NamedAttribute[ + namedattribute("asm_string", asm_string), namedattribute("constraints", constraints) + ] !isnothing(res) && push!(op_ty_results, res) - !isnothing(has_side_effects) && push!(attributes, namedattribute("has_side_effects", has_side_effects)) - !isnothing(is_align_stack) && push!(attributes, namedattribute("is_align_stack", is_align_stack)) + !isnothing(has_side_effects) && + push!(attributes, namedattribute("has_side_effects", has_side_effects)) + !isnothing(is_align_stack) && + push!(attributes, namedattribute("is_align_stack", is_align_stack)) !isnothing(asm_dialect) && push!(attributes, namedattribute("asm_dialect", asm_dialect)) - !isnothing(operand_attrs) && push!(attributes, namedattribute("operand_attrs", operand_attrs)) - - create_operation( - "llvm.inline_asm", location; - operands, owned_regions, successors, attributes, + !isnothing(operand_attrs) && + push!(attributes, namedattribute("operand_attrs", operand_attrs)) + + return create_operation( + "llvm.inline_asm", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - -function insertelement(vector::Value, value::Value, position::Value; res=nothing::Union{Nothing, IR.Type}, location=Location()) +function insertelement( + vector::Value, + value::Value, + position::Value; + res=nothing::Union{Nothing,IR.Type}, + location=Location(), +) op_ty_results = IR.Type[] - operands = Value[vector, value, position, ] + operands = Value[vector, value, position] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(res) && push!(op_ty_results, res) - - create_operation( - "llvm.insertelement", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "llvm.insertelement", + location; + operands, + owned_regions, + successors, + attributes, results=(length(op_ty_results) == 0 ? nothing : op_ty_results), - result_inference=(length(op_ty_results) == 0 ? true : false) + result_inference=(length(op_ty_results) == 0 ? true : false), ) end - -function insertvalue(container::Value, value::Value; res=nothing::Union{Nothing, IR.Type}, position, location=Location()) +function insertvalue( + container::Value, + value::Value; + res=nothing::Union{Nothing,IR.Type}, + position, + location=Location(), +) op_ty_results = IR.Type[] - operands = Value[container, value, ] + operands = Value[container, value] owned_regions = Region[] successors = Block[] - attributes = NamedAttribute[namedattribute("position", position), ] + attributes = NamedAttribute[namedattribute("position", position),] !isnothing(res) && push!(op_ty_results, res) - - create_operation( - "llvm.insertvalue", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "llvm.insertvalue", + location; + operands, + owned_regions, + successors, + attributes, results=(length(op_ty_results) == 0 ? nothing : op_ty_results), - result_inference=(length(op_ty_results) == 0 ? true : false) + result_inference=(length(op_ty_results) == 0 ? true : false), ) end - function inttoptr(arg::Value; res::IR.Type, location=Location()) - op_ty_results = IR.Type[res, ] - operands = Value[arg, ] + op_ty_results = IR.Type[res,] + operands = Value[arg,] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "llvm.inttoptr", location; - operands, owned_regions, successors, attributes, - results=op_ty_results, - result_inference=false - ) -end - -function invoke(callee_operands::Vector{Value}, normalDestOperands::Vector{Value}, unwindDestOperands::Vector{Value}, op_bundle_operands::Vector{Value}; result=nothing::Union{Nothing, IR.Type}, var_callee_type=nothing, callee=nothing, branch_weights=nothing, CConv=nothing, op_bundle_sizes, op_bundle_tags=nothing, normalDest::Block, unwindDest::Block, location=Location()) + return create_operation( + "llvm.inttoptr", + location; + operands, + owned_regions, + successors, + attributes, + results=op_ty_results, + result_inference=false, + ) +end + +function invoke( + callee_operands::Vector{Value}, + normalDestOperands::Vector{Value}, + unwindDestOperands::Vector{Value}, + op_bundle_operands::Vector{Value}; + result=nothing::Union{Nothing,IR.Type}, + var_callee_type=nothing, + callee=nothing, + branch_weights=nothing, + CConv=nothing, + op_bundle_sizes, + op_bundle_tags=nothing, + normalDest::Block, + unwindDest::Block, + location=Location(), +) op_ty_results = IR.Type[] - operands = Value[callee_operands..., normalDestOperands..., unwindDestOperands..., op_bundle_operands..., ] - owned_regions = Region[] - successors = Block[normalDest, unwindDest, ] - attributes = NamedAttribute[namedattribute("op_bundle_sizes", op_bundle_sizes), ] - push!(attributes, operandsegmentsizes([length(callee_operands), length(normalDestOperands), length(unwindDestOperands), length(op_bundle_operands), ])) + operands = Value[ + callee_operands..., + normalDestOperands..., + unwindDestOperands..., + op_bundle_operands..., + ] + owned_regions = Region[] + successors = Block[normalDest, unwindDest] + attributes = NamedAttribute[namedattribute("op_bundle_sizes", op_bundle_sizes),] + push!( + attributes, + operandsegmentsizes([ + length(callee_operands), + length(normalDestOperands), + length(unwindDestOperands), + length(op_bundle_operands), + ]), + ) !isnothing(result) && push!(op_ty_results, result) - !isnothing(var_callee_type) && push!(attributes, namedattribute("var_callee_type", var_callee_type)) + !isnothing(var_callee_type) && + push!(attributes, namedattribute("var_callee_type", var_callee_type)) !isnothing(callee) && push!(attributes, namedattribute("callee", callee)) - !isnothing(branch_weights) && push!(attributes, namedattribute("branch_weights", branch_weights)) + !isnothing(branch_weights) && + push!(attributes, namedattribute("branch_weights", branch_weights)) !isnothing(CConv) && push!(attributes, namedattribute("CConv", CConv)) - !isnothing(op_bundle_tags) && push!(attributes, namedattribute("op_bundle_tags", op_bundle_tags)) - - create_operation( - "llvm.invoke", location; - operands, owned_regions, successors, attributes, + !isnothing(op_bundle_tags) && + push!(attributes, namedattribute("op_bundle_tags", op_bundle_tags)) + + return create_operation( + "llvm.invoke", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end @@ -1093,100 +1513,202 @@ llvm.func internal @internal_func() { } ``` """ -function func(; sym_name, sym_visibility=nothing, function_type, linkage=nothing, dso_local=nothing, CConv=nothing, comdat=nothing, convergent=nothing, personality=nothing, garbageCollector=nothing, passthrough=nothing, arg_attrs=nothing, res_attrs=nothing, function_entry_count=nothing, memory_effects=nothing, visibility_=nothing, arm_streaming=nothing, arm_locally_streaming=nothing, arm_streaming_compatible=nothing, arm_new_za=nothing, arm_in_za=nothing, arm_out_za=nothing, arm_inout_za=nothing, arm_preserves_za=nothing, section=nothing, unnamed_addr=nothing, alignment=nothing, vscale_range=nothing, frame_pointer=nothing, target_cpu=nothing, tune_cpu=nothing, target_features=nothing, unsafe_fp_math=nothing, no_infs_fp_math=nothing, no_nans_fp_math=nothing, approx_func_fp_math=nothing, no_signed_zeros_fp_math=nothing, denormal_fp_math=nothing, denormal_fp_math_f32=nothing, fp_contract=nothing, no_inline=nothing, always_inline=nothing, no_unwind=nothing, will_return=nothing, optimize_none=nothing, vec_type_hint=nothing, work_group_size_hint=nothing, reqd_work_group_size=nothing, intel_reqd_sub_group_size=nothing, body::Region, location=Location()) +function func(; + sym_name, + sym_visibility=nothing, + function_type, + linkage=nothing, + dso_local=nothing, + CConv=nothing, + comdat=nothing, + convergent=nothing, + personality=nothing, + garbageCollector=nothing, + passthrough=nothing, + arg_attrs=nothing, + res_attrs=nothing, + function_entry_count=nothing, + memory_effects=nothing, + visibility_=nothing, + arm_streaming=nothing, + arm_locally_streaming=nothing, + arm_streaming_compatible=nothing, + arm_new_za=nothing, + arm_in_za=nothing, + arm_out_za=nothing, + arm_inout_za=nothing, + arm_preserves_za=nothing, + section=nothing, + unnamed_addr=nothing, + alignment=nothing, + vscale_range=nothing, + frame_pointer=nothing, + target_cpu=nothing, + tune_cpu=nothing, + target_features=nothing, + unsafe_fp_math=nothing, + no_infs_fp_math=nothing, + no_nans_fp_math=nothing, + approx_func_fp_math=nothing, + no_signed_zeros_fp_math=nothing, + denormal_fp_math=nothing, + denormal_fp_math_f32=nothing, + fp_contract=nothing, + no_inline=nothing, + always_inline=nothing, + no_unwind=nothing, + will_return=nothing, + optimize_none=nothing, + vec_type_hint=nothing, + work_group_size_hint=nothing, + reqd_work_group_size=nothing, + intel_reqd_sub_group_size=nothing, + body::Region, + location=Location(), +) op_ty_results = IR.Type[] operands = Value[] - owned_regions = Region[body, ] + owned_regions = Region[body,] successors = Block[] - attributes = NamedAttribute[namedattribute("sym_name", sym_name), namedattribute("function_type", function_type), ] - !isnothing(sym_visibility) && push!(attributes, namedattribute("sym_visibility", sym_visibility)) + attributes = NamedAttribute[ + namedattribute("sym_name", sym_name), namedattribute("function_type", function_type) + ] + !isnothing(sym_visibility) && + push!(attributes, namedattribute("sym_visibility", sym_visibility)) !isnothing(linkage) && push!(attributes, namedattribute("linkage", linkage)) !isnothing(dso_local) && push!(attributes, namedattribute("dso_local", dso_local)) !isnothing(CConv) && push!(attributes, namedattribute("CConv", CConv)) !isnothing(comdat) && push!(attributes, namedattribute("comdat", comdat)) !isnothing(convergent) && push!(attributes, namedattribute("convergent", convergent)) !isnothing(personality) && push!(attributes, namedattribute("personality", personality)) - !isnothing(garbageCollector) && push!(attributes, namedattribute("garbageCollector", garbageCollector)) + !isnothing(garbageCollector) && + push!(attributes, namedattribute("garbageCollector", garbageCollector)) !isnothing(passthrough) && push!(attributes, namedattribute("passthrough", passthrough)) !isnothing(arg_attrs) && push!(attributes, namedattribute("arg_attrs", arg_attrs)) !isnothing(res_attrs) && push!(attributes, namedattribute("res_attrs", res_attrs)) - !isnothing(function_entry_count) && push!(attributes, namedattribute("function_entry_count", function_entry_count)) - !isnothing(memory_effects) && push!(attributes, namedattribute("memory_effects", memory_effects)) + !isnothing(function_entry_count) && + push!(attributes, namedattribute("function_entry_count", function_entry_count)) + !isnothing(memory_effects) && + push!(attributes, namedattribute("memory_effects", memory_effects)) !isnothing(visibility_) && push!(attributes, namedattribute("visibility_", visibility_)) - !isnothing(arm_streaming) && push!(attributes, namedattribute("arm_streaming", arm_streaming)) - !isnothing(arm_locally_streaming) && push!(attributes, namedattribute("arm_locally_streaming", arm_locally_streaming)) - !isnothing(arm_streaming_compatible) && push!(attributes, namedattribute("arm_streaming_compatible", arm_streaming_compatible)) + !isnothing(arm_streaming) && + push!(attributes, namedattribute("arm_streaming", arm_streaming)) + !isnothing(arm_locally_streaming) && + push!(attributes, namedattribute("arm_locally_streaming", arm_locally_streaming)) + !isnothing(arm_streaming_compatible) && push!( + attributes, namedattribute("arm_streaming_compatible", arm_streaming_compatible) + ) !isnothing(arm_new_za) && push!(attributes, namedattribute("arm_new_za", arm_new_za)) !isnothing(arm_in_za) && push!(attributes, namedattribute("arm_in_za", arm_in_za)) !isnothing(arm_out_za) && push!(attributes, namedattribute("arm_out_za", arm_out_za)) - !isnothing(arm_inout_za) && push!(attributes, namedattribute("arm_inout_za", arm_inout_za)) - !isnothing(arm_preserves_za) && push!(attributes, namedattribute("arm_preserves_za", arm_preserves_za)) + !isnothing(arm_inout_za) && + push!(attributes, namedattribute("arm_inout_za", arm_inout_za)) + !isnothing(arm_preserves_za) && + push!(attributes, namedattribute("arm_preserves_za", arm_preserves_za)) !isnothing(section) && push!(attributes, namedattribute("section", section)) - !isnothing(unnamed_addr) && push!(attributes, namedattribute("unnamed_addr", unnamed_addr)) + !isnothing(unnamed_addr) && + push!(attributes, namedattribute("unnamed_addr", unnamed_addr)) !isnothing(alignment) && push!(attributes, namedattribute("alignment", alignment)) - !isnothing(vscale_range) && push!(attributes, namedattribute("vscale_range", vscale_range)) - !isnothing(frame_pointer) && push!(attributes, namedattribute("frame_pointer", frame_pointer)) + !isnothing(vscale_range) && + push!(attributes, namedattribute("vscale_range", vscale_range)) + !isnothing(frame_pointer) && + push!(attributes, namedattribute("frame_pointer", frame_pointer)) !isnothing(target_cpu) && push!(attributes, namedattribute("target_cpu", target_cpu)) !isnothing(tune_cpu) && push!(attributes, namedattribute("tune_cpu", tune_cpu)) - !isnothing(target_features) && push!(attributes, namedattribute("target_features", target_features)) - !isnothing(unsafe_fp_math) && push!(attributes, namedattribute("unsafe_fp_math", unsafe_fp_math)) - !isnothing(no_infs_fp_math) && push!(attributes, namedattribute("no_infs_fp_math", no_infs_fp_math)) - !isnothing(no_nans_fp_math) && push!(attributes, namedattribute("no_nans_fp_math", no_nans_fp_math)) - !isnothing(approx_func_fp_math) && push!(attributes, namedattribute("approx_func_fp_math", approx_func_fp_math)) - !isnothing(no_signed_zeros_fp_math) && push!(attributes, namedattribute("no_signed_zeros_fp_math", no_signed_zeros_fp_math)) - !isnothing(denormal_fp_math) && push!(attributes, namedattribute("denormal_fp_math", denormal_fp_math)) - !isnothing(denormal_fp_math_f32) && push!(attributes, namedattribute("denormal_fp_math_f32", denormal_fp_math_f32)) + !isnothing(target_features) && + push!(attributes, namedattribute("target_features", target_features)) + !isnothing(unsafe_fp_math) && + push!(attributes, namedattribute("unsafe_fp_math", unsafe_fp_math)) + !isnothing(no_infs_fp_math) && + push!(attributes, namedattribute("no_infs_fp_math", no_infs_fp_math)) + !isnothing(no_nans_fp_math) && + push!(attributes, namedattribute("no_nans_fp_math", no_nans_fp_math)) + !isnothing(approx_func_fp_math) && + push!(attributes, namedattribute("approx_func_fp_math", approx_func_fp_math)) + !isnothing(no_signed_zeros_fp_math) && push!( + attributes, namedattribute("no_signed_zeros_fp_math", no_signed_zeros_fp_math) + ) + !isnothing(denormal_fp_math) && + push!(attributes, namedattribute("denormal_fp_math", denormal_fp_math)) + !isnothing(denormal_fp_math_f32) && + push!(attributes, namedattribute("denormal_fp_math_f32", denormal_fp_math_f32)) !isnothing(fp_contract) && push!(attributes, namedattribute("fp_contract", fp_contract)) !isnothing(no_inline) && push!(attributes, namedattribute("no_inline", no_inline)) - !isnothing(always_inline) && push!(attributes, namedattribute("always_inline", always_inline)) + !isnothing(always_inline) && + push!(attributes, namedattribute("always_inline", always_inline)) !isnothing(no_unwind) && push!(attributes, namedattribute("no_unwind", no_unwind)) !isnothing(will_return) && push!(attributes, namedattribute("will_return", will_return)) - !isnothing(optimize_none) && push!(attributes, namedattribute("optimize_none", optimize_none)) - !isnothing(vec_type_hint) && push!(attributes, namedattribute("vec_type_hint", vec_type_hint)) - !isnothing(work_group_size_hint) && push!(attributes, namedattribute("work_group_size_hint", work_group_size_hint)) - !isnothing(reqd_work_group_size) && push!(attributes, namedattribute("reqd_work_group_size", reqd_work_group_size)) - !isnothing(intel_reqd_sub_group_size) && push!(attributes, namedattribute("intel_reqd_sub_group_size", intel_reqd_sub_group_size)) - - create_operation( - "llvm.func", location; - operands, owned_regions, successors, attributes, + !isnothing(optimize_none) && + push!(attributes, namedattribute("optimize_none", optimize_none)) + !isnothing(vec_type_hint) && + push!(attributes, namedattribute("vec_type_hint", vec_type_hint)) + !isnothing(work_group_size_hint) && + push!(attributes, namedattribute("work_group_size_hint", work_group_size_hint)) + !isnothing(reqd_work_group_size) && + push!(attributes, namedattribute("reqd_work_group_size", reqd_work_group_size)) + !isnothing(intel_reqd_sub_group_size) && push!( + attributes, + namedattribute("intel_reqd_sub_group_size", intel_reqd_sub_group_size), + ) + + return create_operation( + "llvm.func", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - -function lshr(lhs::Value, rhs::Value; res=nothing::Union{Nothing, IR.Type}, isExact=nothing, location=Location()) +function lshr( + lhs::Value, + rhs::Value; + res=nothing::Union{Nothing,IR.Type}, + isExact=nothing, + location=Location(), +) op_ty_results = IR.Type[] - operands = Value[lhs, rhs, ] + operands = Value[lhs, rhs] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(res) && push!(op_ty_results, res) !isnothing(isExact) && push!(attributes, namedattribute("isExact", isExact)) - - create_operation( - "llvm.lshr", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "llvm.lshr", + location; + operands, + owned_regions, + successors, + attributes, results=(length(op_ty_results) == 0 ? nothing : op_ty_results), - result_inference=(length(op_ty_results) == 0 ? true : false) + result_inference=(length(op_ty_results) == 0 ? true : false), ) end - -function landingpad(operand_0::Vector{Value}; res::IR.Type, cleanup=nothing, location=Location()) - op_ty_results = IR.Type[res, ] - operands = Value[operand_0..., ] +function landingpad( + operand_0::Vector{Value}; res::IR.Type, cleanup=nothing, location=Location() +) + op_ty_results = IR.Type[res,] + operands = Value[operand_0...,] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(cleanup) && push!(attributes, namedattribute("cleanup", cleanup)) - - create_operation( - "llvm.landingpad", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "llvm.landingpad", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end @@ -1211,13 +1733,17 @@ function linker_options(; options, location=Location()) operands = Value[] owned_regions = Region[] successors = Block[] - attributes = NamedAttribute[namedattribute("options", options), ] - - create_operation( - "llvm.linker_options", location; - operands, owned_regions, successors, attributes, + attributes = NamedAttribute[namedattribute("options", options),] + + return create_operation( + "llvm.linker_options", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end @@ -1247,9 +1773,24 @@ Examples: See the following link for more details: https://llvm.org/docs/LangRef.html#load-instruction """ -function load(addr::Value; res::IR.Type, alignment=nothing, volatile_=nothing, nontemporal=nothing, invariant=nothing, invariantGroup=nothing, ordering=nothing, syncscope=nothing, access_groups=nothing, alias_scopes=nothing, noalias_scopes=nothing, tbaa=nothing, location=Location()) - op_ty_results = IR.Type[res, ] - operands = Value[addr, ] +function load( + addr::Value; + res::IR.Type, + alignment=nothing, + volatile_=nothing, + nontemporal=nothing, + invariant=nothing, + invariantGroup=nothing, + ordering=nothing, + syncscope=nothing, + access_groups=nothing, + alias_scopes=nothing, + noalias_scopes=nothing, + tbaa=nothing, + location=Location(), +) + op_ty_results = IR.Type[res,] + operands = Value[addr,] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] @@ -1257,36 +1798,49 @@ function load(addr::Value; res::IR.Type, alignment=nothing, volatile_=nothing, n !isnothing(volatile_) && push!(attributes, namedattribute("volatile_", volatile_)) !isnothing(nontemporal) && push!(attributes, namedattribute("nontemporal", nontemporal)) !isnothing(invariant) && push!(attributes, namedattribute("invariant", invariant)) - !isnothing(invariantGroup) && push!(attributes, namedattribute("invariantGroup", invariantGroup)) + !isnothing(invariantGroup) && + push!(attributes, namedattribute("invariantGroup", invariantGroup)) !isnothing(ordering) && push!(attributes, namedattribute("ordering", ordering)) !isnothing(syncscope) && push!(attributes, namedattribute("syncscope", syncscope)) - !isnothing(access_groups) && push!(attributes, namedattribute("access_groups", access_groups)) - !isnothing(alias_scopes) && push!(attributes, namedattribute("alias_scopes", alias_scopes)) - !isnothing(noalias_scopes) && push!(attributes, namedattribute("noalias_scopes", noalias_scopes)) + !isnothing(access_groups) && + push!(attributes, namedattribute("access_groups", access_groups)) + !isnothing(alias_scopes) && + push!(attributes, namedattribute("alias_scopes", alias_scopes)) + !isnothing(noalias_scopes) && + push!(attributes, namedattribute("noalias_scopes", noalias_scopes)) !isnothing(tbaa) && push!(attributes, namedattribute("tbaa", tbaa)) - - create_operation( - "llvm.load", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "llvm.load", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - -function mul(lhs::Value, rhs::Value; res=nothing::Union{Nothing, IR.Type}, location=Location()) +function mul( + lhs::Value, rhs::Value; res=nothing::Union{Nothing,IR.Type}, location=Location() +) op_ty_results = IR.Type[] - operands = Value[lhs, rhs, ] + operands = Value[lhs, rhs] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(res) && push!(op_ty_results, res) - - create_operation( - "llvm.mul", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "llvm.mul", + location; + operands, + owned_regions, + successors, + attributes, results=(length(op_ty_results) == 0 ? nothing : op_ty_results), - result_inference=(length(op_ty_results) == 0 ? true : false) + result_inference=(length(op_ty_results) == 0 ? true : false), ) end @@ -1304,37 +1858,50 @@ Examples: %0 = llvm.mlir.none : !llvm.token ``` """ -function mlir_none(; res=nothing::Union{Nothing, IR.Type}, location=Location()) +function mlir_none(; res=nothing::Union{Nothing,IR.Type}, location=Location()) op_ty_results = IR.Type[] operands = Value[] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(res) && push!(op_ty_results, res) - - create_operation( - "llvm.mlir.none", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "llvm.mlir.none", + location; + operands, + owned_regions, + successors, + attributes, results=(length(op_ty_results) == 0 ? nothing : op_ty_results), - result_inference=(length(op_ty_results) == 0 ? true : false) + result_inference=(length(op_ty_results) == 0 ? true : false), ) end - -function or(lhs::Value, rhs::Value; res=nothing::Union{Nothing, IR.Type}, isDisjoint=nothing, location=Location()) +function or( + lhs::Value, + rhs::Value; + res=nothing::Union{Nothing,IR.Type}, + isDisjoint=nothing, + location=Location(), +) op_ty_results = IR.Type[] - operands = Value[lhs, rhs, ] + operands = Value[lhs, rhs] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(res) && push!(op_ty_results, res) !isnothing(isDisjoint) && push!(attributes, namedattribute("isDisjoint", isDisjoint)) - - create_operation( - "llvm.or", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "llvm.or", + location; + operands, + owned_regions, + successors, + attributes, results=(length(op_ty_results) == 0 ? nothing : op_ty_results), - result_inference=(length(op_ty_results) == 0 ? true : false) + result_inference=(length(op_ty_results) == 0 ? true : false), ) end @@ -1355,184 +1922,236 @@ IR dialect type. ``` """ function mlir_poison(; res::IR.Type, location=Location()) - op_ty_results = IR.Type[res, ] + op_ty_results = IR.Type[res,] operands = Value[] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "llvm.mlir.poison", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "llvm.mlir.poison", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function ptrtoint(arg::Value; res::IR.Type, location=Location()) - op_ty_results = IR.Type[res, ] - operands = Value[arg, ] + op_ty_results = IR.Type[res,] + operands = Value[arg,] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "llvm.ptrtoint", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "llvm.ptrtoint", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function resume(value::Value; location=Location()) op_ty_results = IR.Type[] - operands = Value[value, ] + operands = Value[value,] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "llvm.resume", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "llvm.resume", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - -function return_(arg=nothing::Union{Nothing, Value}; location=Location()) +function return_(arg=nothing::Union{Nothing,Value}; location=Location()) op_ty_results = IR.Type[] operands = Value[] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(arg) && push!(operands, arg) - - create_operation( - "llvm.return", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "llvm.return", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - -function sdiv(lhs::Value, rhs::Value; res=nothing::Union{Nothing, IR.Type}, isExact=nothing, location=Location()) +function sdiv( + lhs::Value, + rhs::Value; + res=nothing::Union{Nothing,IR.Type}, + isExact=nothing, + location=Location(), +) op_ty_results = IR.Type[] - operands = Value[lhs, rhs, ] + operands = Value[lhs, rhs] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(res) && push!(op_ty_results, res) !isnothing(isExact) && push!(attributes, namedattribute("isExact", isExact)) - - create_operation( - "llvm.sdiv", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "llvm.sdiv", + location; + operands, + owned_regions, + successors, + attributes, results=(length(op_ty_results) == 0 ? nothing : op_ty_results), - result_inference=(length(op_ty_results) == 0 ? true : false) + result_inference=(length(op_ty_results) == 0 ? true : false), ) end - function sext(arg::Value; res::IR.Type, location=Location()) - op_ty_results = IR.Type[res, ] - operands = Value[arg, ] + op_ty_results = IR.Type[res,] + operands = Value[arg,] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "llvm.sext", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "llvm.sext", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function sitofp(arg::Value; res::IR.Type, location=Location()) - op_ty_results = IR.Type[res, ] - operands = Value[arg, ] + op_ty_results = IR.Type[res,] + operands = Value[arg,] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "llvm.sitofp", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "llvm.sitofp", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - -function srem(lhs::Value, rhs::Value; res=nothing::Union{Nothing, IR.Type}, location=Location()) +function srem( + lhs::Value, rhs::Value; res=nothing::Union{Nothing,IR.Type}, location=Location() +) op_ty_results = IR.Type[] - operands = Value[lhs, rhs, ] + operands = Value[lhs, rhs] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(res) && push!(op_ty_results, res) - - create_operation( - "llvm.srem", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "llvm.srem", + location; + operands, + owned_regions, + successors, + attributes, results=(length(op_ty_results) == 0 ? nothing : op_ty_results), - result_inference=(length(op_ty_results) == 0 ? true : false) + result_inference=(length(op_ty_results) == 0 ? true : false), ) end - -function select(condition::Value, trueValue::Value, falseValue::Value; res=nothing::Union{Nothing, IR.Type}, fastmathFlags=nothing, location=Location()) +function select( + condition::Value, + trueValue::Value, + falseValue::Value; + res=nothing::Union{Nothing,IR.Type}, + fastmathFlags=nothing, + location=Location(), +) op_ty_results = IR.Type[] - operands = Value[condition, trueValue, falseValue, ] + operands = Value[condition, trueValue, falseValue] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(res) && push!(op_ty_results, res) - !isnothing(fastmathFlags) && push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) - - create_operation( - "llvm.select", location; - operands, owned_regions, successors, attributes, + !isnothing(fastmathFlags) && + push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) + + return create_operation( + "llvm.select", + location; + operands, + owned_regions, + successors, + attributes, results=(length(op_ty_results) == 0 ? nothing : op_ty_results), - result_inference=(length(op_ty_results) == 0 ? true : false) + result_inference=(length(op_ty_results) == 0 ? true : false), ) end - -function shl(lhs::Value, rhs::Value; res=nothing::Union{Nothing, IR.Type}, location=Location()) +function shl( + lhs::Value, rhs::Value; res=nothing::Union{Nothing,IR.Type}, location=Location() +) op_ty_results = IR.Type[] - operands = Value[lhs, rhs, ] + operands = Value[lhs, rhs] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(res) && push!(op_ty_results, res) - - create_operation( - "llvm.shl", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "llvm.shl", + location; + operands, + owned_regions, + successors, + attributes, results=(length(op_ty_results) == 0 ? nothing : op_ty_results), - result_inference=(length(op_ty_results) == 0 ? true : false) + result_inference=(length(op_ty_results) == 0 ? true : false), ) end - function shufflevector(v1::Value, v2::Value; res::IR.Type, mask, location=Location()) - op_ty_results = IR.Type[res, ] - operands = Value[v1, v2, ] + op_ty_results = IR.Type[res,] + operands = Value[v1, v2] owned_regions = Region[] successors = Block[] - attributes = NamedAttribute[namedattribute("mask", mask), ] - - create_operation( - "llvm.shufflevector", location; - operands, owned_regions, successors, attributes, + attributes = NamedAttribute[namedattribute("mask", mask),] + + return create_operation( + "llvm.shufflevector", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end @@ -1562,132 +2181,197 @@ llvm.store %val, %ptr atomic monotonic {alignment = 8 : i64} See the following link for more details: https://llvm.org/docs/LangRef.html#store-instruction """ -function store(value::Value, addr::Value; alignment=nothing, volatile_=nothing, nontemporal=nothing, invariantGroup=nothing, ordering=nothing, syncscope=nothing, access_groups=nothing, alias_scopes=nothing, noalias_scopes=nothing, tbaa=nothing, location=Location()) +function store( + value::Value, + addr::Value; + alignment=nothing, + volatile_=nothing, + nontemporal=nothing, + invariantGroup=nothing, + ordering=nothing, + syncscope=nothing, + access_groups=nothing, + alias_scopes=nothing, + noalias_scopes=nothing, + tbaa=nothing, + location=Location(), +) op_ty_results = IR.Type[] - operands = Value[value, addr, ] + operands = Value[value, addr] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(alignment) && push!(attributes, namedattribute("alignment", alignment)) !isnothing(volatile_) && push!(attributes, namedattribute("volatile_", volatile_)) !isnothing(nontemporal) && push!(attributes, namedattribute("nontemporal", nontemporal)) - !isnothing(invariantGroup) && push!(attributes, namedattribute("invariantGroup", invariantGroup)) + !isnothing(invariantGroup) && + push!(attributes, namedattribute("invariantGroup", invariantGroup)) !isnothing(ordering) && push!(attributes, namedattribute("ordering", ordering)) !isnothing(syncscope) && push!(attributes, namedattribute("syncscope", syncscope)) - !isnothing(access_groups) && push!(attributes, namedattribute("access_groups", access_groups)) - !isnothing(alias_scopes) && push!(attributes, namedattribute("alias_scopes", alias_scopes)) - !isnothing(noalias_scopes) && push!(attributes, namedattribute("noalias_scopes", noalias_scopes)) + !isnothing(access_groups) && + push!(attributes, namedattribute("access_groups", access_groups)) + !isnothing(alias_scopes) && + push!(attributes, namedattribute("alias_scopes", alias_scopes)) + !isnothing(noalias_scopes) && + push!(attributes, namedattribute("noalias_scopes", noalias_scopes)) !isnothing(tbaa) && push!(attributes, namedattribute("tbaa", tbaa)) - - create_operation( - "llvm.store", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "llvm.store", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - -function sub(lhs::Value, rhs::Value; res=nothing::Union{Nothing, IR.Type}, location=Location()) +function sub( + lhs::Value, rhs::Value; res=nothing::Union{Nothing,IR.Type}, location=Location() +) op_ty_results = IR.Type[] - operands = Value[lhs, rhs, ] + operands = Value[lhs, rhs] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(res) && push!(op_ty_results, res) - - create_operation( - "llvm.sub", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "llvm.sub", + location; + operands, + owned_regions, + successors, + attributes, results=(length(op_ty_results) == 0 ? nothing : op_ty_results), - result_inference=(length(op_ty_results) == 0 ? true : false) + result_inference=(length(op_ty_results) == 0 ? true : false), ) end - -function switch(value::Value, defaultOperands::Vector{Value}, caseOperands::Vector{Value}; case_values=nothing, case_operand_segments, branch_weights=nothing, defaultDestination::Block, caseDestinations::Vector{Block}, location=Location()) +function switch( + value::Value, + defaultOperands::Vector{Value}, + caseOperands::Vector{Value}; + case_values=nothing, + case_operand_segments, + branch_weights=nothing, + defaultDestination::Block, + caseDestinations::Vector{Block}, + location=Location(), +) op_ty_results = IR.Type[] - operands = Value[value, defaultOperands..., caseOperands..., ] + operands = Value[value, defaultOperands..., caseOperands...] owned_regions = Region[] - successors = Block[defaultDestination, caseDestinations..., ] - attributes = NamedAttribute[namedattribute("case_operand_segments", case_operand_segments), ] - push!(attributes, operandsegmentsizes([1, length(defaultOperands), length(caseOperands), ])) + successors = Block[defaultDestination, caseDestinations...] + attributes = NamedAttribute[namedattribute( + "case_operand_segments", case_operand_segments + ),] + push!( + attributes, operandsegmentsizes([1, length(defaultOperands), length(caseOperands)]) + ) !isnothing(case_values) && push!(attributes, namedattribute("case_values", case_values)) - !isnothing(branch_weights) && push!(attributes, namedattribute("branch_weights", branch_weights)) - - create_operation( - "llvm.switch", location; - operands, owned_regions, successors, attributes, + !isnothing(branch_weights) && + push!(attributes, namedattribute("branch_weights", branch_weights)) + + return create_operation( + "llvm.switch", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function trunc(arg::Value; res::IR.Type, location=Location()) - op_ty_results = IR.Type[res, ] - operands = Value[arg, ] + op_ty_results = IR.Type[res,] + operands = Value[arg,] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "llvm.trunc", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "llvm.trunc", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - -function udiv(lhs::Value, rhs::Value; res=nothing::Union{Nothing, IR.Type}, isExact=nothing, location=Location()) +function udiv( + lhs::Value, + rhs::Value; + res=nothing::Union{Nothing,IR.Type}, + isExact=nothing, + location=Location(), +) op_ty_results = IR.Type[] - operands = Value[lhs, rhs, ] + operands = Value[lhs, rhs] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(res) && push!(op_ty_results, res) !isnothing(isExact) && push!(attributes, namedattribute("isExact", isExact)) - - create_operation( - "llvm.udiv", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "llvm.udiv", + location; + operands, + owned_regions, + successors, + attributes, results=(length(op_ty_results) == 0 ? nothing : op_ty_results), - result_inference=(length(op_ty_results) == 0 ? true : false) + result_inference=(length(op_ty_results) == 0 ? true : false), ) end - function uitofp(arg::Value; res::IR.Type, nonNeg=nothing, location=Location()) - op_ty_results = IR.Type[res, ] - operands = Value[arg, ] + op_ty_results = IR.Type[res,] + operands = Value[arg,] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(nonNeg) && push!(attributes, namedattribute("nonNeg", nonNeg)) - - create_operation( - "llvm.uitofp", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "llvm.uitofp", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - -function urem(lhs::Value, rhs::Value; res=nothing::Union{Nothing, IR.Type}, location=Location()) +function urem( + lhs::Value, rhs::Value; res=nothing::Union{Nothing,IR.Type}, location=Location() +) op_ty_results = IR.Type[] - operands = Value[lhs, rhs, ] + operands = Value[lhs, rhs] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(res) && push!(op_ty_results, res) - - create_operation( - "llvm.urem", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "llvm.urem", + location; + operands, + owned_regions, + successors, + attributes, results=(length(op_ty_results) == 0 ? nothing : op_ty_results), - result_inference=(length(op_ty_results) == 0 ? true : false) + result_inference=(length(op_ty_results) == 0 ? true : false), ) end @@ -1707,83 +2391,101 @@ IR dialect type. ``` """ function mlir_undef(; res::IR.Type, location=Location()) - op_ty_results = IR.Type[res, ] + op_ty_results = IR.Type[res,] operands = Value[] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "llvm.mlir.undef", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "llvm.mlir.undef", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function unreachable(; location=Location()) op_ty_results = IR.Type[] operands = Value[] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "llvm.unreachable", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "llvm.unreachable", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function va_arg(arg::Value; res::IR.Type, location=Location()) - op_ty_results = IR.Type[res, ] - operands = Value[arg, ] + op_ty_results = IR.Type[res,] + operands = Value[arg,] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "llvm.va_arg", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "llvm.va_arg", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - -function xor(lhs::Value, rhs::Value; res=nothing::Union{Nothing, IR.Type}, location=Location()) +function xor( + lhs::Value, rhs::Value; res=nothing::Union{Nothing,IR.Type}, location=Location() +) op_ty_results = IR.Type[] - operands = Value[lhs, rhs, ] + operands = Value[lhs, rhs] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(res) && push!(op_ty_results, res) - - create_operation( - "llvm.xor", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "llvm.xor", + location; + operands, + owned_regions, + successors, + attributes, results=(length(op_ty_results) == 0 ? nothing : op_ty_results), - result_inference=(length(op_ty_results) == 0 ? true : false) + result_inference=(length(op_ty_results) == 0 ? true : false), ) end - function zext(arg::Value; res::IR.Type, nonNeg=nothing, location=Location()) - op_ty_results = IR.Type[res, ] - operands = Value[arg, ] + op_ty_results = IR.Type[res,] + operands = Value[arg,] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(nonNeg) && push!(attributes, namedattribute("nonNeg", nonNeg)) - - create_operation( - "llvm.zext", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "llvm.zext", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end @@ -1804,17 +2506,21 @@ value of the specified LLVM IR dialect type. ``` """ function mlir_zero(; res::IR.Type, location=Location()) - op_ty_results = IR.Type[res, ] + op_ty_results = IR.Type[res,] operands = Value[] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "llvm.mlir.zero", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "llvm.mlir.zero", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end diff --git a/src/mlir/Dialects/Nvvm.jl b/src/mlir/Dialects/Nvvm.jl index 2840e0d2e..60f59be07 100755 --- a/src/mlir/Dialects/Nvvm.jl +++ b/src/mlir/Dialects/Nvvm.jl @@ -1,23 +1,34 @@ module nvvm using ...IR -import ...IR: NamedAttribute, Value, Location, Block, Region, Attribute, create_operation, context, IndexType +import ...IR: + NamedAttribute, + Value, + Location, + Block, + Region, + Attribute, + create_operation, + context, + IndexType import ..Dialects: namedattribute, operandsegmentsizes import ...API - - function barrier0(; location=Location()) op_ty_results = IR.Type[] operands = Value[] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "nvvm.barrier0", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.barrier0", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end @@ -33,24 +44,33 @@ The default barrier id is 0 that is similar to `nvvm.barrier` Op. When [For more information, see PTX ISA] (https://docs.nvidia.com/cuda/parallel-thread-execution/index.html#parallel-synchronization-and-communication-instructions-bar) """ -function barrier_arrive(barrierId=nothing::Union{Nothing, Value}; numberOfThreads::Value, location=Location()) +function barrier_arrive( + barrierId=nothing::Union{Nothing,Value}; numberOfThreads::Value, location=Location() +) op_ty_results = IR.Type[] - operands = Value[numberOfThreads, ] + operands = Value[numberOfThreads,] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(barrierId) && push!(operands, barrierId) - - create_operation( - "nvvm.barrier.arrive", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.barrier.arrive", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - -function barrier(barrierId=nothing::Union{Nothing, Value}; numberOfThreads=nothing::Union{Nothing, Value}, location=Location()) +function barrier( + barrierId=nothing::Union{Nothing,Value}; + numberOfThreads=nothing::Union{Nothing,Value}, + location=Location(), +) op_ty_results = IR.Type[] operands = Value[] owned_regions = Region[] @@ -58,166 +78,208 @@ function barrier(barrierId=nothing::Union{Nothing, Value}; numberOfThreads=nothi attributes = NamedAttribute[] !isnothing(barrierId) && push!(operands, barrierId) !isnothing(numberOfThreads) && push!(operands, numberOfThreads) - push!(attributes, operandsegmentsizes([(barrierId==nothing) ? 0 : 1(numberOfThreads==nothing) ? 0 : 1])) - - create_operation( - "nvvm.barrier", location; - operands, owned_regions, successors, attributes, + push!( + attributes, + operandsegmentsizes([ + if (barrierId == nothing) + 0 + elseif 1(numberOfThreads == nothing) + 0 + else + 1 + end + ]), + ) + + return create_operation( + "nvvm.barrier", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function read_ptx_sreg_ntid_x(; res::IR.Type, range=nothing, location=Location()) - op_ty_results = IR.Type[res, ] + op_ty_results = IR.Type[res,] operands = Value[] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(range) && push!(attributes, namedattribute("range", range)) - - create_operation( - "nvvm.read.ptx.sreg.ntid.x", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.read.ptx.sreg.ntid.x", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function read_ptx_sreg_ntid_y(; res::IR.Type, range=nothing, location=Location()) - op_ty_results = IR.Type[res, ] + op_ty_results = IR.Type[res,] operands = Value[] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(range) && push!(attributes, namedattribute("range", range)) - - create_operation( - "nvvm.read.ptx.sreg.ntid.y", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.read.ptx.sreg.ntid.y", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function read_ptx_sreg_ntid_z(; res::IR.Type, range=nothing, location=Location()) - op_ty_results = IR.Type[res, ] + op_ty_results = IR.Type[res,] operands = Value[] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(range) && push!(attributes, namedattribute("range", range)) - - create_operation( - "nvvm.read.ptx.sreg.ntid.z", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.read.ptx.sreg.ntid.z", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function read_ptx_sreg_ctaid_x(; res::IR.Type, range=nothing, location=Location()) - op_ty_results = IR.Type[res, ] + op_ty_results = IR.Type[res,] operands = Value[] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(range) && push!(attributes, namedattribute("range", range)) - - create_operation( - "nvvm.read.ptx.sreg.ctaid.x", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.read.ptx.sreg.ctaid.x", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function read_ptx_sreg_ctaid_y(; res::IR.Type, range=nothing, location=Location()) - op_ty_results = IR.Type[res, ] + op_ty_results = IR.Type[res,] operands = Value[] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(range) && push!(attributes, namedattribute("range", range)) - - create_operation( - "nvvm.read.ptx.sreg.ctaid.y", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.read.ptx.sreg.ctaid.y", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function read_ptx_sreg_ctaid_z(; res::IR.Type, range=nothing, location=Location()) - op_ty_results = IR.Type[res, ] + op_ty_results = IR.Type[res,] operands = Value[] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(range) && push!(attributes, namedattribute("range", range)) - - create_operation( - "nvvm.read.ptx.sreg.ctaid.z", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.read.ptx.sreg.ctaid.z", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function read_ptx_sreg_cluster_ctaid_x(; res::IR.Type, range=nothing, location=Location()) - op_ty_results = IR.Type[res, ] + op_ty_results = IR.Type[res,] operands = Value[] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(range) && push!(attributes, namedattribute("range", range)) - - create_operation( - "nvvm.read.ptx.sreg.cluster.ctaid.x", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.read.ptx.sreg.cluster.ctaid.x", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function read_ptx_sreg_cluster_ctaid_y(; res::IR.Type, range=nothing, location=Location()) - op_ty_results = IR.Type[res, ] + op_ty_results = IR.Type[res,] operands = Value[] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(range) && push!(attributes, namedattribute("range", range)) - - create_operation( - "nvvm.read.ptx.sreg.cluster.ctaid.y", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.read.ptx.sreg.cluster.ctaid.y", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function read_ptx_sreg_cluster_ctaid_z(; res::IR.Type, range=nothing, location=Location()) - op_ty_results = IR.Type[res, ] + op_ty_results = IR.Type[res,] operands = Value[] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(range) && push!(attributes, namedattribute("range", range)) - - create_operation( - "nvvm.read.ptx.sreg.cluster.ctaid.z", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.read.ptx.sreg.cluster.ctaid.z", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end @@ -233,44 +295,54 @@ function breakpoint(; location=Location()) owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "nvvm.breakpoint", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.breakpoint", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function read_ptx_sreg_clock64(; res::IR.Type, location=Location()) - op_ty_results = IR.Type[res, ] + op_ty_results = IR.Type[res,] operands = Value[] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "nvvm.read.ptx.sreg.clock64", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.read.ptx.sreg.clock64", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function read_ptx_sreg_clock(; res::IR.Type, location=Location()) - op_ty_results = IR.Type[res, ] + op_ty_results = IR.Type[res,] operands = Value[] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "nvvm.read.ptx.sreg.clock", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.read.ptx.sreg.clock", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end @@ -293,12 +365,16 @@ function cluster_arrive(; aligned=nothing, location=Location()) successors = Block[] attributes = NamedAttribute[] !isnothing(aligned) && push!(attributes, namedattribute("aligned", aligned)) - - create_operation( - "nvvm.cluster.arrive", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.cluster.arrive", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end @@ -324,199 +400,236 @@ function cluster_arrive_relaxed(; aligned=nothing, location=Location()) successors = Block[] attributes = NamedAttribute[] !isnothing(aligned) && push!(attributes, namedattribute("aligned", aligned)) - - create_operation( - "nvvm.cluster.arrive.relaxed", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.cluster.arrive.relaxed", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function read_ptx_sreg_cluster_nctarank(; res::IR.Type, range=nothing, location=Location()) - op_ty_results = IR.Type[res, ] + op_ty_results = IR.Type[res,] operands = Value[] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(range) && push!(attributes, namedattribute("range", range)) - - create_operation( - "nvvm.read.ptx.sreg.cluster.nctarank", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.read.ptx.sreg.cluster.nctarank", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function read_ptx_sreg_cluster_nctaid_x(; res::IR.Type, range=nothing, location=Location()) - op_ty_results = IR.Type[res, ] + op_ty_results = IR.Type[res,] operands = Value[] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(range) && push!(attributes, namedattribute("range", range)) - - create_operation( - "nvvm.read.ptx.sreg.cluster.nctaid.x", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.read.ptx.sreg.cluster.nctaid.x", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function read_ptx_sreg_cluster_nctaid_y(; res::IR.Type, range=nothing, location=Location()) - op_ty_results = IR.Type[res, ] + op_ty_results = IR.Type[res,] operands = Value[] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(range) && push!(attributes, namedattribute("range", range)) - - create_operation( - "nvvm.read.ptx.sreg.cluster.nctaid.y", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.read.ptx.sreg.cluster.nctaid.y", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function read_ptx_sreg_cluster_nctaid_z(; res::IR.Type, range=nothing, location=Location()) - op_ty_results = IR.Type[res, ] + op_ty_results = IR.Type[res,] operands = Value[] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(range) && push!(attributes, namedattribute("range", range)) - - create_operation( - "nvvm.read.ptx.sreg.cluster.nctaid.z", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.read.ptx.sreg.cluster.nctaid.z", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function read_ptx_sreg_nclusterid_x(; res::IR.Type, range=nothing, location=Location()) - op_ty_results = IR.Type[res, ] + op_ty_results = IR.Type[res,] operands = Value[] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(range) && push!(attributes, namedattribute("range", range)) - - create_operation( - "nvvm.read.ptx.sreg.nclusterid.x", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.read.ptx.sreg.nclusterid.x", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function read_ptx_sreg_nclusterid_y(; res::IR.Type, range=nothing, location=Location()) - op_ty_results = IR.Type[res, ] + op_ty_results = IR.Type[res,] operands = Value[] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(range) && push!(attributes, namedattribute("range", range)) - - create_operation( - "nvvm.read.ptx.sreg.nclusterid.y", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.read.ptx.sreg.nclusterid.y", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function read_ptx_sreg_nclusterid_z(; res::IR.Type, range=nothing, location=Location()) - op_ty_results = IR.Type[res, ] + op_ty_results = IR.Type[res,] operands = Value[] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(range) && push!(attributes, namedattribute("range", range)) - - create_operation( - "nvvm.read.ptx.sreg.nclusterid.z", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.read.ptx.sreg.nclusterid.z", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function read_ptx_sreg_cluster_ctarank(; res::IR.Type, range=nothing, location=Location()) - op_ty_results = IR.Type[res, ] + op_ty_results = IR.Type[res,] operands = Value[] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(range) && push!(attributes, namedattribute("range", range)) - - create_operation( - "nvvm.read.ptx.sreg.cluster.ctarank", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.read.ptx.sreg.cluster.ctarank", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function read_ptx_sreg_clusterid_x(; res::IR.Type, range=nothing, location=Location()) - op_ty_results = IR.Type[res, ] + op_ty_results = IR.Type[res,] operands = Value[] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(range) && push!(attributes, namedattribute("range", range)) - - create_operation( - "nvvm.read.ptx.sreg.clusterid.x", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.read.ptx.sreg.clusterid.x", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function read_ptx_sreg_clusterid_y(; res::IR.Type, range=nothing, location=Location()) - op_ty_results = IR.Type[res, ] + op_ty_results = IR.Type[res,] operands = Value[] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(range) && push!(attributes, namedattribute("range", range)) - - create_operation( - "nvvm.read.ptx.sreg.clusterid.y", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.read.ptx.sreg.clusterid.y", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function read_ptx_sreg_clusterid_z(; res::IR.Type, range=nothing, location=Location()) - op_ty_results = IR.Type[res, ] + op_ty_results = IR.Type[res,] operands = Value[] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(range) && push!(attributes, namedattribute("range", range)) - - create_operation( - "nvvm.read.ptx.sreg.clusterid.z", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.read.ptx.sreg.clusterid.z", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end @@ -537,12 +650,16 @@ function cluster_wait(; aligned=nothing, location=Location()) successors = Block[] attributes = NamedAttribute[] !isnothing(aligned) && push!(attributes, namedattribute("aligned", aligned)) - - create_operation( - "nvvm.cluster.wait", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.cluster.wait", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end @@ -561,12 +678,16 @@ function cp_async_bulk_commit_group(; location=Location()) owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "nvvm.cp.async.bulk.commit.group", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.cp.async.bulk.commit.group", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end @@ -597,40 +718,187 @@ eviction policy that may be used during the memory access. [For more information, see PTX ISA] (https://docs.nvidia.com/cuda/parallel-thread-execution/index.html#data-movement-and-conversion-instructions-cp-async-bulk-tensor) """ -function cp_async_bulk_tensor_shared_cluster_global(dstMem::Value, tmaDescriptor::Value, coordinates::Vector{Value}, mbar::Value, im2colOffsets::Vector{Value}, multicastMask=nothing::Union{Nothing, Value}; l2CacheHint=nothing::Union{Nothing, Value}, predicate=nothing::Union{Nothing, Value}, location=Location()) +function cp_async_bulk_tensor_shared_cluster_global( + dstMem::Value, + tmaDescriptor::Value, + coordinates::Vector{Value}, + mbar::Value, + im2colOffsets::Vector{Value}, + multicastMask=nothing::Union{Nothing,Value}; + l2CacheHint=nothing::Union{Nothing,Value}, + predicate=nothing::Union{Nothing,Value}, + location=Location(), +) op_ty_results = IR.Type[] - operands = Value[dstMem, tmaDescriptor, coordinates..., mbar, im2colOffsets..., ] + operands = Value[dstMem, tmaDescriptor, coordinates..., mbar, im2colOffsets...] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(multicastMask) && push!(operands, multicastMask) !isnothing(l2CacheHint) && push!(operands, l2CacheHint) !isnothing(predicate) && push!(operands, predicate) - push!(attributes, operandsegmentsizes([1, 1, length(coordinates), 1, length(im2colOffsets), (multicastMask==nothing) ? 0 : 1(l2CacheHint==nothing) ? 0 : 1(predicate==nothing) ? 0 : 1])) - - create_operation( - "nvvm.cp.async.bulk.tensor.shared.cluster.global", location; - operands, owned_regions, successors, attributes, + push!( + attributes, + operandsegmentsizes([ + 1, + 1, + length(coordinates), + 1, + length(im2colOffsets), + if (multicastMask == nothing) + 0 + elseif 1(l2CacheHint == nothing) + 0 + elseif 1(predicate == nothing) + 0 + else + 1 + end, + ]), + ) + + return create_operation( + "nvvm.cp.async.bulk.tensor.shared.cluster.global", + location; + operands, + owned_regions, + successors, + attributes, + results=op_ty_results, + result_inference=false, + ) +end + +""" +`cp_async_bulk_tensor_prefetch` + +Initiates an asynchronous prefetch operation on the tensor data from global +memory to L2 cache. + +The Op has two modes: +1) Tiled Mode: It\'s the default mode. The source multi-dimensional tensor +layout is preserved at the destination. + +2) Im2col Mode: This mode is used when `im2colOffsets` operands are present. +the elements in the Bounding Box of the source tensor are rearranged into +columns at the destination. In this mode, the tensor has to be at least +3-dimensional. + +The `l2CacheHint` operand is optional, and it is used to specify cache +eviction policy that may be used during the memory access. + +[For more information, see PTX ISA] +(https://docs.nvidia.com/cuda/parallel-thread-execution/index.html#data-movement-and-conversion-instructions-cp-async-bulk-prefetch-tensor) +""" +function cp_async_bulk_tensor_prefetch( + tmaDescriptor::Value, + coordinates::Vector{Value}, + im2colOffsets::Vector{Value}, + l2CacheHint=nothing::Union{Nothing,Value}; + location=Location(), +) + op_ty_results = IR.Type[] + operands = Value[tmaDescriptor, coordinates..., im2colOffsets...] + owned_regions = Region[] + successors = Block[] + attributes = NamedAttribute[] + !isnothing(l2CacheHint) && push!(operands, l2CacheHint) + push!( + attributes, + operandsegmentsizes([ + 1, length(coordinates), length(im2colOffsets), (l2CacheHint == nothing) ? 0 : 1 + ]), + ) + + return create_operation( + "nvvm.cp.async.bulk.tensor.prefetch", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end +""" +`cp_async_bulk_tensor_reduce` + +Initiates an asynchronous reduction operation of tensor data in +global memory with tensor data in shared memory. + +The `mode` attribute indicates whether the copy mode is tile or im2col. +The `redOp` attribute specifies the reduction operations applied. +The supported reduction operations are: +{add, min, max, inc, dec, and, or, xor} + +The `l2CacheHint` operand is optional, and it is used to specify cache +eviction policy that may be used during the memory access. + +[For more information, see PTX ISA] +(https://docs.nvidia.com/cuda/parallel-thread-execution/index.html#data-movement-and-conversion-instructions-cp-reduce-async-bulk-tensor) +""" +function cp_async_bulk_tensor_reduce( + tmaDescriptor::Value, + srcMem::Value, + coordinates::Vector{Value}, + l2CacheHint=nothing::Union{Nothing,Value}; + redKind, + mode=nothing, + location=Location(), +) + op_ty_results = IR.Type[] + operands = Value[tmaDescriptor, srcMem, coordinates...] + owned_regions = Region[] + successors = Block[] + attributes = NamedAttribute[namedattribute("redKind", redKind),] + !isnothing(l2CacheHint) && push!(operands, l2CacheHint) + push!( + attributes, + operandsegmentsizes([1, 1, length(coordinates), (l2CacheHint == nothing) ? 0 : 1]), + ) + !isnothing(mode) && push!(attributes, namedattribute("mode", mode)) + + return create_operation( + "nvvm.cp.async.bulk.tensor.reduce", + location; + operands, + owned_regions, + successors, + attributes, + results=op_ty_results, + result_inference=false, + ) +end -function cp_async_bulk_tensor_global_shared_cta(tmaDescriptor::Value, srcMem::Value, coordinates::Vector{Value}, predicate=nothing::Union{Nothing, Value}; location=Location()) +function cp_async_bulk_tensor_global_shared_cta( + tmaDescriptor::Value, + srcMem::Value, + coordinates::Vector{Value}, + predicate=nothing::Union{Nothing,Value}; + location=Location(), +) op_ty_results = IR.Type[] - operands = Value[tmaDescriptor, srcMem, coordinates..., ] + operands = Value[tmaDescriptor, srcMem, coordinates...] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(predicate) && push!(operands, predicate) - push!(attributes, operandsegmentsizes([1, 1, length(coordinates), (predicate==nothing) ? 0 : 1])) - - create_operation( - "nvvm.cp.async.bulk.tensor.global.shared.cta", location; - operands, owned_regions, successors, attributes, + push!( + attributes, + operandsegmentsizes([1, 1, length(coordinates), (predicate == nothing) ? 0 : 1]), + ) + + return create_operation( + "nvvm.cp.async.bulk.tensor.global.shared.cta", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end @@ -655,30 +923,37 @@ function cp_async_bulk_wait_group(; group, read=nothing, location=Location()) operands = Value[] owned_regions = Region[] successors = Block[] - attributes = NamedAttribute[namedattribute("group", group), ] + attributes = NamedAttribute[namedattribute("group", group),] !isnothing(read) && push!(attributes, namedattribute("read", read)) - - create_operation( - "nvvm.cp.async.bulk.wait_group", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.cp.async.bulk.wait_group", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function cp_async_commit_group(; location=Location()) op_ty_results = IR.Type[] operands = Value[] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "nvvm.cp.async.commit.group", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.cp.async.commit.group", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end @@ -695,17 +970,21 @@ mbarrier\'s state is updated. """ function cp_async_mbarrier_arrive(addr::Value; noinc=nothing, location=Location()) op_ty_results = IR.Type[] - operands = Value[addr, ] + operands = Value[addr,] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(noinc) && push!(attributes, namedattribute("noinc", noinc)) - - create_operation( - "nvvm.cp.async.mbarrier.arrive", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.cp.async.mbarrier.arrive", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end @@ -721,578 +1000,733 @@ is updated. [For more information, refer PTX ISA] """ function cp_async_mbarrier_arrive_shared(addr::Value; noinc=nothing, location=Location()) op_ty_results = IR.Type[] - operands = Value[addr, ] + operands = Value[addr,] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(noinc) && push!(attributes, namedattribute("noinc", noinc)) - - create_operation( - "nvvm.cp.async.mbarrier.arrive.shared", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.cp.async.mbarrier.arrive.shared", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - -function cp_async_shared_global(dst::Value, src::Value, cpSize=nothing::Union{Nothing, Value}; size, modifier, location=Location()) +function cp_async_shared_global( + dst::Value, + src::Value, + cpSize=nothing::Union{Nothing,Value}; + size, + modifier, + location=Location(), +) op_ty_results = IR.Type[] - operands = Value[dst, src, ] + operands = Value[dst, src] owned_regions = Region[] successors = Block[] - attributes = NamedAttribute[namedattribute("size", size), namedattribute("modifier", modifier), ] + attributes = NamedAttribute[ + namedattribute("size", size), namedattribute("modifier", modifier) + ] !isnothing(cpSize) && push!(operands, cpSize) - - create_operation( - "nvvm.cp.async.shared.global", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.cp.async.shared.global", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function cp_async_wait_group(; n, location=Location()) op_ty_results = IR.Type[] operands = Value[] owned_regions = Region[] successors = Block[] - attributes = NamedAttribute[namedattribute("n", n), ] - - create_operation( - "nvvm.cp.async.wait.group", location; - operands, owned_regions, successors, attributes, + attributes = NamedAttribute[namedattribute("n", n),] + + return create_operation( + "nvvm.cp.async.wait.group", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end +""" +`elect_sync` + +The `elect.sync` instruction elects one predicated active leader +thread from among a set of threads specified in membermask. +The membermask is set to `0xFFFFFFFF` for the current version +of this Op. The predicate result is set to `True` for the +leader thread, and `False` for all other threads. +[For more information, see PTX ISA] +(https://docs.nvidia.com/cuda/parallel-thread-execution/index.html#parallel-synchronization-and-communication-instructions-elect-sync) +""" function elect_sync(; pred::IR.Type, location=Location()) - op_ty_results = IR.Type[pred, ] + op_ty_results = IR.Type[pred,] operands = Value[] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "nvvm.elect.sync", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.elect.sync", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function read_ptx_sreg_envreg0(; res::IR.Type, location=Location()) - op_ty_results = IR.Type[res, ] + op_ty_results = IR.Type[res,] operands = Value[] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "nvvm.read.ptx.sreg.envreg0", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.read.ptx.sreg.envreg0", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function read_ptx_sreg_envreg1(; res::IR.Type, location=Location()) - op_ty_results = IR.Type[res, ] + op_ty_results = IR.Type[res,] operands = Value[] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "nvvm.read.ptx.sreg.envreg1", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.read.ptx.sreg.envreg1", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function read_ptx_sreg_envreg2(; res::IR.Type, location=Location()) - op_ty_results = IR.Type[res, ] + op_ty_results = IR.Type[res,] operands = Value[] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "nvvm.read.ptx.sreg.envreg2", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.read.ptx.sreg.envreg2", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function read_ptx_sreg_envreg3(; res::IR.Type, location=Location()) - op_ty_results = IR.Type[res, ] + op_ty_results = IR.Type[res,] operands = Value[] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "nvvm.read.ptx.sreg.envreg3", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.read.ptx.sreg.envreg3", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function read_ptx_sreg_envreg4(; res::IR.Type, location=Location()) - op_ty_results = IR.Type[res, ] + op_ty_results = IR.Type[res,] operands = Value[] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "nvvm.read.ptx.sreg.envreg4", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.read.ptx.sreg.envreg4", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function read_ptx_sreg_envreg5(; res::IR.Type, location=Location()) - op_ty_results = IR.Type[res, ] + op_ty_results = IR.Type[res,] operands = Value[] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "nvvm.read.ptx.sreg.envreg5", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.read.ptx.sreg.envreg5", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function read_ptx_sreg_envreg6(; res::IR.Type, location=Location()) - op_ty_results = IR.Type[res, ] + op_ty_results = IR.Type[res,] operands = Value[] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "nvvm.read.ptx.sreg.envreg6", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.read.ptx.sreg.envreg6", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function read_ptx_sreg_envreg7(; res::IR.Type, location=Location()) - op_ty_results = IR.Type[res, ] + op_ty_results = IR.Type[res,] operands = Value[] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "nvvm.read.ptx.sreg.envreg7", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.read.ptx.sreg.envreg7", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function read_ptx_sreg_envreg8(; res::IR.Type, location=Location()) - op_ty_results = IR.Type[res, ] + op_ty_results = IR.Type[res,] operands = Value[] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "nvvm.read.ptx.sreg.envreg8", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.read.ptx.sreg.envreg8", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function read_ptx_sreg_envreg9(; res::IR.Type, location=Location()) - op_ty_results = IR.Type[res, ] + op_ty_results = IR.Type[res,] operands = Value[] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "nvvm.read.ptx.sreg.envreg9", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.read.ptx.sreg.envreg9", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function read_ptx_sreg_envreg10(; res::IR.Type, location=Location()) - op_ty_results = IR.Type[res, ] + op_ty_results = IR.Type[res,] operands = Value[] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "nvvm.read.ptx.sreg.envreg10", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.read.ptx.sreg.envreg10", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function read_ptx_sreg_envreg11(; res::IR.Type, location=Location()) - op_ty_results = IR.Type[res, ] + op_ty_results = IR.Type[res,] operands = Value[] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "nvvm.read.ptx.sreg.envreg11", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.read.ptx.sreg.envreg11", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function read_ptx_sreg_envreg12(; res::IR.Type, location=Location()) - op_ty_results = IR.Type[res, ] + op_ty_results = IR.Type[res,] operands = Value[] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "nvvm.read.ptx.sreg.envreg12", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.read.ptx.sreg.envreg12", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function read_ptx_sreg_envreg13(; res::IR.Type, location=Location()) - op_ty_results = IR.Type[res, ] + op_ty_results = IR.Type[res,] operands = Value[] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "nvvm.read.ptx.sreg.envreg13", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.read.ptx.sreg.envreg13", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function read_ptx_sreg_envreg14(; res::IR.Type, location=Location()) - op_ty_results = IR.Type[res, ] + op_ty_results = IR.Type[res,] operands = Value[] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "nvvm.read.ptx.sreg.envreg14", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.read.ptx.sreg.envreg14", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function read_ptx_sreg_envreg15(; res::IR.Type, location=Location()) - op_ty_results = IR.Type[res, ] + op_ty_results = IR.Type[res,] operands = Value[] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "nvvm.read.ptx.sreg.envreg15", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.read.ptx.sreg.envreg15", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function read_ptx_sreg_envreg16(; res::IR.Type, location=Location()) - op_ty_results = IR.Type[res, ] + op_ty_results = IR.Type[res,] operands = Value[] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "nvvm.read.ptx.sreg.envreg16", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.read.ptx.sreg.envreg16", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function read_ptx_sreg_envreg17(; res::IR.Type, location=Location()) - op_ty_results = IR.Type[res, ] + op_ty_results = IR.Type[res,] operands = Value[] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "nvvm.read.ptx.sreg.envreg17", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.read.ptx.sreg.envreg17", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function read_ptx_sreg_envreg18(; res::IR.Type, location=Location()) - op_ty_results = IR.Type[res, ] + op_ty_results = IR.Type[res,] operands = Value[] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "nvvm.read.ptx.sreg.envreg18", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.read.ptx.sreg.envreg18", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function read_ptx_sreg_envreg19(; res::IR.Type, location=Location()) - op_ty_results = IR.Type[res, ] + op_ty_results = IR.Type[res,] operands = Value[] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "nvvm.read.ptx.sreg.envreg19", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.read.ptx.sreg.envreg19", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function read_ptx_sreg_envreg20(; res::IR.Type, location=Location()) - op_ty_results = IR.Type[res, ] + op_ty_results = IR.Type[res,] operands = Value[] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "nvvm.read.ptx.sreg.envreg20", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.read.ptx.sreg.envreg20", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function read_ptx_sreg_envreg21(; res::IR.Type, location=Location()) - op_ty_results = IR.Type[res, ] + op_ty_results = IR.Type[res,] operands = Value[] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "nvvm.read.ptx.sreg.envreg21", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.read.ptx.sreg.envreg21", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function read_ptx_sreg_envreg22(; res::IR.Type, location=Location()) - op_ty_results = IR.Type[res, ] + op_ty_results = IR.Type[res,] operands = Value[] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "nvvm.read.ptx.sreg.envreg22", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.read.ptx.sreg.envreg22", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function read_ptx_sreg_envreg23(; res::IR.Type, location=Location()) - op_ty_results = IR.Type[res, ] + op_ty_results = IR.Type[res,] operands = Value[] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "nvvm.read.ptx.sreg.envreg23", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.read.ptx.sreg.envreg23", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function read_ptx_sreg_envreg24(; res::IR.Type, location=Location()) - op_ty_results = IR.Type[res, ] + op_ty_results = IR.Type[res,] operands = Value[] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "nvvm.read.ptx.sreg.envreg24", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.read.ptx.sreg.envreg24", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function read_ptx_sreg_envreg25(; res::IR.Type, location=Location()) - op_ty_results = IR.Type[res, ] + op_ty_results = IR.Type[res,] operands = Value[] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "nvvm.read.ptx.sreg.envreg25", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.read.ptx.sreg.envreg25", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function read_ptx_sreg_envreg26(; res::IR.Type, location=Location()) - op_ty_results = IR.Type[res, ] + op_ty_results = IR.Type[res,] operands = Value[] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "nvvm.read.ptx.sreg.envreg26", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.read.ptx.sreg.envreg26", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function read_ptx_sreg_envreg27(; res::IR.Type, location=Location()) - op_ty_results = IR.Type[res, ] + op_ty_results = IR.Type[res,] operands = Value[] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "nvvm.read.ptx.sreg.envreg27", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.read.ptx.sreg.envreg27", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function read_ptx_sreg_envreg28(; res::IR.Type, location=Location()) - op_ty_results = IR.Type[res, ] + op_ty_results = IR.Type[res,] operands = Value[] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "nvvm.read.ptx.sreg.envreg28", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.read.ptx.sreg.envreg28", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function read_ptx_sreg_envreg29(; res::IR.Type, location=Location()) - op_ty_results = IR.Type[res, ] + op_ty_results = IR.Type[res,] operands = Value[] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "nvvm.read.ptx.sreg.envreg29", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.read.ptx.sreg.envreg29", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function read_ptx_sreg_envreg30(; res::IR.Type, location=Location()) - op_ty_results = IR.Type[res, ] + op_ty_results = IR.Type[res,] operands = Value[] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "nvvm.read.ptx.sreg.envreg30", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.read.ptx.sreg.envreg30", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function read_ptx_sreg_envreg31(; res::IR.Type, location=Location()) - op_ty_results = IR.Type[res, ] + op_ty_results = IR.Type[res,] operands = Value[] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "nvvm.read.ptx.sreg.envreg31", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.read.ptx.sreg.envreg31", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, + ) +end + +""" +`exit` + +Ends execution of a thread. +[For more information, see PTX ISA](https://docs.nvidia.com/cuda/parallel-thread-execution/index.html#control-flow-instructions-exit) +""" +function exit(; location=Location()) + op_ty_results = IR.Type[] + operands = Value[] + owned_regions = Region[] + successors = Block[] + attributes = NamedAttribute[] + + return create_operation( + "nvvm.exit", + location; + operands, + owned_regions, + successors, + attributes, + results=op_ty_results, + result_inference=false, ) end @@ -1309,12 +1743,16 @@ function fence_mbarrier_init(; location=Location()) owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "nvvm.fence.mbarrier.init", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.fence.mbarrier.init", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end @@ -1334,20 +1772,26 @@ fall within the `.global` state space. Otherwise, the behavior is undefined [For more information, see PTX ISA] (https://docs.nvidia.com/cuda/parallel-thread-execution/index.html#parallel-synchronization-and-communication-instructions-membar) """ -function fence_proxy_acquire(addr::Value, size::Value; scope, fromProxy=nothing, toProxy=nothing, location=Location()) +function fence_proxy_acquire( + addr::Value, size::Value; scope, fromProxy=nothing, toProxy=nothing, location=Location() +) op_ty_results = IR.Type[] - operands = Value[addr, size, ] + operands = Value[addr, size] owned_regions = Region[] successors = Block[] - attributes = NamedAttribute[namedattribute("scope", scope), ] + attributes = NamedAttribute[namedattribute("scope", scope),] !isnothing(fromProxy) && push!(attributes, namedattribute("fromProxy", fromProxy)) !isnothing(toProxy) && push!(attributes, namedattribute("toProxy", toProxy)) - - create_operation( - "nvvm.fence.proxy.acquire", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.fence.proxy.acquire", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end @@ -1364,14 +1808,18 @@ function fence_proxy(; kind, space=nothing, location=Location()) operands = Value[] owned_regions = Region[] successors = Block[] - attributes = NamedAttribute[namedattribute("kind", kind), ] + attributes = NamedAttribute[namedattribute("kind", kind),] !isnothing(space) && push!(attributes, namedattribute("space", space)) - - create_operation( - "nvvm.fence.proxy", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.fence.proxy", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end @@ -1386,461 +1834,574 @@ sequence that contains the fence.proxy.acquire proxy fence operation [For more information, see PTX ISA] (https://docs.nvidia.com/cuda/parallel-thread-execution/index.html#parallel-synchronization-and-communication-instructions-membar) """ -function fence_proxy_release(; scope, fromProxy=nothing, toProxy=nothing, location=Location()) +function fence_proxy_release(; + scope, fromProxy=nothing, toProxy=nothing, location=Location() +) op_ty_results = IR.Type[] operands = Value[] owned_regions = Region[] successors = Block[] - attributes = NamedAttribute[namedattribute("scope", scope), ] + attributes = NamedAttribute[namedattribute("scope", scope),] !isnothing(fromProxy) && push!(attributes, namedattribute("fromProxy", fromProxy)) !isnothing(toProxy) && push!(attributes, namedattribute("toProxy", toProxy)) - - create_operation( - "nvvm.fence.proxy.release", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.fence.proxy.release", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function fence_sc_cluster(; location=Location()) op_ty_results = IR.Type[] operands = Value[] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "nvvm.fence.sc.cluster", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.fence.sc.cluster", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function read_ptx_sreg_globaltimer(; res::IR.Type, location=Location()) - op_ty_results = IR.Type[res, ] + op_ty_results = IR.Type[res,] operands = Value[] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "nvvm.read.ptx.sreg.globaltimer", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.read.ptx.sreg.globaltimer", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function read_ptx_sreg_nctaid_x(; res::IR.Type, range=nothing, location=Location()) - op_ty_results = IR.Type[res, ] + op_ty_results = IR.Type[res,] operands = Value[] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(range) && push!(attributes, namedattribute("range", range)) - - create_operation( - "nvvm.read.ptx.sreg.nctaid.x", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.read.ptx.sreg.nctaid.x", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function read_ptx_sreg_nctaid_y(; res::IR.Type, range=nothing, location=Location()) - op_ty_results = IR.Type[res, ] + op_ty_results = IR.Type[res,] operands = Value[] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(range) && push!(attributes, namedattribute("range", range)) - - create_operation( - "nvvm.read.ptx.sreg.nctaid.y", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.read.ptx.sreg.nctaid.y", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function read_ptx_sreg_nctaid_z(; res::IR.Type, range=nothing, location=Location()) - op_ty_results = IR.Type[res, ] + op_ty_results = IR.Type[res,] operands = Value[] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(range) && push!(attributes, namedattribute("range", range)) - - create_operation( - "nvvm.read.ptx.sreg.nctaid.z", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.read.ptx.sreg.nctaid.z", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function read_ptx_sreg_gridid(; res::IR.Type, range=nothing, location=Location()) - op_ty_results = IR.Type[res, ] + op_ty_results = IR.Type[res,] operands = Value[] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(range) && push!(attributes, namedattribute("range", range)) - - create_operation( - "nvvm.read.ptx.sreg.gridid", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.read.ptx.sreg.gridid", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function read_ptx_sreg_laneid(; res::IR.Type, range=nothing, location=Location()) - op_ty_results = IR.Type[res, ] + op_ty_results = IR.Type[res,] operands = Value[] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(range) && push!(attributes, namedattribute("range", range)) - - create_operation( - "nvvm.read.ptx.sreg.laneid", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.read.ptx.sreg.laneid", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function read_ptx_sreg_lanemask_eq(; res::IR.Type, location=Location()) - op_ty_results = IR.Type[res, ] + op_ty_results = IR.Type[res,] operands = Value[] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "nvvm.read.ptx.sreg.lanemask.eq", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.read.ptx.sreg.lanemask.eq", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function read_ptx_sreg_lanemask_ge(; res::IR.Type, location=Location()) - op_ty_results = IR.Type[res, ] + op_ty_results = IR.Type[res,] operands = Value[] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "nvvm.read.ptx.sreg.lanemask.ge", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.read.ptx.sreg.lanemask.ge", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function read_ptx_sreg_lanemask_gt(; res::IR.Type, location=Location()) - op_ty_results = IR.Type[res, ] + op_ty_results = IR.Type[res,] operands = Value[] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "nvvm.read.ptx.sreg.lanemask.gt", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.read.ptx.sreg.lanemask.gt", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function read_ptx_sreg_lanemask_le(; res::IR.Type, location=Location()) - op_ty_results = IR.Type[res, ] + op_ty_results = IR.Type[res,] operands = Value[] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "nvvm.read.ptx.sreg.lanemask.le", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.read.ptx.sreg.lanemask.le", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function read_ptx_sreg_lanemask_lt(; res::IR.Type, location=Location()) - op_ty_results = IR.Type[res, ] + op_ty_results = IR.Type[res,] operands = Value[] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "nvvm.read.ptx.sreg.lanemask.lt", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.read.ptx.sreg.lanemask.lt", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function ldmatrix(ptr::Value; res::IR.Type, num, layout, location=Location()) - op_ty_results = IR.Type[res, ] - operands = Value[ptr, ] + op_ty_results = IR.Type[res,] + operands = Value[ptr,] owned_regions = Region[] successors = Block[] - attributes = NamedAttribute[namedattribute("num", num), namedattribute("layout", layout), ] - - create_operation( - "nvvm.ldmatrix", location; - operands, owned_regions, successors, attributes, + attributes = NamedAttribute[ + namedattribute("num", num), namedattribute("layout", layout) + ] + + return create_operation( + "nvvm.ldmatrix", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - -function mbarrier_arrive_expect_tx(addr::Value, txcount::Value, predicate=nothing::Union{Nothing, Value}; location=Location()) +function mbarrier_arrive_expect_tx( + addr::Value, + txcount::Value, + predicate=nothing::Union{Nothing,Value}; + location=Location(), +) op_ty_results = IR.Type[] - operands = Value[addr, txcount, ] + operands = Value[addr, txcount] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(predicate) && push!(operands, predicate) - - create_operation( - "nvvm.mbarrier.arrive.expect_tx", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.mbarrier.arrive.expect_tx", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - -function mbarrier_arrive_expect_tx_shared(addr::Value, txcount::Value, predicate=nothing::Union{Nothing, Value}; location=Location()) +function mbarrier_arrive_expect_tx_shared( + addr::Value, + txcount::Value, + predicate=nothing::Union{Nothing,Value}; + location=Location(), +) op_ty_results = IR.Type[] - operands = Value[addr, txcount, ] + operands = Value[addr, txcount] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(predicate) && push!(operands, predicate) - - create_operation( - "nvvm.mbarrier.arrive.expect_tx.shared", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.mbarrier.arrive.expect_tx.shared", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - -function mbarrier_arrive_nocomplete(addr::Value, count::Value; res::IR.Type, location=Location()) - op_ty_results = IR.Type[res, ] - operands = Value[addr, count, ] +function mbarrier_arrive_nocomplete( + addr::Value, count::Value; res::IR.Type, location=Location() +) + op_ty_results = IR.Type[res,] + operands = Value[addr, count] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "nvvm.mbarrier.arrive.nocomplete", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.mbarrier.arrive.nocomplete", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - -function mbarrier_arrive_nocomplete_shared(addr::Value, count::Value; res::IR.Type, location=Location()) - op_ty_results = IR.Type[res, ] - operands = Value[addr, count, ] +function mbarrier_arrive_nocomplete_shared( + addr::Value, count::Value; res::IR.Type, location=Location() +) + op_ty_results = IR.Type[res,] + operands = Value[addr, count] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "nvvm.mbarrier.arrive.nocomplete.shared", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.mbarrier.arrive.nocomplete.shared", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function mbarrier_arrive(addr::Value; res::IR.Type, location=Location()) - op_ty_results = IR.Type[res, ] - operands = Value[addr, ] + op_ty_results = IR.Type[res,] + operands = Value[addr,] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "nvvm.mbarrier.arrive", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.mbarrier.arrive", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function mbarrier_arrive_shared(addr::Value; res::IR.Type, location=Location()) - op_ty_results = IR.Type[res, ] - operands = Value[addr, ] + op_ty_results = IR.Type[res,] + operands = Value[addr,] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "nvvm.mbarrier.arrive.shared", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.mbarrier.arrive.shared", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - -function mbarrier_init(addr::Value, count::Value, predicate=nothing::Union{Nothing, Value}; location=Location()) +function mbarrier_init( + addr::Value, count::Value, predicate=nothing::Union{Nothing,Value}; location=Location() +) op_ty_results = IR.Type[] - operands = Value[addr, count, ] + operands = Value[addr, count] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(predicate) && push!(operands, predicate) - - create_operation( - "nvvm.mbarrier.init", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.mbarrier.init", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - -function mbarrier_init_shared(addr::Value, count::Value, predicate=nothing::Union{Nothing, Value}; location=Location()) +function mbarrier_init_shared( + addr::Value, count::Value, predicate=nothing::Union{Nothing,Value}; location=Location() +) op_ty_results = IR.Type[] - operands = Value[addr, count, ] + operands = Value[addr, count] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(predicate) && push!(operands, predicate) - - create_operation( - "nvvm.mbarrier.init.shared", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.mbarrier.init.shared", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function mbarrier_inval(addr::Value; location=Location()) op_ty_results = IR.Type[] - operands = Value[addr, ] + operands = Value[addr,] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "nvvm.mbarrier.inval", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.mbarrier.inval", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function mbarrier_inval_shared(addr::Value; location=Location()) op_ty_results = IR.Type[] - operands = Value[addr, ] + operands = Value[addr,] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "nvvm.mbarrier.inval.shared", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.mbarrier.inval.shared", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function mbarrier_test_wait(addr::Value, state::Value; res::IR.Type, location=Location()) - op_ty_results = IR.Type[res, ] - operands = Value[addr, state, ] + op_ty_results = IR.Type[res,] + operands = Value[addr, state] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "nvvm.mbarrier.test.wait", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.mbarrier.test.wait", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - -function mbarrier_test_wait_shared(addr::Value, state::Value; res::IR.Type, location=Location()) - op_ty_results = IR.Type[res, ] - operands = Value[addr, state, ] +function mbarrier_test_wait_shared( + addr::Value, state::Value; res::IR.Type, location=Location() +) + op_ty_results = IR.Type[res,] + operands = Value[addr, state] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "nvvm.mbarrier.test.wait.shared", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.mbarrier.test.wait.shared", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - -function mbarrier_try_wait_parity(addr::Value, phase::Value, ticks::Value; location=Location()) +function mbarrier_try_wait_parity( + addr::Value, phase::Value, ticks::Value; location=Location() +) op_ty_results = IR.Type[] - operands = Value[addr, phase, ticks, ] + operands = Value[addr, phase, ticks] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "nvvm.mbarrier.try_wait.parity", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.mbarrier.try_wait.parity", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - -function mbarrier_try_wait_parity_shared(addr::Value, phase::Value, ticks::Value; location=Location()) +function mbarrier_try_wait_parity_shared( + addr::Value, phase::Value, ticks::Value; location=Location() +) op_ty_results = IR.Type[] - operands = Value[addr, phase, ticks, ] + operands = Value[addr, phase, ticks] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "nvvm.mbarrier.try_wait.parity.shared", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.mbarrier.try_wait.parity.shared", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end @@ -1912,88 +2473,133 @@ combinations are possible for certain layouts according to the table below. -> !llvm.struct<(vector<2xf16>, vector<2xf16>)> ``` """ -function mma_sync(operandA::Vector{Value}, operandB::Vector{Value}, operandC::Vector{Value}; res::IR.Type, shape, b1Op=nothing, intOverflowBehavior=nothing, layoutA, layoutB, multiplicandAPtxType=nothing, multiplicandBPtxType=nothing, location=Location()) - op_ty_results = IR.Type[res, ] - operands = Value[operandA..., operandB..., operandC..., ] - owned_regions = Region[] - successors = Block[] - attributes = NamedAttribute[namedattribute("shape", shape), namedattribute("layoutA", layoutA), namedattribute("layoutB", layoutB), ] - push!(attributes, operandsegmentsizes([length(operandA), length(operandB), length(operandC), ])) +function mma_sync( + operandA::Vector{Value}, + operandB::Vector{Value}, + operandC::Vector{Value}; + res::IR.Type, + shape, + b1Op=nothing, + intOverflowBehavior=nothing, + layoutA, + layoutB, + multiplicandAPtxType=nothing, + multiplicandBPtxType=nothing, + location=Location(), +) + op_ty_results = IR.Type[res,] + operands = Value[operandA..., operandB..., operandC...] + owned_regions = Region[] + successors = Block[] + attributes = NamedAttribute[ + namedattribute("shape", shape), + namedattribute("layoutA", layoutA), + namedattribute("layoutB", layoutB), + ] + push!( + attributes, + operandsegmentsizes([length(operandA), length(operandB), length(operandC)]), + ) !isnothing(b1Op) && push!(attributes, namedattribute("b1Op", b1Op)) - !isnothing(intOverflowBehavior) && push!(attributes, namedattribute("intOverflowBehavior", intOverflowBehavior)) - !isnothing(multiplicandAPtxType) && push!(attributes, namedattribute("multiplicandAPtxType", multiplicandAPtxType)) - !isnothing(multiplicandBPtxType) && push!(attributes, namedattribute("multiplicandBPtxType", multiplicandBPtxType)) - - create_operation( - "nvvm.mma.sync", location; - operands, owned_regions, successors, attributes, + !isnothing(intOverflowBehavior) && + push!(attributes, namedattribute("intOverflowBehavior", intOverflowBehavior)) + !isnothing(multiplicandAPtxType) && + push!(attributes, namedattribute("multiplicandAPtxType", multiplicandAPtxType)) + !isnothing(multiplicandBPtxType) && + push!(attributes, namedattribute("multiplicandBPtxType", multiplicandBPtxType)) + + return create_operation( + "nvvm.mma.sync", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - -function prefetch_tensormap(tmaDescriptor::Value, predicate=nothing::Union{Nothing, Value}; location=Location()) +function prefetch_tensormap( + tmaDescriptor::Value, predicate=nothing::Union{Nothing,Value}; location=Location() +) op_ty_results = IR.Type[] - operands = Value[tmaDescriptor, ] + operands = Value[tmaDescriptor,] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(predicate) && push!(operands, predicate) - - create_operation( - "nvvm.prefetch.tensormap", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.prefetch.tensormap", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function rcp_approx_ftz_f(arg::Value; res::IR.Type, location=Location()) - op_ty_results = IR.Type[res, ] - operands = Value[arg, ] + op_ty_results = IR.Type[res,] + operands = Value[arg,] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "nvvm.rcp.approx.ftz.f", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.rcp.approx.ftz.f", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - -function redux_sync(val::Value, mask_and_clamp::Value; res::IR.Type, kind, location=Location()) - op_ty_results = IR.Type[res, ] - operands = Value[val, mask_and_clamp, ] +function redux_sync( + val::Value, mask_and_clamp::Value; res::IR.Type, kind, location=Location() +) + op_ty_results = IR.Type[res,] + operands = Value[val, mask_and_clamp] owned_regions = Region[] successors = Block[] - attributes = NamedAttribute[namedattribute("kind", kind), ] - - create_operation( - "nvvm.redux.sync", location; - operands, owned_regions, successors, attributes, + attributes = NamedAttribute[namedattribute("kind", kind),] + + return create_operation( + "nvvm.redux.sync", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function setmaxregister(; regCount, action, location=Location()) op_ty_results = IR.Type[] operands = Value[] owned_regions = Region[] successors = Block[] - attributes = NamedAttribute[namedattribute("regCount", regCount), namedattribute("action", action), ] - - create_operation( - "nvvm.setmaxregister", location; - operands, owned_regions, successors, attributes, + attributes = NamedAttribute[ + namedattribute("regCount", regCount), namedattribute("action", action) + ] + + return create_operation( + "nvvm.setmaxregister", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end @@ -2011,53 +2617,75 @@ for clamping the source lane index. [For more information, refer PTX ISA] (https://docs.nvidia.com/cuda/parallel-thread-execution/#data-movement-and-conversion-instructions-shfl-sync) """ -function shfl_sync(thread_mask::Value, val::Value, offset::Value, mask_and_clamp::Value; res::IR.Type, kind, return_value_and_is_valid=nothing, location=Location()) - op_ty_results = IR.Type[res, ] - operands = Value[thread_mask, val, offset, mask_and_clamp, ] +function shfl_sync( + thread_mask::Value, + val::Value, + offset::Value, + mask_and_clamp::Value; + res::IR.Type, + kind, + return_value_and_is_valid=nothing, + location=Location(), +) + op_ty_results = IR.Type[res,] + operands = Value[thread_mask, val, offset, mask_and_clamp] owned_regions = Region[] successors = Block[] - attributes = NamedAttribute[namedattribute("kind", kind), ] - !isnothing(return_value_and_is_valid) && push!(attributes, namedattribute("return_value_and_is_valid", return_value_and_is_valid)) - - create_operation( - "nvvm.shfl.sync", location; - operands, owned_regions, successors, attributes, + attributes = NamedAttribute[namedattribute("kind", kind),] + !isnothing(return_value_and_is_valid) && push!( + attributes, + namedattribute("return_value_and_is_valid", return_value_and_is_valid), + ) + + return create_operation( + "nvvm.shfl.sync", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function read_ptx_sreg_nsmid(; res::IR.Type, range=nothing, location=Location()) - op_ty_results = IR.Type[res, ] + op_ty_results = IR.Type[res,] operands = Value[] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(range) && push!(attributes, namedattribute("range", range)) - - create_operation( - "nvvm.read.ptx.sreg.nsmid", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.read.ptx.sreg.nsmid", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function read_ptx_sreg_smid(; res::IR.Type, range=nothing, location=Location()) - op_ty_results = IR.Type[res, ] + op_ty_results = IR.Type[res,] operands = Value[] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(range) && push!(attributes, namedattribute("range", range)) - - create_operation( - "nvvm.read.ptx.sreg.smid", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.read.ptx.sreg.smid", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end @@ -2071,198 +2699,288 @@ location indicated by the address operand \$ptr in shared memory. """ function stmatrix(ptr::Value, sources::Vector{Value}; layout, location=Location()) op_ty_results = IR.Type[] - operands = Value[ptr, sources..., ] + operands = Value[ptr, sources...] owned_regions = Region[] successors = Block[] - attributes = NamedAttribute[namedattribute("layout", layout), ] - - create_operation( - "nvvm.stmatrix", location; - operands, owned_regions, successors, attributes, + attributes = NamedAttribute[namedattribute("layout", layout),] + + return create_operation( + "nvvm.stmatrix", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function bar_warp_sync(mask::Value; location=Location()) op_ty_results = IR.Type[] - operands = Value[mask, ] + operands = Value[mask,] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "nvvm.bar.warp.sync", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.bar.warp.sync", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function read_ptx_sreg_tid_x(; res::IR.Type, range=nothing, location=Location()) - op_ty_results = IR.Type[res, ] + op_ty_results = IR.Type[res,] operands = Value[] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(range) && push!(attributes, namedattribute("range", range)) - - create_operation( - "nvvm.read.ptx.sreg.tid.x", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.read.ptx.sreg.tid.x", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function read_ptx_sreg_tid_y(; res::IR.Type, range=nothing, location=Location()) - op_ty_results = IR.Type[res, ] + op_ty_results = IR.Type[res,] operands = Value[] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(range) && push!(attributes, namedattribute("range", range)) - - create_operation( - "nvvm.read.ptx.sreg.tid.y", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.read.ptx.sreg.tid.y", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function read_ptx_sreg_tid_z(; res::IR.Type, range=nothing, location=Location()) - op_ty_results = IR.Type[res, ] + op_ty_results = IR.Type[res,] operands = Value[] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(range) && push!(attributes, namedattribute("range", range)) - - create_operation( - "nvvm.read.ptx.sreg.tid.z", location; - operands, owned_regions, successors, attributes, - results=op_ty_results, - result_inference=false - ) -end - - -function vote_ballot_sync(mask::Value, pred::Value; res::IR.Type, location=Location()) - op_ty_results = IR.Type[res, ] - operands = Value[mask, pred, ] - owned_regions = Region[] - successors = Block[] - attributes = NamedAttribute[] - - create_operation( - "nvvm.vote.ballot.sync", location; - operands, owned_regions, successors, attributes, - results=op_ty_results, - result_inference=false - ) -end - - -function wmma_load(ptr::Value, stride::Value; res::IR.Type, m, n, k, layout, eltype, frag, location=Location()) - op_ty_results = IR.Type[res, ] - operands = Value[ptr, stride, ] - owned_regions = Region[] - successors = Block[] - attributes = NamedAttribute[namedattribute("m", m), namedattribute("n", n), namedattribute("k", k), namedattribute("layout", layout), namedattribute("eltype", eltype), namedattribute("frag", frag), ] - - create_operation( - "nvvm.wmma.load", location; - operands, owned_regions, successors, attributes, - results=op_ty_results, - result_inference=false - ) -end - -function wmma_mma(args::Vector{Value}; res::IR.Type, m, n, k, layoutA, layoutB, eltypeA, eltypeB, location=Location()) - op_ty_results = IR.Type[res, ] - operands = Value[args..., ] - owned_regions = Region[] - successors = Block[] - attributes = NamedAttribute[namedattribute("m", m), namedattribute("n", n), namedattribute("k", k), namedattribute("layoutA", layoutA), namedattribute("layoutB", layoutB), namedattribute("eltypeA", eltypeA), namedattribute("eltypeB", eltypeB), ] - - create_operation( - "nvvm.wmma.mma", location; - operands, owned_regions, successors, attributes, + return create_operation( + "nvvm.read.ptx.sreg.tid.z", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - -function wmma_store(ptr::Value, args::Vector{Value}, stride::Value; m, n, k, layout, eltype, location=Location()) +function vote_ballot_sync(mask::Value, pred::Value; res::IR.Type, location=Location()) + op_ty_results = IR.Type[res,] + operands = Value[mask, pred] + owned_regions = Region[] + successors = Block[] + attributes = NamedAttribute[] + + return create_operation( + "nvvm.vote.ballot.sync", + location; + operands, + owned_regions, + successors, + attributes, + results=op_ty_results, + result_inference=false, + ) +end + +function wmma_load( + ptr::Value, + stride::Value; + res::IR.Type, + m, + n, + k, + layout, + eltype, + frag, + location=Location(), +) + op_ty_results = IR.Type[res,] + operands = Value[ptr, stride] + owned_regions = Region[] + successors = Block[] + attributes = NamedAttribute[ + namedattribute("m", m), + namedattribute("n", n), + namedattribute("k", k), + namedattribute("layout", layout), + namedattribute("eltype", eltype), + namedattribute("frag", frag), + ] + + return create_operation( + "nvvm.wmma.load", + location; + operands, + owned_regions, + successors, + attributes, + results=op_ty_results, + result_inference=false, + ) +end + +function wmma_mma( + args::Vector{Value}; + res::IR.Type, + m, + n, + k, + layoutA, + layoutB, + eltypeA, + eltypeB, + location=Location(), +) + op_ty_results = IR.Type[res,] + operands = Value[args...,] + owned_regions = Region[] + successors = Block[] + attributes = NamedAttribute[ + namedattribute("m", m), + namedattribute("n", n), + namedattribute("k", k), + namedattribute("layoutA", layoutA), + namedattribute("layoutB", layoutB), + namedattribute("eltypeA", eltypeA), + namedattribute("eltypeB", eltypeB), + ] + + return create_operation( + "nvvm.wmma.mma", + location; + operands, + owned_regions, + successors, + attributes, + results=op_ty_results, + result_inference=false, + ) +end + +function wmma_store( + ptr::Value, + args::Vector{Value}, + stride::Value; + m, + n, + k, + layout, + eltype, + location=Location(), +) op_ty_results = IR.Type[] - operands = Value[ptr, args..., stride, ] + operands = Value[ptr, args..., stride] owned_regions = Region[] successors = Block[] - attributes = NamedAttribute[namedattribute("m", m), namedattribute("n", n), namedattribute("k", k), namedattribute("layout", layout), namedattribute("eltype", eltype), ] - - create_operation( - "nvvm.wmma.store", location; - operands, owned_regions, successors, attributes, + attributes = NamedAttribute[ + namedattribute("m", m), + namedattribute("n", n), + namedattribute("k", k), + namedattribute("layout", layout), + namedattribute("eltype", eltype), + ] + + return create_operation( + "nvvm.wmma.store", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function read_ptx_sreg_nwarpid(; res::IR.Type, range=nothing, location=Location()) - op_ty_results = IR.Type[res, ] + op_ty_results = IR.Type[res,] operands = Value[] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(range) && push!(attributes, namedattribute("range", range)) - - create_operation( - "nvvm.read.ptx.sreg.nwarpid", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.read.ptx.sreg.nwarpid", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function read_ptx_sreg_warpid(; res::IR.Type, range=nothing, location=Location()) - op_ty_results = IR.Type[res, ] + op_ty_results = IR.Type[res,] operands = Value[] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(range) && push!(attributes, namedattribute("range", range)) - - create_operation( - "nvvm.read.ptx.sreg.warpid", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.read.ptx.sreg.warpid", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function read_ptx_sreg_warpsize(; res::IR.Type, range=nothing, location=Location()) - op_ty_results = IR.Type[res, ] + op_ty_results = IR.Type[res,] operands = Value[] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(range) && push!(attributes, namedattribute("range", range)) - - create_operation( - "nvvm.read.ptx.sreg.warpsize", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.read.ptx.sreg.warpsize", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end @@ -2280,12 +2998,16 @@ function wgmma_fence_aligned(; location=Location()) owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "nvvm.wgmma.fence.aligned", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.wgmma.fence.aligned", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end @@ -2302,12 +3024,16 @@ function wgmma_commit_group_sync_aligned(; location=Location()) owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "nvvm.wgmma.commit.group.sync.aligned", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.wgmma.commit.group.sync.aligned", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end @@ -2370,19 +3096,49 @@ Supported shapes: [For more information, see PTX ISA](https://docs.nvidia.com/cuda/parallel-thread-execution/index.html#asynchronous-warpgroup-level-matrix-instructions) """ -function wgmma_mma_async(inouts::Value, descriptorA::Value, descriptorB::Value; results::IR.Type, shape, typeA, typeB, typeD, scaleD, scaleA, scaleB, layoutA, layoutB, satfinite=nothing, location=Location()) - op_ty_results = IR.Type[results, ] - operands = Value[inouts, descriptorA, descriptorB, ] - owned_regions = Region[] - successors = Block[] - attributes = NamedAttribute[namedattribute("shape", shape), namedattribute("typeA", typeA), namedattribute("typeB", typeB), namedattribute("typeD", typeD), namedattribute("scaleD", scaleD), namedattribute("scaleA", scaleA), namedattribute("scaleB", scaleB), namedattribute("layoutA", layoutA), namedattribute("layoutB", layoutB), ] +function wgmma_mma_async( + inouts::Value, + descriptorA::Value, + descriptorB::Value; + results::IR.Type, + shape, + typeA, + typeB, + typeD, + scaleD, + scaleA, + scaleB, + layoutA, + layoutB, + satfinite=nothing, + location=Location(), +) + op_ty_results = IR.Type[results,] + operands = Value[inouts, descriptorA, descriptorB] + owned_regions = Region[] + successors = Block[] + attributes = NamedAttribute[ + namedattribute("shape", shape), + namedattribute("typeA", typeA), + namedattribute("typeB", typeB), + namedattribute("typeD", typeD), + namedattribute("scaleD", scaleD), + namedattribute("scaleA", scaleA), + namedattribute("scaleB", scaleB), + namedattribute("layoutA", layoutA), + namedattribute("layoutB", layoutB), + ] !isnothing(satfinite) && push!(attributes, namedattribute("satfinite", satfinite)) - - create_operation( - "nvvm.wgmma.mma_async", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "nvvm.wgmma.mma_async", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end @@ -2398,13 +3154,17 @@ function wgmma_wait_group_sync_aligned(; group, location=Location()) operands = Value[] owned_regions = Region[] successors = Block[] - attributes = NamedAttribute[namedattribute("group", group), ] - - create_operation( - "nvvm.wgmma.wait.group.sync.aligned", location; - operands, owned_regions, successors, attributes, + attributes = NamedAttribute[namedattribute("group", group),] + + return create_operation( + "nvvm.wgmma.wait.group.sync.aligned", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end diff --git a/src/mlir/Dialects/TPU.jl b/src/mlir/Dialects/TPU.jl new file mode 100644 index 000000000..ee104ff15 --- /dev/null +++ b/src/mlir/Dialects/TPU.jl @@ -0,0 +1,1275 @@ +module tpu +using ...IR +import ...IR: + NamedAttribute, + Value, + Location, + Block, + Region, + Attribute, + create_operation, + context, + IndexType +import ..Dialects: namedattribute, operandsegmentsizes +import ...API + +function all_reduce( + input::Value; output=nothing::Union{Nothing,IR.Type}, dim, kind, location=Location() +) + op_ty_results = IR.Type[] + operands = Value[input,] + owned_regions = Region[] + successors = Block[] + attributes = NamedAttribute[namedattribute("dim", dim), namedattribute("kind", kind)] + !isnothing(output) && push!(op_ty_results, output) + + return create_operation( + "tpu.all_reduce", + location; + operands, + owned_regions, + successors, + attributes, + results=(length(op_ty_results) == 0 ? nothing : op_ty_results), + result_inference=(length(op_ty_results) == 0 ? true : false), + ) +end + +function sem_alloc(; result::IR.Type, location=Location()) + op_ty_results = IR.Type[result,] + operands = Value[] + owned_regions = Region[] + successors = Block[] + attributes = NamedAttribute[] + + return create_operation( + "tpu.sem_alloc", + location; + operands, + owned_regions, + successors, + attributes, + results=op_ty_results, + result_inference=false, + ) +end + +function assume_layout(input::Value; result::IR.Type, location=Location()) + op_ty_results = IR.Type[result,] + operands = Value[input,] + owned_regions = Region[] + successors = Block[] + attributes = NamedAttribute[] + + return create_operation( + "tpu.assume_layout", + location; + operands, + owned_regions, + successors, + attributes, + results=op_ty_results, + result_inference=false, + ) +end + +function assume_multiple( + value::Value; result=nothing::Union{Nothing,IR.Type}, multiple, location=Location() +) + op_ty_results = IR.Type[] + operands = Value[value,] + owned_regions = Region[] + successors = Block[] + attributes = NamedAttribute[namedattribute("multiple", multiple),] + !isnothing(result) && push!(op_ty_results, result) + + return create_operation( + "tpu.assume_multiple", + location; + operands, + owned_regions, + successors, + attributes, + results=(length(op_ty_results) == 0 ? nothing : op_ty_results), + result_inference=(length(op_ty_results) == 0 ? true : false), + ) +end + +function bitcast(input::Value; output::IR.Type, location=Location()) + op_ty_results = IR.Type[output,] + operands = Value[input,] + owned_regions = Region[] + successors = Block[] + attributes = NamedAttribute[] + + return create_operation( + "tpu.bitcast", + location; + operands, + owned_regions, + successors, + attributes, + results=op_ty_results, + result_inference=false, + ) +end + +function bitcast_vreg(input::Value; output::IR.Type, location=Location()) + op_ty_results = IR.Type[output,] + operands = Value[input,] + owned_regions = Region[] + successors = Block[] + attributes = NamedAttribute[] + + return create_operation( + "tpu.bitcast_vreg", + location; + operands, + owned_regions, + successors, + attributes, + results=op_ty_results, + result_inference=false, + ) +end + +""" +`broadcast_in_sublanes` + +For each sublane `i`, broadcasts the value in lane `lane + i` along the entire +sublane. If `lane + i` is not in [0, lane_count), then the value in sublane `i` +is not defined (can be anything). +""" +function broadcast_in_sublanes(source::Value; output::IR.Type, lane, location=Location()) + op_ty_results = IR.Type[output,] + operands = Value[source,] + owned_regions = Region[] + successors = Block[] + attributes = NamedAttribute[namedattribute("lane", lane),] + + return create_operation( + "tpu.broadcast_in_sublanes", + location; + operands, + owned_regions, + successors, + attributes, + results=op_ty_results, + result_inference=false, + ) +end + +function concatenate( + sources::Vector{Value}; output::IR.Type, dimension, location=Location() +) + op_ty_results = IR.Type[output,] + operands = Value[sources...,] + owned_regions = Region[] + successors = Block[] + attributes = NamedAttribute[namedattribute("dimension", dimension),] + + return create_operation( + "tpu.concatenate", + location; + operands, + owned_regions, + successors, + attributes, + results=op_ty_results, + result_inference=false, + ) +end + +function create_mask( + low::Vector{Value}, high::Vector{Value}; output::IR.Type, location=Location() +) + op_ty_results = IR.Type[output,] + operands = Value[low..., high...] + owned_regions = Region[] + successors = Block[] + attributes = NamedAttribute[] + + return create_operation( + "tpu.create_mask", + location; + operands, + owned_regions, + successors, + attributes, + results=op_ty_results, + result_inference=false, + ) +end + +""" +`create_subelement_mask` + +The \"half-sublanes\", \"quarter-sublanes\", etc. (unit is determined by +`num_subelems`) of the mask are masked in the range specified by `from` and +`to`. + +- If `from <= to`, the range `[from, to)` is set and the rest is unset. +- If `to <= from`, the range `[to, from)` is unset and the rest is set. + +All lanes are set identically. + +# Example + +```mlir +%msk = tpu.create_subelement_mask 3, 9, 2 : vector<8x128x2xi1> +``` + +This creates a mask `%msk` where, for all `lane`s, `%msk[*][lane][*]` is: + +``` +[[0, 0], [0, 1], [1, 1], [1, 1], [1, 0], [0, 0], [0, 0], [0, 0]] +``` + +It is currently only supported: +- In TPU v4, for `num_subelems` of 1 and 2. +- In TPU v5, for `num_subelems` of 1, 2, and 4. +""" +function create_subelement_mask(; + output::IR.Type, from, to, num_subelems, location=Location() +) + op_ty_results = IR.Type[output,] + operands = Value[] + owned_regions = Region[] + successors = Block[] + attributes = NamedAttribute[ + namedattribute("from", from), + namedattribute("to", to), + namedattribute("num_subelems", num_subelems), + ] + + return create_operation( + "tpu.create_subelement_mask", + location; + operands, + owned_regions, + successors, + attributes, + results=op_ty_results, + result_inference=false, + ) +end + +function delay(nanos::Value; location=Location()) + op_ty_results = IR.Type[] + operands = Value[nanos,] + owned_regions = Region[] + successors = Block[] + attributes = NamedAttribute[] + + return create_operation( + "tpu.delay", + location; + operands, + owned_regions, + successors, + attributes, + results=op_ty_results, + result_inference=false, + ) +end + +function device_id(; result=nothing::Union{Nothing,IR.Type}, location=Location()) + op_ty_results = IR.Type[] + operands = Value[] + owned_regions = Region[] + successors = Block[] + attributes = NamedAttribute[] + !isnothing(result) && push!(op_ty_results, result) + + return create_operation( + "tpu.device_id", + location; + operands, + owned_regions, + successors, + attributes, + results=(length(op_ty_results) == 0 ? nothing : op_ty_results), + result_inference=(length(op_ty_results) == 0 ? true : false), + ) +end + +function dynamic_gather( + source::Value, indices::Value; output::IR.Type, dimension, location=Location() +) + op_ty_results = IR.Type[output,] + operands = Value[source, indices] + owned_regions = Region[] + successors = Block[] + attributes = NamedAttribute[namedattribute("dimension", dimension),] + + return create_operation( + "tpu.dynamic_gather", + location; + operands, + owned_regions, + successors, + attributes, + results=op_ty_results, + result_inference=false, + ) +end + +function dynamic_rotate( + value::Value, + amount::Value; + result::IR.Type, + dimension, + stride=nothing, + stride_dimension=nothing, + location=Location(), +) + op_ty_results = IR.Type[result,] + operands = Value[value, amount] + owned_regions = Region[] + successors = Block[] + attributes = NamedAttribute[namedattribute("dimension", dimension),] + !isnothing(stride) && push!(attributes, namedattribute("stride", stride)) + !isnothing(stride_dimension) && + push!(attributes, namedattribute("stride_dimension", stride_dimension)) + + return create_operation( + "tpu.dynamic_rotate", + location; + operands, + owned_regions, + successors, + attributes, + results=op_ty_results, + result_inference=false, + ) +end + +function enqueue_dma( + source::Value, + source_semaphore=nothing::Union{Nothing,Value}; + target::Value, + target_semaphore::Value, + device_id=nothing::Union{Nothing,Value}, + core_id=nothing::Union{Nothing,Value}, + location=Location(), +) + op_ty_results = IR.Type[] + operands = Value[source, target, target_semaphore] + owned_regions = Region[] + successors = Block[] + attributes = NamedAttribute[] + !isnothing(source_semaphore) && push!(operands, source_semaphore) + !isnothing(device_id) && push!(operands, device_id) + !isnothing(core_id) && push!(operands, core_id) + push!( + attributes, + operandsegmentsizes([ + 1, + (source_semaphore == nothing) ? 0 : 11, + 1, + if (device_id == nothing) + 0 + elseif 1(core_id == nothing) + 0 + else + 1 + end, + ]), + ) + + return create_operation( + "tpu.enqueue_dma", + location; + operands, + owned_regions, + successors, + attributes, + results=op_ty_results, + result_inference=false, + ) +end + +function erase_memref_layout(operand::Value; result::IR.Type, location=Location()) + op_ty_results = IR.Type[result,] + operands = Value[operand,] + owned_regions = Region[] + successors = Block[] + attributes = NamedAttribute[] + + return create_operation( + "tpu.erase_memref_layout", + location; + operands, + owned_regions, + successors, + attributes, + results=op_ty_results, + result_inference=false, + ) +end + +function gather(source::Value; output::IR.Type, indices, dimension, location=Location()) + op_ty_results = IR.Type[output,] + operands = Value[source,] + owned_regions = Region[] + successors = Block[] + attributes = NamedAttribute[ + namedattribute("indices", indices), namedattribute("dimension", dimension) + ] + + return create_operation( + "tpu.gather", + location; + operands, + owned_regions, + successors, + attributes, + results=op_ty_results, + result_inference=false, + ) +end + +function sem_barrier(; semaphore::IR.Type, location=Location()) + op_ty_results = IR.Type[semaphore,] + operands = Value[] + owned_regions = Region[] + successors = Block[] + attributes = NamedAttribute[] + + return create_operation( + "tpu.sem_barrier", + location; + operands, + owned_regions, + successors, + attributes, + results=op_ty_results, + result_inference=false, + ) +end + +function internal_scratch(; result::IR.Type, location=Location()) + op_ty_results = IR.Type[result,] + operands = Value[] + owned_regions = Region[] + successors = Block[] + attributes = NamedAttribute[] + + return create_operation( + "tpu.internal_scratch", + location; + operands, + owned_regions, + successors, + attributes, + results=op_ty_results, + result_inference=false, + ) +end + +function iteration_bound(; result=nothing::Union{Nothing,IR.Type}, dim, location=Location()) + op_ty_results = IR.Type[] + operands = Value[] + owned_regions = Region[] + successors = Block[] + attributes = NamedAttribute[namedattribute("dim", dim),] + !isnothing(result) && push!(op_ty_results, result) + + return create_operation( + "tpu.iteration_bound", + location; + operands, + owned_regions, + successors, + attributes, + results=(length(op_ty_results) == 0 ? nothing : op_ty_results), + result_inference=(length(op_ty_results) == 0 ? true : false), + ) +end + +function iota(; output::IR.Type, dimension=nothing, location=Location()) + op_ty_results = IR.Type[output,] + operands = Value[] + owned_regions = Region[] + successors = Block[] + attributes = NamedAttribute[] + !isnothing(dimension) && push!(attributes, namedattribute("dimension", dimension)) + + return create_operation( + "tpu.iota", + location; + operands, + owned_regions, + successors, + attributes, + results=op_ty_results, + result_inference=false, + ) +end + +function load( + base::Value, + indices::Vector{Value}; + result::IR.Type, + sublane_mask, + sublane_stride=nothing, + location=Location(), +) + op_ty_results = IR.Type[result,] + operands = Value[base, indices...] + owned_regions = Region[] + successors = Block[] + attributes = NamedAttribute[namedattribute("sublane_mask", sublane_mask),] + !isnothing(sublane_stride) && + push!(attributes, namedattribute("sublane_stride", sublane_stride)) + + return create_operation( + "tpu.load", + location; + operands, + owned_regions, + successors, + attributes, + results=op_ty_results, + result_inference=false, + ) +end + +function log(inputs::Vector{Value}; tag, formatted=nothing, location=Location()) + op_ty_results = IR.Type[] + operands = Value[inputs...,] + owned_regions = Region[] + successors = Block[] + attributes = NamedAttribute[namedattribute("tag", tag),] + !isnothing(formatted) && push!(attributes, namedattribute("formatted", formatted)) + + return create_operation( + "tpu.log", + location; + operands, + owned_regions, + successors, + attributes, + results=op_ty_results, + result_inference=false, + ) +end + +function mask_cast(input::Value; result::IR.Type, location=Location()) + op_ty_results = IR.Type[result,] + operands = Value[input,] + owned_regions = Region[] + successors = Block[] + attributes = NamedAttribute[] + + return create_operation( + "tpu.mask_cast", + location; + operands, + owned_regions, + successors, + attributes, + results=op_ty_results, + result_inference=false, + ) +end + +function matmul( + lhs::Value, + rhs::Value, + acc::Value; + result::IR.Type, + transpose_lhs=nothing, + transpose_rhs=nothing, + precision=nothing, + dimension_numbers=nothing, + location=Location(), +) + op_ty_results = IR.Type[result,] + operands = Value[lhs, rhs, acc] + owned_regions = Region[] + successors = Block[] + attributes = NamedAttribute[] + !isnothing(transpose_lhs) && + push!(attributes, namedattribute("transpose_lhs", transpose_lhs)) + !isnothing(transpose_rhs) && + push!(attributes, namedattribute("transpose_rhs", transpose_rhs)) + !isnothing(precision) && push!(attributes, namedattribute("precision", precision)) + !isnothing(dimension_numbers) && + push!(attributes, namedattribute("dimension_numbers", dimension_numbers)) + + return create_operation( + "tpu.matmul", + location; + operands, + owned_regions, + successors, + attributes, + results=op_ty_results, + result_inference=false, + ) +end + +function memref_bitcast(input::Value; result::IR.Type, location=Location()) + op_ty_results = IR.Type[result,] + operands = Value[input,] + owned_regions = Region[] + successors = Block[] + attributes = NamedAttribute[] + + return create_operation( + "tpu.memref_bitcast", + location; + operands, + owned_regions, + successors, + attributes, + results=op_ty_results, + result_inference=false, + ) +end + +function memref_reshape(input::Value; result::IR.Type, location=Location()) + op_ty_results = IR.Type[result,] + operands = Value[input,] + owned_regions = Region[] + successors = Block[] + attributes = NamedAttribute[] + + return create_operation( + "tpu.memref_reshape", + location; + operands, + owned_regions, + successors, + attributes, + results=op_ty_results, + result_inference=false, + ) +end + +function memref_slice( + mem_ref::Value, + base_idx::Vector{Value}, + dynamic_sizes::Vector{Value}; + result::IR.Type, + location=Location(), +) + op_ty_results = IR.Type[result,] + operands = Value[mem_ref, base_idx..., dynamic_sizes...] + owned_regions = Region[] + successors = Block[] + attributes = NamedAttribute[] + push!(attributes, operandsegmentsizes([1, length(base_idx), length(dynamic_sizes)])) + + return create_operation( + "tpu.memref_slice", + location; + operands, + owned_regions, + successors, + attributes, + results=op_ty_results, + result_inference=false, + ) +end + +function memref_squeeze(input::Value; result::IR.Type, location=Location()) + op_ty_results = IR.Type[result,] + operands = Value[input,] + owned_regions = Region[] + successors = Block[] + attributes = NamedAttribute[] + + return create_operation( + "tpu.memref_squeeze", + location; + operands, + owned_regions, + successors, + attributes, + results=op_ty_results, + result_inference=false, + ) +end + +function prng_random_bits(; output::IR.Type, location=Location()) + op_ty_results = IR.Type[output,] + operands = Value[] + owned_regions = Region[] + successors = Block[] + attributes = NamedAttribute[] + + return create_operation( + "tpu.prng_random_bits", + location; + operands, + owned_regions, + successors, + attributes, + results=op_ty_results, + result_inference=false, + ) +end + +function prng_set_seed_32(seeds::Vector{Value}; location=Location()) + op_ty_results = IR.Type[] + operands = Value[seeds...,] + owned_regions = Region[] + successors = Block[] + attributes = NamedAttribute[] + + return create_operation( + "tpu.prng_set_seed_32", + location; + operands, + owned_regions, + successors, + attributes, + results=op_ty_results, + result_inference=false, + ) +end + +function pack_subelements( + sources::Vector{Value}; output::IR.Type, positions, pack_format, location=Location() +) + op_ty_results = IR.Type[output,] + operands = Value[sources...,] + owned_regions = Region[] + successors = Block[] + attributes = NamedAttribute[ + namedattribute("positions", positions), namedattribute("pack_format", pack_format) + ] + + return create_operation( + "tpu.pack_subelements", + location; + operands, + owned_regions, + successors, + attributes, + results=op_ty_results, + result_inference=false, + ) +end + +function region(; results::Vector{IR.Type}, region::Region, location=Location()) + op_ty_results = IR.Type[results...,] + operands = Value[] + owned_regions = Region[region,] + successors = Block[] + attributes = NamedAttribute[] + + return create_operation( + "tpu.region", + location; + operands, + owned_regions, + successors, + attributes, + results=op_ty_results, + result_inference=false, + ) +end + +function reinterpret_cast(input::Value; result::IR.Type, location=Location()) + op_ty_results = IR.Type[result,] + operands = Value[input,] + owned_regions = Region[] + successors = Block[] + attributes = NamedAttribute[] + + return create_operation( + "tpu.reinterpret_cast", + location; + operands, + owned_regions, + successors, + attributes, + results=op_ty_results, + result_inference=false, + ) +end + +function repeat(source::Value; output::IR.Type, dimension, times, location=Location()) + op_ty_results = IR.Type[output,] + operands = Value[source,] + owned_regions = Region[] + successors = Block[] + attributes = NamedAttribute[ + namedattribute("dimension", dimension), namedattribute("times", times) + ] + + return create_operation( + "tpu.repeat", + location; + operands, + owned_regions, + successors, + attributes, + results=op_ty_results, + result_inference=false, + ) +end + +function roll_vectors(input::Vector{Value}; output::IR.Type, location=Location()) + op_ty_results = IR.Type[output,] + operands = Value[input...,] + owned_regions = Region[] + successors = Block[] + attributes = NamedAttribute[] + + return create_operation( + "tpu.roll_vectors", + location; + operands, + owned_regions, + successors, + attributes, + results=op_ty_results, + result_inference=false, + ) +end + +function rotate( + value::Value; + result=nothing::Union{Nothing,IR.Type}, + amount, + dimension, + stride=nothing, + stride_dimension=nothing, + location=Location(), +) + op_ty_results = IR.Type[] + operands = Value[value,] + owned_regions = Region[] + successors = Block[] + attributes = NamedAttribute[ + namedattribute("amount", amount), namedattribute("dimension", dimension) + ] + !isnothing(result) && push!(op_ty_results, result) + !isnothing(stride) && push!(attributes, namedattribute("stride", stride)) + !isnothing(stride_dimension) && + push!(attributes, namedattribute("stride_dimension", stride_dimension)) + + return create_operation( + "tpu.rotate", + location; + operands, + owned_regions, + successors, + attributes, + results=(length(op_ty_results) == 0 ? nothing : op_ty_results), + result_inference=(length(op_ty_results) == 0 ? true : false), + ) +end + +function sem_read( + semaphore::Value; result=nothing::Union{Nothing,IR.Type}, location=Location() +) + op_ty_results = IR.Type[] + operands = Value[semaphore,] + owned_regions = Region[] + successors = Block[] + attributes = NamedAttribute[] + !isnothing(result) && push!(op_ty_results, result) + + return create_operation( + "tpu.sem_read", + location; + operands, + owned_regions, + successors, + attributes, + results=(length(op_ty_results) == 0 ? nothing : op_ty_results), + result_inference=(length(op_ty_results) == 0 ? true : false), + ) +end + +function sem_signal( + semaphore::Value, + amount::Value, + device_id=nothing::Union{Nothing,Value}; + core_id=nothing::Union{Nothing,Value}, + core_type=nothing, + location=Location(), +) + op_ty_results = IR.Type[] + operands = Value[semaphore, amount] + owned_regions = Region[] + successors = Block[] + attributes = NamedAttribute[] + !isnothing(device_id) && push!(operands, device_id) + !isnothing(core_id) && push!(operands, core_id) + push!( + attributes, + operandsegmentsizes([ + 1, 1, if (device_id == nothing) + 0 + elseif 1(core_id == nothing) + 0 + else + 1 + end + ]), + ) + !isnothing(core_type) && push!(attributes, namedattribute("core_type", core_type)) + + return create_operation( + "tpu.sem_signal", + location; + operands, + owned_regions, + successors, + attributes, + results=op_ty_results, + result_inference=false, + ) +end + +function sem_wait(semaphore::Value, amount::Value; location=Location()) + op_ty_results = IR.Type[] + operands = Value[semaphore, amount] + owned_regions = Region[] + successors = Block[] + attributes = NamedAttribute[] + + return create_operation( + "tpu.sem_wait", + location; + operands, + owned_regions, + successors, + attributes, + results=op_ty_results, + result_inference=false, + ) +end + +function shuffled_load( + base::Value, + indices::Vector{Value}; + result::IR.Type, + sublane_mask, + sublane_offsets, + location=Location(), +) + op_ty_results = IR.Type[result,] + operands = Value[base, indices...] + owned_regions = Region[] + successors = Block[] + attributes = NamedAttribute[ + namedattribute("sublane_mask", sublane_mask), + namedattribute("sublane_offsets", sublane_offsets), + ] + + return create_operation( + "tpu.shuffled_load", + location; + operands, + owned_regions, + successors, + attributes, + results=op_ty_results, + result_inference=false, + ) +end + +function shuffled_store( + valueToStore::Value, + base::Value, + indices::Vector{Value}; + sublane_mask, + sublane_offsets, + location=Location(), +) + op_ty_results = IR.Type[] + operands = Value[valueToStore, base, indices...] + owned_regions = Region[] + successors = Block[] + attributes = NamedAttribute[ + namedattribute("sublane_mask", sublane_mask), + namedattribute("sublane_offsets", sublane_offsets), + ] + + return create_operation( + "tpu.shuffled_store", + location; + operands, + owned_regions, + successors, + attributes, + results=op_ty_results, + result_inference=false, + ) +end + +function store( + valueToStore::Value, + base::Value, + indices::Vector{Value}, + mask=nothing::Union{Nothing,Value}; + sublane_mask, + sublane_stride=nothing, + location=Location(), +) + op_ty_results = IR.Type[] + operands = Value[valueToStore, base, indices...] + owned_regions = Region[] + successors = Block[] + attributes = NamedAttribute[namedattribute("sublane_mask", sublane_mask),] + !isnothing(mask) && push!(operands, mask) + push!( + attributes, operandsegmentsizes([1, 1, length(indices), (mask == nothing) ? 0 : 1]) + ) + !isnothing(sublane_stride) && + push!(attributes, namedattribute("sublane_stride", sublane_stride)) + + return create_operation( + "tpu.store", + location; + operands, + owned_regions, + successors, + attributes, + results=op_ty_results, + result_inference=false, + ) +end + +function strided_load( + base::Value, indices::Vector{Value}; result::IR.Type, strides, location=Location() +) + op_ty_results = IR.Type[result,] + operands = Value[base, indices...] + owned_regions = Region[] + successors = Block[] + attributes = NamedAttribute[namedattribute("strides", strides),] + + return create_operation( + "tpu.strided_load", + location; + operands, + owned_regions, + successors, + attributes, + results=op_ty_results, + result_inference=false, + ) +end + +function strided_store( + valueToStore::Value, base::Value, indices::Vector{Value}; strides, location=Location() +) + op_ty_results = IR.Type[] + operands = Value[valueToStore, base, indices...] + owned_regions = Region[] + successors = Block[] + attributes = NamedAttribute[namedattribute("strides", strides),] + + return create_operation( + "tpu.strided_store", + location; + operands, + owned_regions, + successors, + attributes, + results=op_ty_results, + result_inference=false, + ) +end + +function trace(; + results::Vector{IR.Type}, message, level, region::Region, location=Location() +) + op_ty_results = IR.Type[results...,] + operands = Value[] + owned_regions = Region[region,] + successors = Block[] + attributes = NamedAttribute[ + namedattribute("message", message), namedattribute("level", level) + ] + + return create_operation( + "tpu.trace", + location; + operands, + owned_regions, + successors, + attributes, + results=op_ty_results, + result_inference=false, + ) +end + +function trace_start(; message, level, location=Location()) + op_ty_results = IR.Type[] + operands = Value[] + owned_regions = Region[] + successors = Block[] + attributes = NamedAttribute[ + namedattribute("message", message), namedattribute("level", level) + ] + + return create_operation( + "tpu.trace_start", + location; + operands, + owned_regions, + successors, + attributes, + results=op_ty_results, + result_inference=false, + ) +end + +function trace_stop(; location=Location()) + op_ty_results = IR.Type[] + operands = Value[] + owned_regions = Region[] + successors = Block[] + attributes = NamedAttribute[] + + return create_operation( + "tpu.trace_stop", + location; + operands, + owned_regions, + successors, + attributes, + results=op_ty_results, + result_inference=false, + ) +end + +function unpack_subelements( + source::Value; output::IR.Type, index, pack_format, location=Location() +) + op_ty_results = IR.Type[output,] + operands = Value[source,] + owned_regions = Region[] + successors = Block[] + attributes = NamedAttribute[ + namedattribute("index", index), namedattribute("pack_format", pack_format) + ] + + return create_operation( + "tpu.unpack_subelements", + location; + operands, + owned_regions, + successors, + attributes, + results=op_ty_results, + result_inference=false, + ) +end + +function unroll_vectors(input::Value; output::Vector{IR.Type}, location=Location()) + op_ty_results = IR.Type[output...,] + operands = Value[input,] + owned_regions = Region[] + successors = Block[] + attributes = NamedAttribute[] + + return create_operation( + "tpu.unroll_vectors", + location; + operands, + owned_regions, + successors, + attributes, + results=op_ty_results, + result_inference=false, + ) +end + +function vector_store( + valueToStore::Value, + base::Value, + indices::Vector{Value}, + mask=nothing::Union{Nothing,Value}; + strides, + location=Location(), +) + op_ty_results = IR.Type[] + operands = Value[valueToStore, base, indices...] + owned_regions = Region[] + successors = Block[] + attributes = NamedAttribute[namedattribute("strides", strides),] + !isnothing(mask) && push!(operands, mask) + push!( + attributes, operandsegmentsizes([1, 1, length(indices), (mask == nothing) ? 0 : 1]) + ) + + return create_operation( + "tpu.vector_store", + location; + operands, + owned_regions, + successors, + attributes, + results=op_ty_results, + result_inference=false, + ) +end + +function wait_dma(semaphore::Value, ref::Value; location=Location()) + op_ty_results = IR.Type[] + operands = Value[semaphore, ref] + owned_regions = Region[] + successors = Block[] + attributes = NamedAttribute[] + + return create_operation( + "tpu.wait_dma", + location; + operands, + owned_regions, + successors, + attributes, + results=op_ty_results, + result_inference=false, + ) +end + +function weird(input::Value; output::IR.Type, location=Location()) + op_ty_results = IR.Type[output,] + operands = Value[input,] + owned_regions = Region[] + successors = Block[] + attributes = NamedAttribute[] + + return create_operation( + "tpu.weird", + location; + operands, + owned_regions, + successors, + attributes, + results=op_ty_results, + result_inference=false, + ) +end + +function yield(results::Vector{Value}; location=Location()) + op_ty_results = IR.Type[] + operands = Value[results...,] + owned_regions = Region[] + successors = Block[] + attributes = NamedAttribute[] + + return create_operation( + "tpu.yield", + location; + operands, + owned_regions, + successors, + attributes, + results=op_ty_results, + result_inference=false, + ) +end + +end # tpu diff --git a/src/mlir/Dialects/Triton.jl b/src/mlir/Dialects/Triton.jl index 698a6edae..f02e239e6 100755 --- a/src/mlir/Dialects/Triton.jl +++ b/src/mlir/Dialects/Triton.jl @@ -1,10 +1,18 @@ module tt using ...IR -import ...IR: NamedAttribute, Value, Location, Block, Region, Attribute, create_operation, context, IndexType +import ...IR: + NamedAttribute, + Value, + Location, + Block, + Region, + Attribute, + create_operation, + context, + IndexType import ..Dialects: namedattribute, operandsegmentsizes import ...API - """ `call` @@ -19,18 +27,24 @@ symbol reference attribute named \"callee\". %2 = tt.call @my_add(%0, %1) : (f32, f32) -> f32 ``` """ -function call(operands::Vector{Value}; result_0::Vector{IR.Type}, callee, location=Location()) - op_ty_results = IR.Type[result_0..., ] - operands = Value[operands..., ] +function call( + operands::Vector{Value}; result_0::Vector{IR.Type}, callee, location=Location() +) + op_ty_results = IR.Type[result_0...,] + operands = Value[operands...,] owned_regions = Region[] successors = Block[] - attributes = NamedAttribute[namedattribute("callee", callee), ] - - create_operation( - "tt.call", location; - operands, owned_regions, successors, attributes, + attributes = NamedAttribute[namedattribute("callee", callee),] + + return create_operation( + "tt.call", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end @@ -73,21 +87,36 @@ tt.func @example_fn_result() -> (f64 {dialectName.attrName = 0 : i64}) tt.func @example_fn_attr() attributes {dialectName.attrName = false} ``` """ -function func(; sym_name, function_type, sym_visibility=nothing, arg_attrs=nothing, res_attrs=nothing, body::Region, location=Location()) +function func(; + sym_name, + function_type, + sym_visibility=nothing, + arg_attrs=nothing, + res_attrs=nothing, + body::Region, + location=Location(), +) op_ty_results = IR.Type[] operands = Value[] - owned_regions = Region[body, ] + owned_regions = Region[body,] successors = Block[] - attributes = NamedAttribute[namedattribute("sym_name", sym_name), namedattribute("function_type", function_type), ] - !isnothing(sym_visibility) && push!(attributes, namedattribute("sym_visibility", sym_visibility)) + attributes = NamedAttribute[ + namedattribute("sym_name", sym_name), namedattribute("function_type", function_type) + ] + !isnothing(sym_visibility) && + push!(attributes, namedattribute("sym_visibility", sym_visibility)) !isnothing(arg_attrs) && push!(attributes, namedattribute("arg_attrs", arg_attrs)) !isnothing(res_attrs) && push!(attributes, namedattribute("res_attrs", res_attrs)) - - create_operation( - "tt.func", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "tt.func", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end @@ -98,17 +127,21 @@ This Op exists to help the transition from untyped raw TMA objects to typed Tens Ideally, we can remove this once the APIs are fully fleshed out. """ function reinterpret_tensor_descriptor(rawDesc::Value; result::IR.Type, location=Location()) - op_ty_results = IR.Type[result, ] - operands = Value[rawDesc, ] + op_ty_results = IR.Type[result,] + operands = Value[rawDesc,] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "tt.reinterpret_tensor_descriptor", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "tt.reinterpret_tensor_descriptor", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end @@ -131,48 +164,58 @@ tt.func @foo() : (i32, f8) { """ function return_(srcs::Vector{Value}; location=Location()) op_ty_results = IR.Type[] - operands = Value[srcs..., ] + operands = Value[srcs...,] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "tt.return", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "tt.return", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function addptr(ptr::Value, offset::Value; result::IR.Type, location=Location()) - op_ty_results = IR.Type[result, ] - operands = Value[ptr, offset, ] + op_ty_results = IR.Type[result,] + operands = Value[ptr, offset] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "tt.addptr", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "tt.addptr", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function advance(ptr::Value, offsets::Vector{Value}; result::IR.Type, location=Location()) - op_ty_results = IR.Type[result, ] - operands = Value[ptr, offsets..., ] + op_ty_results = IR.Type[result,] + operands = Value[ptr, offsets...] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "tt.advance", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "tt.advance", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end @@ -184,16 +227,20 @@ If the condition is false, the message is printed, and the program is aborted. """ function assert(condition::Value; message, location=Location()) op_ty_results = IR.Type[] - operands = Value[condition, ] + operands = Value[condition,] owned_regions = Region[] successors = Block[] - attributes = NamedAttribute[namedattribute("message", message), ] - - create_operation( - "tt.assert", location; - operands, owned_regions, successors, attributes, + attributes = NamedAttribute[namedattribute("message", message),] + + return create_operation( + "tt.assert", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end @@ -208,18 +255,24 @@ else store \$old to \$ptr, return \$old """ -function atomic_cas(ptr::Value, cmp::Value, val::Value; result::IR.Type, sem, scope, location=Location()) - op_ty_results = IR.Type[result, ] - operands = Value[ptr, cmp, val, ] +function atomic_cas( + ptr::Value, cmp::Value, val::Value; result::IR.Type, sem, scope, location=Location() +) + op_ty_results = IR.Type[result,] + operands = Value[ptr, cmp, val] owned_regions = Region[] successors = Block[] - attributes = NamedAttribute[namedattribute("sem", sem), namedattribute("scope", scope), ] - - create_operation( - "tt.atomic_cas", location; - operands, owned_regions, successors, attributes, + attributes = NamedAttribute[namedattribute("sem", sem), namedattribute("scope", scope)] + + return create_operation( + "tt.atomic_cas", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end @@ -230,35 +283,55 @@ load data at \$ptr, do \$rmw_op with \$val, and store result to \$ptr. return old value at \$ptr """ -function atomic_rmw(ptr::Value, val::Value, mask=nothing::Union{Nothing, Value}; result::IR.Type, atomic_rmw_op, sem, scope, location=Location()) - op_ty_results = IR.Type[result, ] - operands = Value[ptr, val, ] +function atomic_rmw( + ptr::Value, + val::Value, + mask=nothing::Union{Nothing,Value}; + result::IR.Type, + atomic_rmw_op, + sem, + scope, + location=Location(), +) + op_ty_results = IR.Type[result,] + operands = Value[ptr, val] owned_regions = Region[] successors = Block[] - attributes = NamedAttribute[namedattribute("atomic_rmw_op", atomic_rmw_op), namedattribute("sem", sem), namedattribute("scope", scope), ] + attributes = NamedAttribute[ + namedattribute("atomic_rmw_op", atomic_rmw_op), + namedattribute("sem", sem), + namedattribute("scope", scope), + ] !isnothing(mask) && push!(operands, mask) - - create_operation( - "tt.atomic_rmw", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "tt.atomic_rmw", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function bitcast(src::Value; result::IR.Type, location=Location()) - op_ty_results = IR.Type[result, ] - operands = Value[src, ] + op_ty_results = IR.Type[result,] + operands = Value[src,] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "tt.bitcast", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "tt.bitcast", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end @@ -270,33 +343,40 @@ to a new size, e.g. tensor<1x32x1xf32> -> tensor<2x32x4xf32>. You cannot change the size of a non-1 dimension. """ function broadcast(src::Value; result::IR.Type, location=Location()) - op_ty_results = IR.Type[result, ] - operands = Value[src, ] + op_ty_results = IR.Type[result,] + operands = Value[src,] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "tt.broadcast", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "tt.broadcast", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function cat(lhs::Value, rhs::Value; result::IR.Type, location=Location()) - op_ty_results = IR.Type[result, ] - operands = Value[lhs, rhs, ] + op_ty_results = IR.Type[result,] + operands = Value[lhs, rhs] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "tt.cat", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "tt.cat", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end @@ -307,19 +387,30 @@ Clamp operation for floating point types. The operation takes three arguments: x, min, and max. It returns a tensor of the same shape as x with its values clamped to the range [min, max]. """ -function clampf(x::Value, min::Value, max::Value; result=nothing::Union{Nothing, IR.Type}, propagateNan, location=Location()) +function clampf( + x::Value, + min::Value, + max::Value; + result=nothing::Union{Nothing,IR.Type}, + propagateNan, + location=Location(), +) op_ty_results = IR.Type[] - operands = Value[x, min, max, ] + operands = Value[x, min, max] owned_regions = Region[] successors = Block[] - attributes = NamedAttribute[namedattribute("propagateNan", propagateNan), ] + attributes = NamedAttribute[namedattribute("propagateNan", propagateNan),] !isnothing(result) && push!(op_ty_results, result) - - create_operation( - "tt.clampf", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "tt.clampf", + location; + operands, + owned_regions, + successors, + attributes, results=(length(op_ty_results) == 0 ? nothing : op_ty_results), - result_inference=(length(op_ty_results) == 0 ? true : false) + result_inference=(length(op_ty_results) == 0 ? true : false), ) end @@ -333,21 +424,35 @@ tf32x3: implement the 3xTF32 trick. For more info see the pass in F32DotTC.cpp ieee: don\'t use TC, implement dot in software. If the GPU does not have Tensor cores or the inputs are not f32, this flag is ignored. """ -function dot(a::Value, b::Value, c::Value; d=nothing::Union{Nothing, IR.Type}, inputPrecision=nothing, maxNumImpreciseAcc=nothing, location=Location()) +function dot( + a::Value, + b::Value, + c::Value; + d=nothing::Union{Nothing,IR.Type}, + inputPrecision=nothing, + maxNumImpreciseAcc=nothing, + location=Location(), +) op_ty_results = IR.Type[] - operands = Value[a, b, c, ] + operands = Value[a, b, c] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(d) && push!(op_ty_results, d) - !isnothing(inputPrecision) && push!(attributes, namedattribute("inputPrecision", inputPrecision)) - !isnothing(maxNumImpreciseAcc) && push!(attributes, namedattribute("maxNumImpreciseAcc", maxNumImpreciseAcc)) - - create_operation( - "tt.dot", location; - operands, owned_regions, successors, attributes, + !isnothing(inputPrecision) && + push!(attributes, namedattribute("inputPrecision", inputPrecision)) + !isnothing(maxNumImpreciseAcc) && + push!(attributes, namedattribute("maxNumImpreciseAcc", maxNumImpreciseAcc)) + + return create_operation( + "tt.dot", + location; + operands, + owned_regions, + successors, + attributes, results=(length(op_ty_results) == 0 ? nothing : op_ty_results), - result_inference=(length(op_ty_results) == 0 ? true : false) + result_inference=(length(op_ty_results) == 0 ? true : false), ) end @@ -357,21 +462,48 @@ end \$d = matrix_multiply(scale(\$lhs, \$lhs_scale), scale(\$rhs, \$rhs_scale)) + \$c. Where scale(x, s) is a function that applies the scale per block following microscaling spec. """ -function dot_scaled(lhs::Value, rhs::Value, c::Value, lhs_scale=nothing::Union{Nothing, Value}; rhs_scale=nothing::Union{Nothing, Value}, d::IR.Type, lhs_type, rhs_type, location=Location()) - op_ty_results = IR.Type[d, ] - operands = Value[lhs, rhs, c, ] +function dot_scaled( + lhs::Value, + rhs::Value, + c::Value, + lhs_scale=nothing::Union{Nothing,Value}; + rhs_scale=nothing::Union{Nothing,Value}, + d::IR.Type, + lhs_type, + rhs_type, + location=Location(), +) + op_ty_results = IR.Type[d,] + operands = Value[lhs, rhs, c] owned_regions = Region[] successors = Block[] - attributes = NamedAttribute[namedattribute("lhs_type", lhs_type), namedattribute("rhs_type", rhs_type), ] + attributes = NamedAttribute[ + namedattribute("lhs_type", lhs_type), namedattribute("rhs_type", rhs_type) + ] !isnothing(lhs_scale) && push!(operands, lhs_scale) !isnothing(rhs_scale) && push!(operands, rhs_scale) - push!(attributes, operandsegmentsizes([1, 1, 1, (lhs_scale==nothing) ? 0 : 1(rhs_scale==nothing) ? 0 : 1])) - - create_operation( - "tt.dot_scaled", location; - operands, owned_regions, successors, attributes, + push!( + attributes, + operandsegmentsizes([ + 1, 1, 1, if (lhs_scale == nothing) + 0 + elseif 1(rhs_scale == nothing) + 0 + else + 1 + end + ]), + ) + + return create_operation( + "tt.dot_scaled", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end @@ -383,35 +515,57 @@ Runs an inline asm block to generate one or more tensors. The asm block is given `packed_element` elements at a time. Exactly which elems it receives is unspecified. """ -function elementwise_inline_asm(args::Vector{Value}; result::Vector{IR.Type}, asm_string, constraints, pure, packed_element, location=Location()) - op_ty_results = IR.Type[result..., ] - operands = Value[args..., ] +function elementwise_inline_asm( + args::Vector{Value}; + result::Vector{IR.Type}, + asm_string, + constraints, + pure, + packed_element, + location=Location(), +) + op_ty_results = IR.Type[result...,] + operands = Value[args...,] owned_regions = Region[] successors = Block[] - attributes = NamedAttribute[namedattribute("asm_string", asm_string), namedattribute("constraints", constraints), namedattribute("pure", pure), namedattribute("packed_element", packed_element), ] - - create_operation( - "tt.elementwise_inline_asm", location; - operands, owned_regions, successors, attributes, + attributes = NamedAttribute[ + namedattribute("asm_string", asm_string), + namedattribute("constraints", constraints), + namedattribute("pure", pure), + namedattribute("packed_element", packed_element), + ] + + return create_operation( + "tt.elementwise_inline_asm", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - -function expand_dims(src::Value; result=nothing::Union{Nothing, IR.Type}, axis, location=Location()) +function expand_dims( + src::Value; result=nothing::Union{Nothing,IR.Type}, axis, location=Location() +) op_ty_results = IR.Type[] - operands = Value[src, ] + operands = Value[src,] owned_regions = Region[] successors = Block[] - attributes = NamedAttribute[namedattribute("axis", axis), ] + attributes = NamedAttribute[namedattribute("axis", axis),] !isnothing(result) && push!(op_ty_results, result) - - create_operation( - "tt.expand_dims", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "tt.expand_dims", + location; + operands, + owned_regions, + successors, + attributes, results=(length(op_ty_results) == 0 ? nothing : op_ty_results), - result_inference=(length(op_ty_results) == 0 ? true : false) + result_inference=(length(op_ty_results) == 0 ? true : false), ) end @@ -425,20 +579,31 @@ The destination tensor type and shape must match the descriptor otherwise the re This is an escape hatch and is only there for testing/experimenting. This op will be removed in the future. """ -function experimental_descriptor_load(desc::Value, indices::Vector{Value}; result::IR.Type, cache=nothing, evict=nothing, location=Location()) - op_ty_results = IR.Type[result, ] - operands = Value[desc, indices..., ] +function experimental_descriptor_load( + desc::Value, + indices::Vector{Value}; + result::IR.Type, + cache=nothing, + evict=nothing, + location=Location(), +) + op_ty_results = IR.Type[result,] + operands = Value[desc, indices...] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(cache) && push!(attributes, namedattribute("cache", cache)) !isnothing(evict) && push!(attributes, namedattribute("evict", evict)) - - create_operation( - "tt.experimental_descriptor_load", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "tt.experimental_descriptor_load", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end @@ -452,51 +617,97 @@ The shape and types of `src` must match the descriptor otherwise the result is u This is an escape hatch and is only there for testing/experimenting. This op will be removed in the future. """ -function experimental_descriptor_store(desc::Value, src::Value, indices::Vector{Value}; location=Location()) +function experimental_descriptor_store( + desc::Value, src::Value, indices::Vector{Value}; location=Location() +) op_ty_results = IR.Type[] - operands = Value[desc, src, indices..., ] + operands = Value[desc, src, indices...] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "tt.experimental_descriptor_store", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "tt.experimental_descriptor_store", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - -function experimental_tensormap_create(desc_ptr::Value, global_address::Value, box_dim::Vector{Value}, global_dim::Vector{Value}, global_stride::Vector{Value}, element_stride::Vector{Value}; elem_type, interleave_layout, swizzle_mode, fill_mode, location=Location()) +function experimental_tensormap_create( + desc_ptr::Value, + global_address::Value, + box_dim::Vector{Value}, + global_dim::Vector{Value}, + global_stride::Vector{Value}, + element_stride::Vector{Value}; + elem_type, + interleave_layout, + swizzle_mode, + fill_mode, + location=Location(), +) op_ty_results = IR.Type[] - operands = Value[desc_ptr, global_address, box_dim..., global_dim..., global_stride..., element_stride..., ] + operands = Value[ + desc_ptr, + global_address, + box_dim..., + global_dim..., + global_stride..., + element_stride..., + ] owned_regions = Region[] successors = Block[] - attributes = NamedAttribute[namedattribute("elem_type", elem_type), namedattribute("interleave_layout", interleave_layout), namedattribute("swizzle_mode", swizzle_mode), namedattribute("fill_mode", fill_mode), ] - push!(attributes, operandsegmentsizes([1, 1, length(box_dim), length(global_dim), length(global_stride), length(element_stride), ])) - - create_operation( - "tt.experimental_tensormap_create", location; - operands, owned_regions, successors, attributes, + attributes = NamedAttribute[ + namedattribute("elem_type", elem_type), + namedattribute("interleave_layout", interleave_layout), + namedattribute("swizzle_mode", swizzle_mode), + namedattribute("fill_mode", fill_mode), + ] + push!( + attributes, + operandsegmentsizes([ + 1, + 1, + length(box_dim), + length(global_dim), + length(global_stride), + length(element_stride), + ]), + ) + + return create_operation( + "tt.experimental_tensormap_create", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function experimental_tensormap_fenceproxy_acquire(desc_ptr::Value; location=Location()) op_ty_results = IR.Type[] - operands = Value[desc_ptr, ] + operands = Value[desc_ptr,] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "tt.experimental_tensormap_fenceproxy_acquire", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "tt.experimental_tensormap_fenceproxy_acquire", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end @@ -506,18 +717,35 @@ end call an external function \$symbol implemented in \$libpath/\$libname with \$args return \$libpath/\$libname:\$symbol(\$args...) """ -function extern_elementwise(srcs::Vector{Value}; result::IR.Type, libname, libpath, symbol, pure, location=Location()) - op_ty_results = IR.Type[result, ] - operands = Value[srcs..., ] +function extern_elementwise( + srcs::Vector{Value}; + result::IR.Type, + libname, + libpath, + symbol, + pure, + location=Location(), +) + op_ty_results = IR.Type[result,] + operands = Value[srcs...,] owned_regions = Region[] successors = Block[] - attributes = NamedAttribute[namedattribute("libname", libname), namedattribute("libpath", libpath), namedattribute("symbol", symbol), namedattribute("pure", pure), ] - - create_operation( - "tt.extern_elementwise", location; - operands, owned_regions, successors, attributes, + attributes = NamedAttribute[ + namedattribute("libname", libname), + namedattribute("libpath", libpath), + namedattribute("symbol", symbol), + namedattribute("pure", pure), + ] + + return create_operation( + "tt.extern_elementwise", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end @@ -529,18 +757,22 @@ Floating point casting for custom types (F8), and non-default rounding modes. F8 <-> FP16, BF16, FP32, FP64 """ function fp_to_fp(src::Value; result::IR.Type, rounding=nothing, location=Location()) - op_ty_results = IR.Type[result, ] - operands = Value[src, ] + op_ty_results = IR.Type[result,] + operands = Value[src,] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(rounding) && push!(attributes, namedattribute("rounding", rounding)) - - create_operation( - "tt.fp_to_fp", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "tt.fp_to_fp", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end @@ -554,53 +786,71 @@ dimension, and each dimension of the indices tensor that is not the gather dimension cannot be greater than the corresponding dimension in the input tensor. """ -function gather(src::Value, indices::Value; result=nothing::Union{Nothing, IR.Type}, axis, location=Location()) +function gather( + src::Value, + indices::Value; + result=nothing::Union{Nothing,IR.Type}, + axis, + location=Location(), +) op_ty_results = IR.Type[] - operands = Value[src, indices, ] + operands = Value[src, indices] owned_regions = Region[] successors = Block[] - attributes = NamedAttribute[namedattribute("axis", axis), ] + attributes = NamedAttribute[namedattribute("axis", axis),] !isnothing(result) && push!(op_ty_results, result) - - create_operation( - "tt.gather", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "tt.gather", + location; + operands, + owned_regions, + successors, + attributes, results=(length(op_ty_results) == 0 ? nothing : op_ty_results), - result_inference=(length(op_ty_results) == 0 ? true : false) + result_inference=(length(op_ty_results) == 0 ? true : false), ) end - -function get_num_programs(; result=nothing::Union{Nothing, IR.Type}, axis, location=Location()) +function get_num_programs(; + result=nothing::Union{Nothing,IR.Type}, axis, location=Location() +) op_ty_results = IR.Type[] operands = Value[] owned_regions = Region[] successors = Block[] - attributes = NamedAttribute[namedattribute("axis", axis), ] + attributes = NamedAttribute[namedattribute("axis", axis),] !isnothing(result) && push!(op_ty_results, result) - - create_operation( - "tt.get_num_programs", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "tt.get_num_programs", + location; + operands, + owned_regions, + successors, + attributes, results=(length(op_ty_results) == 0 ? nothing : op_ty_results), - result_inference=(length(op_ty_results) == 0 ? true : false) + result_inference=(length(op_ty_results) == 0 ? true : false), ) end - -function get_program_id(; result=nothing::Union{Nothing, IR.Type}, axis, location=Location()) +function get_program_id(; result=nothing::Union{Nothing,IR.Type}, axis, location=Location()) op_ty_results = IR.Type[] operands = Value[] owned_regions = Region[] successors = Block[] - attributes = NamedAttribute[namedattribute("axis", axis), ] + attributes = NamedAttribute[namedattribute("axis", axis),] !isnothing(result) && push!(op_ty_results, result) - - create_operation( - "tt.get_program_id", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "tt.get_program_id", + location; + operands, + owned_regions, + successors, + attributes, results=(length(op_ty_results) == 0 ? nothing : op_ty_results), - result_inference=(length(op_ty_results) == 0 ? true : false) + result_inference=(length(op_ty_results) == 0 ? true : false), ) end @@ -612,33 +862,40 @@ the dimension of the output tensor. Each bins has a width of 1 and bins start at 0. """ function histogram(src::Value; result::IR.Type, location=Location()) - op_ty_results = IR.Type[result, ] - operands = Value[src, ] + op_ty_results = IR.Type[result,] + operands = Value[src,] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "tt.histogram", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "tt.histogram", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function int_to_ptr(src::Value; result::IR.Type, location=Location()) - op_ty_results = IR.Type[result, ] - operands = Value[src, ] + op_ty_results = IR.Type[result,] + operands = Value[src,] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "tt.int_to_ptr", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "tt.int_to_ptr", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end @@ -651,44 +908,74 @@ shape 4x8x2xf32. Because Triton tensors always have a power-of-two number of elements, the two input tensors must have the same shape. """ -function join(lhs::Value, rhs::Value; result=nothing::Union{Nothing, IR.Type}, location=Location()) +function join( + lhs::Value, rhs::Value; result=nothing::Union{Nothing,IR.Type}, location=Location() +) op_ty_results = IR.Type[] - operands = Value[lhs, rhs, ] + operands = Value[lhs, rhs] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(result) && push!(op_ty_results, result) - - create_operation( - "tt.join", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "tt.join", + location; + operands, + owned_regions, + successors, + attributes, results=(length(op_ty_results) == 0 ? nothing : op_ty_results), - result_inference=(length(op_ty_results) == 0 ? true : false) + result_inference=(length(op_ty_results) == 0 ? true : false), ) end - -function load(ptr::Value, mask=nothing::Union{Nothing, Value}; other=nothing::Union{Nothing, Value}, result=nothing::Union{Nothing, IR.Type}, boundaryCheck=nothing, padding=nothing, cache=nothing, evict=nothing, isVolatile=nothing, location=Location()) +function load( + ptr::Value, + mask=nothing::Union{Nothing,Value}; + other=nothing::Union{Nothing,Value}, + result=nothing::Union{Nothing,IR.Type}, + boundaryCheck=nothing, + padding=nothing, + cache=nothing, + evict=nothing, + isVolatile=nothing, + location=Location(), +) op_ty_results = IR.Type[] - operands = Value[ptr, ] + operands = Value[ptr,] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(mask) && push!(operands, mask) !isnothing(other) && push!(operands, other) - push!(attributes, operandsegmentsizes([1, (mask==nothing) ? 0 : 1(other==nothing) ? 0 : 1])) + push!( + attributes, + operandsegmentsizes([1, if (mask == nothing) + 0 + elseif 1(other == nothing) + 0 + else + 1 + end]), + ) !isnothing(result) && push!(op_ty_results, result) - !isnothing(boundaryCheck) && push!(attributes, namedattribute("boundaryCheck", boundaryCheck)) + !isnothing(boundaryCheck) && + push!(attributes, namedattribute("boundaryCheck", boundaryCheck)) !isnothing(padding) && push!(attributes, namedattribute("padding", padding)) !isnothing(cache) && push!(attributes, namedattribute("cache", cache)) !isnothing(evict) && push!(attributes, namedattribute("evict", evict)) !isnothing(isVolatile) && push!(attributes, namedattribute("isVolatile", isVolatile)) - - create_operation( - "tt.load", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "tt.load", + location; + operands, + owned_regions, + successors, + attributes, results=(length(op_ty_results) == 0 ? nothing : op_ty_results), - result_inference=(length(op_ty_results) == 0 ? true : false) + result_inference=(length(op_ty_results) == 0 ? true : false), ) end @@ -700,17 +987,21 @@ Returns an 1D int32 tensor. Values span from \$start to \$end (exclusive), with step = 1 """ function make_range(; result::IR.Type, start, end_, location=Location()) - op_ty_results = IR.Type[result, ] + op_ty_results = IR.Type[result,] operands = Value[] owned_regions = Region[] successors = Block[] - attributes = NamedAttribute[namedattribute("start", start), namedattribute("end", end_), ] - - create_operation( - "tt.make_range", location; - operands, owned_regions, successors, attributes, + attributes = NamedAttribute[namedattribute("start", start), namedattribute("end", end_)] + + return create_operation( + "tt.make_range", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end @@ -720,18 +1011,28 @@ end `tt.make_tensor_descriptor` takes both meta information of the parent tensor and the block size, and returns a descriptor object which can be used to load/store from the tensor in global memory. """ -function make_tensor_descriptor(base::Value, shape::Vector{Value}, strides::Vector{Value}; result::IR.Type, location=Location()) - op_ty_results = IR.Type[result, ] - operands = Value[base, shape..., strides..., ] +function make_tensor_descriptor( + base::Value, + shape::Vector{Value}, + strides::Vector{Value}; + result::IR.Type, + location=Location(), +) + op_ty_results = IR.Type[result,] + operands = Value[base, shape..., strides...] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "tt.make_tensor_descriptor", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "tt.make_tensor_descriptor", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end @@ -741,18 +1042,30 @@ end `tt.make_tensor_ptr` takes both meta information of the parent tensor and the block tensor, then it returns a pointer to the block tensor, e.g. returns a type of `tt.ptr>`. """ -function make_tensor_ptr(base::Value, shape::Vector{Value}, strides::Vector{Value}, offsets::Vector{Value}; result::IR.Type, order, location=Location()) - op_ty_results = IR.Type[result, ] - operands = Value[base, shape..., strides..., offsets..., ] +function make_tensor_ptr( + base::Value, + shape::Vector{Value}, + strides::Vector{Value}, + offsets::Vector{Value}; + result::IR.Type, + order, + location=Location(), +) + op_ty_results = IR.Type[result,] + operands = Value[base, shape..., strides..., offsets...] owned_regions = Region[] successors = Block[] - attributes = NamedAttribute[namedattribute("order", order), ] - - create_operation( - "tt.make_tensor_ptr", location; - operands, owned_regions, successors, attributes, + attributes = NamedAttribute[namedattribute("order", order),] + + return create_operation( + "tt.make_tensor_ptr", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end @@ -761,19 +1074,25 @@ end Most significant N bits of the 2N-bit product of two integers. """ -function mulhiui(x::Value, y::Value; result=nothing::Union{Nothing, IR.Type}, location=Location()) +function mulhiui( + x::Value, y::Value; result=nothing::Union{Nothing,IR.Type}, location=Location() +) op_ty_results = IR.Type[] - operands = Value[x, y, ] + operands = Value[x, y] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(result) && push!(op_ty_results, result) - - create_operation( - "tt.mulhiui", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "tt.mulhiui", + location; + operands, + owned_regions, + successors, + attributes, results=(length(op_ty_results) == 0 ? nothing : op_ty_results), - result_inference=(length(op_ty_results) == 0 ? true : false) + result_inference=(length(op_ty_results) == 0 ? true : false), ) end @@ -782,19 +1101,25 @@ end Precise div for floating point types. """ -function precise_divf(x::Value, y::Value; result=nothing::Union{Nothing, IR.Type}, location=Location()) +function precise_divf( + x::Value, y::Value; result=nothing::Union{Nothing,IR.Type}, location=Location() +) op_ty_results = IR.Type[] - operands = Value[x, y, ] + operands = Value[x, y] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(result) && push!(op_ty_results, result) - - create_operation( - "tt.precise_divf", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "tt.precise_divf", + location; + operands, + owned_regions, + successors, + attributes, results=(length(op_ty_results) == 0 ? nothing : op_ty_results), - result_inference=(length(op_ty_results) == 0 ? true : false) + result_inference=(length(op_ty_results) == 0 ? true : false), ) end @@ -803,19 +1128,23 @@ end Precise sqrt for floating point types. """ -function precise_sqrt(x::Value; result=nothing::Union{Nothing, IR.Type}, location=Location()) +function precise_sqrt(x::Value; result=nothing::Union{Nothing,IR.Type}, location=Location()) op_ty_results = IR.Type[] - operands = Value[x, ] + operands = Value[x,] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(result) && push!(op_ty_results, result) - - create_operation( - "tt.precise_sqrt", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "tt.precise_sqrt", + location; + operands, + owned_regions, + successors, + attributes, results=(length(op_ty_results) == 0 ? nothing : op_ty_results), - result_inference=(length(op_ty_results) == 0 ? true : false) + result_inference=(length(op_ty_results) == 0 ? true : false), ) end @@ -827,64 +1156,87 @@ format are generated automatically from the arguments. """ function print(args::Vector{Value}; prefix, hex, isSigned, location=Location()) op_ty_results = IR.Type[] - operands = Value[args..., ] + operands = Value[args...,] owned_regions = Region[] successors = Block[] - attributes = NamedAttribute[namedattribute("prefix", prefix), namedattribute("hex", hex), namedattribute("isSigned", isSigned), ] - - create_operation( - "tt.print", location; - operands, owned_regions, successors, attributes, + attributes = NamedAttribute[ + namedattribute("prefix", prefix), + namedattribute("hex", hex), + namedattribute("isSigned", isSigned), + ] + + return create_operation( + "tt.print", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function ptr_to_int(src::Value; result::IR.Type, location=Location()) - op_ty_results = IR.Type[result, ] - operands = Value[src, ] + op_ty_results = IR.Type[result,] + operands = Value[src,] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "tt.ptr_to_int", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "tt.ptr_to_int", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - -function reduce(srcs::Vector{Value}; result::Vector{IR.Type}, axis, combineOp::Region, location=Location()) - op_ty_results = IR.Type[result..., ] - operands = Value[srcs..., ] - owned_regions = Region[combineOp, ] +function reduce( + srcs::Vector{Value}; + result::Vector{IR.Type}, + axis, + combineOp::Region, + location=Location(), +) + op_ty_results = IR.Type[result...,] + operands = Value[srcs...,] + owned_regions = Region[combineOp,] successors = Block[] - attributes = NamedAttribute[namedattribute("axis", axis), ] - - create_operation( - "tt.reduce", location; - operands, owned_regions, successors, attributes, + attributes = NamedAttribute[namedattribute("axis", axis),] + + return create_operation( + "tt.reduce", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function reduce_return(result::Vector{Value}; location=Location()) op_ty_results = IR.Type[] - operands = Value[result..., ] + operands = Value[result...,] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "tt.reduce.return", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "tt.reduce.return", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end @@ -899,68 +1251,98 @@ elements to generate more efficient code. If efficient_layout is set, this is a hint that the destination layout should be kept for performance reason. The compiler is still free to change it for better performance. """ -function reshape(src::Value; result::IR.Type, allow_reorder=nothing, efficient_layout=nothing, location=Location()) - op_ty_results = IR.Type[result, ] - operands = Value[src, ] +function reshape( + src::Value; + result::IR.Type, + allow_reorder=nothing, + efficient_layout=nothing, + location=Location(), +) + op_ty_results = IR.Type[result,] + operands = Value[src,] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - !isnothing(allow_reorder) && push!(attributes, namedattribute("allow_reorder", allow_reorder)) - !isnothing(efficient_layout) && push!(attributes, namedattribute("efficient_layout", efficient_layout)) - - create_operation( - "tt.reshape", location; - operands, owned_regions, successors, attributes, + !isnothing(allow_reorder) && + push!(attributes, namedattribute("allow_reorder", allow_reorder)) + !isnothing(efficient_layout) && + push!(attributes, namedattribute("efficient_layout", efficient_layout)) + + return create_operation( + "tt.reshape", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - -function scan(srcs::Vector{Value}; result::Vector{IR.Type}, axis, reverse, combineOp::Region, location=Location()) - op_ty_results = IR.Type[result..., ] - operands = Value[srcs..., ] - owned_regions = Region[combineOp, ] +function scan( + srcs::Vector{Value}; + result::Vector{IR.Type}, + axis, + reverse, + combineOp::Region, + location=Location(), +) + op_ty_results = IR.Type[result...,] + operands = Value[srcs...,] + owned_regions = Region[combineOp,] successors = Block[] - attributes = NamedAttribute[namedattribute("axis", axis), namedattribute("reverse", reverse), ] - - create_operation( - "tt.scan", location; - operands, owned_regions, successors, attributes, + attributes = NamedAttribute[ + namedattribute("axis", axis), namedattribute("reverse", reverse) + ] + + return create_operation( + "tt.scan", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function scan_return(result::Vector{Value}; location=Location()) op_ty_results = IR.Type[] - operands = Value[result..., ] + operands = Value[result...,] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "tt.scan.return", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "tt.scan.return", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end - function splat(src::Value; result::IR.Type, location=Location()) - op_ty_results = IR.Type[result, ] - operands = Value[src, ] + op_ty_results = IR.Type[result,] + operands = Value[src,] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] - - create_operation( - "tt.splat", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "tt.splat", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end @@ -973,40 +1355,61 @@ tensors, src[..., 0] and src[..., 1]. For example, if the input shape is 4x8x2xf32, returns two tensors of shape 4x8xf32. """ -function split(src::Value; outLHS=nothing::Union{Nothing, IR.Type}, outRHS=nothing::Union{Nothing, IR.Type}, location=Location()) +function split( + src::Value; + outLHS=nothing::Union{Nothing,IR.Type}, + outRHS=nothing::Union{Nothing,IR.Type}, + location=Location(), +) op_ty_results = IR.Type[] - operands = Value[src, ] + operands = Value[src,] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(outLHS) && push!(op_ty_results, outLHS) !isnothing(outRHS) && push!(op_ty_results, outRHS) - - create_operation( - "tt.split", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "tt.split", + location; + operands, + owned_regions, + successors, + attributes, results=(length(op_ty_results) == 0 ? nothing : op_ty_results), - result_inference=(length(op_ty_results) == 0 ? true : false) + result_inference=(length(op_ty_results) == 0 ? true : false), ) end - -function store(ptr::Value, value::Value, mask=nothing::Union{Nothing, Value}; boundaryCheck=nothing, cache=nothing, evict=nothing, location=Location()) +function store( + ptr::Value, + value::Value, + mask=nothing::Union{Nothing,Value}; + boundaryCheck=nothing, + cache=nothing, + evict=nothing, + location=Location(), +) op_ty_results = IR.Type[] - operands = Value[ptr, value, ] + operands = Value[ptr, value] owned_regions = Region[] successors = Block[] attributes = NamedAttribute[] !isnothing(mask) && push!(operands, mask) - !isnothing(boundaryCheck) && push!(attributes, namedattribute("boundaryCheck", boundaryCheck)) + !isnothing(boundaryCheck) && + push!(attributes, namedattribute("boundaryCheck", boundaryCheck)) !isnothing(cache) && push!(attributes, namedattribute("cache", cache)) !isnothing(evict) && push!(attributes, namedattribute("evict", evict)) - - create_operation( - "tt.store", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "tt.store", + location; + operands, + owned_regions, + successors, + attributes, results=op_ty_results, - result_inference=false + result_inference=false, ) end @@ -1039,19 +1442,25 @@ convertLayout ops that appear before and/or after the operation. We do this so that you can chain multiple data-movement ops (e.g. transpose+reshape+concat) without going to shared memory after each one. """ -function trans(src::Value; result=nothing::Union{Nothing, IR.Type}, order, location=Location()) +function trans( + src::Value; result=nothing::Union{Nothing,IR.Type}, order, location=Location() +) op_ty_results = IR.Type[] - operands = Value[src, ] + operands = Value[src,] owned_regions = Region[] successors = Block[] - attributes = NamedAttribute[namedattribute("order", order), ] + attributes = NamedAttribute[namedattribute("order", order),] !isnothing(result) && push!(op_ty_results, result) - - create_operation( - "tt.trans", location; - operands, owned_regions, successors, attributes, + + return create_operation( + "tt.trans", + location; + operands, + owned_regions, + successors, + attributes, results=(length(op_ty_results) == 0 ? nothing : op_ty_results), - result_inference=(length(op_ty_results) == 0 ? true : false) + result_inference=(length(op_ty_results) == 0 ? true : false), ) end diff --git a/src/mlir/Dialects/libMLIR_h.jl b/src/mlir/Dialects/libMLIR_h.jl index 7154a0230..788c30e73 100755 --- a/src/mlir/Dialects/libMLIR_h.jl +++ b/src/mlir/Dialects/libMLIR_h.jl @@ -39,7 +39,6 @@ elseif Sys.iswindows() && Sys.ARCH === :x86_64 const off_t = off32_t end - const intptr_t = Clong struct MlirDialectHandle @@ -236,7 +235,9 @@ end Allocates a type id that is valid for the lifetime of the allocator """ function mlirTypeIDAllocatorAllocateTypeID(allocator) - @ccall mlir_c.mlirTypeIDAllocatorAllocateTypeID(allocator::MlirTypeIDAllocator)::MlirTypeID + @ccall mlir_c.mlirTypeIDAllocatorAllocateTypeID( + allocator::MlirTypeIDAllocator + )::MlirTypeID end struct MlirAsmState @@ -343,7 +344,9 @@ end Creates an MLIR context, setting the multithreading setting explicitly and pre-loading the dialects from the provided DialectRegistry. """ function mlirContextCreateWithRegistry(registry, threadingEnabled) - @ccall mlir_c.mlirContextCreateWithRegistry(registry::MlirDialectRegistry, threadingEnabled::Bool)::MlirContext + @ccall mlir_c.mlirContextCreateWithRegistry( + registry::MlirDialectRegistry, threadingEnabled::Bool + )::MlirContext end """ @@ -379,7 +382,9 @@ end Sets whether unregistered dialects are allowed in this context. """ function mlirContextSetAllowUnregisteredDialects(context, allow) - @ccall mlir_c.mlirContextSetAllowUnregisteredDialects(context::MlirContext, allow::Bool)::Cvoid + @ccall mlir_c.mlirContextSetAllowUnregisteredDialects( + context::MlirContext, allow::Bool + )::Cvoid end """ @@ -406,7 +411,9 @@ end Append the contents of the given dialect registry to the registry associated with the context. """ function mlirContextAppendDialectRegistry(ctx, registry) - @ccall mlir_c.mlirContextAppendDialectRegistry(ctx::MlirContext, registry::MlirDialectRegistry)::Cvoid + @ccall mlir_c.mlirContextAppendDialectRegistry( + ctx::MlirContext, registry::MlirDialectRegistry + )::Cvoid end """ @@ -424,7 +431,9 @@ end Gets the dialect instance owned by the given context using the dialect namespace to identify it, loads (i.e., constructs the instance of) the dialect if necessary. If the dialect is not registered with the context, returns null. Use mlirContextLoadDialect to load an unregistered dialect. """ function mlirContextGetOrLoadDialect(context, name) - @ccall mlir_c.mlirContextGetOrLoadDialect(context::MlirContext, name::MlirStringRef)::MlirDialect + @ccall mlir_c.mlirContextGetOrLoadDialect( + context::MlirContext, name::MlirStringRef + )::MlirDialect end """ @@ -451,7 +460,9 @@ end 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. """ function mlirContextIsRegisteredOperation(context, name) - @ccall mlir_c.mlirContextIsRegisteredOperation(context::MlirContext, name::MlirStringRef)::Bool + @ccall mlir_c.mlirContextIsRegisteredOperation( + context::MlirContext, name::MlirStringRef + )::Bool end """ @@ -460,7 +471,9 @@ end 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. """ function mlirContextSetThreadPool(context, threadPool) - @ccall mlir_c.mlirContextSetThreadPool(context::MlirContext, threadPool::MlirLlvmThreadPool)::Cvoid + @ccall mlir_c.mlirContextSetThreadPool( + context::MlirContext, threadPool::MlirLlvmThreadPool + )::Cvoid end """ @@ -514,7 +527,9 @@ end Inserts the dialect associated with the provided dialect handle into the provided dialect registry """ function mlirDialectHandleInsertDialect(arg1, arg2) - @ccall mlir_c.mlirDialectHandleInsertDialect(arg1::MlirDialectHandle, arg2::MlirDialectRegistry)::Cvoid + @ccall mlir_c.mlirDialectHandleInsertDialect( + arg1::MlirDialectHandle, arg2::MlirDialectRegistry + )::Cvoid end """ @@ -523,7 +538,9 @@ end Registers the dialect associated with the provided dialect handle. """ function mlirDialectHandleRegisterDialect(arg1, arg2) - @ccall mlir_c.mlirDialectHandleRegisterDialect(arg1::MlirDialectHandle, arg2::MlirContext)::Cvoid + @ccall mlir_c.mlirDialectHandleRegisterDialect( + arg1::MlirDialectHandle, arg2::MlirContext + )::Cvoid end """ @@ -532,7 +549,9 @@ end Loads the dialect associated with the provided dialect handle. """ function mlirDialectHandleLoadDialect(arg1, arg2) - @ccall mlir_c.mlirDialectHandleLoadDialect(arg1::MlirDialectHandle, arg2::MlirContext)::MlirDialect + @ccall mlir_c.mlirDialectHandleLoadDialect( + arg1::MlirDialectHandle, arg2::MlirContext + )::MlirDialect end """ @@ -586,7 +605,9 @@ end Creates an File/Line/Column location owned by the given context. """ function mlirLocationFileLineColGet(context, filename, line, col) - @ccall mlir_c.mlirLocationFileLineColGet(context::MlirContext, filename::MlirStringRef, line::Cuint, col::Cuint)::MlirLocation + @ccall mlir_c.mlirLocationFileLineColGet( + context::MlirContext, filename::MlirStringRef, line::Cuint, col::Cuint + )::MlirLocation end """ @@ -595,7 +616,9 @@ end Creates a call site location with a callee and a caller. """ function mlirLocationCallSiteGet(callee, caller) - @ccall mlir_c.mlirLocationCallSiteGet(callee::MlirLocation, caller::MlirLocation)::MlirLocation + @ccall mlir_c.mlirLocationCallSiteGet( + callee::MlirLocation, caller::MlirLocation + )::MlirLocation end """ @@ -604,7 +627,12 @@ end Creates a fused location with an array of locations and metadata. """ function mlirLocationFusedGet(ctx, nLocations, locations, metadata) - @ccall mlir_c.mlirLocationFusedGet(ctx::MlirContext, nLocations::intptr_t, locations::Ptr{MlirLocation}, metadata::MlirAttribute)::MlirLocation + @ccall mlir_c.mlirLocationFusedGet( + ctx::MlirContext, + nLocations::intptr_t, + locations::Ptr{MlirLocation}, + metadata::MlirAttribute, + )::MlirLocation end """ @@ -613,7 +641,9 @@ end 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. """ function mlirLocationNameGet(context, name, childLoc) - @ccall mlir_c.mlirLocationNameGet(context::MlirContext, name::MlirStringRef, childLoc::MlirLocation)::MlirLocation + @ccall mlir_c.mlirLocationNameGet( + context::MlirContext, name::MlirStringRef, childLoc::MlirLocation + )::MlirLocation end """ @@ -658,7 +688,9 @@ end Prints a location by sending chunks of the string representation and forwarding `userData to `callback`. Note that the callback may be called several times with consecutive chunks of the string. """ function mlirLocationPrint(location, callback, userData) - @ccall mlir_c.mlirLocationPrint(location::MlirLocation, callback::MlirStringCallback, userData::Ptr{Cvoid})::Cvoid + @ccall mlir_c.mlirLocationPrint( + location::MlirLocation, callback::MlirStringCallback, userData::Ptr{Cvoid} + )::Cvoid end """ @@ -676,7 +708,9 @@ end Parses a module from the string and transfers ownership to the caller. """ function mlirModuleCreateParse(context, _module) - @ccall mlir_c.mlirModuleCreateParse(context::MlirContext, _module::MlirStringRef)::MlirModule + @ccall mlir_c.mlirModuleCreateParse( + context::MlirContext, _module::MlirStringRef + )::MlirModule end """ @@ -762,7 +796,9 @@ end Constructs an operation state from a name and a location. """ function mlirOperationStateGet(name, loc) - @ccall mlir_c.mlirOperationStateGet(name::MlirStringRef, loc::MlirLocation)::MlirOperationState + @ccall mlir_c.mlirOperationStateGet( + name::MlirStringRef, loc::MlirLocation + )::MlirOperationState end """ @@ -771,23 +807,33 @@ end Adds a list of components to the operation state. """ function mlirOperationStateAddResults(state, n, results) - @ccall mlir_c.mlirOperationStateAddResults(state::Ptr{MlirOperationState}, n::intptr_t, results::Ptr{MlirType})::Cvoid + @ccall mlir_c.mlirOperationStateAddResults( + state::Ptr{MlirOperationState}, n::intptr_t, results::Ptr{MlirType} + )::Cvoid end function mlirOperationStateAddOperands(state, n, operands) - @ccall mlir_c.mlirOperationStateAddOperands(state::Ptr{MlirOperationState}, n::intptr_t, operands::Ptr{MlirValue})::Cvoid + @ccall mlir_c.mlirOperationStateAddOperands( + state::Ptr{MlirOperationState}, n::intptr_t, operands::Ptr{MlirValue} + )::Cvoid end function mlirOperationStateAddOwnedRegions(state, n, regions) - @ccall mlir_c.mlirOperationStateAddOwnedRegions(state::Ptr{MlirOperationState}, n::intptr_t, regions::Ptr{MlirRegion})::Cvoid + @ccall mlir_c.mlirOperationStateAddOwnedRegions( + state::Ptr{MlirOperationState}, n::intptr_t, regions::Ptr{MlirRegion} + )::Cvoid end function mlirOperationStateAddSuccessors(state, n, successors) - @ccall mlir_c.mlirOperationStateAddSuccessors(state::Ptr{MlirOperationState}, n::intptr_t, successors::Ptr{MlirBlock})::Cvoid + @ccall mlir_c.mlirOperationStateAddSuccessors( + state::Ptr{MlirOperationState}, n::intptr_t, successors::Ptr{MlirBlock} + )::Cvoid end function mlirOperationStateAddAttributes(state, n, attributes) - @ccall mlir_c.mlirOperationStateAddAttributes(state::Ptr{MlirOperationState}, n::intptr_t, attributes::Ptr{MlirNamedAttribute})::Cvoid + @ccall mlir_c.mlirOperationStateAddAttributes( + state::Ptr{MlirOperationState}, n::intptr_t, attributes::Ptr{MlirNamedAttribute} + )::Cvoid end """ @@ -796,7 +842,9 @@ end Enables result type inference for the operation under construction. If enabled, then the caller must not have called [`mlirOperationStateAddResults`](@ref)(). Note that if enabled, the [`mlirOperationCreate`](@ref)() call is failable: it will return a null operation on inference failure and will emit diagnostics. """ function mlirOperationStateEnableResultTypeInference(state) - @ccall mlir_c.mlirOperationStateEnableResultTypeInference(state::Ptr{MlirOperationState})::Cvoid + @ccall mlir_c.mlirOperationStateEnableResultTypeInference( + state::Ptr{MlirOperationState} + )::Cvoid end """ @@ -805,7 +853,9 @@ end 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`](@ref)(). """ function mlirAsmStateCreateForOperation(op, flags) - @ccall mlir_c.mlirAsmStateCreateForOperation(op::MlirOperation, flags::MlirOpPrintingFlags)::MlirAsmState + @ccall mlir_c.mlirAsmStateCreateForOperation( + op::MlirOperation, flags::MlirOpPrintingFlags + )::MlirAsmState end """ @@ -814,7 +864,9 @@ end Creates new AsmState from value. Must be freed with a call to [`mlirAsmStateDestroy`](@ref)(). """ function mlirAsmStateCreateForValue(value, flags) - @ccall mlir_c.mlirAsmStateCreateForValue(value::MlirValue, flags::MlirOpPrintingFlags)::MlirAsmState + @ccall mlir_c.mlirAsmStateCreateForValue( + value::MlirValue, flags::MlirOpPrintingFlags + )::MlirAsmState end """ @@ -850,7 +902,9 @@ end 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. """ function mlirOpPrintingFlagsElideLargeElementsAttrs(flags, largeElementLimit) - @ccall mlir_c.mlirOpPrintingFlagsElideLargeElementsAttrs(flags::MlirOpPrintingFlags, largeElementLimit::intptr_t)::Cvoid + @ccall mlir_c.mlirOpPrintingFlagsElideLargeElementsAttrs( + flags::MlirOpPrintingFlags, largeElementLimit::intptr_t + )::Cvoid end """ @@ -859,7 +913,9 @@ end 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. """ function mlirOpPrintingFlagsElideLargeResourceString(flags, largeResourceLimit) - @ccall mlir_c.mlirOpPrintingFlagsElideLargeResourceString(flags::MlirOpPrintingFlags, largeResourceLimit::intptr_t)::Cvoid + @ccall mlir_c.mlirOpPrintingFlagsElideLargeResourceString( + flags::MlirOpPrintingFlags, largeResourceLimit::intptr_t + )::Cvoid end """ @@ -868,7 +924,9 @@ end 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. """ function mlirOpPrintingFlagsEnableDebugInfo(flags, enable, prettyForm) - @ccall mlir_c.mlirOpPrintingFlagsEnableDebugInfo(flags::MlirOpPrintingFlags, enable::Bool, prettyForm::Bool)::Cvoid + @ccall mlir_c.mlirOpPrintingFlagsEnableDebugInfo( + flags::MlirOpPrintingFlags, enable::Bool, prettyForm::Bool + )::Cvoid end """ @@ -931,7 +989,9 @@ end Sets the version to emit in the writer config. """ function mlirBytecodeWriterConfigDesiredEmitVersion(flags, version) - @ccall mlir_c.mlirBytecodeWriterConfigDesiredEmitVersion(flags::MlirBytecodeWriterConfig, version::Int64)::Cvoid + @ccall mlir_c.mlirBytecodeWriterConfigDesiredEmitVersion( + flags::MlirBytecodeWriterConfig, version::Int64 + )::Cvoid end """ @@ -953,7 +1013,9 @@ Parses an operation, giving ownership to the caller. If parsing fails a null ope `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. """ function mlirOperationCreateParse(context, sourceStr, sourceName) - @ccall mlir_c.mlirOperationCreateParse(context::MlirContext, sourceStr::MlirStringRef, sourceName::MlirStringRef)::MlirOperation + @ccall mlir_c.mlirOperationCreateParse( + context::MlirContext, sourceStr::MlirStringRef, sourceName::MlirStringRef + )::MlirOperation end """ @@ -1106,7 +1168,9 @@ end Sets the `pos`-th operand of the operation. """ function mlirOperationSetOperand(op, pos, newValue) - @ccall mlir_c.mlirOperationSetOperand(op::MlirOperation, pos::intptr_t, newValue::MlirValue)::Cvoid + @ccall mlir_c.mlirOperationSetOperand( + op::MlirOperation, pos::intptr_t, newValue::MlirValue + )::Cvoid end """ @@ -1115,7 +1179,9 @@ end Replaces the operands of the operation. """ function mlirOperationSetOperands(op, nOperands, operands) - @ccall mlir_c.mlirOperationSetOperands(op::MlirOperation, nOperands::intptr_t, operands::Ptr{MlirValue})::Cvoid + @ccall mlir_c.mlirOperationSetOperands( + op::MlirOperation, nOperands::intptr_t, operands::Ptr{MlirValue} + )::Cvoid end """ @@ -1160,7 +1226,9 @@ end Set `pos`-th successor of the operation. """ function mlirOperationSetSuccessor(op, pos, block) - @ccall mlir_c.mlirOperationSetSuccessor(op::MlirOperation, pos::intptr_t, block::MlirBlock)::Cvoid + @ccall mlir_c.mlirOperationSetSuccessor( + op::MlirOperation, pos::intptr_t, block::MlirBlock + )::Cvoid end """ @@ -1169,7 +1237,9 @@ end Returns true if this operation defines an inherent attribute with this name. Note: the attribute can be optional, so [`mlirOperationGetInherentAttributeByName`](@ref) can still return a null attribute. """ function mlirOperationHasInherentAttributeByName(op, name) - @ccall mlir_c.mlirOperationHasInherentAttributeByName(op::MlirOperation, name::MlirStringRef)::Bool + @ccall mlir_c.mlirOperationHasInherentAttributeByName( + op::MlirOperation, name::MlirStringRef + )::Bool end """ @@ -1178,7 +1248,9 @@ end Returns an inherent attribute attached to the operation given its name. """ function mlirOperationGetInherentAttributeByName(op, name) - @ccall mlir_c.mlirOperationGetInherentAttributeByName(op::MlirOperation, name::MlirStringRef)::MlirAttribute + @ccall mlir_c.mlirOperationGetInherentAttributeByName( + op::MlirOperation, name::MlirStringRef + )::MlirAttribute end """ @@ -1187,7 +1259,9 @@ end Sets an inherent attribute by name, replacing the existing if it exists. This has no effect if "name" does not match an inherent attribute. """ function mlirOperationSetInherentAttributeByName(op, name, attr) - @ccall mlir_c.mlirOperationSetInherentAttributeByName(op::MlirOperation, name::MlirStringRef, attr::MlirAttribute)::Cvoid + @ccall mlir_c.mlirOperationSetInherentAttributeByName( + op::MlirOperation, name::MlirStringRef, attr::MlirAttribute + )::Cvoid end """ @@ -1205,7 +1279,9 @@ end Return `pos`-th discardable attribute of the operation. """ function mlirOperationGetDiscardableAttribute(op, pos) - @ccall mlir_c.mlirOperationGetDiscardableAttribute(op::MlirOperation, pos::intptr_t)::MlirNamedAttribute + @ccall mlir_c.mlirOperationGetDiscardableAttribute( + op::MlirOperation, pos::intptr_t + )::MlirNamedAttribute end """ @@ -1214,7 +1290,9 @@ end Returns a discardable attribute attached to the operation given its name. """ function mlirOperationGetDiscardableAttributeByName(op, name) - @ccall mlir_c.mlirOperationGetDiscardableAttributeByName(op::MlirOperation, name::MlirStringRef)::MlirAttribute + @ccall mlir_c.mlirOperationGetDiscardableAttributeByName( + op::MlirOperation, name::MlirStringRef + )::MlirAttribute end """ @@ -1223,7 +1301,9 @@ end 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`](@ref) to remove an Attribute instead. """ function mlirOperationSetDiscardableAttributeByName(op, name, attr) - @ccall mlir_c.mlirOperationSetDiscardableAttributeByName(op::MlirOperation, name::MlirStringRef, attr::MlirAttribute)::Cvoid + @ccall mlir_c.mlirOperationSetDiscardableAttributeByName( + op::MlirOperation, name::MlirStringRef, attr::MlirAttribute + )::Cvoid end """ @@ -1232,7 +1312,9 @@ end Removes a discardable attribute by name. Returns false if the attribute was not found and true if removed. """ function mlirOperationRemoveDiscardableAttributeByName(op, name) - @ccall mlir_c.mlirOperationRemoveDiscardableAttributeByName(op::MlirOperation, name::MlirStringRef)::Bool + @ccall mlir_c.mlirOperationRemoveDiscardableAttributeByName( + op::MlirOperation, name::MlirStringRef + )::Bool end """ @@ -1250,7 +1332,9 @@ end Return `pos`-th attribute of the operation. Deprecated, please use `mlirOperationGetInherentAttribute` or [`mlirOperationGetDiscardableAttribute`](@ref). """ function mlirOperationGetAttribute(op, pos) - @ccall mlir_c.mlirOperationGetAttribute(op::MlirOperation, pos::intptr_t)::MlirNamedAttribute + @ccall mlir_c.mlirOperationGetAttribute( + op::MlirOperation, pos::intptr_t + )::MlirNamedAttribute end """ @@ -1259,7 +1343,9 @@ end Returns an attribute attached to the operation given its name. Deprecated, please use [`mlirOperationGetInherentAttributeByName`](@ref) or [`mlirOperationGetDiscardableAttributeByName`](@ref). """ function mlirOperationGetAttributeByName(op, name) - @ccall mlir_c.mlirOperationGetAttributeByName(op::MlirOperation, name::MlirStringRef)::MlirAttribute + @ccall mlir_c.mlirOperationGetAttributeByName( + op::MlirOperation, name::MlirStringRef + )::MlirAttribute end """ @@ -1268,7 +1354,9 @@ end Sets an attribute by name, replacing the existing if it exists or adding a new one otherwise. Deprecated, please use [`mlirOperationSetInherentAttributeByName`](@ref) or [`mlirOperationSetDiscardableAttributeByName`](@ref). """ function mlirOperationSetAttributeByName(op, name, attr) - @ccall mlir_c.mlirOperationSetAttributeByName(op::MlirOperation, name::MlirStringRef, attr::MlirAttribute)::Cvoid + @ccall mlir_c.mlirOperationSetAttributeByName( + op::MlirOperation, name::MlirStringRef, attr::MlirAttribute + )::Cvoid end """ @@ -1277,7 +1365,9 @@ end Removes an attribute by name. Returns false if the attribute was not found and true if removed. Deprecated, please use `mlirOperationRemoveInherentAttributeByName` or [`mlirOperationRemoveDiscardableAttributeByName`](@ref). """ function mlirOperationRemoveAttributeByName(op, name) - @ccall mlir_c.mlirOperationRemoveAttributeByName(op::MlirOperation, name::MlirStringRef)::Bool + @ccall mlir_c.mlirOperationRemoveAttributeByName( + op::MlirOperation, name::MlirStringRef + )::Bool end """ @@ -1286,7 +1376,9 @@ end Prints an operation by sending chunks of the string representation and forwarding `userData to `callback`. Note that the callback may be called several times with consecutive chunks of the string. """ function mlirOperationPrint(op, callback, userData) - @ccall mlir_c.mlirOperationPrint(op::MlirOperation, callback::MlirStringCallback, userData::Ptr{Cvoid})::Cvoid + @ccall mlir_c.mlirOperationPrint( + op::MlirOperation, callback::MlirStringCallback, userData::Ptr{Cvoid} + )::Cvoid end """ @@ -1295,7 +1387,12 @@ end Same as [`mlirOperationPrint`](@ref) but accepts flags controlling the printing behavior. """ function mlirOperationPrintWithFlags(op, flags, callback, userData) - @ccall mlir_c.mlirOperationPrintWithFlags(op::MlirOperation, flags::MlirOpPrintingFlags, callback::MlirStringCallback, userData::Ptr{Cvoid})::Cvoid + @ccall mlir_c.mlirOperationPrintWithFlags( + op::MlirOperation, + flags::MlirOpPrintingFlags, + callback::MlirStringCallback, + userData::Ptr{Cvoid}, + )::Cvoid end """ @@ -1304,7 +1401,12 @@ end Same as [`mlirOperationPrint`](@ref) but accepts AsmState controlling the printing behavior as well as caching computed names. """ function mlirOperationPrintWithState(op, state, callback, userData) - @ccall mlir_c.mlirOperationPrintWithState(op::MlirOperation, state::MlirAsmState, callback::MlirStringCallback, userData::Ptr{Cvoid})::Cvoid + @ccall mlir_c.mlirOperationPrintWithState( + op::MlirOperation, + state::MlirAsmState, + callback::MlirStringCallback, + userData::Ptr{Cvoid}, + )::Cvoid end """ @@ -1313,7 +1415,9 @@ end Same as [`mlirOperationPrint`](@ref) but writing the bytecode format. """ function mlirOperationWriteBytecode(op, callback, userData) - @ccall mlir_c.mlirOperationWriteBytecode(op::MlirOperation, callback::MlirStringCallback, userData::Ptr{Cvoid})::Cvoid + @ccall mlir_c.mlirOperationWriteBytecode( + op::MlirOperation, callback::MlirStringCallback, userData::Ptr{Cvoid} + )::Cvoid end """ @@ -1322,7 +1426,12 @@ end Same as [`mlirOperationWriteBytecode`](@ref) but with writer config and returns failure only if desired bytecode could not be honored. """ function mlirOperationWriteBytecodeWithConfig(op, config, callback, userData) - @ccall mlir_c.mlirOperationWriteBytecodeWithConfig(op::MlirOperation, config::MlirBytecodeWriterConfig, callback::MlirStringCallback, userData::Ptr{Cvoid})::MlirLogicalResult + @ccall mlir_c.mlirOperationWriteBytecodeWithConfig( + op::MlirOperation, + config::MlirBytecodeWriterConfig, + callback::MlirStringCallback, + userData::Ptr{Cvoid}, + )::MlirLogicalResult end """ @@ -1394,7 +1503,12 @@ const MlirOperationWalkCallback = Ptr{Cvoid} 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. """ function mlirOperationWalk(op, callback, userData, walkOrder) - @ccall mlir_c.mlirOperationWalk(op::MlirOperation, callback::MlirOperationWalkCallback, userData::Ptr{Cvoid}, walkOrder::MlirWalkOrder)::Cvoid + @ccall mlir_c.mlirOperationWalk( + op::MlirOperation, + callback::MlirOperationWalkCallback, + userData::Ptr{Cvoid}, + walkOrder::MlirWalkOrder, + )::Cvoid end """ @@ -1457,7 +1571,9 @@ end 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. """ function mlirRegionInsertOwnedBlock(region, pos, block) - @ccall mlir_c.mlirRegionInsertOwnedBlock(region::MlirRegion, pos::intptr_t, block::MlirBlock)::Cvoid + @ccall mlir_c.mlirRegionInsertOwnedBlock( + region::MlirRegion, pos::intptr_t, block::MlirBlock + )::Cvoid end """ @@ -1466,7 +1582,9 @@ end 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. """ function mlirRegionInsertOwnedBlockAfter(region, reference, block) - @ccall mlir_c.mlirRegionInsertOwnedBlockAfter(region::MlirRegion, reference::MlirBlock, block::MlirBlock)::Cvoid + @ccall mlir_c.mlirRegionInsertOwnedBlockAfter( + region::MlirRegion, reference::MlirBlock, block::MlirBlock + )::Cvoid end """ @@ -1475,7 +1593,9 @@ end 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. """ function mlirRegionInsertOwnedBlockBefore(region, reference, block) - @ccall mlir_c.mlirRegionInsertOwnedBlockBefore(region::MlirRegion, reference::MlirBlock, block::MlirBlock)::Cvoid + @ccall mlir_c.mlirRegionInsertOwnedBlockBefore( + region::MlirRegion, reference::MlirBlock, block::MlirBlock + )::Cvoid end """ @@ -1511,7 +1631,9 @@ end Creates a new empty block with the given argument types and transfers ownership to the caller. """ function mlirBlockCreate(nArgs, args, locs) - @ccall mlir_c.mlirBlockCreate(nArgs::intptr_t, args::Ptr{MlirType}, locs::Ptr{MlirLocation})::MlirBlock + @ccall mlir_c.mlirBlockCreate( + nArgs::intptr_t, args::Ptr{MlirType}, locs::Ptr{MlirLocation} + )::MlirBlock end """ @@ -1601,7 +1723,9 @@ end Takes an operation owned by the caller and appends it to the block. """ function mlirBlockAppendOwnedOperation(block, operation) - @ccall mlir_c.mlirBlockAppendOwnedOperation(block::MlirBlock, operation::MlirOperation)::Cvoid + @ccall mlir_c.mlirBlockAppendOwnedOperation( + block::MlirBlock, operation::MlirOperation + )::Cvoid end """ @@ -1610,7 +1734,9 @@ end 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. """ function mlirBlockInsertOwnedOperation(block, pos, operation) - @ccall mlir_c.mlirBlockInsertOwnedOperation(block::MlirBlock, pos::intptr_t, operation::MlirOperation)::Cvoid + @ccall mlir_c.mlirBlockInsertOwnedOperation( + block::MlirBlock, pos::intptr_t, operation::MlirOperation + )::Cvoid end """ @@ -1619,7 +1745,9 @@ end 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. """ function mlirBlockInsertOwnedOperationAfter(block, reference, operation) - @ccall mlir_c.mlirBlockInsertOwnedOperationAfter(block::MlirBlock, reference::MlirOperation, operation::MlirOperation)::Cvoid + @ccall mlir_c.mlirBlockInsertOwnedOperationAfter( + block::MlirBlock, reference::MlirOperation, operation::MlirOperation + )::Cvoid end """ @@ -1628,7 +1756,9 @@ end 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. """ function mlirBlockInsertOwnedOperationBefore(block, reference, operation) - @ccall mlir_c.mlirBlockInsertOwnedOperationBefore(block::MlirBlock, reference::MlirOperation, operation::MlirOperation)::Cvoid + @ccall mlir_c.mlirBlockInsertOwnedOperationBefore( + block::MlirBlock, reference::MlirOperation, operation::MlirOperation + )::Cvoid end """ @@ -1646,7 +1776,9 @@ end Appends an argument of the specified type to the block. Returns the newly added argument. """ function mlirBlockAddArgument(block, type, loc) - @ccall mlir_c.mlirBlockAddArgument(block::MlirBlock, type::MlirType, loc::MlirLocation)::MlirValue + @ccall mlir_c.mlirBlockAddArgument( + block::MlirBlock, type::MlirType, loc::MlirLocation + )::MlirValue end """ @@ -1664,7 +1796,9 @@ end Inserts an argument of the specified type at a specified index to the block. Returns the newly added argument. """ function mlirBlockInsertArgument(block, pos, type, loc) - @ccall mlir_c.mlirBlockInsertArgument(block::MlirBlock, pos::intptr_t, type::MlirType, loc::MlirLocation)::MlirValue + @ccall mlir_c.mlirBlockInsertArgument( + block::MlirBlock, pos::intptr_t, type::MlirType, loc::MlirLocation + )::MlirValue end """ @@ -1682,7 +1816,9 @@ end Prints a block by sending chunks of the string representation and forwarding `userData to `callback`. Note that the callback may be called several times with consecutive chunks of the string. """ function mlirBlockPrint(block, callback, userData) - @ccall mlir_c.mlirBlockPrint(block::MlirBlock, callback::MlirStringCallback, userData::Ptr{Cvoid})::Cvoid + @ccall mlir_c.mlirBlockPrint( + block::MlirBlock, callback::MlirStringCallback, userData::Ptr{Cvoid} + )::Cvoid end """ @@ -1799,7 +1935,9 @@ end Prints a value by sending chunks of the string representation and forwarding `userData to `callback`. Note that the callback may be called several times with consecutive chunks of the string. """ function mlirValuePrint(value, callback, userData) - @ccall mlir_c.mlirValuePrint(value::MlirValue, callback::MlirStringCallback, userData::Ptr{Cvoid})::Cvoid + @ccall mlir_c.mlirValuePrint( + value::MlirValue, callback::MlirStringCallback, userData::Ptr{Cvoid} + )::Cvoid end """ @@ -1808,7 +1946,12 @@ end Prints a value as an operand (i.e., the ValueID). """ function mlirValuePrintAsOperand(value, state, callback, userData) - @ccall mlir_c.mlirValuePrintAsOperand(value::MlirValue, state::MlirAsmState, callback::MlirStringCallback, userData::Ptr{Cvoid})::Cvoid + @ccall mlir_c.mlirValuePrintAsOperand( + value::MlirValue, + state::MlirAsmState, + callback::MlirStringCallback, + userData::Ptr{Cvoid}, + )::Cvoid end """ @@ -1835,7 +1978,12 @@ end 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`](@ref) pointers with a length of 'numExceptions'. """ function mlirValueReplaceAllUsesExcept(of, with, numExceptions, exceptions) - @ccall mlir_c.mlirValueReplaceAllUsesExcept(of::MlirValue, with::MlirValue, numExceptions::intptr_t, exceptions::Ptr{MlirOperation})::Cvoid + @ccall mlir_c.mlirValueReplaceAllUsesExcept( + of::MlirValue, + with::MlirValue, + numExceptions::intptr_t, + exceptions::Ptr{MlirOperation}, + )::Cvoid end """ @@ -1943,7 +2091,9 @@ end Prints a location by sending chunks of the string representation and forwarding `userData to `callback`. Note that the callback may be called several times with consecutive chunks of the string. """ function mlirTypePrint(type, callback, userData) - @ccall mlir_c.mlirTypePrint(type::MlirType, callback::MlirStringCallback, userData::Ptr{Cvoid})::Cvoid + @ccall mlir_c.mlirTypePrint( + type::MlirType, callback::MlirStringCallback, userData::Ptr{Cvoid} + )::Cvoid end """ @@ -1961,7 +2111,9 @@ end Parses an attribute. The attribute is owned by the context. """ function mlirAttributeParseGet(context, attr) - @ccall mlir_c.mlirAttributeParseGet(context::MlirContext, attr::MlirStringRef)::MlirAttribute + @ccall mlir_c.mlirAttributeParseGet( + context::MlirContext, attr::MlirStringRef + )::MlirAttribute end """ @@ -2024,7 +2176,9 @@ end Prints an attribute by sending chunks of the string representation and forwarding `userData to `callback`. Note that the callback may be called several times with consecutive chunks of the string. """ function mlirAttributePrint(attr, callback, userData) - @ccall mlir_c.mlirAttributePrint(attr::MlirAttribute, callback::MlirStringCallback, userData::Ptr{Cvoid})::Cvoid + @ccall mlir_c.mlirAttributePrint( + attr::MlirAttribute, callback::MlirStringCallback, userData::Ptr{Cvoid} + )::Cvoid end """ @@ -2042,7 +2196,9 @@ end Associates an attribute with the name. Takes ownership of neither. """ function mlirNamedAttributeGet(name, attr) - @ccall mlir_c.mlirNamedAttributeGet(name::MlirIdentifier, attr::MlirAttribute)::MlirNamedAttribute + @ccall mlir_c.mlirNamedAttributeGet( + name::MlirIdentifier, attr::MlirAttribute + )::MlirNamedAttribute end """ @@ -2051,7 +2207,9 @@ end Gets an identifier with the given string value. """ function mlirIdentifierGet(context, str) - @ccall mlir_c.mlirIdentifierGet(context::MlirContext, str::MlirStringRef)::MlirIdentifier + @ccall mlir_c.mlirIdentifierGet( + context::MlirContext, str::MlirStringRef + )::MlirIdentifier end """ @@ -2132,7 +2290,9 @@ end 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. """ function mlirSymbolTableLookup(symbolTable, name) - @ccall mlir_c.mlirSymbolTableLookup(symbolTable::MlirSymbolTable, name::MlirStringRef)::MlirOperation + @ccall mlir_c.mlirSymbolTableLookup( + symbolTable::MlirSymbolTable, name::MlirStringRef + )::MlirOperation end """ @@ -2141,7 +2301,9 @@ end 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. """ function mlirSymbolTableInsert(symbolTable, operation) - @ccall mlir_c.mlirSymbolTableInsert(symbolTable::MlirSymbolTable, operation::MlirOperation)::MlirAttribute + @ccall mlir_c.mlirSymbolTableInsert( + symbolTable::MlirSymbolTable, operation::MlirOperation + )::MlirAttribute end """ @@ -2150,7 +2312,9 @@ end Removes the given operation from the symbol table and erases it. """ function mlirSymbolTableErase(symbolTable, operation) - @ccall mlir_c.mlirSymbolTableErase(symbolTable::MlirSymbolTable, operation::MlirOperation)::Cvoid + @ccall mlir_c.mlirSymbolTableErase( + symbolTable::MlirSymbolTable, operation::MlirOperation + )::Cvoid end """ @@ -2159,7 +2323,9 @@ end 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. """ function mlirSymbolTableReplaceAllSymbolUses(oldSymbol, newSymbol, from) - @ccall mlir_c.mlirSymbolTableReplaceAllSymbolUses(oldSymbol::MlirStringRef, newSymbol::MlirStringRef, from::MlirOperation)::MlirLogicalResult + @ccall mlir_c.mlirSymbolTableReplaceAllSymbolUses( + oldSymbol::MlirStringRef, newSymbol::MlirStringRef, from::MlirOperation + )::MlirLogicalResult end """ @@ -2168,7 +2334,12 @@ end 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. """ function mlirSymbolTableWalkSymbolTables(from, allSymUsesVisible, callback, userData) - @ccall mlir_c.mlirSymbolTableWalkSymbolTables(from::MlirOperation, allSymUsesVisible::Bool, callback::Ptr{Cvoid}, userData::Ptr{Cvoid})::Cvoid + @ccall mlir_c.mlirSymbolTableWalkSymbolTables( + from::MlirOperation, + allSymUsesVisible::Bool, + callback::Ptr{Cvoid}, + userData::Ptr{Cvoid}, + )::Cvoid end struct MlirAffineExpr @@ -2208,7 +2379,9 @@ end Prints an affine expression by sending chunks of the string representation and forwarding `userData to `callback`. Note that the callback may be called several times with consecutive chunks of the string. """ function mlirAffineExprPrint(affineExpr, callback, userData) - @ccall mlir_c.mlirAffineExprPrint(affineExpr::MlirAffineExpr, callback::MlirStringCallback, userData::Ptr{Cvoid})::Cvoid + @ccall mlir_c.mlirAffineExprPrint( + affineExpr::MlirAffineExpr, callback::MlirStringCallback, userData::Ptr{Cvoid} + )::Cvoid end """ @@ -2253,7 +2426,9 @@ end Checks whether the given affine expression is a multiple of 'factor'. """ function mlirAffineExprIsMultipleOf(affineExpr, factor) - @ccall mlir_c.mlirAffineExprIsMultipleOf(affineExpr::MlirAffineExpr, factor::Int64)::Bool + @ccall mlir_c.mlirAffineExprIsMultipleOf( + affineExpr::MlirAffineExpr, factor::Int64 + )::Bool end """ @@ -2262,7 +2437,9 @@ end Checks whether the given affine expression involves AffineDimExpr 'position'. """ function mlirAffineExprIsFunctionOfDim(affineExpr, position) - @ccall mlir_c.mlirAffineExprIsFunctionOfDim(affineExpr::MlirAffineExpr, position::intptr_t)::Bool + @ccall mlir_c.mlirAffineExprIsFunctionOfDim( + affineExpr::MlirAffineExpr, position::intptr_t + )::Bool end struct MlirAffineMap @@ -2275,7 +2452,9 @@ end Composes the given map with the given expression. """ function mlirAffineExprCompose(affineExpr, affineMap) - @ccall mlir_c.mlirAffineExprCompose(affineExpr::MlirAffineExpr, affineMap::MlirAffineMap)::MlirAffineExpr + @ccall mlir_c.mlirAffineExprCompose( + affineExpr::MlirAffineExpr, affineMap::MlirAffineMap + )::MlirAffineExpr end """ @@ -2320,7 +2499,9 @@ end Creates an affine symbol expression with 'position' in the context. """ function mlirAffineSymbolExprGet(ctx, position) - @ccall mlir_c.mlirAffineSymbolExprGet(ctx::MlirContext, position::intptr_t)::MlirAffineExpr + @ccall mlir_c.mlirAffineSymbolExprGet( + ctx::MlirContext, position::intptr_t + )::MlirAffineExpr end """ @@ -2347,7 +2528,9 @@ end Creates an affine constant expression with 'constant' in the context. """ function mlirAffineConstantExprGet(ctx, constant) - @ccall mlir_c.mlirAffineConstantExprGet(ctx::MlirContext, constant::Int64)::MlirAffineExpr + @ccall mlir_c.mlirAffineConstantExprGet( + ctx::MlirContext, constant::Int64 + )::MlirAffineExpr end """ @@ -2374,7 +2557,9 @@ end Creates an affine add expression with 'lhs' and 'rhs'. """ function mlirAffineAddExprGet(lhs, rhs) - @ccall mlir_c.mlirAffineAddExprGet(lhs::MlirAffineExpr, rhs::MlirAffineExpr)::MlirAffineExpr + @ccall mlir_c.mlirAffineAddExprGet( + lhs::MlirAffineExpr, rhs::MlirAffineExpr + )::MlirAffineExpr end """ @@ -2392,7 +2577,9 @@ end Creates an affine mul expression with 'lhs' and 'rhs'. """ function mlirAffineMulExprGet(lhs, rhs) - @ccall mlir_c.mlirAffineMulExprGet(lhs::MlirAffineExpr, rhs::MlirAffineExpr)::MlirAffineExpr + @ccall mlir_c.mlirAffineMulExprGet( + lhs::MlirAffineExpr, rhs::MlirAffineExpr + )::MlirAffineExpr end """ @@ -2410,7 +2597,9 @@ end Creates an affine mod expression with 'lhs' and 'rhs'. """ function mlirAffineModExprGet(lhs, rhs) - @ccall mlir_c.mlirAffineModExprGet(lhs::MlirAffineExpr, rhs::MlirAffineExpr)::MlirAffineExpr + @ccall mlir_c.mlirAffineModExprGet( + lhs::MlirAffineExpr, rhs::MlirAffineExpr + )::MlirAffineExpr end """ @@ -2428,7 +2617,9 @@ end Creates an affine floordiv expression with 'lhs' and 'rhs'. """ function mlirAffineFloorDivExprGet(lhs, rhs) - @ccall mlir_c.mlirAffineFloorDivExprGet(lhs::MlirAffineExpr, rhs::MlirAffineExpr)::MlirAffineExpr + @ccall mlir_c.mlirAffineFloorDivExprGet( + lhs::MlirAffineExpr, rhs::MlirAffineExpr + )::MlirAffineExpr end """ @@ -2446,7 +2637,9 @@ end Creates an affine ceildiv expression with 'lhs' and 'rhs'. """ function mlirAffineCeilDivExprGet(lhs, rhs) - @ccall mlir_c.mlirAffineCeilDivExprGet(lhs::MlirAffineExpr, rhs::MlirAffineExpr)::MlirAffineExpr + @ccall mlir_c.mlirAffineCeilDivExprGet( + lhs::MlirAffineExpr, rhs::MlirAffineExpr + )::MlirAffineExpr end """ @@ -2509,7 +2702,9 @@ end Prints an affine map by sending chunks of the string representation and forwarding `userData to `callback`. Note that the callback may be called several times with consecutive chunks of the string. """ function mlirAffineMapPrint(affineMap, callback, userData) - @ccall mlir_c.mlirAffineMapPrint(affineMap::MlirAffineMap, callback::MlirStringCallback, userData::Ptr{Cvoid})::Cvoid + @ccall mlir_c.mlirAffineMapPrint( + affineMap::MlirAffineMap, callback::MlirStringCallback, userData::Ptr{Cvoid} + )::Cvoid end """ @@ -2536,7 +2731,9 @@ end Creates a zero result affine map of the given dimensions and symbols in the context. The affine map is owned by the context. """ function mlirAffineMapZeroResultGet(ctx, dimCount, symbolCount) - @ccall mlir_c.mlirAffineMapZeroResultGet(ctx::MlirContext, dimCount::intptr_t, symbolCount::intptr_t)::MlirAffineMap + @ccall mlir_c.mlirAffineMapZeroResultGet( + ctx::MlirContext, dimCount::intptr_t, symbolCount::intptr_t + )::MlirAffineMap end """ @@ -2545,7 +2742,13 @@ end 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. """ function mlirAffineMapGet(ctx, dimCount, symbolCount, nAffineExprs, affineExprs) - @ccall mlir_c.mlirAffineMapGet(ctx::MlirContext, dimCount::intptr_t, symbolCount::intptr_t, nAffineExprs::intptr_t, affineExprs::Ptr{MlirAffineExpr})::MlirAffineMap + @ccall mlir_c.mlirAffineMapGet( + ctx::MlirContext, + dimCount::intptr_t, + symbolCount::intptr_t, + nAffineExprs::intptr_t, + affineExprs::Ptr{MlirAffineExpr}, + )::MlirAffineMap end """ @@ -2563,7 +2766,9 @@ end Creates an affine map with 'numDims' identity in the context. The affine map is owned by the context. """ function mlirAffineMapMultiDimIdentityGet(ctx, numDims) - @ccall mlir_c.mlirAffineMapMultiDimIdentityGet(ctx::MlirContext, numDims::intptr_t)::MlirAffineMap + @ccall mlir_c.mlirAffineMapMultiDimIdentityGet( + ctx::MlirContext, numDims::intptr_t + )::MlirAffineMap end """ @@ -2572,7 +2777,9 @@ end 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. """ function mlirAffineMapMinorIdentityGet(ctx, dims, results) - @ccall mlir_c.mlirAffineMapMinorIdentityGet(ctx::MlirContext, dims::intptr_t, results::intptr_t)::MlirAffineMap + @ccall mlir_c.mlirAffineMapMinorIdentityGet( + ctx::MlirContext, dims::intptr_t, results::intptr_t + )::MlirAffineMap end """ @@ -2581,7 +2788,9 @@ end 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. """ function mlirAffineMapPermutationGet(ctx, size, permutation) - @ccall mlir_c.mlirAffineMapPermutationGet(ctx::MlirContext, size::intptr_t, permutation::Ptr{Cuint})::MlirAffineMap + @ccall mlir_c.mlirAffineMapPermutationGet( + ctx::MlirContext, size::intptr_t, permutation::Ptr{Cuint} + )::MlirAffineMap end """ @@ -2662,7 +2871,9 @@ end Returns the result at the given position. """ function mlirAffineMapGetResult(affineMap, pos) - @ccall mlir_c.mlirAffineMapGetResult(affineMap::MlirAffineMap, pos::intptr_t)::MlirAffineExpr + @ccall mlir_c.mlirAffineMapGetResult( + affineMap::MlirAffineMap, pos::intptr_t + )::MlirAffineExpr end """ @@ -2698,7 +2909,9 @@ end Returns the affine map consisting of the `resultPos` subset. """ function mlirAffineMapGetSubMap(affineMap, size, resultPos) - @ccall mlir_c.mlirAffineMapGetSubMap(affineMap::MlirAffineMap, size::intptr_t, resultPos::Ptr{intptr_t})::MlirAffineMap + @ccall mlir_c.mlirAffineMapGetSubMap( + affineMap::MlirAffineMap, size::intptr_t, resultPos::Ptr{intptr_t} + )::MlirAffineMap end """ @@ -2707,7 +2920,9 @@ end 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. """ function mlirAffineMapGetMajorSubMap(affineMap, numResults) - @ccall mlir_c.mlirAffineMapGetMajorSubMap(affineMap::MlirAffineMap, numResults::intptr_t)::MlirAffineMap + @ccall mlir_c.mlirAffineMapGetMajorSubMap( + affineMap::MlirAffineMap, numResults::intptr_t + )::MlirAffineMap end """ @@ -2716,7 +2931,9 @@ end 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. """ function mlirAffineMapGetMinorSubMap(affineMap, numResults) - @ccall mlir_c.mlirAffineMapGetMinorSubMap(affineMap::MlirAffineMap, numResults::intptr_t)::MlirAffineMap + @ccall mlir_c.mlirAffineMapGetMinorSubMap( + affineMap::MlirAffineMap, numResults::intptr_t + )::MlirAffineMap end """ @@ -2724,8 +2941,16 @@ end 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. """ -function mlirAffineMapReplace(affineMap, expression, replacement, numResultDims, numResultSyms) - @ccall mlir_c.mlirAffineMapReplace(affineMap::MlirAffineMap, expression::MlirAffineExpr, replacement::MlirAffineExpr, numResultDims::intptr_t, numResultSyms::intptr_t)::MlirAffineMap +function mlirAffineMapReplace( + affineMap, expression, replacement, numResultDims, numResultSyms +) + @ccall mlir_c.mlirAffineMapReplace( + affineMap::MlirAffineMap, + expression::MlirAffineExpr, + replacement::MlirAffineExpr, + numResultDims::intptr_t, + numResultSyms::intptr_t, + )::MlirAffineMap end """ @@ -2734,7 +2959,12 @@ end 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. """ function mlirAffineMapCompressUnusedSymbols(affineMaps, size, result, populateResult) - @ccall mlir_c.mlirAffineMapCompressUnusedSymbols(affineMaps::Ptr{MlirAffineMap}, size::intptr_t, result::Ptr{Cvoid}, populateResult::Ptr{Cvoid})::Cvoid + @ccall mlir_c.mlirAffineMapCompressUnusedSymbols( + affineMaps::Ptr{MlirAffineMap}, + size::intptr_t, + result::Ptr{Cvoid}, + populateResult::Ptr{Cvoid}, + )::Cvoid end struct MlirIntegerSet @@ -2774,7 +3004,9 @@ end Prints an integer set by sending chunks of the string representation and forwarding `userData to `callback`. Note that the callback may be called several times with consecutive chunks of the string. """ function mlirIntegerSetPrint(set, callback, userData) - @ccall mlir_c.mlirIntegerSetPrint(set::MlirIntegerSet, callback::MlirStringCallback, userData::Ptr{Cvoid})::Cvoid + @ccall mlir_c.mlirIntegerSetPrint( + set::MlirIntegerSet, callback::MlirStringCallback, userData::Ptr{Cvoid} + )::Cvoid end """ @@ -2792,7 +3024,9 @@ end Gets or creates a new canonically empty integer set with the give number of dimensions and symbols in the given context. """ function mlirIntegerSetEmptyGet(context, numDims, numSymbols) - @ccall mlir_c.mlirIntegerSetEmptyGet(context::MlirContext, numDims::intptr_t, numSymbols::intptr_t)::MlirIntegerSet + @ccall mlir_c.mlirIntegerSetEmptyGet( + context::MlirContext, numDims::intptr_t, numSymbols::intptr_t + )::MlirIntegerSet end """ @@ -2800,8 +3034,17 @@ end 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. """ -function mlirIntegerSetGet(context, numDims, numSymbols, numConstraints, constraints, eqFlags) - @ccall mlir_c.mlirIntegerSetGet(context::MlirContext, numDims::intptr_t, numSymbols::intptr_t, numConstraints::intptr_t, constraints::Ptr{MlirAffineExpr}, eqFlags::Ptr{Bool})::MlirIntegerSet +function mlirIntegerSetGet( + context, numDims, numSymbols, numConstraints, constraints, eqFlags +) + @ccall mlir_c.mlirIntegerSetGet( + context::MlirContext, + numDims::intptr_t, + numSymbols::intptr_t, + numConstraints::intptr_t, + constraints::Ptr{MlirAffineExpr}, + eqFlags::Ptr{Bool}, + )::MlirIntegerSet end """ @@ -2809,8 +3052,16 @@ end 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. """ -function mlirIntegerSetReplaceGet(set, dimReplacements, symbolReplacements, numResultDims, numResultSymbols) - @ccall mlir_c.mlirIntegerSetReplaceGet(set::MlirIntegerSet, dimReplacements::Ptr{MlirAffineExpr}, symbolReplacements::Ptr{MlirAffineExpr}, numResultDims::intptr_t, numResultSymbols::intptr_t)::MlirIntegerSet +function mlirIntegerSetReplaceGet( + set, dimReplacements, symbolReplacements, numResultDims, numResultSymbols +) + @ccall mlir_c.mlirIntegerSetReplaceGet( + set::MlirIntegerSet, + dimReplacements::Ptr{MlirAffineExpr}, + symbolReplacements::Ptr{MlirAffineExpr}, + numResultDims::intptr_t, + numResultSymbols::intptr_t, + )::MlirIntegerSet end """ @@ -2882,7 +3133,9 @@ end Returns `pos`-th constraint of the set. """ function mlirIntegerSetGetConstraint(set, pos) - @ccall mlir_c.mlirIntegerSetGetConstraint(set::MlirIntegerSet, pos::intptr_t)::MlirAffineExpr + @ccall mlir_c.mlirIntegerSetGetConstraint( + set::MlirIntegerSet, pos::intptr_t + )::MlirAffineExpr end """ @@ -2958,7 +3211,9 @@ end Creates an array element containing the given list of elements in the given context. """ function mlirArrayAttrGet(ctx, numElements, elements) - @ccall mlir_c.mlirArrayAttrGet(ctx::MlirContext, numElements::intptr_t, elements::Ptr{MlirAttribute})::MlirAttribute + @ccall mlir_c.mlirArrayAttrGet( + ctx::MlirContext, numElements::intptr_t, elements::Ptr{MlirAttribute} + )::MlirAttribute end """ @@ -3003,7 +3258,9 @@ end Creates a dictionary attribute containing the given list of elements in the provided context. """ function mlirDictionaryAttrGet(ctx, numElements, elements) - @ccall mlir_c.mlirDictionaryAttrGet(ctx::MlirContext, numElements::intptr_t, elements::Ptr{MlirNamedAttribute})::MlirAttribute + @ccall mlir_c.mlirDictionaryAttrGet( + ctx::MlirContext, numElements::intptr_t, elements::Ptr{MlirNamedAttribute} + )::MlirAttribute end """ @@ -3021,7 +3278,9 @@ end Returns pos-th element of the given dictionary attribute. """ function mlirDictionaryAttrGetElement(attr, pos) - @ccall mlir_c.mlirDictionaryAttrGetElement(attr::MlirAttribute, pos::intptr_t)::MlirNamedAttribute + @ccall mlir_c.mlirDictionaryAttrGetElement( + attr::MlirAttribute, pos::intptr_t + )::MlirNamedAttribute end """ @@ -3030,7 +3289,9 @@ end Returns the dictionary attribute element with the given name or NULL if the given name does not exist in the dictionary. """ function mlirDictionaryAttrGetElementByName(attr, name) - @ccall mlir_c.mlirDictionaryAttrGetElementByName(attr::MlirAttribute, name::MlirStringRef)::MlirAttribute + @ccall mlir_c.mlirDictionaryAttrGetElementByName( + attr::MlirAttribute, name::MlirStringRef + )::MlirAttribute end """ @@ -3057,7 +3318,9 @@ end Creates a floating point attribute in the given context with the given double value and double-precision FP semantics. """ function mlirFloatAttrDoubleGet(ctx, type, value) - @ccall mlir_c.mlirFloatAttrDoubleGet(ctx::MlirContext, type::MlirType, value::Cdouble)::MlirAttribute + @ccall mlir_c.mlirFloatAttrDoubleGet( + ctx::MlirContext, type::MlirType, value::Cdouble + )::MlirAttribute end """ @@ -3066,7 +3329,9 @@ end Same as "[`mlirFloatAttrDoubleGet`](@ref)", but if the type is not valid for a construction of a FloatAttr, returns a null [`MlirAttribute`](@ref). """ function mlirFloatAttrDoubleGetChecked(loc, type, value) - @ccall mlir_c.mlirFloatAttrDoubleGetChecked(loc::MlirLocation, type::MlirType, value::Cdouble)::MlirAttribute + @ccall mlir_c.mlirFloatAttrDoubleGetChecked( + loc::MlirLocation, type::MlirType, value::Cdouble + )::MlirAttribute end """ @@ -3219,7 +3484,13 @@ end 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). """ function mlirOpaqueAttrGet(ctx, dialectNamespace, dataLength, data, type) - @ccall mlir_c.mlirOpaqueAttrGet(ctx::MlirContext, dialectNamespace::MlirStringRef, dataLength::intptr_t, data::Cstring, type::MlirType)::MlirAttribute + @ccall mlir_c.mlirOpaqueAttrGet( + ctx::MlirContext, + dialectNamespace::MlirStringRef, + dataLength::intptr_t, + data::Cstring, + type::MlirType, + )::MlirAttribute end """ @@ -3309,7 +3580,12 @@ end 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. """ function mlirSymbolRefAttrGet(ctx, symbol, numReferences, references) - @ccall mlir_c.mlirSymbolRefAttrGet(ctx::MlirContext, symbol::MlirStringRef, numReferences::intptr_t, references::Ptr{MlirAttribute})::MlirAttribute + @ccall mlir_c.mlirSymbolRefAttrGet( + ctx::MlirContext, + symbol::MlirStringRef, + numReferences::intptr_t, + references::Ptr{MlirAttribute}, + )::MlirAttribute end """ @@ -3345,7 +3621,9 @@ end Returns pos-th reference nested in the given symbol reference attribute. """ function mlirSymbolRefAttrGetNestedReference(attr, pos) - @ccall mlir_c.mlirSymbolRefAttrGetNestedReference(attr::MlirAttribute, pos::intptr_t)::MlirAttribute + @ccall mlir_c.mlirSymbolRefAttrGetNestedReference( + attr::MlirAttribute, pos::intptr_t + )::MlirAttribute end """ @@ -3381,7 +3659,9 @@ end Creates a flat symbol reference attribute in the given context referencing a symbol identified by the given string. """ function mlirFlatSymbolRefAttrGet(ctx, symbol) - @ccall mlir_c.mlirFlatSymbolRefAttrGet(ctx::MlirContext, symbol::MlirStringRef)::MlirAttribute + @ccall mlir_c.mlirFlatSymbolRefAttrGet( + ctx::MlirContext, symbol::MlirStringRef + )::MlirAttribute end """ @@ -3471,7 +3751,9 @@ end Returns the element at the given rank-dimensional index. """ function mlirElementsAttrGetValue(attr, rank, idxs) - @ccall mlir_c.mlirElementsAttrGetValue(attr::MlirAttribute, rank::intptr_t, idxs::Ptr{UInt64})::MlirAttribute + @ccall mlir_c.mlirElementsAttrGetValue( + attr::MlirAttribute, rank::intptr_t, idxs::Ptr{UInt64} + )::MlirAttribute end """ @@ -3480,7 +3762,9 @@ end Checks whether the given rank-dimensional index is valid in the given elements attribute. """ function mlirElementsAttrIsValidIndex(attr, rank, idxs) - @ccall mlir_c.mlirElementsAttrIsValidIndex(attr::MlirAttribute, rank::intptr_t, idxs::Ptr{UInt64})::Bool + @ccall mlir_c.mlirElementsAttrIsValidIndex( + attr::MlirAttribute, rank::intptr_t, idxs::Ptr{UInt64} + )::Bool end """ @@ -3535,31 +3819,45 @@ end Create a dense array attribute with the given elements. """ function mlirDenseBoolArrayGet(ctx, size, values) - @ccall mlir_c.mlirDenseBoolArrayGet(ctx::MlirContext, size::intptr_t, values::Ptr{Cint})::MlirAttribute + @ccall mlir_c.mlirDenseBoolArrayGet( + ctx::MlirContext, size::intptr_t, values::Ptr{Cint} + )::MlirAttribute end function mlirDenseI8ArrayGet(ctx, size, values) - @ccall mlir_c.mlirDenseI8ArrayGet(ctx::MlirContext, size::intptr_t, values::Ptr{Int8})::MlirAttribute + @ccall mlir_c.mlirDenseI8ArrayGet( + ctx::MlirContext, size::intptr_t, values::Ptr{Int8} + )::MlirAttribute end function mlirDenseI16ArrayGet(ctx, size, values) - @ccall mlir_c.mlirDenseI16ArrayGet(ctx::MlirContext, size::intptr_t, values::Ptr{Int16})::MlirAttribute + @ccall mlir_c.mlirDenseI16ArrayGet( + ctx::MlirContext, size::intptr_t, values::Ptr{Int16} + )::MlirAttribute end function mlirDenseI32ArrayGet(ctx, size, values) - @ccall mlir_c.mlirDenseI32ArrayGet(ctx::MlirContext, size::intptr_t, values::Ptr{Int32})::MlirAttribute + @ccall mlir_c.mlirDenseI32ArrayGet( + ctx::MlirContext, size::intptr_t, values::Ptr{Int32} + )::MlirAttribute end function mlirDenseI64ArrayGet(ctx, size, values) - @ccall mlir_c.mlirDenseI64ArrayGet(ctx::MlirContext, size::intptr_t, values::Ptr{Int64})::MlirAttribute + @ccall mlir_c.mlirDenseI64ArrayGet( + ctx::MlirContext, size::intptr_t, values::Ptr{Int64} + )::MlirAttribute end function mlirDenseF32ArrayGet(ctx, size, values) - @ccall mlir_c.mlirDenseF32ArrayGet(ctx::MlirContext, size::intptr_t, values::Ptr{Cfloat})::MlirAttribute + @ccall mlir_c.mlirDenseF32ArrayGet( + ctx::MlirContext, size::intptr_t, values::Ptr{Cfloat} + )::MlirAttribute end function mlirDenseF64ArrayGet(ctx, size, values) - @ccall mlir_c.mlirDenseF64ArrayGet(ctx::MlirContext, size::intptr_t, values::Ptr{Cdouble})::MlirAttribute + @ccall mlir_c.mlirDenseF64ArrayGet( + ctx::MlirContext, size::intptr_t, values::Ptr{Cdouble} + )::MlirAttribute end """ @@ -3636,7 +3934,9 @@ end Creates a dense elements attribute with the given Shaped type and elements in the same context as the type. """ function mlirDenseElementsAttrGet(shapedType, numElements, elements) - @ccall mlir_c.mlirDenseElementsAttrGet(shapedType::MlirType, numElements::intptr_t, elements::Ptr{MlirAttribute})::MlirAttribute + @ccall mlir_c.mlirDenseElementsAttrGet( + shapedType::MlirType, numElements::intptr_t, elements::Ptr{MlirAttribute} + )::MlirAttribute end """ @@ -3649,7 +3949,9 @@ The format of the raw buffer is a densely packed array of values that can be bit 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. """ function mlirDenseElementsAttrRawBufferGet(shapedType, rawBufferSize, rawBuffer) - @ccall mlir_c.mlirDenseElementsAttrRawBufferGet(shapedType::MlirType, rawBufferSize::Csize_t, rawBuffer::Ptr{Cvoid})::MlirAttribute + @ccall mlir_c.mlirDenseElementsAttrRawBufferGet( + shapedType::MlirType, rawBufferSize::Csize_t, rawBuffer::Ptr{Cvoid} + )::MlirAttribute end """ @@ -3658,43 +3960,63 @@ end Creates a dense elements attribute with the given Shaped type containing a single replicated element (splat). """ function mlirDenseElementsAttrSplatGet(shapedType, element) - @ccall mlir_c.mlirDenseElementsAttrSplatGet(shapedType::MlirType, element::MlirAttribute)::MlirAttribute + @ccall mlir_c.mlirDenseElementsAttrSplatGet( + shapedType::MlirType, element::MlirAttribute + )::MlirAttribute end function mlirDenseElementsAttrBoolSplatGet(shapedType, element) - @ccall mlir_c.mlirDenseElementsAttrBoolSplatGet(shapedType::MlirType, element::Bool)::MlirAttribute + @ccall mlir_c.mlirDenseElementsAttrBoolSplatGet( + shapedType::MlirType, element::Bool + )::MlirAttribute end function mlirDenseElementsAttrUInt8SplatGet(shapedType, element) - @ccall mlir_c.mlirDenseElementsAttrUInt8SplatGet(shapedType::MlirType, element::UInt8)::MlirAttribute + @ccall mlir_c.mlirDenseElementsAttrUInt8SplatGet( + shapedType::MlirType, element::UInt8 + )::MlirAttribute end function mlirDenseElementsAttrInt8SplatGet(shapedType, element) - @ccall mlir_c.mlirDenseElementsAttrInt8SplatGet(shapedType::MlirType, element::Int8)::MlirAttribute + @ccall mlir_c.mlirDenseElementsAttrInt8SplatGet( + shapedType::MlirType, element::Int8 + )::MlirAttribute end function mlirDenseElementsAttrUInt32SplatGet(shapedType, element) - @ccall mlir_c.mlirDenseElementsAttrUInt32SplatGet(shapedType::MlirType, element::UInt32)::MlirAttribute + @ccall mlir_c.mlirDenseElementsAttrUInt32SplatGet( + shapedType::MlirType, element::UInt32 + )::MlirAttribute end function mlirDenseElementsAttrInt32SplatGet(shapedType, element) - @ccall mlir_c.mlirDenseElementsAttrInt32SplatGet(shapedType::MlirType, element::Int32)::MlirAttribute + @ccall mlir_c.mlirDenseElementsAttrInt32SplatGet( + shapedType::MlirType, element::Int32 + )::MlirAttribute end function mlirDenseElementsAttrUInt64SplatGet(shapedType, element) - @ccall mlir_c.mlirDenseElementsAttrUInt64SplatGet(shapedType::MlirType, element::UInt64)::MlirAttribute + @ccall mlir_c.mlirDenseElementsAttrUInt64SplatGet( + shapedType::MlirType, element::UInt64 + )::MlirAttribute end function mlirDenseElementsAttrInt64SplatGet(shapedType, element) - @ccall mlir_c.mlirDenseElementsAttrInt64SplatGet(shapedType::MlirType, element::Int64)::MlirAttribute + @ccall mlir_c.mlirDenseElementsAttrInt64SplatGet( + shapedType::MlirType, element::Int64 + )::MlirAttribute end function mlirDenseElementsAttrFloatSplatGet(shapedType, element) - @ccall mlir_c.mlirDenseElementsAttrFloatSplatGet(shapedType::MlirType, element::Cfloat)::MlirAttribute + @ccall mlir_c.mlirDenseElementsAttrFloatSplatGet( + shapedType::MlirType, element::Cfloat + )::MlirAttribute end function mlirDenseElementsAttrDoubleSplatGet(shapedType, element) - @ccall mlir_c.mlirDenseElementsAttrDoubleSplatGet(shapedType::MlirType, element::Cdouble)::MlirAttribute + @ccall mlir_c.mlirDenseElementsAttrDoubleSplatGet( + shapedType::MlirType, element::Cdouble + )::MlirAttribute end """ @@ -3703,55 +4025,81 @@ end 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. """ function mlirDenseElementsAttrBoolGet(shapedType, numElements, elements) - @ccall mlir_c.mlirDenseElementsAttrBoolGet(shapedType::MlirType, numElements::intptr_t, elements::Ptr{Cint})::MlirAttribute + @ccall mlir_c.mlirDenseElementsAttrBoolGet( + shapedType::MlirType, numElements::intptr_t, elements::Ptr{Cint} + )::MlirAttribute end function mlirDenseElementsAttrUInt8Get(shapedType, numElements, elements) - @ccall mlir_c.mlirDenseElementsAttrUInt8Get(shapedType::MlirType, numElements::intptr_t, elements::Ptr{UInt8})::MlirAttribute + @ccall mlir_c.mlirDenseElementsAttrUInt8Get( + shapedType::MlirType, numElements::intptr_t, elements::Ptr{UInt8} + )::MlirAttribute end function mlirDenseElementsAttrInt8Get(shapedType, numElements, elements) - @ccall mlir_c.mlirDenseElementsAttrInt8Get(shapedType::MlirType, numElements::intptr_t, elements::Ptr{Int8})::MlirAttribute + @ccall mlir_c.mlirDenseElementsAttrInt8Get( + shapedType::MlirType, numElements::intptr_t, elements::Ptr{Int8} + )::MlirAttribute end function mlirDenseElementsAttrUInt16Get(shapedType, numElements, elements) - @ccall mlir_c.mlirDenseElementsAttrUInt16Get(shapedType::MlirType, numElements::intptr_t, elements::Ptr{UInt16})::MlirAttribute + @ccall mlir_c.mlirDenseElementsAttrUInt16Get( + shapedType::MlirType, numElements::intptr_t, elements::Ptr{UInt16} + )::MlirAttribute end function mlirDenseElementsAttrInt16Get(shapedType, numElements, elements) - @ccall mlir_c.mlirDenseElementsAttrInt16Get(shapedType::MlirType, numElements::intptr_t, elements::Ptr{Int16})::MlirAttribute + @ccall mlir_c.mlirDenseElementsAttrInt16Get( + shapedType::MlirType, numElements::intptr_t, elements::Ptr{Int16} + )::MlirAttribute end function mlirDenseElementsAttrUInt32Get(shapedType, numElements, elements) - @ccall mlir_c.mlirDenseElementsAttrUInt32Get(shapedType::MlirType, numElements::intptr_t, elements::Ptr{UInt32})::MlirAttribute + @ccall mlir_c.mlirDenseElementsAttrUInt32Get( + shapedType::MlirType, numElements::intptr_t, elements::Ptr{UInt32} + )::MlirAttribute end function mlirDenseElementsAttrInt32Get(shapedType, numElements, elements) - @ccall mlir_c.mlirDenseElementsAttrInt32Get(shapedType::MlirType, numElements::intptr_t, elements::Ptr{Int32})::MlirAttribute + @ccall mlir_c.mlirDenseElementsAttrInt32Get( + shapedType::MlirType, numElements::intptr_t, elements::Ptr{Int32} + )::MlirAttribute end function mlirDenseElementsAttrUInt64Get(shapedType, numElements, elements) - @ccall mlir_c.mlirDenseElementsAttrUInt64Get(shapedType::MlirType, numElements::intptr_t, elements::Ptr{UInt64})::MlirAttribute + @ccall mlir_c.mlirDenseElementsAttrUInt64Get( + shapedType::MlirType, numElements::intptr_t, elements::Ptr{UInt64} + )::MlirAttribute end function mlirDenseElementsAttrInt64Get(shapedType, numElements, elements) - @ccall mlir_c.mlirDenseElementsAttrInt64Get(shapedType::MlirType, numElements::intptr_t, elements::Ptr{Int64})::MlirAttribute + @ccall mlir_c.mlirDenseElementsAttrInt64Get( + shapedType::MlirType, numElements::intptr_t, elements::Ptr{Int64} + )::MlirAttribute end function mlirDenseElementsAttrFloatGet(shapedType, numElements, elements) - @ccall mlir_c.mlirDenseElementsAttrFloatGet(shapedType::MlirType, numElements::intptr_t, elements::Ptr{Cfloat})::MlirAttribute + @ccall mlir_c.mlirDenseElementsAttrFloatGet( + shapedType::MlirType, numElements::intptr_t, elements::Ptr{Cfloat} + )::MlirAttribute end function mlirDenseElementsAttrDoubleGet(shapedType, numElements, elements) - @ccall mlir_c.mlirDenseElementsAttrDoubleGet(shapedType::MlirType, numElements::intptr_t, elements::Ptr{Cdouble})::MlirAttribute + @ccall mlir_c.mlirDenseElementsAttrDoubleGet( + shapedType::MlirType, numElements::intptr_t, elements::Ptr{Cdouble} + )::MlirAttribute end function mlirDenseElementsAttrBFloat16Get(shapedType, numElements, elements) - @ccall mlir_c.mlirDenseElementsAttrBFloat16Get(shapedType::MlirType, numElements::intptr_t, elements::Ptr{UInt16})::MlirAttribute + @ccall mlir_c.mlirDenseElementsAttrBFloat16Get( + shapedType::MlirType, numElements::intptr_t, elements::Ptr{UInt16} + )::MlirAttribute end function mlirDenseElementsAttrFloat16Get(shapedType, numElements, elements) - @ccall mlir_c.mlirDenseElementsAttrFloat16Get(shapedType::MlirType, numElements::intptr_t, elements::Ptr{UInt16})::MlirAttribute + @ccall mlir_c.mlirDenseElementsAttrFloat16Get( + shapedType::MlirType, numElements::intptr_t, elements::Ptr{UInt16} + )::MlirAttribute end """ @@ -3760,7 +4108,9 @@ end Creates a dense elements attribute with the given shaped type from string elements. """ function mlirDenseElementsAttrStringGet(shapedType, numElements, strs) - @ccall mlir_c.mlirDenseElementsAttrStringGet(shapedType::MlirType, numElements::intptr_t, strs::Ptr{MlirStringRef})::MlirAttribute + @ccall mlir_c.mlirDenseElementsAttrStringGet( + shapedType::MlirType, numElements::intptr_t, strs::Ptr{MlirStringRef} + )::MlirAttribute end """ @@ -3769,7 +4119,9 @@ end 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. """ function mlirDenseElementsAttrReshapeGet(attr, shapedType) - @ccall mlir_c.mlirDenseElementsAttrReshapeGet(attr::MlirAttribute, shapedType::MlirType)::MlirAttribute + @ccall mlir_c.mlirDenseElementsAttrReshapeGet( + attr::MlirAttribute, shapedType::MlirType + )::MlirAttribute end """ @@ -3827,7 +4179,9 @@ function mlirDenseElementsAttrGetDoubleSplatValue(attr) end function mlirDenseElementsAttrGetStringSplatValue(attr) - @ccall mlir_c.mlirDenseElementsAttrGetStringSplatValue(attr::MlirAttribute)::MlirStringRef + @ccall mlir_c.mlirDenseElementsAttrGetStringSplatValue( + attr::MlirAttribute + )::MlirStringRef end """ @@ -3836,51 +4190,75 @@ end Returns the pos-th value (flat contiguous indexing) of a specific type contained by the given dense elements attribute. """ function mlirDenseElementsAttrGetBoolValue(attr, pos) - @ccall mlir_c.mlirDenseElementsAttrGetBoolValue(attr::MlirAttribute, pos::intptr_t)::Bool + @ccall mlir_c.mlirDenseElementsAttrGetBoolValue( + attr::MlirAttribute, pos::intptr_t + )::Bool end function mlirDenseElementsAttrGetInt8Value(attr, pos) - @ccall mlir_c.mlirDenseElementsAttrGetInt8Value(attr::MlirAttribute, pos::intptr_t)::Int8 + @ccall mlir_c.mlirDenseElementsAttrGetInt8Value( + attr::MlirAttribute, pos::intptr_t + )::Int8 end function mlirDenseElementsAttrGetUInt8Value(attr, pos) - @ccall mlir_c.mlirDenseElementsAttrGetUInt8Value(attr::MlirAttribute, pos::intptr_t)::UInt8 + @ccall mlir_c.mlirDenseElementsAttrGetUInt8Value( + attr::MlirAttribute, pos::intptr_t + )::UInt8 end function mlirDenseElementsAttrGetInt16Value(attr, pos) - @ccall mlir_c.mlirDenseElementsAttrGetInt16Value(attr::MlirAttribute, pos::intptr_t)::Int16 + @ccall mlir_c.mlirDenseElementsAttrGetInt16Value( + attr::MlirAttribute, pos::intptr_t + )::Int16 end function mlirDenseElementsAttrGetUInt16Value(attr, pos) - @ccall mlir_c.mlirDenseElementsAttrGetUInt16Value(attr::MlirAttribute, pos::intptr_t)::UInt16 + @ccall mlir_c.mlirDenseElementsAttrGetUInt16Value( + attr::MlirAttribute, pos::intptr_t + )::UInt16 end function mlirDenseElementsAttrGetInt32Value(attr, pos) - @ccall mlir_c.mlirDenseElementsAttrGetInt32Value(attr::MlirAttribute, pos::intptr_t)::Int32 + @ccall mlir_c.mlirDenseElementsAttrGetInt32Value( + attr::MlirAttribute, pos::intptr_t + )::Int32 end function mlirDenseElementsAttrGetUInt32Value(attr, pos) - @ccall mlir_c.mlirDenseElementsAttrGetUInt32Value(attr::MlirAttribute, pos::intptr_t)::UInt32 + @ccall mlir_c.mlirDenseElementsAttrGetUInt32Value( + attr::MlirAttribute, pos::intptr_t + )::UInt32 end function mlirDenseElementsAttrGetInt64Value(attr, pos) - @ccall mlir_c.mlirDenseElementsAttrGetInt64Value(attr::MlirAttribute, pos::intptr_t)::Int64 + @ccall mlir_c.mlirDenseElementsAttrGetInt64Value( + attr::MlirAttribute, pos::intptr_t + )::Int64 end function mlirDenseElementsAttrGetUInt64Value(attr, pos) - @ccall mlir_c.mlirDenseElementsAttrGetUInt64Value(attr::MlirAttribute, pos::intptr_t)::UInt64 + @ccall mlir_c.mlirDenseElementsAttrGetUInt64Value( + attr::MlirAttribute, pos::intptr_t + )::UInt64 end function mlirDenseElementsAttrGetFloatValue(attr, pos) - @ccall mlir_c.mlirDenseElementsAttrGetFloatValue(attr::MlirAttribute, pos::intptr_t)::Cfloat + @ccall mlir_c.mlirDenseElementsAttrGetFloatValue( + attr::MlirAttribute, pos::intptr_t + )::Cfloat end function mlirDenseElementsAttrGetDoubleValue(attr, pos) - @ccall mlir_c.mlirDenseElementsAttrGetDoubleValue(attr::MlirAttribute, pos::intptr_t)::Cdouble + @ccall mlir_c.mlirDenseElementsAttrGetDoubleValue( + attr::MlirAttribute, pos::intptr_t + )::Cdouble end function mlirDenseElementsAttrGetStringValue(attr, pos) - @ccall mlir_c.mlirDenseElementsAttrGetStringValue(attr::MlirAttribute, pos::intptr_t)::MlirStringRef + @ccall mlir_c.mlirDenseElementsAttrGetStringValue( + attr::MlirAttribute, pos::intptr_t + )::MlirStringRef end """ @@ -3901,52 +4279,140 @@ end 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). """ -function mlirUnmanagedDenseResourceElementsAttrGet(shapedType, name, data, dataLength, dataAlignment, dataIsMutable, deleter, userData) - @ccall mlir_c.mlirUnmanagedDenseResourceElementsAttrGet(shapedType::MlirType, name::MlirStringRef, data::Ptr{Cvoid}, dataLength::Csize_t, dataAlignment::Csize_t, dataIsMutable::Bool, deleter::Ptr{Cvoid}, userData::Ptr{Cvoid})::MlirAttribute -end - -function mlirUnmanagedDenseBoolResourceElementsAttrGet(shapedType, name, numElements, elements) - @ccall mlir_c.mlirUnmanagedDenseBoolResourceElementsAttrGet(shapedType::MlirType, name::MlirStringRef, numElements::intptr_t, elements::Ptr{Cint})::MlirAttribute -end - -function mlirUnmanagedDenseUInt8ResourceElementsAttrGet(shapedType, name, numElements, elements) - @ccall mlir_c.mlirUnmanagedDenseUInt8ResourceElementsAttrGet(shapedType::MlirType, name::MlirStringRef, numElements::intptr_t, elements::Ptr{UInt8})::MlirAttribute -end - -function mlirUnmanagedDenseInt8ResourceElementsAttrGet(shapedType, name, numElements, elements) - @ccall mlir_c.mlirUnmanagedDenseInt8ResourceElementsAttrGet(shapedType::MlirType, name::MlirStringRef, numElements::intptr_t, elements::Ptr{Int8})::MlirAttribute -end - -function mlirUnmanagedDenseUInt16ResourceElementsAttrGet(shapedType, name, numElements, elements) - @ccall mlir_c.mlirUnmanagedDenseUInt16ResourceElementsAttrGet(shapedType::MlirType, name::MlirStringRef, numElements::intptr_t, elements::Ptr{UInt16})::MlirAttribute -end - -function mlirUnmanagedDenseInt16ResourceElementsAttrGet(shapedType, name, numElements, elements) - @ccall mlir_c.mlirUnmanagedDenseInt16ResourceElementsAttrGet(shapedType::MlirType, name::MlirStringRef, numElements::intptr_t, elements::Ptr{Int16})::MlirAttribute -end - -function mlirUnmanagedDenseUInt32ResourceElementsAttrGet(shapedType, name, numElements, elements) - @ccall mlir_c.mlirUnmanagedDenseUInt32ResourceElementsAttrGet(shapedType::MlirType, name::MlirStringRef, numElements::intptr_t, elements::Ptr{UInt32})::MlirAttribute -end - -function mlirUnmanagedDenseInt32ResourceElementsAttrGet(shapedType, name, numElements, elements) - @ccall mlir_c.mlirUnmanagedDenseInt32ResourceElementsAttrGet(shapedType::MlirType, name::MlirStringRef, numElements::intptr_t, elements::Ptr{Int32})::MlirAttribute -end - -function mlirUnmanagedDenseUInt64ResourceElementsAttrGet(shapedType, name, numElements, elements) - @ccall mlir_c.mlirUnmanagedDenseUInt64ResourceElementsAttrGet(shapedType::MlirType, name::MlirStringRef, numElements::intptr_t, elements::Ptr{UInt64})::MlirAttribute -end - -function mlirUnmanagedDenseInt64ResourceElementsAttrGet(shapedType, name, numElements, elements) - @ccall mlir_c.mlirUnmanagedDenseInt64ResourceElementsAttrGet(shapedType::MlirType, name::MlirStringRef, numElements::intptr_t, elements::Ptr{Int64})::MlirAttribute -end - -function mlirUnmanagedDenseFloatResourceElementsAttrGet(shapedType, name, numElements, elements) - @ccall mlir_c.mlirUnmanagedDenseFloatResourceElementsAttrGet(shapedType::MlirType, name::MlirStringRef, numElements::intptr_t, elements::Ptr{Cfloat})::MlirAttribute -end - -function mlirUnmanagedDenseDoubleResourceElementsAttrGet(shapedType, name, numElements, elements) - @ccall mlir_c.mlirUnmanagedDenseDoubleResourceElementsAttrGet(shapedType::MlirType, name::MlirStringRef, numElements::intptr_t, elements::Ptr{Cdouble})::MlirAttribute +function mlirUnmanagedDenseResourceElementsAttrGet( + shapedType, name, data, dataLength, dataAlignment, dataIsMutable, deleter, userData +) + @ccall mlir_c.mlirUnmanagedDenseResourceElementsAttrGet( + shapedType::MlirType, + name::MlirStringRef, + data::Ptr{Cvoid}, + dataLength::Csize_t, + dataAlignment::Csize_t, + dataIsMutable::Bool, + deleter::Ptr{Cvoid}, + userData::Ptr{Cvoid}, + )::MlirAttribute +end + +function mlirUnmanagedDenseBoolResourceElementsAttrGet( + shapedType, name, numElements, elements +) + @ccall mlir_c.mlirUnmanagedDenseBoolResourceElementsAttrGet( + shapedType::MlirType, + name::MlirStringRef, + numElements::intptr_t, + elements::Ptr{Cint}, + )::MlirAttribute +end + +function mlirUnmanagedDenseUInt8ResourceElementsAttrGet( + shapedType, name, numElements, elements +) + @ccall mlir_c.mlirUnmanagedDenseUInt8ResourceElementsAttrGet( + shapedType::MlirType, + name::MlirStringRef, + numElements::intptr_t, + elements::Ptr{UInt8}, + )::MlirAttribute +end + +function mlirUnmanagedDenseInt8ResourceElementsAttrGet( + shapedType, name, numElements, elements +) + @ccall mlir_c.mlirUnmanagedDenseInt8ResourceElementsAttrGet( + shapedType::MlirType, + name::MlirStringRef, + numElements::intptr_t, + elements::Ptr{Int8}, + )::MlirAttribute +end + +function mlirUnmanagedDenseUInt16ResourceElementsAttrGet( + shapedType, name, numElements, elements +) + @ccall mlir_c.mlirUnmanagedDenseUInt16ResourceElementsAttrGet( + shapedType::MlirType, + name::MlirStringRef, + numElements::intptr_t, + elements::Ptr{UInt16}, + )::MlirAttribute +end + +function mlirUnmanagedDenseInt16ResourceElementsAttrGet( + shapedType, name, numElements, elements +) + @ccall mlir_c.mlirUnmanagedDenseInt16ResourceElementsAttrGet( + shapedType::MlirType, + name::MlirStringRef, + numElements::intptr_t, + elements::Ptr{Int16}, + )::MlirAttribute +end + +function mlirUnmanagedDenseUInt32ResourceElementsAttrGet( + shapedType, name, numElements, elements +) + @ccall mlir_c.mlirUnmanagedDenseUInt32ResourceElementsAttrGet( + shapedType::MlirType, + name::MlirStringRef, + numElements::intptr_t, + elements::Ptr{UInt32}, + )::MlirAttribute +end + +function mlirUnmanagedDenseInt32ResourceElementsAttrGet( + shapedType, name, numElements, elements +) + @ccall mlir_c.mlirUnmanagedDenseInt32ResourceElementsAttrGet( + shapedType::MlirType, + name::MlirStringRef, + numElements::intptr_t, + elements::Ptr{Int32}, + )::MlirAttribute +end + +function mlirUnmanagedDenseUInt64ResourceElementsAttrGet( + shapedType, name, numElements, elements +) + @ccall mlir_c.mlirUnmanagedDenseUInt64ResourceElementsAttrGet( + shapedType::MlirType, + name::MlirStringRef, + numElements::intptr_t, + elements::Ptr{UInt64}, + )::MlirAttribute +end + +function mlirUnmanagedDenseInt64ResourceElementsAttrGet( + shapedType, name, numElements, elements +) + @ccall mlir_c.mlirUnmanagedDenseInt64ResourceElementsAttrGet( + shapedType::MlirType, + name::MlirStringRef, + numElements::intptr_t, + elements::Ptr{Int64}, + )::MlirAttribute +end + +function mlirUnmanagedDenseFloatResourceElementsAttrGet( + shapedType, name, numElements, elements +) + @ccall mlir_c.mlirUnmanagedDenseFloatResourceElementsAttrGet( + shapedType::MlirType, + name::MlirStringRef, + numElements::intptr_t, + elements::Ptr{Cfloat}, + )::MlirAttribute +end + +function mlirUnmanagedDenseDoubleResourceElementsAttrGet( + shapedType, name, numElements, elements +) + @ccall mlir_c.mlirUnmanagedDenseDoubleResourceElementsAttrGet( + shapedType::MlirType, + name::MlirStringRef, + numElements::intptr_t, + elements::Ptr{Cdouble}, + )::MlirAttribute end """ @@ -3955,47 +4421,69 @@ end Returns the pos-th value (flat contiguous indexing) of a specific type contained by the given dense resource elements attribute. """ function mlirDenseBoolResourceElementsAttrGetValue(attr, pos) - @ccall mlir_c.mlirDenseBoolResourceElementsAttrGetValue(attr::MlirAttribute, pos::intptr_t)::Bool + @ccall mlir_c.mlirDenseBoolResourceElementsAttrGetValue( + attr::MlirAttribute, pos::intptr_t + )::Bool end function mlirDenseInt8ResourceElementsAttrGetValue(attr, pos) - @ccall mlir_c.mlirDenseInt8ResourceElementsAttrGetValue(attr::MlirAttribute, pos::intptr_t)::Int8 + @ccall mlir_c.mlirDenseInt8ResourceElementsAttrGetValue( + attr::MlirAttribute, pos::intptr_t + )::Int8 end function mlirDenseUInt8ResourceElementsAttrGetValue(attr, pos) - @ccall mlir_c.mlirDenseUInt8ResourceElementsAttrGetValue(attr::MlirAttribute, pos::intptr_t)::UInt8 + @ccall mlir_c.mlirDenseUInt8ResourceElementsAttrGetValue( + attr::MlirAttribute, pos::intptr_t + )::UInt8 end function mlirDenseInt16ResourceElementsAttrGetValue(attr, pos) - @ccall mlir_c.mlirDenseInt16ResourceElementsAttrGetValue(attr::MlirAttribute, pos::intptr_t)::Int16 + @ccall mlir_c.mlirDenseInt16ResourceElementsAttrGetValue( + attr::MlirAttribute, pos::intptr_t + )::Int16 end function mlirDenseUInt16ResourceElementsAttrGetValue(attr, pos) - @ccall mlir_c.mlirDenseUInt16ResourceElementsAttrGetValue(attr::MlirAttribute, pos::intptr_t)::UInt16 + @ccall mlir_c.mlirDenseUInt16ResourceElementsAttrGetValue( + attr::MlirAttribute, pos::intptr_t + )::UInt16 end function mlirDenseInt32ResourceElementsAttrGetValue(attr, pos) - @ccall mlir_c.mlirDenseInt32ResourceElementsAttrGetValue(attr::MlirAttribute, pos::intptr_t)::Int32 + @ccall mlir_c.mlirDenseInt32ResourceElementsAttrGetValue( + attr::MlirAttribute, pos::intptr_t + )::Int32 end function mlirDenseUInt32ResourceElementsAttrGetValue(attr, pos) - @ccall mlir_c.mlirDenseUInt32ResourceElementsAttrGetValue(attr::MlirAttribute, pos::intptr_t)::UInt32 + @ccall mlir_c.mlirDenseUInt32ResourceElementsAttrGetValue( + attr::MlirAttribute, pos::intptr_t + )::UInt32 end function mlirDenseInt64ResourceElementsAttrGetValue(attr, pos) - @ccall mlir_c.mlirDenseInt64ResourceElementsAttrGetValue(attr::MlirAttribute, pos::intptr_t)::Int64 + @ccall mlir_c.mlirDenseInt64ResourceElementsAttrGetValue( + attr::MlirAttribute, pos::intptr_t + )::Int64 end function mlirDenseUInt64ResourceElementsAttrGetValue(attr, pos) - @ccall mlir_c.mlirDenseUInt64ResourceElementsAttrGetValue(attr::MlirAttribute, pos::intptr_t)::UInt64 + @ccall mlir_c.mlirDenseUInt64ResourceElementsAttrGetValue( + attr::MlirAttribute, pos::intptr_t + )::UInt64 end function mlirDenseFloatResourceElementsAttrGetValue(attr, pos) - @ccall mlir_c.mlirDenseFloatResourceElementsAttrGetValue(attr::MlirAttribute, pos::intptr_t)::Cfloat + @ccall mlir_c.mlirDenseFloatResourceElementsAttrGetValue( + attr::MlirAttribute, pos::intptr_t + )::Cfloat end function mlirDenseDoubleResourceElementsAttrGetValue(attr, pos) - @ccall mlir_c.mlirDenseDoubleResourceElementsAttrGetValue(attr::MlirAttribute, pos::intptr_t)::Cdouble + @ccall mlir_c.mlirDenseDoubleResourceElementsAttrGetValue( + attr::MlirAttribute, pos::intptr_t + )::Cdouble end """ @@ -4013,7 +4501,9 @@ end 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. """ function mlirSparseElementsAttribute(shapedType, denseIndices, denseValues) - @ccall mlir_c.mlirSparseElementsAttribute(shapedType::MlirType, denseIndices::MlirAttribute, denseValues::MlirAttribute)::MlirAttribute + @ccall mlir_c.mlirSparseElementsAttribute( + shapedType::MlirType, denseIndices::MlirAttribute, denseValues::MlirAttribute + )::MlirAttribute end """ @@ -4048,7 +4538,9 @@ function mlirAttributeIsAStridedLayout(attr) end function mlirStridedLayoutAttrGet(ctx, offset, numStrides, strides) - @ccall mlir_c.mlirStridedLayoutAttrGet(ctx::MlirContext, offset::Int64, numStrides::intptr_t, strides::Ptr{Int64})::MlirAttribute + @ccall mlir_c.mlirStridedLayoutAttrGet( + ctx::MlirContext, offset::Int64, numStrides::intptr_t, strides::Ptr{Int64} + )::MlirAttribute end function mlirStridedLayoutAttrGetOffset(attr) @@ -4816,7 +5308,9 @@ end 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. """ function mlirVectorTypeGet(rank, shape, elementType) - @ccall mlir_c.mlirVectorTypeGet(rank::intptr_t, shape::Ptr{Int64}, elementType::MlirType)::MlirType + @ccall mlir_c.mlirVectorTypeGet( + rank::intptr_t, shape::Ptr{Int64}, elementType::MlirType + )::MlirType end """ @@ -4825,7 +5319,9 @@ end Same as "[`mlirVectorTypeGet`](@ref)" but returns a nullptr wrapping [`MlirType`](@ref) on illegal arguments, emitting appropriate diagnostics. """ function mlirVectorTypeGetChecked(loc, rank, shape, elementType) - @ccall mlir_c.mlirVectorTypeGetChecked(loc::MlirLocation, rank::intptr_t, shape::Ptr{Int64}, elementType::MlirType)::MlirType + @ccall mlir_c.mlirVectorTypeGetChecked( + loc::MlirLocation, rank::intptr_t, shape::Ptr{Int64}, elementType::MlirType + )::MlirType end """ @@ -4834,7 +5330,9 @@ end 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. """ function mlirVectorTypeGetScalable(rank, shape, scalable, elementType) - @ccall mlir_c.mlirVectorTypeGetScalable(rank::intptr_t, shape::Ptr{Int64}, scalable::Ptr{Bool}, elementType::MlirType)::MlirType + @ccall mlir_c.mlirVectorTypeGetScalable( + rank::intptr_t, shape::Ptr{Int64}, scalable::Ptr{Bool}, elementType::MlirType + )::MlirType end """ @@ -4843,7 +5341,13 @@ end Same as "[`mlirVectorTypeGetScalable`](@ref)" but returns a nullptr wrapping [`MlirType`](@ref) on illegal arguments, emitting appropriate diagnostics. """ function mlirVectorTypeGetScalableChecked(loc, rank, shape, scalable, elementType) - @ccall mlir_c.mlirVectorTypeGetScalableChecked(loc::MlirLocation, rank::intptr_t, shape::Ptr{Int64}, scalable::Ptr{Bool}, elementType::MlirType)::MlirType + @ccall mlir_c.mlirVectorTypeGetScalableChecked( + loc::MlirLocation, + rank::intptr_t, + shape::Ptr{Int64}, + scalable::Ptr{Bool}, + elementType::MlirType, + )::MlirType end """ @@ -4915,7 +5419,9 @@ end 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`](@ref)() to this parameter. """ function mlirRankedTensorTypeGet(rank, shape, elementType, encoding) - @ccall mlir_c.mlirRankedTensorTypeGet(rank::intptr_t, shape::Ptr{Int64}, elementType::MlirType, encoding::MlirAttribute)::MlirType + @ccall mlir_c.mlirRankedTensorTypeGet( + rank::intptr_t, shape::Ptr{Int64}, elementType::MlirType, encoding::MlirAttribute + )::MlirType end """ @@ -4924,7 +5430,13 @@ end Same as "[`mlirRankedTensorTypeGet`](@ref)" but returns a nullptr wrapping [`MlirType`](@ref) on illegal arguments, emitting appropriate diagnostics. """ function mlirRankedTensorTypeGetChecked(loc, rank, shape, elementType, encoding) - @ccall mlir_c.mlirRankedTensorTypeGetChecked(loc::MlirLocation, rank::intptr_t, shape::Ptr{Int64}, elementType::MlirType, encoding::MlirAttribute)::MlirType + @ccall mlir_c.mlirRankedTensorTypeGetChecked( + loc::MlirLocation, + rank::intptr_t, + shape::Ptr{Int64}, + elementType::MlirType, + encoding::MlirAttribute, + )::MlirType end """ @@ -4951,7 +5463,9 @@ end Same as "[`mlirUnrankedTensorTypeGet`](@ref)" but returns a nullptr wrapping [`MlirType`](@ref) on illegal arguments, emitting appropriate diagnostics. """ function mlirUnrankedTensorTypeGetChecked(loc, elementType) - @ccall mlir_c.mlirUnrankedTensorTypeGetChecked(loc::MlirLocation, elementType::MlirType)::MlirType + @ccall mlir_c.mlirUnrankedTensorTypeGetChecked( + loc::MlirLocation, elementType::MlirType + )::MlirType end """ @@ -4996,7 +5510,13 @@ end 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. """ function mlirMemRefTypeGet(elementType, rank, shape, layout, memorySpace) - @ccall mlir_c.mlirMemRefTypeGet(elementType::MlirType, rank::intptr_t, shape::Ptr{Int64}, layout::MlirAttribute, memorySpace::MlirAttribute)::MlirType + @ccall mlir_c.mlirMemRefTypeGet( + elementType::MlirType, + rank::intptr_t, + shape::Ptr{Int64}, + layout::MlirAttribute, + memorySpace::MlirAttribute, + )::MlirType end """ @@ -5005,7 +5525,14 @@ end Same as "[`mlirMemRefTypeGet`](@ref)" but returns a nullptr-wrapping [`MlirType`](@ref) o illegal arguments, emitting appropriate diagnostics. """ function mlirMemRefTypeGetChecked(loc, elementType, rank, shape, layout, memorySpace) - @ccall mlir_c.mlirMemRefTypeGetChecked(loc::MlirLocation, elementType::MlirType, rank::intptr_t, shape::Ptr{Int64}, layout::MlirAttribute, memorySpace::MlirAttribute)::MlirType + @ccall mlir_c.mlirMemRefTypeGetChecked( + loc::MlirLocation, + elementType::MlirType, + rank::intptr_t, + shape::Ptr{Int64}, + layout::MlirAttribute, + memorySpace::MlirAttribute, + )::MlirType end """ @@ -5014,7 +5541,9 @@ end 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. """ function mlirMemRefTypeContiguousGet(elementType, rank, shape, memorySpace) - @ccall mlir_c.mlirMemRefTypeContiguousGet(elementType::MlirType, rank::intptr_t, shape::Ptr{Int64}, memorySpace::MlirAttribute)::MlirType + @ccall mlir_c.mlirMemRefTypeContiguousGet( + elementType::MlirType, rank::intptr_t, shape::Ptr{Int64}, memorySpace::MlirAttribute + )::MlirType end """ @@ -5023,7 +5552,13 @@ end Same as "[`mlirMemRefTypeContiguousGet`](@ref)" but returns a nullptr wrapping [`MlirType`](@ref) on illegal arguments, emitting appropriate diagnostics. """ function mlirMemRefTypeContiguousGetChecked(loc, elementType, rank, shape, memorySpace) - @ccall mlir_c.mlirMemRefTypeContiguousGetChecked(loc::MlirLocation, elementType::MlirType, rank::intptr_t, shape::Ptr{Int64}, memorySpace::MlirAttribute)::MlirType + @ccall mlir_c.mlirMemRefTypeContiguousGetChecked( + loc::MlirLocation, + elementType::MlirType, + rank::intptr_t, + shape::Ptr{Int64}, + memorySpace::MlirAttribute, + )::MlirType end """ @@ -5032,7 +5567,9 @@ end 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. """ function mlirUnrankedMemRefTypeGet(elementType, memorySpace) - @ccall mlir_c.mlirUnrankedMemRefTypeGet(elementType::MlirType, memorySpace::MlirAttribute)::MlirType + @ccall mlir_c.mlirUnrankedMemRefTypeGet( + elementType::MlirType, memorySpace::MlirAttribute + )::MlirType end """ @@ -5041,7 +5578,9 @@ end Same as "[`mlirUnrankedMemRefTypeGet`](@ref)" but returns a nullptr wrapping [`MlirType`](@ref) on illegal arguments, emitting appropriate diagnostics. """ function mlirUnrankedMemRefTypeGetChecked(loc, elementType, memorySpace) - @ccall mlir_c.mlirUnrankedMemRefTypeGetChecked(loc::MlirLocation, elementType::MlirType, memorySpace::MlirAttribute)::MlirType + @ccall mlir_c.mlirUnrankedMemRefTypeGetChecked( + loc::MlirLocation, elementType::MlirType, memorySpace::MlirAttribute + )::MlirType end """ @@ -5077,7 +5616,9 @@ end 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. """ function mlirMemRefTypeGetStridesAndOffset(type, strides, offset) - @ccall mlir_c.mlirMemRefTypeGetStridesAndOffset(type::MlirType, strides::Ptr{Int64}, offset::Ptr{Int64})::MlirLogicalResult + @ccall mlir_c.mlirMemRefTypeGetStridesAndOffset( + type::MlirType, strides::Ptr{Int64}, offset::Ptr{Int64} + )::MlirLogicalResult end """ @@ -5113,7 +5654,9 @@ end Creates a tuple type that consists of the given list of elemental types. The type is owned by the context. """ function mlirTupleTypeGet(ctx, numElements, elements) - @ccall mlir_c.mlirTupleTypeGet(ctx::MlirContext, numElements::intptr_t, elements::Ptr{MlirType})::MlirType + @ccall mlir_c.mlirTupleTypeGet( + ctx::MlirContext, numElements::intptr_t, elements::Ptr{MlirType} + )::MlirType end """ @@ -5158,7 +5701,13 @@ end Creates a function type, mapping a list of input types to result types. """ function mlirFunctionTypeGet(ctx, numInputs, inputs, numResults, results) - @ccall mlir_c.mlirFunctionTypeGet(ctx::MlirContext, numInputs::intptr_t, inputs::Ptr{MlirType}, numResults::intptr_t, results::Ptr{MlirType})::MlirType + @ccall mlir_c.mlirFunctionTypeGet( + ctx::MlirContext, + numInputs::intptr_t, + inputs::Ptr{MlirType}, + numResults::intptr_t, + results::Ptr{MlirType}, + )::MlirType end """ @@ -5221,7 +5770,9 @@ end 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). """ function mlirOpaqueTypeGet(ctx, dialectNamespace, typeData) - @ccall mlir_c.mlirOpaqueTypeGet(ctx::MlirContext, dialectNamespace::MlirStringRef, typeData::MlirStringRef)::MlirType + @ccall mlir_c.mlirOpaqueTypeGet( + ctx::MlirContext, dialectNamespace::MlirStringRef, typeData::MlirStringRef + )::MlirType end """ @@ -5273,7 +5824,9 @@ end Create a new top-level PassManager anchored on `anchorOp`. """ function mlirPassManagerCreateOnOperation(ctx, anchorOp) - @ccall mlir_c.mlirPassManagerCreateOnOperation(ctx::MlirContext, anchorOp::MlirStringRef)::MlirPassManager + @ccall mlir_c.mlirPassManagerCreateOnOperation( + ctx::MlirContext, anchorOp::MlirStringRef + )::MlirPassManager end """ @@ -5300,7 +5853,9 @@ end Cast a top-level PassManager to a generic OpPassManager. """ function mlirPassManagerGetAsOpPassManager(passManager) - @ccall mlir_c.mlirPassManagerGetAsOpPassManager(passManager::MlirPassManager)::MlirOpPassManager + @ccall mlir_c.mlirPassManagerGetAsOpPassManager( + passManager::MlirPassManager + )::MlirOpPassManager end """ @@ -5309,7 +5864,9 @@ end Run the provided `passManager` on the given `op`. """ function mlirPassManagerRunOnOp(passManager, op) - @ccall mlir_c.mlirPassManagerRunOnOp(passManager::MlirPassManager, op::MlirOperation)::MlirLogicalResult + @ccall mlir_c.mlirPassManagerRunOnOp( + passManager::MlirPassManager, op::MlirOperation + )::MlirLogicalResult end """ @@ -5317,8 +5874,26 @@ end 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. """ -function mlirPassManagerEnableIRPrinting(passManager, printBeforeAll, printAfterAll, printModuleScope, printAfterOnlyOnChange, printAfterOnlyOnFailure, flags, treePrintingPath) - @ccall mlir_c.mlirPassManagerEnableIRPrinting(passManager::MlirPassManager, printBeforeAll::Bool, printAfterAll::Bool, printModuleScope::Bool, printAfterOnlyOnChange::Bool, printAfterOnlyOnFailure::Bool, flags::MlirOpPrintingFlags, treePrintingPath::MlirStringRef)::Cvoid +function mlirPassManagerEnableIRPrinting( + passManager, + printBeforeAll, + printAfterAll, + printModuleScope, + printAfterOnlyOnChange, + printAfterOnlyOnFailure, + flags, + treePrintingPath, +) + @ccall mlir_c.mlirPassManagerEnableIRPrinting( + passManager::MlirPassManager, + printBeforeAll::Bool, + printAfterAll::Bool, + printModuleScope::Bool, + printAfterOnlyOnChange::Bool, + printAfterOnlyOnFailure::Bool, + flags::MlirOpPrintingFlags, + treePrintingPath::MlirStringRef, + )::Cvoid end """ @@ -5327,7 +5902,9 @@ end Enable / disable verify-each. """ function mlirPassManagerEnableVerifier(passManager, enable) - @ccall mlir_c.mlirPassManagerEnableVerifier(passManager::MlirPassManager, enable::Bool)::Cvoid + @ccall mlir_c.mlirPassManagerEnableVerifier( + passManager::MlirPassManager, enable::Bool + )::Cvoid end """ @@ -5336,7 +5913,9 @@ end 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. """ function mlirPassManagerGetNestedUnder(passManager, operationName) - @ccall mlir_c.mlirPassManagerGetNestedUnder(passManager::MlirPassManager, operationName::MlirStringRef)::MlirOpPassManager + @ccall mlir_c.mlirPassManagerGetNestedUnder( + passManager::MlirPassManager, operationName::MlirStringRef + )::MlirOpPassManager end """ @@ -5345,7 +5924,9 @@ end 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. """ function mlirOpPassManagerGetNestedUnder(passManager, operationName) - @ccall mlir_c.mlirOpPassManagerGetNestedUnder(passManager::MlirOpPassManager, operationName::MlirStringRef)::MlirOpPassManager + @ccall mlir_c.mlirOpPassManagerGetNestedUnder( + passManager::MlirOpPassManager, operationName::MlirStringRef + )::MlirOpPassManager end """ @@ -5354,7 +5935,9 @@ end 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. """ function mlirPassManagerAddOwnedPass(passManager, pass) - @ccall mlir_c.mlirPassManagerAddOwnedPass(passManager::MlirPassManager, pass::MlirPass)::Cvoid + @ccall mlir_c.mlirPassManagerAddOwnedPass( + passManager::MlirPassManager, pass::MlirPass + )::Cvoid end """ @@ -5363,7 +5946,9 @@ end 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. """ function mlirOpPassManagerAddOwnedPass(passManager, pass) - @ccall mlir_c.mlirOpPassManagerAddOwnedPass(passManager::MlirOpPassManager, pass::MlirPass)::Cvoid + @ccall mlir_c.mlirOpPassManagerAddOwnedPass( + passManager::MlirOpPassManager, pass::MlirPass + )::Cvoid end """ @@ -5372,7 +5957,12 @@ end 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. """ function mlirOpPassManagerAddPipeline(passManager, pipelineElements, callback, userData) - @ccall mlir_c.mlirOpPassManagerAddPipeline(passManager::MlirOpPassManager, pipelineElements::MlirStringRef, callback::MlirStringCallback, userData::Ptr{Cvoid})::MlirLogicalResult + @ccall mlir_c.mlirOpPassManagerAddPipeline( + passManager::MlirOpPassManager, + pipelineElements::MlirStringRef, + callback::MlirStringCallback, + userData::Ptr{Cvoid}, + )::MlirLogicalResult end """ @@ -5381,7 +5971,9 @@ end Print a textual MLIR pass pipeline by sending chunks of the string representation and forwarding `userData to `callback`. Note that the callback may be called several times with consecutive chunks of the string. """ function mlirPrintPassPipeline(passManager, callback, userData) - @ccall mlir_c.mlirPrintPassPipeline(passManager::MlirOpPassManager, callback::MlirStringCallback, userData::Ptr{Cvoid})::Cvoid + @ccall mlir_c.mlirPrintPassPipeline( + passManager::MlirOpPassManager, callback::MlirStringCallback, userData::Ptr{Cvoid} + )::Cvoid end """ @@ -5390,7 +5982,12 @@ end 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. """ function mlirParsePassPipeline(passManager, pipeline, callback, userData) - @ccall mlir_c.mlirParsePassPipeline(passManager::MlirOpPassManager, pipeline::MlirStringRef, callback::MlirStringCallback, userData::Ptr{Cvoid})::MlirLogicalResult + @ccall mlir_c.mlirParsePassPipeline( + passManager::MlirOpPassManager, + pipeline::MlirStringRef, + callback::MlirStringCallback, + userData::Ptr{Cvoid}, + )::MlirLogicalResult end """ @@ -5419,8 +6016,28 @@ end Creates an external [`MlirPass`](@ref) 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. """ -function mlirCreateExternalPass(passID, name, argument, description, opName, nDependentDialects, dependentDialects, callbacks, userData) - @ccall mlir_c.mlirCreateExternalPass(passID::MlirTypeID, name::MlirStringRef, argument::MlirStringRef, description::MlirStringRef, opName::MlirStringRef, nDependentDialects::intptr_t, dependentDialects::Ptr{MlirDialectHandle}, callbacks::MlirExternalPassCallbacks, userData::Ptr{Cvoid})::MlirPass +function mlirCreateExternalPass( + passID, + name, + argument, + description, + opName, + nDependentDialects, + dependentDialects, + callbacks, + userData, +) + @ccall mlir_c.mlirCreateExternalPass( + passID::MlirTypeID, + name::MlirStringRef, + argument::MlirStringRef, + description::MlirStringRef, + opName::MlirStringRef, + nDependentDialects::intptr_t, + dependentDialects::Ptr{MlirDialectHandle}, + callbacks::MlirExternalPassCallbacks, + userData::Ptr{Cvoid}, + )::MlirPass end """ @@ -6135,7 +6752,9 @@ const MlirDiagnosticHandler = Ptr{Cvoid} Prints a diagnostic using the provided callback. """ function mlirDiagnosticPrint(diagnostic, callback, userData) - @ccall mlir_c.mlirDiagnosticPrint(diagnostic::MlirDiagnostic, callback::MlirStringCallback, userData::Ptr{Cvoid})::Cvoid + @ccall mlir_c.mlirDiagnosticPrint( + diagnostic::MlirDiagnostic, callback::MlirStringCallback, userData::Ptr{Cvoid} + )::Cvoid end """ @@ -6153,7 +6772,9 @@ end Returns the severity of the diagnostic. """ function mlirDiagnosticGetSeverity(diagnostic) - @ccall mlir_c.mlirDiagnosticGetSeverity(diagnostic::MlirDiagnostic)::MlirDiagnosticSeverity + @ccall mlir_c.mlirDiagnosticGetSeverity( + diagnostic::MlirDiagnostic + )::MlirDiagnosticSeverity end """ @@ -6171,7 +6792,9 @@ end Returns `pos`-th note attached to the diagnostic. Expects `pos` to be a valid zero-based index into the list of notes. """ function mlirDiagnosticGetNote(diagnostic, pos) - @ccall mlir_c.mlirDiagnosticGetNote(diagnostic::MlirDiagnostic, pos::intptr_t)::MlirDiagnostic + @ccall mlir_c.mlirDiagnosticGetNote( + diagnostic::MlirDiagnostic, pos::intptr_t + )::MlirDiagnostic end """ @@ -6180,7 +6803,12 @@ end 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. """ function mlirContextAttachDiagnosticHandler(context, handler, userData, deleteUserData) - @ccall mlir_c.mlirContextAttachDiagnosticHandler(context::MlirContext, handler::MlirDiagnosticHandler, userData::Ptr{Cvoid}, deleteUserData::Ptr{Cvoid})::MlirDiagnosticHandlerID + @ccall mlir_c.mlirContextAttachDiagnosticHandler( + context::MlirContext, + handler::MlirDiagnosticHandler, + userData::Ptr{Cvoid}, + deleteUserData::Ptr{Cvoid}, + )::MlirDiagnosticHandlerID end """ @@ -6189,7 +6817,9 @@ end Detaches an attached diagnostic handler from the context given its identifier. """ function mlirContextDetachDiagnosticHandler(context, id) - @ccall mlir_c.mlirContextDetachDiagnosticHandler(context::MlirContext, id::MlirDiagnosticHandlerID)::Cvoid + @ccall mlir_c.mlirContextDetachDiagnosticHandler( + context::MlirContext, id::MlirDiagnosticHandlerID + )::Cvoid end """ @@ -6283,7 +6913,9 @@ end Sets the argument attribute 'name' of an argument at index 'pos'. Asserts that the operation is a FuncOp. """ function mlirFuncSetArgAttr(op, pos, name, attr) - @ccall mlir_c.mlirFuncSetArgAttr(op::MlirOperation, pos::intptr_t, name::MlirStringRef, attr::MlirAttribute)::Cvoid + @ccall mlir_c.mlirFuncSetArgAttr( + op::MlirOperation, pos::intptr_t, name::MlirStringRef, attr::MlirAttribute + )::Cvoid end function mlirGetDialectHandle__gpu__() @@ -6303,11 +6935,26 @@ function mlirAttributeIsAGPUObjectAttr(attr) end function mlirGPUObjectAttrGet(mlirCtx, target, format, objectStrRef, mlirObjectProps) - @ccall mlir_c.mlirGPUObjectAttrGet(mlirCtx::MlirContext, target::MlirAttribute, format::UInt32, objectStrRef::MlirStringRef, mlirObjectProps::MlirAttribute)::MlirAttribute -end - -function mlirGPUObjectAttrGetWithKernels(mlirCtx, target, format, objectStrRef, mlirObjectProps, mlirKernelsAttr) - @ccall mlir_c.mlirGPUObjectAttrGetWithKernels(mlirCtx::MlirContext, target::MlirAttribute, format::UInt32, objectStrRef::MlirStringRef, mlirObjectProps::MlirAttribute, mlirKernelsAttr::MlirAttribute)::MlirAttribute + @ccall mlir_c.mlirGPUObjectAttrGet( + mlirCtx::MlirContext, + target::MlirAttribute, + format::UInt32, + objectStrRef::MlirStringRef, + mlirObjectProps::MlirAttribute, + )::MlirAttribute +end + +function mlirGPUObjectAttrGetWithKernels( + mlirCtx, target, format, objectStrRef, mlirObjectProps, mlirKernelsAttr +) + @ccall mlir_c.mlirGPUObjectAttrGetWithKernels( + mlirCtx::MlirContext, + target::MlirAttribute, + format::UInt32, + objectStrRef::MlirStringRef, + mlirObjectProps::MlirAttribute, + mlirKernelsAttr::MlirAttribute, + )::MlirAttribute end function mlirGPUObjectAttrGetTarget(mlirObjectAttr) @@ -6327,7 +6974,9 @@ function mlirGPUObjectAttrHasProperties(mlirObjectAttr) end function mlirGPUObjectAttrGetProperties(mlirObjectAttr) - @ccall mlir_c.mlirGPUObjectAttrGetProperties(mlirObjectAttr::MlirAttribute)::MlirAttribute + @ccall mlir_c.mlirGPUObjectAttrGetProperties( + mlirObjectAttr::MlirAttribute + )::MlirAttribute end function mlirGPUObjectAttrHasKernels(mlirObjectAttr) @@ -6499,7 +7148,12 @@ end Creates an llvm.func type. """ function mlirLLVMFunctionTypeGet(resultType, nArgumentTypes, argumentTypes, isVarArg) - @ccall mlir_c.mlirLLVMFunctionTypeGet(resultType::MlirType, nArgumentTypes::intptr_t, argumentTypes::Ptr{MlirType}, isVarArg::Bool)::MlirType + @ccall mlir_c.mlirLLVMFunctionTypeGet( + resultType::MlirType, + nArgumentTypes::intptr_t, + argumentTypes::Ptr{MlirType}, + isVarArg::Bool, + )::MlirType end """ @@ -6553,7 +7207,9 @@ end 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. """ function mlirLLVMStructTypeGetElementType(type, position) - @ccall mlir_c.mlirLLVMStructTypeGetElementType(type::MlirType, position::intptr_t)::MlirType + @ccall mlir_c.mlirLLVMStructTypeGetElementType( + type::MlirType, position::intptr_t + )::MlirType end """ @@ -6589,7 +7245,9 @@ end 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. """ function mlirLLVMStructTypeLiteralGet(ctx, nFieldTypes, fieldTypes, isPacked) - @ccall mlir_c.mlirLLVMStructTypeLiteralGet(ctx::MlirContext, nFieldTypes::intptr_t, fieldTypes::Ptr{MlirType}, isPacked::Bool)::MlirType + @ccall mlir_c.mlirLLVMStructTypeLiteralGet( + ctx::MlirContext, nFieldTypes::intptr_t, fieldTypes::Ptr{MlirType}, isPacked::Bool + )::MlirType end """ @@ -6598,7 +7256,9 @@ end Creates an LLVM literal (unnamed) struct type if possible. Emits a diagnostic at the given location and returns null otherwise. """ function mlirLLVMStructTypeLiteralGetChecked(loc, nFieldTypes, fieldTypes, isPacked) - @ccall mlir_c.mlirLLVMStructTypeLiteralGetChecked(loc::MlirLocation, nFieldTypes::intptr_t, fieldTypes::Ptr{MlirType}, isPacked::Bool)::MlirType + @ccall mlir_c.mlirLLVMStructTypeLiteralGetChecked( + loc::MlirLocation, nFieldTypes::intptr_t, fieldTypes::Ptr{MlirType}, isPacked::Bool + )::MlirType end """ @@ -6607,7 +7267,9 @@ end 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`](@ref) to create a fresh struct type, potentially renaming it. The body should be set separatelty by calling [`mlirLLVMStructTypeSetBody`](@ref), if it isn't set already. """ function mlirLLVMStructTypeIdentifiedGet(ctx, name) - @ccall mlir_c.mlirLLVMStructTypeIdentifiedGet(ctx::MlirContext, name::MlirStringRef)::MlirType + @ccall mlir_c.mlirLLVMStructTypeIdentifiedGet( + ctx::MlirContext, name::MlirStringRef + )::MlirType end """ @@ -6616,11 +7278,19 @@ end 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. """ function mlirLLVMStructTypeIdentifiedNewGet(ctx, name, nFieldTypes, fieldTypes, isPacked) - @ccall mlir_c.mlirLLVMStructTypeIdentifiedNewGet(ctx::MlirContext, name::MlirStringRef, nFieldTypes::intptr_t, fieldTypes::Ptr{MlirType}, isPacked::Bool)::MlirType + @ccall mlir_c.mlirLLVMStructTypeIdentifiedNewGet( + ctx::MlirContext, + name::MlirStringRef, + nFieldTypes::intptr_t, + fieldTypes::Ptr{MlirType}, + isPacked::Bool, + )::MlirType end function mlirLLVMStructTypeOpaqueGet(ctx, name) - @ccall mlir_c.mlirLLVMStructTypeOpaqueGet(ctx::MlirContext, name::MlirStringRef)::MlirType + @ccall mlir_c.mlirLLVMStructTypeOpaqueGet( + ctx::MlirContext, name::MlirStringRef + )::MlirType end """ @@ -6629,7 +7299,12 @@ end Sets the body of the identified struct if it hasn't been set yet. Returns whether the operation was successful. """ function mlirLLVMStructTypeSetBody(structType, nFieldTypes, fieldTypes, isPacked) - @ccall mlir_c.mlirLLVMStructTypeSetBody(structType::MlirType, nFieldTypes::intptr_t, fieldTypes::Ptr{MlirType}, isPacked::Bool)::MlirLogicalResult + @ccall mlir_c.mlirLLVMStructTypeSetBody( + structType::MlirType, + nFieldTypes::intptr_t, + fieldTypes::Ptr{MlirType}, + isPacked::Bool, + )::MlirLogicalResult end @cenum MlirLLVMCConv::UInt32 begin @@ -6688,7 +7363,9 @@ end Creates a LLVM CConv attribute. """ function mlirLLVMCConvAttrGet(ctx, cconv) - @ccall mlir_c.mlirLLVMCConvAttrGet(ctx::MlirContext, cconv::MlirLLVMCConv)::MlirAttribute + @ccall mlir_c.mlirLLVMCConvAttrGet( + ctx::MlirContext, cconv::MlirLLVMCConv + )::MlirAttribute end @cenum MlirLLVMComdat::UInt32 begin @@ -6705,7 +7382,9 @@ end Creates a LLVM Comdat attribute. """ function mlirLLVMComdatAttrGet(ctx, comdat) - @ccall mlir_c.mlirLLVMComdatAttrGet(ctx::MlirContext, comdat::MlirLLVMComdat)::MlirAttribute + @ccall mlir_c.mlirLLVMComdatAttrGet( + ctx::MlirContext, comdat::MlirLLVMComdat + )::MlirAttribute end @cenum MlirLLVMLinkage::UInt32 begin @@ -6728,7 +7407,9 @@ end Creates a LLVM Linkage attribute. """ function mlirLLVMLinkageAttrGet(ctx, linkage) - @ccall mlir_c.mlirLLVMLinkageAttrGet(ctx::MlirContext, linkage::MlirLLVMLinkage)::MlirAttribute + @ccall mlir_c.mlirLLVMLinkageAttrGet( + ctx::MlirContext, linkage::MlirLLVMLinkage + )::MlirAttribute end """ @@ -6746,7 +7427,9 @@ end Creates a LLVM DIExpressionElem attribute. """ function mlirLLVMDIExpressionElemAttrGet(ctx, opcode, nArguments, arguments) - @ccall mlir_c.mlirLLVMDIExpressionElemAttrGet(ctx::MlirContext, opcode::Cuint, nArguments::intptr_t, arguments::Ptr{UInt64})::MlirAttribute + @ccall mlir_c.mlirLLVMDIExpressionElemAttrGet( + ctx::MlirContext, opcode::Cuint, nArguments::intptr_t, arguments::Ptr{UInt64} + )::MlirAttribute end """ @@ -6755,7 +7438,9 @@ end Creates a LLVM DIExpression attribute. """ function mlirLLVMDIExpressionAttrGet(ctx, nOperations, operations) - @ccall mlir_c.mlirLLVMDIExpressionAttrGet(ctx::MlirContext, nOperations::intptr_t, operations::Ptr{MlirAttribute})::MlirAttribute + @ccall mlir_c.mlirLLVMDIExpressionAttrGet( + ctx::MlirContext, nOperations::intptr_t, operations::Ptr{MlirAttribute} + )::MlirAttribute end @cenum MlirLLVMTypeEncoding::UInt32 begin @@ -6787,7 +7472,13 @@ end Creates a LLVM DIBasicType attribute. """ function mlirLLVMDIBasicTypeAttrGet(ctx, tag, name, sizeInBits, encoding) - @ccall mlir_c.mlirLLVMDIBasicTypeAttrGet(ctx::MlirContext, tag::Cuint, name::MlirAttribute, sizeInBits::UInt64, encoding::MlirLLVMTypeEncoding)::MlirAttribute + @ccall mlir_c.mlirLLVMDIBasicTypeAttrGet( + ctx::MlirContext, + tag::Cuint, + name::MlirAttribute, + sizeInBits::UInt64, + encoding::MlirLLVMTypeEncoding, + )::MlirAttribute end """ @@ -6804,8 +7495,46 @@ end Creates a LLVM DICompositeType attribute. """ -function mlirLLVMDICompositeTypeAttrGet(ctx, recId, isRecSelf, tag, name, file, line, scope, baseType, flags, sizeInBits, alignInBits, nElements, elements, dataLocation, rank, allocated, associated) - @ccall mlir_c.mlirLLVMDICompositeTypeAttrGet(ctx::MlirContext, recId::MlirAttribute, isRecSelf::Bool, tag::Cuint, name::MlirAttribute, file::MlirAttribute, line::UInt32, scope::MlirAttribute, baseType::MlirAttribute, flags::Int64, sizeInBits::UInt64, alignInBits::UInt64, nElements::intptr_t, elements::Ptr{MlirAttribute}, dataLocation::MlirAttribute, rank::MlirAttribute, allocated::MlirAttribute, associated::MlirAttribute)::MlirAttribute +function mlirLLVMDICompositeTypeAttrGet( + ctx, + recId, + isRecSelf, + tag, + name, + file, + line, + scope, + baseType, + flags, + sizeInBits, + alignInBits, + nElements, + elements, + dataLocation, + rank, + allocated, + associated, +) + @ccall mlir_c.mlirLLVMDICompositeTypeAttrGet( + ctx::MlirContext, + recId::MlirAttribute, + isRecSelf::Bool, + tag::Cuint, + name::MlirAttribute, + file::MlirAttribute, + line::UInt32, + scope::MlirAttribute, + baseType::MlirAttribute, + flags::Int64, + sizeInBits::UInt64, + alignInBits::UInt64, + nElements::intptr_t, + elements::Ptr{MlirAttribute}, + dataLocation::MlirAttribute, + rank::MlirAttribute, + allocated::MlirAttribute, + associated::MlirAttribute, + )::MlirAttribute end """ @@ -6813,12 +7542,52 @@ end Creates a LLVM DIDerivedType attribute. Note that `dwarfAddressSpace` is an optional field, where [`MLIR_CAPI_DWARF_ADDRESS_SPACE_NULL`](@ref) indicates null and non-negative values indicate a value present. """ -function mlirLLVMDIDerivedTypeAttrGet(ctx, tag, name, baseType, sizeInBits, alignInBits, offsetInBits, dwarfAddressSpace, extraData) - @ccall mlir_c.mlirLLVMDIDerivedTypeAttrGet(ctx::MlirContext, tag::Cuint, name::MlirAttribute, baseType::MlirAttribute, sizeInBits::UInt64, alignInBits::UInt32, offsetInBits::UInt64, dwarfAddressSpace::Int64, extraData::MlirAttribute)::MlirAttribute -end - -function mlirLLVMDIStringTypeAttrGet(ctx, tag, name, sizeInBits, alignInBits, stringLength, stringLengthExp, stringLocationExp, encoding) - @ccall mlir_c.mlirLLVMDIStringTypeAttrGet(ctx::MlirContext, tag::Cuint, name::MlirAttribute, sizeInBits::UInt64, alignInBits::UInt32, stringLength::MlirAttribute, stringLengthExp::MlirAttribute, stringLocationExp::MlirAttribute, encoding::MlirLLVMTypeEncoding)::MlirAttribute +function mlirLLVMDIDerivedTypeAttrGet( + ctx, + tag, + name, + baseType, + sizeInBits, + alignInBits, + offsetInBits, + dwarfAddressSpace, + extraData, +) + @ccall mlir_c.mlirLLVMDIDerivedTypeAttrGet( + ctx::MlirContext, + tag::Cuint, + name::MlirAttribute, + baseType::MlirAttribute, + sizeInBits::UInt64, + alignInBits::UInt32, + offsetInBits::UInt64, + dwarfAddressSpace::Int64, + extraData::MlirAttribute, + )::MlirAttribute +end + +function mlirLLVMDIStringTypeAttrGet( + ctx, + tag, + name, + sizeInBits, + alignInBits, + stringLength, + stringLengthExp, + stringLocationExp, + encoding, +) + @ccall mlir_c.mlirLLVMDIStringTypeAttrGet( + ctx::MlirContext, + tag::Cuint, + name::MlirAttribute, + sizeInBits::UInt64, + alignInBits::UInt32, + stringLength::MlirAttribute, + stringLengthExp::MlirAttribute, + stringLocationExp::MlirAttribute, + encoding::MlirLLVMTypeEncoding, + )::MlirAttribute end """ @@ -6827,7 +7596,9 @@ end Gets the base type from a LLVM DIDerivedType attribute. """ function mlirLLVMDIDerivedTypeAttrGetBaseType(diDerivedType) - @ccall mlir_c.mlirLLVMDIDerivedTypeAttrGetBaseType(diDerivedType::MlirAttribute)::MlirAttribute + @ccall mlir_c.mlirLLVMDIDerivedTypeAttrGetBaseType( + diDerivedType::MlirAttribute + )::MlirAttribute end """ @@ -6836,7 +7607,9 @@ end Creates a LLVM DIFileAttr attribute. """ function mlirLLVMDIFileAttrGet(ctx, name, directory) - @ccall mlir_c.mlirLLVMDIFileAttrGet(ctx::MlirContext, name::MlirAttribute, directory::MlirAttribute)::MlirAttribute + @ccall mlir_c.mlirLLVMDIFileAttrGet( + ctx::MlirContext, name::MlirAttribute, directory::MlirAttribute + )::MlirAttribute end @cenum MlirLLVMDIEmissionKind::UInt32 begin @@ -6858,8 +7631,19 @@ end Creates a LLVM DICompileUnit attribute. """ -function mlirLLVMDICompileUnitAttrGet(ctx, id, sourceLanguage, file, producer, isOptimized, emissionKind, nameTableKind) - @ccall mlir_c.mlirLLVMDICompileUnitAttrGet(ctx::MlirContext, id::MlirAttribute, sourceLanguage::Cuint, file::MlirAttribute, producer::MlirAttribute, isOptimized::Bool, emissionKind::MlirLLVMDIEmissionKind, nameTableKind::MlirLLVMDINameTableKind)::MlirAttribute +function mlirLLVMDICompileUnitAttrGet( + ctx, id, sourceLanguage, file, producer, isOptimized, emissionKind, nameTableKind +) + @ccall mlir_c.mlirLLVMDICompileUnitAttrGet( + ctx::MlirContext, + id::MlirAttribute, + sourceLanguage::Cuint, + file::MlirAttribute, + producer::MlirAttribute, + isOptimized::Bool, + emissionKind::MlirLLVMDIEmissionKind, + nameTableKind::MlirLLVMDINameTableKind, + )::MlirAttribute end """ @@ -6877,7 +7661,13 @@ end Creates a LLVM DILexicalBlock attribute. """ function mlirLLVMDILexicalBlockAttrGet(ctx, scope, file, line, column) - @ccall mlir_c.mlirLLVMDILexicalBlockAttrGet(ctx::MlirContext, scope::MlirAttribute, file::MlirAttribute, line::Cuint, column::Cuint)::MlirAttribute + @ccall mlir_c.mlirLLVMDILexicalBlockAttrGet( + ctx::MlirContext, + scope::MlirAttribute, + file::MlirAttribute, + line::Cuint, + column::Cuint, + )::MlirAttribute end """ @@ -6886,7 +7676,9 @@ end Creates a LLVM DILexicalBlockFile attribute. """ function mlirLLVMDILexicalBlockFileAttrGet(ctx, scope, file, discriminator) - @ccall mlir_c.mlirLLVMDILexicalBlockFileAttrGet(ctx::MlirContext, scope::MlirAttribute, file::MlirAttribute, discriminator::Cuint)::MlirAttribute + @ccall mlir_c.mlirLLVMDILexicalBlockFileAttrGet( + ctx::MlirContext, scope::MlirAttribute, file::MlirAttribute, discriminator::Cuint + )::MlirAttribute end """ @@ -6894,8 +7686,20 @@ end Creates a LLVM DILocalVariableAttr attribute. """ -function mlirLLVMDILocalVariableAttrGet(ctx, scope, name, diFile, line, arg, alignInBits, diType, flags) - @ccall mlir_c.mlirLLVMDILocalVariableAttrGet(ctx::MlirContext, scope::MlirAttribute, name::MlirAttribute, diFile::MlirAttribute, line::Cuint, arg::Cuint, alignInBits::Cuint, diType::MlirAttribute, flags::Int64)::MlirAttribute +function mlirLLVMDILocalVariableAttrGet( + ctx, scope, name, diFile, line, arg, alignInBits, diType, flags +) + @ccall mlir_c.mlirLLVMDILocalVariableAttrGet( + ctx::MlirContext, + scope::MlirAttribute, + name::MlirAttribute, + diFile::MlirAttribute, + line::Cuint, + arg::Cuint, + alignInBits::Cuint, + diType::MlirAttribute, + flags::Int64, + )::MlirAttribute end """ @@ -6912,8 +7716,44 @@ end Creates a LLVM DISubprogramAttr attribute. """ -function mlirLLVMDISubprogramAttrGet(ctx, recId, isRecSelf, id, compileUnit, scope, name, linkageName, file, line, scopeLine, subprogramFlags, type, nRetainedNodes, retainedNodes, nAnnotations, annotations) - @ccall mlir_c.mlirLLVMDISubprogramAttrGet(ctx::MlirContext, recId::MlirAttribute, isRecSelf::Bool, id::MlirAttribute, compileUnit::MlirAttribute, scope::MlirAttribute, name::MlirAttribute, linkageName::MlirAttribute, file::MlirAttribute, line::Cuint, scopeLine::Cuint, subprogramFlags::UInt64, type::MlirAttribute, nRetainedNodes::intptr_t, retainedNodes::Ptr{MlirAttribute}, nAnnotations::intptr_t, annotations::Ptr{MlirAttribute})::MlirAttribute +function mlirLLVMDISubprogramAttrGet( + ctx, + recId, + isRecSelf, + id, + compileUnit, + scope, + name, + linkageName, + file, + line, + scopeLine, + subprogramFlags, + type, + nRetainedNodes, + retainedNodes, + nAnnotations, + annotations, +) + @ccall mlir_c.mlirLLVMDISubprogramAttrGet( + ctx::MlirContext, + recId::MlirAttribute, + isRecSelf::Bool, + id::MlirAttribute, + compileUnit::MlirAttribute, + scope::MlirAttribute, + name::MlirAttribute, + linkageName::MlirAttribute, + file::MlirAttribute, + line::Cuint, + scopeLine::Cuint, + subprogramFlags::UInt64, + type::MlirAttribute, + nRetainedNodes::intptr_t, + retainedNodes::Ptr{MlirAttribute}, + nAnnotations::intptr_t, + annotations::Ptr{MlirAttribute}, + )::MlirAttribute end """ @@ -6922,7 +7762,9 @@ end Creates a LLVM DIAnnotation attribute. """ function mlirLLVMDIAnnotationAttrGet(ctx, name, value) - @ccall mlir_c.mlirLLVMDIAnnotationAttrGet(ctx::MlirContext, name::MlirAttribute, value::MlirAttribute)::MlirAttribute + @ccall mlir_c.mlirLLVMDIAnnotationAttrGet( + ctx::MlirContext, name::MlirAttribute, value::MlirAttribute + )::MlirAttribute end """ @@ -6931,7 +7773,9 @@ end Gets the scope from this DISubprogramAttr. """ function mlirLLVMDISubprogramAttrGetScope(diSubprogram) - @ccall mlir_c.mlirLLVMDISubprogramAttrGetScope(diSubprogram::MlirAttribute)::MlirAttribute + @ccall mlir_c.mlirLLVMDISubprogramAttrGetScope( + diSubprogram::MlirAttribute + )::MlirAttribute end """ @@ -6958,7 +7802,9 @@ end Gets the compile unit from this DISubprogram. """ function mlirLLVMDISubprogramAttrGetCompileUnit(diSubprogram) - @ccall mlir_c.mlirLLVMDISubprogramAttrGetCompileUnit(diSubprogram::MlirAttribute)::MlirAttribute + @ccall mlir_c.mlirLLVMDISubprogramAttrGetCompileUnit( + diSubprogram::MlirAttribute + )::MlirAttribute end """ @@ -6967,7 +7813,9 @@ end Gets the file from this DISubprogramAttr. """ function mlirLLVMDISubprogramAttrGetFile(diSubprogram) - @ccall mlir_c.mlirLLVMDISubprogramAttrGetFile(diSubprogram::MlirAttribute)::MlirAttribute + @ccall mlir_c.mlirLLVMDISubprogramAttrGetFile( + diSubprogram::MlirAttribute + )::MlirAttribute end """ @@ -6976,7 +7824,9 @@ end Gets the type from this DISubprogramAttr. """ function mlirLLVMDISubprogramAttrGetType(diSubprogram) - @ccall mlir_c.mlirLLVMDISubprogramAttrGetType(diSubprogram::MlirAttribute)::MlirAttribute + @ccall mlir_c.mlirLLVMDISubprogramAttrGetType( + diSubprogram::MlirAttribute + )::MlirAttribute end """ @@ -6985,7 +7835,12 @@ end Creates a LLVM DISubroutineTypeAttr attribute. """ function mlirLLVMDISubroutineTypeAttrGet(ctx, callingConvention, nTypes, types) - @ccall mlir_c.mlirLLVMDISubroutineTypeAttrGet(ctx::MlirContext, callingConvention::Cuint, nTypes::intptr_t, types::Ptr{MlirAttribute})::MlirAttribute + @ccall mlir_c.mlirLLVMDISubroutineTypeAttrGet( + ctx::MlirContext, + callingConvention::Cuint, + nTypes::intptr_t, + types::Ptr{MlirAttribute}, + )::MlirAttribute end """ @@ -6993,8 +7848,20 @@ end Creates a LLVM DIModuleAttr attribute. """ -function mlirLLVMDIModuleAttrGet(ctx, file, scope, name, configMacros, includePath, apinotes, line, isDecl) - @ccall mlir_c.mlirLLVMDIModuleAttrGet(ctx::MlirContext, file::MlirAttribute, scope::MlirAttribute, name::MlirAttribute, configMacros::MlirAttribute, includePath::MlirAttribute, apinotes::MlirAttribute, line::Cuint, isDecl::Bool)::MlirAttribute +function mlirLLVMDIModuleAttrGet( + ctx, file, scope, name, configMacros, includePath, apinotes, line, isDecl +) + @ccall mlir_c.mlirLLVMDIModuleAttrGet( + ctx::MlirContext, + file::MlirAttribute, + scope::MlirAttribute, + name::MlirAttribute, + configMacros::MlirAttribute, + includePath::MlirAttribute, + apinotes::MlirAttribute, + line::Cuint, + isDecl::Bool, + )::MlirAttribute end """ @@ -7002,8 +7869,20 @@ end Creates a LLVM DIImportedEntityAttr attribute. """ -function mlirLLVMDIImportedEntityAttrGet(ctx, tag, scope, entity, file, line, name, nElements, elements) - @ccall mlir_c.mlirLLVMDIImportedEntityAttrGet(ctx::MlirContext, tag::Cuint, scope::MlirAttribute, entity::MlirAttribute, file::MlirAttribute, line::Cuint, name::MlirAttribute, nElements::intptr_t, elements::Ptr{MlirAttribute})::MlirAttribute +function mlirLLVMDIImportedEntityAttrGet( + ctx, tag, scope, entity, file, line, name, nElements, elements +) + @ccall mlir_c.mlirLLVMDIImportedEntityAttrGet( + ctx::MlirContext, + tag::Cuint, + scope::MlirAttribute, + entity::MlirAttribute, + file::MlirAttribute, + line::Cuint, + name::MlirAttribute, + nElements::intptr_t, + elements::Ptr{MlirAttribute}, + )::MlirAttribute end """ @@ -7148,8 +8027,17 @@ function mlirTypeIsANVGPUTensorMapDescriptorType(type) @ccall mlir_c.mlirTypeIsANVGPUTensorMapDescriptorType(type::MlirType)::Bool end -function mlirNVGPUTensorMapDescriptorTypeGet(ctx, tensorMemrefType, swizzle, l2promo, oobFill, interleave) - @ccall mlir_c.mlirNVGPUTensorMapDescriptorTypeGet(ctx::MlirContext, tensorMemrefType::MlirType, swizzle::Cint, l2promo::Cint, oobFill::Cint, interleave::Cint)::MlirType +function mlirNVGPUTensorMapDescriptorTypeGet( + ctx, tensorMemrefType, swizzle, l2promo, oobFill, interleave +) + @ccall mlir_c.mlirNVGPUTensorMapDescriptorTypeGet( + ctx::MlirContext, + tensorMemrefType::MlirType, + swizzle::Cint, + l2promo::Cint, + oobFill::Cint, + interleave::Cint, + )::MlirType end function mlirGetDialectHandle__nvvm__() @@ -7240,7 +8128,9 @@ end Returns the minimum possible value stored by a quantized type. """ function mlirQuantizedTypeGetDefaultMinimumForInteger(isSigned, integralWidth) - @ccall mlir_c.mlirQuantizedTypeGetDefaultMinimumForInteger(isSigned::Bool, integralWidth::Cuint)::Int64 + @ccall mlir_c.mlirQuantizedTypeGetDefaultMinimumForInteger( + isSigned::Bool, integralWidth::Cuint + )::Int64 end """ @@ -7249,7 +8139,9 @@ end Returns the maximum possible value stored by a quantized type. """ function mlirQuantizedTypeGetDefaultMaximumForInteger(isSigned, integralWidth) - @ccall mlir_c.mlirQuantizedTypeGetDefaultMaximumForInteger(isSigned::Bool, integralWidth::Cuint)::Int64 + @ccall mlir_c.mlirQuantizedTypeGetDefaultMaximumForInteger( + isSigned::Bool, integralWidth::Cuint + )::Int64 end """ @@ -7321,7 +8213,9 @@ end Returns `true` if the `candidate` type is compatible with the given quantized `type`. """ function mlirQuantizedTypeIsCompatibleExpressedType(type, candidate) - @ccall mlir_c.mlirQuantizedTypeIsCompatibleExpressedType(type::MlirType, candidate::MlirType)::Bool + @ccall mlir_c.mlirQuantizedTypeIsCompatibleExpressedType( + type::MlirType, candidate::MlirType + )::Bool end """ @@ -7339,7 +8233,9 @@ end 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. """ function mlirQuantizedTypeCastFromStorageType(type, candidate) - @ccall mlir_c.mlirQuantizedTypeCastFromStorageType(type::MlirType, candidate::MlirType)::MlirType + @ccall mlir_c.mlirQuantizedTypeCastFromStorageType( + type::MlirType, candidate::MlirType + )::MlirType end """ @@ -7357,7 +8253,9 @@ end 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. """ function mlirQuantizedTypeCastFromExpressedType(type, candidate) - @ccall mlir_c.mlirQuantizedTypeCastFromExpressedType(type::MlirType, candidate::MlirType)::MlirType + @ccall mlir_c.mlirQuantizedTypeCastFromExpressedType( + type::MlirType, candidate::MlirType + )::MlirType end """ @@ -7375,7 +8273,9 @@ end 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. """ function mlirQuantizedTypeCastExpressedToStorageType(type, candidate) - @ccall mlir_c.mlirQuantizedTypeCastExpressedToStorageType(type::MlirType, candidate::MlirType)::MlirType + @ccall mlir_c.mlirQuantizedTypeCastExpressedToStorageType( + type::MlirType, candidate::MlirType + )::MlirType end """ @@ -7392,8 +8292,16 @@ end 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. """ -function mlirAnyQuantizedTypeGet(flags, storageType, expressedType, storageTypeMin, storageTypeMax) - @ccall mlir_c.mlirAnyQuantizedTypeGet(flags::Cuint, storageType::MlirType, expressedType::MlirType, storageTypeMin::Int64, storageTypeMax::Int64)::MlirType +function mlirAnyQuantizedTypeGet( + flags, storageType, expressedType, storageTypeMin, storageTypeMax +) + @ccall mlir_c.mlirAnyQuantizedTypeGet( + flags::Cuint, + storageType::MlirType, + expressedType::MlirType, + storageTypeMin::Int64, + storageTypeMax::Int64, + )::MlirType end """ @@ -7410,8 +8318,18 @@ end 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. """ -function mlirUniformQuantizedTypeGet(flags, storageType, expressedType, scale, zeroPoint, storageTypeMin, storageTypeMax) - @ccall mlir_c.mlirUniformQuantizedTypeGet(flags::Cuint, storageType::MlirType, expressedType::MlirType, scale::Cdouble, zeroPoint::Int64, storageTypeMin::Int64, storageTypeMax::Int64)::MlirType +function mlirUniformQuantizedTypeGet( + flags, storageType, expressedType, scale, zeroPoint, storageTypeMin, storageTypeMax +) + @ccall mlir_c.mlirUniformQuantizedTypeGet( + flags::Cuint, + storageType::MlirType, + expressedType::MlirType, + scale::Cdouble, + zeroPoint::Int64, + storageTypeMin::Int64, + storageTypeMax::Int64, + )::MlirType end """ @@ -7455,8 +8373,28 @@ end 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. """ -function mlirUniformQuantizedPerAxisTypeGet(flags, storageType, expressedType, nDims, scales, zeroPoints, quantizedDimension, storageTypeMin, storageTypeMax) - @ccall mlir_c.mlirUniformQuantizedPerAxisTypeGet(flags::Cuint, storageType::MlirType, expressedType::MlirType, nDims::intptr_t, scales::Ptr{Cdouble}, zeroPoints::Ptr{Int64}, quantizedDimension::Int32, storageTypeMin::Int64, storageTypeMax::Int64)::MlirType +function mlirUniformQuantizedPerAxisTypeGet( + flags, + storageType, + expressedType, + nDims, + scales, + zeroPoints, + quantizedDimension, + storageTypeMin, + storageTypeMax, +) + @ccall mlir_c.mlirUniformQuantizedPerAxisTypeGet( + flags::Cuint, + storageType::MlirType, + expressedType::MlirType, + nDims::intptr_t, + scales::Ptr{Cdouble}, + zeroPoints::Ptr{Int64}, + quantizedDimension::Int32, + storageTypeMin::Int64, + storageTypeMax::Int64, + )::MlirType end """ @@ -7474,7 +8412,9 @@ end Returns `pos`-th scale of the given quantized per-axis type. """ function mlirUniformQuantizedPerAxisTypeGetScale(type, pos) - @ccall mlir_c.mlirUniformQuantizedPerAxisTypeGetScale(type::MlirType, pos::intptr_t)::Cdouble + @ccall mlir_c.mlirUniformQuantizedPerAxisTypeGetScale( + type::MlirType, pos::intptr_t + )::Cdouble end """ @@ -7483,7 +8423,9 @@ end Returns `pos`-th zero point of the given quantized per-axis type. """ function mlirUniformQuantizedPerAxisTypeGetZeroPoint(type, pos) - @ccall mlir_c.mlirUniformQuantizedPerAxisTypeGetZeroPoint(type::MlirType, pos::intptr_t)::Int64 + @ccall mlir_c.mlirUniformQuantizedPerAxisTypeGetZeroPoint( + type::MlirType, pos::intptr_t + )::Int64 end """ @@ -7492,7 +8434,9 @@ end Returns the index of the quantized dimension in the given quantized per-axis type. """ function mlirUniformQuantizedPerAxisTypeGetQuantizedDimension(type) - @ccall mlir_c.mlirUniformQuantizedPerAxisTypeGetQuantizedDimension(type::MlirType)::Int32 + @ccall mlir_c.mlirUniformQuantizedPerAxisTypeGetQuantizedDimension( + type::MlirType + )::Int32 end """ @@ -7519,7 +8463,9 @@ end 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. """ function mlirCalibratedQuantizedTypeGet(expressedType, min, max) - @ccall mlir_c.mlirCalibratedQuantizedTypeGet(expressedType::MlirType, min::Cdouble, max::Cdouble)::MlirType + @ccall mlir_c.mlirCalibratedQuantizedTypeGet( + expressedType::MlirType, min::Cdouble, max::Cdouble + )::MlirType end """ @@ -7596,8 +8542,20 @@ end Creates a `sparse\\_tensor.encoding` attribute with the given parameters. """ -function mlirSparseTensorEncodingAttrGet(ctx, lvlRank, lvlTypes, dimToLvl, lvlTodim, posWidth, crdWidth, explicitVal, implicitVal) - @ccall mlir_c.mlirSparseTensorEncodingAttrGet(ctx::MlirContext, lvlRank::intptr_t, lvlTypes::Ptr{MlirSparseTensorLevelType}, dimToLvl::MlirAffineMap, lvlTodim::MlirAffineMap, posWidth::Cint, crdWidth::Cint, explicitVal::MlirAttribute, implicitVal::MlirAttribute)::MlirAttribute +function mlirSparseTensorEncodingAttrGet( + ctx, lvlRank, lvlTypes, dimToLvl, lvlTodim, posWidth, crdWidth, explicitVal, implicitVal +) + @ccall mlir_c.mlirSparseTensorEncodingAttrGet( + ctx::MlirContext, + lvlRank::intptr_t, + lvlTypes::Ptr{MlirSparseTensorLevelType}, + dimToLvl::MlirAffineMap, + lvlTodim::MlirAffineMap, + posWidth::Cint, + crdWidth::Cint, + explicitVal::MlirAttribute, + implicitVal::MlirAttribute, + )::MlirAttribute end """ @@ -7615,7 +8573,9 @@ end Returns a specified level-type of the `sparse\\_tensor.encoding` attribute. """ function mlirSparseTensorEncodingAttrGetLvlType(attr, lvl) - @ccall mlir_c.mlirSparseTensorEncodingAttrGetLvlType(attr::MlirAttribute, lvl::intptr_t)::MlirSparseTensorLevelType + @ccall mlir_c.mlirSparseTensorEncodingAttrGetLvlType( + attr::MlirAttribute, lvl::intptr_t + )::MlirSparseTensorLevelType end """ @@ -7624,7 +8584,9 @@ end Returns a specified level-format of the `sparse\\_tensor.encoding` attribute. """ function mlirSparseTensorEncodingAttrGetLvlFmt(attr, lvl) - @ccall mlir_c.mlirSparseTensorEncodingAttrGetLvlFmt(attr::MlirAttribute, lvl::intptr_t)::MlirSparseTensorLevelFormat + @ccall mlir_c.mlirSparseTensorEncodingAttrGetLvlFmt( + attr::MlirAttribute, lvl::intptr_t + )::MlirSparseTensorLevelFormat end """ @@ -7633,7 +8595,9 @@ end Returns the dimension-to-level mapping of the `sparse\\_tensor.encoding` attribute. """ function mlirSparseTensorEncodingAttrGetDimToLvl(attr) - @ccall mlir_c.mlirSparseTensorEncodingAttrGetDimToLvl(attr::MlirAttribute)::MlirAffineMap + @ccall mlir_c.mlirSparseTensorEncodingAttrGetDimToLvl( + attr::MlirAttribute + )::MlirAffineMap end """ @@ -7642,7 +8606,9 @@ end Returns the level-to-dimension mapping of the `sparse\\_tensor.encoding` attribute. """ function mlirSparseTensorEncodingAttrGetLvlToDim(attr) - @ccall mlir_c.mlirSparseTensorEncodingAttrGetLvlToDim(attr::MlirAttribute)::MlirAffineMap + @ccall mlir_c.mlirSparseTensorEncodingAttrGetLvlToDim( + attr::MlirAttribute + )::MlirAffineMap end """ @@ -7669,7 +8635,9 @@ end Returns the explicit value of the `sparse\\_tensor.encoding` attribute. """ function mlirSparseTensorEncodingAttrGetExplicitVal(attr) - @ccall mlir_c.mlirSparseTensorEncodingAttrGetExplicitVal(attr::MlirAttribute)::MlirAttribute + @ccall mlir_c.mlirSparseTensorEncodingAttrGetExplicitVal( + attr::MlirAttribute + )::MlirAttribute end """ @@ -7678,19 +8646,31 @@ end Returns the implicit value of the `sparse\\_tensor.encoding` attribute. """ function mlirSparseTensorEncodingAttrGetImplicitVal(attr) - @ccall mlir_c.mlirSparseTensorEncodingAttrGetImplicitVal(attr::MlirAttribute)::MlirAttribute + @ccall mlir_c.mlirSparseTensorEncodingAttrGetImplicitVal( + attr::MlirAttribute + )::MlirAttribute end function mlirSparseTensorEncodingAttrGetStructuredN(lvlType) - @ccall mlir_c.mlirSparseTensorEncodingAttrGetStructuredN(lvlType::MlirSparseTensorLevelType)::Cuint + @ccall mlir_c.mlirSparseTensorEncodingAttrGetStructuredN( + lvlType::MlirSparseTensorLevelType + )::Cuint end function mlirSparseTensorEncodingAttrGetStructuredM(lvlType) - @ccall mlir_c.mlirSparseTensorEncodingAttrGetStructuredM(lvlType::MlirSparseTensorLevelType)::Cuint + @ccall mlir_c.mlirSparseTensorEncodingAttrGetStructuredM( + lvlType::MlirSparseTensorLevelType + )::Cuint end function mlirSparseTensorEncodingAttrBuildLvlType(lvlFmt, properties, propSize, n, m) - @ccall mlir_c.mlirSparseTensorEncodingAttrBuildLvlType(lvlFmt::MlirSparseTensorLevelFormat, properties::Ptr{MlirSparseTensorLevelPropertyNondefault}, propSize::Cuint, n::Cuint, m::Cuint)::MlirSparseTensorLevelType + @ccall mlir_c.mlirSparseTensorEncodingAttrBuildLvlType( + lvlFmt::MlirSparseTensorLevelFormat, + properties::Ptr{MlirSparseTensorLevelPropertyNondefault}, + propSize::Cuint, + n::Cuint, + m::Cuint, + )::MlirSparseTensorLevelType end function mlirRegisterSparseTensorPasses() @@ -7878,7 +8858,9 @@ function mlirTransformOperationTypeGetTypeID() end function mlirTransformOperationTypeGet(ctx, operationName) - @ccall mlir_c.mlirTransformOperationTypeGet(ctx::MlirContext, operationName::MlirStringRef)::MlirType + @ccall mlir_c.mlirTransformOperationTypeGet( + ctx::MlirContext, operationName::MlirStringRef + )::MlirType end function mlirTransformOperationTypeGetOperationName(type) @@ -7920,7 +8902,9 @@ end Enables or disables expensive checks in transform options. """ function mlirTransformOptionsEnableExpensiveChecks(transformOptions, enable) - @ccall mlir_c.mlirTransformOptionsEnableExpensiveChecks(transformOptions::MlirTransformOptions, enable::Bool)::Cvoid + @ccall mlir_c.mlirTransformOptionsEnableExpensiveChecks( + transformOptions::MlirTransformOptions, enable::Bool + )::Cvoid end """ @@ -7929,7 +8913,9 @@ end Returns true if expensive checks are enabled in transform options. """ function mlirTransformOptionsGetExpensiveChecksEnabled(transformOptions) - @ccall mlir_c.mlirTransformOptionsGetExpensiveChecksEnabled(transformOptions::MlirTransformOptions)::Bool + @ccall mlir_c.mlirTransformOptionsGetExpensiveChecksEnabled( + transformOptions::MlirTransformOptions + )::Bool end """ @@ -7938,7 +8924,9 @@ end Enables or disables the enforcement of the top-level transform op being single in transform options. """ function mlirTransformOptionsEnforceSingleTopLevelTransformOp(transformOptions, enable) - @ccall mlir_c.mlirTransformOptionsEnforceSingleTopLevelTransformOp(transformOptions::MlirTransformOptions, enable::Bool)::Cvoid + @ccall mlir_c.mlirTransformOptionsEnforceSingleTopLevelTransformOp( + transformOptions::MlirTransformOptions, enable::Bool + )::Cvoid end """ @@ -7947,7 +8935,9 @@ end Returns true if the enforcement of the top-level transform op being single is enabled in transform options. """ function mlirTransformOptionsGetEnforceSingleTopLevelTransformOp(transformOptions) - @ccall mlir_c.mlirTransformOptionsGetEnforceSingleTopLevelTransformOp(transformOptions::MlirTransformOptions)::Bool + @ccall mlir_c.mlirTransformOptionsGetEnforceSingleTopLevelTransformOp( + transformOptions::MlirTransformOptions + )::Bool end """ @@ -7964,8 +8954,15 @@ end 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. """ -function mlirTransformApplyNamedSequence(payload, transformRoot, transformModule, transformOptions) - @ccall mlir_c.mlirTransformApplyNamedSequence(payload::MlirOperation, transformRoot::MlirOperation, transformModule::MlirOperation, transformOptions::MlirTransformOptions)::MlirLogicalResult +function mlirTransformApplyNamedSequence( + payload, transformRoot, transformModule, transformOptions +) + @ccall mlir_c.mlirTransformApplyNamedSequence( + payload::MlirOperation, + transformRoot::MlirOperation, + transformModule::MlirOperation, + transformOptions::MlirTransformOptions, + )::MlirLogicalResult end """ @@ -7976,7 +8973,9 @@ Merge the symbols from `other` into `target`, potentially renaming them to avoid Note that this clones the `other` operation unlike the C++ counterpart that takes ownership. """ function mlirMergeSymbolsIntoFromClone(target, other) - @ccall mlir_c.mlirMergeSymbolsIntoFromClone(target::MlirOperation, other::MlirOperation)::MlirLogicalResult + @ccall mlir_c.mlirMergeSymbolsIntoFromClone( + target::MlirOperation, other::MlirOperation + )::MlirLogicalResult end function mlirGetDialectHandle__vector__() @@ -7993,7 +8992,13 @@ end Creates an ExecutionEngine for the provided ModuleOp. The ModuleOp is expected to be "translatable" to LLVM IR (only contains operations in dialects that implement the `LLVMTranslationDialectInterface`). The module ownership stays with the client and can be destroyed as soon as the call returns. `optLevel` is the optimization level to be used for transformation and code generation. LLVM passes at `optLevel` are run before code generation. The number and array of paths corresponding to shared libraries that will be loaded are specified via `numPaths` and `sharedLibPaths` respectively. TODO: figure out other options. """ function mlirExecutionEngineCreate(op, optLevel, numPaths, sharedLibPaths, enableObjectDump) - @ccall mlir_c.mlirExecutionEngineCreate(op::MlirModule, optLevel::Cint, numPaths::Cint, sharedLibPaths::Ptr{MlirStringRef}, enableObjectDump::Bool)::MlirExecutionEngine + @ccall mlir_c.mlirExecutionEngineCreate( + op::MlirModule, + optLevel::Cint, + numPaths::Cint, + sharedLibPaths::Ptr{MlirStringRef}, + enableObjectDump::Bool, + )::MlirExecutionEngine end """ @@ -8020,7 +9025,9 @@ end 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). """ function mlirExecutionEngineInvokePacked(jit, name, arguments) - @ccall mlir_c.mlirExecutionEngineInvokePacked(jit::MlirExecutionEngine, name::MlirStringRef, arguments::Ptr{Ptr{Cvoid}})::MlirLogicalResult + @ccall mlir_c.mlirExecutionEngineInvokePacked( + jit::MlirExecutionEngine, name::MlirStringRef, arguments::Ptr{Ptr{Cvoid}} + )::MlirLogicalResult end """ @@ -8029,7 +9036,9 @@ end 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. """ function mlirExecutionEngineLookupPacked(jit, name) - @ccall mlir_c.mlirExecutionEngineLookupPacked(jit::MlirExecutionEngine, name::MlirStringRef)::Ptr{Cvoid} + @ccall mlir_c.mlirExecutionEngineLookupPacked( + jit::MlirExecutionEngine, name::MlirStringRef + )::Ptr{Cvoid} end """ @@ -8038,7 +9047,9 @@ end Lookup a native function in the execution engine by name, returns nullptr if the name can't be looked-up. """ function mlirExecutionEngineLookup(jit, name) - @ccall mlir_c.mlirExecutionEngineLookup(jit::MlirExecutionEngine, name::MlirStringRef)::Ptr{Cvoid} + @ccall mlir_c.mlirExecutionEngineLookup( + jit::MlirExecutionEngine, name::MlirStringRef + )::Ptr{Cvoid} end """ @@ -8047,7 +9058,9 @@ end Register a symbol with the jit: this symbol will be accessible to the jitted code. """ function mlirExecutionEngineRegisterSymbol(jit, name, sym) - @ccall mlir_c.mlirExecutionEngineRegisterSymbol(jit::MlirExecutionEngine, name::MlirStringRef, sym::Ptr{Cvoid})::Cvoid + @ccall mlir_c.mlirExecutionEngineRegisterSymbol( + jit::MlirExecutionEngine, name::MlirStringRef, sym::Ptr{Cvoid} + )::Cvoid end """ @@ -8056,7 +9069,9 @@ end Dump as an object in `fileName`. """ function mlirExecutionEngineDumpToObjectFile(jit, fileName) - @ccall mlir_c.mlirExecutionEngineDumpToObjectFile(jit::MlirExecutionEngine, fileName::MlirStringRef)::Cvoid + @ccall mlir_c.mlirExecutionEngineDumpToObjectFile( + jit::MlirExecutionEngine, fileName::MlirStringRef + )::Cvoid end """ @@ -8065,7 +9080,9 @@ end Returns `true` if the given operation implements an interface identified by its TypeID. """ function mlirOperationImplementsInterface(operation, interfaceTypeID) - @ccall mlir_c.mlirOperationImplementsInterface(operation::MlirOperation, interfaceTypeID::MlirTypeID)::Bool + @ccall mlir_c.mlirOperationImplementsInterface( + operation::MlirOperation, interfaceTypeID::MlirTypeID + )::Bool end """ @@ -8074,7 +9091,9 @@ end 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. """ function mlirOperationImplementsInterfaceStatic(operationName, context, interfaceTypeID) - @ccall mlir_c.mlirOperationImplementsInterfaceStatic(operationName::MlirStringRef, context::MlirContext, interfaceTypeID::MlirTypeID)::Bool + @ccall mlir_c.mlirOperationImplementsInterfaceStatic( + operationName::MlirStringRef, context::MlirContext, interfaceTypeID::MlirTypeID + )::Bool end """ @@ -8097,8 +9116,32 @@ const MlirTypesCallback = Ptr{Cvoid} Infers the return types of the operation identified by its canonical given the arguments that will be supplied to its generic builder. Calls `callback` with the types of inferred arguments, potentially several times, on success. Returns failure otherwise. """ -function mlirInferTypeOpInterfaceInferReturnTypes(opName, context, location, nOperands, operands, attributes, properties, nRegions, regions, callback, userData) - @ccall mlir_c.mlirInferTypeOpInterfaceInferReturnTypes(opName::MlirStringRef, context::MlirContext, location::MlirLocation, nOperands::intptr_t, operands::Ptr{MlirValue}, attributes::MlirAttribute, properties::Ptr{Cvoid}, nRegions::intptr_t, regions::Ptr{MlirRegion}, callback::MlirTypesCallback, userData::Ptr{Cvoid})::MlirLogicalResult +function mlirInferTypeOpInterfaceInferReturnTypes( + opName, + context, + location, + nOperands, + operands, + attributes, + properties, + nRegions, + regions, + callback, + userData, +) + @ccall mlir_c.mlirInferTypeOpInterfaceInferReturnTypes( + opName::MlirStringRef, + context::MlirContext, + location::MlirLocation, + nOperands::intptr_t, + operands::Ptr{MlirValue}, + attributes::MlirAttribute, + properties::Ptr{Cvoid}, + nRegions::intptr_t, + regions::Ptr{MlirRegion}, + callback::MlirTypesCallback, + userData::Ptr{Cvoid}, + )::MlirLogicalResult end """ @@ -8121,8 +9164,32 @@ const MlirShapedTypeComponentsCallback = Ptr{Cvoid} Infers the return shaped type components of the operation. Calls `callback` with the types of inferred arguments on success. Returns failure otherwise. """ -function mlirInferShapedTypeOpInterfaceInferReturnTypes(opName, context, location, nOperands, operands, attributes, properties, nRegions, regions, callback, userData) - @ccall mlir_c.mlirInferShapedTypeOpInterfaceInferReturnTypes(opName::MlirStringRef, context::MlirContext, location::MlirLocation, nOperands::intptr_t, operands::Ptr{MlirValue}, attributes::MlirAttribute, properties::Ptr{Cvoid}, nRegions::intptr_t, regions::Ptr{MlirRegion}, callback::MlirShapedTypeComponentsCallback, userData::Ptr{Cvoid})::MlirLogicalResult +function mlirInferShapedTypeOpInterfaceInferReturnTypes( + opName, + context, + location, + nOperands, + operands, + attributes, + properties, + nRegions, + regions, + callback, + userData, +) + @ccall mlir_c.mlirInferShapedTypeOpInterfaceInferReturnTypes( + opName::MlirStringRef, + context::MlirContext, + location::MlirLocation, + nOperands::intptr_t, + operands::Ptr{MlirValue}, + attributes::MlirAttribute, + properties::Ptr{Cvoid}, + nRegions::intptr_t, + regions::Ptr{MlirRegion}, + callback::MlirShapedTypeComponentsCallback, + userData::Ptr{Cvoid}, + )::MlirLogicalResult end """ @@ -8192,7 +9259,9 @@ end Sets the insertion point to the specified operation, which will cause subsequent insertions to go right before it. """ function mlirRewriterBaseSetInsertionPointBefore(rewriter, op) - @ccall mlir_c.mlirRewriterBaseSetInsertionPointBefore(rewriter::MlirRewriterBase, op::MlirOperation)::Cvoid + @ccall mlir_c.mlirRewriterBaseSetInsertionPointBefore( + rewriter::MlirRewriterBase, op::MlirOperation + )::Cvoid end """ @@ -8201,7 +9270,9 @@ end Sets the insertion point to the node after the specified operation, which will cause subsequent insertions to go right after it. """ function mlirRewriterBaseSetInsertionPointAfter(rewriter, op) - @ccall mlir_c.mlirRewriterBaseSetInsertionPointAfter(rewriter::MlirRewriterBase, op::MlirOperation)::Cvoid + @ccall mlir_c.mlirRewriterBaseSetInsertionPointAfter( + rewriter::MlirRewriterBase, op::MlirOperation + )::Cvoid end """ @@ -8210,7 +9281,9 @@ end 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. """ function mlirRewriterBaseSetInsertionPointAfterValue(rewriter, value) - @ccall mlir_c.mlirRewriterBaseSetInsertionPointAfterValue(rewriter::MlirRewriterBase, value::MlirValue)::Cvoid + @ccall mlir_c.mlirRewriterBaseSetInsertionPointAfterValue( + rewriter::MlirRewriterBase, value::MlirValue + )::Cvoid end """ @@ -8219,7 +9292,9 @@ end Sets the insertion point to the start of the specified block. """ function mlirRewriterBaseSetInsertionPointToStart(rewriter, block) - @ccall mlir_c.mlirRewriterBaseSetInsertionPointToStart(rewriter::MlirRewriterBase, block::MlirBlock)::Cvoid + @ccall mlir_c.mlirRewriterBaseSetInsertionPointToStart( + rewriter::MlirRewriterBase, block::MlirBlock + )::Cvoid end """ @@ -8228,7 +9303,9 @@ end Sets the insertion point to the end of the specified block. """ function mlirRewriterBaseSetInsertionPointToEnd(rewriter, block) - @ccall mlir_c.mlirRewriterBaseSetInsertionPointToEnd(rewriter::MlirRewriterBase, block::MlirBlock)::Cvoid + @ccall mlir_c.mlirRewriterBaseSetInsertionPointToEnd( + rewriter::MlirRewriterBase, block::MlirBlock + )::Cvoid end """ @@ -8254,8 +9331,16 @@ end 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`. """ -function mlirRewriterBaseCreateBlockBefore(rewriter, insertBefore, nArgTypes, argTypes, locations) - @ccall mlir_c.mlirRewriterBaseCreateBlockBefore(rewriter::MlirRewriterBase, insertBefore::MlirBlock, nArgTypes::intptr_t, argTypes::Ptr{MlirType}, locations::Ptr{MlirLocation})::MlirBlock +function mlirRewriterBaseCreateBlockBefore( + rewriter, insertBefore, nArgTypes, argTypes, locations +) + @ccall mlir_c.mlirRewriterBaseCreateBlockBefore( + rewriter::MlirRewriterBase, + insertBefore::MlirBlock, + nArgTypes::intptr_t, + argTypes::Ptr{MlirType}, + locations::Ptr{MlirLocation}, + )::MlirBlock end """ @@ -8264,7 +9349,9 @@ end Insert the given operation at the current insertion point and return it. """ function mlirRewriterBaseInsert(rewriter, op) - @ccall mlir_c.mlirRewriterBaseInsert(rewriter::MlirRewriterBase, op::MlirOperation)::MlirOperation + @ccall mlir_c.mlirRewriterBaseInsert( + rewriter::MlirRewriterBase, op::MlirOperation + )::MlirOperation end """ @@ -8273,7 +9360,9 @@ end Creates a deep copy of the specified operation. """ function mlirRewriterBaseClone(rewriter, op) - @ccall mlir_c.mlirRewriterBaseClone(rewriter::MlirRewriterBase, op::MlirOperation)::MlirOperation + @ccall mlir_c.mlirRewriterBaseClone( + rewriter::MlirRewriterBase, op::MlirOperation + )::MlirOperation end """ @@ -8282,7 +9371,9 @@ end Creates a deep copy of this operation but keep the operation regions empty. """ function mlirRewriterBaseCloneWithoutRegions(rewriter, op) - @ccall mlir_c.mlirRewriterBaseCloneWithoutRegions(rewriter::MlirRewriterBase, op::MlirOperation)::MlirOperation + @ccall mlir_c.mlirRewriterBaseCloneWithoutRegions( + rewriter::MlirRewriterBase, op::MlirOperation + )::MlirOperation end """ @@ -8291,7 +9382,9 @@ end Clone the blocks that belong to "region" before the given position in another region "parent". """ function mlirRewriterBaseCloneRegionBefore(rewriter, region, before) - @ccall mlir_c.mlirRewriterBaseCloneRegionBefore(rewriter::MlirRewriterBase, region::MlirRegion, before::MlirBlock)::Cvoid + @ccall mlir_c.mlirRewriterBaseCloneRegionBefore( + rewriter::MlirRewriterBase, region::MlirRegion, before::MlirBlock + )::Cvoid end """ @@ -8300,7 +9393,9 @@ end 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. """ function mlirRewriterBaseInlineRegionBefore(rewriter, region, before) - @ccall mlir_c.mlirRewriterBaseInlineRegionBefore(rewriter::MlirRewriterBase, region::MlirRegion, before::MlirBlock)::Cvoid + @ccall mlir_c.mlirRewriterBaseInlineRegionBefore( + rewriter::MlirRewriterBase, region::MlirRegion, before::MlirBlock + )::Cvoid end """ @@ -8309,7 +9404,12 @@ end 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. """ function mlirRewriterBaseReplaceOpWithValues(rewriter, op, nValues, values) - @ccall mlir_c.mlirRewriterBaseReplaceOpWithValues(rewriter::MlirRewriterBase, op::MlirOperation, nValues::intptr_t, values::Ptr{MlirValue})::Cvoid + @ccall mlir_c.mlirRewriterBaseReplaceOpWithValues( + rewriter::MlirRewriterBase, + op::MlirOperation, + nValues::intptr_t, + values::Ptr{MlirValue}, + )::Cvoid end """ @@ -8318,7 +9418,9 @@ end 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. """ function mlirRewriterBaseReplaceOpWithOperation(rewriter, op, newOp) - @ccall mlir_c.mlirRewriterBaseReplaceOpWithOperation(rewriter::MlirRewriterBase, op::MlirOperation, newOp::MlirOperation)::Cvoid + @ccall mlir_c.mlirRewriterBaseReplaceOpWithOperation( + rewriter::MlirRewriterBase, op::MlirOperation, newOp::MlirOperation + )::Cvoid end """ @@ -8327,7 +9429,9 @@ end Erases an operation that is known to have no uses. """ function mlirRewriterBaseEraseOp(rewriter, op) - @ccall mlir_c.mlirRewriterBaseEraseOp(rewriter::MlirRewriterBase, op::MlirOperation)::Cvoid + @ccall mlir_c.mlirRewriterBaseEraseOp( + rewriter::MlirRewriterBase, op::MlirOperation + )::Cvoid end """ @@ -8336,7 +9440,9 @@ end Erases a block along with all operations inside it. """ function mlirRewriterBaseEraseBlock(rewriter, block) - @ccall mlir_c.mlirRewriterBaseEraseBlock(rewriter::MlirRewriterBase, block::MlirBlock)::Cvoid + @ccall mlir_c.mlirRewriterBaseEraseBlock( + rewriter::MlirRewriterBase, block::MlirBlock + )::Cvoid end """ @@ -8347,7 +9453,13 @@ Inline the operations of block 'source' before the operation 'op'. The source bl The source block must have no successors. Otherwise, the resulting IR would have unreachable operations. """ function mlirRewriterBaseInlineBlockBefore(rewriter, source, op, nArgValues, argValues) - @ccall mlir_c.mlirRewriterBaseInlineBlockBefore(rewriter::MlirRewriterBase, source::MlirBlock, op::MlirOperation, nArgValues::intptr_t, argValues::Ptr{MlirValue})::Cvoid + @ccall mlir_c.mlirRewriterBaseInlineBlockBefore( + rewriter::MlirRewriterBase, + source::MlirBlock, + op::MlirOperation, + nArgValues::intptr_t, + argValues::Ptr{MlirValue}, + )::Cvoid end """ @@ -8358,7 +9470,13 @@ Inline the operations of block 'source' into the end of block 'dest'. The source The dest block must have no successors. Otherwise, the resulting IR would have unreachable operation. """ function mlirRewriterBaseMergeBlocks(rewriter, source, dest, nArgValues, argValues) - @ccall mlir_c.mlirRewriterBaseMergeBlocks(rewriter::MlirRewriterBase, source::MlirBlock, dest::MlirBlock, nArgValues::intptr_t, argValues::Ptr{MlirValue})::Cvoid + @ccall mlir_c.mlirRewriterBaseMergeBlocks( + rewriter::MlirRewriterBase, + source::MlirBlock, + dest::MlirBlock, + nArgValues::intptr_t, + argValues::Ptr{MlirValue}, + )::Cvoid end """ @@ -8367,7 +9485,9 @@ end 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. """ function mlirRewriterBaseMoveOpBefore(rewriter, op, existingOp) - @ccall mlir_c.mlirRewriterBaseMoveOpBefore(rewriter::MlirRewriterBase, op::MlirOperation, existingOp::MlirOperation)::Cvoid + @ccall mlir_c.mlirRewriterBaseMoveOpBefore( + rewriter::MlirRewriterBase, op::MlirOperation, existingOp::MlirOperation + )::Cvoid end """ @@ -8376,7 +9496,9 @@ end 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. """ function mlirRewriterBaseMoveOpAfter(rewriter, op, existingOp) - @ccall mlir_c.mlirRewriterBaseMoveOpAfter(rewriter::MlirRewriterBase, op::MlirOperation, existingOp::MlirOperation)::Cvoid + @ccall mlir_c.mlirRewriterBaseMoveOpAfter( + rewriter::MlirRewriterBase, op::MlirOperation, existingOp::MlirOperation + )::Cvoid end """ @@ -8385,7 +9507,9 @@ end Unlink this block and insert it right before `existingBlock`. """ function mlirRewriterBaseMoveBlockBefore(rewriter, block, existingBlock) - @ccall mlir_c.mlirRewriterBaseMoveBlockBefore(rewriter::MlirRewriterBase, block::MlirBlock, existingBlock::MlirBlock)::Cvoid + @ccall mlir_c.mlirRewriterBaseMoveBlockBefore( + rewriter::MlirRewriterBase, block::MlirBlock, existingBlock::MlirBlock + )::Cvoid end """ @@ -8394,7 +9518,9 @@ end 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. """ function mlirRewriterBaseStartOpModification(rewriter, op) - @ccall mlir_c.mlirRewriterBaseStartOpModification(rewriter::MlirRewriterBase, op::MlirOperation)::Cvoid + @ccall mlir_c.mlirRewriterBaseStartOpModification( + rewriter::MlirRewriterBase, op::MlirOperation + )::Cvoid end """ @@ -8403,7 +9529,9 @@ end 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`. """ function mlirRewriterBaseFinalizeOpModification(rewriter, op) - @ccall mlir_c.mlirRewriterBaseFinalizeOpModification(rewriter::MlirRewriterBase, op::MlirOperation)::Cvoid + @ccall mlir_c.mlirRewriterBaseFinalizeOpModification( + rewriter::MlirRewriterBase, op::MlirOperation + )::Cvoid end """ @@ -8412,7 +9540,9 @@ end This method cancels a pending in-place modification. This can only be called on operations that were provided to a call to `startOpModification`. """ function mlirRewriterBaseCancelOpModification(rewriter, op) - @ccall mlir_c.mlirRewriterBaseCancelOpModification(rewriter::MlirRewriterBase, op::MlirOperation)::Cvoid + @ccall mlir_c.mlirRewriterBaseCancelOpModification( + rewriter::MlirRewriterBase, op::MlirOperation + )::Cvoid end """ @@ -8421,7 +9551,9 @@ end 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). """ function mlirRewriterBaseReplaceAllUsesWith(rewriter, from, to) - @ccall mlir_c.mlirRewriterBaseReplaceAllUsesWith(rewriter::MlirRewriterBase, from::MlirValue, to::MlirValue)::Cvoid + @ccall mlir_c.mlirRewriterBaseReplaceAllUsesWith( + rewriter::MlirRewriterBase, from::MlirValue, to::MlirValue + )::Cvoid end """ @@ -8430,7 +9562,12 @@ end 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). """ function mlirRewriterBaseReplaceAllValueRangeUsesWith(rewriter, nValues, from, to) - @ccall mlir_c.mlirRewriterBaseReplaceAllValueRangeUsesWith(rewriter::MlirRewriterBase, nValues::intptr_t, from::Ptr{MlirValue}, to::Ptr{MlirValue})::Cvoid + @ccall mlir_c.mlirRewriterBaseReplaceAllValueRangeUsesWith( + rewriter::MlirRewriterBase, + nValues::intptr_t, + from::Ptr{MlirValue}, + to::Ptr{MlirValue}, + )::Cvoid end """ @@ -8439,7 +9576,9 @@ end 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. """ function mlirRewriterBaseReplaceAllOpUsesWithValueRange(rewriter, from, nTo, to) - @ccall mlir_c.mlirRewriterBaseReplaceAllOpUsesWithValueRange(rewriter::MlirRewriterBase, from::MlirOperation, nTo::intptr_t, to::Ptr{MlirValue})::Cvoid + @ccall mlir_c.mlirRewriterBaseReplaceAllOpUsesWithValueRange( + rewriter::MlirRewriterBase, from::MlirOperation, nTo::intptr_t, to::Ptr{MlirValue} + )::Cvoid end """ @@ -8448,7 +9587,9 @@ end 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. """ function mlirRewriterBaseReplaceAllOpUsesWithOperation(rewriter, from, to) - @ccall mlir_c.mlirRewriterBaseReplaceAllOpUsesWithOperation(rewriter::MlirRewriterBase, from::MlirOperation, to::MlirOperation)::Cvoid + @ccall mlir_c.mlirRewriterBaseReplaceAllOpUsesWithOperation( + rewriter::MlirRewriterBase, from::MlirOperation, to::MlirOperation + )::Cvoid end """ @@ -8456,8 +9597,16 @@ end 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. """ -function mlirRewriterBaseReplaceOpUsesWithinBlock(rewriter, op, nNewValues, newValues, block) - @ccall mlir_c.mlirRewriterBaseReplaceOpUsesWithinBlock(rewriter::MlirRewriterBase, op::MlirOperation, nNewValues::intptr_t, newValues::Ptr{MlirValue}, block::MlirBlock)::Cvoid +function mlirRewriterBaseReplaceOpUsesWithinBlock( + rewriter, op, nNewValues, newValues, block +) + @ccall mlir_c.mlirRewriterBaseReplaceOpUsesWithinBlock( + rewriter::MlirRewriterBase, + op::MlirOperation, + nNewValues::intptr_t, + newValues::Ptr{MlirValue}, + block::MlirBlock, + )::Cvoid end """ @@ -8466,7 +9615,12 @@ end 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). """ function mlirRewriterBaseReplaceAllUsesExcept(rewriter, from, to, exceptedUser) - @ccall mlir_c.mlirRewriterBaseReplaceAllUsesExcept(rewriter::MlirRewriterBase, from::MlirValue, to::MlirValue, exceptedUser::MlirOperation)::Cvoid + @ccall mlir_c.mlirRewriterBaseReplaceAllUsesExcept( + rewriter::MlirRewriterBase, + from::MlirValue, + to::MlirValue, + exceptedUser::MlirOperation, + )::Cvoid end """ @@ -8502,7 +9656,9 @@ end FrozenRewritePatternSet API """ function mlirFreezeRewritePattern(op) - @ccall mlir_c.mlirFreezeRewritePattern(op::MlirRewritePatternSet)::MlirFrozenRewritePatternSet + @ccall mlir_c.mlirFreezeRewritePattern( + op::MlirRewritePatternSet + )::MlirFrozenRewritePatternSet end function mlirFrozenRewritePatternSetDestroy(op) @@ -8510,7 +9666,11 @@ function mlirFrozenRewritePatternSetDestroy(op) end function mlirApplyPatternsAndFoldGreedily(op, patterns, arg3) - @ccall mlir_c.mlirApplyPatternsAndFoldGreedily(op::MlirModule, patterns::MlirFrozenRewritePatternSet, arg3::MlirGreedyRewriteDriverConfig)::MlirLogicalResult + @ccall mlir_c.mlirApplyPatternsAndFoldGreedily( + op::MlirModule, + patterns::MlirFrozenRewritePatternSet, + arg3::MlirGreedyRewriteDriverConfig, + )::MlirLogicalResult end """ @@ -8732,7 +9892,9 @@ This function parses the given arguments using the LLVM command line parser. Not llvm::cl::ParseCommandLineOptions() """ function LLVMParseCommandLineOptions(argc, argv, Overview) - @ccall mlir_c.LLVMParseCommandLineOptions(argc::Cint, argv::Ptr{Cstring}, Overview::Cstring)::Cvoid + @ccall mlir_c.LLVMParseCommandLineOptions( + argc::Cint, argv::Ptr{Cstring}, Overview::Cstring + )::Cvoid end """ @@ -8768,7 +9930,9 @@ Translate operation that satisfies LLVM dialect module requirements into an LLVM the generated LLVM IR Module from the translated MLIR module, it is owned by the caller. """ function mlirTranslateModuleToLLVMIR(_module, context) - @ccall mlir_c.mlirTranslateModuleToLLVMIR(_module::MlirOperation, context::LLVMContextRef)::LLVMModuleRef + @ccall mlir_c.mlirTranslateModuleToLLVMIR( + _module::MlirOperation, context::LLVMContextRef + )::LLVMModuleRef end function mlirRegisterTransformsPasses() @@ -8935,8 +10099,34 @@ function mlirRegisterTransformsViewOpGraph() @ccall mlir_c.mlirRegisterTransformsViewOpGraph()::Cvoid end -function stablehloScatterDimensionNumbersGet(ctx, nUpdateWindowDims, updateWindowDims, nInsertedWindowDims, insertedWindowDims, nInputBatchingDims, inputBatchingDims, nScatterIndicesBatchingDims, scatterIndicesBatchingDims, nScatteredDimsToOperandDims, scatteredDimsToOperandDims, indexVectorDim) - @ccall mlir_c.stablehloScatterDimensionNumbersGet(ctx::MlirContext, nUpdateWindowDims::intptr_t, updateWindowDims::Ptr{Int64}, nInsertedWindowDims::intptr_t, insertedWindowDims::Ptr{Int64}, nInputBatchingDims::intptr_t, inputBatchingDims::Ptr{Int64}, nScatterIndicesBatchingDims::intptr_t, scatterIndicesBatchingDims::Ptr{Int64}, nScatteredDimsToOperandDims::intptr_t, scatteredDimsToOperandDims::Ptr{Int64}, indexVectorDim::Int64)::MlirAttribute +function stablehloScatterDimensionNumbersGet( + ctx, + nUpdateWindowDims, + updateWindowDims, + nInsertedWindowDims, + insertedWindowDims, + nInputBatchingDims, + inputBatchingDims, + nScatterIndicesBatchingDims, + scatterIndicesBatchingDims, + nScatteredDimsToOperandDims, + scatteredDimsToOperandDims, + indexVectorDim, +) + @ccall mlir_c.stablehloScatterDimensionNumbersGet( + ctx::MlirContext, + nUpdateWindowDims::intptr_t, + updateWindowDims::Ptr{Int64}, + nInsertedWindowDims::intptr_t, + insertedWindowDims::Ptr{Int64}, + nInputBatchingDims::intptr_t, + inputBatchingDims::Ptr{Int64}, + nScatterIndicesBatchingDims::intptr_t, + scatterIndicesBatchingDims::Ptr{Int64}, + nScatteredDimsToOperandDims::intptr_t, + scatteredDimsToOperandDims::Ptr{Int64}, + indexVectorDim::Int64, + )::MlirAttribute end function stablehloAttributeIsAScatterDimensionNumbers(attr) @@ -8944,51 +10134,97 @@ function stablehloAttributeIsAScatterDimensionNumbers(attr) end function stablehloScatterDimensionNumbersGetUpdateWindowDimsSize(attr) - @ccall mlir_c.stablehloScatterDimensionNumbersGetUpdateWindowDimsSize(attr::MlirAttribute)::intptr_t + @ccall mlir_c.stablehloScatterDimensionNumbersGetUpdateWindowDimsSize( + attr::MlirAttribute + )::intptr_t end function stablehloScatterDimensionNumbersGetUpdateWindowDimsElem(attr, pos) - @ccall mlir_c.stablehloScatterDimensionNumbersGetUpdateWindowDimsElem(attr::MlirAttribute, pos::intptr_t)::Int64 + @ccall mlir_c.stablehloScatterDimensionNumbersGetUpdateWindowDimsElem( + attr::MlirAttribute, pos::intptr_t + )::Int64 end function stablehloScatterDimensionNumbersGetInsertedWindowDimsSize(attr) - @ccall mlir_c.stablehloScatterDimensionNumbersGetInsertedWindowDimsSize(attr::MlirAttribute)::intptr_t + @ccall mlir_c.stablehloScatterDimensionNumbersGetInsertedWindowDimsSize( + attr::MlirAttribute + )::intptr_t end function stablehloScatterDimensionNumbersGetInsertedWindowDimsElem(attr, pos) - @ccall mlir_c.stablehloScatterDimensionNumbersGetInsertedWindowDimsElem(attr::MlirAttribute, pos::intptr_t)::Int64 + @ccall mlir_c.stablehloScatterDimensionNumbersGetInsertedWindowDimsElem( + attr::MlirAttribute, pos::intptr_t + )::Int64 end function stablehloScatterDimensionNumbersGetInputBatchingDimsSize(attr) - @ccall mlir_c.stablehloScatterDimensionNumbersGetInputBatchingDimsSize(attr::MlirAttribute)::intptr_t + @ccall mlir_c.stablehloScatterDimensionNumbersGetInputBatchingDimsSize( + attr::MlirAttribute + )::intptr_t end function stablehloScatterDimensionNumbersGetInputBatchingDimsElem(attr, pos) - @ccall mlir_c.stablehloScatterDimensionNumbersGetInputBatchingDimsElem(attr::MlirAttribute, pos::intptr_t)::Int64 + @ccall mlir_c.stablehloScatterDimensionNumbersGetInputBatchingDimsElem( + attr::MlirAttribute, pos::intptr_t + )::Int64 end function stablehloScatterDimensionNumbersGetScatterIndicesBatchingDimsSize(attr) - @ccall mlir_c.stablehloScatterDimensionNumbersGetScatterIndicesBatchingDimsSize(attr::MlirAttribute)::intptr_t + @ccall mlir_c.stablehloScatterDimensionNumbersGetScatterIndicesBatchingDimsSize( + attr::MlirAttribute + )::intptr_t end function stablehloScatterDimensionNumbersGetScatterIndicesBatchingDimsElem(attr, pos) - @ccall mlir_c.stablehloScatterDimensionNumbersGetScatterIndicesBatchingDimsElem(attr::MlirAttribute, pos::intptr_t)::Int64 + @ccall mlir_c.stablehloScatterDimensionNumbersGetScatterIndicesBatchingDimsElem( + attr::MlirAttribute, pos::intptr_t + )::Int64 end function stablehloScatterDimensionNumbersGetScatteredDimsToOperandDimsSize(attr) - @ccall mlir_c.stablehloScatterDimensionNumbersGetScatteredDimsToOperandDimsSize(attr::MlirAttribute)::intptr_t + @ccall mlir_c.stablehloScatterDimensionNumbersGetScatteredDimsToOperandDimsSize( + attr::MlirAttribute + )::intptr_t end function stablehloScatterDimensionNumbersGetScatteredDimsToOperandDimsElem(attr, pos) - @ccall mlir_c.stablehloScatterDimensionNumbersGetScatteredDimsToOperandDimsElem(attr::MlirAttribute, pos::intptr_t)::Int64 + @ccall mlir_c.stablehloScatterDimensionNumbersGetScatteredDimsToOperandDimsElem( + attr::MlirAttribute, pos::intptr_t + )::Int64 end function stablehloDimensionNumbersGetIndexVectorDim(attr) @ccall mlir_c.stablehloDimensionNumbersGetIndexVectorDim(attr::MlirAttribute)::Int64 end -function stablehloGatherDimensionNumbersGet(ctx, nOffsetDims, offsetDims, nCollapsedSliceDims, collapsedSliceDims, nOperandBatchingDims, operandBatchingDims, nStartIndicesBatchingDims, startIndicesBatchingDims, nStartIndexMap, startIndexMap, indexVectorDim) - @ccall mlir_c.stablehloGatherDimensionNumbersGet(ctx::MlirContext, nOffsetDims::intptr_t, offsetDims::Ptr{Int64}, nCollapsedSliceDims::intptr_t, collapsedSliceDims::Ptr{Int64}, nOperandBatchingDims::intptr_t, operandBatchingDims::Ptr{Int64}, nStartIndicesBatchingDims::intptr_t, startIndicesBatchingDims::Ptr{Int64}, nStartIndexMap::intptr_t, startIndexMap::Ptr{Int64}, indexVectorDim::Int64)::MlirAttribute +function stablehloGatherDimensionNumbersGet( + ctx, + nOffsetDims, + offsetDims, + nCollapsedSliceDims, + collapsedSliceDims, + nOperandBatchingDims, + operandBatchingDims, + nStartIndicesBatchingDims, + startIndicesBatchingDims, + nStartIndexMap, + startIndexMap, + indexVectorDim, +) + @ccall mlir_c.stablehloGatherDimensionNumbersGet( + ctx::MlirContext, + nOffsetDims::intptr_t, + offsetDims::Ptr{Int64}, + nCollapsedSliceDims::intptr_t, + collapsedSliceDims::Ptr{Int64}, + nOperandBatchingDims::intptr_t, + operandBatchingDims::Ptr{Int64}, + nStartIndicesBatchingDims::intptr_t, + startIndicesBatchingDims::Ptr{Int64}, + nStartIndexMap::intptr_t, + startIndexMap::Ptr{Int64}, + indexVectorDim::Int64, + )::MlirAttribute end function stablehloAttributeIsAGatherDimensionNumbers(attr) @@ -8996,51 +10232,91 @@ function stablehloAttributeIsAGatherDimensionNumbers(attr) end function stablehloGatherDimensionNumbersGetOffsetDimsSize(attr) - @ccall mlir_c.stablehloGatherDimensionNumbersGetOffsetDimsSize(attr::MlirAttribute)::intptr_t + @ccall mlir_c.stablehloGatherDimensionNumbersGetOffsetDimsSize( + attr::MlirAttribute + )::intptr_t end function stablehloGatherDimensionNumbersGetOffsetDimsElem(attr, pos) - @ccall mlir_c.stablehloGatherDimensionNumbersGetOffsetDimsElem(attr::MlirAttribute, pos::intptr_t)::Int64 + @ccall mlir_c.stablehloGatherDimensionNumbersGetOffsetDimsElem( + attr::MlirAttribute, pos::intptr_t + )::Int64 end function stablehloGatherDimensionNumbersGetCollapsedSliceDimsSize(attr) - @ccall mlir_c.stablehloGatherDimensionNumbersGetCollapsedSliceDimsSize(attr::MlirAttribute)::intptr_t + @ccall mlir_c.stablehloGatherDimensionNumbersGetCollapsedSliceDimsSize( + attr::MlirAttribute + )::intptr_t end function stablehloGatherDimensionNumbersGetCollapsedSliceDimsElem(attr, pos) - @ccall mlir_c.stablehloGatherDimensionNumbersGetCollapsedSliceDimsElem(attr::MlirAttribute, pos::intptr_t)::Int64 + @ccall mlir_c.stablehloGatherDimensionNumbersGetCollapsedSliceDimsElem( + attr::MlirAttribute, pos::intptr_t + )::Int64 end function stablehloGatherDimensionNumbersGetOperandBatchingDimsSize(attr) - @ccall mlir_c.stablehloGatherDimensionNumbersGetOperandBatchingDimsSize(attr::MlirAttribute)::intptr_t + @ccall mlir_c.stablehloGatherDimensionNumbersGetOperandBatchingDimsSize( + attr::MlirAttribute + )::intptr_t end function stablehloGatherDimensionNumbersGetOperandBatchingDimsElem(attr, pos) - @ccall mlir_c.stablehloGatherDimensionNumbersGetOperandBatchingDimsElem(attr::MlirAttribute, pos::intptr_t)::Int64 + @ccall mlir_c.stablehloGatherDimensionNumbersGetOperandBatchingDimsElem( + attr::MlirAttribute, pos::intptr_t + )::Int64 end function stablehloGatherDimensionNumbersGetStartIndicesBatchingDimsSize(attr) - @ccall mlir_c.stablehloGatherDimensionNumbersGetStartIndicesBatchingDimsSize(attr::MlirAttribute)::intptr_t + @ccall mlir_c.stablehloGatherDimensionNumbersGetStartIndicesBatchingDimsSize( + attr::MlirAttribute + )::intptr_t end function stablehloGatherDimensionNumbersGetStartIndicesBatchingDimsElem(attr, pos) - @ccall mlir_c.stablehloGatherDimensionNumbersGetStartIndicesBatchingDimsElem(attr::MlirAttribute, pos::intptr_t)::Int64 + @ccall mlir_c.stablehloGatherDimensionNumbersGetStartIndicesBatchingDimsElem( + attr::MlirAttribute, pos::intptr_t + )::Int64 end function stablehloGatherDimensionNumbersGetStartIndexMapSize(attr) - @ccall mlir_c.stablehloGatherDimensionNumbersGetStartIndexMapSize(attr::MlirAttribute)::intptr_t + @ccall mlir_c.stablehloGatherDimensionNumbersGetStartIndexMapSize( + attr::MlirAttribute + )::intptr_t end function stablehloGatherDimensionNumbersGetStartIndexMapElem(attr, pos) - @ccall mlir_c.stablehloGatherDimensionNumbersGetStartIndexMapElem(attr::MlirAttribute, pos::intptr_t)::Int64 + @ccall mlir_c.stablehloGatherDimensionNumbersGetStartIndexMapElem( + attr::MlirAttribute, pos::intptr_t + )::Int64 end function stablehloGatherDimensionNumbersGetIndexVectorDim(attr) - @ccall mlir_c.stablehloGatherDimensionNumbersGetIndexVectorDim(attr::MlirAttribute)::Int64 -end - -function stablehloDotAlgorithmGet(ctx, lhsPrecisionType, rhsPrecisionType, accumulationType, lhsComponentCount, rhsComponentCount, numPrimitiveOperations, allowImpreciseAccumulation) - @ccall mlir_c.stablehloDotAlgorithmGet(ctx::MlirContext, lhsPrecisionType::MlirType, rhsPrecisionType::MlirType, accumulationType::MlirType, lhsComponentCount::Int64, rhsComponentCount::Int64, numPrimitiveOperations::Int64, allowImpreciseAccumulation::Bool)::MlirAttribute + @ccall mlir_c.stablehloGatherDimensionNumbersGetIndexVectorDim( + attr::MlirAttribute + )::Int64 +end + +function stablehloDotAlgorithmGet( + ctx, + lhsPrecisionType, + rhsPrecisionType, + accumulationType, + lhsComponentCount, + rhsComponentCount, + numPrimitiveOperations, + allowImpreciseAccumulation, +) + @ccall mlir_c.stablehloDotAlgorithmGet( + ctx::MlirContext, + lhsPrecisionType::MlirType, + rhsPrecisionType::MlirType, + accumulationType::MlirType, + lhsComponentCount::Int64, + rhsComponentCount::Int64, + numPrimitiveOperations::Int64, + allowImpreciseAccumulation::Bool, + )::MlirAttribute end function stablehloAttributeIsADotAlgorithm(attr) @@ -9072,11 +10348,33 @@ function stablehloDotAlgorithmGetNumPrimitiveOperations(attr) end function stablehloDotAlgorithmGetAllowImpreciseAccumulation(attr) - @ccall mlir_c.stablehloDotAlgorithmGetAllowImpreciseAccumulation(attr::MlirAttribute)::Bool -end - -function stablehloDotDimensionNumbersGet(ctx, nLhsBatchingDimensions, lhsBatchingDimensions, nRhsBatchingDimensions, rhsBatchingDimensions, nLhsContractingDimensions, lhsContractingDimensions, nRhsContractingDimensions, rhsContractingDimensions) - @ccall mlir_c.stablehloDotDimensionNumbersGet(ctx::MlirContext, nLhsBatchingDimensions::intptr_t, lhsBatchingDimensions::Ptr{Int64}, nRhsBatchingDimensions::intptr_t, rhsBatchingDimensions::Ptr{Int64}, nLhsContractingDimensions::intptr_t, lhsContractingDimensions::Ptr{Int64}, nRhsContractingDimensions::intptr_t, rhsContractingDimensions::Ptr{Int64})::MlirAttribute + @ccall mlir_c.stablehloDotAlgorithmGetAllowImpreciseAccumulation( + attr::MlirAttribute + )::Bool +end + +function stablehloDotDimensionNumbersGet( + ctx, + nLhsBatchingDimensions, + lhsBatchingDimensions, + nRhsBatchingDimensions, + rhsBatchingDimensions, + nLhsContractingDimensions, + lhsContractingDimensions, + nRhsContractingDimensions, + rhsContractingDimensions, +) + @ccall mlir_c.stablehloDotDimensionNumbersGet( + ctx::MlirContext, + nLhsBatchingDimensions::intptr_t, + lhsBatchingDimensions::Ptr{Int64}, + nRhsBatchingDimensions::intptr_t, + rhsBatchingDimensions::Ptr{Int64}, + nLhsContractingDimensions::intptr_t, + lhsContractingDimensions::Ptr{Int64}, + nRhsContractingDimensions::intptr_t, + rhsContractingDimensions::Ptr{Int64}, + )::MlirAttribute end function stablehloAttributeIsADotDimensionNumbers(attr) @@ -9084,39 +10382,83 @@ function stablehloAttributeIsADotDimensionNumbers(attr) end function stablehloDotDimensionNumbersGetLhsBatchingDimensionsSize(attr) - @ccall mlir_c.stablehloDotDimensionNumbersGetLhsBatchingDimensionsSize(attr::MlirAttribute)::intptr_t + @ccall mlir_c.stablehloDotDimensionNumbersGetLhsBatchingDimensionsSize( + attr::MlirAttribute + )::intptr_t end function stablehloDotDimensionNumbersGetLhsBatchingDimensionsElem(attr, pos) - @ccall mlir_c.stablehloDotDimensionNumbersGetLhsBatchingDimensionsElem(attr::MlirAttribute, pos::intptr_t)::Int64 + @ccall mlir_c.stablehloDotDimensionNumbersGetLhsBatchingDimensionsElem( + attr::MlirAttribute, pos::intptr_t + )::Int64 end function stablehloDotDimensionNumbersGetRhsBatchingDimensionsSize(attr) - @ccall mlir_c.stablehloDotDimensionNumbersGetRhsBatchingDimensionsSize(attr::MlirAttribute)::intptr_t + @ccall mlir_c.stablehloDotDimensionNumbersGetRhsBatchingDimensionsSize( + attr::MlirAttribute + )::intptr_t end function stablehloDotDimensionNumbersGetRhsBatchingDimensionsElem(attr, pos) - @ccall mlir_c.stablehloDotDimensionNumbersGetRhsBatchingDimensionsElem(attr::MlirAttribute, pos::intptr_t)::Int64 + @ccall mlir_c.stablehloDotDimensionNumbersGetRhsBatchingDimensionsElem( + attr::MlirAttribute, pos::intptr_t + )::Int64 end function stablehloDotDimensionNumbersGetLhsContractingDimensionsSize(attr) - @ccall mlir_c.stablehloDotDimensionNumbersGetLhsContractingDimensionsSize(attr::MlirAttribute)::intptr_t + @ccall mlir_c.stablehloDotDimensionNumbersGetLhsContractingDimensionsSize( + attr::MlirAttribute + )::intptr_t end function stablehloDotDimensionNumbersGetLhsContractingDimensionsElem(attr, pos) - @ccall mlir_c.stablehloDotDimensionNumbersGetLhsContractingDimensionsElem(attr::MlirAttribute, pos::intptr_t)::Int64 + @ccall mlir_c.stablehloDotDimensionNumbersGetLhsContractingDimensionsElem( + attr::MlirAttribute, pos::intptr_t + )::Int64 end function stablehloDotDimensionNumbersGetRhsContractingDimensionsSize(attr) - @ccall mlir_c.stablehloDotDimensionNumbersGetRhsContractingDimensionsSize(attr::MlirAttribute)::intptr_t + @ccall mlir_c.stablehloDotDimensionNumbersGetRhsContractingDimensionsSize( + attr::MlirAttribute + )::intptr_t end function stablehloDotDimensionNumbersGetRhsContractingDimensionsElem(attr, pos) - @ccall mlir_c.stablehloDotDimensionNumbersGetRhsContractingDimensionsElem(attr::MlirAttribute, pos::intptr_t)::Int64 -end - -function stablehloConvDimensionNumbersGet(ctx, inputBatchDimension, inputFeatureDimension, nInputSpatialDimensions, inputSpatialDimensions, kernelInputFeatureDimension, kernelOutputFeatureDimension, nKernelSpatialDimensions, kernelSpatialDimensions, outputBatchDimension, outputFeatureDimension, nOutputSpatialDimensions, outputSpatialDimensions) - @ccall mlir_c.stablehloConvDimensionNumbersGet(ctx::MlirContext, inputBatchDimension::Int64, inputFeatureDimension::Int64, nInputSpatialDimensions::intptr_t, inputSpatialDimensions::Ptr{Int64}, kernelInputFeatureDimension::Int64, kernelOutputFeatureDimension::Int64, nKernelSpatialDimensions::intptr_t, kernelSpatialDimensions::Ptr{Int64}, outputBatchDimension::Int64, outputFeatureDimension::Int64, nOutputSpatialDimensions::intptr_t, outputSpatialDimensions::Ptr{Int64})::MlirAttribute + @ccall mlir_c.stablehloDotDimensionNumbersGetRhsContractingDimensionsElem( + attr::MlirAttribute, pos::intptr_t + )::Int64 +end + +function stablehloConvDimensionNumbersGet( + ctx, + inputBatchDimension, + inputFeatureDimension, + nInputSpatialDimensions, + inputSpatialDimensions, + kernelInputFeatureDimension, + kernelOutputFeatureDimension, + nKernelSpatialDimensions, + kernelSpatialDimensions, + outputBatchDimension, + outputFeatureDimension, + nOutputSpatialDimensions, + outputSpatialDimensions, +) + @ccall mlir_c.stablehloConvDimensionNumbersGet( + ctx::MlirContext, + inputBatchDimension::Int64, + inputFeatureDimension::Int64, + nInputSpatialDimensions::intptr_t, + inputSpatialDimensions::Ptr{Int64}, + kernelInputFeatureDimension::Int64, + kernelOutputFeatureDimension::Int64, + nKernelSpatialDimensions::intptr_t, + kernelSpatialDimensions::Ptr{Int64}, + outputBatchDimension::Int64, + outputFeatureDimension::Int64, + nOutputSpatialDimensions::intptr_t, + outputSpatialDimensions::Ptr{Int64}, + )::MlirAttribute end function stablehloAttributeIsAConvDimensionNumbers(attr) @@ -9124,55 +10466,93 @@ function stablehloAttributeIsAConvDimensionNumbers(attr) end function stablehloConvDimensionNumbersGetInputBatchDimension(attr) - @ccall mlir_c.stablehloConvDimensionNumbersGetInputBatchDimension(attr::MlirAttribute)::Int64 + @ccall mlir_c.stablehloConvDimensionNumbersGetInputBatchDimension( + attr::MlirAttribute + )::Int64 end function stablehloConvDimensionNumbersGetInputFeatureDimension(attr) - @ccall mlir_c.stablehloConvDimensionNumbersGetInputFeatureDimension(attr::MlirAttribute)::Int64 + @ccall mlir_c.stablehloConvDimensionNumbersGetInputFeatureDimension( + attr::MlirAttribute + )::Int64 end function stablehloConvDimensionNumbersGetInputSpatialDimensionsSize(attr) - @ccall mlir_c.stablehloConvDimensionNumbersGetInputSpatialDimensionsSize(attr::MlirAttribute)::intptr_t + @ccall mlir_c.stablehloConvDimensionNumbersGetInputSpatialDimensionsSize( + attr::MlirAttribute + )::intptr_t end function stablehloConvDimensionNumbersGetInputSpatialDimensionsElem(attr, pos) - @ccall mlir_c.stablehloConvDimensionNumbersGetInputSpatialDimensionsElem(attr::MlirAttribute, pos::intptr_t)::Int64 + @ccall mlir_c.stablehloConvDimensionNumbersGetInputSpatialDimensionsElem( + attr::MlirAttribute, pos::intptr_t + )::Int64 end function stablehloConvDimensionNumbersGetKernelInputFeatureDimension(attr) - @ccall mlir_c.stablehloConvDimensionNumbersGetKernelInputFeatureDimension(attr::MlirAttribute)::Int64 + @ccall mlir_c.stablehloConvDimensionNumbersGetKernelInputFeatureDimension( + attr::MlirAttribute + )::Int64 end function stablehloConvDimensionNumbersGetKernelOutputFeatureDimension(attr) - @ccall mlir_c.stablehloConvDimensionNumbersGetKernelOutputFeatureDimension(attr::MlirAttribute)::Int64 + @ccall mlir_c.stablehloConvDimensionNumbersGetKernelOutputFeatureDimension( + attr::MlirAttribute + )::Int64 end function stablehloConvDimensionNumbersGetKernelSpatialDimensionsSize(attr) - @ccall mlir_c.stablehloConvDimensionNumbersGetKernelSpatialDimensionsSize(attr::MlirAttribute)::intptr_t + @ccall mlir_c.stablehloConvDimensionNumbersGetKernelSpatialDimensionsSize( + attr::MlirAttribute + )::intptr_t end function stablehloConvDimensionNumbersGetKernelSpatialDimensionsElem(attr, pos) - @ccall mlir_c.stablehloConvDimensionNumbersGetKernelSpatialDimensionsElem(attr::MlirAttribute, pos::intptr_t)::Int64 + @ccall mlir_c.stablehloConvDimensionNumbersGetKernelSpatialDimensionsElem( + attr::MlirAttribute, pos::intptr_t + )::Int64 end function stablehloConvDimensionNumbersGetOutputBatchDimension(attr) - @ccall mlir_c.stablehloConvDimensionNumbersGetOutputBatchDimension(attr::MlirAttribute)::Int64 + @ccall mlir_c.stablehloConvDimensionNumbersGetOutputBatchDimension( + attr::MlirAttribute + )::Int64 end function stablehloConvDimensionNumbersGetOutputFeatureDimension(attr) - @ccall mlir_c.stablehloConvDimensionNumbersGetOutputFeatureDimension(attr::MlirAttribute)::Int64 + @ccall mlir_c.stablehloConvDimensionNumbersGetOutputFeatureDimension( + attr::MlirAttribute + )::Int64 end function stablehloConvDimensionNumbersGetOutputSpatialDimensionsSize(attr) - @ccall mlir_c.stablehloConvDimensionNumbersGetOutputSpatialDimensionsSize(attr::MlirAttribute)::intptr_t + @ccall mlir_c.stablehloConvDimensionNumbersGetOutputSpatialDimensionsSize( + attr::MlirAttribute + )::intptr_t end function stablehloConvDimensionNumbersGetOutputSpatialDimensionsElem(attr, pos) - @ccall mlir_c.stablehloConvDimensionNumbersGetOutputSpatialDimensionsElem(attr::MlirAttribute, pos::intptr_t)::Int64 -end - -function stablehloOutputOperandAliasGet(ctx, nOutputTupleIndices, outputTupleIndices, operandIndex, nOperandTupleIndices, operandTupleIndices) - @ccall mlir_c.stablehloOutputOperandAliasGet(ctx::MlirContext, nOutputTupleIndices::intptr_t, outputTupleIndices::Ptr{Int64}, operandIndex::Int64, nOperandTupleIndices::intptr_t, operandTupleIndices::Ptr{Int64})::MlirAttribute + @ccall mlir_c.stablehloConvDimensionNumbersGetOutputSpatialDimensionsElem( + attr::MlirAttribute, pos::intptr_t + )::Int64 +end + +function stablehloOutputOperandAliasGet( + ctx, + nOutputTupleIndices, + outputTupleIndices, + operandIndex, + nOperandTupleIndices, + operandTupleIndices, +) + @ccall mlir_c.stablehloOutputOperandAliasGet( + ctx::MlirContext, + nOutputTupleIndices::intptr_t, + outputTupleIndices::Ptr{Int64}, + operandIndex::Int64, + nOperandTupleIndices::intptr_t, + operandTupleIndices::Ptr{Int64}, + )::MlirAttribute end function stablehloAttributeIsAOutputOperandAlias(attr) @@ -9180,11 +10560,15 @@ function stablehloAttributeIsAOutputOperandAlias(attr) end function stablehloOutputOperandAliasGetOutputTupleIndicesSize(attr) - @ccall mlir_c.stablehloOutputOperandAliasGetOutputTupleIndicesSize(attr::MlirAttribute)::intptr_t + @ccall mlir_c.stablehloOutputOperandAliasGetOutputTupleIndicesSize( + attr::MlirAttribute + )::intptr_t end function stablehloOutputOperandAliasGetOutputTupleIndicesElem(attr, pos) - @ccall mlir_c.stablehloOutputOperandAliasGetOutputTupleIndicesElem(attr::MlirAttribute, pos::intptr_t)::Int64 + @ccall mlir_c.stablehloOutputOperandAliasGetOutputTupleIndicesElem( + attr::MlirAttribute, pos::intptr_t + )::Int64 end function stablehloOutputOperandAliasGetOperandIndex(attr) @@ -9192,15 +10576,21 @@ function stablehloOutputOperandAliasGetOperandIndex(attr) end function stablehloOutputOperandAliasGetOperandTupleIndicesSize(attr) - @ccall mlir_c.stablehloOutputOperandAliasGetOperandTupleIndicesSize(attr::MlirAttribute)::intptr_t + @ccall mlir_c.stablehloOutputOperandAliasGetOperandTupleIndicesSize( + attr::MlirAttribute + )::intptr_t end function stablehloOutputOperandAliasGetOperandTupleIndicesElem(attr, pos) - @ccall mlir_c.stablehloOutputOperandAliasGetOperandTupleIndicesElem(attr::MlirAttribute, pos::intptr_t)::Int64 + @ccall mlir_c.stablehloOutputOperandAliasGetOperandTupleIndicesElem( + attr::MlirAttribute, pos::intptr_t + )::Int64 end function stablehloComparisonDirectionAttrGet(ctx, value) - @ccall mlir_c.stablehloComparisonDirectionAttrGet(ctx::MlirContext, value::MlirStringRef)::MlirAttribute + @ccall mlir_c.stablehloComparisonDirectionAttrGet( + ctx::MlirContext, value::MlirStringRef + )::MlirAttribute end function stablehloAttributeIsAComparisonDirectionAttr(attr) @@ -9208,11 +10598,15 @@ function stablehloAttributeIsAComparisonDirectionAttr(attr) end function stablehloComparisonDirectionAttrGetValue(attr) - @ccall mlir_c.stablehloComparisonDirectionAttrGetValue(attr::MlirAttribute)::MlirStringRef + @ccall mlir_c.stablehloComparisonDirectionAttrGetValue( + attr::MlirAttribute + )::MlirStringRef end function stablehloComparisonTypeAttrGet(ctx, value) - @ccall mlir_c.stablehloComparisonTypeAttrGet(ctx::MlirContext, value::MlirStringRef)::MlirAttribute + @ccall mlir_c.stablehloComparisonTypeAttrGet( + ctx::MlirContext, value::MlirStringRef + )::MlirAttribute end function stablehloAttributeIsAComparisonTypeAttr(attr) @@ -9224,7 +10618,9 @@ function stablehloComparisonTypeAttrGetValue(attr) end function stablehloPrecisionAttrGet(ctx, value) - @ccall mlir_c.stablehloPrecisionAttrGet(ctx::MlirContext, value::MlirStringRef)::MlirAttribute + @ccall mlir_c.stablehloPrecisionAttrGet( + ctx::MlirContext, value::MlirStringRef + )::MlirAttribute end function stablehloAttributeIsAPrecisionAttr(attr) @@ -9236,7 +10632,9 @@ function stablehloPrecisionAttrGetValue(attr) end function stablehloFftTypeAttrGet(ctx, value) - @ccall mlir_c.stablehloFftTypeAttrGet(ctx::MlirContext, value::MlirStringRef)::MlirAttribute + @ccall mlir_c.stablehloFftTypeAttrGet( + ctx::MlirContext, value::MlirStringRef + )::MlirAttribute end function stablehloAttributeIsAFftTypeAttr(attr) @@ -9248,7 +10646,9 @@ function stablehloFftTypeAttrGetValue(attr) end function stablehloTransposeAttrGet(ctx, value) - @ccall mlir_c.stablehloTransposeAttrGet(ctx::MlirContext, value::MlirStringRef)::MlirAttribute + @ccall mlir_c.stablehloTransposeAttrGet( + ctx::MlirContext, value::MlirStringRef + )::MlirAttribute end function stablehloAttributeIsATransposeAttr(attr) @@ -9260,7 +10660,9 @@ function stablehloTransposeAttrGetValue(attr) end function stablehloRngDistributionAttrGet(ctx, value) - @ccall mlir_c.stablehloRngDistributionAttrGet(ctx::MlirContext, value::MlirStringRef)::MlirAttribute + @ccall mlir_c.stablehloRngDistributionAttrGet( + ctx::MlirContext, value::MlirStringRef + )::MlirAttribute end function stablehloAttributeIsARngDistributionAttr(attr) @@ -9272,7 +10674,9 @@ function stablehloRngDistributionAttrGetValue(attr) end function stablehloRngAlgorithmAttrGet(ctx, value) - @ccall mlir_c.stablehloRngAlgorithmAttrGet(ctx::MlirContext, value::MlirStringRef)::MlirAttribute + @ccall mlir_c.stablehloRngAlgorithmAttrGet( + ctx::MlirContext, value::MlirStringRef + )::MlirAttribute end function stablehloAttributeIsARngAlgorithmAttr(attr) @@ -9284,7 +10688,9 @@ function stablehloRngAlgorithmAttrGetValue(attr) end function stablehloChannelHandleGet(ctx, handle, type) - @ccall mlir_c.stablehloChannelHandleGet(ctx::MlirContext, handle::Int64, type::Int64)::MlirAttribute + @ccall mlir_c.stablehloChannelHandleGet( + ctx::MlirContext, handle::Int64, type::Int64 + )::MlirAttribute end function stablehloAttributeIsChannelHandle(attr) @@ -9300,7 +10706,9 @@ function stablehloChannelHandleGetType(attr) end function stablehloTypeExtensionsGet(ctx, nBounds, bounds) - @ccall mlir_c.stablehloTypeExtensionsGet(ctx::MlirContext, nBounds::intptr_t, bounds::Ptr{Int64})::MlirAttribute + @ccall mlir_c.stablehloTypeExtensionsGet( + ctx::MlirContext, nBounds::intptr_t, bounds::Ptr{Int64} + )::MlirAttribute end function stablehloAttributeIsTypeExtensions(attr) @@ -9312,8 +10720,9 @@ function stablehloTypeExtensionsGetBoundsSize(attr) end function stablehloTypeExtensionsGetBoundsElem(attr, pos) - @ccall mlir_c.stablehloTypeExtensionsGetBoundsElem(attr::MlirAttribute, pos::intptr_t)::Int64 + @ccall mlir_c.stablehloTypeExtensionsGetBoundsElem( + attr::MlirAttribute, pos::intptr_t + )::Int64 end const MLIR_CAPI_DWARF_ADDRESS_SPACE_NULL = -1 - diff --git a/src/mlir/libMLIR_h.jl b/src/mlir/libMLIR_h.jl index 7154a0230..5f5c0feeb 100644 --- a/src/mlir/libMLIR_h.jl +++ b/src/mlir/libMLIR_h.jl @@ -39,7 +39,6 @@ elseif Sys.iswindows() && Sys.ARCH === :x86_64 const off_t = off32_t end - const intptr_t = Clong struct MlirDialectHandle @@ -236,7 +235,9 @@ end Allocates a type id that is valid for the lifetime of the allocator """ function mlirTypeIDAllocatorAllocateTypeID(allocator) - @ccall mlir_c.mlirTypeIDAllocatorAllocateTypeID(allocator::MlirTypeIDAllocator)::MlirTypeID + @ccall mlir_c.mlirTypeIDAllocatorAllocateTypeID( + allocator::MlirTypeIDAllocator + )::MlirTypeID end struct MlirAsmState @@ -343,7 +344,9 @@ end Creates an MLIR context, setting the multithreading setting explicitly and pre-loading the dialects from the provided DialectRegistry. """ function mlirContextCreateWithRegistry(registry, threadingEnabled) - @ccall mlir_c.mlirContextCreateWithRegistry(registry::MlirDialectRegistry, threadingEnabled::Bool)::MlirContext + @ccall mlir_c.mlirContextCreateWithRegistry( + registry::MlirDialectRegistry, threadingEnabled::Bool + )::MlirContext end """ @@ -379,7 +382,9 @@ end Sets whether unregistered dialects are allowed in this context. """ function mlirContextSetAllowUnregisteredDialects(context, allow) - @ccall mlir_c.mlirContextSetAllowUnregisteredDialects(context::MlirContext, allow::Bool)::Cvoid + @ccall mlir_c.mlirContextSetAllowUnregisteredDialects( + context::MlirContext, allow::Bool + )::Cvoid end """ @@ -406,7 +411,9 @@ end Append the contents of the given dialect registry to the registry associated with the context. """ function mlirContextAppendDialectRegistry(ctx, registry) - @ccall mlir_c.mlirContextAppendDialectRegistry(ctx::MlirContext, registry::MlirDialectRegistry)::Cvoid + @ccall mlir_c.mlirContextAppendDialectRegistry( + ctx::MlirContext, registry::MlirDialectRegistry + )::Cvoid end """ @@ -424,7 +431,9 @@ end Gets the dialect instance owned by the given context using the dialect namespace to identify it, loads (i.e., constructs the instance of) the dialect if necessary. If the dialect is not registered with the context, returns null. Use mlirContextLoadDialect to load an unregistered dialect. """ function mlirContextGetOrLoadDialect(context, name) - @ccall mlir_c.mlirContextGetOrLoadDialect(context::MlirContext, name::MlirStringRef)::MlirDialect + @ccall mlir_c.mlirContextGetOrLoadDialect( + context::MlirContext, name::MlirStringRef + )::MlirDialect end """ @@ -451,7 +460,9 @@ end 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. """ function mlirContextIsRegisteredOperation(context, name) - @ccall mlir_c.mlirContextIsRegisteredOperation(context::MlirContext, name::MlirStringRef)::Bool + @ccall mlir_c.mlirContextIsRegisteredOperation( + context::MlirContext, name::MlirStringRef + )::Bool end """ @@ -460,7 +471,9 @@ end 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. """ function mlirContextSetThreadPool(context, threadPool) - @ccall mlir_c.mlirContextSetThreadPool(context::MlirContext, threadPool::MlirLlvmThreadPool)::Cvoid + @ccall mlir_c.mlirContextSetThreadPool( + context::MlirContext, threadPool::MlirLlvmThreadPool + )::Cvoid end """ @@ -514,7 +527,9 @@ end Inserts the dialect associated with the provided dialect handle into the provided dialect registry """ function mlirDialectHandleInsertDialect(arg1, arg2) - @ccall mlir_c.mlirDialectHandleInsertDialect(arg1::MlirDialectHandle, arg2::MlirDialectRegistry)::Cvoid + @ccall mlir_c.mlirDialectHandleInsertDialect( + arg1::MlirDialectHandle, arg2::MlirDialectRegistry + )::Cvoid end """ @@ -523,7 +538,9 @@ end Registers the dialect associated with the provided dialect handle. """ function mlirDialectHandleRegisterDialect(arg1, arg2) - @ccall mlir_c.mlirDialectHandleRegisterDialect(arg1::MlirDialectHandle, arg2::MlirContext)::Cvoid + @ccall mlir_c.mlirDialectHandleRegisterDialect( + arg1::MlirDialectHandle, arg2::MlirContext + )::Cvoid end """ @@ -532,7 +549,9 @@ end Loads the dialect associated with the provided dialect handle. """ function mlirDialectHandleLoadDialect(arg1, arg2) - @ccall mlir_c.mlirDialectHandleLoadDialect(arg1::MlirDialectHandle, arg2::MlirContext)::MlirDialect + @ccall mlir_c.mlirDialectHandleLoadDialect( + arg1::MlirDialectHandle, arg2::MlirContext + )::MlirDialect end """ @@ -586,7 +605,9 @@ end Creates an File/Line/Column location owned by the given context. """ function mlirLocationFileLineColGet(context, filename, line, col) - @ccall mlir_c.mlirLocationFileLineColGet(context::MlirContext, filename::MlirStringRef, line::Cuint, col::Cuint)::MlirLocation + @ccall mlir_c.mlirLocationFileLineColGet( + context::MlirContext, filename::MlirStringRef, line::Cuint, col::Cuint + )::MlirLocation end """ @@ -595,7 +616,9 @@ end Creates a call site location with a callee and a caller. """ function mlirLocationCallSiteGet(callee, caller) - @ccall mlir_c.mlirLocationCallSiteGet(callee::MlirLocation, caller::MlirLocation)::MlirLocation + @ccall mlir_c.mlirLocationCallSiteGet( + callee::MlirLocation, caller::MlirLocation + )::MlirLocation end """ @@ -604,7 +627,12 @@ end Creates a fused location with an array of locations and metadata. """ function mlirLocationFusedGet(ctx, nLocations, locations, metadata) - @ccall mlir_c.mlirLocationFusedGet(ctx::MlirContext, nLocations::intptr_t, locations::Ptr{MlirLocation}, metadata::MlirAttribute)::MlirLocation + @ccall mlir_c.mlirLocationFusedGet( + ctx::MlirContext, + nLocations::intptr_t, + locations::Ptr{MlirLocation}, + metadata::MlirAttribute, + )::MlirLocation end """ @@ -613,7 +641,9 @@ end 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. """ function mlirLocationNameGet(context, name, childLoc) - @ccall mlir_c.mlirLocationNameGet(context::MlirContext, name::MlirStringRef, childLoc::MlirLocation)::MlirLocation + @ccall mlir_c.mlirLocationNameGet( + context::MlirContext, name::MlirStringRef, childLoc::MlirLocation + )::MlirLocation end """ @@ -658,7 +688,9 @@ end Prints a location by sending chunks of the string representation and forwarding `userData to `callback`. Note that the callback may be called several times with consecutive chunks of the string. """ function mlirLocationPrint(location, callback, userData) - @ccall mlir_c.mlirLocationPrint(location::MlirLocation, callback::MlirStringCallback, userData::Ptr{Cvoid})::Cvoid + @ccall mlir_c.mlirLocationPrint( + location::MlirLocation, callback::MlirStringCallback, userData::Ptr{Cvoid} + )::Cvoid end """ @@ -676,7 +708,9 @@ end Parses a module from the string and transfers ownership to the caller. """ function mlirModuleCreateParse(context, _module) - @ccall mlir_c.mlirModuleCreateParse(context::MlirContext, _module::MlirStringRef)::MlirModule + @ccall mlir_c.mlirModuleCreateParse( + context::MlirContext, _module::MlirStringRef + )::MlirModule end """ @@ -762,7 +796,9 @@ end Constructs an operation state from a name and a location. """ function mlirOperationStateGet(name, loc) - @ccall mlir_c.mlirOperationStateGet(name::MlirStringRef, loc::MlirLocation)::MlirOperationState + @ccall mlir_c.mlirOperationStateGet( + name::MlirStringRef, loc::MlirLocation + )::MlirOperationState end """ @@ -771,23 +807,33 @@ end Adds a list of components to the operation state. """ function mlirOperationStateAddResults(state, n, results) - @ccall mlir_c.mlirOperationStateAddResults(state::Ptr{MlirOperationState}, n::intptr_t, results::Ptr{MlirType})::Cvoid + @ccall mlir_c.mlirOperationStateAddResults( + state::Ptr{MlirOperationState}, n::intptr_t, results::Ptr{MlirType} + )::Cvoid end function mlirOperationStateAddOperands(state, n, operands) - @ccall mlir_c.mlirOperationStateAddOperands(state::Ptr{MlirOperationState}, n::intptr_t, operands::Ptr{MlirValue})::Cvoid + @ccall mlir_c.mlirOperationStateAddOperands( + state::Ptr{MlirOperationState}, n::intptr_t, operands::Ptr{MlirValue} + )::Cvoid end function mlirOperationStateAddOwnedRegions(state, n, regions) - @ccall mlir_c.mlirOperationStateAddOwnedRegions(state::Ptr{MlirOperationState}, n::intptr_t, regions::Ptr{MlirRegion})::Cvoid + @ccall mlir_c.mlirOperationStateAddOwnedRegions( + state::Ptr{MlirOperationState}, n::intptr_t, regions::Ptr{MlirRegion} + )::Cvoid end function mlirOperationStateAddSuccessors(state, n, successors) - @ccall mlir_c.mlirOperationStateAddSuccessors(state::Ptr{MlirOperationState}, n::intptr_t, successors::Ptr{MlirBlock})::Cvoid + @ccall mlir_c.mlirOperationStateAddSuccessors( + state::Ptr{MlirOperationState}, n::intptr_t, successors::Ptr{MlirBlock} + )::Cvoid end function mlirOperationStateAddAttributes(state, n, attributes) - @ccall mlir_c.mlirOperationStateAddAttributes(state::Ptr{MlirOperationState}, n::intptr_t, attributes::Ptr{MlirNamedAttribute})::Cvoid + @ccall mlir_c.mlirOperationStateAddAttributes( + state::Ptr{MlirOperationState}, n::intptr_t, attributes::Ptr{MlirNamedAttribute} + )::Cvoid end """ @@ -796,7 +842,9 @@ end Enables result type inference for the operation under construction. If enabled, then the caller must not have called [`mlirOperationStateAddResults`](@ref)(). Note that if enabled, the [`mlirOperationCreate`](@ref)() call is failable: it will return a null operation on inference failure and will emit diagnostics. """ function mlirOperationStateEnableResultTypeInference(state) - @ccall mlir_c.mlirOperationStateEnableResultTypeInference(state::Ptr{MlirOperationState})::Cvoid + @ccall mlir_c.mlirOperationStateEnableResultTypeInference( + state::Ptr{MlirOperationState} + )::Cvoid end """ @@ -805,7 +853,9 @@ end 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`](@ref)(). """ function mlirAsmStateCreateForOperation(op, flags) - @ccall mlir_c.mlirAsmStateCreateForOperation(op::MlirOperation, flags::MlirOpPrintingFlags)::MlirAsmState + @ccall mlir_c.mlirAsmStateCreateForOperation( + op::MlirOperation, flags::MlirOpPrintingFlags + )::MlirAsmState end """ @@ -814,7 +864,9 @@ end Creates new AsmState from value. Must be freed with a call to [`mlirAsmStateDestroy`](@ref)(). """ function mlirAsmStateCreateForValue(value, flags) - @ccall mlir_c.mlirAsmStateCreateForValue(value::MlirValue, flags::MlirOpPrintingFlags)::MlirAsmState + @ccall mlir_c.mlirAsmStateCreateForValue( + value::MlirValue, flags::MlirOpPrintingFlags + )::MlirAsmState end """ @@ -850,7 +902,9 @@ end 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. """ function mlirOpPrintingFlagsElideLargeElementsAttrs(flags, largeElementLimit) - @ccall mlir_c.mlirOpPrintingFlagsElideLargeElementsAttrs(flags::MlirOpPrintingFlags, largeElementLimit::intptr_t)::Cvoid + @ccall mlir_c.mlirOpPrintingFlagsElideLargeElementsAttrs( + flags::MlirOpPrintingFlags, largeElementLimit::intptr_t + )::Cvoid end """ @@ -859,7 +913,9 @@ end 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. """ function mlirOpPrintingFlagsElideLargeResourceString(flags, largeResourceLimit) - @ccall mlir_c.mlirOpPrintingFlagsElideLargeResourceString(flags::MlirOpPrintingFlags, largeResourceLimit::intptr_t)::Cvoid + @ccall mlir_c.mlirOpPrintingFlagsElideLargeResourceString( + flags::MlirOpPrintingFlags, largeResourceLimit::intptr_t + )::Cvoid end """ @@ -868,7 +924,9 @@ end 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. """ function mlirOpPrintingFlagsEnableDebugInfo(flags, enable, prettyForm) - @ccall mlir_c.mlirOpPrintingFlagsEnableDebugInfo(flags::MlirOpPrintingFlags, enable::Bool, prettyForm::Bool)::Cvoid + @ccall mlir_c.mlirOpPrintingFlagsEnableDebugInfo( + flags::MlirOpPrintingFlags, enable::Bool, prettyForm::Bool + )::Cvoid end """ @@ -931,7 +989,9 @@ end Sets the version to emit in the writer config. """ function mlirBytecodeWriterConfigDesiredEmitVersion(flags, version) - @ccall mlir_c.mlirBytecodeWriterConfigDesiredEmitVersion(flags::MlirBytecodeWriterConfig, version::Int64)::Cvoid + @ccall mlir_c.mlirBytecodeWriterConfigDesiredEmitVersion( + flags::MlirBytecodeWriterConfig, version::Int64 + )::Cvoid end """ @@ -953,7 +1013,9 @@ Parses an operation, giving ownership to the caller. If parsing fails a null ope `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. """ function mlirOperationCreateParse(context, sourceStr, sourceName) - @ccall mlir_c.mlirOperationCreateParse(context::MlirContext, sourceStr::MlirStringRef, sourceName::MlirStringRef)::MlirOperation + @ccall mlir_c.mlirOperationCreateParse( + context::MlirContext, sourceStr::MlirStringRef, sourceName::MlirStringRef + )::MlirOperation end """ @@ -1106,7 +1168,9 @@ end Sets the `pos`-th operand of the operation. """ function mlirOperationSetOperand(op, pos, newValue) - @ccall mlir_c.mlirOperationSetOperand(op::MlirOperation, pos::intptr_t, newValue::MlirValue)::Cvoid + @ccall mlir_c.mlirOperationSetOperand( + op::MlirOperation, pos::intptr_t, newValue::MlirValue + )::Cvoid end """ @@ -1115,7 +1179,9 @@ end Replaces the operands of the operation. """ function mlirOperationSetOperands(op, nOperands, operands) - @ccall mlir_c.mlirOperationSetOperands(op::MlirOperation, nOperands::intptr_t, operands::Ptr{MlirValue})::Cvoid + @ccall mlir_c.mlirOperationSetOperands( + op::MlirOperation, nOperands::intptr_t, operands::Ptr{MlirValue} + )::Cvoid end """ @@ -1160,7 +1226,9 @@ end Set `pos`-th successor of the operation. """ function mlirOperationSetSuccessor(op, pos, block) - @ccall mlir_c.mlirOperationSetSuccessor(op::MlirOperation, pos::intptr_t, block::MlirBlock)::Cvoid + @ccall mlir_c.mlirOperationSetSuccessor( + op::MlirOperation, pos::intptr_t, block::MlirBlock + )::Cvoid end """ @@ -1169,7 +1237,9 @@ end Returns true if this operation defines an inherent attribute with this name. Note: the attribute can be optional, so [`mlirOperationGetInherentAttributeByName`](@ref) can still return a null attribute. """ function mlirOperationHasInherentAttributeByName(op, name) - @ccall mlir_c.mlirOperationHasInherentAttributeByName(op::MlirOperation, name::MlirStringRef)::Bool + @ccall mlir_c.mlirOperationHasInherentAttributeByName( + op::MlirOperation, name::MlirStringRef + )::Bool end """ @@ -1178,7 +1248,9 @@ end Returns an inherent attribute attached to the operation given its name. """ function mlirOperationGetInherentAttributeByName(op, name) - @ccall mlir_c.mlirOperationGetInherentAttributeByName(op::MlirOperation, name::MlirStringRef)::MlirAttribute + @ccall mlir_c.mlirOperationGetInherentAttributeByName( + op::MlirOperation, name::MlirStringRef + )::MlirAttribute end """ @@ -1187,7 +1259,9 @@ end Sets an inherent attribute by name, replacing the existing if it exists. This has no effect if "name" does not match an inherent attribute. """ function mlirOperationSetInherentAttributeByName(op, name, attr) - @ccall mlir_c.mlirOperationSetInherentAttributeByName(op::MlirOperation, name::MlirStringRef, attr::MlirAttribute)::Cvoid + @ccall mlir_c.mlirOperationSetInherentAttributeByName( + op::MlirOperation, name::MlirStringRef, attr::MlirAttribute + )::Cvoid end """ @@ -1205,7 +1279,9 @@ end Return `pos`-th discardable attribute of the operation. """ function mlirOperationGetDiscardableAttribute(op, pos) - @ccall mlir_c.mlirOperationGetDiscardableAttribute(op::MlirOperation, pos::intptr_t)::MlirNamedAttribute + @ccall mlir_c.mlirOperationGetDiscardableAttribute( + op::MlirOperation, pos::intptr_t + )::MlirNamedAttribute end """ @@ -1214,7 +1290,9 @@ end Returns a discardable attribute attached to the operation given its name. """ function mlirOperationGetDiscardableAttributeByName(op, name) - @ccall mlir_c.mlirOperationGetDiscardableAttributeByName(op::MlirOperation, name::MlirStringRef)::MlirAttribute + @ccall mlir_c.mlirOperationGetDiscardableAttributeByName( + op::MlirOperation, name::MlirStringRef + )::MlirAttribute end """ @@ -1223,7 +1301,9 @@ end 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`](@ref) to remove an Attribute instead. """ function mlirOperationSetDiscardableAttributeByName(op, name, attr) - @ccall mlir_c.mlirOperationSetDiscardableAttributeByName(op::MlirOperation, name::MlirStringRef, attr::MlirAttribute)::Cvoid + @ccall mlir_c.mlirOperationSetDiscardableAttributeByName( + op::MlirOperation, name::MlirStringRef, attr::MlirAttribute + )::Cvoid end """ @@ -1232,7 +1312,9 @@ end Removes a discardable attribute by name. Returns false if the attribute was not found and true if removed. """ function mlirOperationRemoveDiscardableAttributeByName(op, name) - @ccall mlir_c.mlirOperationRemoveDiscardableAttributeByName(op::MlirOperation, name::MlirStringRef)::Bool + @ccall mlir_c.mlirOperationRemoveDiscardableAttributeByName( + op::MlirOperation, name::MlirStringRef + )::Bool end """ @@ -1250,7 +1332,9 @@ end Return `pos`-th attribute of the operation. Deprecated, please use `mlirOperationGetInherentAttribute` or [`mlirOperationGetDiscardableAttribute`](@ref). """ function mlirOperationGetAttribute(op, pos) - @ccall mlir_c.mlirOperationGetAttribute(op::MlirOperation, pos::intptr_t)::MlirNamedAttribute + @ccall mlir_c.mlirOperationGetAttribute( + op::MlirOperation, pos::intptr_t + )::MlirNamedAttribute end """ @@ -1259,7 +1343,9 @@ end Returns an attribute attached to the operation given its name. Deprecated, please use [`mlirOperationGetInherentAttributeByName`](@ref) or [`mlirOperationGetDiscardableAttributeByName`](@ref). """ function mlirOperationGetAttributeByName(op, name) - @ccall mlir_c.mlirOperationGetAttributeByName(op::MlirOperation, name::MlirStringRef)::MlirAttribute + @ccall mlir_c.mlirOperationGetAttributeByName( + op::MlirOperation, name::MlirStringRef + )::MlirAttribute end """ @@ -1268,7 +1354,9 @@ end Sets an attribute by name, replacing the existing if it exists or adding a new one otherwise. Deprecated, please use [`mlirOperationSetInherentAttributeByName`](@ref) or [`mlirOperationSetDiscardableAttributeByName`](@ref). """ function mlirOperationSetAttributeByName(op, name, attr) - @ccall mlir_c.mlirOperationSetAttributeByName(op::MlirOperation, name::MlirStringRef, attr::MlirAttribute)::Cvoid + @ccall mlir_c.mlirOperationSetAttributeByName( + op::MlirOperation, name::MlirStringRef, attr::MlirAttribute + )::Cvoid end """ @@ -1277,7 +1365,9 @@ end Removes an attribute by name. Returns false if the attribute was not found and true if removed. Deprecated, please use `mlirOperationRemoveInherentAttributeByName` or [`mlirOperationRemoveDiscardableAttributeByName`](@ref). """ function mlirOperationRemoveAttributeByName(op, name) - @ccall mlir_c.mlirOperationRemoveAttributeByName(op::MlirOperation, name::MlirStringRef)::Bool + @ccall mlir_c.mlirOperationRemoveAttributeByName( + op::MlirOperation, name::MlirStringRef + )::Bool end """ @@ -1286,7 +1376,9 @@ end Prints an operation by sending chunks of the string representation and forwarding `userData to `callback`. Note that the callback may be called several times with consecutive chunks of the string. """ function mlirOperationPrint(op, callback, userData) - @ccall mlir_c.mlirOperationPrint(op::MlirOperation, callback::MlirStringCallback, userData::Ptr{Cvoid})::Cvoid + @ccall mlir_c.mlirOperationPrint( + op::MlirOperation, callback::MlirStringCallback, userData::Ptr{Cvoid} + )::Cvoid end """ @@ -1295,7 +1387,12 @@ end Same as [`mlirOperationPrint`](@ref) but accepts flags controlling the printing behavior. """ function mlirOperationPrintWithFlags(op, flags, callback, userData) - @ccall mlir_c.mlirOperationPrintWithFlags(op::MlirOperation, flags::MlirOpPrintingFlags, callback::MlirStringCallback, userData::Ptr{Cvoid})::Cvoid + @ccall mlir_c.mlirOperationPrintWithFlags( + op::MlirOperation, + flags::MlirOpPrintingFlags, + callback::MlirStringCallback, + userData::Ptr{Cvoid}, + )::Cvoid end """ @@ -1304,7 +1401,12 @@ end Same as [`mlirOperationPrint`](@ref) but accepts AsmState controlling the printing behavior as well as caching computed names. """ function mlirOperationPrintWithState(op, state, callback, userData) - @ccall mlir_c.mlirOperationPrintWithState(op::MlirOperation, state::MlirAsmState, callback::MlirStringCallback, userData::Ptr{Cvoid})::Cvoid + @ccall mlir_c.mlirOperationPrintWithState( + op::MlirOperation, + state::MlirAsmState, + callback::MlirStringCallback, + userData::Ptr{Cvoid}, + )::Cvoid end """ @@ -1313,7 +1415,9 @@ end Same as [`mlirOperationPrint`](@ref) but writing the bytecode format. """ function mlirOperationWriteBytecode(op, callback, userData) - @ccall mlir_c.mlirOperationWriteBytecode(op::MlirOperation, callback::MlirStringCallback, userData::Ptr{Cvoid})::Cvoid + @ccall mlir_c.mlirOperationWriteBytecode( + op::MlirOperation, callback::MlirStringCallback, userData::Ptr{Cvoid} + )::Cvoid end """ @@ -1322,7 +1426,12 @@ end Same as [`mlirOperationWriteBytecode`](@ref) but with writer config and returns failure only if desired bytecode could not be honored. """ function mlirOperationWriteBytecodeWithConfig(op, config, callback, userData) - @ccall mlir_c.mlirOperationWriteBytecodeWithConfig(op::MlirOperation, config::MlirBytecodeWriterConfig, callback::MlirStringCallback, userData::Ptr{Cvoid})::MlirLogicalResult + @ccall mlir_c.mlirOperationWriteBytecodeWithConfig( + op::MlirOperation, + config::MlirBytecodeWriterConfig, + callback::MlirStringCallback, + userData::Ptr{Cvoid}, + )::MlirLogicalResult end """ @@ -1394,7 +1503,12 @@ const MlirOperationWalkCallback = Ptr{Cvoid} 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. """ function mlirOperationWalk(op, callback, userData, walkOrder) - @ccall mlir_c.mlirOperationWalk(op::MlirOperation, callback::MlirOperationWalkCallback, userData::Ptr{Cvoid}, walkOrder::MlirWalkOrder)::Cvoid + @ccall mlir_c.mlirOperationWalk( + op::MlirOperation, + callback::MlirOperationWalkCallback, + userData::Ptr{Cvoid}, + walkOrder::MlirWalkOrder, + )::Cvoid end """ @@ -1457,7 +1571,9 @@ end 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. """ function mlirRegionInsertOwnedBlock(region, pos, block) - @ccall mlir_c.mlirRegionInsertOwnedBlock(region::MlirRegion, pos::intptr_t, block::MlirBlock)::Cvoid + @ccall mlir_c.mlirRegionInsertOwnedBlock( + region::MlirRegion, pos::intptr_t, block::MlirBlock + )::Cvoid end """ @@ -1466,7 +1582,9 @@ end 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. """ function mlirRegionInsertOwnedBlockAfter(region, reference, block) - @ccall mlir_c.mlirRegionInsertOwnedBlockAfter(region::MlirRegion, reference::MlirBlock, block::MlirBlock)::Cvoid + @ccall mlir_c.mlirRegionInsertOwnedBlockAfter( + region::MlirRegion, reference::MlirBlock, block::MlirBlock + )::Cvoid end """ @@ -1475,7 +1593,9 @@ end 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. """ function mlirRegionInsertOwnedBlockBefore(region, reference, block) - @ccall mlir_c.mlirRegionInsertOwnedBlockBefore(region::MlirRegion, reference::MlirBlock, block::MlirBlock)::Cvoid + @ccall mlir_c.mlirRegionInsertOwnedBlockBefore( + region::MlirRegion, reference::MlirBlock, block::MlirBlock + )::Cvoid end """ @@ -1511,7 +1631,9 @@ end Creates a new empty block with the given argument types and transfers ownership to the caller. """ function mlirBlockCreate(nArgs, args, locs) - @ccall mlir_c.mlirBlockCreate(nArgs::intptr_t, args::Ptr{MlirType}, locs::Ptr{MlirLocation})::MlirBlock + @ccall mlir_c.mlirBlockCreate( + nArgs::intptr_t, args::Ptr{MlirType}, locs::Ptr{MlirLocation} + )::MlirBlock end """ @@ -1601,7 +1723,9 @@ end Takes an operation owned by the caller and appends it to the block. """ function mlirBlockAppendOwnedOperation(block, operation) - @ccall mlir_c.mlirBlockAppendOwnedOperation(block::MlirBlock, operation::MlirOperation)::Cvoid + @ccall mlir_c.mlirBlockAppendOwnedOperation( + block::MlirBlock, operation::MlirOperation + )::Cvoid end """ @@ -1610,7 +1734,9 @@ end 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. """ function mlirBlockInsertOwnedOperation(block, pos, operation) - @ccall mlir_c.mlirBlockInsertOwnedOperation(block::MlirBlock, pos::intptr_t, operation::MlirOperation)::Cvoid + @ccall mlir_c.mlirBlockInsertOwnedOperation( + block::MlirBlock, pos::intptr_t, operation::MlirOperation + )::Cvoid end """ @@ -1619,7 +1745,9 @@ end 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. """ function mlirBlockInsertOwnedOperationAfter(block, reference, operation) - @ccall mlir_c.mlirBlockInsertOwnedOperationAfter(block::MlirBlock, reference::MlirOperation, operation::MlirOperation)::Cvoid + @ccall mlir_c.mlirBlockInsertOwnedOperationAfter( + block::MlirBlock, reference::MlirOperation, operation::MlirOperation + )::Cvoid end """ @@ -1628,7 +1756,9 @@ end 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. """ function mlirBlockInsertOwnedOperationBefore(block, reference, operation) - @ccall mlir_c.mlirBlockInsertOwnedOperationBefore(block::MlirBlock, reference::MlirOperation, operation::MlirOperation)::Cvoid + @ccall mlir_c.mlirBlockInsertOwnedOperationBefore( + block::MlirBlock, reference::MlirOperation, operation::MlirOperation + )::Cvoid end """ @@ -1646,7 +1776,9 @@ end Appends an argument of the specified type to the block. Returns the newly added argument. """ function mlirBlockAddArgument(block, type, loc) - @ccall mlir_c.mlirBlockAddArgument(block::MlirBlock, type::MlirType, loc::MlirLocation)::MlirValue + @ccall mlir_c.mlirBlockAddArgument( + block::MlirBlock, type::MlirType, loc::MlirLocation + )::MlirValue end """ @@ -1664,7 +1796,9 @@ end Inserts an argument of the specified type at a specified index to the block. Returns the newly added argument. """ function mlirBlockInsertArgument(block, pos, type, loc) - @ccall mlir_c.mlirBlockInsertArgument(block::MlirBlock, pos::intptr_t, type::MlirType, loc::MlirLocation)::MlirValue + @ccall mlir_c.mlirBlockInsertArgument( + block::MlirBlock, pos::intptr_t, type::MlirType, loc::MlirLocation + )::MlirValue end """ @@ -1682,7 +1816,9 @@ end Prints a block by sending chunks of the string representation and forwarding `userData to `callback`. Note that the callback may be called several times with consecutive chunks of the string. """ function mlirBlockPrint(block, callback, userData) - @ccall mlir_c.mlirBlockPrint(block::MlirBlock, callback::MlirStringCallback, userData::Ptr{Cvoid})::Cvoid + @ccall mlir_c.mlirBlockPrint( + block::MlirBlock, callback::MlirStringCallback, userData::Ptr{Cvoid} + )::Cvoid end """ @@ -1799,7 +1935,9 @@ end Prints a value by sending chunks of the string representation and forwarding `userData to `callback`. Note that the callback may be called several times with consecutive chunks of the string. """ function mlirValuePrint(value, callback, userData) - @ccall mlir_c.mlirValuePrint(value::MlirValue, callback::MlirStringCallback, userData::Ptr{Cvoid})::Cvoid + @ccall mlir_c.mlirValuePrint( + value::MlirValue, callback::MlirStringCallback, userData::Ptr{Cvoid} + )::Cvoid end """ @@ -1808,7 +1946,12 @@ end Prints a value as an operand (i.e., the ValueID). """ function mlirValuePrintAsOperand(value, state, callback, userData) - @ccall mlir_c.mlirValuePrintAsOperand(value::MlirValue, state::MlirAsmState, callback::MlirStringCallback, userData::Ptr{Cvoid})::Cvoid + @ccall mlir_c.mlirValuePrintAsOperand( + value::MlirValue, + state::MlirAsmState, + callback::MlirStringCallback, + userData::Ptr{Cvoid}, + )::Cvoid end """ @@ -1835,7 +1978,12 @@ end 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`](@ref) pointers with a length of 'numExceptions'. """ function mlirValueReplaceAllUsesExcept(of, with, numExceptions, exceptions) - @ccall mlir_c.mlirValueReplaceAllUsesExcept(of::MlirValue, with::MlirValue, numExceptions::intptr_t, exceptions::Ptr{MlirOperation})::Cvoid + @ccall mlir_c.mlirValueReplaceAllUsesExcept( + of::MlirValue, + with::MlirValue, + numExceptions::intptr_t, + exceptions::Ptr{MlirOperation}, + )::Cvoid end """ @@ -1943,7 +2091,9 @@ end Prints a location by sending chunks of the string representation and forwarding `userData to `callback`. Note that the callback may be called several times with consecutive chunks of the string. """ function mlirTypePrint(type, callback, userData) - @ccall mlir_c.mlirTypePrint(type::MlirType, callback::MlirStringCallback, userData::Ptr{Cvoid})::Cvoid + @ccall mlir_c.mlirTypePrint( + type::MlirType, callback::MlirStringCallback, userData::Ptr{Cvoid} + )::Cvoid end """ @@ -1961,7 +2111,9 @@ end Parses an attribute. The attribute is owned by the context. """ function mlirAttributeParseGet(context, attr) - @ccall mlir_c.mlirAttributeParseGet(context::MlirContext, attr::MlirStringRef)::MlirAttribute + @ccall mlir_c.mlirAttributeParseGet( + context::MlirContext, attr::MlirStringRef + )::MlirAttribute end """ @@ -2024,7 +2176,9 @@ end Prints an attribute by sending chunks of the string representation and forwarding `userData to `callback`. Note that the callback may be called several times with consecutive chunks of the string. """ function mlirAttributePrint(attr, callback, userData) - @ccall mlir_c.mlirAttributePrint(attr::MlirAttribute, callback::MlirStringCallback, userData::Ptr{Cvoid})::Cvoid + @ccall mlir_c.mlirAttributePrint( + attr::MlirAttribute, callback::MlirStringCallback, userData::Ptr{Cvoid} + )::Cvoid end """ @@ -2042,7 +2196,9 @@ end Associates an attribute with the name. Takes ownership of neither. """ function mlirNamedAttributeGet(name, attr) - @ccall mlir_c.mlirNamedAttributeGet(name::MlirIdentifier, attr::MlirAttribute)::MlirNamedAttribute + @ccall mlir_c.mlirNamedAttributeGet( + name::MlirIdentifier, attr::MlirAttribute + )::MlirNamedAttribute end """ @@ -2051,7 +2207,9 @@ end Gets an identifier with the given string value. """ function mlirIdentifierGet(context, str) - @ccall mlir_c.mlirIdentifierGet(context::MlirContext, str::MlirStringRef)::MlirIdentifier + @ccall mlir_c.mlirIdentifierGet( + context::MlirContext, str::MlirStringRef + )::MlirIdentifier end """ @@ -2132,7 +2290,9 @@ end 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. """ function mlirSymbolTableLookup(symbolTable, name) - @ccall mlir_c.mlirSymbolTableLookup(symbolTable::MlirSymbolTable, name::MlirStringRef)::MlirOperation + @ccall mlir_c.mlirSymbolTableLookup( + symbolTable::MlirSymbolTable, name::MlirStringRef + )::MlirOperation end """ @@ -2141,7 +2301,9 @@ end 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. """ function mlirSymbolTableInsert(symbolTable, operation) - @ccall mlir_c.mlirSymbolTableInsert(symbolTable::MlirSymbolTable, operation::MlirOperation)::MlirAttribute + @ccall mlir_c.mlirSymbolTableInsert( + symbolTable::MlirSymbolTable, operation::MlirOperation + )::MlirAttribute end """ @@ -2150,7 +2312,9 @@ end Removes the given operation from the symbol table and erases it. """ function mlirSymbolTableErase(symbolTable, operation) - @ccall mlir_c.mlirSymbolTableErase(symbolTable::MlirSymbolTable, operation::MlirOperation)::Cvoid + @ccall mlir_c.mlirSymbolTableErase( + symbolTable::MlirSymbolTable, operation::MlirOperation + )::Cvoid end """ @@ -2159,7 +2323,9 @@ end 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. """ function mlirSymbolTableReplaceAllSymbolUses(oldSymbol, newSymbol, from) - @ccall mlir_c.mlirSymbolTableReplaceAllSymbolUses(oldSymbol::MlirStringRef, newSymbol::MlirStringRef, from::MlirOperation)::MlirLogicalResult + @ccall mlir_c.mlirSymbolTableReplaceAllSymbolUses( + oldSymbol::MlirStringRef, newSymbol::MlirStringRef, from::MlirOperation + )::MlirLogicalResult end """ @@ -2168,7 +2334,12 @@ end 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. """ function mlirSymbolTableWalkSymbolTables(from, allSymUsesVisible, callback, userData) - @ccall mlir_c.mlirSymbolTableWalkSymbolTables(from::MlirOperation, allSymUsesVisible::Bool, callback::Ptr{Cvoid}, userData::Ptr{Cvoid})::Cvoid + @ccall mlir_c.mlirSymbolTableWalkSymbolTables( + from::MlirOperation, + allSymUsesVisible::Bool, + callback::Ptr{Cvoid}, + userData::Ptr{Cvoid}, + )::Cvoid end struct MlirAffineExpr @@ -2208,7 +2379,9 @@ end Prints an affine expression by sending chunks of the string representation and forwarding `userData to `callback`. Note that the callback may be called several times with consecutive chunks of the string. """ function mlirAffineExprPrint(affineExpr, callback, userData) - @ccall mlir_c.mlirAffineExprPrint(affineExpr::MlirAffineExpr, callback::MlirStringCallback, userData::Ptr{Cvoid})::Cvoid + @ccall mlir_c.mlirAffineExprPrint( + affineExpr::MlirAffineExpr, callback::MlirStringCallback, userData::Ptr{Cvoid} + )::Cvoid end """ @@ -2253,7 +2426,9 @@ end Checks whether the given affine expression is a multiple of 'factor'. """ function mlirAffineExprIsMultipleOf(affineExpr, factor) - @ccall mlir_c.mlirAffineExprIsMultipleOf(affineExpr::MlirAffineExpr, factor::Int64)::Bool + @ccall mlir_c.mlirAffineExprIsMultipleOf( + affineExpr::MlirAffineExpr, factor::Int64 + )::Bool end """ @@ -2262,7 +2437,9 @@ end Checks whether the given affine expression involves AffineDimExpr 'position'. """ function mlirAffineExprIsFunctionOfDim(affineExpr, position) - @ccall mlir_c.mlirAffineExprIsFunctionOfDim(affineExpr::MlirAffineExpr, position::intptr_t)::Bool + @ccall mlir_c.mlirAffineExprIsFunctionOfDim( + affineExpr::MlirAffineExpr, position::intptr_t + )::Bool end struct MlirAffineMap @@ -2275,7 +2452,9 @@ end Composes the given map with the given expression. """ function mlirAffineExprCompose(affineExpr, affineMap) - @ccall mlir_c.mlirAffineExprCompose(affineExpr::MlirAffineExpr, affineMap::MlirAffineMap)::MlirAffineExpr + @ccall mlir_c.mlirAffineExprCompose( + affineExpr::MlirAffineExpr, affineMap::MlirAffineMap + )::MlirAffineExpr end """ @@ -2320,7 +2499,9 @@ end Creates an affine symbol expression with 'position' in the context. """ function mlirAffineSymbolExprGet(ctx, position) - @ccall mlir_c.mlirAffineSymbolExprGet(ctx::MlirContext, position::intptr_t)::MlirAffineExpr + @ccall mlir_c.mlirAffineSymbolExprGet( + ctx::MlirContext, position::intptr_t + )::MlirAffineExpr end """ @@ -2347,7 +2528,9 @@ end Creates an affine constant expression with 'constant' in the context. """ function mlirAffineConstantExprGet(ctx, constant) - @ccall mlir_c.mlirAffineConstantExprGet(ctx::MlirContext, constant::Int64)::MlirAffineExpr + @ccall mlir_c.mlirAffineConstantExprGet( + ctx::MlirContext, constant::Int64 + )::MlirAffineExpr end """ @@ -2374,7 +2557,9 @@ end Creates an affine add expression with 'lhs' and 'rhs'. """ function mlirAffineAddExprGet(lhs, rhs) - @ccall mlir_c.mlirAffineAddExprGet(lhs::MlirAffineExpr, rhs::MlirAffineExpr)::MlirAffineExpr + @ccall mlir_c.mlirAffineAddExprGet( + lhs::MlirAffineExpr, rhs::MlirAffineExpr + )::MlirAffineExpr end """ @@ -2392,7 +2577,9 @@ end Creates an affine mul expression with 'lhs' and 'rhs'. """ function mlirAffineMulExprGet(lhs, rhs) - @ccall mlir_c.mlirAffineMulExprGet(lhs::MlirAffineExpr, rhs::MlirAffineExpr)::MlirAffineExpr + @ccall mlir_c.mlirAffineMulExprGet( + lhs::MlirAffineExpr, rhs::MlirAffineExpr + )::MlirAffineExpr end """ @@ -2410,7 +2597,9 @@ end Creates an affine mod expression with 'lhs' and 'rhs'. """ function mlirAffineModExprGet(lhs, rhs) - @ccall mlir_c.mlirAffineModExprGet(lhs::MlirAffineExpr, rhs::MlirAffineExpr)::MlirAffineExpr + @ccall mlir_c.mlirAffineModExprGet( + lhs::MlirAffineExpr, rhs::MlirAffineExpr + )::MlirAffineExpr end """ @@ -2428,7 +2617,9 @@ end Creates an affine floordiv expression with 'lhs' and 'rhs'. """ function mlirAffineFloorDivExprGet(lhs, rhs) - @ccall mlir_c.mlirAffineFloorDivExprGet(lhs::MlirAffineExpr, rhs::MlirAffineExpr)::MlirAffineExpr + @ccall mlir_c.mlirAffineFloorDivExprGet( + lhs::MlirAffineExpr, rhs::MlirAffineExpr + )::MlirAffineExpr end """ @@ -2446,7 +2637,9 @@ end Creates an affine ceildiv expression with 'lhs' and 'rhs'. """ function mlirAffineCeilDivExprGet(lhs, rhs) - @ccall mlir_c.mlirAffineCeilDivExprGet(lhs::MlirAffineExpr, rhs::MlirAffineExpr)::MlirAffineExpr + @ccall mlir_c.mlirAffineCeilDivExprGet( + lhs::MlirAffineExpr, rhs::MlirAffineExpr + )::MlirAffineExpr end """ @@ -2509,7 +2702,9 @@ end Prints an affine map by sending chunks of the string representation and forwarding `userData to `callback`. Note that the callback may be called several times with consecutive chunks of the string. """ function mlirAffineMapPrint(affineMap, callback, userData) - @ccall mlir_c.mlirAffineMapPrint(affineMap::MlirAffineMap, callback::MlirStringCallback, userData::Ptr{Cvoid})::Cvoid + @ccall mlir_c.mlirAffineMapPrint( + affineMap::MlirAffineMap, callback::MlirStringCallback, userData::Ptr{Cvoid} + )::Cvoid end """ @@ -2536,7 +2731,9 @@ end Creates a zero result affine map of the given dimensions and symbols in the context. The affine map is owned by the context. """ function mlirAffineMapZeroResultGet(ctx, dimCount, symbolCount) - @ccall mlir_c.mlirAffineMapZeroResultGet(ctx::MlirContext, dimCount::intptr_t, symbolCount::intptr_t)::MlirAffineMap + @ccall mlir_c.mlirAffineMapZeroResultGet( + ctx::MlirContext, dimCount::intptr_t, symbolCount::intptr_t + )::MlirAffineMap end """ @@ -2545,7 +2742,13 @@ end 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. """ function mlirAffineMapGet(ctx, dimCount, symbolCount, nAffineExprs, affineExprs) - @ccall mlir_c.mlirAffineMapGet(ctx::MlirContext, dimCount::intptr_t, symbolCount::intptr_t, nAffineExprs::intptr_t, affineExprs::Ptr{MlirAffineExpr})::MlirAffineMap + @ccall mlir_c.mlirAffineMapGet( + ctx::MlirContext, + dimCount::intptr_t, + symbolCount::intptr_t, + nAffineExprs::intptr_t, + affineExprs::Ptr{MlirAffineExpr}, + )::MlirAffineMap end """ @@ -2563,7 +2766,9 @@ end Creates an affine map with 'numDims' identity in the context. The affine map is owned by the context. """ function mlirAffineMapMultiDimIdentityGet(ctx, numDims) - @ccall mlir_c.mlirAffineMapMultiDimIdentityGet(ctx::MlirContext, numDims::intptr_t)::MlirAffineMap + @ccall mlir_c.mlirAffineMapMultiDimIdentityGet( + ctx::MlirContext, numDims::intptr_t + )::MlirAffineMap end """ @@ -2572,7 +2777,9 @@ end 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. """ function mlirAffineMapMinorIdentityGet(ctx, dims, results) - @ccall mlir_c.mlirAffineMapMinorIdentityGet(ctx::MlirContext, dims::intptr_t, results::intptr_t)::MlirAffineMap + @ccall mlir_c.mlirAffineMapMinorIdentityGet( + ctx::MlirContext, dims::intptr_t, results::intptr_t + )::MlirAffineMap end """ @@ -2581,7 +2788,9 @@ end 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. """ function mlirAffineMapPermutationGet(ctx, size, permutation) - @ccall mlir_c.mlirAffineMapPermutationGet(ctx::MlirContext, size::intptr_t, permutation::Ptr{Cuint})::MlirAffineMap + @ccall mlir_c.mlirAffineMapPermutationGet( + ctx::MlirContext, size::intptr_t, permutation::Ptr{Cuint} + )::MlirAffineMap end """ @@ -2662,7 +2871,9 @@ end Returns the result at the given position. """ function mlirAffineMapGetResult(affineMap, pos) - @ccall mlir_c.mlirAffineMapGetResult(affineMap::MlirAffineMap, pos::intptr_t)::MlirAffineExpr + @ccall mlir_c.mlirAffineMapGetResult( + affineMap::MlirAffineMap, pos::intptr_t + )::MlirAffineExpr end """ @@ -2698,7 +2909,9 @@ end Returns the affine map consisting of the `resultPos` subset. """ function mlirAffineMapGetSubMap(affineMap, size, resultPos) - @ccall mlir_c.mlirAffineMapGetSubMap(affineMap::MlirAffineMap, size::intptr_t, resultPos::Ptr{intptr_t})::MlirAffineMap + @ccall mlir_c.mlirAffineMapGetSubMap( + affineMap::MlirAffineMap, size::intptr_t, resultPos::Ptr{intptr_t} + )::MlirAffineMap end """ @@ -2707,7 +2920,9 @@ end 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. """ function mlirAffineMapGetMajorSubMap(affineMap, numResults) - @ccall mlir_c.mlirAffineMapGetMajorSubMap(affineMap::MlirAffineMap, numResults::intptr_t)::MlirAffineMap + @ccall mlir_c.mlirAffineMapGetMajorSubMap( + affineMap::MlirAffineMap, numResults::intptr_t + )::MlirAffineMap end """ @@ -2716,7 +2931,9 @@ end 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. """ function mlirAffineMapGetMinorSubMap(affineMap, numResults) - @ccall mlir_c.mlirAffineMapGetMinorSubMap(affineMap::MlirAffineMap, numResults::intptr_t)::MlirAffineMap + @ccall mlir_c.mlirAffineMapGetMinorSubMap( + affineMap::MlirAffineMap, numResults::intptr_t + )::MlirAffineMap end """ @@ -2724,8 +2941,16 @@ end 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. """ -function mlirAffineMapReplace(affineMap, expression, replacement, numResultDims, numResultSyms) - @ccall mlir_c.mlirAffineMapReplace(affineMap::MlirAffineMap, expression::MlirAffineExpr, replacement::MlirAffineExpr, numResultDims::intptr_t, numResultSyms::intptr_t)::MlirAffineMap +function mlirAffineMapReplace( + affineMap, expression, replacement, numResultDims, numResultSyms +) + @ccall mlir_c.mlirAffineMapReplace( + affineMap::MlirAffineMap, + expression::MlirAffineExpr, + replacement::MlirAffineExpr, + numResultDims::intptr_t, + numResultSyms::intptr_t, + )::MlirAffineMap end """ @@ -2734,7 +2959,12 @@ end 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. """ function mlirAffineMapCompressUnusedSymbols(affineMaps, size, result, populateResult) - @ccall mlir_c.mlirAffineMapCompressUnusedSymbols(affineMaps::Ptr{MlirAffineMap}, size::intptr_t, result::Ptr{Cvoid}, populateResult::Ptr{Cvoid})::Cvoid + @ccall mlir_c.mlirAffineMapCompressUnusedSymbols( + affineMaps::Ptr{MlirAffineMap}, + size::intptr_t, + result::Ptr{Cvoid}, + populateResult::Ptr{Cvoid}, + )::Cvoid end struct MlirIntegerSet @@ -2774,7 +3004,9 @@ end Prints an integer set by sending chunks of the string representation and forwarding `userData to `callback`. Note that the callback may be called several times with consecutive chunks of the string. """ function mlirIntegerSetPrint(set, callback, userData) - @ccall mlir_c.mlirIntegerSetPrint(set::MlirIntegerSet, callback::MlirStringCallback, userData::Ptr{Cvoid})::Cvoid + @ccall mlir_c.mlirIntegerSetPrint( + set::MlirIntegerSet, callback::MlirStringCallback, userData::Ptr{Cvoid} + )::Cvoid end """ @@ -2792,7 +3024,9 @@ end Gets or creates a new canonically empty integer set with the give number of dimensions and symbols in the given context. """ function mlirIntegerSetEmptyGet(context, numDims, numSymbols) - @ccall mlir_c.mlirIntegerSetEmptyGet(context::MlirContext, numDims::intptr_t, numSymbols::intptr_t)::MlirIntegerSet + @ccall mlir_c.mlirIntegerSetEmptyGet( + context::MlirContext, numDims::intptr_t, numSymbols::intptr_t + )::MlirIntegerSet end """ @@ -2800,8 +3034,17 @@ end 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. """ -function mlirIntegerSetGet(context, numDims, numSymbols, numConstraints, constraints, eqFlags) - @ccall mlir_c.mlirIntegerSetGet(context::MlirContext, numDims::intptr_t, numSymbols::intptr_t, numConstraints::intptr_t, constraints::Ptr{MlirAffineExpr}, eqFlags::Ptr{Bool})::MlirIntegerSet +function mlirIntegerSetGet( + context, numDims, numSymbols, numConstraints, constraints, eqFlags +) + @ccall mlir_c.mlirIntegerSetGet( + context::MlirContext, + numDims::intptr_t, + numSymbols::intptr_t, + numConstraints::intptr_t, + constraints::Ptr{MlirAffineExpr}, + eqFlags::Ptr{Bool}, + )::MlirIntegerSet end """ @@ -2809,8 +3052,16 @@ end 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. """ -function mlirIntegerSetReplaceGet(set, dimReplacements, symbolReplacements, numResultDims, numResultSymbols) - @ccall mlir_c.mlirIntegerSetReplaceGet(set::MlirIntegerSet, dimReplacements::Ptr{MlirAffineExpr}, symbolReplacements::Ptr{MlirAffineExpr}, numResultDims::intptr_t, numResultSymbols::intptr_t)::MlirIntegerSet +function mlirIntegerSetReplaceGet( + set, dimReplacements, symbolReplacements, numResultDims, numResultSymbols +) + @ccall mlir_c.mlirIntegerSetReplaceGet( + set::MlirIntegerSet, + dimReplacements::Ptr{MlirAffineExpr}, + symbolReplacements::Ptr{MlirAffineExpr}, + numResultDims::intptr_t, + numResultSymbols::intptr_t, + )::MlirIntegerSet end """ @@ -2882,7 +3133,9 @@ end Returns `pos`-th constraint of the set. """ function mlirIntegerSetGetConstraint(set, pos) - @ccall mlir_c.mlirIntegerSetGetConstraint(set::MlirIntegerSet, pos::intptr_t)::MlirAffineExpr + @ccall mlir_c.mlirIntegerSetGetConstraint( + set::MlirIntegerSet, pos::intptr_t + )::MlirAffineExpr end """ @@ -2958,7 +3211,9 @@ end Creates an array element containing the given list of elements in the given context. """ function mlirArrayAttrGet(ctx, numElements, elements) - @ccall mlir_c.mlirArrayAttrGet(ctx::MlirContext, numElements::intptr_t, elements::Ptr{MlirAttribute})::MlirAttribute + @ccall mlir_c.mlirArrayAttrGet( + ctx::MlirContext, numElements::intptr_t, elements::Ptr{MlirAttribute} + )::MlirAttribute end """ @@ -3003,7 +3258,9 @@ end Creates a dictionary attribute containing the given list of elements in the provided context. """ function mlirDictionaryAttrGet(ctx, numElements, elements) - @ccall mlir_c.mlirDictionaryAttrGet(ctx::MlirContext, numElements::intptr_t, elements::Ptr{MlirNamedAttribute})::MlirAttribute + @ccall mlir_c.mlirDictionaryAttrGet( + ctx::MlirContext, numElements::intptr_t, elements::Ptr{MlirNamedAttribute} + )::MlirAttribute end """ @@ -3021,7 +3278,9 @@ end Returns pos-th element of the given dictionary attribute. """ function mlirDictionaryAttrGetElement(attr, pos) - @ccall mlir_c.mlirDictionaryAttrGetElement(attr::MlirAttribute, pos::intptr_t)::MlirNamedAttribute + @ccall mlir_c.mlirDictionaryAttrGetElement( + attr::MlirAttribute, pos::intptr_t + )::MlirNamedAttribute end """ @@ -3030,7 +3289,9 @@ end Returns the dictionary attribute element with the given name or NULL if the given name does not exist in the dictionary. """ function mlirDictionaryAttrGetElementByName(attr, name) - @ccall mlir_c.mlirDictionaryAttrGetElementByName(attr::MlirAttribute, name::MlirStringRef)::MlirAttribute + @ccall mlir_c.mlirDictionaryAttrGetElementByName( + attr::MlirAttribute, name::MlirStringRef + )::MlirAttribute end """ @@ -3057,7 +3318,9 @@ end Creates a floating point attribute in the given context with the given double value and double-precision FP semantics. """ function mlirFloatAttrDoubleGet(ctx, type, value) - @ccall mlir_c.mlirFloatAttrDoubleGet(ctx::MlirContext, type::MlirType, value::Cdouble)::MlirAttribute + @ccall mlir_c.mlirFloatAttrDoubleGet( + ctx::MlirContext, type::MlirType, value::Cdouble + )::MlirAttribute end """ @@ -3066,7 +3329,9 @@ end Same as "[`mlirFloatAttrDoubleGet`](@ref)", but if the type is not valid for a construction of a FloatAttr, returns a null [`MlirAttribute`](@ref). """ function mlirFloatAttrDoubleGetChecked(loc, type, value) - @ccall mlir_c.mlirFloatAttrDoubleGetChecked(loc::MlirLocation, type::MlirType, value::Cdouble)::MlirAttribute + @ccall mlir_c.mlirFloatAttrDoubleGetChecked( + loc::MlirLocation, type::MlirType, value::Cdouble + )::MlirAttribute end """ @@ -3219,7 +3484,13 @@ end 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). """ function mlirOpaqueAttrGet(ctx, dialectNamespace, dataLength, data, type) - @ccall mlir_c.mlirOpaqueAttrGet(ctx::MlirContext, dialectNamespace::MlirStringRef, dataLength::intptr_t, data::Cstring, type::MlirType)::MlirAttribute + @ccall mlir_c.mlirOpaqueAttrGet( + ctx::MlirContext, + dialectNamespace::MlirStringRef, + dataLength::intptr_t, + data::Cstring, + type::MlirType, + )::MlirAttribute end """ @@ -3309,7 +3580,12 @@ end 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. """ function mlirSymbolRefAttrGet(ctx, symbol, numReferences, references) - @ccall mlir_c.mlirSymbolRefAttrGet(ctx::MlirContext, symbol::MlirStringRef, numReferences::intptr_t, references::Ptr{MlirAttribute})::MlirAttribute + @ccall mlir_c.mlirSymbolRefAttrGet( + ctx::MlirContext, + symbol::MlirStringRef, + numReferences::intptr_t, + references::Ptr{MlirAttribute}, + )::MlirAttribute end """ @@ -3345,7 +3621,9 @@ end Returns pos-th reference nested in the given symbol reference attribute. """ function mlirSymbolRefAttrGetNestedReference(attr, pos) - @ccall mlir_c.mlirSymbolRefAttrGetNestedReference(attr::MlirAttribute, pos::intptr_t)::MlirAttribute + @ccall mlir_c.mlirSymbolRefAttrGetNestedReference( + attr::MlirAttribute, pos::intptr_t + )::MlirAttribute end """ @@ -3381,7 +3659,9 @@ end Creates a flat symbol reference attribute in the given context referencing a symbol identified by the given string. """ function mlirFlatSymbolRefAttrGet(ctx, symbol) - @ccall mlir_c.mlirFlatSymbolRefAttrGet(ctx::MlirContext, symbol::MlirStringRef)::MlirAttribute + @ccall mlir_c.mlirFlatSymbolRefAttrGet( + ctx::MlirContext, symbol::MlirStringRef + )::MlirAttribute end """ @@ -3471,7 +3751,9 @@ end Returns the element at the given rank-dimensional index. """ function mlirElementsAttrGetValue(attr, rank, idxs) - @ccall mlir_c.mlirElementsAttrGetValue(attr::MlirAttribute, rank::intptr_t, idxs::Ptr{UInt64})::MlirAttribute + @ccall mlir_c.mlirElementsAttrGetValue( + attr::MlirAttribute, rank::intptr_t, idxs::Ptr{UInt64} + )::MlirAttribute end """ @@ -3480,7 +3762,9 @@ end Checks whether the given rank-dimensional index is valid in the given elements attribute. """ function mlirElementsAttrIsValidIndex(attr, rank, idxs) - @ccall mlir_c.mlirElementsAttrIsValidIndex(attr::MlirAttribute, rank::intptr_t, idxs::Ptr{UInt64})::Bool + @ccall mlir_c.mlirElementsAttrIsValidIndex( + attr::MlirAttribute, rank::intptr_t, idxs::Ptr{UInt64} + )::Bool end """ @@ -3535,31 +3819,45 @@ end Create a dense array attribute with the given elements. """ function mlirDenseBoolArrayGet(ctx, size, values) - @ccall mlir_c.mlirDenseBoolArrayGet(ctx::MlirContext, size::intptr_t, values::Ptr{Cint})::MlirAttribute + @ccall mlir_c.mlirDenseBoolArrayGet( + ctx::MlirContext, size::intptr_t, values::Ptr{Cint} + )::MlirAttribute end function mlirDenseI8ArrayGet(ctx, size, values) - @ccall mlir_c.mlirDenseI8ArrayGet(ctx::MlirContext, size::intptr_t, values::Ptr{Int8})::MlirAttribute + @ccall mlir_c.mlirDenseI8ArrayGet( + ctx::MlirContext, size::intptr_t, values::Ptr{Int8} + )::MlirAttribute end function mlirDenseI16ArrayGet(ctx, size, values) - @ccall mlir_c.mlirDenseI16ArrayGet(ctx::MlirContext, size::intptr_t, values::Ptr{Int16})::MlirAttribute + @ccall mlir_c.mlirDenseI16ArrayGet( + ctx::MlirContext, size::intptr_t, values::Ptr{Int16} + )::MlirAttribute end function mlirDenseI32ArrayGet(ctx, size, values) - @ccall mlir_c.mlirDenseI32ArrayGet(ctx::MlirContext, size::intptr_t, values::Ptr{Int32})::MlirAttribute + @ccall mlir_c.mlirDenseI32ArrayGet( + ctx::MlirContext, size::intptr_t, values::Ptr{Int32} + )::MlirAttribute end function mlirDenseI64ArrayGet(ctx, size, values) - @ccall mlir_c.mlirDenseI64ArrayGet(ctx::MlirContext, size::intptr_t, values::Ptr{Int64})::MlirAttribute + @ccall mlir_c.mlirDenseI64ArrayGet( + ctx::MlirContext, size::intptr_t, values::Ptr{Int64} + )::MlirAttribute end function mlirDenseF32ArrayGet(ctx, size, values) - @ccall mlir_c.mlirDenseF32ArrayGet(ctx::MlirContext, size::intptr_t, values::Ptr{Cfloat})::MlirAttribute + @ccall mlir_c.mlirDenseF32ArrayGet( + ctx::MlirContext, size::intptr_t, values::Ptr{Cfloat} + )::MlirAttribute end function mlirDenseF64ArrayGet(ctx, size, values) - @ccall mlir_c.mlirDenseF64ArrayGet(ctx::MlirContext, size::intptr_t, values::Ptr{Cdouble})::MlirAttribute + @ccall mlir_c.mlirDenseF64ArrayGet( + ctx::MlirContext, size::intptr_t, values::Ptr{Cdouble} + )::MlirAttribute end """ @@ -3636,7 +3934,9 @@ end Creates a dense elements attribute with the given Shaped type and elements in the same context as the type. """ function mlirDenseElementsAttrGet(shapedType, numElements, elements) - @ccall mlir_c.mlirDenseElementsAttrGet(shapedType::MlirType, numElements::intptr_t, elements::Ptr{MlirAttribute})::MlirAttribute + @ccall mlir_c.mlirDenseElementsAttrGet( + shapedType::MlirType, numElements::intptr_t, elements::Ptr{MlirAttribute} + )::MlirAttribute end """ @@ -3649,7 +3949,9 @@ The format of the raw buffer is a densely packed array of values that can be bit 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. """ function mlirDenseElementsAttrRawBufferGet(shapedType, rawBufferSize, rawBuffer) - @ccall mlir_c.mlirDenseElementsAttrRawBufferGet(shapedType::MlirType, rawBufferSize::Csize_t, rawBuffer::Ptr{Cvoid})::MlirAttribute + @ccall mlir_c.mlirDenseElementsAttrRawBufferGet( + shapedType::MlirType, rawBufferSize::Csize_t, rawBuffer::Ptr{Cvoid} + )::MlirAttribute end """ @@ -3658,43 +3960,63 @@ end Creates a dense elements attribute with the given Shaped type containing a single replicated element (splat). """ function mlirDenseElementsAttrSplatGet(shapedType, element) - @ccall mlir_c.mlirDenseElementsAttrSplatGet(shapedType::MlirType, element::MlirAttribute)::MlirAttribute + @ccall mlir_c.mlirDenseElementsAttrSplatGet( + shapedType::MlirType, element::MlirAttribute + )::MlirAttribute end function mlirDenseElementsAttrBoolSplatGet(shapedType, element) - @ccall mlir_c.mlirDenseElementsAttrBoolSplatGet(shapedType::MlirType, element::Bool)::MlirAttribute + @ccall mlir_c.mlirDenseElementsAttrBoolSplatGet( + shapedType::MlirType, element::Bool + )::MlirAttribute end function mlirDenseElementsAttrUInt8SplatGet(shapedType, element) - @ccall mlir_c.mlirDenseElementsAttrUInt8SplatGet(shapedType::MlirType, element::UInt8)::MlirAttribute + @ccall mlir_c.mlirDenseElementsAttrUInt8SplatGet( + shapedType::MlirType, element::UInt8 + )::MlirAttribute end function mlirDenseElementsAttrInt8SplatGet(shapedType, element) - @ccall mlir_c.mlirDenseElementsAttrInt8SplatGet(shapedType::MlirType, element::Int8)::MlirAttribute + @ccall mlir_c.mlirDenseElementsAttrInt8SplatGet( + shapedType::MlirType, element::Int8 + )::MlirAttribute end function mlirDenseElementsAttrUInt32SplatGet(shapedType, element) - @ccall mlir_c.mlirDenseElementsAttrUInt32SplatGet(shapedType::MlirType, element::UInt32)::MlirAttribute + @ccall mlir_c.mlirDenseElementsAttrUInt32SplatGet( + shapedType::MlirType, element::UInt32 + )::MlirAttribute end function mlirDenseElementsAttrInt32SplatGet(shapedType, element) - @ccall mlir_c.mlirDenseElementsAttrInt32SplatGet(shapedType::MlirType, element::Int32)::MlirAttribute + @ccall mlir_c.mlirDenseElementsAttrInt32SplatGet( + shapedType::MlirType, element::Int32 + )::MlirAttribute end function mlirDenseElementsAttrUInt64SplatGet(shapedType, element) - @ccall mlir_c.mlirDenseElementsAttrUInt64SplatGet(shapedType::MlirType, element::UInt64)::MlirAttribute + @ccall mlir_c.mlirDenseElementsAttrUInt64SplatGet( + shapedType::MlirType, element::UInt64 + )::MlirAttribute end function mlirDenseElementsAttrInt64SplatGet(shapedType, element) - @ccall mlir_c.mlirDenseElementsAttrInt64SplatGet(shapedType::MlirType, element::Int64)::MlirAttribute + @ccall mlir_c.mlirDenseElementsAttrInt64SplatGet( + shapedType::MlirType, element::Int64 + )::MlirAttribute end function mlirDenseElementsAttrFloatSplatGet(shapedType, element) - @ccall mlir_c.mlirDenseElementsAttrFloatSplatGet(shapedType::MlirType, element::Cfloat)::MlirAttribute + @ccall mlir_c.mlirDenseElementsAttrFloatSplatGet( + shapedType::MlirType, element::Cfloat + )::MlirAttribute end function mlirDenseElementsAttrDoubleSplatGet(shapedType, element) - @ccall mlir_c.mlirDenseElementsAttrDoubleSplatGet(shapedType::MlirType, element::Cdouble)::MlirAttribute + @ccall mlir_c.mlirDenseElementsAttrDoubleSplatGet( + shapedType::MlirType, element::Cdouble + )::MlirAttribute end """ @@ -3703,55 +4025,81 @@ end 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. """ function mlirDenseElementsAttrBoolGet(shapedType, numElements, elements) - @ccall mlir_c.mlirDenseElementsAttrBoolGet(shapedType::MlirType, numElements::intptr_t, elements::Ptr{Cint})::MlirAttribute + @ccall mlir_c.mlirDenseElementsAttrBoolGet( + shapedType::MlirType, numElements::intptr_t, elements::Ptr{Cint} + )::MlirAttribute end function mlirDenseElementsAttrUInt8Get(shapedType, numElements, elements) - @ccall mlir_c.mlirDenseElementsAttrUInt8Get(shapedType::MlirType, numElements::intptr_t, elements::Ptr{UInt8})::MlirAttribute + @ccall mlir_c.mlirDenseElementsAttrUInt8Get( + shapedType::MlirType, numElements::intptr_t, elements::Ptr{UInt8} + )::MlirAttribute end function mlirDenseElementsAttrInt8Get(shapedType, numElements, elements) - @ccall mlir_c.mlirDenseElementsAttrInt8Get(shapedType::MlirType, numElements::intptr_t, elements::Ptr{Int8})::MlirAttribute + @ccall mlir_c.mlirDenseElementsAttrInt8Get( + shapedType::MlirType, numElements::intptr_t, elements::Ptr{Int8} + )::MlirAttribute end function mlirDenseElementsAttrUInt16Get(shapedType, numElements, elements) - @ccall mlir_c.mlirDenseElementsAttrUInt16Get(shapedType::MlirType, numElements::intptr_t, elements::Ptr{UInt16})::MlirAttribute + @ccall mlir_c.mlirDenseElementsAttrUInt16Get( + shapedType::MlirType, numElements::intptr_t, elements::Ptr{UInt16} + )::MlirAttribute end function mlirDenseElementsAttrInt16Get(shapedType, numElements, elements) - @ccall mlir_c.mlirDenseElementsAttrInt16Get(shapedType::MlirType, numElements::intptr_t, elements::Ptr{Int16})::MlirAttribute + @ccall mlir_c.mlirDenseElementsAttrInt16Get( + shapedType::MlirType, numElements::intptr_t, elements::Ptr{Int16} + )::MlirAttribute end function mlirDenseElementsAttrUInt32Get(shapedType, numElements, elements) - @ccall mlir_c.mlirDenseElementsAttrUInt32Get(shapedType::MlirType, numElements::intptr_t, elements::Ptr{UInt32})::MlirAttribute + @ccall mlir_c.mlirDenseElementsAttrUInt32Get( + shapedType::MlirType, numElements::intptr_t, elements::Ptr{UInt32} + )::MlirAttribute end function mlirDenseElementsAttrInt32Get(shapedType, numElements, elements) - @ccall mlir_c.mlirDenseElementsAttrInt32Get(shapedType::MlirType, numElements::intptr_t, elements::Ptr{Int32})::MlirAttribute + @ccall mlir_c.mlirDenseElementsAttrInt32Get( + shapedType::MlirType, numElements::intptr_t, elements::Ptr{Int32} + )::MlirAttribute end function mlirDenseElementsAttrUInt64Get(shapedType, numElements, elements) - @ccall mlir_c.mlirDenseElementsAttrUInt64Get(shapedType::MlirType, numElements::intptr_t, elements::Ptr{UInt64})::MlirAttribute + @ccall mlir_c.mlirDenseElementsAttrUInt64Get( + shapedType::MlirType, numElements::intptr_t, elements::Ptr{UInt64} + )::MlirAttribute end function mlirDenseElementsAttrInt64Get(shapedType, numElements, elements) - @ccall mlir_c.mlirDenseElementsAttrInt64Get(shapedType::MlirType, numElements::intptr_t, elements::Ptr{Int64})::MlirAttribute + @ccall mlir_c.mlirDenseElementsAttrInt64Get( + shapedType::MlirType, numElements::intptr_t, elements::Ptr{Int64} + )::MlirAttribute end function mlirDenseElementsAttrFloatGet(shapedType, numElements, elements) - @ccall mlir_c.mlirDenseElementsAttrFloatGet(shapedType::MlirType, numElements::intptr_t, elements::Ptr{Cfloat})::MlirAttribute + @ccall mlir_c.mlirDenseElementsAttrFloatGet( + shapedType::MlirType, numElements::intptr_t, elements::Ptr{Cfloat} + )::MlirAttribute end function mlirDenseElementsAttrDoubleGet(shapedType, numElements, elements) - @ccall mlir_c.mlirDenseElementsAttrDoubleGet(shapedType::MlirType, numElements::intptr_t, elements::Ptr{Cdouble})::MlirAttribute + @ccall mlir_c.mlirDenseElementsAttrDoubleGet( + shapedType::MlirType, numElements::intptr_t, elements::Ptr{Cdouble} + )::MlirAttribute end function mlirDenseElementsAttrBFloat16Get(shapedType, numElements, elements) - @ccall mlir_c.mlirDenseElementsAttrBFloat16Get(shapedType::MlirType, numElements::intptr_t, elements::Ptr{UInt16})::MlirAttribute + @ccall mlir_c.mlirDenseElementsAttrBFloat16Get( + shapedType::MlirType, numElements::intptr_t, elements::Ptr{UInt16} + )::MlirAttribute end function mlirDenseElementsAttrFloat16Get(shapedType, numElements, elements) - @ccall mlir_c.mlirDenseElementsAttrFloat16Get(shapedType::MlirType, numElements::intptr_t, elements::Ptr{UInt16})::MlirAttribute + @ccall mlir_c.mlirDenseElementsAttrFloat16Get( + shapedType::MlirType, numElements::intptr_t, elements::Ptr{UInt16} + )::MlirAttribute end """ @@ -3760,7 +4108,9 @@ end Creates a dense elements attribute with the given shaped type from string elements. """ function mlirDenseElementsAttrStringGet(shapedType, numElements, strs) - @ccall mlir_c.mlirDenseElementsAttrStringGet(shapedType::MlirType, numElements::intptr_t, strs::Ptr{MlirStringRef})::MlirAttribute + @ccall mlir_c.mlirDenseElementsAttrStringGet( + shapedType::MlirType, numElements::intptr_t, strs::Ptr{MlirStringRef} + )::MlirAttribute end """ @@ -3769,7 +4119,9 @@ end 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. """ function mlirDenseElementsAttrReshapeGet(attr, shapedType) - @ccall mlir_c.mlirDenseElementsAttrReshapeGet(attr::MlirAttribute, shapedType::MlirType)::MlirAttribute + @ccall mlir_c.mlirDenseElementsAttrReshapeGet( + attr::MlirAttribute, shapedType::MlirType + )::MlirAttribute end """ @@ -3827,7 +4179,9 @@ function mlirDenseElementsAttrGetDoubleSplatValue(attr) end function mlirDenseElementsAttrGetStringSplatValue(attr) - @ccall mlir_c.mlirDenseElementsAttrGetStringSplatValue(attr::MlirAttribute)::MlirStringRef + @ccall mlir_c.mlirDenseElementsAttrGetStringSplatValue( + attr::MlirAttribute + )::MlirStringRef end """ @@ -3836,51 +4190,75 @@ end Returns the pos-th value (flat contiguous indexing) of a specific type contained by the given dense elements attribute. """ function mlirDenseElementsAttrGetBoolValue(attr, pos) - @ccall mlir_c.mlirDenseElementsAttrGetBoolValue(attr::MlirAttribute, pos::intptr_t)::Bool + @ccall mlir_c.mlirDenseElementsAttrGetBoolValue( + attr::MlirAttribute, pos::intptr_t + )::Bool end function mlirDenseElementsAttrGetInt8Value(attr, pos) - @ccall mlir_c.mlirDenseElementsAttrGetInt8Value(attr::MlirAttribute, pos::intptr_t)::Int8 + @ccall mlir_c.mlirDenseElementsAttrGetInt8Value( + attr::MlirAttribute, pos::intptr_t + )::Int8 end function mlirDenseElementsAttrGetUInt8Value(attr, pos) - @ccall mlir_c.mlirDenseElementsAttrGetUInt8Value(attr::MlirAttribute, pos::intptr_t)::UInt8 + @ccall mlir_c.mlirDenseElementsAttrGetUInt8Value( + attr::MlirAttribute, pos::intptr_t + )::UInt8 end function mlirDenseElementsAttrGetInt16Value(attr, pos) - @ccall mlir_c.mlirDenseElementsAttrGetInt16Value(attr::MlirAttribute, pos::intptr_t)::Int16 + @ccall mlir_c.mlirDenseElementsAttrGetInt16Value( + attr::MlirAttribute, pos::intptr_t + )::Int16 end function mlirDenseElementsAttrGetUInt16Value(attr, pos) - @ccall mlir_c.mlirDenseElementsAttrGetUInt16Value(attr::MlirAttribute, pos::intptr_t)::UInt16 + @ccall mlir_c.mlirDenseElementsAttrGetUInt16Value( + attr::MlirAttribute, pos::intptr_t + )::UInt16 end function mlirDenseElementsAttrGetInt32Value(attr, pos) - @ccall mlir_c.mlirDenseElementsAttrGetInt32Value(attr::MlirAttribute, pos::intptr_t)::Int32 + @ccall mlir_c.mlirDenseElementsAttrGetInt32Value( + attr::MlirAttribute, pos::intptr_t + )::Int32 end function mlirDenseElementsAttrGetUInt32Value(attr, pos) - @ccall mlir_c.mlirDenseElementsAttrGetUInt32Value(attr::MlirAttribute, pos::intptr_t)::UInt32 + @ccall mlir_c.mlirDenseElementsAttrGetUInt32Value( + attr::MlirAttribute, pos::intptr_t + )::UInt32 end function mlirDenseElementsAttrGetInt64Value(attr, pos) - @ccall mlir_c.mlirDenseElementsAttrGetInt64Value(attr::MlirAttribute, pos::intptr_t)::Int64 + @ccall mlir_c.mlirDenseElementsAttrGetInt64Value( + attr::MlirAttribute, pos::intptr_t + )::Int64 end function mlirDenseElementsAttrGetUInt64Value(attr, pos) - @ccall mlir_c.mlirDenseElementsAttrGetUInt64Value(attr::MlirAttribute, pos::intptr_t)::UInt64 + @ccall mlir_c.mlirDenseElementsAttrGetUInt64Value( + attr::MlirAttribute, pos::intptr_t + )::UInt64 end function mlirDenseElementsAttrGetFloatValue(attr, pos) - @ccall mlir_c.mlirDenseElementsAttrGetFloatValue(attr::MlirAttribute, pos::intptr_t)::Cfloat + @ccall mlir_c.mlirDenseElementsAttrGetFloatValue( + attr::MlirAttribute, pos::intptr_t + )::Cfloat end function mlirDenseElementsAttrGetDoubleValue(attr, pos) - @ccall mlir_c.mlirDenseElementsAttrGetDoubleValue(attr::MlirAttribute, pos::intptr_t)::Cdouble + @ccall mlir_c.mlirDenseElementsAttrGetDoubleValue( + attr::MlirAttribute, pos::intptr_t + )::Cdouble end function mlirDenseElementsAttrGetStringValue(attr, pos) - @ccall mlir_c.mlirDenseElementsAttrGetStringValue(attr::MlirAttribute, pos::intptr_t)::MlirStringRef + @ccall mlir_c.mlirDenseElementsAttrGetStringValue( + attr::MlirAttribute, pos::intptr_t + )::MlirStringRef end """ @@ -3901,52 +4279,140 @@ end 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). """ -function mlirUnmanagedDenseResourceElementsAttrGet(shapedType, name, data, dataLength, dataAlignment, dataIsMutable, deleter, userData) - @ccall mlir_c.mlirUnmanagedDenseResourceElementsAttrGet(shapedType::MlirType, name::MlirStringRef, data::Ptr{Cvoid}, dataLength::Csize_t, dataAlignment::Csize_t, dataIsMutable::Bool, deleter::Ptr{Cvoid}, userData::Ptr{Cvoid})::MlirAttribute -end - -function mlirUnmanagedDenseBoolResourceElementsAttrGet(shapedType, name, numElements, elements) - @ccall mlir_c.mlirUnmanagedDenseBoolResourceElementsAttrGet(shapedType::MlirType, name::MlirStringRef, numElements::intptr_t, elements::Ptr{Cint})::MlirAttribute -end - -function mlirUnmanagedDenseUInt8ResourceElementsAttrGet(shapedType, name, numElements, elements) - @ccall mlir_c.mlirUnmanagedDenseUInt8ResourceElementsAttrGet(shapedType::MlirType, name::MlirStringRef, numElements::intptr_t, elements::Ptr{UInt8})::MlirAttribute -end - -function mlirUnmanagedDenseInt8ResourceElementsAttrGet(shapedType, name, numElements, elements) - @ccall mlir_c.mlirUnmanagedDenseInt8ResourceElementsAttrGet(shapedType::MlirType, name::MlirStringRef, numElements::intptr_t, elements::Ptr{Int8})::MlirAttribute -end - -function mlirUnmanagedDenseUInt16ResourceElementsAttrGet(shapedType, name, numElements, elements) - @ccall mlir_c.mlirUnmanagedDenseUInt16ResourceElementsAttrGet(shapedType::MlirType, name::MlirStringRef, numElements::intptr_t, elements::Ptr{UInt16})::MlirAttribute -end - -function mlirUnmanagedDenseInt16ResourceElementsAttrGet(shapedType, name, numElements, elements) - @ccall mlir_c.mlirUnmanagedDenseInt16ResourceElementsAttrGet(shapedType::MlirType, name::MlirStringRef, numElements::intptr_t, elements::Ptr{Int16})::MlirAttribute -end - -function mlirUnmanagedDenseUInt32ResourceElementsAttrGet(shapedType, name, numElements, elements) - @ccall mlir_c.mlirUnmanagedDenseUInt32ResourceElementsAttrGet(shapedType::MlirType, name::MlirStringRef, numElements::intptr_t, elements::Ptr{UInt32})::MlirAttribute -end - -function mlirUnmanagedDenseInt32ResourceElementsAttrGet(shapedType, name, numElements, elements) - @ccall mlir_c.mlirUnmanagedDenseInt32ResourceElementsAttrGet(shapedType::MlirType, name::MlirStringRef, numElements::intptr_t, elements::Ptr{Int32})::MlirAttribute -end - -function mlirUnmanagedDenseUInt64ResourceElementsAttrGet(shapedType, name, numElements, elements) - @ccall mlir_c.mlirUnmanagedDenseUInt64ResourceElementsAttrGet(shapedType::MlirType, name::MlirStringRef, numElements::intptr_t, elements::Ptr{UInt64})::MlirAttribute -end - -function mlirUnmanagedDenseInt64ResourceElementsAttrGet(shapedType, name, numElements, elements) - @ccall mlir_c.mlirUnmanagedDenseInt64ResourceElementsAttrGet(shapedType::MlirType, name::MlirStringRef, numElements::intptr_t, elements::Ptr{Int64})::MlirAttribute -end - -function mlirUnmanagedDenseFloatResourceElementsAttrGet(shapedType, name, numElements, elements) - @ccall mlir_c.mlirUnmanagedDenseFloatResourceElementsAttrGet(shapedType::MlirType, name::MlirStringRef, numElements::intptr_t, elements::Ptr{Cfloat})::MlirAttribute -end - -function mlirUnmanagedDenseDoubleResourceElementsAttrGet(shapedType, name, numElements, elements) - @ccall mlir_c.mlirUnmanagedDenseDoubleResourceElementsAttrGet(shapedType::MlirType, name::MlirStringRef, numElements::intptr_t, elements::Ptr{Cdouble})::MlirAttribute +function mlirUnmanagedDenseResourceElementsAttrGet( + shapedType, name, data, dataLength, dataAlignment, dataIsMutable, deleter, userData +) + @ccall mlir_c.mlirUnmanagedDenseResourceElementsAttrGet( + shapedType::MlirType, + name::MlirStringRef, + data::Ptr{Cvoid}, + dataLength::Csize_t, + dataAlignment::Csize_t, + dataIsMutable::Bool, + deleter::Ptr{Cvoid}, + userData::Ptr{Cvoid}, + )::MlirAttribute +end + +function mlirUnmanagedDenseBoolResourceElementsAttrGet( + shapedType, name, numElements, elements +) + @ccall mlir_c.mlirUnmanagedDenseBoolResourceElementsAttrGet( + shapedType::MlirType, + name::MlirStringRef, + numElements::intptr_t, + elements::Ptr{Cint}, + )::MlirAttribute +end + +function mlirUnmanagedDenseUInt8ResourceElementsAttrGet( + shapedType, name, numElements, elements +) + @ccall mlir_c.mlirUnmanagedDenseUInt8ResourceElementsAttrGet( + shapedType::MlirType, + name::MlirStringRef, + numElements::intptr_t, + elements::Ptr{UInt8}, + )::MlirAttribute +end + +function mlirUnmanagedDenseInt8ResourceElementsAttrGet( + shapedType, name, numElements, elements +) + @ccall mlir_c.mlirUnmanagedDenseInt8ResourceElementsAttrGet( + shapedType::MlirType, + name::MlirStringRef, + numElements::intptr_t, + elements::Ptr{Int8}, + )::MlirAttribute +end + +function mlirUnmanagedDenseUInt16ResourceElementsAttrGet( + shapedType, name, numElements, elements +) + @ccall mlir_c.mlirUnmanagedDenseUInt16ResourceElementsAttrGet( + shapedType::MlirType, + name::MlirStringRef, + numElements::intptr_t, + elements::Ptr{UInt16}, + )::MlirAttribute +end + +function mlirUnmanagedDenseInt16ResourceElementsAttrGet( + shapedType, name, numElements, elements +) + @ccall mlir_c.mlirUnmanagedDenseInt16ResourceElementsAttrGet( + shapedType::MlirType, + name::MlirStringRef, + numElements::intptr_t, + elements::Ptr{Int16}, + )::MlirAttribute +end + +function mlirUnmanagedDenseUInt32ResourceElementsAttrGet( + shapedType, name, numElements, elements +) + @ccall mlir_c.mlirUnmanagedDenseUInt32ResourceElementsAttrGet( + shapedType::MlirType, + name::MlirStringRef, + numElements::intptr_t, + elements::Ptr{UInt32}, + )::MlirAttribute +end + +function mlirUnmanagedDenseInt32ResourceElementsAttrGet( + shapedType, name, numElements, elements +) + @ccall mlir_c.mlirUnmanagedDenseInt32ResourceElementsAttrGet( + shapedType::MlirType, + name::MlirStringRef, + numElements::intptr_t, + elements::Ptr{Int32}, + )::MlirAttribute +end + +function mlirUnmanagedDenseUInt64ResourceElementsAttrGet( + shapedType, name, numElements, elements +) + @ccall mlir_c.mlirUnmanagedDenseUInt64ResourceElementsAttrGet( + shapedType::MlirType, + name::MlirStringRef, + numElements::intptr_t, + elements::Ptr{UInt64}, + )::MlirAttribute +end + +function mlirUnmanagedDenseInt64ResourceElementsAttrGet( + shapedType, name, numElements, elements +) + @ccall mlir_c.mlirUnmanagedDenseInt64ResourceElementsAttrGet( + shapedType::MlirType, + name::MlirStringRef, + numElements::intptr_t, + elements::Ptr{Int64}, + )::MlirAttribute +end + +function mlirUnmanagedDenseFloatResourceElementsAttrGet( + shapedType, name, numElements, elements +) + @ccall mlir_c.mlirUnmanagedDenseFloatResourceElementsAttrGet( + shapedType::MlirType, + name::MlirStringRef, + numElements::intptr_t, + elements::Ptr{Cfloat}, + )::MlirAttribute +end + +function mlirUnmanagedDenseDoubleResourceElementsAttrGet( + shapedType, name, numElements, elements +) + @ccall mlir_c.mlirUnmanagedDenseDoubleResourceElementsAttrGet( + shapedType::MlirType, + name::MlirStringRef, + numElements::intptr_t, + elements::Ptr{Cdouble}, + )::MlirAttribute end """ @@ -3955,47 +4421,69 @@ end Returns the pos-th value (flat contiguous indexing) of a specific type contained by the given dense resource elements attribute. """ function mlirDenseBoolResourceElementsAttrGetValue(attr, pos) - @ccall mlir_c.mlirDenseBoolResourceElementsAttrGetValue(attr::MlirAttribute, pos::intptr_t)::Bool + @ccall mlir_c.mlirDenseBoolResourceElementsAttrGetValue( + attr::MlirAttribute, pos::intptr_t + )::Bool end function mlirDenseInt8ResourceElementsAttrGetValue(attr, pos) - @ccall mlir_c.mlirDenseInt8ResourceElementsAttrGetValue(attr::MlirAttribute, pos::intptr_t)::Int8 + @ccall mlir_c.mlirDenseInt8ResourceElementsAttrGetValue( + attr::MlirAttribute, pos::intptr_t + )::Int8 end function mlirDenseUInt8ResourceElementsAttrGetValue(attr, pos) - @ccall mlir_c.mlirDenseUInt8ResourceElementsAttrGetValue(attr::MlirAttribute, pos::intptr_t)::UInt8 + @ccall mlir_c.mlirDenseUInt8ResourceElementsAttrGetValue( + attr::MlirAttribute, pos::intptr_t + )::UInt8 end function mlirDenseInt16ResourceElementsAttrGetValue(attr, pos) - @ccall mlir_c.mlirDenseInt16ResourceElementsAttrGetValue(attr::MlirAttribute, pos::intptr_t)::Int16 + @ccall mlir_c.mlirDenseInt16ResourceElementsAttrGetValue( + attr::MlirAttribute, pos::intptr_t + )::Int16 end function mlirDenseUInt16ResourceElementsAttrGetValue(attr, pos) - @ccall mlir_c.mlirDenseUInt16ResourceElementsAttrGetValue(attr::MlirAttribute, pos::intptr_t)::UInt16 + @ccall mlir_c.mlirDenseUInt16ResourceElementsAttrGetValue( + attr::MlirAttribute, pos::intptr_t + )::UInt16 end function mlirDenseInt32ResourceElementsAttrGetValue(attr, pos) - @ccall mlir_c.mlirDenseInt32ResourceElementsAttrGetValue(attr::MlirAttribute, pos::intptr_t)::Int32 + @ccall mlir_c.mlirDenseInt32ResourceElementsAttrGetValue( + attr::MlirAttribute, pos::intptr_t + )::Int32 end function mlirDenseUInt32ResourceElementsAttrGetValue(attr, pos) - @ccall mlir_c.mlirDenseUInt32ResourceElementsAttrGetValue(attr::MlirAttribute, pos::intptr_t)::UInt32 + @ccall mlir_c.mlirDenseUInt32ResourceElementsAttrGetValue( + attr::MlirAttribute, pos::intptr_t + )::UInt32 end function mlirDenseInt64ResourceElementsAttrGetValue(attr, pos) - @ccall mlir_c.mlirDenseInt64ResourceElementsAttrGetValue(attr::MlirAttribute, pos::intptr_t)::Int64 + @ccall mlir_c.mlirDenseInt64ResourceElementsAttrGetValue( + attr::MlirAttribute, pos::intptr_t + )::Int64 end function mlirDenseUInt64ResourceElementsAttrGetValue(attr, pos) - @ccall mlir_c.mlirDenseUInt64ResourceElementsAttrGetValue(attr::MlirAttribute, pos::intptr_t)::UInt64 + @ccall mlir_c.mlirDenseUInt64ResourceElementsAttrGetValue( + attr::MlirAttribute, pos::intptr_t + )::UInt64 end function mlirDenseFloatResourceElementsAttrGetValue(attr, pos) - @ccall mlir_c.mlirDenseFloatResourceElementsAttrGetValue(attr::MlirAttribute, pos::intptr_t)::Cfloat + @ccall mlir_c.mlirDenseFloatResourceElementsAttrGetValue( + attr::MlirAttribute, pos::intptr_t + )::Cfloat end function mlirDenseDoubleResourceElementsAttrGetValue(attr, pos) - @ccall mlir_c.mlirDenseDoubleResourceElementsAttrGetValue(attr::MlirAttribute, pos::intptr_t)::Cdouble + @ccall mlir_c.mlirDenseDoubleResourceElementsAttrGetValue( + attr::MlirAttribute, pos::intptr_t + )::Cdouble end """ @@ -4013,7 +4501,9 @@ end 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. """ function mlirSparseElementsAttribute(shapedType, denseIndices, denseValues) - @ccall mlir_c.mlirSparseElementsAttribute(shapedType::MlirType, denseIndices::MlirAttribute, denseValues::MlirAttribute)::MlirAttribute + @ccall mlir_c.mlirSparseElementsAttribute( + shapedType::MlirType, denseIndices::MlirAttribute, denseValues::MlirAttribute + )::MlirAttribute end """ @@ -4048,7 +4538,9 @@ function mlirAttributeIsAStridedLayout(attr) end function mlirStridedLayoutAttrGet(ctx, offset, numStrides, strides) - @ccall mlir_c.mlirStridedLayoutAttrGet(ctx::MlirContext, offset::Int64, numStrides::intptr_t, strides::Ptr{Int64})::MlirAttribute + @ccall mlir_c.mlirStridedLayoutAttrGet( + ctx::MlirContext, offset::Int64, numStrides::intptr_t, strides::Ptr{Int64} + )::MlirAttribute end function mlirStridedLayoutAttrGetOffset(attr) @@ -4816,7 +5308,9 @@ end 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. """ function mlirVectorTypeGet(rank, shape, elementType) - @ccall mlir_c.mlirVectorTypeGet(rank::intptr_t, shape::Ptr{Int64}, elementType::MlirType)::MlirType + @ccall mlir_c.mlirVectorTypeGet( + rank::intptr_t, shape::Ptr{Int64}, elementType::MlirType + )::MlirType end """ @@ -4825,7 +5319,9 @@ end Same as "[`mlirVectorTypeGet`](@ref)" but returns a nullptr wrapping [`MlirType`](@ref) on illegal arguments, emitting appropriate diagnostics. """ function mlirVectorTypeGetChecked(loc, rank, shape, elementType) - @ccall mlir_c.mlirVectorTypeGetChecked(loc::MlirLocation, rank::intptr_t, shape::Ptr{Int64}, elementType::MlirType)::MlirType + @ccall mlir_c.mlirVectorTypeGetChecked( + loc::MlirLocation, rank::intptr_t, shape::Ptr{Int64}, elementType::MlirType + )::MlirType end """ @@ -4834,7 +5330,9 @@ end 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. """ function mlirVectorTypeGetScalable(rank, shape, scalable, elementType) - @ccall mlir_c.mlirVectorTypeGetScalable(rank::intptr_t, shape::Ptr{Int64}, scalable::Ptr{Bool}, elementType::MlirType)::MlirType + @ccall mlir_c.mlirVectorTypeGetScalable( + rank::intptr_t, shape::Ptr{Int64}, scalable::Ptr{Bool}, elementType::MlirType + )::MlirType end """ @@ -4843,7 +5341,13 @@ end Same as "[`mlirVectorTypeGetScalable`](@ref)" but returns a nullptr wrapping [`MlirType`](@ref) on illegal arguments, emitting appropriate diagnostics. """ function mlirVectorTypeGetScalableChecked(loc, rank, shape, scalable, elementType) - @ccall mlir_c.mlirVectorTypeGetScalableChecked(loc::MlirLocation, rank::intptr_t, shape::Ptr{Int64}, scalable::Ptr{Bool}, elementType::MlirType)::MlirType + @ccall mlir_c.mlirVectorTypeGetScalableChecked( + loc::MlirLocation, + rank::intptr_t, + shape::Ptr{Int64}, + scalable::Ptr{Bool}, + elementType::MlirType, + )::MlirType end """ @@ -4915,7 +5419,9 @@ end 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`](@ref)() to this parameter. """ function mlirRankedTensorTypeGet(rank, shape, elementType, encoding) - @ccall mlir_c.mlirRankedTensorTypeGet(rank::intptr_t, shape::Ptr{Int64}, elementType::MlirType, encoding::MlirAttribute)::MlirType + @ccall mlir_c.mlirRankedTensorTypeGet( + rank::intptr_t, shape::Ptr{Int64}, elementType::MlirType, encoding::MlirAttribute + )::MlirType end """ @@ -4924,7 +5430,13 @@ end Same as "[`mlirRankedTensorTypeGet`](@ref)" but returns a nullptr wrapping [`MlirType`](@ref) on illegal arguments, emitting appropriate diagnostics. """ function mlirRankedTensorTypeGetChecked(loc, rank, shape, elementType, encoding) - @ccall mlir_c.mlirRankedTensorTypeGetChecked(loc::MlirLocation, rank::intptr_t, shape::Ptr{Int64}, elementType::MlirType, encoding::MlirAttribute)::MlirType + @ccall mlir_c.mlirRankedTensorTypeGetChecked( + loc::MlirLocation, + rank::intptr_t, + shape::Ptr{Int64}, + elementType::MlirType, + encoding::MlirAttribute, + )::MlirType end """ @@ -4951,7 +5463,9 @@ end Same as "[`mlirUnrankedTensorTypeGet`](@ref)" but returns a nullptr wrapping [`MlirType`](@ref) on illegal arguments, emitting appropriate diagnostics. """ function mlirUnrankedTensorTypeGetChecked(loc, elementType) - @ccall mlir_c.mlirUnrankedTensorTypeGetChecked(loc::MlirLocation, elementType::MlirType)::MlirType + @ccall mlir_c.mlirUnrankedTensorTypeGetChecked( + loc::MlirLocation, elementType::MlirType + )::MlirType end """ @@ -4996,7 +5510,13 @@ end 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. """ function mlirMemRefTypeGet(elementType, rank, shape, layout, memorySpace) - @ccall mlir_c.mlirMemRefTypeGet(elementType::MlirType, rank::intptr_t, shape::Ptr{Int64}, layout::MlirAttribute, memorySpace::MlirAttribute)::MlirType + @ccall mlir_c.mlirMemRefTypeGet( + elementType::MlirType, + rank::intptr_t, + shape::Ptr{Int64}, + layout::MlirAttribute, + memorySpace::MlirAttribute, + )::MlirType end """ @@ -5005,7 +5525,14 @@ end Same as "[`mlirMemRefTypeGet`](@ref)" but returns a nullptr-wrapping [`MlirType`](@ref) o illegal arguments, emitting appropriate diagnostics. """ function mlirMemRefTypeGetChecked(loc, elementType, rank, shape, layout, memorySpace) - @ccall mlir_c.mlirMemRefTypeGetChecked(loc::MlirLocation, elementType::MlirType, rank::intptr_t, shape::Ptr{Int64}, layout::MlirAttribute, memorySpace::MlirAttribute)::MlirType + @ccall mlir_c.mlirMemRefTypeGetChecked( + loc::MlirLocation, + elementType::MlirType, + rank::intptr_t, + shape::Ptr{Int64}, + layout::MlirAttribute, + memorySpace::MlirAttribute, + )::MlirType end """ @@ -5014,7 +5541,9 @@ end 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. """ function mlirMemRefTypeContiguousGet(elementType, rank, shape, memorySpace) - @ccall mlir_c.mlirMemRefTypeContiguousGet(elementType::MlirType, rank::intptr_t, shape::Ptr{Int64}, memorySpace::MlirAttribute)::MlirType + @ccall mlir_c.mlirMemRefTypeContiguousGet( + elementType::MlirType, rank::intptr_t, shape::Ptr{Int64}, memorySpace::MlirAttribute + )::MlirType end """ @@ -5023,7 +5552,13 @@ end Same as "[`mlirMemRefTypeContiguousGet`](@ref)" but returns a nullptr wrapping [`MlirType`](@ref) on illegal arguments, emitting appropriate diagnostics. """ function mlirMemRefTypeContiguousGetChecked(loc, elementType, rank, shape, memorySpace) - @ccall mlir_c.mlirMemRefTypeContiguousGetChecked(loc::MlirLocation, elementType::MlirType, rank::intptr_t, shape::Ptr{Int64}, memorySpace::MlirAttribute)::MlirType + @ccall mlir_c.mlirMemRefTypeContiguousGetChecked( + loc::MlirLocation, + elementType::MlirType, + rank::intptr_t, + shape::Ptr{Int64}, + memorySpace::MlirAttribute, + )::MlirType end """ @@ -5032,7 +5567,9 @@ end 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. """ function mlirUnrankedMemRefTypeGet(elementType, memorySpace) - @ccall mlir_c.mlirUnrankedMemRefTypeGet(elementType::MlirType, memorySpace::MlirAttribute)::MlirType + @ccall mlir_c.mlirUnrankedMemRefTypeGet( + elementType::MlirType, memorySpace::MlirAttribute + )::MlirType end """ @@ -5041,7 +5578,9 @@ end Same as "[`mlirUnrankedMemRefTypeGet`](@ref)" but returns a nullptr wrapping [`MlirType`](@ref) on illegal arguments, emitting appropriate diagnostics. """ function mlirUnrankedMemRefTypeGetChecked(loc, elementType, memorySpace) - @ccall mlir_c.mlirUnrankedMemRefTypeGetChecked(loc::MlirLocation, elementType::MlirType, memorySpace::MlirAttribute)::MlirType + @ccall mlir_c.mlirUnrankedMemRefTypeGetChecked( + loc::MlirLocation, elementType::MlirType, memorySpace::MlirAttribute + )::MlirType end """ @@ -5077,7 +5616,9 @@ end 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. """ function mlirMemRefTypeGetStridesAndOffset(type, strides, offset) - @ccall mlir_c.mlirMemRefTypeGetStridesAndOffset(type::MlirType, strides::Ptr{Int64}, offset::Ptr{Int64})::MlirLogicalResult + @ccall mlir_c.mlirMemRefTypeGetStridesAndOffset( + type::MlirType, strides::Ptr{Int64}, offset::Ptr{Int64} + )::MlirLogicalResult end """ @@ -5113,7 +5654,9 @@ end Creates a tuple type that consists of the given list of elemental types. The type is owned by the context. """ function mlirTupleTypeGet(ctx, numElements, elements) - @ccall mlir_c.mlirTupleTypeGet(ctx::MlirContext, numElements::intptr_t, elements::Ptr{MlirType})::MlirType + @ccall mlir_c.mlirTupleTypeGet( + ctx::MlirContext, numElements::intptr_t, elements::Ptr{MlirType} + )::MlirType end """ @@ -5158,7 +5701,13 @@ end Creates a function type, mapping a list of input types to result types. """ function mlirFunctionTypeGet(ctx, numInputs, inputs, numResults, results) - @ccall mlir_c.mlirFunctionTypeGet(ctx::MlirContext, numInputs::intptr_t, inputs::Ptr{MlirType}, numResults::intptr_t, results::Ptr{MlirType})::MlirType + @ccall mlir_c.mlirFunctionTypeGet( + ctx::MlirContext, + numInputs::intptr_t, + inputs::Ptr{MlirType}, + numResults::intptr_t, + results::Ptr{MlirType}, + )::MlirType end """ @@ -5221,7 +5770,9 @@ end 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). """ function mlirOpaqueTypeGet(ctx, dialectNamespace, typeData) - @ccall mlir_c.mlirOpaqueTypeGet(ctx::MlirContext, dialectNamespace::MlirStringRef, typeData::MlirStringRef)::MlirType + @ccall mlir_c.mlirOpaqueTypeGet( + ctx::MlirContext, dialectNamespace::MlirStringRef, typeData::MlirStringRef + )::MlirType end """ @@ -5273,7 +5824,9 @@ end Create a new top-level PassManager anchored on `anchorOp`. """ function mlirPassManagerCreateOnOperation(ctx, anchorOp) - @ccall mlir_c.mlirPassManagerCreateOnOperation(ctx::MlirContext, anchorOp::MlirStringRef)::MlirPassManager + @ccall mlir_c.mlirPassManagerCreateOnOperation( + ctx::MlirContext, anchorOp::MlirStringRef + )::MlirPassManager end """ @@ -5300,7 +5853,9 @@ end Cast a top-level PassManager to a generic OpPassManager. """ function mlirPassManagerGetAsOpPassManager(passManager) - @ccall mlir_c.mlirPassManagerGetAsOpPassManager(passManager::MlirPassManager)::MlirOpPassManager + @ccall mlir_c.mlirPassManagerGetAsOpPassManager( + passManager::MlirPassManager + )::MlirOpPassManager end """ @@ -5309,7 +5864,9 @@ end Run the provided `passManager` on the given `op`. """ function mlirPassManagerRunOnOp(passManager, op) - @ccall mlir_c.mlirPassManagerRunOnOp(passManager::MlirPassManager, op::MlirOperation)::MlirLogicalResult + @ccall mlir_c.mlirPassManagerRunOnOp( + passManager::MlirPassManager, op::MlirOperation + )::MlirLogicalResult end """ @@ -5317,8 +5874,26 @@ end 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. """ -function mlirPassManagerEnableIRPrinting(passManager, printBeforeAll, printAfterAll, printModuleScope, printAfterOnlyOnChange, printAfterOnlyOnFailure, flags, treePrintingPath) - @ccall mlir_c.mlirPassManagerEnableIRPrinting(passManager::MlirPassManager, printBeforeAll::Bool, printAfterAll::Bool, printModuleScope::Bool, printAfterOnlyOnChange::Bool, printAfterOnlyOnFailure::Bool, flags::MlirOpPrintingFlags, treePrintingPath::MlirStringRef)::Cvoid +function mlirPassManagerEnableIRPrinting( + passManager, + printBeforeAll, + printAfterAll, + printModuleScope, + printAfterOnlyOnChange, + printAfterOnlyOnFailure, + flags, + treePrintingPath, +) + @ccall mlir_c.mlirPassManagerEnableIRPrinting( + passManager::MlirPassManager, + printBeforeAll::Bool, + printAfterAll::Bool, + printModuleScope::Bool, + printAfterOnlyOnChange::Bool, + printAfterOnlyOnFailure::Bool, + flags::MlirOpPrintingFlags, + treePrintingPath::MlirStringRef, + )::Cvoid end """ @@ -5327,7 +5902,9 @@ end Enable / disable verify-each. """ function mlirPassManagerEnableVerifier(passManager, enable) - @ccall mlir_c.mlirPassManagerEnableVerifier(passManager::MlirPassManager, enable::Bool)::Cvoid + @ccall mlir_c.mlirPassManagerEnableVerifier( + passManager::MlirPassManager, enable::Bool + )::Cvoid end """ @@ -5336,7 +5913,9 @@ end 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. """ function mlirPassManagerGetNestedUnder(passManager, operationName) - @ccall mlir_c.mlirPassManagerGetNestedUnder(passManager::MlirPassManager, operationName::MlirStringRef)::MlirOpPassManager + @ccall mlir_c.mlirPassManagerGetNestedUnder( + passManager::MlirPassManager, operationName::MlirStringRef + )::MlirOpPassManager end """ @@ -5345,7 +5924,9 @@ end 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. """ function mlirOpPassManagerGetNestedUnder(passManager, operationName) - @ccall mlir_c.mlirOpPassManagerGetNestedUnder(passManager::MlirOpPassManager, operationName::MlirStringRef)::MlirOpPassManager + @ccall mlir_c.mlirOpPassManagerGetNestedUnder( + passManager::MlirOpPassManager, operationName::MlirStringRef + )::MlirOpPassManager end """ @@ -5354,7 +5935,9 @@ end 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. """ function mlirPassManagerAddOwnedPass(passManager, pass) - @ccall mlir_c.mlirPassManagerAddOwnedPass(passManager::MlirPassManager, pass::MlirPass)::Cvoid + @ccall mlir_c.mlirPassManagerAddOwnedPass( + passManager::MlirPassManager, pass::MlirPass + )::Cvoid end """ @@ -5363,7 +5946,9 @@ end 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. """ function mlirOpPassManagerAddOwnedPass(passManager, pass) - @ccall mlir_c.mlirOpPassManagerAddOwnedPass(passManager::MlirOpPassManager, pass::MlirPass)::Cvoid + @ccall mlir_c.mlirOpPassManagerAddOwnedPass( + passManager::MlirOpPassManager, pass::MlirPass + )::Cvoid end """ @@ -5372,7 +5957,12 @@ end 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. """ function mlirOpPassManagerAddPipeline(passManager, pipelineElements, callback, userData) - @ccall mlir_c.mlirOpPassManagerAddPipeline(passManager::MlirOpPassManager, pipelineElements::MlirStringRef, callback::MlirStringCallback, userData::Ptr{Cvoid})::MlirLogicalResult + @ccall mlir_c.mlirOpPassManagerAddPipeline( + passManager::MlirOpPassManager, + pipelineElements::MlirStringRef, + callback::MlirStringCallback, + userData::Ptr{Cvoid}, + )::MlirLogicalResult end """ @@ -5381,7 +5971,9 @@ end Print a textual MLIR pass pipeline by sending chunks of the string representation and forwarding `userData to `callback`. Note that the callback may be called several times with consecutive chunks of the string. """ function mlirPrintPassPipeline(passManager, callback, userData) - @ccall mlir_c.mlirPrintPassPipeline(passManager::MlirOpPassManager, callback::MlirStringCallback, userData::Ptr{Cvoid})::Cvoid + @ccall mlir_c.mlirPrintPassPipeline( + passManager::MlirOpPassManager, callback::MlirStringCallback, userData::Ptr{Cvoid} + )::Cvoid end """ @@ -5390,7 +5982,12 @@ end 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. """ function mlirParsePassPipeline(passManager, pipeline, callback, userData) - @ccall mlir_c.mlirParsePassPipeline(passManager::MlirOpPassManager, pipeline::MlirStringRef, callback::MlirStringCallback, userData::Ptr{Cvoid})::MlirLogicalResult + @ccall mlir_c.mlirParsePassPipeline( + passManager::MlirOpPassManager, + pipeline::MlirStringRef, + callback::MlirStringCallback, + userData::Ptr{Cvoid}, + )::MlirLogicalResult end """ @@ -5419,8 +6016,28 @@ end Creates an external [`MlirPass`](@ref) 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. """ -function mlirCreateExternalPass(passID, name, argument, description, opName, nDependentDialects, dependentDialects, callbacks, userData) - @ccall mlir_c.mlirCreateExternalPass(passID::MlirTypeID, name::MlirStringRef, argument::MlirStringRef, description::MlirStringRef, opName::MlirStringRef, nDependentDialects::intptr_t, dependentDialects::Ptr{MlirDialectHandle}, callbacks::MlirExternalPassCallbacks, userData::Ptr{Cvoid})::MlirPass +function mlirCreateExternalPass( + passID, + name, + argument, + description, + opName, + nDependentDialects, + dependentDialects, + callbacks, + userData, +) + @ccall mlir_c.mlirCreateExternalPass( + passID::MlirTypeID, + name::MlirStringRef, + argument::MlirStringRef, + description::MlirStringRef, + opName::MlirStringRef, + nDependentDialects::intptr_t, + dependentDialects::Ptr{MlirDialectHandle}, + callbacks::MlirExternalPassCallbacks, + userData::Ptr{Cvoid}, + )::MlirPass end """ @@ -6135,7 +6752,9 @@ const MlirDiagnosticHandler = Ptr{Cvoid} Prints a diagnostic using the provided callback. """ function mlirDiagnosticPrint(diagnostic, callback, userData) - @ccall mlir_c.mlirDiagnosticPrint(diagnostic::MlirDiagnostic, callback::MlirStringCallback, userData::Ptr{Cvoid})::Cvoid + @ccall mlir_c.mlirDiagnosticPrint( + diagnostic::MlirDiagnostic, callback::MlirStringCallback, userData::Ptr{Cvoid} + )::Cvoid end """ @@ -6153,7 +6772,9 @@ end Returns the severity of the diagnostic. """ function mlirDiagnosticGetSeverity(diagnostic) - @ccall mlir_c.mlirDiagnosticGetSeverity(diagnostic::MlirDiagnostic)::MlirDiagnosticSeverity + @ccall mlir_c.mlirDiagnosticGetSeverity( + diagnostic::MlirDiagnostic + )::MlirDiagnosticSeverity end """ @@ -6171,7 +6792,9 @@ end Returns `pos`-th note attached to the diagnostic. Expects `pos` to be a valid zero-based index into the list of notes. """ function mlirDiagnosticGetNote(diagnostic, pos) - @ccall mlir_c.mlirDiagnosticGetNote(diagnostic::MlirDiagnostic, pos::intptr_t)::MlirDiagnostic + @ccall mlir_c.mlirDiagnosticGetNote( + diagnostic::MlirDiagnostic, pos::intptr_t + )::MlirDiagnostic end """ @@ -6180,7 +6803,12 @@ end 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. """ function mlirContextAttachDiagnosticHandler(context, handler, userData, deleteUserData) - @ccall mlir_c.mlirContextAttachDiagnosticHandler(context::MlirContext, handler::MlirDiagnosticHandler, userData::Ptr{Cvoid}, deleteUserData::Ptr{Cvoid})::MlirDiagnosticHandlerID + @ccall mlir_c.mlirContextAttachDiagnosticHandler( + context::MlirContext, + handler::MlirDiagnosticHandler, + userData::Ptr{Cvoid}, + deleteUserData::Ptr{Cvoid}, + )::MlirDiagnosticHandlerID end """ @@ -6189,7 +6817,9 @@ end Detaches an attached diagnostic handler from the context given its identifier. """ function mlirContextDetachDiagnosticHandler(context, id) - @ccall mlir_c.mlirContextDetachDiagnosticHandler(context::MlirContext, id::MlirDiagnosticHandlerID)::Cvoid + @ccall mlir_c.mlirContextDetachDiagnosticHandler( + context::MlirContext, id::MlirDiagnosticHandlerID + )::Cvoid end """ @@ -6283,7 +6913,9 @@ end Sets the argument attribute 'name' of an argument at index 'pos'. Asserts that the operation is a FuncOp. """ function mlirFuncSetArgAttr(op, pos, name, attr) - @ccall mlir_c.mlirFuncSetArgAttr(op::MlirOperation, pos::intptr_t, name::MlirStringRef, attr::MlirAttribute)::Cvoid + @ccall mlir_c.mlirFuncSetArgAttr( + op::MlirOperation, pos::intptr_t, name::MlirStringRef, attr::MlirAttribute + )::Cvoid end function mlirGetDialectHandle__gpu__() @@ -6303,11 +6935,26 @@ function mlirAttributeIsAGPUObjectAttr(attr) end function mlirGPUObjectAttrGet(mlirCtx, target, format, objectStrRef, mlirObjectProps) - @ccall mlir_c.mlirGPUObjectAttrGet(mlirCtx::MlirContext, target::MlirAttribute, format::UInt32, objectStrRef::MlirStringRef, mlirObjectProps::MlirAttribute)::MlirAttribute -end - -function mlirGPUObjectAttrGetWithKernels(mlirCtx, target, format, objectStrRef, mlirObjectProps, mlirKernelsAttr) - @ccall mlir_c.mlirGPUObjectAttrGetWithKernels(mlirCtx::MlirContext, target::MlirAttribute, format::UInt32, objectStrRef::MlirStringRef, mlirObjectProps::MlirAttribute, mlirKernelsAttr::MlirAttribute)::MlirAttribute + @ccall mlir_c.mlirGPUObjectAttrGet( + mlirCtx::MlirContext, + target::MlirAttribute, + format::UInt32, + objectStrRef::MlirStringRef, + mlirObjectProps::MlirAttribute, + )::MlirAttribute +end + +function mlirGPUObjectAttrGetWithKernels( + mlirCtx, target, format, objectStrRef, mlirObjectProps, mlirKernelsAttr +) + @ccall mlir_c.mlirGPUObjectAttrGetWithKernels( + mlirCtx::MlirContext, + target::MlirAttribute, + format::UInt32, + objectStrRef::MlirStringRef, + mlirObjectProps::MlirAttribute, + mlirKernelsAttr::MlirAttribute, + )::MlirAttribute end function mlirGPUObjectAttrGetTarget(mlirObjectAttr) @@ -6327,7 +6974,9 @@ function mlirGPUObjectAttrHasProperties(mlirObjectAttr) end function mlirGPUObjectAttrGetProperties(mlirObjectAttr) - @ccall mlir_c.mlirGPUObjectAttrGetProperties(mlirObjectAttr::MlirAttribute)::MlirAttribute + @ccall mlir_c.mlirGPUObjectAttrGetProperties( + mlirObjectAttr::MlirAttribute + )::MlirAttribute end function mlirGPUObjectAttrHasKernels(mlirObjectAttr) @@ -6499,25 +7148,12 @@ end Creates an llvm.func type. """ function mlirLLVMFunctionTypeGet(resultType, nArgumentTypes, argumentTypes, isVarArg) - @ccall mlir_c.mlirLLVMFunctionTypeGet(resultType::MlirType, nArgumentTypes::intptr_t, argumentTypes::Ptr{MlirType}, isVarArg::Bool)::MlirType -end - -""" - mlirLLVMFunctionTypeGetNumInputs(type) - -Returns the number of input types. -""" -function mlirLLVMFunctionTypeGetNumInputs(type) - @ccall mlir_c.mlirLLVMFunctionTypeGetNumInputs(type::MlirType)::intptr_t -end - -""" - mlirLLVMFunctionTypeGetInput(type, pos) - -Returns the pos-th input type. -""" -function mlirLLVMFunctionTypeGetInput(type, pos) - @ccall mlir_c.mlirLLVMFunctionTypeGetInput(type::MlirType, pos::intptr_t)::MlirType + @ccall mlir_c.mlirLLVMFunctionTypeGet( + resultType::MlirType, + nArgumentTypes::intptr_t, + argumentTypes::Ptr{MlirType}, + isVarArg::Bool, + )::MlirType end """ @@ -6553,7 +7189,9 @@ end 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. """ function mlirLLVMStructTypeGetElementType(type, position) - @ccall mlir_c.mlirLLVMStructTypeGetElementType(type::MlirType, position::intptr_t)::MlirType + @ccall mlir_c.mlirLLVMStructTypeGetElementType( + type::MlirType, position::intptr_t + )::MlirType end """ @@ -6589,7 +7227,9 @@ end 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. """ function mlirLLVMStructTypeLiteralGet(ctx, nFieldTypes, fieldTypes, isPacked) - @ccall mlir_c.mlirLLVMStructTypeLiteralGet(ctx::MlirContext, nFieldTypes::intptr_t, fieldTypes::Ptr{MlirType}, isPacked::Bool)::MlirType + @ccall mlir_c.mlirLLVMStructTypeLiteralGet( + ctx::MlirContext, nFieldTypes::intptr_t, fieldTypes::Ptr{MlirType}, isPacked::Bool + )::MlirType end """ @@ -6598,7 +7238,9 @@ end Creates an LLVM literal (unnamed) struct type if possible. Emits a diagnostic at the given location and returns null otherwise. """ function mlirLLVMStructTypeLiteralGetChecked(loc, nFieldTypes, fieldTypes, isPacked) - @ccall mlir_c.mlirLLVMStructTypeLiteralGetChecked(loc::MlirLocation, nFieldTypes::intptr_t, fieldTypes::Ptr{MlirType}, isPacked::Bool)::MlirType + @ccall mlir_c.mlirLLVMStructTypeLiteralGetChecked( + loc::MlirLocation, nFieldTypes::intptr_t, fieldTypes::Ptr{MlirType}, isPacked::Bool + )::MlirType end """ @@ -6607,7 +7249,9 @@ end 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`](@ref) to create a fresh struct type, potentially renaming it. The body should be set separatelty by calling [`mlirLLVMStructTypeSetBody`](@ref), if it isn't set already. """ function mlirLLVMStructTypeIdentifiedGet(ctx, name) - @ccall mlir_c.mlirLLVMStructTypeIdentifiedGet(ctx::MlirContext, name::MlirStringRef)::MlirType + @ccall mlir_c.mlirLLVMStructTypeIdentifiedGet( + ctx::MlirContext, name::MlirStringRef + )::MlirType end """ @@ -6616,11 +7260,19 @@ end 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. """ function mlirLLVMStructTypeIdentifiedNewGet(ctx, name, nFieldTypes, fieldTypes, isPacked) - @ccall mlir_c.mlirLLVMStructTypeIdentifiedNewGet(ctx::MlirContext, name::MlirStringRef, nFieldTypes::intptr_t, fieldTypes::Ptr{MlirType}, isPacked::Bool)::MlirType + @ccall mlir_c.mlirLLVMStructTypeIdentifiedNewGet( + ctx::MlirContext, + name::MlirStringRef, + nFieldTypes::intptr_t, + fieldTypes::Ptr{MlirType}, + isPacked::Bool, + )::MlirType end function mlirLLVMStructTypeOpaqueGet(ctx, name) - @ccall mlir_c.mlirLLVMStructTypeOpaqueGet(ctx::MlirContext, name::MlirStringRef)::MlirType + @ccall mlir_c.mlirLLVMStructTypeOpaqueGet( + ctx::MlirContext, name::MlirStringRef + )::MlirType end """ @@ -6629,7 +7281,12 @@ end Sets the body of the identified struct if it hasn't been set yet. Returns whether the operation was successful. """ function mlirLLVMStructTypeSetBody(structType, nFieldTypes, fieldTypes, isPacked) - @ccall mlir_c.mlirLLVMStructTypeSetBody(structType::MlirType, nFieldTypes::intptr_t, fieldTypes::Ptr{MlirType}, isPacked::Bool)::MlirLogicalResult + @ccall mlir_c.mlirLLVMStructTypeSetBody( + structType::MlirType, + nFieldTypes::intptr_t, + fieldTypes::Ptr{MlirType}, + isPacked::Bool, + )::MlirLogicalResult end @cenum MlirLLVMCConv::UInt32 begin @@ -6688,7 +7345,9 @@ end Creates a LLVM CConv attribute. """ function mlirLLVMCConvAttrGet(ctx, cconv) - @ccall mlir_c.mlirLLVMCConvAttrGet(ctx::MlirContext, cconv::MlirLLVMCConv)::MlirAttribute + @ccall mlir_c.mlirLLVMCConvAttrGet( + ctx::MlirContext, cconv::MlirLLVMCConv + )::MlirAttribute end @cenum MlirLLVMComdat::UInt32 begin @@ -6705,7 +7364,9 @@ end Creates a LLVM Comdat attribute. """ function mlirLLVMComdatAttrGet(ctx, comdat) - @ccall mlir_c.mlirLLVMComdatAttrGet(ctx::MlirContext, comdat::MlirLLVMComdat)::MlirAttribute + @ccall mlir_c.mlirLLVMComdatAttrGet( + ctx::MlirContext, comdat::MlirLLVMComdat + )::MlirAttribute end @cenum MlirLLVMLinkage::UInt32 begin @@ -6728,7 +7389,9 @@ end Creates a LLVM Linkage attribute. """ function mlirLLVMLinkageAttrGet(ctx, linkage) - @ccall mlir_c.mlirLLVMLinkageAttrGet(ctx::MlirContext, linkage::MlirLLVMLinkage)::MlirAttribute + @ccall mlir_c.mlirLLVMLinkageAttrGet( + ctx::MlirContext, linkage::MlirLLVMLinkage + )::MlirAttribute end """ @@ -6746,7 +7409,9 @@ end Creates a LLVM DIExpressionElem attribute. """ function mlirLLVMDIExpressionElemAttrGet(ctx, opcode, nArguments, arguments) - @ccall mlir_c.mlirLLVMDIExpressionElemAttrGet(ctx::MlirContext, opcode::Cuint, nArguments::intptr_t, arguments::Ptr{UInt64})::MlirAttribute + @ccall mlir_c.mlirLLVMDIExpressionElemAttrGet( + ctx::MlirContext, opcode::Cuint, nArguments::intptr_t, arguments::Ptr{UInt64} + )::MlirAttribute end """ @@ -6755,7 +7420,9 @@ end Creates a LLVM DIExpression attribute. """ function mlirLLVMDIExpressionAttrGet(ctx, nOperations, operations) - @ccall mlir_c.mlirLLVMDIExpressionAttrGet(ctx::MlirContext, nOperations::intptr_t, operations::Ptr{MlirAttribute})::MlirAttribute + @ccall mlir_c.mlirLLVMDIExpressionAttrGet( + ctx::MlirContext, nOperations::intptr_t, operations::Ptr{MlirAttribute} + )::MlirAttribute end @cenum MlirLLVMTypeEncoding::UInt32 begin @@ -6787,7 +7454,13 @@ end Creates a LLVM DIBasicType attribute. """ function mlirLLVMDIBasicTypeAttrGet(ctx, tag, name, sizeInBits, encoding) - @ccall mlir_c.mlirLLVMDIBasicTypeAttrGet(ctx::MlirContext, tag::Cuint, name::MlirAttribute, sizeInBits::UInt64, encoding::MlirLLVMTypeEncoding)::MlirAttribute + @ccall mlir_c.mlirLLVMDIBasicTypeAttrGet( + ctx::MlirContext, + tag::Cuint, + name::MlirAttribute, + sizeInBits::UInt64, + encoding::MlirLLVMTypeEncoding, + )::MlirAttribute end """ @@ -6804,8 +7477,46 @@ end Creates a LLVM DICompositeType attribute. """ -function mlirLLVMDICompositeTypeAttrGet(ctx, recId, isRecSelf, tag, name, file, line, scope, baseType, flags, sizeInBits, alignInBits, nElements, elements, dataLocation, rank, allocated, associated) - @ccall mlir_c.mlirLLVMDICompositeTypeAttrGet(ctx::MlirContext, recId::MlirAttribute, isRecSelf::Bool, tag::Cuint, name::MlirAttribute, file::MlirAttribute, line::UInt32, scope::MlirAttribute, baseType::MlirAttribute, flags::Int64, sizeInBits::UInt64, alignInBits::UInt64, nElements::intptr_t, elements::Ptr{MlirAttribute}, dataLocation::MlirAttribute, rank::MlirAttribute, allocated::MlirAttribute, associated::MlirAttribute)::MlirAttribute +function mlirLLVMDICompositeTypeAttrGet( + ctx, + recId, + isRecSelf, + tag, + name, + file, + line, + scope, + baseType, + flags, + sizeInBits, + alignInBits, + nElements, + elements, + dataLocation, + rank, + allocated, + associated, +) + @ccall mlir_c.mlirLLVMDICompositeTypeAttrGet( + ctx::MlirContext, + recId::MlirAttribute, + isRecSelf::Bool, + tag::Cuint, + name::MlirAttribute, + file::MlirAttribute, + line::UInt32, + scope::MlirAttribute, + baseType::MlirAttribute, + flags::Int64, + sizeInBits::UInt64, + alignInBits::UInt64, + nElements::intptr_t, + elements::Ptr{MlirAttribute}, + dataLocation::MlirAttribute, + rank::MlirAttribute, + allocated::MlirAttribute, + associated::MlirAttribute, + )::MlirAttribute end """ @@ -6813,12 +7524,52 @@ end Creates a LLVM DIDerivedType attribute. Note that `dwarfAddressSpace` is an optional field, where [`MLIR_CAPI_DWARF_ADDRESS_SPACE_NULL`](@ref) indicates null and non-negative values indicate a value present. """ -function mlirLLVMDIDerivedTypeAttrGet(ctx, tag, name, baseType, sizeInBits, alignInBits, offsetInBits, dwarfAddressSpace, extraData) - @ccall mlir_c.mlirLLVMDIDerivedTypeAttrGet(ctx::MlirContext, tag::Cuint, name::MlirAttribute, baseType::MlirAttribute, sizeInBits::UInt64, alignInBits::UInt32, offsetInBits::UInt64, dwarfAddressSpace::Int64, extraData::MlirAttribute)::MlirAttribute -end - -function mlirLLVMDIStringTypeAttrGet(ctx, tag, name, sizeInBits, alignInBits, stringLength, stringLengthExp, stringLocationExp, encoding) - @ccall mlir_c.mlirLLVMDIStringTypeAttrGet(ctx::MlirContext, tag::Cuint, name::MlirAttribute, sizeInBits::UInt64, alignInBits::UInt32, stringLength::MlirAttribute, stringLengthExp::MlirAttribute, stringLocationExp::MlirAttribute, encoding::MlirLLVMTypeEncoding)::MlirAttribute +function mlirLLVMDIDerivedTypeAttrGet( + ctx, + tag, + name, + baseType, + sizeInBits, + alignInBits, + offsetInBits, + dwarfAddressSpace, + extraData, +) + @ccall mlir_c.mlirLLVMDIDerivedTypeAttrGet( + ctx::MlirContext, + tag::Cuint, + name::MlirAttribute, + baseType::MlirAttribute, + sizeInBits::UInt64, + alignInBits::UInt32, + offsetInBits::UInt64, + dwarfAddressSpace::Int64, + extraData::MlirAttribute, + )::MlirAttribute +end + +function mlirLLVMDIStringTypeAttrGet( + ctx, + tag, + name, + sizeInBits, + alignInBits, + stringLength, + stringLengthExp, + stringLocationExp, + encoding, +) + @ccall mlir_c.mlirLLVMDIStringTypeAttrGet( + ctx::MlirContext, + tag::Cuint, + name::MlirAttribute, + sizeInBits::UInt64, + alignInBits::UInt32, + stringLength::MlirAttribute, + stringLengthExp::MlirAttribute, + stringLocationExp::MlirAttribute, + encoding::MlirLLVMTypeEncoding, + )::MlirAttribute end """ @@ -6827,7 +7578,9 @@ end Gets the base type from a LLVM DIDerivedType attribute. """ function mlirLLVMDIDerivedTypeAttrGetBaseType(diDerivedType) - @ccall mlir_c.mlirLLVMDIDerivedTypeAttrGetBaseType(diDerivedType::MlirAttribute)::MlirAttribute + @ccall mlir_c.mlirLLVMDIDerivedTypeAttrGetBaseType( + diDerivedType::MlirAttribute + )::MlirAttribute end """ @@ -6836,7 +7589,9 @@ end Creates a LLVM DIFileAttr attribute. """ function mlirLLVMDIFileAttrGet(ctx, name, directory) - @ccall mlir_c.mlirLLVMDIFileAttrGet(ctx::MlirContext, name::MlirAttribute, directory::MlirAttribute)::MlirAttribute + @ccall mlir_c.mlirLLVMDIFileAttrGet( + ctx::MlirContext, name::MlirAttribute, directory::MlirAttribute + )::MlirAttribute end @cenum MlirLLVMDIEmissionKind::UInt32 begin @@ -6858,8 +7613,19 @@ end Creates a LLVM DICompileUnit attribute. """ -function mlirLLVMDICompileUnitAttrGet(ctx, id, sourceLanguage, file, producer, isOptimized, emissionKind, nameTableKind) - @ccall mlir_c.mlirLLVMDICompileUnitAttrGet(ctx::MlirContext, id::MlirAttribute, sourceLanguage::Cuint, file::MlirAttribute, producer::MlirAttribute, isOptimized::Bool, emissionKind::MlirLLVMDIEmissionKind, nameTableKind::MlirLLVMDINameTableKind)::MlirAttribute +function mlirLLVMDICompileUnitAttrGet( + ctx, id, sourceLanguage, file, producer, isOptimized, emissionKind, nameTableKind +) + @ccall mlir_c.mlirLLVMDICompileUnitAttrGet( + ctx::MlirContext, + id::MlirAttribute, + sourceLanguage::Cuint, + file::MlirAttribute, + producer::MlirAttribute, + isOptimized::Bool, + emissionKind::MlirLLVMDIEmissionKind, + nameTableKind::MlirLLVMDINameTableKind, + )::MlirAttribute end """ @@ -6877,7 +7643,13 @@ end Creates a LLVM DILexicalBlock attribute. """ function mlirLLVMDILexicalBlockAttrGet(ctx, scope, file, line, column) - @ccall mlir_c.mlirLLVMDILexicalBlockAttrGet(ctx::MlirContext, scope::MlirAttribute, file::MlirAttribute, line::Cuint, column::Cuint)::MlirAttribute + @ccall mlir_c.mlirLLVMDILexicalBlockAttrGet( + ctx::MlirContext, + scope::MlirAttribute, + file::MlirAttribute, + line::Cuint, + column::Cuint, + )::MlirAttribute end """ @@ -6886,7 +7658,9 @@ end Creates a LLVM DILexicalBlockFile attribute. """ function mlirLLVMDILexicalBlockFileAttrGet(ctx, scope, file, discriminator) - @ccall mlir_c.mlirLLVMDILexicalBlockFileAttrGet(ctx::MlirContext, scope::MlirAttribute, file::MlirAttribute, discriminator::Cuint)::MlirAttribute + @ccall mlir_c.mlirLLVMDILexicalBlockFileAttrGet( + ctx::MlirContext, scope::MlirAttribute, file::MlirAttribute, discriminator::Cuint + )::MlirAttribute end """ @@ -6894,8 +7668,20 @@ end Creates a LLVM DILocalVariableAttr attribute. """ -function mlirLLVMDILocalVariableAttrGet(ctx, scope, name, diFile, line, arg, alignInBits, diType, flags) - @ccall mlir_c.mlirLLVMDILocalVariableAttrGet(ctx::MlirContext, scope::MlirAttribute, name::MlirAttribute, diFile::MlirAttribute, line::Cuint, arg::Cuint, alignInBits::Cuint, diType::MlirAttribute, flags::Int64)::MlirAttribute +function mlirLLVMDILocalVariableAttrGet( + ctx, scope, name, diFile, line, arg, alignInBits, diType, flags +) + @ccall mlir_c.mlirLLVMDILocalVariableAttrGet( + ctx::MlirContext, + scope::MlirAttribute, + name::MlirAttribute, + diFile::MlirAttribute, + line::Cuint, + arg::Cuint, + alignInBits::Cuint, + diType::MlirAttribute, + flags::Int64, + )::MlirAttribute end """ @@ -6912,8 +7698,44 @@ end Creates a LLVM DISubprogramAttr attribute. """ -function mlirLLVMDISubprogramAttrGet(ctx, recId, isRecSelf, id, compileUnit, scope, name, linkageName, file, line, scopeLine, subprogramFlags, type, nRetainedNodes, retainedNodes, nAnnotations, annotations) - @ccall mlir_c.mlirLLVMDISubprogramAttrGet(ctx::MlirContext, recId::MlirAttribute, isRecSelf::Bool, id::MlirAttribute, compileUnit::MlirAttribute, scope::MlirAttribute, name::MlirAttribute, linkageName::MlirAttribute, file::MlirAttribute, line::Cuint, scopeLine::Cuint, subprogramFlags::UInt64, type::MlirAttribute, nRetainedNodes::intptr_t, retainedNodes::Ptr{MlirAttribute}, nAnnotations::intptr_t, annotations::Ptr{MlirAttribute})::MlirAttribute +function mlirLLVMDISubprogramAttrGet( + ctx, + recId, + isRecSelf, + id, + compileUnit, + scope, + name, + linkageName, + file, + line, + scopeLine, + subprogramFlags, + type, + nRetainedNodes, + retainedNodes, + nAnnotations, + annotations, +) + @ccall mlir_c.mlirLLVMDISubprogramAttrGet( + ctx::MlirContext, + recId::MlirAttribute, + isRecSelf::Bool, + id::MlirAttribute, + compileUnit::MlirAttribute, + scope::MlirAttribute, + name::MlirAttribute, + linkageName::MlirAttribute, + file::MlirAttribute, + line::Cuint, + scopeLine::Cuint, + subprogramFlags::UInt64, + type::MlirAttribute, + nRetainedNodes::intptr_t, + retainedNodes::Ptr{MlirAttribute}, + nAnnotations::intptr_t, + annotations::Ptr{MlirAttribute}, + )::MlirAttribute end """ @@ -6922,7 +7744,9 @@ end Creates a LLVM DIAnnotation attribute. """ function mlirLLVMDIAnnotationAttrGet(ctx, name, value) - @ccall mlir_c.mlirLLVMDIAnnotationAttrGet(ctx::MlirContext, name::MlirAttribute, value::MlirAttribute)::MlirAttribute + @ccall mlir_c.mlirLLVMDIAnnotationAttrGet( + ctx::MlirContext, name::MlirAttribute, value::MlirAttribute + )::MlirAttribute end """ @@ -6931,7 +7755,9 @@ end Gets the scope from this DISubprogramAttr. """ function mlirLLVMDISubprogramAttrGetScope(diSubprogram) - @ccall mlir_c.mlirLLVMDISubprogramAttrGetScope(diSubprogram::MlirAttribute)::MlirAttribute + @ccall mlir_c.mlirLLVMDISubprogramAttrGetScope( + diSubprogram::MlirAttribute + )::MlirAttribute end """ @@ -6958,7 +7784,9 @@ end Gets the compile unit from this DISubprogram. """ function mlirLLVMDISubprogramAttrGetCompileUnit(diSubprogram) - @ccall mlir_c.mlirLLVMDISubprogramAttrGetCompileUnit(diSubprogram::MlirAttribute)::MlirAttribute + @ccall mlir_c.mlirLLVMDISubprogramAttrGetCompileUnit( + diSubprogram::MlirAttribute + )::MlirAttribute end """ @@ -6967,7 +7795,9 @@ end Gets the file from this DISubprogramAttr. """ function mlirLLVMDISubprogramAttrGetFile(diSubprogram) - @ccall mlir_c.mlirLLVMDISubprogramAttrGetFile(diSubprogram::MlirAttribute)::MlirAttribute + @ccall mlir_c.mlirLLVMDISubprogramAttrGetFile( + diSubprogram::MlirAttribute + )::MlirAttribute end """ @@ -6976,7 +7806,9 @@ end Gets the type from this DISubprogramAttr. """ function mlirLLVMDISubprogramAttrGetType(diSubprogram) - @ccall mlir_c.mlirLLVMDISubprogramAttrGetType(diSubprogram::MlirAttribute)::MlirAttribute + @ccall mlir_c.mlirLLVMDISubprogramAttrGetType( + diSubprogram::MlirAttribute + )::MlirAttribute end """ @@ -6985,7 +7817,12 @@ end Creates a LLVM DISubroutineTypeAttr attribute. """ function mlirLLVMDISubroutineTypeAttrGet(ctx, callingConvention, nTypes, types) - @ccall mlir_c.mlirLLVMDISubroutineTypeAttrGet(ctx::MlirContext, callingConvention::Cuint, nTypes::intptr_t, types::Ptr{MlirAttribute})::MlirAttribute + @ccall mlir_c.mlirLLVMDISubroutineTypeAttrGet( + ctx::MlirContext, + callingConvention::Cuint, + nTypes::intptr_t, + types::Ptr{MlirAttribute}, + )::MlirAttribute end """ @@ -6993,8 +7830,20 @@ end Creates a LLVM DIModuleAttr attribute. """ -function mlirLLVMDIModuleAttrGet(ctx, file, scope, name, configMacros, includePath, apinotes, line, isDecl) - @ccall mlir_c.mlirLLVMDIModuleAttrGet(ctx::MlirContext, file::MlirAttribute, scope::MlirAttribute, name::MlirAttribute, configMacros::MlirAttribute, includePath::MlirAttribute, apinotes::MlirAttribute, line::Cuint, isDecl::Bool)::MlirAttribute +function mlirLLVMDIModuleAttrGet( + ctx, file, scope, name, configMacros, includePath, apinotes, line, isDecl +) + @ccall mlir_c.mlirLLVMDIModuleAttrGet( + ctx::MlirContext, + file::MlirAttribute, + scope::MlirAttribute, + name::MlirAttribute, + configMacros::MlirAttribute, + includePath::MlirAttribute, + apinotes::MlirAttribute, + line::Cuint, + isDecl::Bool, + )::MlirAttribute end """ @@ -7002,8 +7851,20 @@ end Creates a LLVM DIImportedEntityAttr attribute. """ -function mlirLLVMDIImportedEntityAttrGet(ctx, tag, scope, entity, file, line, name, nElements, elements) - @ccall mlir_c.mlirLLVMDIImportedEntityAttrGet(ctx::MlirContext, tag::Cuint, scope::MlirAttribute, entity::MlirAttribute, file::MlirAttribute, line::Cuint, name::MlirAttribute, nElements::intptr_t, elements::Ptr{MlirAttribute})::MlirAttribute +function mlirLLVMDIImportedEntityAttrGet( + ctx, tag, scope, entity, file, line, name, nElements, elements +) + @ccall mlir_c.mlirLLVMDIImportedEntityAttrGet( + ctx::MlirContext, + tag::Cuint, + scope::MlirAttribute, + entity::MlirAttribute, + file::MlirAttribute, + line::Cuint, + name::MlirAttribute, + nElements::intptr_t, + elements::Ptr{MlirAttribute}, + )::MlirAttribute end """ @@ -7148,8 +8009,17 @@ function mlirTypeIsANVGPUTensorMapDescriptorType(type) @ccall mlir_c.mlirTypeIsANVGPUTensorMapDescriptorType(type::MlirType)::Bool end -function mlirNVGPUTensorMapDescriptorTypeGet(ctx, tensorMemrefType, swizzle, l2promo, oobFill, interleave) - @ccall mlir_c.mlirNVGPUTensorMapDescriptorTypeGet(ctx::MlirContext, tensorMemrefType::MlirType, swizzle::Cint, l2promo::Cint, oobFill::Cint, interleave::Cint)::MlirType +function mlirNVGPUTensorMapDescriptorTypeGet( + ctx, tensorMemrefType, swizzle, l2promo, oobFill, interleave +) + @ccall mlir_c.mlirNVGPUTensorMapDescriptorTypeGet( + ctx::MlirContext, + tensorMemrefType::MlirType, + swizzle::Cint, + l2promo::Cint, + oobFill::Cint, + interleave::Cint, + )::MlirType end function mlirGetDialectHandle__nvvm__() @@ -7240,7 +8110,9 @@ end Returns the minimum possible value stored by a quantized type. """ function mlirQuantizedTypeGetDefaultMinimumForInteger(isSigned, integralWidth) - @ccall mlir_c.mlirQuantizedTypeGetDefaultMinimumForInteger(isSigned::Bool, integralWidth::Cuint)::Int64 + @ccall mlir_c.mlirQuantizedTypeGetDefaultMinimumForInteger( + isSigned::Bool, integralWidth::Cuint + )::Int64 end """ @@ -7249,7 +8121,9 @@ end Returns the maximum possible value stored by a quantized type. """ function mlirQuantizedTypeGetDefaultMaximumForInteger(isSigned, integralWidth) - @ccall mlir_c.mlirQuantizedTypeGetDefaultMaximumForInteger(isSigned::Bool, integralWidth::Cuint)::Int64 + @ccall mlir_c.mlirQuantizedTypeGetDefaultMaximumForInteger( + isSigned::Bool, integralWidth::Cuint + )::Int64 end """ @@ -7321,7 +8195,9 @@ end Returns `true` if the `candidate` type is compatible with the given quantized `type`. """ function mlirQuantizedTypeIsCompatibleExpressedType(type, candidate) - @ccall mlir_c.mlirQuantizedTypeIsCompatibleExpressedType(type::MlirType, candidate::MlirType)::Bool + @ccall mlir_c.mlirQuantizedTypeIsCompatibleExpressedType( + type::MlirType, candidate::MlirType + )::Bool end """ @@ -7339,7 +8215,9 @@ end 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. """ function mlirQuantizedTypeCastFromStorageType(type, candidate) - @ccall mlir_c.mlirQuantizedTypeCastFromStorageType(type::MlirType, candidate::MlirType)::MlirType + @ccall mlir_c.mlirQuantizedTypeCastFromStorageType( + type::MlirType, candidate::MlirType + )::MlirType end """ @@ -7357,7 +8235,9 @@ end 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. """ function mlirQuantizedTypeCastFromExpressedType(type, candidate) - @ccall mlir_c.mlirQuantizedTypeCastFromExpressedType(type::MlirType, candidate::MlirType)::MlirType + @ccall mlir_c.mlirQuantizedTypeCastFromExpressedType( + type::MlirType, candidate::MlirType + )::MlirType end """ @@ -7375,7 +8255,9 @@ end 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. """ function mlirQuantizedTypeCastExpressedToStorageType(type, candidate) - @ccall mlir_c.mlirQuantizedTypeCastExpressedToStorageType(type::MlirType, candidate::MlirType)::MlirType + @ccall mlir_c.mlirQuantizedTypeCastExpressedToStorageType( + type::MlirType, candidate::MlirType + )::MlirType end """ @@ -7392,8 +8274,16 @@ end 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. """ -function mlirAnyQuantizedTypeGet(flags, storageType, expressedType, storageTypeMin, storageTypeMax) - @ccall mlir_c.mlirAnyQuantizedTypeGet(flags::Cuint, storageType::MlirType, expressedType::MlirType, storageTypeMin::Int64, storageTypeMax::Int64)::MlirType +function mlirAnyQuantizedTypeGet( + flags, storageType, expressedType, storageTypeMin, storageTypeMax +) + @ccall mlir_c.mlirAnyQuantizedTypeGet( + flags::Cuint, + storageType::MlirType, + expressedType::MlirType, + storageTypeMin::Int64, + storageTypeMax::Int64, + )::MlirType end """ @@ -7410,8 +8300,18 @@ end 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. """ -function mlirUniformQuantizedTypeGet(flags, storageType, expressedType, scale, zeroPoint, storageTypeMin, storageTypeMax) - @ccall mlir_c.mlirUniformQuantizedTypeGet(flags::Cuint, storageType::MlirType, expressedType::MlirType, scale::Cdouble, zeroPoint::Int64, storageTypeMin::Int64, storageTypeMax::Int64)::MlirType +function mlirUniformQuantizedTypeGet( + flags, storageType, expressedType, scale, zeroPoint, storageTypeMin, storageTypeMax +) + @ccall mlir_c.mlirUniformQuantizedTypeGet( + flags::Cuint, + storageType::MlirType, + expressedType::MlirType, + scale::Cdouble, + zeroPoint::Int64, + storageTypeMin::Int64, + storageTypeMax::Int64, + )::MlirType end """ @@ -7455,8 +8355,28 @@ end 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. """ -function mlirUniformQuantizedPerAxisTypeGet(flags, storageType, expressedType, nDims, scales, zeroPoints, quantizedDimension, storageTypeMin, storageTypeMax) - @ccall mlir_c.mlirUniformQuantizedPerAxisTypeGet(flags::Cuint, storageType::MlirType, expressedType::MlirType, nDims::intptr_t, scales::Ptr{Cdouble}, zeroPoints::Ptr{Int64}, quantizedDimension::Int32, storageTypeMin::Int64, storageTypeMax::Int64)::MlirType +function mlirUniformQuantizedPerAxisTypeGet( + flags, + storageType, + expressedType, + nDims, + scales, + zeroPoints, + quantizedDimension, + storageTypeMin, + storageTypeMax, +) + @ccall mlir_c.mlirUniformQuantizedPerAxisTypeGet( + flags::Cuint, + storageType::MlirType, + expressedType::MlirType, + nDims::intptr_t, + scales::Ptr{Cdouble}, + zeroPoints::Ptr{Int64}, + quantizedDimension::Int32, + storageTypeMin::Int64, + storageTypeMax::Int64, + )::MlirType end """ @@ -7474,7 +8394,9 @@ end Returns `pos`-th scale of the given quantized per-axis type. """ function mlirUniformQuantizedPerAxisTypeGetScale(type, pos) - @ccall mlir_c.mlirUniformQuantizedPerAxisTypeGetScale(type::MlirType, pos::intptr_t)::Cdouble + @ccall mlir_c.mlirUniformQuantizedPerAxisTypeGetScale( + type::MlirType, pos::intptr_t + )::Cdouble end """ @@ -7483,7 +8405,9 @@ end Returns `pos`-th zero point of the given quantized per-axis type. """ function mlirUniformQuantizedPerAxisTypeGetZeroPoint(type, pos) - @ccall mlir_c.mlirUniformQuantizedPerAxisTypeGetZeroPoint(type::MlirType, pos::intptr_t)::Int64 + @ccall mlir_c.mlirUniformQuantizedPerAxisTypeGetZeroPoint( + type::MlirType, pos::intptr_t + )::Int64 end """ @@ -7492,7 +8416,9 @@ end Returns the index of the quantized dimension in the given quantized per-axis type. """ function mlirUniformQuantizedPerAxisTypeGetQuantizedDimension(type) - @ccall mlir_c.mlirUniformQuantizedPerAxisTypeGetQuantizedDimension(type::MlirType)::Int32 + @ccall mlir_c.mlirUniformQuantizedPerAxisTypeGetQuantizedDimension( + type::MlirType + )::Int32 end """ @@ -7519,7 +8445,9 @@ end 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. """ function mlirCalibratedQuantizedTypeGet(expressedType, min, max) - @ccall mlir_c.mlirCalibratedQuantizedTypeGet(expressedType::MlirType, min::Cdouble, max::Cdouble)::MlirType + @ccall mlir_c.mlirCalibratedQuantizedTypeGet( + expressedType::MlirType, min::Cdouble, max::Cdouble + )::MlirType end """ @@ -7596,8 +8524,20 @@ end Creates a `sparse\\_tensor.encoding` attribute with the given parameters. """ -function mlirSparseTensorEncodingAttrGet(ctx, lvlRank, lvlTypes, dimToLvl, lvlTodim, posWidth, crdWidth, explicitVal, implicitVal) - @ccall mlir_c.mlirSparseTensorEncodingAttrGet(ctx::MlirContext, lvlRank::intptr_t, lvlTypes::Ptr{MlirSparseTensorLevelType}, dimToLvl::MlirAffineMap, lvlTodim::MlirAffineMap, posWidth::Cint, crdWidth::Cint, explicitVal::MlirAttribute, implicitVal::MlirAttribute)::MlirAttribute +function mlirSparseTensorEncodingAttrGet( + ctx, lvlRank, lvlTypes, dimToLvl, lvlTodim, posWidth, crdWidth, explicitVal, implicitVal +) + @ccall mlir_c.mlirSparseTensorEncodingAttrGet( + ctx::MlirContext, + lvlRank::intptr_t, + lvlTypes::Ptr{MlirSparseTensorLevelType}, + dimToLvl::MlirAffineMap, + lvlTodim::MlirAffineMap, + posWidth::Cint, + crdWidth::Cint, + explicitVal::MlirAttribute, + implicitVal::MlirAttribute, + )::MlirAttribute end """ @@ -7615,7 +8555,9 @@ end Returns a specified level-type of the `sparse\\_tensor.encoding` attribute. """ function mlirSparseTensorEncodingAttrGetLvlType(attr, lvl) - @ccall mlir_c.mlirSparseTensorEncodingAttrGetLvlType(attr::MlirAttribute, lvl::intptr_t)::MlirSparseTensorLevelType + @ccall mlir_c.mlirSparseTensorEncodingAttrGetLvlType( + attr::MlirAttribute, lvl::intptr_t + )::MlirSparseTensorLevelType end """ @@ -7624,7 +8566,9 @@ end Returns a specified level-format of the `sparse\\_tensor.encoding` attribute. """ function mlirSparseTensorEncodingAttrGetLvlFmt(attr, lvl) - @ccall mlir_c.mlirSparseTensorEncodingAttrGetLvlFmt(attr::MlirAttribute, lvl::intptr_t)::MlirSparseTensorLevelFormat + @ccall mlir_c.mlirSparseTensorEncodingAttrGetLvlFmt( + attr::MlirAttribute, lvl::intptr_t + )::MlirSparseTensorLevelFormat end """ @@ -7633,7 +8577,9 @@ end Returns the dimension-to-level mapping of the `sparse\\_tensor.encoding` attribute. """ function mlirSparseTensorEncodingAttrGetDimToLvl(attr) - @ccall mlir_c.mlirSparseTensorEncodingAttrGetDimToLvl(attr::MlirAttribute)::MlirAffineMap + @ccall mlir_c.mlirSparseTensorEncodingAttrGetDimToLvl( + attr::MlirAttribute + )::MlirAffineMap end """ @@ -7642,7 +8588,9 @@ end Returns the level-to-dimension mapping of the `sparse\\_tensor.encoding` attribute. """ function mlirSparseTensorEncodingAttrGetLvlToDim(attr) - @ccall mlir_c.mlirSparseTensorEncodingAttrGetLvlToDim(attr::MlirAttribute)::MlirAffineMap + @ccall mlir_c.mlirSparseTensorEncodingAttrGetLvlToDim( + attr::MlirAttribute + )::MlirAffineMap end """ @@ -7669,7 +8617,9 @@ end Returns the explicit value of the `sparse\\_tensor.encoding` attribute. """ function mlirSparseTensorEncodingAttrGetExplicitVal(attr) - @ccall mlir_c.mlirSparseTensorEncodingAttrGetExplicitVal(attr::MlirAttribute)::MlirAttribute + @ccall mlir_c.mlirSparseTensorEncodingAttrGetExplicitVal( + attr::MlirAttribute + )::MlirAttribute end """ @@ -7678,19 +8628,31 @@ end Returns the implicit value of the `sparse\\_tensor.encoding` attribute. """ function mlirSparseTensorEncodingAttrGetImplicitVal(attr) - @ccall mlir_c.mlirSparseTensorEncodingAttrGetImplicitVal(attr::MlirAttribute)::MlirAttribute + @ccall mlir_c.mlirSparseTensorEncodingAttrGetImplicitVal( + attr::MlirAttribute + )::MlirAttribute end function mlirSparseTensorEncodingAttrGetStructuredN(lvlType) - @ccall mlir_c.mlirSparseTensorEncodingAttrGetStructuredN(lvlType::MlirSparseTensorLevelType)::Cuint + @ccall mlir_c.mlirSparseTensorEncodingAttrGetStructuredN( + lvlType::MlirSparseTensorLevelType + )::Cuint end function mlirSparseTensorEncodingAttrGetStructuredM(lvlType) - @ccall mlir_c.mlirSparseTensorEncodingAttrGetStructuredM(lvlType::MlirSparseTensorLevelType)::Cuint + @ccall mlir_c.mlirSparseTensorEncodingAttrGetStructuredM( + lvlType::MlirSparseTensorLevelType + )::Cuint end function mlirSparseTensorEncodingAttrBuildLvlType(lvlFmt, properties, propSize, n, m) - @ccall mlir_c.mlirSparseTensorEncodingAttrBuildLvlType(lvlFmt::MlirSparseTensorLevelFormat, properties::Ptr{MlirSparseTensorLevelPropertyNondefault}, propSize::Cuint, n::Cuint, m::Cuint)::MlirSparseTensorLevelType + @ccall mlir_c.mlirSparseTensorEncodingAttrBuildLvlType( + lvlFmt::MlirSparseTensorLevelFormat, + properties::Ptr{MlirSparseTensorLevelPropertyNondefault}, + propSize::Cuint, + n::Cuint, + m::Cuint, + )::MlirSparseTensorLevelType end function mlirRegisterSparseTensorPasses() @@ -7878,7 +8840,9 @@ function mlirTransformOperationTypeGetTypeID() end function mlirTransformOperationTypeGet(ctx, operationName) - @ccall mlir_c.mlirTransformOperationTypeGet(ctx::MlirContext, operationName::MlirStringRef)::MlirType + @ccall mlir_c.mlirTransformOperationTypeGet( + ctx::MlirContext, operationName::MlirStringRef + )::MlirType end function mlirTransformOperationTypeGetOperationName(type) @@ -7920,7 +8884,9 @@ end Enables or disables expensive checks in transform options. """ function mlirTransformOptionsEnableExpensiveChecks(transformOptions, enable) - @ccall mlir_c.mlirTransformOptionsEnableExpensiveChecks(transformOptions::MlirTransformOptions, enable::Bool)::Cvoid + @ccall mlir_c.mlirTransformOptionsEnableExpensiveChecks( + transformOptions::MlirTransformOptions, enable::Bool + )::Cvoid end """ @@ -7929,7 +8895,9 @@ end Returns true if expensive checks are enabled in transform options. """ function mlirTransformOptionsGetExpensiveChecksEnabled(transformOptions) - @ccall mlir_c.mlirTransformOptionsGetExpensiveChecksEnabled(transformOptions::MlirTransformOptions)::Bool + @ccall mlir_c.mlirTransformOptionsGetExpensiveChecksEnabled( + transformOptions::MlirTransformOptions + )::Bool end """ @@ -7938,7 +8906,9 @@ end Enables or disables the enforcement of the top-level transform op being single in transform options. """ function mlirTransformOptionsEnforceSingleTopLevelTransformOp(transformOptions, enable) - @ccall mlir_c.mlirTransformOptionsEnforceSingleTopLevelTransformOp(transformOptions::MlirTransformOptions, enable::Bool)::Cvoid + @ccall mlir_c.mlirTransformOptionsEnforceSingleTopLevelTransformOp( + transformOptions::MlirTransformOptions, enable::Bool + )::Cvoid end """ @@ -7947,7 +8917,9 @@ end Returns true if the enforcement of the top-level transform op being single is enabled in transform options. """ function mlirTransformOptionsGetEnforceSingleTopLevelTransformOp(transformOptions) - @ccall mlir_c.mlirTransformOptionsGetEnforceSingleTopLevelTransformOp(transformOptions::MlirTransformOptions)::Bool + @ccall mlir_c.mlirTransformOptionsGetEnforceSingleTopLevelTransformOp( + transformOptions::MlirTransformOptions + )::Bool end """ @@ -7964,8 +8936,15 @@ end 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. """ -function mlirTransformApplyNamedSequence(payload, transformRoot, transformModule, transformOptions) - @ccall mlir_c.mlirTransformApplyNamedSequence(payload::MlirOperation, transformRoot::MlirOperation, transformModule::MlirOperation, transformOptions::MlirTransformOptions)::MlirLogicalResult +function mlirTransformApplyNamedSequence( + payload, transformRoot, transformModule, transformOptions +) + @ccall mlir_c.mlirTransformApplyNamedSequence( + payload::MlirOperation, + transformRoot::MlirOperation, + transformModule::MlirOperation, + transformOptions::MlirTransformOptions, + )::MlirLogicalResult end """ @@ -7976,7 +8955,9 @@ Merge the symbols from `other` into `target`, potentially renaming them to avoid Note that this clones the `other` operation unlike the C++ counterpart that takes ownership. """ function mlirMergeSymbolsIntoFromClone(target, other) - @ccall mlir_c.mlirMergeSymbolsIntoFromClone(target::MlirOperation, other::MlirOperation)::MlirLogicalResult + @ccall mlir_c.mlirMergeSymbolsIntoFromClone( + target::MlirOperation, other::MlirOperation + )::MlirLogicalResult end function mlirGetDialectHandle__vector__() @@ -7993,7 +8974,13 @@ end Creates an ExecutionEngine for the provided ModuleOp. The ModuleOp is expected to be "translatable" to LLVM IR (only contains operations in dialects that implement the `LLVMTranslationDialectInterface`). The module ownership stays with the client and can be destroyed as soon as the call returns. `optLevel` is the optimization level to be used for transformation and code generation. LLVM passes at `optLevel` are run before code generation. The number and array of paths corresponding to shared libraries that will be loaded are specified via `numPaths` and `sharedLibPaths` respectively. TODO: figure out other options. """ function mlirExecutionEngineCreate(op, optLevel, numPaths, sharedLibPaths, enableObjectDump) - @ccall mlir_c.mlirExecutionEngineCreate(op::MlirModule, optLevel::Cint, numPaths::Cint, sharedLibPaths::Ptr{MlirStringRef}, enableObjectDump::Bool)::MlirExecutionEngine + @ccall mlir_c.mlirExecutionEngineCreate( + op::MlirModule, + optLevel::Cint, + numPaths::Cint, + sharedLibPaths::Ptr{MlirStringRef}, + enableObjectDump::Bool, + )::MlirExecutionEngine end """ @@ -8020,7 +9007,9 @@ end 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). """ function mlirExecutionEngineInvokePacked(jit, name, arguments) - @ccall mlir_c.mlirExecutionEngineInvokePacked(jit::MlirExecutionEngine, name::MlirStringRef, arguments::Ptr{Ptr{Cvoid}})::MlirLogicalResult + @ccall mlir_c.mlirExecutionEngineInvokePacked( + jit::MlirExecutionEngine, name::MlirStringRef, arguments::Ptr{Ptr{Cvoid}} + )::MlirLogicalResult end """ @@ -8029,7 +9018,9 @@ end 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. """ function mlirExecutionEngineLookupPacked(jit, name) - @ccall mlir_c.mlirExecutionEngineLookupPacked(jit::MlirExecutionEngine, name::MlirStringRef)::Ptr{Cvoid} + @ccall mlir_c.mlirExecutionEngineLookupPacked( + jit::MlirExecutionEngine, name::MlirStringRef + )::Ptr{Cvoid} end """ @@ -8038,7 +9029,9 @@ end Lookup a native function in the execution engine by name, returns nullptr if the name can't be looked-up. """ function mlirExecutionEngineLookup(jit, name) - @ccall mlir_c.mlirExecutionEngineLookup(jit::MlirExecutionEngine, name::MlirStringRef)::Ptr{Cvoid} + @ccall mlir_c.mlirExecutionEngineLookup( + jit::MlirExecutionEngine, name::MlirStringRef + )::Ptr{Cvoid} end """ @@ -8047,7 +9040,9 @@ end Register a symbol with the jit: this symbol will be accessible to the jitted code. """ function mlirExecutionEngineRegisterSymbol(jit, name, sym) - @ccall mlir_c.mlirExecutionEngineRegisterSymbol(jit::MlirExecutionEngine, name::MlirStringRef, sym::Ptr{Cvoid})::Cvoid + @ccall mlir_c.mlirExecutionEngineRegisterSymbol( + jit::MlirExecutionEngine, name::MlirStringRef, sym::Ptr{Cvoid} + )::Cvoid end """ @@ -8056,7 +9051,9 @@ end Dump as an object in `fileName`. """ function mlirExecutionEngineDumpToObjectFile(jit, fileName) - @ccall mlir_c.mlirExecutionEngineDumpToObjectFile(jit::MlirExecutionEngine, fileName::MlirStringRef)::Cvoid + @ccall mlir_c.mlirExecutionEngineDumpToObjectFile( + jit::MlirExecutionEngine, fileName::MlirStringRef + )::Cvoid end """ @@ -8065,7 +9062,9 @@ end Returns `true` if the given operation implements an interface identified by its TypeID. """ function mlirOperationImplementsInterface(operation, interfaceTypeID) - @ccall mlir_c.mlirOperationImplementsInterface(operation::MlirOperation, interfaceTypeID::MlirTypeID)::Bool + @ccall mlir_c.mlirOperationImplementsInterface( + operation::MlirOperation, interfaceTypeID::MlirTypeID + )::Bool end """ @@ -8074,7 +9073,9 @@ end 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. """ function mlirOperationImplementsInterfaceStatic(operationName, context, interfaceTypeID) - @ccall mlir_c.mlirOperationImplementsInterfaceStatic(operationName::MlirStringRef, context::MlirContext, interfaceTypeID::MlirTypeID)::Bool + @ccall mlir_c.mlirOperationImplementsInterfaceStatic( + operationName::MlirStringRef, context::MlirContext, interfaceTypeID::MlirTypeID + )::Bool end """ @@ -8097,8 +9098,32 @@ const MlirTypesCallback = Ptr{Cvoid} Infers the return types of the operation identified by its canonical given the arguments that will be supplied to its generic builder. Calls `callback` with the types of inferred arguments, potentially several times, on success. Returns failure otherwise. """ -function mlirInferTypeOpInterfaceInferReturnTypes(opName, context, location, nOperands, operands, attributes, properties, nRegions, regions, callback, userData) - @ccall mlir_c.mlirInferTypeOpInterfaceInferReturnTypes(opName::MlirStringRef, context::MlirContext, location::MlirLocation, nOperands::intptr_t, operands::Ptr{MlirValue}, attributes::MlirAttribute, properties::Ptr{Cvoid}, nRegions::intptr_t, regions::Ptr{MlirRegion}, callback::MlirTypesCallback, userData::Ptr{Cvoid})::MlirLogicalResult +function mlirInferTypeOpInterfaceInferReturnTypes( + opName, + context, + location, + nOperands, + operands, + attributes, + properties, + nRegions, + regions, + callback, + userData, +) + @ccall mlir_c.mlirInferTypeOpInterfaceInferReturnTypes( + opName::MlirStringRef, + context::MlirContext, + location::MlirLocation, + nOperands::intptr_t, + operands::Ptr{MlirValue}, + attributes::MlirAttribute, + properties::Ptr{Cvoid}, + nRegions::intptr_t, + regions::Ptr{MlirRegion}, + callback::MlirTypesCallback, + userData::Ptr{Cvoid}, + )::MlirLogicalResult end """ @@ -8121,8 +9146,32 @@ const MlirShapedTypeComponentsCallback = Ptr{Cvoid} Infers the return shaped type components of the operation. Calls `callback` with the types of inferred arguments on success. Returns failure otherwise. """ -function mlirInferShapedTypeOpInterfaceInferReturnTypes(opName, context, location, nOperands, operands, attributes, properties, nRegions, regions, callback, userData) - @ccall mlir_c.mlirInferShapedTypeOpInterfaceInferReturnTypes(opName::MlirStringRef, context::MlirContext, location::MlirLocation, nOperands::intptr_t, operands::Ptr{MlirValue}, attributes::MlirAttribute, properties::Ptr{Cvoid}, nRegions::intptr_t, regions::Ptr{MlirRegion}, callback::MlirShapedTypeComponentsCallback, userData::Ptr{Cvoid})::MlirLogicalResult +function mlirInferShapedTypeOpInterfaceInferReturnTypes( + opName, + context, + location, + nOperands, + operands, + attributes, + properties, + nRegions, + regions, + callback, + userData, +) + @ccall mlir_c.mlirInferShapedTypeOpInterfaceInferReturnTypes( + opName::MlirStringRef, + context::MlirContext, + location::MlirLocation, + nOperands::intptr_t, + operands::Ptr{MlirValue}, + attributes::MlirAttribute, + properties::Ptr{Cvoid}, + nRegions::intptr_t, + regions::Ptr{MlirRegion}, + callback::MlirShapedTypeComponentsCallback, + userData::Ptr{Cvoid}, + )::MlirLogicalResult end """ @@ -8192,7 +9241,9 @@ end Sets the insertion point to the specified operation, which will cause subsequent insertions to go right before it. """ function mlirRewriterBaseSetInsertionPointBefore(rewriter, op) - @ccall mlir_c.mlirRewriterBaseSetInsertionPointBefore(rewriter::MlirRewriterBase, op::MlirOperation)::Cvoid + @ccall mlir_c.mlirRewriterBaseSetInsertionPointBefore( + rewriter::MlirRewriterBase, op::MlirOperation + )::Cvoid end """ @@ -8201,7 +9252,9 @@ end Sets the insertion point to the node after the specified operation, which will cause subsequent insertions to go right after it. """ function mlirRewriterBaseSetInsertionPointAfter(rewriter, op) - @ccall mlir_c.mlirRewriterBaseSetInsertionPointAfter(rewriter::MlirRewriterBase, op::MlirOperation)::Cvoid + @ccall mlir_c.mlirRewriterBaseSetInsertionPointAfter( + rewriter::MlirRewriterBase, op::MlirOperation + )::Cvoid end """ @@ -8210,7 +9263,9 @@ end 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. """ function mlirRewriterBaseSetInsertionPointAfterValue(rewriter, value) - @ccall mlir_c.mlirRewriterBaseSetInsertionPointAfterValue(rewriter::MlirRewriterBase, value::MlirValue)::Cvoid + @ccall mlir_c.mlirRewriterBaseSetInsertionPointAfterValue( + rewriter::MlirRewriterBase, value::MlirValue + )::Cvoid end """ @@ -8219,7 +9274,9 @@ end Sets the insertion point to the start of the specified block. """ function mlirRewriterBaseSetInsertionPointToStart(rewriter, block) - @ccall mlir_c.mlirRewriterBaseSetInsertionPointToStart(rewriter::MlirRewriterBase, block::MlirBlock)::Cvoid + @ccall mlir_c.mlirRewriterBaseSetInsertionPointToStart( + rewriter::MlirRewriterBase, block::MlirBlock + )::Cvoid end """ @@ -8228,7 +9285,9 @@ end Sets the insertion point to the end of the specified block. """ function mlirRewriterBaseSetInsertionPointToEnd(rewriter, block) - @ccall mlir_c.mlirRewriterBaseSetInsertionPointToEnd(rewriter::MlirRewriterBase, block::MlirBlock)::Cvoid + @ccall mlir_c.mlirRewriterBaseSetInsertionPointToEnd( + rewriter::MlirRewriterBase, block::MlirBlock + )::Cvoid end """ @@ -8254,8 +9313,16 @@ end 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`. """ -function mlirRewriterBaseCreateBlockBefore(rewriter, insertBefore, nArgTypes, argTypes, locations) - @ccall mlir_c.mlirRewriterBaseCreateBlockBefore(rewriter::MlirRewriterBase, insertBefore::MlirBlock, nArgTypes::intptr_t, argTypes::Ptr{MlirType}, locations::Ptr{MlirLocation})::MlirBlock +function mlirRewriterBaseCreateBlockBefore( + rewriter, insertBefore, nArgTypes, argTypes, locations +) + @ccall mlir_c.mlirRewriterBaseCreateBlockBefore( + rewriter::MlirRewriterBase, + insertBefore::MlirBlock, + nArgTypes::intptr_t, + argTypes::Ptr{MlirType}, + locations::Ptr{MlirLocation}, + )::MlirBlock end """ @@ -8264,7 +9331,9 @@ end Insert the given operation at the current insertion point and return it. """ function mlirRewriterBaseInsert(rewriter, op) - @ccall mlir_c.mlirRewriterBaseInsert(rewriter::MlirRewriterBase, op::MlirOperation)::MlirOperation + @ccall mlir_c.mlirRewriterBaseInsert( + rewriter::MlirRewriterBase, op::MlirOperation + )::MlirOperation end """ @@ -8273,7 +9342,9 @@ end Creates a deep copy of the specified operation. """ function mlirRewriterBaseClone(rewriter, op) - @ccall mlir_c.mlirRewriterBaseClone(rewriter::MlirRewriterBase, op::MlirOperation)::MlirOperation + @ccall mlir_c.mlirRewriterBaseClone( + rewriter::MlirRewriterBase, op::MlirOperation + )::MlirOperation end """ @@ -8282,7 +9353,9 @@ end Creates a deep copy of this operation but keep the operation regions empty. """ function mlirRewriterBaseCloneWithoutRegions(rewriter, op) - @ccall mlir_c.mlirRewriterBaseCloneWithoutRegions(rewriter::MlirRewriterBase, op::MlirOperation)::MlirOperation + @ccall mlir_c.mlirRewriterBaseCloneWithoutRegions( + rewriter::MlirRewriterBase, op::MlirOperation + )::MlirOperation end """ @@ -8291,7 +9364,9 @@ end Clone the blocks that belong to "region" before the given position in another region "parent". """ function mlirRewriterBaseCloneRegionBefore(rewriter, region, before) - @ccall mlir_c.mlirRewriterBaseCloneRegionBefore(rewriter::MlirRewriterBase, region::MlirRegion, before::MlirBlock)::Cvoid + @ccall mlir_c.mlirRewriterBaseCloneRegionBefore( + rewriter::MlirRewriterBase, region::MlirRegion, before::MlirBlock + )::Cvoid end """ @@ -8300,7 +9375,9 @@ end 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. """ function mlirRewriterBaseInlineRegionBefore(rewriter, region, before) - @ccall mlir_c.mlirRewriterBaseInlineRegionBefore(rewriter::MlirRewriterBase, region::MlirRegion, before::MlirBlock)::Cvoid + @ccall mlir_c.mlirRewriterBaseInlineRegionBefore( + rewriter::MlirRewriterBase, region::MlirRegion, before::MlirBlock + )::Cvoid end """ @@ -8309,7 +9386,12 @@ end 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. """ function mlirRewriterBaseReplaceOpWithValues(rewriter, op, nValues, values) - @ccall mlir_c.mlirRewriterBaseReplaceOpWithValues(rewriter::MlirRewriterBase, op::MlirOperation, nValues::intptr_t, values::Ptr{MlirValue})::Cvoid + @ccall mlir_c.mlirRewriterBaseReplaceOpWithValues( + rewriter::MlirRewriterBase, + op::MlirOperation, + nValues::intptr_t, + values::Ptr{MlirValue}, + )::Cvoid end """ @@ -8318,7 +9400,9 @@ end 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. """ function mlirRewriterBaseReplaceOpWithOperation(rewriter, op, newOp) - @ccall mlir_c.mlirRewriterBaseReplaceOpWithOperation(rewriter::MlirRewriterBase, op::MlirOperation, newOp::MlirOperation)::Cvoid + @ccall mlir_c.mlirRewriterBaseReplaceOpWithOperation( + rewriter::MlirRewriterBase, op::MlirOperation, newOp::MlirOperation + )::Cvoid end """ @@ -8327,7 +9411,9 @@ end Erases an operation that is known to have no uses. """ function mlirRewriterBaseEraseOp(rewriter, op) - @ccall mlir_c.mlirRewriterBaseEraseOp(rewriter::MlirRewriterBase, op::MlirOperation)::Cvoid + @ccall mlir_c.mlirRewriterBaseEraseOp( + rewriter::MlirRewriterBase, op::MlirOperation + )::Cvoid end """ @@ -8336,7 +9422,9 @@ end Erases a block along with all operations inside it. """ function mlirRewriterBaseEraseBlock(rewriter, block) - @ccall mlir_c.mlirRewriterBaseEraseBlock(rewriter::MlirRewriterBase, block::MlirBlock)::Cvoid + @ccall mlir_c.mlirRewriterBaseEraseBlock( + rewriter::MlirRewriterBase, block::MlirBlock + )::Cvoid end """ @@ -8347,7 +9435,13 @@ Inline the operations of block 'source' before the operation 'op'. The source bl The source block must have no successors. Otherwise, the resulting IR would have unreachable operations. """ function mlirRewriterBaseInlineBlockBefore(rewriter, source, op, nArgValues, argValues) - @ccall mlir_c.mlirRewriterBaseInlineBlockBefore(rewriter::MlirRewriterBase, source::MlirBlock, op::MlirOperation, nArgValues::intptr_t, argValues::Ptr{MlirValue})::Cvoid + @ccall mlir_c.mlirRewriterBaseInlineBlockBefore( + rewriter::MlirRewriterBase, + source::MlirBlock, + op::MlirOperation, + nArgValues::intptr_t, + argValues::Ptr{MlirValue}, + )::Cvoid end """ @@ -8358,7 +9452,13 @@ Inline the operations of block 'source' into the end of block 'dest'. The source The dest block must have no successors. Otherwise, the resulting IR would have unreachable operation. """ function mlirRewriterBaseMergeBlocks(rewriter, source, dest, nArgValues, argValues) - @ccall mlir_c.mlirRewriterBaseMergeBlocks(rewriter::MlirRewriterBase, source::MlirBlock, dest::MlirBlock, nArgValues::intptr_t, argValues::Ptr{MlirValue})::Cvoid + @ccall mlir_c.mlirRewriterBaseMergeBlocks( + rewriter::MlirRewriterBase, + source::MlirBlock, + dest::MlirBlock, + nArgValues::intptr_t, + argValues::Ptr{MlirValue}, + )::Cvoid end """ @@ -8367,7 +9467,9 @@ end 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. """ function mlirRewriterBaseMoveOpBefore(rewriter, op, existingOp) - @ccall mlir_c.mlirRewriterBaseMoveOpBefore(rewriter::MlirRewriterBase, op::MlirOperation, existingOp::MlirOperation)::Cvoid + @ccall mlir_c.mlirRewriterBaseMoveOpBefore( + rewriter::MlirRewriterBase, op::MlirOperation, existingOp::MlirOperation + )::Cvoid end """ @@ -8376,7 +9478,9 @@ end 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. """ function mlirRewriterBaseMoveOpAfter(rewriter, op, existingOp) - @ccall mlir_c.mlirRewriterBaseMoveOpAfter(rewriter::MlirRewriterBase, op::MlirOperation, existingOp::MlirOperation)::Cvoid + @ccall mlir_c.mlirRewriterBaseMoveOpAfter( + rewriter::MlirRewriterBase, op::MlirOperation, existingOp::MlirOperation + )::Cvoid end """ @@ -8385,7 +9489,9 @@ end Unlink this block and insert it right before `existingBlock`. """ function mlirRewriterBaseMoveBlockBefore(rewriter, block, existingBlock) - @ccall mlir_c.mlirRewriterBaseMoveBlockBefore(rewriter::MlirRewriterBase, block::MlirBlock, existingBlock::MlirBlock)::Cvoid + @ccall mlir_c.mlirRewriterBaseMoveBlockBefore( + rewriter::MlirRewriterBase, block::MlirBlock, existingBlock::MlirBlock + )::Cvoid end """ @@ -8394,7 +9500,9 @@ end 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. """ function mlirRewriterBaseStartOpModification(rewriter, op) - @ccall mlir_c.mlirRewriterBaseStartOpModification(rewriter::MlirRewriterBase, op::MlirOperation)::Cvoid + @ccall mlir_c.mlirRewriterBaseStartOpModification( + rewriter::MlirRewriterBase, op::MlirOperation + )::Cvoid end """ @@ -8403,7 +9511,9 @@ end 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`. """ function mlirRewriterBaseFinalizeOpModification(rewriter, op) - @ccall mlir_c.mlirRewriterBaseFinalizeOpModification(rewriter::MlirRewriterBase, op::MlirOperation)::Cvoid + @ccall mlir_c.mlirRewriterBaseFinalizeOpModification( + rewriter::MlirRewriterBase, op::MlirOperation + )::Cvoid end """ @@ -8412,7 +9522,9 @@ end This method cancels a pending in-place modification. This can only be called on operations that were provided to a call to `startOpModification`. """ function mlirRewriterBaseCancelOpModification(rewriter, op) - @ccall mlir_c.mlirRewriterBaseCancelOpModification(rewriter::MlirRewriterBase, op::MlirOperation)::Cvoid + @ccall mlir_c.mlirRewriterBaseCancelOpModification( + rewriter::MlirRewriterBase, op::MlirOperation + )::Cvoid end """ @@ -8421,7 +9533,9 @@ end 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). """ function mlirRewriterBaseReplaceAllUsesWith(rewriter, from, to) - @ccall mlir_c.mlirRewriterBaseReplaceAllUsesWith(rewriter::MlirRewriterBase, from::MlirValue, to::MlirValue)::Cvoid + @ccall mlir_c.mlirRewriterBaseReplaceAllUsesWith( + rewriter::MlirRewriterBase, from::MlirValue, to::MlirValue + )::Cvoid end """ @@ -8430,7 +9544,12 @@ end 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). """ function mlirRewriterBaseReplaceAllValueRangeUsesWith(rewriter, nValues, from, to) - @ccall mlir_c.mlirRewriterBaseReplaceAllValueRangeUsesWith(rewriter::MlirRewriterBase, nValues::intptr_t, from::Ptr{MlirValue}, to::Ptr{MlirValue})::Cvoid + @ccall mlir_c.mlirRewriterBaseReplaceAllValueRangeUsesWith( + rewriter::MlirRewriterBase, + nValues::intptr_t, + from::Ptr{MlirValue}, + to::Ptr{MlirValue}, + )::Cvoid end """ @@ -8439,7 +9558,9 @@ end 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. """ function mlirRewriterBaseReplaceAllOpUsesWithValueRange(rewriter, from, nTo, to) - @ccall mlir_c.mlirRewriterBaseReplaceAllOpUsesWithValueRange(rewriter::MlirRewriterBase, from::MlirOperation, nTo::intptr_t, to::Ptr{MlirValue})::Cvoid + @ccall mlir_c.mlirRewriterBaseReplaceAllOpUsesWithValueRange( + rewriter::MlirRewriterBase, from::MlirOperation, nTo::intptr_t, to::Ptr{MlirValue} + )::Cvoid end """ @@ -8448,7 +9569,9 @@ end 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. """ function mlirRewriterBaseReplaceAllOpUsesWithOperation(rewriter, from, to) - @ccall mlir_c.mlirRewriterBaseReplaceAllOpUsesWithOperation(rewriter::MlirRewriterBase, from::MlirOperation, to::MlirOperation)::Cvoid + @ccall mlir_c.mlirRewriterBaseReplaceAllOpUsesWithOperation( + rewriter::MlirRewriterBase, from::MlirOperation, to::MlirOperation + )::Cvoid end """ @@ -8456,8 +9579,16 @@ end 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. """ -function mlirRewriterBaseReplaceOpUsesWithinBlock(rewriter, op, nNewValues, newValues, block) - @ccall mlir_c.mlirRewriterBaseReplaceOpUsesWithinBlock(rewriter::MlirRewriterBase, op::MlirOperation, nNewValues::intptr_t, newValues::Ptr{MlirValue}, block::MlirBlock)::Cvoid +function mlirRewriterBaseReplaceOpUsesWithinBlock( + rewriter, op, nNewValues, newValues, block +) + @ccall mlir_c.mlirRewriterBaseReplaceOpUsesWithinBlock( + rewriter::MlirRewriterBase, + op::MlirOperation, + nNewValues::intptr_t, + newValues::Ptr{MlirValue}, + block::MlirBlock, + )::Cvoid end """ @@ -8466,7 +9597,12 @@ end 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). """ function mlirRewriterBaseReplaceAllUsesExcept(rewriter, from, to, exceptedUser) - @ccall mlir_c.mlirRewriterBaseReplaceAllUsesExcept(rewriter::MlirRewriterBase, from::MlirValue, to::MlirValue, exceptedUser::MlirOperation)::Cvoid + @ccall mlir_c.mlirRewriterBaseReplaceAllUsesExcept( + rewriter::MlirRewriterBase, + from::MlirValue, + to::MlirValue, + exceptedUser::MlirOperation, + )::Cvoid end """ @@ -8502,7 +9638,9 @@ end FrozenRewritePatternSet API """ function mlirFreezeRewritePattern(op) - @ccall mlir_c.mlirFreezeRewritePattern(op::MlirRewritePatternSet)::MlirFrozenRewritePatternSet + @ccall mlir_c.mlirFreezeRewritePattern( + op::MlirRewritePatternSet + )::MlirFrozenRewritePatternSet end function mlirFrozenRewritePatternSetDestroy(op) @@ -8510,7 +9648,11 @@ function mlirFrozenRewritePatternSetDestroy(op) end function mlirApplyPatternsAndFoldGreedily(op, patterns, arg3) - @ccall mlir_c.mlirApplyPatternsAndFoldGreedily(op::MlirModule, patterns::MlirFrozenRewritePatternSet, arg3::MlirGreedyRewriteDriverConfig)::MlirLogicalResult + @ccall mlir_c.mlirApplyPatternsAndFoldGreedily( + op::MlirModule, + patterns::MlirFrozenRewritePatternSet, + arg3::MlirGreedyRewriteDriverConfig, + )::MlirLogicalResult end """ @@ -8525,7 +9667,7 @@ mutable struct LLVMOpaqueMemoryBuffer end """ Used to pass regions of memory through LLVM interfaces. -### See also +# See also llvm::MemoryBuffer """ const LLVMMemoryBufferRef = Ptr{LLVMOpaqueMemoryBuffer} @@ -8542,7 +9684,7 @@ mutable struct LLVMOpaqueModule end """ The top-level container for all other LLVM Intermediate Representation (IR) objects. -### See also +# See also llvm::Module """ const LLVMModuleRef = Ptr{LLVMOpaqueModule} @@ -8552,7 +9694,7 @@ mutable struct LLVMOpaqueType end """ Each value in the LLVM IR has a type, an [`LLVMTypeRef`](@ref). -### See also +# See also llvm::Type """ const LLVMTypeRef = Ptr{LLVMOpaqueType} @@ -8630,7 +9772,7 @@ const LLVMModuleProviderRef = Ptr{LLVMOpaqueModuleProvider} mutable struct LLVMOpaquePassManager end """ -### See also +# See also llvm::PassManagerBase """ const LLVMPassManagerRef = Ptr{LLVMOpaquePassManager} @@ -8640,7 +9782,7 @@ mutable struct LLVMOpaqueUse end """ Used to get the users and usees of a Value. -### See also +# See also llvm::Use """ const LLVMUseRef = Ptr{LLVMOpaqueUse} @@ -8648,7 +9790,7 @@ const LLVMUseRef = Ptr{LLVMOpaqueUse} mutable struct LLVMOpaqueOperandBundle end """ -### See also +# See also llvm::OperandBundleDef """ const LLVMOperandBundleRef = Ptr{LLVMOpaqueOperandBundle} @@ -8658,7 +9800,7 @@ mutable struct LLVMOpaqueAttributeRef end """ Used to represent an attributes. -### See also +# See also llvm::Attribute """ const LLVMAttributeRef = Ptr{LLVMOpaqueAttributeRef} @@ -8666,7 +9808,7 @@ const LLVMAttributeRef = Ptr{LLVMOpaqueAttributeRef} mutable struct LLVMOpaqueDiagnosticInfo end """ -### See also +# See also llvm::DiagnosticInfo """ const LLVMDiagnosticInfoRef = Ptr{LLVMOpaqueDiagnosticInfo} @@ -8674,7 +9816,7 @@ const LLVMDiagnosticInfoRef = Ptr{LLVMOpaqueDiagnosticInfo} mutable struct LLVMComdat end """ -### See also +# See also llvm::Comdat """ const LLVMComdatRef = Ptr{LLVMComdat} @@ -8682,7 +9824,7 @@ const LLVMComdatRef = Ptr{LLVMComdat} mutable struct LLVMOpaqueModuleFlagEntry end """ -### See also +# See also llvm::Module::ModuleFlagEntry """ const LLVMModuleFlagEntry = LLVMOpaqueModuleFlagEntry @@ -8690,7 +9832,7 @@ const LLVMModuleFlagEntry = LLVMOpaqueModuleFlagEntry mutable struct LLVMOpaqueJITEventListener end """ -### See also +# See also llvm::JITEventListener """ const LLVMJITEventListenerRef = Ptr{LLVMOpaqueJITEventListener} @@ -8698,7 +9840,7 @@ const LLVMJITEventListenerRef = Ptr{LLVMOpaqueJITEventListener} mutable struct LLVMOpaqueBinary end """ -### See also +# See also llvm::object::Binary """ const LLVMBinaryRef = Ptr{LLVMOpaqueBinary} @@ -8706,7 +9848,7 @@ const LLVMBinaryRef = Ptr{LLVMOpaqueBinary} mutable struct LLVMOpaqueDbgRecord end """ -### See also +# See also llvm::DbgRecord """ const LLVMDbgRecordRef = Ptr{LLVMOpaqueDbgRecord} @@ -8716,7 +9858,7 @@ const LLVMDbgRecordRef = Ptr{LLVMOpaqueDbgRecord} This function permanently loads the dynamic library at the given path. It is safe to call this function multiple times for the same library. -### See also +# See also sys::DynamicLibrary::LoadLibraryPermanently() """ function LLVMLoadLibraryPermanently(Filename) @@ -8728,11 +9870,13 @@ end This function parses the given arguments using the LLVM command line parser. Note that the only stable thing about this function is its signature; you cannot rely on any particular set of command line arguments being interpreted the same way across LLVM versions. -### See also +# See also llvm::cl::ParseCommandLineOptions() """ function LLVMParseCommandLineOptions(argc, argv, Overview) - @ccall mlir_c.LLVMParseCommandLineOptions(argc::Cint, argv::Ptr{Cstring}, Overview::Cstring)::Cvoid + @ccall mlir_c.LLVMParseCommandLineOptions( + argc::Cint, argv::Ptr{Cstring}, Overview::Cstring + )::Cvoid end """ @@ -8740,7 +9884,7 @@ end This function will search through all previously loaded dynamic libraries for the symbol `symbolName`. If it is found, the address of that symbol is returned. If not, null is returned. -### See also +# See also sys::DynamicLibrary::SearchForAddressOfSymbol() """ function LLVMSearchForAddressOfSymbol(symbolName) @@ -8752,7 +9896,7 @@ end This functions permanently adds the symbol `symbolName` with the value `symbolValue`. These symbols are searched before any libraries. -### See also +# See also sys::DynamicLibrary::AddSymbol() """ function LLVMAddSymbol(symbolName, symbolValue) @@ -8764,11 +9908,13 @@ end Translate operation that satisfies LLVM dialect module requirements into an LLVM IR module living in the given context. This translates operations from any dilalect that has a registered implementation of LLVMTranslationDialectInterface. -### Returns +# Returns the generated LLVM IR Module from the translated MLIR module, it is owned by the caller. """ function mlirTranslateModuleToLLVMIR(_module, context) - @ccall mlir_c.mlirTranslateModuleToLLVMIR(_module::MlirOperation, context::LLVMContextRef)::LLVMModuleRef + @ccall mlir_c.mlirTranslateModuleToLLVMIR( + _module::MlirOperation, context::LLVMContextRef + )::LLVMModuleRef end function mlirRegisterTransformsPasses() @@ -8935,8 +10081,34 @@ function mlirRegisterTransformsViewOpGraph() @ccall mlir_c.mlirRegisterTransformsViewOpGraph()::Cvoid end -function stablehloScatterDimensionNumbersGet(ctx, nUpdateWindowDims, updateWindowDims, nInsertedWindowDims, insertedWindowDims, nInputBatchingDims, inputBatchingDims, nScatterIndicesBatchingDims, scatterIndicesBatchingDims, nScatteredDimsToOperandDims, scatteredDimsToOperandDims, indexVectorDim) - @ccall mlir_c.stablehloScatterDimensionNumbersGet(ctx::MlirContext, nUpdateWindowDims::intptr_t, updateWindowDims::Ptr{Int64}, nInsertedWindowDims::intptr_t, insertedWindowDims::Ptr{Int64}, nInputBatchingDims::intptr_t, inputBatchingDims::Ptr{Int64}, nScatterIndicesBatchingDims::intptr_t, scatterIndicesBatchingDims::Ptr{Int64}, nScatteredDimsToOperandDims::intptr_t, scatteredDimsToOperandDims::Ptr{Int64}, indexVectorDim::Int64)::MlirAttribute +function stablehloScatterDimensionNumbersGet( + ctx, + nUpdateWindowDims, + updateWindowDims, + nInsertedWindowDims, + insertedWindowDims, + nInputBatchingDims, + inputBatchingDims, + nScatterIndicesBatchingDims, + scatterIndicesBatchingDims, + nScatteredDimsToOperandDims, + scatteredDimsToOperandDims, + indexVectorDim, +) + @ccall mlir_c.stablehloScatterDimensionNumbersGet( + ctx::MlirContext, + nUpdateWindowDims::intptr_t, + updateWindowDims::Ptr{Int64}, + nInsertedWindowDims::intptr_t, + insertedWindowDims::Ptr{Int64}, + nInputBatchingDims::intptr_t, + inputBatchingDims::Ptr{Int64}, + nScatterIndicesBatchingDims::intptr_t, + scatterIndicesBatchingDims::Ptr{Int64}, + nScatteredDimsToOperandDims::intptr_t, + scatteredDimsToOperandDims::Ptr{Int64}, + indexVectorDim::Int64, + )::MlirAttribute end function stablehloAttributeIsAScatterDimensionNumbers(attr) @@ -8944,51 +10116,97 @@ function stablehloAttributeIsAScatterDimensionNumbers(attr) end function stablehloScatterDimensionNumbersGetUpdateWindowDimsSize(attr) - @ccall mlir_c.stablehloScatterDimensionNumbersGetUpdateWindowDimsSize(attr::MlirAttribute)::intptr_t + @ccall mlir_c.stablehloScatterDimensionNumbersGetUpdateWindowDimsSize( + attr::MlirAttribute + )::intptr_t end function stablehloScatterDimensionNumbersGetUpdateWindowDimsElem(attr, pos) - @ccall mlir_c.stablehloScatterDimensionNumbersGetUpdateWindowDimsElem(attr::MlirAttribute, pos::intptr_t)::Int64 + @ccall mlir_c.stablehloScatterDimensionNumbersGetUpdateWindowDimsElem( + attr::MlirAttribute, pos::intptr_t + )::Int64 end function stablehloScatterDimensionNumbersGetInsertedWindowDimsSize(attr) - @ccall mlir_c.stablehloScatterDimensionNumbersGetInsertedWindowDimsSize(attr::MlirAttribute)::intptr_t + @ccall mlir_c.stablehloScatterDimensionNumbersGetInsertedWindowDimsSize( + attr::MlirAttribute + )::intptr_t end function stablehloScatterDimensionNumbersGetInsertedWindowDimsElem(attr, pos) - @ccall mlir_c.stablehloScatterDimensionNumbersGetInsertedWindowDimsElem(attr::MlirAttribute, pos::intptr_t)::Int64 + @ccall mlir_c.stablehloScatterDimensionNumbersGetInsertedWindowDimsElem( + attr::MlirAttribute, pos::intptr_t + )::Int64 end function stablehloScatterDimensionNumbersGetInputBatchingDimsSize(attr) - @ccall mlir_c.stablehloScatterDimensionNumbersGetInputBatchingDimsSize(attr::MlirAttribute)::intptr_t + @ccall mlir_c.stablehloScatterDimensionNumbersGetInputBatchingDimsSize( + attr::MlirAttribute + )::intptr_t end function stablehloScatterDimensionNumbersGetInputBatchingDimsElem(attr, pos) - @ccall mlir_c.stablehloScatterDimensionNumbersGetInputBatchingDimsElem(attr::MlirAttribute, pos::intptr_t)::Int64 + @ccall mlir_c.stablehloScatterDimensionNumbersGetInputBatchingDimsElem( + attr::MlirAttribute, pos::intptr_t + )::Int64 end function stablehloScatterDimensionNumbersGetScatterIndicesBatchingDimsSize(attr) - @ccall mlir_c.stablehloScatterDimensionNumbersGetScatterIndicesBatchingDimsSize(attr::MlirAttribute)::intptr_t + @ccall mlir_c.stablehloScatterDimensionNumbersGetScatterIndicesBatchingDimsSize( + attr::MlirAttribute + )::intptr_t end function stablehloScatterDimensionNumbersGetScatterIndicesBatchingDimsElem(attr, pos) - @ccall mlir_c.stablehloScatterDimensionNumbersGetScatterIndicesBatchingDimsElem(attr::MlirAttribute, pos::intptr_t)::Int64 + @ccall mlir_c.stablehloScatterDimensionNumbersGetScatterIndicesBatchingDimsElem( + attr::MlirAttribute, pos::intptr_t + )::Int64 end function stablehloScatterDimensionNumbersGetScatteredDimsToOperandDimsSize(attr) - @ccall mlir_c.stablehloScatterDimensionNumbersGetScatteredDimsToOperandDimsSize(attr::MlirAttribute)::intptr_t + @ccall mlir_c.stablehloScatterDimensionNumbersGetScatteredDimsToOperandDimsSize( + attr::MlirAttribute + )::intptr_t end function stablehloScatterDimensionNumbersGetScatteredDimsToOperandDimsElem(attr, pos) - @ccall mlir_c.stablehloScatterDimensionNumbersGetScatteredDimsToOperandDimsElem(attr::MlirAttribute, pos::intptr_t)::Int64 + @ccall mlir_c.stablehloScatterDimensionNumbersGetScatteredDimsToOperandDimsElem( + attr::MlirAttribute, pos::intptr_t + )::Int64 end function stablehloDimensionNumbersGetIndexVectorDim(attr) @ccall mlir_c.stablehloDimensionNumbersGetIndexVectorDim(attr::MlirAttribute)::Int64 end -function stablehloGatherDimensionNumbersGet(ctx, nOffsetDims, offsetDims, nCollapsedSliceDims, collapsedSliceDims, nOperandBatchingDims, operandBatchingDims, nStartIndicesBatchingDims, startIndicesBatchingDims, nStartIndexMap, startIndexMap, indexVectorDim) - @ccall mlir_c.stablehloGatherDimensionNumbersGet(ctx::MlirContext, nOffsetDims::intptr_t, offsetDims::Ptr{Int64}, nCollapsedSliceDims::intptr_t, collapsedSliceDims::Ptr{Int64}, nOperandBatchingDims::intptr_t, operandBatchingDims::Ptr{Int64}, nStartIndicesBatchingDims::intptr_t, startIndicesBatchingDims::Ptr{Int64}, nStartIndexMap::intptr_t, startIndexMap::Ptr{Int64}, indexVectorDim::Int64)::MlirAttribute +function stablehloGatherDimensionNumbersGet( + ctx, + nOffsetDims, + offsetDims, + nCollapsedSliceDims, + collapsedSliceDims, + nOperandBatchingDims, + operandBatchingDims, + nStartIndicesBatchingDims, + startIndicesBatchingDims, + nStartIndexMap, + startIndexMap, + indexVectorDim, +) + @ccall mlir_c.stablehloGatherDimensionNumbersGet( + ctx::MlirContext, + nOffsetDims::intptr_t, + offsetDims::Ptr{Int64}, + nCollapsedSliceDims::intptr_t, + collapsedSliceDims::Ptr{Int64}, + nOperandBatchingDims::intptr_t, + operandBatchingDims::Ptr{Int64}, + nStartIndicesBatchingDims::intptr_t, + startIndicesBatchingDims::Ptr{Int64}, + nStartIndexMap::intptr_t, + startIndexMap::Ptr{Int64}, + indexVectorDim::Int64, + )::MlirAttribute end function stablehloAttributeIsAGatherDimensionNumbers(attr) @@ -8996,51 +10214,91 @@ function stablehloAttributeIsAGatherDimensionNumbers(attr) end function stablehloGatherDimensionNumbersGetOffsetDimsSize(attr) - @ccall mlir_c.stablehloGatherDimensionNumbersGetOffsetDimsSize(attr::MlirAttribute)::intptr_t + @ccall mlir_c.stablehloGatherDimensionNumbersGetOffsetDimsSize( + attr::MlirAttribute + )::intptr_t end function stablehloGatherDimensionNumbersGetOffsetDimsElem(attr, pos) - @ccall mlir_c.stablehloGatherDimensionNumbersGetOffsetDimsElem(attr::MlirAttribute, pos::intptr_t)::Int64 + @ccall mlir_c.stablehloGatherDimensionNumbersGetOffsetDimsElem( + attr::MlirAttribute, pos::intptr_t + )::Int64 end function stablehloGatherDimensionNumbersGetCollapsedSliceDimsSize(attr) - @ccall mlir_c.stablehloGatherDimensionNumbersGetCollapsedSliceDimsSize(attr::MlirAttribute)::intptr_t + @ccall mlir_c.stablehloGatherDimensionNumbersGetCollapsedSliceDimsSize( + attr::MlirAttribute + )::intptr_t end function stablehloGatherDimensionNumbersGetCollapsedSliceDimsElem(attr, pos) - @ccall mlir_c.stablehloGatherDimensionNumbersGetCollapsedSliceDimsElem(attr::MlirAttribute, pos::intptr_t)::Int64 + @ccall mlir_c.stablehloGatherDimensionNumbersGetCollapsedSliceDimsElem( + attr::MlirAttribute, pos::intptr_t + )::Int64 end function stablehloGatherDimensionNumbersGetOperandBatchingDimsSize(attr) - @ccall mlir_c.stablehloGatherDimensionNumbersGetOperandBatchingDimsSize(attr::MlirAttribute)::intptr_t + @ccall mlir_c.stablehloGatherDimensionNumbersGetOperandBatchingDimsSize( + attr::MlirAttribute + )::intptr_t end function stablehloGatherDimensionNumbersGetOperandBatchingDimsElem(attr, pos) - @ccall mlir_c.stablehloGatherDimensionNumbersGetOperandBatchingDimsElem(attr::MlirAttribute, pos::intptr_t)::Int64 + @ccall mlir_c.stablehloGatherDimensionNumbersGetOperandBatchingDimsElem( + attr::MlirAttribute, pos::intptr_t + )::Int64 end function stablehloGatherDimensionNumbersGetStartIndicesBatchingDimsSize(attr) - @ccall mlir_c.stablehloGatherDimensionNumbersGetStartIndicesBatchingDimsSize(attr::MlirAttribute)::intptr_t + @ccall mlir_c.stablehloGatherDimensionNumbersGetStartIndicesBatchingDimsSize( + attr::MlirAttribute + )::intptr_t end function stablehloGatherDimensionNumbersGetStartIndicesBatchingDimsElem(attr, pos) - @ccall mlir_c.stablehloGatherDimensionNumbersGetStartIndicesBatchingDimsElem(attr::MlirAttribute, pos::intptr_t)::Int64 + @ccall mlir_c.stablehloGatherDimensionNumbersGetStartIndicesBatchingDimsElem( + attr::MlirAttribute, pos::intptr_t + )::Int64 end function stablehloGatherDimensionNumbersGetStartIndexMapSize(attr) - @ccall mlir_c.stablehloGatherDimensionNumbersGetStartIndexMapSize(attr::MlirAttribute)::intptr_t + @ccall mlir_c.stablehloGatherDimensionNumbersGetStartIndexMapSize( + attr::MlirAttribute + )::intptr_t end function stablehloGatherDimensionNumbersGetStartIndexMapElem(attr, pos) - @ccall mlir_c.stablehloGatherDimensionNumbersGetStartIndexMapElem(attr::MlirAttribute, pos::intptr_t)::Int64 + @ccall mlir_c.stablehloGatherDimensionNumbersGetStartIndexMapElem( + attr::MlirAttribute, pos::intptr_t + )::Int64 end function stablehloGatherDimensionNumbersGetIndexVectorDim(attr) - @ccall mlir_c.stablehloGatherDimensionNumbersGetIndexVectorDim(attr::MlirAttribute)::Int64 -end - -function stablehloDotAlgorithmGet(ctx, lhsPrecisionType, rhsPrecisionType, accumulationType, lhsComponentCount, rhsComponentCount, numPrimitiveOperations, allowImpreciseAccumulation) - @ccall mlir_c.stablehloDotAlgorithmGet(ctx::MlirContext, lhsPrecisionType::MlirType, rhsPrecisionType::MlirType, accumulationType::MlirType, lhsComponentCount::Int64, rhsComponentCount::Int64, numPrimitiveOperations::Int64, allowImpreciseAccumulation::Bool)::MlirAttribute + @ccall mlir_c.stablehloGatherDimensionNumbersGetIndexVectorDim( + attr::MlirAttribute + )::Int64 +end + +function stablehloDotAlgorithmGet( + ctx, + lhsPrecisionType, + rhsPrecisionType, + accumulationType, + lhsComponentCount, + rhsComponentCount, + numPrimitiveOperations, + allowImpreciseAccumulation, +) + @ccall mlir_c.stablehloDotAlgorithmGet( + ctx::MlirContext, + lhsPrecisionType::MlirType, + rhsPrecisionType::MlirType, + accumulationType::MlirType, + lhsComponentCount::Int64, + rhsComponentCount::Int64, + numPrimitiveOperations::Int64, + allowImpreciseAccumulation::Bool, + )::MlirAttribute end function stablehloAttributeIsADotAlgorithm(attr) @@ -9072,11 +10330,33 @@ function stablehloDotAlgorithmGetNumPrimitiveOperations(attr) end function stablehloDotAlgorithmGetAllowImpreciseAccumulation(attr) - @ccall mlir_c.stablehloDotAlgorithmGetAllowImpreciseAccumulation(attr::MlirAttribute)::Bool -end - -function stablehloDotDimensionNumbersGet(ctx, nLhsBatchingDimensions, lhsBatchingDimensions, nRhsBatchingDimensions, rhsBatchingDimensions, nLhsContractingDimensions, lhsContractingDimensions, nRhsContractingDimensions, rhsContractingDimensions) - @ccall mlir_c.stablehloDotDimensionNumbersGet(ctx::MlirContext, nLhsBatchingDimensions::intptr_t, lhsBatchingDimensions::Ptr{Int64}, nRhsBatchingDimensions::intptr_t, rhsBatchingDimensions::Ptr{Int64}, nLhsContractingDimensions::intptr_t, lhsContractingDimensions::Ptr{Int64}, nRhsContractingDimensions::intptr_t, rhsContractingDimensions::Ptr{Int64})::MlirAttribute + @ccall mlir_c.stablehloDotAlgorithmGetAllowImpreciseAccumulation( + attr::MlirAttribute + )::Bool +end + +function stablehloDotDimensionNumbersGet( + ctx, + nLhsBatchingDimensions, + lhsBatchingDimensions, + nRhsBatchingDimensions, + rhsBatchingDimensions, + nLhsContractingDimensions, + lhsContractingDimensions, + nRhsContractingDimensions, + rhsContractingDimensions, +) + @ccall mlir_c.stablehloDotDimensionNumbersGet( + ctx::MlirContext, + nLhsBatchingDimensions::intptr_t, + lhsBatchingDimensions::Ptr{Int64}, + nRhsBatchingDimensions::intptr_t, + rhsBatchingDimensions::Ptr{Int64}, + nLhsContractingDimensions::intptr_t, + lhsContractingDimensions::Ptr{Int64}, + nRhsContractingDimensions::intptr_t, + rhsContractingDimensions::Ptr{Int64}, + )::MlirAttribute end function stablehloAttributeIsADotDimensionNumbers(attr) @@ -9084,39 +10364,83 @@ function stablehloAttributeIsADotDimensionNumbers(attr) end function stablehloDotDimensionNumbersGetLhsBatchingDimensionsSize(attr) - @ccall mlir_c.stablehloDotDimensionNumbersGetLhsBatchingDimensionsSize(attr::MlirAttribute)::intptr_t + @ccall mlir_c.stablehloDotDimensionNumbersGetLhsBatchingDimensionsSize( + attr::MlirAttribute + )::intptr_t end function stablehloDotDimensionNumbersGetLhsBatchingDimensionsElem(attr, pos) - @ccall mlir_c.stablehloDotDimensionNumbersGetLhsBatchingDimensionsElem(attr::MlirAttribute, pos::intptr_t)::Int64 + @ccall mlir_c.stablehloDotDimensionNumbersGetLhsBatchingDimensionsElem( + attr::MlirAttribute, pos::intptr_t + )::Int64 end function stablehloDotDimensionNumbersGetRhsBatchingDimensionsSize(attr) - @ccall mlir_c.stablehloDotDimensionNumbersGetRhsBatchingDimensionsSize(attr::MlirAttribute)::intptr_t + @ccall mlir_c.stablehloDotDimensionNumbersGetRhsBatchingDimensionsSize( + attr::MlirAttribute + )::intptr_t end function stablehloDotDimensionNumbersGetRhsBatchingDimensionsElem(attr, pos) - @ccall mlir_c.stablehloDotDimensionNumbersGetRhsBatchingDimensionsElem(attr::MlirAttribute, pos::intptr_t)::Int64 + @ccall mlir_c.stablehloDotDimensionNumbersGetRhsBatchingDimensionsElem( + attr::MlirAttribute, pos::intptr_t + )::Int64 end function stablehloDotDimensionNumbersGetLhsContractingDimensionsSize(attr) - @ccall mlir_c.stablehloDotDimensionNumbersGetLhsContractingDimensionsSize(attr::MlirAttribute)::intptr_t + @ccall mlir_c.stablehloDotDimensionNumbersGetLhsContractingDimensionsSize( + attr::MlirAttribute + )::intptr_t end function stablehloDotDimensionNumbersGetLhsContractingDimensionsElem(attr, pos) - @ccall mlir_c.stablehloDotDimensionNumbersGetLhsContractingDimensionsElem(attr::MlirAttribute, pos::intptr_t)::Int64 + @ccall mlir_c.stablehloDotDimensionNumbersGetLhsContractingDimensionsElem( + attr::MlirAttribute, pos::intptr_t + )::Int64 end function stablehloDotDimensionNumbersGetRhsContractingDimensionsSize(attr) - @ccall mlir_c.stablehloDotDimensionNumbersGetRhsContractingDimensionsSize(attr::MlirAttribute)::intptr_t + @ccall mlir_c.stablehloDotDimensionNumbersGetRhsContractingDimensionsSize( + attr::MlirAttribute + )::intptr_t end function stablehloDotDimensionNumbersGetRhsContractingDimensionsElem(attr, pos) - @ccall mlir_c.stablehloDotDimensionNumbersGetRhsContractingDimensionsElem(attr::MlirAttribute, pos::intptr_t)::Int64 -end - -function stablehloConvDimensionNumbersGet(ctx, inputBatchDimension, inputFeatureDimension, nInputSpatialDimensions, inputSpatialDimensions, kernelInputFeatureDimension, kernelOutputFeatureDimension, nKernelSpatialDimensions, kernelSpatialDimensions, outputBatchDimension, outputFeatureDimension, nOutputSpatialDimensions, outputSpatialDimensions) - @ccall mlir_c.stablehloConvDimensionNumbersGet(ctx::MlirContext, inputBatchDimension::Int64, inputFeatureDimension::Int64, nInputSpatialDimensions::intptr_t, inputSpatialDimensions::Ptr{Int64}, kernelInputFeatureDimension::Int64, kernelOutputFeatureDimension::Int64, nKernelSpatialDimensions::intptr_t, kernelSpatialDimensions::Ptr{Int64}, outputBatchDimension::Int64, outputFeatureDimension::Int64, nOutputSpatialDimensions::intptr_t, outputSpatialDimensions::Ptr{Int64})::MlirAttribute + @ccall mlir_c.stablehloDotDimensionNumbersGetRhsContractingDimensionsElem( + attr::MlirAttribute, pos::intptr_t + )::Int64 +end + +function stablehloConvDimensionNumbersGet( + ctx, + inputBatchDimension, + inputFeatureDimension, + nInputSpatialDimensions, + inputSpatialDimensions, + kernelInputFeatureDimension, + kernelOutputFeatureDimension, + nKernelSpatialDimensions, + kernelSpatialDimensions, + outputBatchDimension, + outputFeatureDimension, + nOutputSpatialDimensions, + outputSpatialDimensions, +) + @ccall mlir_c.stablehloConvDimensionNumbersGet( + ctx::MlirContext, + inputBatchDimension::Int64, + inputFeatureDimension::Int64, + nInputSpatialDimensions::intptr_t, + inputSpatialDimensions::Ptr{Int64}, + kernelInputFeatureDimension::Int64, + kernelOutputFeatureDimension::Int64, + nKernelSpatialDimensions::intptr_t, + kernelSpatialDimensions::Ptr{Int64}, + outputBatchDimension::Int64, + outputFeatureDimension::Int64, + nOutputSpatialDimensions::intptr_t, + outputSpatialDimensions::Ptr{Int64}, + )::MlirAttribute end function stablehloAttributeIsAConvDimensionNumbers(attr) @@ -9124,55 +10448,93 @@ function stablehloAttributeIsAConvDimensionNumbers(attr) end function stablehloConvDimensionNumbersGetInputBatchDimension(attr) - @ccall mlir_c.stablehloConvDimensionNumbersGetInputBatchDimension(attr::MlirAttribute)::Int64 + @ccall mlir_c.stablehloConvDimensionNumbersGetInputBatchDimension( + attr::MlirAttribute + )::Int64 end function stablehloConvDimensionNumbersGetInputFeatureDimension(attr) - @ccall mlir_c.stablehloConvDimensionNumbersGetInputFeatureDimension(attr::MlirAttribute)::Int64 + @ccall mlir_c.stablehloConvDimensionNumbersGetInputFeatureDimension( + attr::MlirAttribute + )::Int64 end function stablehloConvDimensionNumbersGetInputSpatialDimensionsSize(attr) - @ccall mlir_c.stablehloConvDimensionNumbersGetInputSpatialDimensionsSize(attr::MlirAttribute)::intptr_t + @ccall mlir_c.stablehloConvDimensionNumbersGetInputSpatialDimensionsSize( + attr::MlirAttribute + )::intptr_t end function stablehloConvDimensionNumbersGetInputSpatialDimensionsElem(attr, pos) - @ccall mlir_c.stablehloConvDimensionNumbersGetInputSpatialDimensionsElem(attr::MlirAttribute, pos::intptr_t)::Int64 + @ccall mlir_c.stablehloConvDimensionNumbersGetInputSpatialDimensionsElem( + attr::MlirAttribute, pos::intptr_t + )::Int64 end function stablehloConvDimensionNumbersGetKernelInputFeatureDimension(attr) - @ccall mlir_c.stablehloConvDimensionNumbersGetKernelInputFeatureDimension(attr::MlirAttribute)::Int64 + @ccall mlir_c.stablehloConvDimensionNumbersGetKernelInputFeatureDimension( + attr::MlirAttribute + )::Int64 end function stablehloConvDimensionNumbersGetKernelOutputFeatureDimension(attr) - @ccall mlir_c.stablehloConvDimensionNumbersGetKernelOutputFeatureDimension(attr::MlirAttribute)::Int64 + @ccall mlir_c.stablehloConvDimensionNumbersGetKernelOutputFeatureDimension( + attr::MlirAttribute + )::Int64 end function stablehloConvDimensionNumbersGetKernelSpatialDimensionsSize(attr) - @ccall mlir_c.stablehloConvDimensionNumbersGetKernelSpatialDimensionsSize(attr::MlirAttribute)::intptr_t + @ccall mlir_c.stablehloConvDimensionNumbersGetKernelSpatialDimensionsSize( + attr::MlirAttribute + )::intptr_t end function stablehloConvDimensionNumbersGetKernelSpatialDimensionsElem(attr, pos) - @ccall mlir_c.stablehloConvDimensionNumbersGetKernelSpatialDimensionsElem(attr::MlirAttribute, pos::intptr_t)::Int64 + @ccall mlir_c.stablehloConvDimensionNumbersGetKernelSpatialDimensionsElem( + attr::MlirAttribute, pos::intptr_t + )::Int64 end function stablehloConvDimensionNumbersGetOutputBatchDimension(attr) - @ccall mlir_c.stablehloConvDimensionNumbersGetOutputBatchDimension(attr::MlirAttribute)::Int64 + @ccall mlir_c.stablehloConvDimensionNumbersGetOutputBatchDimension( + attr::MlirAttribute + )::Int64 end function stablehloConvDimensionNumbersGetOutputFeatureDimension(attr) - @ccall mlir_c.stablehloConvDimensionNumbersGetOutputFeatureDimension(attr::MlirAttribute)::Int64 + @ccall mlir_c.stablehloConvDimensionNumbersGetOutputFeatureDimension( + attr::MlirAttribute + )::Int64 end function stablehloConvDimensionNumbersGetOutputSpatialDimensionsSize(attr) - @ccall mlir_c.stablehloConvDimensionNumbersGetOutputSpatialDimensionsSize(attr::MlirAttribute)::intptr_t + @ccall mlir_c.stablehloConvDimensionNumbersGetOutputSpatialDimensionsSize( + attr::MlirAttribute + )::intptr_t end function stablehloConvDimensionNumbersGetOutputSpatialDimensionsElem(attr, pos) - @ccall mlir_c.stablehloConvDimensionNumbersGetOutputSpatialDimensionsElem(attr::MlirAttribute, pos::intptr_t)::Int64 -end - -function stablehloOutputOperandAliasGet(ctx, nOutputTupleIndices, outputTupleIndices, operandIndex, nOperandTupleIndices, operandTupleIndices) - @ccall mlir_c.stablehloOutputOperandAliasGet(ctx::MlirContext, nOutputTupleIndices::intptr_t, outputTupleIndices::Ptr{Int64}, operandIndex::Int64, nOperandTupleIndices::intptr_t, operandTupleIndices::Ptr{Int64})::MlirAttribute + @ccall mlir_c.stablehloConvDimensionNumbersGetOutputSpatialDimensionsElem( + attr::MlirAttribute, pos::intptr_t + )::Int64 +end + +function stablehloOutputOperandAliasGet( + ctx, + nOutputTupleIndices, + outputTupleIndices, + operandIndex, + nOperandTupleIndices, + operandTupleIndices, +) + @ccall mlir_c.stablehloOutputOperandAliasGet( + ctx::MlirContext, + nOutputTupleIndices::intptr_t, + outputTupleIndices::Ptr{Int64}, + operandIndex::Int64, + nOperandTupleIndices::intptr_t, + operandTupleIndices::Ptr{Int64}, + )::MlirAttribute end function stablehloAttributeIsAOutputOperandAlias(attr) @@ -9180,11 +10542,15 @@ function stablehloAttributeIsAOutputOperandAlias(attr) end function stablehloOutputOperandAliasGetOutputTupleIndicesSize(attr) - @ccall mlir_c.stablehloOutputOperandAliasGetOutputTupleIndicesSize(attr::MlirAttribute)::intptr_t + @ccall mlir_c.stablehloOutputOperandAliasGetOutputTupleIndicesSize( + attr::MlirAttribute + )::intptr_t end function stablehloOutputOperandAliasGetOutputTupleIndicesElem(attr, pos) - @ccall mlir_c.stablehloOutputOperandAliasGetOutputTupleIndicesElem(attr::MlirAttribute, pos::intptr_t)::Int64 + @ccall mlir_c.stablehloOutputOperandAliasGetOutputTupleIndicesElem( + attr::MlirAttribute, pos::intptr_t + )::Int64 end function stablehloOutputOperandAliasGetOperandIndex(attr) @@ -9192,15 +10558,21 @@ function stablehloOutputOperandAliasGetOperandIndex(attr) end function stablehloOutputOperandAliasGetOperandTupleIndicesSize(attr) - @ccall mlir_c.stablehloOutputOperandAliasGetOperandTupleIndicesSize(attr::MlirAttribute)::intptr_t + @ccall mlir_c.stablehloOutputOperandAliasGetOperandTupleIndicesSize( + attr::MlirAttribute + )::intptr_t end function stablehloOutputOperandAliasGetOperandTupleIndicesElem(attr, pos) - @ccall mlir_c.stablehloOutputOperandAliasGetOperandTupleIndicesElem(attr::MlirAttribute, pos::intptr_t)::Int64 + @ccall mlir_c.stablehloOutputOperandAliasGetOperandTupleIndicesElem( + attr::MlirAttribute, pos::intptr_t + )::Int64 end function stablehloComparisonDirectionAttrGet(ctx, value) - @ccall mlir_c.stablehloComparisonDirectionAttrGet(ctx::MlirContext, value::MlirStringRef)::MlirAttribute + @ccall mlir_c.stablehloComparisonDirectionAttrGet( + ctx::MlirContext, value::MlirStringRef + )::MlirAttribute end function stablehloAttributeIsAComparisonDirectionAttr(attr) @@ -9208,11 +10580,15 @@ function stablehloAttributeIsAComparisonDirectionAttr(attr) end function stablehloComparisonDirectionAttrGetValue(attr) - @ccall mlir_c.stablehloComparisonDirectionAttrGetValue(attr::MlirAttribute)::MlirStringRef + @ccall mlir_c.stablehloComparisonDirectionAttrGetValue( + attr::MlirAttribute + )::MlirStringRef end function stablehloComparisonTypeAttrGet(ctx, value) - @ccall mlir_c.stablehloComparisonTypeAttrGet(ctx::MlirContext, value::MlirStringRef)::MlirAttribute + @ccall mlir_c.stablehloComparisonTypeAttrGet( + ctx::MlirContext, value::MlirStringRef + )::MlirAttribute end function stablehloAttributeIsAComparisonTypeAttr(attr) @@ -9224,7 +10600,9 @@ function stablehloComparisonTypeAttrGetValue(attr) end function stablehloPrecisionAttrGet(ctx, value) - @ccall mlir_c.stablehloPrecisionAttrGet(ctx::MlirContext, value::MlirStringRef)::MlirAttribute + @ccall mlir_c.stablehloPrecisionAttrGet( + ctx::MlirContext, value::MlirStringRef + )::MlirAttribute end function stablehloAttributeIsAPrecisionAttr(attr) @@ -9236,7 +10614,9 @@ function stablehloPrecisionAttrGetValue(attr) end function stablehloFftTypeAttrGet(ctx, value) - @ccall mlir_c.stablehloFftTypeAttrGet(ctx::MlirContext, value::MlirStringRef)::MlirAttribute + @ccall mlir_c.stablehloFftTypeAttrGet( + ctx::MlirContext, value::MlirStringRef + )::MlirAttribute end function stablehloAttributeIsAFftTypeAttr(attr) @@ -9248,7 +10628,9 @@ function stablehloFftTypeAttrGetValue(attr) end function stablehloTransposeAttrGet(ctx, value) - @ccall mlir_c.stablehloTransposeAttrGet(ctx::MlirContext, value::MlirStringRef)::MlirAttribute + @ccall mlir_c.stablehloTransposeAttrGet( + ctx::MlirContext, value::MlirStringRef + )::MlirAttribute end function stablehloAttributeIsATransposeAttr(attr) @@ -9260,7 +10642,9 @@ function stablehloTransposeAttrGetValue(attr) end function stablehloRngDistributionAttrGet(ctx, value) - @ccall mlir_c.stablehloRngDistributionAttrGet(ctx::MlirContext, value::MlirStringRef)::MlirAttribute + @ccall mlir_c.stablehloRngDistributionAttrGet( + ctx::MlirContext, value::MlirStringRef + )::MlirAttribute end function stablehloAttributeIsARngDistributionAttr(attr) @@ -9272,7 +10656,9 @@ function stablehloRngDistributionAttrGetValue(attr) end function stablehloRngAlgorithmAttrGet(ctx, value) - @ccall mlir_c.stablehloRngAlgorithmAttrGet(ctx::MlirContext, value::MlirStringRef)::MlirAttribute + @ccall mlir_c.stablehloRngAlgorithmAttrGet( + ctx::MlirContext, value::MlirStringRef + )::MlirAttribute end function stablehloAttributeIsARngAlgorithmAttr(attr) @@ -9284,7 +10670,9 @@ function stablehloRngAlgorithmAttrGetValue(attr) end function stablehloChannelHandleGet(ctx, handle, type) - @ccall mlir_c.stablehloChannelHandleGet(ctx::MlirContext, handle::Int64, type::Int64)::MlirAttribute + @ccall mlir_c.stablehloChannelHandleGet( + ctx::MlirContext, handle::Int64, type::Int64 + )::MlirAttribute end function stablehloAttributeIsChannelHandle(attr) @@ -9300,7 +10688,9 @@ function stablehloChannelHandleGetType(attr) end function stablehloTypeExtensionsGet(ctx, nBounds, bounds) - @ccall mlir_c.stablehloTypeExtensionsGet(ctx::MlirContext, nBounds::intptr_t, bounds::Ptr{Int64})::MlirAttribute + @ccall mlir_c.stablehloTypeExtensionsGet( + ctx::MlirContext, nBounds::intptr_t, bounds::Ptr{Int64} + )::MlirAttribute end function stablehloAttributeIsTypeExtensions(attr) @@ -9312,8 +10702,9 @@ function stablehloTypeExtensionsGetBoundsSize(attr) end function stablehloTypeExtensionsGetBoundsElem(attr, pos) - @ccall mlir_c.stablehloTypeExtensionsGetBoundsElem(attr::MlirAttribute, pos::intptr_t)::Int64 + @ccall mlir_c.stablehloTypeExtensionsGetBoundsElem( + attr::MlirAttribute, pos::intptr_t + )::Int64 end const MLIR_CAPI_DWARF_ADDRESS_SPACE_NULL = -1 -