diff --git a/src/Dialects/14/AMX.jl b/src/Dialects/14/AMX.jl index d3ceb98b..4df6ab3e 100644 --- a/src/Dialects/14/AMX.jl +++ b/src/Dialects/14/AMX.jl @@ -346,8 +346,8 @@ function tile_muli( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(isZextLhs) && push!(attributes, namedattribute("isZextLhs", isZextLhs)) - !isnothing(isZextRhs) && push!(attributes, namedattribute("isZextRhs", isZextRhs)) + !isnothing(isZextLhs) && push!(_attributes, namedattribute("isZextLhs", isZextLhs)) + !isnothing(isZextRhs) && push!(_attributes, namedattribute("isZextRhs", isZextRhs)) return IR.create_operation( "amx.tile_muli", diff --git a/src/Dialects/14/Async.jl b/src/Dialects/14/Async.jl index 1e83a80c..180f463d 100644 --- a/src/Dialects/14/Async.jl +++ b/src/Dialects/14/Async.jl @@ -375,7 +375,7 @@ function execute( _owned_regions = Region[body,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(dependencies), length(operands)])) + push!(_attributes, operandsegmentsizes([length(dependencies), length(operands)])) return IR.create_operation( "async.execute", diff --git a/src/Dialects/14/Builtin.jl b/src/Dialects/14/Builtin.jl index cb4aca85..9f664dbe 100644 --- a/src/Dialects/14/Builtin.jl +++ b/src/Dialects/14/Builtin.jl @@ -52,7 +52,7 @@ function func(; sym_name, type, sym_visibility=nothing, body::Region, location=L namedattribute("sym_name", sym_name), namedattribute("type", type) ] !isnothing(sym_visibility) && - push!(attributes, namedattribute("sym_visibility", sym_visibility)) + push!(_attributes, namedattribute("sym_visibility", sym_visibility)) return IR.create_operation( "builtin.func", @@ -93,9 +93,9 @@ function module_(; _owned_regions = Region[body,] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(sym_name) && push!(attributes, namedattribute("sym_name", sym_name)) + !isnothing(sym_name) && push!(_attributes, namedattribute("sym_name", sym_name)) !isnothing(sym_visibility) && - push!(attributes, namedattribute("sym_visibility", sym_visibility)) + push!(_attributes, namedattribute("sym_visibility", sym_visibility)) return IR.create_operation( "builtin.module", diff --git a/src/Dialects/14/EmitC.jl b/src/Dialects/14/EmitC.jl index d3b67b03..f8b0604a 100644 --- a/src/Dialects/14/EmitC.jl +++ b/src/Dialects/14/EmitC.jl @@ -73,9 +73,9 @@ function call( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[namedattribute("callee", callee),] - !isnothing(args) && push!(attributes, namedattribute("args", args)) + !isnothing(args) && push!(_attributes, namedattribute("args", args)) !isnothing(template_args) && - push!(attributes, namedattribute("template_args", template_args)) + push!(_attributes, namedattribute("template_args", template_args)) return IR.create_operation( "emitc.call", @@ -158,7 +158,7 @@ function include_(; include_, is_standard_include=nothing, location=Location()) _successors = Block[] _attributes = NamedAttribute[namedattribute("include", include_),] !isnothing(is_standard_include) && - push!(attributes, namedattribute("is_standard_include", is_standard_include)) + push!(_attributes, namedattribute("is_standard_include", is_standard_include)) return IR.create_operation( "emitc.include", diff --git a/src/Dialects/14/GPU.jl b/src/Dialects/14/GPU.jl index 61bf3987..4d9e217e 100644 --- a/src/Dialects/14/GPU.jl +++ b/src/Dialects/14/GPU.jl @@ -42,7 +42,7 @@ function all_reduce( _successors = Block[] _attributes = NamedAttribute[] !isnothing(result_0) && push!(_results, result_0) - !isnothing(op) && push!(attributes, namedattribute("op", op)) + !isnothing(op) && push!(_attributes, namedattribute("op", op)) return IR.create_operation( "gpu.all_reduce", @@ -89,7 +89,7 @@ function alloc( _successors = Block[] _attributes = NamedAttribute[] push!( - attributes, + _attributes, operandsegmentsizes([ length(asyncDependencies), length(dynamicSizes), length(symbolOperands) ]), @@ -556,9 +556,9 @@ function launch_func( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[namedattribute("kernel", kernel),] - !isnothing(dynamicSharedMemorySize) && push!(operands, dynamicSharedMemorySize) + !isnothing(dynamicSharedMemorySize) && push!(_operands, dynamicSharedMemorySize) push!( - attributes, + _attributes, operandsegmentsizes([ length(asyncDependencies), 1, @@ -669,7 +669,7 @@ function launch( _owned_regions = Region[body,] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(dynamicSharedMemorySize) && push!(operands, dynamicSharedMemorySize) + !isnothing(dynamicSharedMemorySize) && push!(_operands, dynamicSharedMemorySize) return IR.create_operation( "gpu.launch", diff --git a/src/Dialects/14/LLVMIR.jl b/src/Dialects/14/LLVMIR.jl index c0c58f96..0fe6ab67 100644 --- a/src/Dialects/14/LLVMIR.jl +++ b/src/Dialects/14/LLVMIR.jl @@ -172,7 +172,8 @@ function alias_scope_domain(; sym_name, description=nothing, location=Location() _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[namedattribute("sym_name", sym_name),] - !isnothing(description) && push!(attributes, namedattribute("description", description)) + !isnothing(description) && + push!(_attributes, namedattribute("description", description)) return IR.create_operation( "llvm.alias_scope_domain", @@ -227,7 +228,8 @@ function alias_scope(; sym_name, domain, description=nothing, location=Location( _attributes = NamedAttribute[ namedattribute("sym_name", sym_name), namedattribute("domain", domain) ] - !isnothing(description) && push!(attributes, namedattribute("description", description)) + !isnothing(description) && + push!(_attributes, namedattribute("description", description)) return IR.create_operation( "llvm.alias_scope", @@ -251,7 +253,7 @@ function alloca(arraySize::Value; res::IR.Type, alignment=nothing, location=Loca _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(alignment) && push!(attributes, namedattribute("alignment", alignment)) + !isnothing(alignment) && push!(_attributes, namedattribute("alignment", alignment)) return IR.create_operation( "llvm.alloca", @@ -489,9 +491,9 @@ function call( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(callee) && push!(attributes, namedattribute("callee", callee)) + !isnothing(callee) && push!(_attributes, namedattribute("callee", callee)) !isnothing(fastmathFlags) && - push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) + push!(_attributes, namedattribute("fastmathFlags", fastmathFlags)) return IR.create_operation( "llvm.call", @@ -524,11 +526,11 @@ function cond_br( _successors = Block[trueDest, falseDest] _attributes = NamedAttribute[] push!( - attributes, + _attributes, operandsegmentsizes([1, length(trueDestOperands), length(falseDestOperands)]), ) !isnothing(branch_weights) && - push!(attributes, namedattribute("branch_weights", branch_weights)) + push!(_attributes, namedattribute("branch_weights", branch_weights)) return IR.create_operation( "llvm.cond_br", @@ -1084,7 +1086,7 @@ function fadd( _attributes = NamedAttribute[] !isnothing(res) && push!(_results, res) !isnothing(fastmathFlags) && - push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) + push!(_attributes, namedattribute("fastmathFlags", fastmathFlags)) return IR.create_operation( "llvm.fadd", @@ -1140,7 +1142,7 @@ function fcmp( _successors = Block[] _attributes = NamedAttribute[namedattribute("predicate", predicate),] !isnothing(fastmathFlags) && - push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) + push!(_attributes, namedattribute("fastmathFlags", fastmathFlags)) return IR.create_operation( "llvm.fcmp", @@ -1172,7 +1174,7 @@ function fdiv( _attributes = NamedAttribute[] !isnothing(res) && push!(_results, res) !isnothing(fastmathFlags) && - push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) + push!(_attributes, namedattribute("fastmathFlags", fastmathFlags)) return IR.create_operation( "llvm.fdiv", @@ -1280,7 +1282,7 @@ function fmul( _attributes = NamedAttribute[] !isnothing(res) && push!(_results, res) !isnothing(fastmathFlags) && - push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) + push!(_attributes, namedattribute("fastmathFlags", fastmathFlags)) return IR.create_operation( "llvm.fmul", @@ -1311,7 +1313,7 @@ function fneg( _attributes = NamedAttribute[] !isnothing(res) && push!(_results, res) !isnothing(fastmathFlags) && - push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) + push!(_attributes, namedattribute("fastmathFlags", fastmathFlags)) return IR.create_operation( "llvm.fneg", @@ -1435,7 +1437,7 @@ function frem( _attributes = NamedAttribute[] !isnothing(res) && push!(_results, res) !isnothing(fastmathFlags) && - push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) + push!(_attributes, namedattribute("fastmathFlags", fastmathFlags)) return IR.create_operation( "llvm.frem", @@ -1467,7 +1469,7 @@ function fsub( _attributes = NamedAttribute[] !isnothing(res) && push!(_results, res) !isnothing(fastmathFlags) && - push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) + push!(_attributes, namedattribute("fastmathFlags", fastmathFlags)) return IR.create_operation( "llvm.fsub", @@ -1781,14 +1783,14 @@ function mlir_global(; 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(value) && push!(attributes, namedattribute("value", value)) - !isnothing(alignment) && push!(attributes, namedattribute("alignment", alignment)) - !isnothing(addr_space) && push!(attributes, namedattribute("addr_space", addr_space)) + !isnothing(constant) && push!(_attributes, namedattribute("constant", constant)) + !isnothing(dso_local) && push!(_attributes, namedattribute("dso_local", dso_local)) + !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(section) && push!(attributes, namedattribute("section", section)) + push!(_attributes, namedattribute("unnamed_addr", unnamed_addr)) + !isnothing(section) && push!(_attributes, namedattribute("section", section)) return IR.create_operation( "llvm.mlir.global", @@ -1855,12 +1857,13 @@ function inline_asm( ] !isnothing(res) && push!(_results, res) !isnothing(has_side_effects) && - push!(attributes, namedattribute("has_side_effects", 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)) + 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)) + push!(_attributes, namedattribute("operand_attrs", operand_attrs)) return IR.create_operation( "llvm.inline_asm", @@ -1967,12 +1970,12 @@ function invoke( _successors = Block[normalDest, unwindDest] _attributes = NamedAttribute[] push!( - attributes, + _attributes, operandsegmentsizes([ length(callee_operands), length(normalDestOperands), length(unwindDestOperands) ]), ) - !isnothing(callee) && push!(attributes, namedattribute("callee", callee)) + !isnothing(callee) && push!(_attributes, namedattribute("callee", callee)) return IR.create_operation( "llvm.invoke", @@ -2028,10 +2031,12 @@ function func(; _owned_regions = Region[body,] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(linkage) && push!(attributes, namedattribute("linkage", linkage)) - !isnothing(dso_local) && push!(attributes, namedattribute("dso_local", dso_local)) - !isnothing(personality) && push!(attributes, namedattribute("personality", personality)) - !isnothing(passthrough) && push!(attributes, namedattribute("passthrough", passthrough)) + !isnothing(linkage) && push!(_attributes, namedattribute("linkage", linkage)) + !isnothing(dso_local) && push!(_attributes, namedattribute("dso_local", dso_local)) + !isnothing(personality) && + push!(_attributes, namedattribute("personality", personality)) + !isnothing(passthrough) && + push!(_attributes, namedattribute("passthrough", passthrough)) return IR.create_operation( "llvm.func", @@ -2083,7 +2088,7 @@ function landingpad( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(cleanup) && push!(attributes, namedattribute("cleanup", cleanup)) + !isnothing(cleanup) && push!(_attributes, namedattribute("cleanup", cleanup)) return IR.create_operation( "llvm.landingpad", @@ -2118,14 +2123,15 @@ function load( _successors = Block[] _attributes = NamedAttribute[] !isnothing(access_groups) && - push!(attributes, namedattribute("access_groups", access_groups)) + push!(_attributes, namedattribute("access_groups", access_groups)) !isnothing(alias_scopes) && - push!(attributes, namedattribute("alias_scopes", alias_scopes)) + push!(_attributes, namedattribute("alias_scopes", alias_scopes)) !isnothing(noalias_scopes) && - push!(attributes, namedattribute("noalias_scopes", noalias_scopes)) - !isnothing(alignment) && push!(attributes, namedattribute("alignment", alignment)) - !isnothing(volatile_) && push!(attributes, namedattribute("volatile_", volatile_)) - !isnothing(nontemporal) && push!(attributes, namedattribute("nontemporal", nontemporal)) + push!(_attributes, namedattribute("noalias_scopes", noalias_scopes)) + !isnothing(alignment) && push!(_attributes, namedattribute("alignment", alignment)) + !isnothing(volatile_) && push!(_attributes, namedattribute("volatile_", volatile_)) + !isnothing(nontemporal) && + push!(_attributes, namedattribute("nontemporal", nontemporal)) return IR.create_operation( "llvm.load", @@ -3278,14 +3284,15 @@ function store( _successors = Block[] _attributes = NamedAttribute[] !isnothing(access_groups) && - push!(attributes, namedattribute("access_groups", access_groups)) + push!(_attributes, namedattribute("access_groups", access_groups)) !isnothing(alias_scopes) && - push!(attributes, namedattribute("alias_scopes", alias_scopes)) + push!(_attributes, namedattribute("alias_scopes", alias_scopes)) !isnothing(noalias_scopes) && - push!(attributes, namedattribute("noalias_scopes", noalias_scopes)) - !isnothing(alignment) && push!(attributes, namedattribute("alignment", alignment)) - !isnothing(volatile_) && push!(attributes, namedattribute("volatile_", volatile_)) - !isnothing(nontemporal) && push!(attributes, namedattribute("nontemporal", nontemporal)) + push!(_attributes, namedattribute("noalias_scopes", noalias_scopes)) + !isnothing(alignment) && push!(_attributes, namedattribute("alignment", alignment)) + !isnothing(volatile_) && push!(_attributes, namedattribute("volatile_", volatile_)) + !isnothing(nontemporal) && + push!(_attributes, namedattribute("nontemporal", nontemporal)) return IR.create_operation( "llvm.store", @@ -3348,11 +3355,12 @@ function switch( "case_operand_segments", case_operand_segments ),] push!( - attributes, operandsegmentsizes([1, length(defaultOperands), length(caseOperands)]) + _attributes, operandsegmentsizes([1, length(defaultOperands), length(caseOperands)]) ) - !isnothing(case_values) && push!(attributes, namedattribute("case_values", case_values)) + !isnothing(case_values) && + push!(_attributes, namedattribute("case_values", case_values)) !isnothing(branch_weights) && - push!(attributes, namedattribute("branch_weights", branch_weights)) + push!(_attributes, namedattribute("branch_weights", branch_weights)) return IR.create_operation( "llvm.switch", @@ -3860,7 +3868,7 @@ function intr_vector_reduce_fadd( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(reassoc) && push!(attributes, namedattribute("reassoc", reassoc)) + !isnothing(reassoc) && push!(_attributes, namedattribute("reassoc", reassoc)) return IR.create_operation( "llvm.intr.vector.reduce.fadd", @@ -3932,7 +3940,7 @@ function intr_vector_reduce_fmul( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(reassoc) && push!(attributes, namedattribute("reassoc", reassoc)) + !isnothing(reassoc) && push!(_attributes, namedattribute("reassoc", reassoc)) return IR.create_operation( "llvm.intr.vector.reduce.fmul", @@ -4499,7 +4507,7 @@ function shfl_sync( _successors = Block[] _attributes = NamedAttribute[namedattribute("kind", kind),] !isnothing(return_value_and_is_valid) && push!( - attributes, + _attributes, namedattribute("return_value_and_is_valid", return_value_and_is_valid), ) diff --git a/src/Dialects/14/Linalg.jl b/src/Dialects/14/Linalg.jl index 2ca7de26..0edb6af6 100644 --- a/src/Dialects/14/Linalg.jl +++ b/src/Dialects/14/Linalg.jl @@ -175,7 +175,7 @@ function tiled_loop( _successors = Block[] _attributes = NamedAttribute[namedattribute("iterator_types", iterator_types),] push!( - attributes, + _attributes, operandsegmentsizes([ length(lowerBound), length(upperBound), @@ -185,7 +185,7 @@ function tiled_loop( ]), ) !isnothing(distribution_types) && - push!(attributes, namedattribute("distribution_types", distribution_types)) + push!(_attributes, namedattribute("distribution_types", distribution_types)) return IR.create_operation( "linalg.tiled_loop", @@ -253,7 +253,7 @@ function batch_matmul( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) return IR.create_operation( "linalg.batch_matmul", @@ -285,7 +285,7 @@ function batch_matvec( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) return IR.create_operation( "linalg.batch_matvec", @@ -321,7 +321,7 @@ function conv_1d_nwc_wcf( _attributes = NamedAttribute[ namedattribute("strides", strides), namedattribute("dilations", dilations) ] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) return IR.create_operation( "linalg.conv_1d_nwc_wcf", @@ -353,7 +353,7 @@ function conv_1d( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) return IR.create_operation( "linalg.conv_1d", @@ -393,7 +393,7 @@ function conv_2d_nchw_fchw( _attributes = NamedAttribute[ namedattribute("strides", strides), namedattribute("dilations", dilations) ] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) return IR.create_operation( "linalg.conv_2d_nchw_fchw", @@ -433,7 +433,7 @@ function conv_2d_nhwc_hwcf( _attributes = NamedAttribute[ namedattribute("strides", strides), namedattribute("dilations", dilations) ] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) return IR.create_operation( "linalg.conv_2d_nhwc_hwcf", @@ -474,7 +474,7 @@ function conv_2d_nhwc_hwcf_q( _attributes = NamedAttribute[ namedattribute("strides", strides), namedattribute("dilations", dilations) ] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) return IR.create_operation( "linalg.conv_2d_nhwc_hwcf_q", @@ -506,7 +506,7 @@ function conv_2d( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) return IR.create_operation( "linalg.conv_2d", @@ -542,7 +542,7 @@ function conv_3d_ndhwc_dhwcf( _attributes = NamedAttribute[ namedattribute("strides", strides), namedattribute("dilations", dilations) ] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) return IR.create_operation( "linalg.conv_3d_ndhwc_dhwcf", @@ -574,7 +574,7 @@ function conv_3d( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) return IR.create_operation( "linalg.conv_3d", @@ -611,7 +611,7 @@ function depthwise_conv_1d_nwc_wc( _attributes = NamedAttribute[ namedattribute("strides", strides), namedattribute("dilations", dilations) ] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) return IR.create_operation( "linalg.depthwise_conv_1d_nwc_wc", @@ -648,7 +648,7 @@ function depthwise_conv_2d_nhwc_hwc( _attributes = NamedAttribute[ namedattribute("strides", strides), namedattribute("dilations", dilations) ] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) return IR.create_operation( "linalg.depthwise_conv_2d_nhwc_hwc", @@ -684,7 +684,7 @@ function depthwise_conv_2d_nhwc_hwc_q( _attributes = NamedAttribute[ namedattribute("strides", strides), namedattribute("dilations", dilations) ] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) return IR.create_operation( "linalg.depthwise_conv_2d_nhwc_hwc_q", @@ -720,7 +720,7 @@ function depthwise_conv_2d_nhwc_hwcm( _attributes = NamedAttribute[ namedattribute("strides", strides), namedattribute("dilations", dilations) ] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) return IR.create_operation( "linalg.depthwise_conv_2d_nhwc_hwcm", @@ -756,7 +756,7 @@ function depthwise_conv_2d_nhwc_hwcm_q( _attributes = NamedAttribute[ namedattribute("strides", strides), namedattribute("dilations", dilations) ] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) return IR.create_operation( "linalg.depthwise_conv_2d_nhwc_hwcm_q", @@ -788,7 +788,7 @@ function dot( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) return IR.create_operation( "linalg.dot", @@ -855,7 +855,7 @@ function fill_rng_2d( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) return IR.create_operation( "linalg.fill_rng_2d", @@ -987,10 +987,10 @@ function generic( namedattribute("indexing_maps", indexing_maps), namedattribute("iterator_types", iterator_types), ] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(doc) && push!(attributes, namedattribute("doc", doc)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(doc) && push!(_attributes, namedattribute("doc", doc)) !isnothing(library_call) && - push!(attributes, namedattribute("library_call", library_call)) + push!(_attributes, namedattribute("library_call", library_call)) return IR.create_operation( "linalg.generic", @@ -1022,7 +1022,7 @@ function matmul( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) return IR.create_operation( "linalg.matmul", @@ -1054,7 +1054,7 @@ function matmul_unsigned( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) return IR.create_operation( "linalg.matmul_unsigned", @@ -1086,7 +1086,7 @@ function matvec( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) return IR.create_operation( "linalg.matvec", @@ -1123,7 +1123,7 @@ function mmt4d( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) return IR.create_operation( "linalg.mmt4d", @@ -1159,7 +1159,7 @@ function pooling_nchw_max( _attributes = NamedAttribute[ namedattribute("strides", strides), namedattribute("dilations", dilations) ] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) return IR.create_operation( "linalg.pooling_nchw_max", @@ -1195,7 +1195,7 @@ function pooling_ndhwc_max( _attributes = NamedAttribute[ namedattribute("strides", strides), namedattribute("dilations", dilations) ] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) return IR.create_operation( "linalg.pooling_ndhwc_max", @@ -1231,7 +1231,7 @@ function pooling_ndhwc_min( _attributes = NamedAttribute[ namedattribute("strides", strides), namedattribute("dilations", dilations) ] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) return IR.create_operation( "linalg.pooling_ndhwc_min", @@ -1267,7 +1267,7 @@ function pooling_ndhwc_sum( _attributes = NamedAttribute[ namedattribute("strides", strides), namedattribute("dilations", dilations) ] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) return IR.create_operation( "linalg.pooling_ndhwc_sum", @@ -1303,7 +1303,7 @@ function pooling_nhwc_max( _attributes = NamedAttribute[ namedattribute("strides", strides), namedattribute("dilations", dilations) ] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) return IR.create_operation( "linalg.pooling_nhwc_max", @@ -1339,7 +1339,7 @@ function pooling_nhwc_max_unsigned( _attributes = NamedAttribute[ namedattribute("strides", strides), namedattribute("dilations", dilations) ] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) return IR.create_operation( "linalg.pooling_nhwc_max_unsigned", @@ -1375,7 +1375,7 @@ function pooling_nhwc_min( _attributes = NamedAttribute[ namedattribute("strides", strides), namedattribute("dilations", dilations) ] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) return IR.create_operation( "linalg.pooling_nhwc_min", @@ -1411,7 +1411,7 @@ function pooling_nhwc_min_unsigned( _attributes = NamedAttribute[ namedattribute("strides", strides), namedattribute("dilations", dilations) ] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) return IR.create_operation( "linalg.pooling_nhwc_min_unsigned", @@ -1447,7 +1447,7 @@ function pooling_nhwc_sum( _attributes = NamedAttribute[ namedattribute("strides", strides), namedattribute("dilations", dilations) ] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) return IR.create_operation( "linalg.pooling_nhwc_sum", @@ -1481,7 +1481,7 @@ function quantized_batch_matmul( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) return IR.create_operation( "linalg.quantized_batch_matmul", @@ -1515,7 +1515,7 @@ function quantized_matmul( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) return IR.create_operation( "linalg.quantized_matmul", @@ -1547,7 +1547,7 @@ function soft_plus_2d( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) return IR.create_operation( "linalg.soft_plus_2d", @@ -1579,7 +1579,7 @@ function vecmat( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) return IR.create_operation( "linalg.vecmat", diff --git a/src/Dialects/14/MemRef.jl b/src/Dialects/14/MemRef.jl index e5f22574..4e85cff4 100644 --- a/src/Dialects/14/MemRef.jl +++ b/src/Dialects/14/MemRef.jl @@ -293,8 +293,8 @@ function alloc( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(dynamicSizes), length(symbolOperands)])) - !isnothing(alignment) && push!(attributes, namedattribute("alignment", alignment)) + push!(_attributes, operandsegmentsizes([length(dynamicSizes), length(symbolOperands)])) + !isnothing(alignment) && push!(_attributes, namedattribute("alignment", alignment)) return IR.create_operation( "memref.alloc", @@ -357,8 +357,8 @@ function alloca( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(dynamicSizes), length(symbolOperands)])) - !isnothing(alignment) && push!(attributes, namedattribute("alignment", alignment)) + push!(_attributes, operandsegmentsizes([length(dynamicSizes), length(symbolOperands)])) + !isnothing(alignment) && push!(_attributes, namedattribute("alignment", alignment)) return IR.create_operation( "memref.alloca", @@ -910,11 +910,11 @@ function global_(; namedattribute("sym_name", sym_name), namedattribute("type", type) ] !isnothing(sym_visibility) && - push!(attributes, namedattribute("sym_visibility", sym_visibility)) + push!(_attributes, namedattribute("sym_visibility", sym_visibility)) !isnothing(initial_value) && - push!(attributes, namedattribute("initial_value", initial_value)) - !isnothing(constant) && push!(attributes, namedattribute("constant", constant)) - !isnothing(alignment) && push!(attributes, namedattribute("alignment", alignment)) + push!(_attributes, namedattribute("initial_value", initial_value)) + !isnothing(constant) && push!(_attributes, namedattribute("constant", constant)) + !isnothing(alignment) && push!(_attributes, namedattribute("alignment", alignment)) return IR.create_operation( "memref.global", @@ -1048,7 +1048,7 @@ function reinterpret_cast( namedattribute("static_strides", static_strides), ] push!( - attributes, + _attributes, operandsegmentsizes([1, length(offsets), length(sizes), length(strides)]), ) @@ -1418,7 +1418,7 @@ function subview( namedattribute("static_strides", static_strides), ] push!( - attributes, + _attributes, operandsegmentsizes([1, length(offsets), length(sizes), length(strides)]), ) diff --git a/src/Dialects/14/OpenACC.jl b/src/Dialects/14/OpenACC.jl index 2907d651..0779ee39 100644 --- a/src/Dialects/14/OpenACC.jl +++ b/src/Dialects/14/OpenACC.jl @@ -56,9 +56,9 @@ function data( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(ifCond) && push!(operands, ifCond) + !isnothing(ifCond) && push!(_operands, ifCond) push!( - attributes, + _attributes, operandsegmentsizes([ isnothing(ifCond) ? 0 : 1, length(copyOperands), @@ -74,7 +74,8 @@ function data( length(attachOperands), ]), ) - !isnothing(defaultAttr) && push!(attributes, namedattribute("defaultAttr", defaultAttr)) + !isnothing(defaultAttr) && + push!(_attributes, namedattribute("defaultAttr", defaultAttr)) return IR.create_operation( "acc.data", @@ -123,11 +124,11 @@ function enter_data( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(ifCond) && push!(operands, ifCond) - !isnothing(asyncOperand) && push!(operands, asyncOperand) - !isnothing(waitDevnum) && push!(operands, waitDevnum) + !isnothing(ifCond) && push!(_operands, ifCond) + !isnothing(asyncOperand) && push!(_operands, asyncOperand) + !isnothing(waitDevnum) && push!(_operands, waitDevnum) push!( - attributes, + _attributes, operandsegmentsizes([ isnothing(ifCond) ? 0 : 1, isnothing(asyncOperand) ? 0 : 1, @@ -139,8 +140,8 @@ function enter_data( length(attachOperands), ]), ) - !isnothing(async) && push!(attributes, namedattribute("async", async)) - !isnothing(wait) && push!(attributes, namedattribute("wait", wait)) + !isnothing(async) && push!(_attributes, namedattribute("async", async)) + !isnothing(wait) && push!(_attributes, namedattribute("wait", wait)) return IR.create_operation( "acc.enter_data", @@ -185,11 +186,11 @@ function exit_data( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(ifCond) && push!(operands, ifCond) - !isnothing(asyncOperand) && push!(operands, asyncOperand) - !isnothing(waitDevnum) && push!(operands, waitDevnum) + !isnothing(ifCond) && push!(_operands, ifCond) + !isnothing(asyncOperand) && push!(_operands, asyncOperand) + !isnothing(waitDevnum) && push!(_operands, waitDevnum) push!( - attributes, + _attributes, operandsegmentsizes([ isnothing(ifCond) ? 0 : 1, isnothing(asyncOperand) ? 0 : 1, @@ -200,9 +201,9 @@ function exit_data( length(detachOperands), ]), ) - !isnothing(async) && push!(attributes, namedattribute("async", async)) - !isnothing(wait) && push!(attributes, namedattribute("wait", wait)) - !isnothing(finalize) && push!(attributes, namedattribute("finalize", finalize)) + !isnothing(async) && push!(_attributes, namedattribute("async", async)) + !isnothing(wait) && push!(_attributes, namedattribute("wait", wait)) + !isnothing(finalize) && push!(_attributes, namedattribute("finalize", finalize)) return IR.create_operation( "acc.exit_data", @@ -240,10 +241,10 @@ function init( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(deviceNumOperand) && push!(operands, deviceNumOperand) - !isnothing(ifCond) && push!(operands, ifCond) + !isnothing(deviceNumOperand) && push!(_operands, deviceNumOperand) + !isnothing(ifCond) && push!(_operands, ifCond) push!( - attributes, + _attributes, operandsegmentsizes([ length(deviceTypeOperands), isnothing(deviceNumOperand) ? 0 : 1, @@ -306,12 +307,12 @@ function loop( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(gangNum) && push!(operands, gangNum) - !isnothing(gangStatic) && push!(operands, gangStatic) - !isnothing(workerNum) && push!(operands, workerNum) - !isnothing(vectorLength) && push!(operands, vectorLength) + !isnothing(gangNum) && push!(_operands, gangNum) + !isnothing(gangStatic) && push!(_operands, gangStatic) + !isnothing(workerNum) && push!(_operands, workerNum) + !isnothing(vectorLength) && push!(_operands, vectorLength) push!( - attributes, + _attributes, operandsegmentsizes([ isnothing(gangNum) ? 0 : 1, isnothing(gangStatic) ? 0 : 1, @@ -322,13 +323,15 @@ function loop( length(reductionOperands), ]), ) - !isnothing(collapse) && push!(attributes, namedattribute("collapse", collapse)) - !isnothing(seq) && push!(attributes, namedattribute("seq", seq)) - !isnothing(independent) && push!(attributes, namedattribute("independent", independent)) - !isnothing(auto_) && push!(attributes, namedattribute("auto_", auto_)) - !isnothing(reductionOp) && push!(attributes, namedattribute("reductionOp", reductionOp)) + !isnothing(collapse) && push!(_attributes, namedattribute("collapse", collapse)) + !isnothing(seq) && push!(_attributes, namedattribute("seq", seq)) + !isnothing(independent) && + push!(_attributes, namedattribute("independent", independent)) + !isnothing(auto_) && push!(_attributes, namedattribute("auto_", auto_)) + !isnothing(reductionOp) && + push!(_attributes, namedattribute("reductionOp", reductionOp)) !isnothing(exec_mapping) && - push!(attributes, namedattribute("exec_mapping", exec_mapping)) + push!(_attributes, namedattribute("exec_mapping", exec_mapping)) return IR.create_operation( "acc.loop", @@ -408,14 +411,14 @@ function parallel( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(async) && push!(operands, async) - !isnothing(numGangs) && push!(operands, numGangs) - !isnothing(numWorkers) && push!(operands, numWorkers) - !isnothing(vectorLength) && push!(operands, vectorLength) - !isnothing(ifCond) && push!(operands, ifCond) - !isnothing(selfCond) && push!(operands, selfCond) + !isnothing(async) && push!(_operands, async) + !isnothing(numGangs) && push!(_operands, numGangs) + !isnothing(numWorkers) && push!(_operands, numWorkers) + !isnothing(vectorLength) && push!(_operands, vectorLength) + !isnothing(ifCond) && push!(_operands, ifCond) + !isnothing(selfCond) && push!(_operands, selfCond) push!( - attributes, + _attributes, operandsegmentsizes([ isnothing(async) ? 0 : 1, length(waitOperands), @@ -440,11 +443,13 @@ function parallel( length(gangFirstPrivateOperands), ]), ) - !isnothing(asyncAttr) && push!(attributes, namedattribute("asyncAttr", asyncAttr)) - !isnothing(waitAttr) && push!(attributes, namedattribute("waitAttr", waitAttr)) - !isnothing(selfAttr) && push!(attributes, namedattribute("selfAttr", selfAttr)) - !isnothing(reductionOp) && push!(attributes, namedattribute("reductionOp", reductionOp)) - !isnothing(defaultAttr) && push!(attributes, namedattribute("defaultAttr", defaultAttr)) + !isnothing(asyncAttr) && push!(_attributes, namedattribute("asyncAttr", asyncAttr)) + !isnothing(waitAttr) && push!(_attributes, namedattribute("waitAttr", waitAttr)) + !isnothing(selfAttr) && push!(_attributes, namedattribute("selfAttr", selfAttr)) + !isnothing(reductionOp) && + push!(_attributes, namedattribute("reductionOp", reductionOp)) + !isnothing(defaultAttr) && + push!(_attributes, namedattribute("defaultAttr", defaultAttr)) return IR.create_operation( "acc.parallel", @@ -482,10 +487,10 @@ function shutdown( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(deviceNumOperand) && push!(operands, deviceNumOperand) - !isnothing(ifCond) && push!(operands, ifCond) + !isnothing(deviceNumOperand) && push!(_operands, deviceNumOperand) + !isnothing(ifCond) && push!(_operands, ifCond) push!( - attributes, + _attributes, operandsegmentsizes([ length(deviceTypeOperands), isnothing(deviceNumOperand) ? 0 : 1, @@ -566,11 +571,11 @@ function update( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(ifCond) && push!(operands, ifCond) - !isnothing(asyncOperand) && push!(operands, asyncOperand) - !isnothing(waitDevnum) && push!(operands, waitDevnum) + !isnothing(ifCond) && push!(_operands, ifCond) + !isnothing(asyncOperand) && push!(_operands, asyncOperand) + !isnothing(waitDevnum) && push!(_operands, waitDevnum) push!( - attributes, + _attributes, operandsegmentsizes([ isnothing(ifCond) ? 0 : 1, isnothing(asyncOperand) ? 0 : 1, @@ -581,9 +586,9 @@ function update( length(deviceOperands), ]), ) - !isnothing(async) && push!(attributes, namedattribute("async", async)) - !isnothing(wait) && push!(attributes, namedattribute("wait", wait)) - !isnothing(ifPresent) && push!(attributes, namedattribute("ifPresent", ifPresent)) + !isnothing(async) && push!(_attributes, namedattribute("async", async)) + !isnothing(wait) && push!(_attributes, namedattribute("wait", wait)) + !isnothing(ifPresent) && push!(_attributes, namedattribute("ifPresent", ifPresent)) return IR.create_operation( "acc.update", @@ -623,11 +628,11 @@ function wait( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(asyncOperand) && push!(operands, asyncOperand) - !isnothing(waitDevnum) && push!(operands, waitDevnum) - !isnothing(ifCond) && push!(operands, ifCond) + !isnothing(asyncOperand) && push!(_operands, asyncOperand) + !isnothing(waitDevnum) && push!(_operands, waitDevnum) + !isnothing(ifCond) && push!(_operands, ifCond) push!( - attributes, + _attributes, operandsegmentsizes([ length(waitOperands), isnothing(asyncOperand) ? 0 : 1, @@ -635,7 +640,7 @@ function wait( isnothing(ifCond) ? 0 : 1, ]), ) - !isnothing(async) && push!(attributes, namedattribute("async", async)) + !isnothing(async) && push!(_attributes, namedattribute("async", async)) return IR.create_operation( "acc.wait", diff --git a/src/Dialects/14/OpenMP.jl b/src/Dialects/14/OpenMP.jl index b0c75168..4154f865 100644 --- a/src/Dialects/14/OpenMP.jl +++ b/src/Dialects/14/OpenMP.jl @@ -45,9 +45,9 @@ function atomic_capture(; _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(hint) && push!(attributes, namedattribute("hint", hint)) + !isnothing(hint) && push!(_attributes, namedattribute("hint", hint)) !isnothing(memory_order) && - push!(attributes, namedattribute("memory_order", memory_order)) + push!(_attributes, namedattribute("memory_order", memory_order)) return IR.create_operation( "omp.atomic.capture", @@ -84,9 +84,9 @@ function atomic_read( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(hint) && push!(attributes, namedattribute("hint", hint)) + !isnothing(hint) && push!(_attributes, namedattribute("hint", hint)) !isnothing(memory_order) && - push!(attributes, namedattribute("memory_order", memory_order)) + push!(_attributes, namedattribute("memory_order", memory_order)) return IR.create_operation( "omp.atomic.read", @@ -139,10 +139,10 @@ function atomic_update( _successors = Block[] _attributes = NamedAttribute[namedattribute("binop", binop),] !isnothing(isXBinopExpr) && - push!(attributes, namedattribute("isXBinopExpr", isXBinopExpr)) - !isnothing(hint) && push!(attributes, namedattribute("hint", hint)) + push!(_attributes, namedattribute("isXBinopExpr", isXBinopExpr)) + !isnothing(hint) && push!(_attributes, namedattribute("hint", hint)) !isnothing(memory_order) && - push!(attributes, namedattribute("memory_order", memory_order)) + push!(_attributes, namedattribute("memory_order", memory_order)) return IR.create_operation( "omp.atomic.update", @@ -181,9 +181,9 @@ function atomic_write( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(hint) && push!(attributes, namedattribute("hint", hint)) + !isnothing(hint) && push!(_attributes, namedattribute("hint", hint)) !isnothing(memory_order) && - push!(attributes, namedattribute("memory_order", memory_order)) + push!(_attributes, namedattribute("memory_order", memory_order)) return IR.create_operation( "omp.atomic.write", @@ -235,7 +235,7 @@ function critical_declare(; sym_name, hint=nothing, location=Location()) _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[namedattribute("sym_name", sym_name),] - !isnothing(hint) && push!(attributes, namedattribute("hint", hint)) + !isnothing(hint) && push!(_attributes, namedattribute("hint", hint)) return IR.create_operation( "omp.critical.declare", @@ -261,7 +261,7 @@ function critical(; name=nothing, region::Region, location=Location()) _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(name) && push!(attributes, namedattribute("name", name)) + !isnothing(name) && push!(_attributes, namedattribute("name", name)) return IR.create_operation( "omp.critical", @@ -357,9 +357,9 @@ function ordered( _successors = Block[] _attributes = NamedAttribute[] !isnothing(depend_type_val) && - push!(attributes, namedattribute("depend_type_val", depend_type_val)) + push!(_attributes, namedattribute("depend_type_val", depend_type_val)) !isnothing(num_loops_val) && - push!(attributes, namedattribute("num_loops_val", num_loops_val)) + push!(_attributes, namedattribute("num_loops_val", num_loops_val)) return IR.create_operation( "omp.ordered", @@ -390,7 +390,7 @@ function ordered_region(; simd=nothing, region::Region, location=Location()) _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(simd) && push!(attributes, namedattribute("simd", simd)) + !isnothing(simd) && push!(_attributes, namedattribute("simd", simd)) return IR.create_operation( "omp.ordered_region", @@ -458,10 +458,10 @@ function parallel( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(if_expr_var) && push!(operands, if_expr_var) - !isnothing(num_threads_var) && push!(operands, num_threads_var) + !isnothing(if_expr_var) && push!(_operands, if_expr_var) + !isnothing(num_threads_var) && push!(_operands, num_threads_var) push!( - attributes, + _attributes, operandsegmentsizes([ isnothing(if_expr_var) ? 0 : 1, isnothing(num_threads_var) ? 0 : 1, @@ -473,9 +473,10 @@ function parallel( length(allocators_vars), ]), ) - !isnothing(default_val) && push!(attributes, namedattribute("default_val", default_val)) + !isnothing(default_val) && + push!(_attributes, namedattribute("default_val", default_val)) !isnothing(proc_bind_val) && - push!(attributes, namedattribute("proc_bind_val", proc_bind_val)) + push!(_attributes, namedattribute("proc_bind_val", proc_bind_val)) return IR.create_operation( "omp.parallel", @@ -648,7 +649,7 @@ function sections( _successors = Block[] _attributes = NamedAttribute[] push!( - attributes, + _attributes, operandsegmentsizes([ length(private_vars), length(firstprivate_vars), @@ -658,8 +659,8 @@ function sections( length(allocators_vars), ]), ) - !isnothing(reductions) && push!(attributes, namedattribute("reductions", reductions)) - !isnothing(nowait) && push!(attributes, namedattribute("nowait", nowait)) + !isnothing(reductions) && push!(_attributes, namedattribute("reductions", reductions)) + !isnothing(nowait) && push!(_attributes, namedattribute("nowait", nowait)) return IR.create_operation( "omp.sections", @@ -706,18 +707,18 @@ function target( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(if_expr) && push!(operands, if_expr) - !isnothing(device) && push!(operands, device) - !isnothing(thread_limit) && push!(operands, thread_limit) + !isnothing(if_expr) && push!(_operands, if_expr) + !isnothing(device) && push!(_operands, device) + !isnothing(thread_limit) && push!(_operands, thread_limit) push!( - attributes, + _attributes, operandsegmentsizes([ isnothing(if_expr) ? 0 : 1, isnothing(device) ? 0 : 1, isnothing(thread_limit) ? 0 : 1, ]), ) - !isnothing(nowait) && push!(attributes, namedattribute("nowait", nowait)) + !isnothing(nowait) && push!(_attributes, namedattribute("nowait", nowait)) return IR.create_operation( "omp.target", @@ -906,9 +907,9 @@ function wsloop( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(schedule_chunk_var) && push!(operands, schedule_chunk_var) + !isnothing(schedule_chunk_var) && push!(_operands, schedule_chunk_var) push!( - attributes, + _attributes, operandsegmentsizes([ length(lowerBound), length(upperBound), @@ -922,19 +923,20 @@ function wsloop( isnothing(schedule_chunk_var) ? 0 : 1, ]), ) - !isnothing(reductions) && push!(attributes, namedattribute("reductions", reductions)) + !isnothing(reductions) && push!(_attributes, namedattribute("reductions", reductions)) !isnothing(schedule_val) && - push!(attributes, namedattribute("schedule_val", schedule_val)) + push!(_attributes, namedattribute("schedule_val", schedule_val)) !isnothing(schedule_modifier) && - push!(attributes, namedattribute("schedule_modifier", schedule_modifier)) + push!(_attributes, namedattribute("schedule_modifier", schedule_modifier)) !isnothing(simd_modifier) && - push!(attributes, namedattribute("simd_modifier", simd_modifier)) + push!(_attributes, namedattribute("simd_modifier", simd_modifier)) !isnothing(collapse_val) && - push!(attributes, namedattribute("collapse_val", collapse_val)) - !isnothing(nowait) && push!(attributes, namedattribute("nowait", nowait)) - !isnothing(ordered_val) && push!(attributes, namedattribute("ordered_val", ordered_val)) - !isnothing(order_val) && push!(attributes, namedattribute("order_val", order_val)) - !isnothing(inclusive) && push!(attributes, namedattribute("inclusive", inclusive)) + push!(_attributes, namedattribute("collapse_val", collapse_val)) + !isnothing(nowait) && push!(_attributes, namedattribute("nowait", nowait)) + !isnothing(ordered_val) && + push!(_attributes, namedattribute("ordered_val", ordered_val)) + !isnothing(order_val) && push!(_attributes, namedattribute("order_val", order_val)) + !isnothing(inclusive) && push!(_attributes, namedattribute("inclusive", inclusive)) return IR.create_operation( "omp.wsloop", diff --git a/src/Dialects/14/PDL.jl b/src/Dialects/14/PDL.jl index c131b325..2f6d8733 100644 --- a/src/Dialects/14/PDL.jl +++ b/src/Dialects/14/PDL.jl @@ -29,7 +29,8 @@ function apply_native_constraint( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[namedattribute("name", name),] - !isnothing(constParams) && push!(attributes, namedattribute("constParams", constParams)) + !isnothing(constParams) && + push!(_attributes, namedattribute("constParams", constParams)) return IR.create_operation( "pdl.apply_native_constraint", @@ -91,7 +92,8 @@ function apply_native_rewrite( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[namedattribute("name", name),] - !isnothing(constParams) && push!(attributes, namedattribute("constParams", constParams)) + !isnothing(constParams) && + push!(_attributes, namedattribute("constParams", constParams)) return IR.create_operation( "pdl.apply_native_rewrite", @@ -138,8 +140,8 @@ function attribute( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(type) && push!(operands, type) - !isnothing(value) && push!(attributes, namedattribute("value", value)) + !isnothing(type) && push!(_operands, type) + !isnothing(value) && push!(_attributes, namedattribute("value", value)) return IR.create_operation( "pdl.attribute", @@ -212,7 +214,7 @@ function operand(type=nothing::Union{Nothing,Value}; val::IR.Type, location=Loca _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(type) && push!(operands, type) + !isnothing(type) && push!(_operands, type) return IR.create_operation( "pdl.operand", @@ -253,7 +255,7 @@ function operands(type=nothing::Union{Nothing,Value}; val::IR.Type, location=Loc _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(type) && push!(operands, type) + !isnothing(type) && push!(_operands, type) return IR.create_operation( "pdl.operands", @@ -379,10 +381,10 @@ function operation( _successors = Block[] _attributes = NamedAttribute[namedattribute("attributeNames", attributeNames),] push!( - attributes, + _attributes, operandsegmentsizes([length(operands), length(attributes), length(types)]), ) - !isnothing(name) && push!(attributes, namedattribute("name", name)) + !isnothing(name) && push!(_attributes, namedattribute("name", name)) return IR.create_operation( "pdl.operation", @@ -426,7 +428,7 @@ function pattern(; benefit, sym_name=nothing, body::Region, location=Location()) _owned_regions = Region[body,] _successors = Block[] _attributes = NamedAttribute[namedattribute("benefit", benefit),] - !isnothing(sym_name) && push!(attributes, namedattribute("sym_name", sym_name)) + !isnothing(sym_name) && push!(_attributes, namedattribute("sym_name", sym_name)) return IR.create_operation( "pdl.pattern", @@ -476,9 +478,9 @@ function replace( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(replOperation) && push!(operands, replOperation) + !isnothing(replOperation) && push!(_operands, replOperation) push!( - attributes, + _attributes, operandsegmentsizes([1, isnothing(replOperation) ? 0 : 1, length(replValues)]), ) @@ -570,7 +572,7 @@ function results(parent::Value; val::IR.Type, index=nothing, location=Location() _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(index) && push!(attributes, namedattribute("index", index)) + !isnothing(index) && push!(_attributes, namedattribute("index", index)) return IR.create_operation( "pdl.results", @@ -637,11 +639,11 @@ function rewrite( _owned_regions = Region[body,] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(root) && push!(operands, root) - push!(attributes, operandsegmentsizes([isnothing(root) ? 0 : 1, length(externalArgs)])) - !isnothing(name) && push!(attributes, namedattribute("name", name)) + !isnothing(root) && push!(_operands, root) + push!(_attributes, operandsegmentsizes([isnothing(root) ? 0 : 1, length(externalArgs)])) + !isnothing(name) && push!(_attributes, namedattribute("name", name)) !isnothing(externalConstParams) && - push!(attributes, namedattribute("externalConstParams", externalConstParams)) + push!(_attributes, namedattribute("externalConstParams", externalConstParams)) return IR.create_operation( "pdl.rewrite", @@ -679,7 +681,7 @@ function type(; result::IR.Type, type=nothing, location=Location()) _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(type) && push!(attributes, namedattribute("type", type)) + !isnothing(type) && push!(_attributes, namedattribute("type", type)) return IR.create_operation( "pdl.type", @@ -717,7 +719,7 @@ function types(; result::IR.Type, types=nothing, location=Location()) _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(types) && push!(attributes, namedattribute("types", types)) + !isnothing(types) && push!(_attributes, namedattribute("types", types)) return IR.create_operation( "pdl.types", diff --git a/src/Dialects/14/PDLInterp.jl b/src/Dialects/14/PDLInterp.jl index fde07695..9992a775 100644 --- a/src/Dialects/14/PDLInterp.jl +++ b/src/Dialects/14/PDLInterp.jl @@ -34,7 +34,8 @@ function apply_constraint( _owned_regions = Region[] _successors = Block[trueDest, falseDest] _attributes = NamedAttribute[namedattribute("name", name),] - !isnothing(constParams) && push!(attributes, namedattribute("constParams", constParams)) + !isnothing(constParams) && + push!(_attributes, namedattribute("constParams", constParams)) return IR.create_operation( "pdl_interp.apply_constraint", @@ -87,7 +88,8 @@ function apply_rewrite( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[namedattribute("name", name),] - !isnothing(constParams) && push!(attributes, namedattribute("constParams", constParams)) + !isnothing(constParams) && + push!(_attributes, namedattribute("constParams", constParams)) return IR.create_operation( "pdl_interp.apply_rewrite", @@ -234,7 +236,7 @@ function check_operand_count( _successors = Block[trueDest, falseDest] _attributes = NamedAttribute[namedattribute("count", count),] !isnothing(compareAtLeast) && - push!(attributes, namedattribute("compareAtLeast", compareAtLeast)) + push!(_attributes, namedattribute("compareAtLeast", compareAtLeast)) return IR.create_operation( "pdl_interp.check_operand_count", @@ -315,7 +317,7 @@ function check_result_count( _successors = Block[trueDest, falseDest] _attributes = NamedAttribute[namedattribute("count", count),] !isnothing(compareAtLeast) && - push!(attributes, namedattribute("compareAtLeast", compareAtLeast)) + push!(_attributes, namedattribute("compareAtLeast", compareAtLeast)) return IR.create_operation( "pdl_interp.check_result_count", @@ -492,7 +494,7 @@ function create_operation( namedattribute("name", name), namedattribute("attributeNames", attributeNames) ] push!( - attributes, + _attributes, operandsegmentsizes([length(operands), length(attributes), length(types)]), ) @@ -860,7 +862,7 @@ function get_operands(operation::Value; value::IR.Type, index=nothing, location= _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(index) && push!(attributes, namedattribute("index", index)) + !isnothing(index) && push!(_attributes, namedattribute("index", index)) return IR.create_operation( "pdl_interp.get_operands", @@ -935,7 +937,7 @@ function get_results(operation::Value; value::IR.Type, index=nothing, location=L _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(index) && push!(attributes, namedattribute("index", index)) + !isnothing(index) && push!(_attributes, namedattribute("index", index)) return IR.create_operation( "pdl_interp.get_results", @@ -1117,10 +1119,10 @@ function record_match( _attributes = NamedAttribute[ namedattribute("rewriter", rewriter), namedattribute("benefit", benefit) ] - push!(attributes, operandsegmentsizes([length(inputs), length(matchedOps)])) - !isnothing(rootKind) && push!(attributes, namedattribute("rootKind", rootKind)) + push!(_attributes, operandsegmentsizes([length(inputs), length(matchedOps)])) + !isnothing(rootKind) && push!(_attributes, namedattribute("rootKind", rootKind)) !isnothing(generatedOps) && - push!(attributes, namedattribute("generatedOps", generatedOps)) + push!(_attributes, namedattribute("generatedOps", generatedOps)) return IR.create_operation( "pdl_interp.record_match", diff --git a/src/Dialects/14/Quant.jl b/src/Dialects/14/Quant.jl index 2ec8e612..42ad32e2 100644 --- a/src/Dialects/14/Quant.jl +++ b/src/Dialects/14/Quant.jl @@ -33,8 +33,8 @@ function const_fake_quant( ] !isnothing(outputs) && push!(_results, outputs) !isnothing(narrow_range) && - push!(attributes, namedattribute("narrow_range", narrow_range)) - !isnothing(is_signed) && push!(attributes, namedattribute("is_signed", is_signed)) + push!(_attributes, namedattribute("narrow_range", narrow_range)) + !isnothing(is_signed) && push!(_attributes, namedattribute("is_signed", is_signed)) return IR.create_operation( "quant.const_fake_quant", @@ -80,8 +80,8 @@ function const_fake_quant_per_axis( ] !isnothing(outputs) && push!(_results, outputs) !isnothing(narrow_range) && - push!(attributes, namedattribute("narrow_range", narrow_range)) - !isnothing(is_signed) && push!(attributes, namedattribute("is_signed", is_signed)) + push!(_attributes, namedattribute("narrow_range", narrow_range)) + !isnothing(is_signed) && push!(_attributes, namedattribute("is_signed", is_signed)) return IR.create_operation( "quant.const_fake_quant_per_axis", @@ -265,8 +265,8 @@ function stats( _successors = Block[] _attributes = NamedAttribute[namedattribute("layerStats", layerStats),] !isnothing(result_0) && push!(_results, result_0) - !isnothing(axisStats) && push!(attributes, namedattribute("axisStats", axisStats)) - !isnothing(axis) && push!(attributes, namedattribute("axis", axis)) + !isnothing(axisStats) && push!(_attributes, namedattribute("axisStats", axisStats)) + !isnothing(axis) && push!(_attributes, namedattribute("axis", axis)) return IR.create_operation( "quant.stats", diff --git a/src/Dialects/14/SCF.jl b/src/Dialects/14/SCF.jl index 3ac67b48..bee5367d 100644 --- a/src/Dialects/14/SCF.jl +++ b/src/Dialects/14/SCF.jl @@ -339,7 +339,7 @@ function parallel( _successors = Block[] _attributes = NamedAttribute[] push!( - attributes, + _attributes, operandsegmentsizes([ length(lowerBound), length(upperBound), length(step), length(initVals) ]), diff --git a/src/Dialects/14/SPIRV.jl b/src/Dialects/14/SPIRV.jl index 281ad952..bb35e77b 100644 --- a/src/Dialects/14/SPIRV.jl +++ b/src/Dialects/14/SPIRV.jl @@ -1590,11 +1590,11 @@ function BranchConditional( _successors = Block[trueTarget, falseTarget] _attributes = NamedAttribute[] push!( - attributes, + _attributes, operandsegmentsizes([1, length(trueTargetOperands), length(falseTargetOperands)]), ) !isnothing(branch_weights) && - push!(attributes, namedattribute("branch_weights", branch_weights)) + push!(_attributes, namedattribute("branch_weights", branch_weights)) return IR.create_operation( "spv.BranchConditional", @@ -2210,7 +2210,7 @@ function CooperativeMatrixLoadNV( _successors = Block[] _attributes = NamedAttribute[] !isnothing(memory_access) && - push!(attributes, namedattribute("memory_access", memory_access)) + push!(_attributes, namedattribute("memory_access", memory_access)) return IR.create_operation( "spv.CooperativeMatrixLoadNV", @@ -2350,7 +2350,7 @@ function CooperativeMatrixStoreNV( _successors = Block[] _attributes = NamedAttribute[] !isnothing(memory_access) && - push!(attributes, namedattribute("memory_access", memory_access)) + push!(_attributes, namedattribute("memory_access", memory_access)) return IR.create_operation( "spv.CooperativeMatrixStoreNV", @@ -2408,12 +2408,12 @@ function CopyMemory( _successors = Block[] _attributes = NamedAttribute[] !isnothing(memory_access) && - push!(attributes, namedattribute("memory_access", memory_access)) - !isnothing(alignment) && push!(attributes, namedattribute("alignment", alignment)) + push!(_attributes, namedattribute("memory_access", memory_access)) + !isnothing(alignment) && push!(_attributes, namedattribute("alignment", alignment)) !isnothing(source_memory_access) && - push!(attributes, namedattribute("source_memory_access", source_memory_access)) + push!(_attributes, namedattribute("source_memory_access", source_memory_access)) !isnothing(source_alignment) && - push!(attributes, namedattribute("source_alignment", source_alignment)) + push!(_attributes, namedattribute("source_alignment", source_alignment)) return IR.create_operation( "spv.CopyMemory", @@ -5227,12 +5227,13 @@ function GlobalVariable(; _attributes = NamedAttribute[ namedattribute("type", type), namedattribute("sym_name", sym_name) ] - !isnothing(initializer) && push!(attributes, namedattribute("initializer", initializer)) - !isnothing(location) && push!(attributes, namedattribute("location", location_)) - !isnothing(binding) && push!(attributes, namedattribute("binding", binding)) + !isnothing(initializer) && + push!(_attributes, namedattribute("initializer", initializer)) + !isnothing(location) && push!(_attributes, namedattribute("location", location_)) + !isnothing(binding) && push!(_attributes, namedattribute("binding", binding)) !isnothing(descriptorSet) && - push!(attributes, namedattribute("descriptorSet", descriptorSet)) - !isnothing(builtin) && push!(attributes, namedattribute("builtin", builtin)) + push!(_attributes, namedattribute("descriptorSet", descriptorSet)) + !isnothing(builtin) && push!(_attributes, namedattribute("builtin", builtin)) return IR.create_operation( "spv.GlobalVariable", @@ -5535,7 +5536,7 @@ function GroupNonUniformFAdd( namedattribute("execution_scope", execution_scope), namedattribute("group_operation", group_operation), ] - !isnothing(cluster_size) && push!(operands, cluster_size) + !isnothing(cluster_size) && push!(_operands, cluster_size) return IR.create_operation( "spv.GroupNonUniformFAdd", @@ -5610,7 +5611,7 @@ function GroupNonUniformFMax( namedattribute("execution_scope", execution_scope), namedattribute("group_operation", group_operation), ] - !isnothing(cluster_size) && push!(operands, cluster_size) + !isnothing(cluster_size) && push!(_operands, cluster_size) return IR.create_operation( "spv.GroupNonUniformFMax", @@ -5685,7 +5686,7 @@ function GroupNonUniformFMin( namedattribute("execution_scope", execution_scope), namedattribute("group_operation", group_operation), ] - !isnothing(cluster_size) && push!(operands, cluster_size) + !isnothing(cluster_size) && push!(_operands, cluster_size) return IR.create_operation( "spv.GroupNonUniformFMin", @@ -5757,7 +5758,7 @@ function GroupNonUniformFMul( namedattribute("execution_scope", execution_scope), namedattribute("group_operation", group_operation), ] - !isnothing(cluster_size) && push!(operands, cluster_size) + !isnothing(cluster_size) && push!(_operands, cluster_size) return IR.create_operation( "spv.GroupNonUniformFMul", @@ -5827,7 +5828,7 @@ function GroupNonUniformIAdd( namedattribute("execution_scope", execution_scope), namedattribute("group_operation", group_operation), ] - !isnothing(cluster_size) && push!(operands, cluster_size) + !isnothing(cluster_size) && push!(_operands, cluster_size) return IR.create_operation( "spv.GroupNonUniformIAdd", @@ -5897,7 +5898,7 @@ function GroupNonUniformIMul( namedattribute("execution_scope", execution_scope), namedattribute("group_operation", group_operation), ] - !isnothing(cluster_size) && push!(operands, cluster_size) + !isnothing(cluster_size) && push!(_operands, cluster_size) return IR.create_operation( "spv.GroupNonUniformIMul", @@ -5967,7 +5968,7 @@ function GroupNonUniformSMax( namedattribute("execution_scope", execution_scope), namedattribute("group_operation", group_operation), ] - !isnothing(cluster_size) && push!(operands, cluster_size) + !isnothing(cluster_size) && push!(_operands, cluster_size) return IR.create_operation( "spv.GroupNonUniformSMax", @@ -6037,7 +6038,7 @@ function GroupNonUniformSMin( namedattribute("execution_scope", execution_scope), namedattribute("group_operation", group_operation), ] - !isnothing(cluster_size) && push!(operands, cluster_size) + !isnothing(cluster_size) && push!(_operands, cluster_size) return IR.create_operation( "spv.GroupNonUniformSMin", @@ -6108,7 +6109,7 @@ function GroupNonUniformUMax( namedattribute("execution_scope", execution_scope), namedattribute("group_operation", group_operation), ] - !isnothing(cluster_size) && push!(operands, cluster_size) + !isnothing(cluster_size) && push!(_operands, cluster_size) return IR.create_operation( "spv.GroupNonUniformUMax", @@ -6179,7 +6180,7 @@ function GroupNonUniformUMin( namedattribute("execution_scope", execution_scope), namedattribute("group_operation", group_operation), ] - !isnothing(cluster_size) && push!(operands, cluster_size) + !isnothing(cluster_size) && push!(_operands, cluster_size) return IR.create_operation( "spv.GroupNonUniformUMin", @@ -6502,7 +6503,7 @@ function ImageDrefGather( _successors = Block[] _attributes = NamedAttribute[] !isnothing(imageoperands) && - push!(attributes, namedattribute("imageoperands", imageoperands)) + push!(_attributes, namedattribute("imageoperands", imageoperands)) return IR.create_operation( "spv.ImageDrefGather", @@ -6787,8 +6788,8 @@ function Load( _successors = Block[] _attributes = NamedAttribute[] !isnothing(memory_access) && - push!(attributes, namedattribute("memory_access", memory_access)) - !isnothing(alignment) && push!(attributes, namedattribute("alignment", alignment)) + push!(_attributes, namedattribute("memory_access", memory_access)) + !isnothing(alignment) && push!(_attributes, namedattribute("alignment", alignment)) return IR.create_operation( "spv.Load", @@ -7311,8 +7312,8 @@ function module_(; namedattribute("addressing_model", addressing_model), namedattribute("memory_model", memory_model), ] - !isnothing(vce_triple) && push!(attributes, namedattribute("vce_triple", vce_triple)) - !isnothing(sym_name) && push!(attributes, namedattribute("sym_name", sym_name)) + !isnothing(vce_triple) && push!(_attributes, namedattribute("vce_triple", vce_triple)) + !isnothing(sym_name) && push!(_attributes, namedattribute("sym_name", sym_name)) return IR.create_operation( "spv.module", @@ -9116,8 +9117,8 @@ function Store( _successors = Block[] _attributes = NamedAttribute[] !isnothing(memory_access) && - push!(attributes, namedattribute("memory_access", memory_access)) - !isnothing(alignment) && push!(attributes, namedattribute("alignment", alignment)) + push!(_attributes, namedattribute("memory_access", memory_access)) + !isnothing(alignment) && push!(_attributes, namedattribute("alignment", alignment)) return IR.create_operation( "spv.Store", @@ -9823,7 +9824,7 @@ function Variable( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[namedattribute("storage_class", storage_class),] - !isnothing(initializer) && push!(operands, initializer) + !isnothing(initializer) && push!(_operands, initializer) return IR.create_operation( "spv.Variable", diff --git a/src/Dialects/14/Shape.jl b/src/Dialects/14/Shape.jl index 0f5745a7..b8a3edd7 100644 --- a/src/Dialects/14/Shape.jl +++ b/src/Dialects/14/Shape.jl @@ -199,7 +199,7 @@ function broadcast( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(error) && push!(attributes, namedattribute("error", error)) + !isnothing(error) && push!(_attributes, namedattribute("error", error)) return IR.create_operation( "shape.broadcast", @@ -791,7 +791,7 @@ function meet( _successors = Block[] _attributes = NamedAttribute[] !isnothing(result) && push!(_results, result) - !isnothing(error) && push!(attributes, namedattribute("error", error)) + !isnothing(error) && push!(_attributes, namedattribute("error", error)) return IR.create_operation( "shape.meet", diff --git a/src/Dialects/14/SparseTensor.jl b/src/Dialects/14/SparseTensor.jl index 69c2fb00..450264de 100644 --- a/src/Dialects/14/SparseTensor.jl +++ b/src/Dialects/14/SparseTensor.jl @@ -275,7 +275,7 @@ function load( _successors = Block[] _attributes = NamedAttribute[] !isnothing(result) && push!(_results, result) - !isnothing(hasInserts) && push!(attributes, namedattribute("hasInserts", hasInserts)) + !isnothing(hasInserts) && push!(_attributes, namedattribute("hasInserts", hasInserts)) return IR.create_operation( "sparse_tensor.load", diff --git a/src/Dialects/14/StandardOps.jl b/src/Dialects/14/StandardOps.jl index c3c07df1..4b16f870 100644 --- a/src/Dialects/14/StandardOps.jl +++ b/src/Dialects/14/StandardOps.jl @@ -192,7 +192,7 @@ function cond_br( _successors = Block[trueDest, falseDest] _attributes = NamedAttribute[] push!( - attributes, + _attributes, operandsegmentsizes([1, length(trueDestOperands), length(falseDestOperands)]), ) @@ -439,9 +439,10 @@ function switch( "case_operand_segments", case_operand_segments ),] push!( - attributes, operandsegmentsizes([1, length(defaultOperands), length(caseOperands)]) + _attributes, operandsegmentsizes([1, length(defaultOperands), length(caseOperands)]) ) - !isnothing(case_values) && push!(attributes, namedattribute("case_values", case_values)) + !isnothing(case_values) && + push!(_attributes, namedattribute("case_values", case_values)) return IR.create_operation( "std.switch", diff --git a/src/Dialects/14/Tensor.jl b/src/Dialects/14/Tensor.jl index 50f4ec32..df21ec9b 100644 --- a/src/Dialects/14/Tensor.jl +++ b/src/Dialects/14/Tensor.jl @@ -283,7 +283,7 @@ function extract_slice( namedattribute("static_strides", static_strides), ] push!( - attributes, + _attributes, operandsegmentsizes([1, length(offsets), length(sizes), length(strides)]), ) @@ -493,7 +493,7 @@ function insert_slice( namedattribute("static_strides", static_strides), ] push!( - attributes, + _attributes, operandsegmentsizes([1, 1, length(offsets), length(sizes), length(strides)]), ) @@ -599,8 +599,8 @@ function pad( _attributes = NamedAttribute[ namedattribute("static_low", static_low), namedattribute("static_high", static_high) ] - push!(attributes, operandsegmentsizes([1, length(low), length(high)])) - !isnothing(nofold) && push!(attributes, namedattribute("nofold", nofold)) + push!(_attributes, operandsegmentsizes([1, length(low), length(high)])) + !isnothing(nofold) && push!(_attributes, namedattribute("nofold", nofold)) return IR.create_operation( "tensor.pad", diff --git a/src/Dialects/14/Tosa.jl b/src/Dialects/14/Tosa.jl index 4b4291da..c2976a44 100644 --- a/src/Dialects/14/Tosa.jl +++ b/src/Dialects/14/Tosa.jl @@ -167,7 +167,7 @@ function avg_pool2d( namedattribute("pad", pad), ] !isnothing(quantization_info) && - push!(attributes, namedattribute("quantization_info", quantization_info)) + push!(_attributes, namedattribute("quantization_info", quantization_info)) return IR.create_operation( "tosa.avg_pool2d", @@ -483,7 +483,7 @@ function conv2d( namedattribute("dilation", dilation), ] !isnothing(quantization_info) && - push!(attributes, namedattribute("quantization_info", quantization_info)) + push!(_attributes, namedattribute("quantization_info", quantization_info)) return IR.create_operation( "tosa.conv2d", @@ -523,7 +523,7 @@ function conv3d( namedattribute("dilation", dilation), ] !isnothing(quantization_info) && - push!(attributes, namedattribute("quantization_info", quantization_info)) + push!(_attributes, namedattribute("quantization_info", quantization_info)) return IR.create_operation( "tosa.conv3d", @@ -593,7 +593,7 @@ function depthwise_conv2d( namedattribute("dilation", dilation), ] !isnothing(quantization_info) && - push!(attributes, namedattribute("quantization_info", quantization_info)) + push!(_attributes, namedattribute("quantization_info", quantization_info)) return IR.create_operation( "tosa.depthwise_conv2d", @@ -723,7 +723,7 @@ function fully_connected( _successors = Block[] _attributes = NamedAttribute[] !isnothing(quantization_info) && - push!(attributes, namedattribute("quantization_info", quantization_info)) + push!(_attributes, namedattribute("quantization_info", quantization_info)) return IR.create_operation( "tosa.fully_connected", @@ -1060,7 +1060,7 @@ function matmul( _successors = Block[] _attributes = NamedAttribute[] !isnothing(quantization_info) && - push!(attributes, namedattribute("quantization_info", quantization_info)) + push!(_attributes, namedattribute("quantization_info", quantization_info)) return IR.create_operation( "tosa.matmul", @@ -1194,7 +1194,7 @@ function negate( _successors = Block[] _attributes = NamedAttribute[] !isnothing(quantization_info) && - push!(attributes, namedattribute("quantization_info", quantization_info)) + push!(_attributes, namedattribute("quantization_info", quantization_info)) return IR.create_operation( "tosa.negate", @@ -1226,9 +1226,9 @@ function pad( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(pad_const) && push!(operands, pad_const) + !isnothing(pad_const) && push!(_operands, pad_const) !isnothing(quantization_info) && - push!(attributes, namedattribute("quantization_info", quantization_info)) + push!(_attributes, namedattribute("quantization_info", quantization_info)) return IR.create_operation( "tosa.pad", @@ -1894,7 +1894,7 @@ function transpose_conv2d( namedattribute("out_shape", out_shape), ] !isnothing(quantization_info) && - push!(attributes, namedattribute("quantization_info", quantization_info)) + push!(_attributes, namedattribute("quantization_info", quantization_info)) return IR.create_operation( "tosa.transpose_conv2d", diff --git a/src/Dialects/14/Vector.jl b/src/Dialects/14/Vector.jl index 9db9922b..2b77fb03 100644 --- a/src/Dialects/14/Vector.jl +++ b/src/Dialects/14/Vector.jl @@ -372,7 +372,7 @@ function contract( namedattribute("indexing_maps", indexing_maps), namedattribute("iterator_types", iterator_types), ] - !isnothing(kind) && push!(attributes, namedattribute("kind", kind)) + !isnothing(kind) && push!(_attributes, namedattribute("kind", kind)) return IR.create_operation( "vector.contract", @@ -525,7 +525,7 @@ function extractelement( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(position) && push!(operands, position) + !isnothing(position) && push!(_operands, position) return IR.create_operation( "vector.extractelement", @@ -860,7 +860,7 @@ function insertelement( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(position) && push!(operands, position) + !isnothing(position) && push!(_operands, position) return IR.create_operation( "vector.insertelement", @@ -1361,7 +1361,7 @@ function outerproduct( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(kind) && push!(attributes, namedattribute("kind", kind)) + !isnothing(kind) && push!(_attributes, namedattribute("kind", kind)) return IR.create_operation( "vector.outerproduct", @@ -1559,7 +1559,7 @@ function reshape( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[namedattribute("fixed_vector_sizes", fixed_vector_sizes),] - push!(attributes, operandsegmentsizes([1, length(input_shape), length(output_shape)])) + push!(_attributes, operandsegmentsizes([1, length(input_shape), length(output_shape)])) return IR.create_operation( "vector.reshape", @@ -2035,9 +2035,11 @@ function transfer_read( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[namedattribute("permutation_map", permutation_map),] - !isnothing(mask) && push!(operands, mask) - push!(attributes, operandsegmentsizes([1, length(indices), 1, isnothing(mask) ? 0 : 1])) - !isnothing(in_bounds) && push!(attributes, namedattribute("in_bounds", in_bounds)) + !isnothing(mask) && push!(_operands, mask) + push!( + _attributes, operandsegmentsizes([1, length(indices), 1, isnothing(mask) ? 0 : 1]) + ) + !isnothing(in_bounds) && push!(_attributes, namedattribute("in_bounds", in_bounds)) return IR.create_operation( "vector.transfer_read", @@ -2156,10 +2158,12 @@ function transfer_write( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[namedattribute("permutation_map", permutation_map),] - !isnothing(mask) && push!(operands, mask) - push!(attributes, operandsegmentsizes([1, 1, length(indices), isnothing(mask) ? 0 : 1])) + !isnothing(mask) && push!(_operands, mask) + push!( + _attributes, operandsegmentsizes([1, 1, length(indices), isnothing(mask) ? 0 : 1]) + ) !isnothing(result) && push!(_results, result) - !isnothing(in_bounds) && push!(attributes, namedattribute("in_bounds", in_bounds)) + !isnothing(in_bounds) && push!(_attributes, namedattribute("in_bounds", in_bounds)) return IR.create_operation( "vector.transfer_write", diff --git a/src/Dialects/14/X86Vector.jl b/src/Dialects/14/X86Vector.jl index bd2beada..61bc575b 100644 --- a/src/Dialects/14/X86Vector.jl +++ b/src/Dialects/14/X86Vector.jl @@ -124,10 +124,10 @@ function avx512_mask_compress( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(src) && push!(operands, src) + !isnothing(src) && push!(_operands, src) !isnothing(dst) && push!(_results, dst) !isnothing(constant_src) && - push!(attributes, namedattribute("constant_src", constant_src)) + push!(_attributes, namedattribute("constant_src", constant_src)) return IR.create_operation( "x86vector.avx512.mask.compress", diff --git a/src/Dialects/15/AMDGPU.jl b/src/Dialects/15/AMDGPU.jl index 75f0a7a8..4a158860 100644 --- a/src/Dialects/15/AMDGPU.jl +++ b/src/Dialects/15/AMDGPU.jl @@ -72,13 +72,15 @@ function raw_buffer_atomic_fadd( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(sgprOffset) && push!(operands, sgprOffset) + !isnothing(sgprOffset) && push!(_operands, sgprOffset) push!( - attributes, + _attributes, operandsegmentsizes([1, 1, length(indices), isnothing(sgprOffset) ? 0 : 1]), ) - !isnothing(boundsCheck) && push!(attributes, namedattribute("boundsCheck", boundsCheck)) - !isnothing(indexOffset) && push!(attributes, namedattribute("indexOffset", indexOffset)) + !isnothing(boundsCheck) && + push!(_attributes, namedattribute("boundsCheck", boundsCheck)) + !isnothing(indexOffset) && + push!(_attributes, namedattribute("indexOffset", indexOffset)) return IR.create_operation( "amdgpu.raw_buffer_atomic_fadd", @@ -138,12 +140,15 @@ function raw_buffer_load( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(sgprOffset) && push!(operands, sgprOffset) + !isnothing(sgprOffset) && push!(_operands, sgprOffset) push!( - attributes, operandsegmentsizes([1, length(indices), isnothing(sgprOffset) ? 0 : 1]) + _attributes, + operandsegmentsizes([1, length(indices), isnothing(sgprOffset) ? 0 : 1]), ) - !isnothing(boundsCheck) && push!(attributes, namedattribute("boundsCheck", boundsCheck)) - !isnothing(indexOffset) && push!(attributes, namedattribute("indexOffset", indexOffset)) + !isnothing(boundsCheck) && + push!(_attributes, namedattribute("boundsCheck", boundsCheck)) + !isnothing(indexOffset) && + push!(_attributes, namedattribute("indexOffset", indexOffset)) return IR.create_operation( "amdgpu.raw_buffer_load", @@ -191,13 +196,15 @@ function raw_buffer_store( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(sgprOffset) && push!(operands, sgprOffset) + !isnothing(sgprOffset) && push!(_operands, sgprOffset) push!( - attributes, + _attributes, operandsegmentsizes([1, 1, length(indices), isnothing(sgprOffset) ? 0 : 1]), ) - !isnothing(boundsCheck) && push!(attributes, namedattribute("boundsCheck", boundsCheck)) - !isnothing(indexOffset) && push!(attributes, namedattribute("indexOffset", indexOffset)) + !isnothing(boundsCheck) && + push!(_attributes, namedattribute("boundsCheck", boundsCheck)) + !isnothing(indexOffset) && + push!(_attributes, namedattribute("indexOffset", indexOffset)) return IR.create_operation( "amdgpu.raw_buffer_store", diff --git a/src/Dialects/15/AMX.jl b/src/Dialects/15/AMX.jl index d3ceb98b..4df6ab3e 100644 --- a/src/Dialects/15/AMX.jl +++ b/src/Dialects/15/AMX.jl @@ -346,8 +346,8 @@ function tile_muli( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(isZextLhs) && push!(attributes, namedattribute("isZextLhs", isZextLhs)) - !isnothing(isZextRhs) && push!(attributes, namedattribute("isZextRhs", isZextRhs)) + !isnothing(isZextLhs) && push!(_attributes, namedattribute("isZextLhs", isZextLhs)) + !isnothing(isZextRhs) && push!(_attributes, namedattribute("isZextRhs", isZextRhs)) return IR.create_operation( "amx.tile_muli", diff --git a/src/Dialects/15/Arithmetic.jl b/src/Dialects/15/Arithmetic.jl index 6a9f95ae..225500c2 100644 --- a/src/Dialects/15/Arithmetic.jl +++ b/src/Dialects/15/Arithmetic.jl @@ -396,13 +396,12 @@ forms simple integer and floating point constants. %1 = \"arith.constant\"() {value = 42 : i32} : () -> i32 ``` """ -function constant(; result=nothing::Union{Nothing,IR.Type}, value, location=Location()) - _results = IR.Type[] +function constant(; result::IR.Type, value, location=Location()) + _results = IR.Type[result,] _operands = Value[] _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[namedattribute("value", value),] - !isnothing(result) && push!(_results, result) return IR.create_operation( "arith.constant", @@ -411,8 +410,8 @@ function constant(; result=nothing::Union{Nothing,IR.Type}, value, location=Loca owned_regions=_owned_regions, successors=_successors, attributes=_attributes, - results=(length(_results) == 0 ? nothing : _results), - result_inference=(length(_results) == 0 ? true : false), + results=_results, + result_inference=false, ) end diff --git a/src/Dialects/15/Async.jl b/src/Dialects/15/Async.jl index 1e83a80c..180f463d 100644 --- a/src/Dialects/15/Async.jl +++ b/src/Dialects/15/Async.jl @@ -375,7 +375,7 @@ function execute( _owned_regions = Region[body,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(dependencies), length(operands)])) + push!(_attributes, operandsegmentsizes([length(dependencies), length(operands)])) return IR.create_operation( "async.execute", diff --git a/src/Dialects/15/Bufferization.jl b/src/Dialects/15/Bufferization.jl index 8c0a1e20..27d0c515 100644 --- a/src/Dialects/15/Bufferization.jl +++ b/src/Dialects/15/Bufferization.jl @@ -57,10 +57,12 @@ function alloc_tensor( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(copy) && push!(operands, copy) - push!(attributes, operandsegmentsizes([length(dynamic_sizes), isnothing(copy) ? 0 : 1])) + !isnothing(copy) && push!(_operands, copy) + push!( + _attributes, operandsegmentsizes([length(dynamic_sizes), isnothing(copy) ? 0 : 1]) + ) !isnothing(memory_space) && - push!(attributes, namedattribute("memory_space", memory_space)) + push!(_attributes, namedattribute("memory_space", memory_space)) return IR.create_operation( "bufferization.alloc_tensor", diff --git a/src/Dialects/15/Builtin.jl b/src/Dialects/15/Builtin.jl index 1a672bef..2ac242d8 100644 --- a/src/Dialects/15/Builtin.jl +++ b/src/Dialects/15/Builtin.jl @@ -31,9 +31,9 @@ function module_(; _owned_regions = Region[bodyRegion,] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(sym_name) && push!(attributes, namedattribute("sym_name", sym_name)) + !isnothing(sym_name) && push!(_attributes, namedattribute("sym_name", sym_name)) !isnothing(sym_visibility) && - push!(attributes, namedattribute("sym_visibility", sym_visibility)) + push!(_attributes, namedattribute("sym_visibility", sym_visibility)) return IR.create_operation( "builtin.module", diff --git a/src/Dialects/15/ControlFlow.jl b/src/Dialects/15/ControlFlow.jl index df39048c..23faa5a7 100644 --- a/src/Dialects/15/ControlFlow.jl +++ b/src/Dialects/15/ControlFlow.jl @@ -115,7 +115,7 @@ function cond_br( _successors = Block[trueDest, falseDest] _attributes = NamedAttribute[] push!( - attributes, + _attributes, operandsegmentsizes([1, length(trueDestOperands), length(falseDestOperands)]), ) @@ -168,9 +168,10 @@ function switch( "case_operand_segments", case_operand_segments ),] push!( - attributes, operandsegmentsizes([1, length(defaultOperands), length(caseOperands)]) + _attributes, operandsegmentsizes([1, length(defaultOperands), length(caseOperands)]) ) - !isnothing(case_values) && push!(attributes, namedattribute("case_values", case_values)) + !isnothing(case_values) && + push!(_attributes, namedattribute("case_values", case_values)) return IR.create_operation( "cf.switch", diff --git a/src/Dialects/15/EmitC.jl b/src/Dialects/15/EmitC.jl index 3df4e3f3..58124247 100644 --- a/src/Dialects/15/EmitC.jl +++ b/src/Dialects/15/EmitC.jl @@ -73,9 +73,9 @@ function call( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[namedattribute("callee", callee),] - !isnothing(args) && push!(attributes, namedattribute("args", args)) + !isnothing(args) && push!(_attributes, namedattribute("args", args)) !isnothing(template_args) && - push!(attributes, namedattribute("template_args", template_args)) + push!(_attributes, namedattribute("template_args", template_args)) return IR.create_operation( "emitc.call", @@ -196,7 +196,7 @@ function include_(; include_, is_standard_include=nothing, location=Location()) _successors = Block[] _attributes = NamedAttribute[namedattribute("include", include_),] !isnothing(is_standard_include) && - push!(attributes, namedattribute("is_standard_include", is_standard_include)) + push!(_attributes, namedattribute("is_standard_include", is_standard_include)) return IR.create_operation( "emitc.include", diff --git a/src/Dialects/15/Func.jl b/src/Dialects/15/Func.jl index 22552dbf..6e7ac218 100644 --- a/src/Dialects/15/Func.jl +++ b/src/Dialects/15/Func.jl @@ -170,7 +170,7 @@ function func_(; namedattribute("sym_name", sym_name), namedattribute("function_type", function_type) ] !isnothing(sym_visibility) && - push!(attributes, namedattribute("sym_visibility", sym_visibility)) + push!(_attributes, namedattribute("sym_visibility", sym_visibility)) return IR.create_operation( "func.func", diff --git a/src/Dialects/15/GPU.jl b/src/Dialects/15/GPU.jl index e0266d40..50334a79 100644 --- a/src/Dialects/15/GPU.jl +++ b/src/Dialects/15/GPU.jl @@ -42,7 +42,7 @@ function all_reduce( _successors = Block[] _attributes = NamedAttribute[] !isnothing(result_0) && push!(_results, result_0) - !isnothing(op) && push!(attributes, namedattribute("op", op)) + !isnothing(op) && push!(_attributes, namedattribute("op", op)) return IR.create_operation( "gpu.all_reduce", @@ -89,7 +89,7 @@ function alloc( _successors = Block[] _attributes = NamedAttribute[] push!( - attributes, + _attributes, operandsegmentsizes([ length(asyncDependencies), length(dynamicSizes), length(symbolOperands) ]), @@ -621,9 +621,9 @@ function launch_func( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[namedattribute("kernel", kernel),] - !isnothing(dynamicSharedMemorySize) && push!(operands, dynamicSharedMemorySize) + !isnothing(dynamicSharedMemorySize) && push!(_operands, dynamicSharedMemorySize) push!( - attributes, + _attributes, operandsegmentsizes([ length(asyncDependencies), 1, @@ -750,9 +750,9 @@ function launch( _owned_regions = Region[body,] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(dynamicSharedMemorySize) && push!(operands, dynamicSharedMemorySize) + !isnothing(dynamicSharedMemorySize) && push!(_operands, dynamicSharedMemorySize) push!( - attributes, + _attributes, operandsegmentsizes([ length(asyncDependencies), 1, diff --git a/src/Dialects/15/LLVMIR.jl b/src/Dialects/15/LLVMIR.jl index 69520456..1ec7ce1e 100644 --- a/src/Dialects/15/LLVMIR.jl +++ b/src/Dialects/15/LLVMIR.jl @@ -172,7 +172,8 @@ function alias_scope_domain(; sym_name, description=nothing, location=Location() _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[namedattribute("sym_name", sym_name),] - !isnothing(description) && push!(attributes, namedattribute("description", description)) + !isnothing(description) && + push!(_attributes, namedattribute("description", description)) return IR.create_operation( "llvm.alias_scope_domain", @@ -227,7 +228,8 @@ function alias_scope(; sym_name, domain, description=nothing, location=Location( _attributes = NamedAttribute[ namedattribute("sym_name", sym_name), namedattribute("domain", domain) ] - !isnothing(description) && push!(attributes, namedattribute("description", description)) + !isnothing(description) && + push!(_attributes, namedattribute("description", description)) return IR.create_operation( "llvm.alias_scope", @@ -257,8 +259,8 @@ function alloca( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(alignment) && push!(attributes, namedattribute("alignment", alignment)) - !isnothing(elem_type) && push!(attributes, namedattribute("elem_type", elem_type)) + !isnothing(alignment) && push!(_attributes, namedattribute("alignment", alignment)) + !isnothing(elem_type) && push!(_attributes, namedattribute("elem_type", elem_type)) return IR.create_operation( "llvm.alloca", @@ -447,9 +449,9 @@ function call( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(callee) && push!(attributes, namedattribute("callee", callee)) + !isnothing(callee) && push!(_attributes, namedattribute("callee", callee)) !isnothing(fastmathFlags) && - push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) + push!(_attributes, namedattribute("fastmathFlags", fastmathFlags)) return IR.create_operation( "llvm.call", @@ -482,11 +484,11 @@ function cond_br( _successors = Block[trueDest, falseDest] _attributes = NamedAttribute[] push!( - attributes, + _attributes, operandsegmentsizes([1, length(trueDestOperands), length(falseDestOperands)]), ) !isnothing(branch_weights) && - push!(attributes, namedattribute("branch_weights", branch_weights)) + push!(_attributes, namedattribute("branch_weights", branch_weights)) return IR.create_operation( "llvm.cond_br", @@ -613,7 +615,7 @@ function fadd( _attributes = NamedAttribute[] !isnothing(res) && push!(_results, res) !isnothing(fastmathFlags) && - push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) + push!(_attributes, namedattribute("fastmathFlags", fastmathFlags)) return IR.create_operation( "llvm.fadd", @@ -645,7 +647,7 @@ function fcmp( _successors = Block[] _attributes = NamedAttribute[namedattribute("predicate", predicate),] !isnothing(fastmathFlags) && - push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) + push!(_attributes, namedattribute("fastmathFlags", fastmathFlags)) return IR.create_operation( "llvm.fcmp", @@ -677,7 +679,7 @@ function fdiv( _attributes = NamedAttribute[] !isnothing(res) && push!(_results, res) !isnothing(fastmathFlags) && - push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) + push!(_attributes, namedattribute("fastmathFlags", fastmathFlags)) return IR.create_operation( "llvm.fdiv", @@ -709,7 +711,7 @@ function fmul( _attributes = NamedAttribute[] !isnothing(res) && push!(_results, res) !isnothing(fastmathFlags) && - push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) + push!(_attributes, namedattribute("fastmathFlags", fastmathFlags)) return IR.create_operation( "llvm.fmul", @@ -740,7 +742,7 @@ function fneg( _attributes = NamedAttribute[] !isnothing(res) && push!(_results, res) !isnothing(fastmathFlags) && - push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) + push!(_attributes, namedattribute("fastmathFlags", fastmathFlags)) return IR.create_operation( "llvm.fneg", @@ -864,7 +866,7 @@ function frem( _attributes = NamedAttribute[] !isnothing(res) && push!(_results, res) !isnothing(fastmathFlags) && - push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) + push!(_attributes, namedattribute("fastmathFlags", fastmathFlags)) return IR.create_operation( "llvm.frem", @@ -896,7 +898,7 @@ function fsub( _attributes = NamedAttribute[] !isnothing(res) && push!(_results, res) !isnothing(fastmathFlags) && - push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) + push!(_attributes, namedattribute("fastmathFlags", fastmathFlags)) return IR.create_operation( "llvm.fsub", @@ -976,7 +978,7 @@ function getelementptr( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[namedattribute("structIndices", structIndices),] - !isnothing(elem_type) && push!(attributes, namedattribute("elem_type", elem_type)) + !isnothing(elem_type) && push!(_attributes, namedattribute("elem_type", elem_type)) return IR.create_operation( "llvm.getelementptr", @@ -1194,16 +1196,16 @@ function mlir_global(; 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(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(value) && push!(attributes, namedattribute("value", value)) - !isnothing(alignment) && push!(attributes, namedattribute("alignment", alignment)) - !isnothing(addr_space) && push!(attributes, namedattribute("addr_space", addr_space)) + push!(_attributes, namedattribute("thread_local_", thread_local_)) + !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(section) && push!(attributes, namedattribute("section", section)) + push!(_attributes, namedattribute("unnamed_addr", unnamed_addr)) + !isnothing(section) && push!(_attributes, namedattribute("section", section)) return IR.create_operation( "llvm.mlir.global", @@ -1270,12 +1272,13 @@ function inline_asm( ] !isnothing(res) && push!(_results, res) !isnothing(has_side_effects) && - push!(attributes, namedattribute("has_side_effects", 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)) + 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)) + push!(_attributes, namedattribute("operand_attrs", operand_attrs)) return IR.create_operation( "llvm.inline_asm", @@ -1382,12 +1385,12 @@ function invoke( _successors = Block[normalDest, unwindDest] _attributes = NamedAttribute[] push!( - attributes, + _attributes, operandsegmentsizes([ length(callee_operands), length(normalDestOperands), length(unwindDestOperands) ]), ) - !isnothing(callee) && push!(attributes, namedattribute("callee", callee)) + !isnothing(callee) && push!(_attributes, namedattribute("callee", callee)) return IR.create_operation( "llvm.invoke", @@ -1446,13 +1449,15 @@ function func(; _owned_regions = Region[body,] _successors = Block[] _attributes = NamedAttribute[namedattribute("function_type", function_type),] - !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(personality) && push!(attributes, namedattribute("personality", personality)) + !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(personality) && + push!(_attributes, namedattribute("personality", personality)) !isnothing(garbageCollector) && - push!(attributes, namedattribute("garbageCollector", garbageCollector)) - !isnothing(passthrough) && push!(attributes, namedattribute("passthrough", passthrough)) + push!(_attributes, namedattribute("garbageCollector", garbageCollector)) + !isnothing(passthrough) && + push!(_attributes, namedattribute("passthrough", passthrough)) return IR.create_operation( "llvm.func", @@ -1504,7 +1509,7 @@ function landingpad( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(cleanup) && push!(attributes, namedattribute("cleanup", cleanup)) + !isnothing(cleanup) && push!(_attributes, namedattribute("cleanup", cleanup)) return IR.create_operation( "llvm.landingpad", @@ -1539,14 +1544,15 @@ function load( _successors = Block[] _attributes = NamedAttribute[] !isnothing(access_groups) && - push!(attributes, namedattribute("access_groups", access_groups)) + push!(_attributes, namedattribute("access_groups", access_groups)) !isnothing(alias_scopes) && - push!(attributes, namedattribute("alias_scopes", alias_scopes)) + push!(_attributes, namedattribute("alias_scopes", alias_scopes)) !isnothing(noalias_scopes) && - push!(attributes, namedattribute("noalias_scopes", noalias_scopes)) - !isnothing(alignment) && push!(attributes, namedattribute("alignment", alignment)) - !isnothing(volatile_) && push!(attributes, namedattribute("volatile_", volatile_)) - !isnothing(nontemporal) && push!(attributes, namedattribute("nontemporal", nontemporal)) + push!(_attributes, namedattribute("noalias_scopes", noalias_scopes)) + !isnothing(alignment) && push!(_attributes, namedattribute("alignment", alignment)) + !isnothing(volatile_) && push!(_attributes, namedattribute("volatile_", volatile_)) + !isnothing(nontemporal) && + push!(_attributes, namedattribute("nontemporal", nontemporal)) return IR.create_operation( "llvm.load", @@ -1947,14 +1953,15 @@ function store( _successors = Block[] _attributes = NamedAttribute[] !isnothing(access_groups) && - push!(attributes, namedattribute("access_groups", access_groups)) + push!(_attributes, namedattribute("access_groups", access_groups)) !isnothing(alias_scopes) && - push!(attributes, namedattribute("alias_scopes", alias_scopes)) + push!(_attributes, namedattribute("alias_scopes", alias_scopes)) !isnothing(noalias_scopes) && - push!(attributes, namedattribute("noalias_scopes", noalias_scopes)) - !isnothing(alignment) && push!(attributes, namedattribute("alignment", alignment)) - !isnothing(volatile_) && push!(attributes, namedattribute("volatile_", volatile_)) - !isnothing(nontemporal) && push!(attributes, namedattribute("nontemporal", nontemporal)) + push!(_attributes, namedattribute("noalias_scopes", noalias_scopes)) + !isnothing(alignment) && push!(_attributes, namedattribute("alignment", alignment)) + !isnothing(volatile_) && push!(_attributes, namedattribute("volatile_", volatile_)) + !isnothing(nontemporal) && + push!(_attributes, namedattribute("nontemporal", nontemporal)) return IR.create_operation( "llvm.store", @@ -2017,11 +2024,12 @@ function switch( "case_operand_segments", case_operand_segments ),] push!( - attributes, operandsegmentsizes([1, length(defaultOperands), length(caseOperands)]) + _attributes, operandsegmentsizes([1, length(defaultOperands), length(caseOperands)]) ) - !isnothing(case_values) && push!(attributes, namedattribute("case_values", case_values)) + !isnothing(case_values) && + push!(_attributes, namedattribute("case_values", case_values)) !isnothing(branch_weights) && - push!(attributes, namedattribute("branch_weights", branch_weights)) + push!(_attributes, namedattribute("branch_weights", branch_weights)) return IR.create_operation( "llvm.switch", @@ -5382,7 +5390,7 @@ function intr_vector_reduce_fadd( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(reassoc) && push!(attributes, namedattribute("reassoc", reassoc)) + !isnothing(reassoc) && push!(_attributes, namedattribute("reassoc", reassoc)) return IR.create_operation( "llvm.intr.vector.reduce.fadd", @@ -5454,7 +5462,7 @@ function intr_vector_reduce_fmul( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(reassoc) && push!(attributes, namedattribute("reassoc", reassoc)) + !isnothing(reassoc) && push!(_attributes, namedattribute("reassoc", reassoc)) return IR.create_operation( "llvm.intr.vector.reduce.fmul", @@ -5852,7 +5860,7 @@ function cp_async_shared_global( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[namedattribute("size", size),] - !isnothing(bypass_l1) && push!(attributes, namedattribute("bypass_l1", bypass_l1)) + !isnothing(bypass_l1) && push!(_attributes, namedattribute("bypass_l1", bypass_l1)) return IR.create_operation( "nvvm.cp.async.shared.global", @@ -6098,16 +6106,16 @@ function mma_sync( namedattribute("layoutB", layoutB), ] push!( - attributes, + _attributes, operandsegmentsizes([length(operandA), length(operandB), length(operandC)]), ) - !isnothing(b1Op) && push!(attributes, namedattribute("b1Op", b1Op)) + !isnothing(b1Op) && push!(_attributes, namedattribute("b1Op", b1Op)) !isnothing(intOverflowBehavior) && - push!(attributes, namedattribute("intOverflowBehavior", intOverflowBehavior)) + push!(_attributes, namedattribute("intOverflowBehavior", intOverflowBehavior)) !isnothing(multiplicandAPtxType) && - push!(attributes, namedattribute("multiplicandAPtxType", multiplicandAPtxType)) + push!(_attributes, namedattribute("multiplicandAPtxType", multiplicandAPtxType)) !isnothing(multiplicandBPtxType) && - push!(attributes, namedattribute("multiplicandBPtxType", multiplicandBPtxType)) + push!(_attributes, namedattribute("multiplicandBPtxType", multiplicandBPtxType)) return IR.create_operation( "nvvm.mma.sync", @@ -6164,7 +6172,7 @@ function shfl_sync( _successors = Block[] _attributes = NamedAttribute[namedattribute("kind", kind),] !isnothing(return_value_and_is_valid) && push!( - attributes, + _attributes, namedattribute("return_value_and_is_valid", return_value_and_is_valid), ) diff --git a/src/Dialects/15/Linalg.jl b/src/Dialects/15/Linalg.jl index 04a7fc6e..3866c31f 100644 --- a/src/Dialects/15/Linalg.jl +++ b/src/Dialects/15/Linalg.jl @@ -147,7 +147,7 @@ function batch_matmul( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) return IR.create_operation( "linalg.batch_matmul", @@ -179,7 +179,7 @@ function batch_matvec( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) return IR.create_operation( "linalg.batch_matvec", @@ -213,9 +213,9 @@ function conv_1d_nwc_wcf( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.conv_1d_nwc_wcf", @@ -247,7 +247,7 @@ function conv_1d( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) return IR.create_operation( "linalg.conv_1d", @@ -285,9 +285,9 @@ function conv_2d_nchw_fchw( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.conv_2d_nchw_fchw", @@ -325,9 +325,9 @@ function conv_2d_ngchw_fgchw( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.conv_2d_ngchw_fgchw", @@ -365,9 +365,9 @@ function conv_2d_nhwc_fhwc( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.conv_2d_nhwc_fhwc", @@ -405,9 +405,9 @@ function conv_2d_nhwc_hwcf( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.conv_2d_nhwc_hwcf", @@ -446,9 +446,9 @@ function conv_2d_nhwc_hwcf_q( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.conv_2d_nhwc_hwcf_q", @@ -480,7 +480,7 @@ function conv_2d( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) return IR.create_operation( "linalg.conv_2d", @@ -514,9 +514,9 @@ function conv_3d_ndhwc_dhwcf( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.conv_3d_ndhwc_dhwcf", @@ -548,7 +548,7 @@ function conv_3d( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) return IR.create_operation( "linalg.conv_3d", @@ -581,8 +581,8 @@ function copy( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(cast) && push!(attributes, namedattribute("cast", cast)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(cast) && push!(_attributes, namedattribute("cast", cast)) return IR.create_operation( "linalg.copy", @@ -617,9 +617,9 @@ function depthwise_conv_1d_nwc_wc( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.depthwise_conv_1d_nwc_wc", @@ -653,9 +653,9 @@ function depthwise_conv_1d_nwc_wcm( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.depthwise_conv_1d_nwc_wcm", @@ -690,9 +690,9 @@ function depthwise_conv_2d_nchw_chw( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.depthwise_conv_2d_nchw_chw", @@ -727,9 +727,9 @@ function depthwise_conv_2d_nhwc_hwc( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.depthwise_conv_2d_nhwc_hwc", @@ -763,9 +763,9 @@ function depthwise_conv_2d_nhwc_hwc_q( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.depthwise_conv_2d_nhwc_hwc_q", @@ -799,9 +799,9 @@ function depthwise_conv_2d_nhwc_hwcm( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.depthwise_conv_2d_nhwc_hwcm", @@ -835,9 +835,9 @@ function depthwise_conv_2d_nhwc_hwcm_q( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.depthwise_conv_2d_nhwc_hwcm_q", @@ -872,9 +872,9 @@ function depthwise_conv_3d_ndhwc_dhwc( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.depthwise_conv_3d_ndhwc_dhwc", @@ -908,9 +908,9 @@ function depthwise_conv_3d_ndhwc_dhwcm( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.depthwise_conv_3d_ndhwc_dhwcm", @@ -942,7 +942,7 @@ function dot( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) return IR.create_operation( "linalg.dot", @@ -976,9 +976,9 @@ function elemwise_binary( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(fun) && push!(attributes, namedattribute("fun", fun)) - !isnothing(cast) && push!(attributes, namedattribute("cast", cast)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(fun) && push!(_attributes, namedattribute("fun", fun)) + !isnothing(cast) && push!(_attributes, namedattribute("cast", cast)) return IR.create_operation( "linalg.elemwise_binary", @@ -1012,9 +1012,9 @@ function elemwise_unary( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(fun) && push!(attributes, namedattribute("fun", fun)) - !isnothing(cast) && push!(attributes, namedattribute("cast", cast)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(fun) && push!(_attributes, namedattribute("fun", fun)) + !isnothing(cast) && push!(_attributes, namedattribute("cast", cast)) return IR.create_operation( "linalg.elemwise_unary", @@ -1047,7 +1047,7 @@ function fill( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) return IR.create_operation( "linalg.fill", @@ -1084,7 +1084,7 @@ function fill_rng_2d( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) return IR.create_operation( "linalg.fill_rng_2d", @@ -1216,10 +1216,10 @@ function generic( namedattribute("indexing_maps", indexing_maps), namedattribute("iterator_types", iterator_types), ] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(doc) && push!(attributes, namedattribute("doc", doc)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(doc) && push!(_attributes, namedattribute("doc", doc)) !isnothing(library_call) && - push!(attributes, namedattribute("library_call", library_call)) + push!(_attributes, namedattribute("library_call", library_call)) return IR.create_operation( "linalg.generic", @@ -1252,8 +1252,8 @@ function matmul( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(cast) && push!(attributes, namedattribute("cast", cast)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(cast) && push!(_attributes, namedattribute("cast", cast)) return IR.create_operation( "linalg.matmul", @@ -1285,7 +1285,7 @@ function matmul_unsigned( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) return IR.create_operation( "linalg.matmul_unsigned", @@ -1317,7 +1317,7 @@ function matvec( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) return IR.create_operation( "linalg.matvec", @@ -1354,7 +1354,7 @@ function mmt4d( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) return IR.create_operation( "linalg.mmt4d", @@ -1388,9 +1388,9 @@ function pooling_nchw_max( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.pooling_nchw_max", @@ -1428,9 +1428,9 @@ function pooling_nchw_sum( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.pooling_nchw_sum", @@ -1464,9 +1464,9 @@ function pooling_ndhwc_max( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.pooling_ndhwc_max", @@ -1500,9 +1500,9 @@ function pooling_ndhwc_min( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.pooling_ndhwc_min", @@ -1536,9 +1536,9 @@ function pooling_ndhwc_sum( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.pooling_ndhwc_sum", @@ -1572,9 +1572,9 @@ function pooling_nhwc_max( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.pooling_nhwc_max", @@ -1608,9 +1608,9 @@ function pooling_nhwc_max_unsigned( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.pooling_nhwc_max_unsigned", @@ -1644,9 +1644,9 @@ function pooling_nhwc_min( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.pooling_nhwc_min", @@ -1680,9 +1680,9 @@ function pooling_nhwc_min_unsigned( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.pooling_nhwc_min_unsigned", @@ -1720,9 +1720,9 @@ function pooling_nhwc_sum( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.pooling_nhwc_sum", @@ -1756,7 +1756,7 @@ function quantized_batch_matmul( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) return IR.create_operation( "linalg.quantized_batch_matmul", @@ -1790,7 +1790,7 @@ function quantized_matmul( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) return IR.create_operation( "linalg.quantized_matmul", @@ -1822,7 +1822,7 @@ function vecmat( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) return IR.create_operation( "linalg.vecmat", diff --git a/src/Dialects/15/MLProgram.jl b/src/Dialects/15/MLProgram.jl index 112d81e7..c6f713db 100644 --- a/src/Dialects/15/MLProgram.jl +++ b/src/Dialects/15/MLProgram.jl @@ -35,7 +35,7 @@ function func(; namedattribute("sym_name", sym_name), namedattribute("function_type", function_type) ] !isnothing(sym_visibility) && - push!(attributes, namedattribute("sym_visibility", sym_visibility)) + push!(_attributes, namedattribute("sym_visibility", sym_visibility)) return IR.create_operation( "ml_program.func", @@ -211,10 +211,10 @@ function global_(; _attributes = NamedAttribute[ namedattribute("sym_name", sym_name), namedattribute("type", type) ] - !isnothing(is_mutable) && push!(attributes, namedattribute("is_mutable", is_mutable)) - !isnothing(value) && push!(attributes, namedattribute("value", value)) + !isnothing(is_mutable) && push!(_attributes, namedattribute("is_mutable", is_mutable)) + !isnothing(value) && push!(_attributes, namedattribute("value", value)) !isnothing(sym_visibility) && - push!(attributes, namedattribute("sym_visibility", sym_visibility)) + push!(_attributes, namedattribute("sym_visibility", sym_visibility)) return IR.create_operation( "ml_program.global", @@ -399,7 +399,7 @@ function subgraph(; namedattribute("sym_name", sym_name), namedattribute("function_type", function_type) ] !isnothing(sym_visibility) && - push!(attributes, namedattribute("sym_visibility", sym_visibility)) + push!(_attributes, namedattribute("sym_visibility", sym_visibility)) return IR.create_operation( "ml_program.subgraph", diff --git a/src/Dialects/15/MemRef.jl b/src/Dialects/15/MemRef.jl index 36059d6d..f27fd854 100644 --- a/src/Dialects/15/MemRef.jl +++ b/src/Dialects/15/MemRef.jl @@ -293,8 +293,8 @@ function alloc( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(dynamicSizes), length(symbolOperands)])) - !isnothing(alignment) && push!(attributes, namedattribute("alignment", alignment)) + push!(_attributes, operandsegmentsizes([length(dynamicSizes), length(symbolOperands)])) + !isnothing(alignment) && push!(_attributes, namedattribute("alignment", alignment)) return IR.create_operation( "memref.alloc", @@ -357,8 +357,8 @@ function alloca( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(dynamicSizes), length(symbolOperands)])) - !isnothing(alignment) && push!(attributes, namedattribute("alignment", alignment)) + push!(_attributes, operandsegmentsizes([length(dynamicSizes), length(symbolOperands)])) + !isnothing(alignment) && push!(_attributes, namedattribute("alignment", alignment)) return IR.create_operation( "memref.alloca", @@ -927,11 +927,11 @@ function global_(; namedattribute("sym_name", sym_name), namedattribute("type", type) ] !isnothing(sym_visibility) && - push!(attributes, namedattribute("sym_visibility", sym_visibility)) + push!(_attributes, namedattribute("sym_visibility", sym_visibility)) !isnothing(initial_value) && - push!(attributes, namedattribute("initial_value", initial_value)) - !isnothing(constant) && push!(attributes, namedattribute("constant", constant)) - !isnothing(alignment) && push!(attributes, namedattribute("alignment", alignment)) + push!(_attributes, namedattribute("initial_value", initial_value)) + !isnothing(constant) && push!(_attributes, namedattribute("constant", constant)) + !isnothing(alignment) && push!(_attributes, namedattribute("alignment", alignment)) return IR.create_operation( "memref.global", @@ -1065,7 +1065,7 @@ function reinterpret_cast( namedattribute("static_strides", static_strides), ] push!( - attributes, + _attributes, operandsegmentsizes([1, length(offsets), length(sizes), length(strides)]), ) @@ -1435,7 +1435,7 @@ function subview( namedattribute("static_strides", static_strides), ] push!( - attributes, + _attributes, operandsegmentsizes([1, length(offsets), length(sizes), length(strides)]), ) diff --git a/src/Dialects/15/NVGPU.jl b/src/Dialects/15/NVGPU.jl index 6b91e45b..142c6dd4 100644 --- a/src/Dialects/15/NVGPU.jl +++ b/src/Dialects/15/NVGPU.jl @@ -61,8 +61,8 @@ function device_async_copy( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[namedattribute("numElements", numElements),] - push!(attributes, operandsegmentsizes([1, length(dstIndices), 1, length(srcIndices)])) - !isnothing(bypassL1) && push!(attributes, namedattribute("bypassL1", bypassL1)) + push!(_attributes, operandsegmentsizes([1, length(dstIndices), 1, length(srcIndices)])) + !isnothing(bypassL1) && push!(_attributes, namedattribute("bypassL1", bypassL1)) return IR.create_operation( "nvgpu.device_async_copy", @@ -137,7 +137,7 @@ function device_async_wait(asyncDependencies::Value; numGroups=nothing, location _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(numGroups) && push!(attributes, namedattribute("numGroups", numGroups)) + !isnothing(numGroups) && push!(_attributes, namedattribute("numGroups", numGroups)) return IR.create_operation( "nvgpu.device_async_wait", diff --git a/src/Dialects/15/OpenACC.jl b/src/Dialects/15/OpenACC.jl index 2907d651..0779ee39 100644 --- a/src/Dialects/15/OpenACC.jl +++ b/src/Dialects/15/OpenACC.jl @@ -56,9 +56,9 @@ function data( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(ifCond) && push!(operands, ifCond) + !isnothing(ifCond) && push!(_operands, ifCond) push!( - attributes, + _attributes, operandsegmentsizes([ isnothing(ifCond) ? 0 : 1, length(copyOperands), @@ -74,7 +74,8 @@ function data( length(attachOperands), ]), ) - !isnothing(defaultAttr) && push!(attributes, namedattribute("defaultAttr", defaultAttr)) + !isnothing(defaultAttr) && + push!(_attributes, namedattribute("defaultAttr", defaultAttr)) return IR.create_operation( "acc.data", @@ -123,11 +124,11 @@ function enter_data( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(ifCond) && push!(operands, ifCond) - !isnothing(asyncOperand) && push!(operands, asyncOperand) - !isnothing(waitDevnum) && push!(operands, waitDevnum) + !isnothing(ifCond) && push!(_operands, ifCond) + !isnothing(asyncOperand) && push!(_operands, asyncOperand) + !isnothing(waitDevnum) && push!(_operands, waitDevnum) push!( - attributes, + _attributes, operandsegmentsizes([ isnothing(ifCond) ? 0 : 1, isnothing(asyncOperand) ? 0 : 1, @@ -139,8 +140,8 @@ function enter_data( length(attachOperands), ]), ) - !isnothing(async) && push!(attributes, namedattribute("async", async)) - !isnothing(wait) && push!(attributes, namedattribute("wait", wait)) + !isnothing(async) && push!(_attributes, namedattribute("async", async)) + !isnothing(wait) && push!(_attributes, namedattribute("wait", wait)) return IR.create_operation( "acc.enter_data", @@ -185,11 +186,11 @@ function exit_data( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(ifCond) && push!(operands, ifCond) - !isnothing(asyncOperand) && push!(operands, asyncOperand) - !isnothing(waitDevnum) && push!(operands, waitDevnum) + !isnothing(ifCond) && push!(_operands, ifCond) + !isnothing(asyncOperand) && push!(_operands, asyncOperand) + !isnothing(waitDevnum) && push!(_operands, waitDevnum) push!( - attributes, + _attributes, operandsegmentsizes([ isnothing(ifCond) ? 0 : 1, isnothing(asyncOperand) ? 0 : 1, @@ -200,9 +201,9 @@ function exit_data( length(detachOperands), ]), ) - !isnothing(async) && push!(attributes, namedattribute("async", async)) - !isnothing(wait) && push!(attributes, namedattribute("wait", wait)) - !isnothing(finalize) && push!(attributes, namedattribute("finalize", finalize)) + !isnothing(async) && push!(_attributes, namedattribute("async", async)) + !isnothing(wait) && push!(_attributes, namedattribute("wait", wait)) + !isnothing(finalize) && push!(_attributes, namedattribute("finalize", finalize)) return IR.create_operation( "acc.exit_data", @@ -240,10 +241,10 @@ function init( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(deviceNumOperand) && push!(operands, deviceNumOperand) - !isnothing(ifCond) && push!(operands, ifCond) + !isnothing(deviceNumOperand) && push!(_operands, deviceNumOperand) + !isnothing(ifCond) && push!(_operands, ifCond) push!( - attributes, + _attributes, operandsegmentsizes([ length(deviceTypeOperands), isnothing(deviceNumOperand) ? 0 : 1, @@ -306,12 +307,12 @@ function loop( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(gangNum) && push!(operands, gangNum) - !isnothing(gangStatic) && push!(operands, gangStatic) - !isnothing(workerNum) && push!(operands, workerNum) - !isnothing(vectorLength) && push!(operands, vectorLength) + !isnothing(gangNum) && push!(_operands, gangNum) + !isnothing(gangStatic) && push!(_operands, gangStatic) + !isnothing(workerNum) && push!(_operands, workerNum) + !isnothing(vectorLength) && push!(_operands, vectorLength) push!( - attributes, + _attributes, operandsegmentsizes([ isnothing(gangNum) ? 0 : 1, isnothing(gangStatic) ? 0 : 1, @@ -322,13 +323,15 @@ function loop( length(reductionOperands), ]), ) - !isnothing(collapse) && push!(attributes, namedattribute("collapse", collapse)) - !isnothing(seq) && push!(attributes, namedattribute("seq", seq)) - !isnothing(independent) && push!(attributes, namedattribute("independent", independent)) - !isnothing(auto_) && push!(attributes, namedattribute("auto_", auto_)) - !isnothing(reductionOp) && push!(attributes, namedattribute("reductionOp", reductionOp)) + !isnothing(collapse) && push!(_attributes, namedattribute("collapse", collapse)) + !isnothing(seq) && push!(_attributes, namedattribute("seq", seq)) + !isnothing(independent) && + push!(_attributes, namedattribute("independent", independent)) + !isnothing(auto_) && push!(_attributes, namedattribute("auto_", auto_)) + !isnothing(reductionOp) && + push!(_attributes, namedattribute("reductionOp", reductionOp)) !isnothing(exec_mapping) && - push!(attributes, namedattribute("exec_mapping", exec_mapping)) + push!(_attributes, namedattribute("exec_mapping", exec_mapping)) return IR.create_operation( "acc.loop", @@ -408,14 +411,14 @@ function parallel( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(async) && push!(operands, async) - !isnothing(numGangs) && push!(operands, numGangs) - !isnothing(numWorkers) && push!(operands, numWorkers) - !isnothing(vectorLength) && push!(operands, vectorLength) - !isnothing(ifCond) && push!(operands, ifCond) - !isnothing(selfCond) && push!(operands, selfCond) + !isnothing(async) && push!(_operands, async) + !isnothing(numGangs) && push!(_operands, numGangs) + !isnothing(numWorkers) && push!(_operands, numWorkers) + !isnothing(vectorLength) && push!(_operands, vectorLength) + !isnothing(ifCond) && push!(_operands, ifCond) + !isnothing(selfCond) && push!(_operands, selfCond) push!( - attributes, + _attributes, operandsegmentsizes([ isnothing(async) ? 0 : 1, length(waitOperands), @@ -440,11 +443,13 @@ function parallel( length(gangFirstPrivateOperands), ]), ) - !isnothing(asyncAttr) && push!(attributes, namedattribute("asyncAttr", asyncAttr)) - !isnothing(waitAttr) && push!(attributes, namedattribute("waitAttr", waitAttr)) - !isnothing(selfAttr) && push!(attributes, namedattribute("selfAttr", selfAttr)) - !isnothing(reductionOp) && push!(attributes, namedattribute("reductionOp", reductionOp)) - !isnothing(defaultAttr) && push!(attributes, namedattribute("defaultAttr", defaultAttr)) + !isnothing(asyncAttr) && push!(_attributes, namedattribute("asyncAttr", asyncAttr)) + !isnothing(waitAttr) && push!(_attributes, namedattribute("waitAttr", waitAttr)) + !isnothing(selfAttr) && push!(_attributes, namedattribute("selfAttr", selfAttr)) + !isnothing(reductionOp) && + push!(_attributes, namedattribute("reductionOp", reductionOp)) + !isnothing(defaultAttr) && + push!(_attributes, namedattribute("defaultAttr", defaultAttr)) return IR.create_operation( "acc.parallel", @@ -482,10 +487,10 @@ function shutdown( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(deviceNumOperand) && push!(operands, deviceNumOperand) - !isnothing(ifCond) && push!(operands, ifCond) + !isnothing(deviceNumOperand) && push!(_operands, deviceNumOperand) + !isnothing(ifCond) && push!(_operands, ifCond) push!( - attributes, + _attributes, operandsegmentsizes([ length(deviceTypeOperands), isnothing(deviceNumOperand) ? 0 : 1, @@ -566,11 +571,11 @@ function update( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(ifCond) && push!(operands, ifCond) - !isnothing(asyncOperand) && push!(operands, asyncOperand) - !isnothing(waitDevnum) && push!(operands, waitDevnum) + !isnothing(ifCond) && push!(_operands, ifCond) + !isnothing(asyncOperand) && push!(_operands, asyncOperand) + !isnothing(waitDevnum) && push!(_operands, waitDevnum) push!( - attributes, + _attributes, operandsegmentsizes([ isnothing(ifCond) ? 0 : 1, isnothing(asyncOperand) ? 0 : 1, @@ -581,9 +586,9 @@ function update( length(deviceOperands), ]), ) - !isnothing(async) && push!(attributes, namedattribute("async", async)) - !isnothing(wait) && push!(attributes, namedattribute("wait", wait)) - !isnothing(ifPresent) && push!(attributes, namedattribute("ifPresent", ifPresent)) + !isnothing(async) && push!(_attributes, namedattribute("async", async)) + !isnothing(wait) && push!(_attributes, namedattribute("wait", wait)) + !isnothing(ifPresent) && push!(_attributes, namedattribute("ifPresent", ifPresent)) return IR.create_operation( "acc.update", @@ -623,11 +628,11 @@ function wait( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(asyncOperand) && push!(operands, asyncOperand) - !isnothing(waitDevnum) && push!(operands, waitDevnum) - !isnothing(ifCond) && push!(operands, ifCond) + !isnothing(asyncOperand) && push!(_operands, asyncOperand) + !isnothing(waitDevnum) && push!(_operands, waitDevnum) + !isnothing(ifCond) && push!(_operands, ifCond) push!( - attributes, + _attributes, operandsegmentsizes([ length(waitOperands), isnothing(asyncOperand) ? 0 : 1, @@ -635,7 +640,7 @@ function wait( isnothing(ifCond) ? 0 : 1, ]), ) - !isnothing(async) && push!(attributes, namedattribute("async", async)) + !isnothing(async) && push!(_attributes, namedattribute("async", async)) return IR.create_operation( "acc.wait", diff --git a/src/Dialects/15/OpenMP.jl b/src/Dialects/15/OpenMP.jl index 07e9b0c0..eeb4e83a 100644 --- a/src/Dialects/15/OpenMP.jl +++ b/src/Dialects/15/OpenMP.jl @@ -45,9 +45,9 @@ function atomic_capture(; _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(hint_val) && push!(attributes, namedattribute("hint_val", hint_val)) + !isnothing(hint_val) && push!(_attributes, namedattribute("hint_val", hint_val)) !isnothing(memory_order_val) && - push!(attributes, namedattribute("memory_order_val", memory_order_val)) + push!(_attributes, namedattribute("memory_order_val", memory_order_val)) return IR.create_operation( "omp.atomic.capture", @@ -84,9 +84,9 @@ function atomic_read( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(hint_val) && push!(attributes, namedattribute("hint_val", hint_val)) + !isnothing(hint_val) && push!(_attributes, namedattribute("hint_val", hint_val)) !isnothing(memory_order_val) && - push!(attributes, namedattribute("memory_order_val", memory_order_val)) + push!(_attributes, namedattribute("memory_order_val", memory_order_val)) return IR.create_operation( "omp.atomic.read", @@ -142,9 +142,9 @@ function atomic_update( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(hint_val) && push!(attributes, namedattribute("hint_val", hint_val)) + !isnothing(hint_val) && push!(_attributes, namedattribute("hint_val", hint_val)) !isnothing(memory_order_val) && - push!(attributes, namedattribute("memory_order_val", memory_order_val)) + push!(_attributes, namedattribute("memory_order_val", memory_order_val)) return IR.create_operation( "omp.atomic.update", @@ -187,9 +187,9 @@ function atomic_write( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(hint_val) && push!(attributes, namedattribute("hint_val", hint_val)) + !isnothing(hint_val) && push!(_attributes, namedattribute("hint_val", hint_val)) !isnothing(memory_order_val) && - push!(attributes, namedattribute("memory_order_val", memory_order_val)) + push!(_attributes, namedattribute("memory_order_val", memory_order_val)) return IR.create_operation( "omp.atomic.write", @@ -246,7 +246,7 @@ function cancel( _attributes = NamedAttribute[namedattribute( "cancellation_construct_type_val", cancellation_construct_type_val ),] - !isnothing(if_expr) && push!(operands, if_expr) + !isnothing(if_expr) && push!(_operands, if_expr) return IR.create_operation( "omp.cancel", @@ -301,7 +301,7 @@ function critical_declare(; sym_name, hint_val=nothing, location=Location()) _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[namedattribute("sym_name", sym_name),] - !isnothing(hint_val) && push!(attributes, namedattribute("hint_val", hint_val)) + !isnothing(hint_val) && push!(_attributes, namedattribute("hint_val", hint_val)) return IR.create_operation( "omp.critical.declare", @@ -327,7 +327,7 @@ function critical(; name=nothing, region::Region, location=Location()) _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(name) && push!(attributes, namedattribute("name", name)) + !isnothing(name) && push!(_attributes, namedattribute("name", name)) return IR.create_operation( "omp.critical", @@ -423,9 +423,9 @@ function ordered( _successors = Block[] _attributes = NamedAttribute[] !isnothing(depend_type_val) && - push!(attributes, namedattribute("depend_type_val", depend_type_val)) + push!(_attributes, namedattribute("depend_type_val", depend_type_val)) !isnothing(num_loops_val) && - push!(attributes, namedattribute("num_loops_val", num_loops_val)) + push!(_attributes, namedattribute("num_loops_val", num_loops_val)) return IR.create_operation( "omp.ordered", @@ -456,7 +456,7 @@ function ordered_region(; simd=nothing, region::Region, location=Location()) _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(simd) && push!(attributes, namedattribute("simd", simd)) + !isnothing(simd) && push!(_attributes, namedattribute("simd", simd)) return IR.create_operation( "omp.ordered_region", @@ -518,10 +518,10 @@ function parallel( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(if_expr_var) && push!(operands, if_expr_var) - !isnothing(num_threads_var) && push!(operands, num_threads_var) + !isnothing(if_expr_var) && push!(_operands, if_expr_var) + !isnothing(num_threads_var) && push!(_operands, num_threads_var) push!( - attributes, + _attributes, operandsegmentsizes([ isnothing(if_expr_var) ? 0 : 1, isnothing(num_threads_var) ? 0 : 1, @@ -530,9 +530,9 @@ function parallel( length(reduction_vars), ]), ) - !isnothing(reductions) && push!(attributes, namedattribute("reductions", reductions)) + !isnothing(reductions) && push!(_attributes, namedattribute("reductions", reductions)) !isnothing(proc_bind_val) && - push!(attributes, namedattribute("proc_bind_val", proc_bind_val)) + push!(_attributes, namedattribute("proc_bind_val", proc_bind_val)) return IR.create_operation( "omp.parallel", @@ -694,13 +694,13 @@ function sections( _successors = Block[] _attributes = NamedAttribute[] push!( - attributes, + _attributes, operandsegmentsizes([ length(reduction_vars), length(allocate_vars), length(allocators_vars) ]), ) - !isnothing(reductions) && push!(attributes, namedattribute("reductions", reductions)) - !isnothing(nowait) && push!(attributes, namedattribute("nowait", nowait)) + !isnothing(reductions) && push!(_attributes, namedattribute("reductions", reductions)) + !isnothing(nowait) && push!(_attributes, namedattribute("nowait", nowait)) return IR.create_operation( "omp.sections", @@ -752,14 +752,14 @@ function simdloop( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(if_expr) && push!(operands, if_expr) + !isnothing(if_expr) && push!(_operands, if_expr) push!( - attributes, + _attributes, operandsegmentsizes([ length(lowerBound), length(upperBound), length(step), isnothing(if_expr) ? 0 : 1 ]), ) - !isnothing(inclusive) && push!(attributes, namedattribute("inclusive", inclusive)) + !isnothing(inclusive) && push!(_attributes, namedattribute("inclusive", inclusive)) return IR.create_operation( "omp.simdloop", @@ -794,8 +794,10 @@ function single( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(allocate_vars), length(allocators_vars)])) - !isnothing(nowait) && push!(attributes, namedattribute("nowait", nowait)) + push!( + _attributes, operandsegmentsizes([length(allocate_vars), length(allocators_vars)]) + ) + !isnothing(nowait) && push!(_attributes, namedattribute("nowait", nowait)) return IR.create_operation( "omp.single", @@ -842,18 +844,18 @@ function target( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(if_expr) && push!(operands, if_expr) - !isnothing(device) && push!(operands, device) - !isnothing(thread_limit) && push!(operands, thread_limit) + !isnothing(if_expr) && push!(_operands, if_expr) + !isnothing(device) && push!(_operands, device) + !isnothing(thread_limit) && push!(_operands, thread_limit) push!( - attributes, + _attributes, operandsegmentsizes([ isnothing(if_expr) ? 0 : 1, isnothing(device) ? 0 : 1, isnothing(thread_limit) ? 0 : 1, ]), ) - !isnothing(nowait) && push!(attributes, namedattribute("nowait", nowait)) + !isnothing(nowait) && push!(_attributes, namedattribute("nowait", nowait)) return IR.create_operation( "omp.target", @@ -905,13 +907,13 @@ function taskgroup( _successors = Block[] _attributes = NamedAttribute[] push!( - attributes, + _attributes, operandsegmentsizes([ length(task_reduction_vars), length(allocate_vars), length(allocators_vars) ]), ) !isnothing(task_reductions) && - push!(attributes, namedattribute("task_reductions", task_reductions)) + push!(_attributes, namedattribute("task_reductions", task_reductions)) return IR.create_operation( "omp.taskgroup", @@ -1058,13 +1060,13 @@ function taskloop( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(if_expr) && push!(operands, if_expr) - !isnothing(final_expr) && push!(operands, final_expr) - !isnothing(priority) && push!(operands, priority) - !isnothing(grain_size) && push!(operands, grain_size) - !isnothing(num_tasks) && push!(operands, num_tasks) + !isnothing(if_expr) && push!(_operands, if_expr) + !isnothing(final_expr) && push!(_operands, final_expr) + !isnothing(priority) && push!(_operands, priority) + !isnothing(grain_size) && push!(_operands, grain_size) + !isnothing(num_tasks) && push!(_operands, num_tasks) push!( - attributes, + _attributes, operandsegmentsizes([ length(lowerBound), length(upperBound), @@ -1080,13 +1082,13 @@ function taskloop( isnothing(num_tasks) ? 0 : 1, ]), ) - !isnothing(inclusive) && push!(attributes, namedattribute("inclusive", inclusive)) - !isnothing(untied) && push!(attributes, namedattribute("untied", untied)) - !isnothing(mergeable) && push!(attributes, namedattribute("mergeable", mergeable)) + !isnothing(inclusive) && push!(_attributes, namedattribute("inclusive", inclusive)) + !isnothing(untied) && push!(_attributes, namedattribute("untied", untied)) + !isnothing(mergeable) && push!(_attributes, namedattribute("mergeable", mergeable)) !isnothing(in_reductions) && - push!(attributes, namedattribute("in_reductions", in_reductions)) - !isnothing(reductions) && push!(attributes, namedattribute("reductions", reductions)) - !isnothing(nogroup) && push!(attributes, namedattribute("nogroup", nogroup)) + push!(_attributes, namedattribute("in_reductions", in_reductions)) + !isnothing(reductions) && push!(_attributes, namedattribute("reductions", reductions)) + !isnothing(nogroup) && push!(_attributes, namedattribute("nogroup", nogroup)) return IR.create_operation( "omp.taskloop", @@ -1160,11 +1162,11 @@ function task( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(if_expr) && push!(operands, if_expr) - !isnothing(final_expr) && push!(operands, final_expr) - !isnothing(priority) && push!(operands, priority) + !isnothing(if_expr) && push!(_operands, if_expr) + !isnothing(final_expr) && push!(_operands, final_expr) + !isnothing(priority) && push!(_operands, priority) push!( - attributes, + _attributes, operandsegmentsizes([ isnothing(if_expr) ? 0 : 1, isnothing(final_expr) ? 0 : 1, @@ -1174,10 +1176,10 @@ function task( length(allocators_vars), ]), ) - !isnothing(untied) && push!(attributes, namedattribute("untied", untied)) - !isnothing(mergeable) && push!(attributes, namedattribute("mergeable", mergeable)) + !isnothing(untied) && push!(_attributes, namedattribute("untied", untied)) + !isnothing(mergeable) && push!(_attributes, namedattribute("mergeable", mergeable)) !isnothing(in_reductions) && - push!(attributes, namedattribute("in_reductions", in_reductions)) + push!(_attributes, namedattribute("in_reductions", in_reductions)) return IR.create_operation( "omp.task", @@ -1397,9 +1399,9 @@ function wsloop( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(schedule_chunk_var) && push!(operands, schedule_chunk_var) + !isnothing(schedule_chunk_var) && push!(_operands, schedule_chunk_var) push!( - attributes, + _attributes, operandsegmentsizes([ length(lowerBound), length(upperBound), @@ -1410,17 +1412,18 @@ function wsloop( isnothing(schedule_chunk_var) ? 0 : 1, ]), ) - !isnothing(reductions) && push!(attributes, namedattribute("reductions", reductions)) + !isnothing(reductions) && push!(_attributes, namedattribute("reductions", reductions)) !isnothing(schedule_val) && - push!(attributes, namedattribute("schedule_val", schedule_val)) + push!(_attributes, namedattribute("schedule_val", schedule_val)) !isnothing(schedule_modifier) && - push!(attributes, namedattribute("schedule_modifier", schedule_modifier)) + push!(_attributes, namedattribute("schedule_modifier", schedule_modifier)) !isnothing(simd_modifier) && - push!(attributes, namedattribute("simd_modifier", simd_modifier)) - !isnothing(nowait) && push!(attributes, namedattribute("nowait", nowait)) - !isnothing(ordered_val) && push!(attributes, namedattribute("ordered_val", ordered_val)) - !isnothing(order_val) && push!(attributes, namedattribute("order_val", order_val)) - !isnothing(inclusive) && push!(attributes, namedattribute("inclusive", inclusive)) + push!(_attributes, namedattribute("simd_modifier", simd_modifier)) + !isnothing(nowait) && push!(_attributes, namedattribute("nowait", nowait)) + !isnothing(ordered_val) && + push!(_attributes, namedattribute("ordered_val", ordered_val)) + !isnothing(order_val) && push!(_attributes, namedattribute("order_val", order_val)) + !isnothing(inclusive) && push!(_attributes, namedattribute("inclusive", inclusive)) return IR.create_operation( "omp.wsloop", diff --git a/src/Dialects/15/PDL.jl b/src/Dialects/15/PDL.jl index c31bcd17..c9c7f325 100644 --- a/src/Dialects/15/PDL.jl +++ b/src/Dialects/15/PDL.jl @@ -119,8 +119,8 @@ function attribute( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(type) && push!(operands, type) - !isnothing(value) && push!(attributes, namedattribute("value", value)) + !isnothing(type) && push!(_operands, type) + !isnothing(value) && push!(_attributes, namedattribute("value", value)) return IR.create_operation( "pdl.attribute", @@ -193,7 +193,7 @@ function operand(type=nothing::Union{Nothing,Value}; val::IR.Type, location=Loca _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(type) && push!(operands, type) + !isnothing(type) && push!(_operands, type) return IR.create_operation( "pdl.operand", @@ -234,7 +234,7 @@ function operands(type=nothing::Union{Nothing,Value}; val::IR.Type, location=Loc _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(type) && push!(operands, type) + !isnothing(type) && push!(_operands, type) return IR.create_operation( "pdl.operands", @@ -360,10 +360,10 @@ function operation( _successors = Block[] _attributes = NamedAttribute[namedattribute("attributeNames", attributeNames),] push!( - attributes, + _attributes, operandsegmentsizes([length(operands), length(attributes), length(types)]), ) - !isnothing(name) && push!(attributes, namedattribute("name", name)) + !isnothing(name) && push!(_attributes, namedattribute("name", name)) return IR.create_operation( "pdl.operation", @@ -407,7 +407,7 @@ function pattern(; benefit, sym_name=nothing, body::Region, location=Location()) _owned_regions = Region[body,] _successors = Block[] _attributes = NamedAttribute[namedattribute("benefit", benefit),] - !isnothing(sym_name) && push!(attributes, namedattribute("sym_name", sym_name)) + !isnothing(sym_name) && push!(_attributes, namedattribute("sym_name", sym_name)) return IR.create_operation( "pdl.pattern", @@ -457,9 +457,9 @@ function replace( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(replOperation) && push!(operands, replOperation) + !isnothing(replOperation) && push!(_operands, replOperation) push!( - attributes, + _attributes, operandsegmentsizes([1, isnothing(replOperation) ? 0 : 1, length(replValues)]), ) @@ -551,7 +551,7 @@ function results(parent::Value; val::IR.Type, index=nothing, location=Location() _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(index) && push!(attributes, namedattribute("index", index)) + !isnothing(index) && push!(_attributes, namedattribute("index", index)) return IR.create_operation( "pdl.results", @@ -616,9 +616,9 @@ function rewrite( _owned_regions = Region[body,] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(root) && push!(operands, root) - push!(attributes, operandsegmentsizes([isnothing(root) ? 0 : 1, length(externalArgs)])) - !isnothing(name) && push!(attributes, namedattribute("name", name)) + !isnothing(root) && push!(_operands, root) + push!(_attributes, operandsegmentsizes([isnothing(root) ? 0 : 1, length(externalArgs)])) + !isnothing(name) && push!(_attributes, namedattribute("name", name)) return IR.create_operation( "pdl.rewrite", @@ -656,7 +656,7 @@ function type(; result::IR.Type, type=nothing, location=Location()) _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(type) && push!(attributes, namedattribute("type", type)) + !isnothing(type) && push!(_attributes, namedattribute("type", type)) return IR.create_operation( "pdl.type", @@ -694,7 +694,7 @@ function types(; result::IR.Type, types=nothing, location=Location()) _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(types) && push!(attributes, namedattribute("types", types)) + !isnothing(types) && push!(_attributes, namedattribute("types", types)) return IR.create_operation( "pdl.types", diff --git a/src/Dialects/15/PDLInterp.jl b/src/Dialects/15/PDLInterp.jl index 8d81df0f..73ae9a04 100644 --- a/src/Dialects/15/PDLInterp.jl +++ b/src/Dialects/15/PDLInterp.jl @@ -217,7 +217,7 @@ function check_operand_count( _successors = Block[trueDest, falseDest] _attributes = NamedAttribute[namedattribute("count", count),] !isnothing(compareAtLeast) && - push!(attributes, namedattribute("compareAtLeast", compareAtLeast)) + push!(_attributes, namedattribute("compareAtLeast", compareAtLeast)) return IR.create_operation( "pdl_interp.check_operand_count", @@ -298,7 +298,7 @@ function check_result_count( _successors = Block[trueDest, falseDest] _attributes = NamedAttribute[namedattribute("count", count),] !isnothing(compareAtLeast) && - push!(attributes, namedattribute("compareAtLeast", compareAtLeast)) + push!(_attributes, namedattribute("compareAtLeast", compareAtLeast)) return IR.create_operation( "pdl_interp.check_result_count", @@ -481,13 +481,13 @@ function create_operation( namedattribute("inputAttributeNames", inputAttributeNames), ] push!( - attributes, + _attributes, operandsegmentsizes([ length(inputOperands), length(inputAttributes), length(inputResultTypes) ]), ) !isnothing(inferredResultTypes) && - push!(attributes, namedattribute("inferredResultTypes", inferredResultTypes)) + push!(_attributes, namedattribute("inferredResultTypes", inferredResultTypes)) return IR.create_operation( "pdl_interp.create_operation", @@ -892,7 +892,7 @@ function get_operands(inputOp::Value; value::IR.Type, index=nothing, location=Lo _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(index) && push!(attributes, namedattribute("index", index)) + !isnothing(index) && push!(_attributes, namedattribute("index", index)) return IR.create_operation( "pdl_interp.get_operands", @@ -967,7 +967,7 @@ function get_results(inputOp::Value; value::IR.Type, index=nothing, location=Loc _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(index) && push!(attributes, namedattribute("index", index)) + !isnothing(index) && push!(_attributes, namedattribute("index", index)) return IR.create_operation( "pdl_interp.get_results", @@ -1117,10 +1117,10 @@ function record_match( _attributes = NamedAttribute[ namedattribute("rewriter", rewriter), namedattribute("benefit", benefit) ] - push!(attributes, operandsegmentsizes([length(inputs), length(matchedOps)])) - !isnothing(rootKind) && push!(attributes, namedattribute("rootKind", rootKind)) + push!(_attributes, operandsegmentsizes([length(inputs), length(matchedOps)])) + !isnothing(rootKind) && push!(_attributes, namedattribute("rootKind", rootKind)) !isnothing(generatedOps) && - push!(attributes, namedattribute("generatedOps", generatedOps)) + push!(_attributes, namedattribute("generatedOps", generatedOps)) return IR.create_operation( "pdl_interp.record_match", diff --git a/src/Dialects/15/Quant.jl b/src/Dialects/15/Quant.jl index 2ec8e612..42ad32e2 100644 --- a/src/Dialects/15/Quant.jl +++ b/src/Dialects/15/Quant.jl @@ -33,8 +33,8 @@ function const_fake_quant( ] !isnothing(outputs) && push!(_results, outputs) !isnothing(narrow_range) && - push!(attributes, namedattribute("narrow_range", narrow_range)) - !isnothing(is_signed) && push!(attributes, namedattribute("is_signed", is_signed)) + push!(_attributes, namedattribute("narrow_range", narrow_range)) + !isnothing(is_signed) && push!(_attributes, namedattribute("is_signed", is_signed)) return IR.create_operation( "quant.const_fake_quant", @@ -80,8 +80,8 @@ function const_fake_quant_per_axis( ] !isnothing(outputs) && push!(_results, outputs) !isnothing(narrow_range) && - push!(attributes, namedattribute("narrow_range", narrow_range)) - !isnothing(is_signed) && push!(attributes, namedattribute("is_signed", is_signed)) + push!(_attributes, namedattribute("narrow_range", narrow_range)) + !isnothing(is_signed) && push!(_attributes, namedattribute("is_signed", is_signed)) return IR.create_operation( "quant.const_fake_quant_per_axis", @@ -265,8 +265,8 @@ function stats( _successors = Block[] _attributes = NamedAttribute[namedattribute("layerStats", layerStats),] !isnothing(result_0) && push!(_results, result_0) - !isnothing(axisStats) && push!(attributes, namedattribute("axisStats", axisStats)) - !isnothing(axis) && push!(attributes, namedattribute("axis", axis)) + !isnothing(axisStats) && push!(_attributes, namedattribute("axisStats", axisStats)) + !isnothing(axis) && push!(_attributes, namedattribute("axis", axis)) return IR.create_operation( "quant.stats", diff --git a/src/Dialects/15/SCF.jl b/src/Dialects/15/SCF.jl index e4b50a05..f6a4f2fa 100644 --- a/src/Dialects/15/SCF.jl +++ b/src/Dialects/15/SCF.jl @@ -320,7 +320,7 @@ function foreach_thread( _successors = Block[] _attributes = NamedAttribute[] !isnothing(thread_dim_mapping) && - push!(attributes, namedattribute("thread_dim_mapping", thread_dim_mapping)) + push!(_attributes, namedattribute("thread_dim_mapping", thread_dim_mapping)) return IR.create_operation( "scf.foreach_thread", @@ -466,7 +466,7 @@ function parallel( _successors = Block[] _attributes = NamedAttribute[] push!( - attributes, + _attributes, operandsegmentsizes([ length(lowerBound), length(upperBound), length(step), length(initVals) ]), diff --git a/src/Dialects/15/SPIRV.jl b/src/Dialects/15/SPIRV.jl index 1e4955df..fe8a6bca 100644 --- a/src/Dialects/15/SPIRV.jl +++ b/src/Dialects/15/SPIRV.jl @@ -1626,11 +1626,11 @@ function BranchConditional( _successors = Block[trueTarget, falseTarget] _attributes = NamedAttribute[] push!( - attributes, + _attributes, operandsegmentsizes([1, length(trueTargetOperands), length(falseTargetOperands)]), ) !isnothing(branch_weights) && - push!(attributes, namedattribute("branch_weights", branch_weights)) + push!(_attributes, namedattribute("branch_weights", branch_weights)) return IR.create_operation( "spv.BranchConditional", @@ -2941,7 +2941,7 @@ function CooperativeMatrixLoadNV( _successors = Block[] _attributes = NamedAttribute[] !isnothing(memory_access) && - push!(attributes, namedattribute("memory_access", memory_access)) + push!(_attributes, namedattribute("memory_access", memory_access)) return IR.create_operation( "spv.CooperativeMatrixLoadNV", @@ -3081,7 +3081,7 @@ function CooperativeMatrixStoreNV( _successors = Block[] _attributes = NamedAttribute[] !isnothing(memory_access) && - push!(attributes, namedattribute("memory_access", memory_access)) + push!(_attributes, namedattribute("memory_access", memory_access)) return IR.create_operation( "spv.CooperativeMatrixStoreNV", @@ -3139,12 +3139,12 @@ function CopyMemory( _successors = Block[] _attributes = NamedAttribute[] !isnothing(memory_access) && - push!(attributes, namedattribute("memory_access", memory_access)) - !isnothing(alignment) && push!(attributes, namedattribute("alignment", alignment)) + push!(_attributes, namedattribute("memory_access", memory_access)) + !isnothing(alignment) && push!(_attributes, namedattribute("alignment", alignment)) !isnothing(source_memory_access) && - push!(attributes, namedattribute("source_memory_access", source_memory_access)) + push!(_attributes, namedattribute("source_memory_access", source_memory_access)) !isnothing(source_alignment) && - push!(attributes, namedattribute("source_alignment", source_alignment)) + push!(_attributes, namedattribute("source_alignment", source_alignment)) return IR.create_operation( "spv.CopyMemory", @@ -6066,12 +6066,13 @@ function GlobalVariable(; _attributes = NamedAttribute[ namedattribute("type", type), namedattribute("sym_name", sym_name) ] - !isnothing(initializer) && push!(attributes, namedattribute("initializer", initializer)) - !isnothing(location) && push!(attributes, namedattribute("location", location_)) - !isnothing(binding) && push!(attributes, namedattribute("binding", binding)) + !isnothing(initializer) && + push!(_attributes, namedattribute("initializer", initializer)) + !isnothing(location) && push!(_attributes, namedattribute("location", location_)) + !isnothing(binding) && push!(_attributes, namedattribute("binding", binding)) !isnothing(descriptor_set) && - push!(attributes, namedattribute("descriptor_set", descriptor_set)) - !isnothing(builtin) && push!(attributes, namedattribute("builtin", builtin)) + push!(_attributes, namedattribute("descriptor_set", descriptor_set)) + !isnothing(builtin) && push!(_attributes, namedattribute("builtin", builtin)) return IR.create_operation( "spv.GlobalVariable", @@ -6374,7 +6375,7 @@ function GroupNonUniformFAdd( namedattribute("execution_scope", execution_scope), namedattribute("group_operation", group_operation), ] - !isnothing(cluster_size) && push!(operands, cluster_size) + !isnothing(cluster_size) && push!(_operands, cluster_size) return IR.create_operation( "spv.GroupNonUniformFAdd", @@ -6449,7 +6450,7 @@ function GroupNonUniformFMax( namedattribute("execution_scope", execution_scope), namedattribute("group_operation", group_operation), ] - !isnothing(cluster_size) && push!(operands, cluster_size) + !isnothing(cluster_size) && push!(_operands, cluster_size) return IR.create_operation( "spv.GroupNonUniformFMax", @@ -6524,7 +6525,7 @@ function GroupNonUniformFMin( namedattribute("execution_scope", execution_scope), namedattribute("group_operation", group_operation), ] - !isnothing(cluster_size) && push!(operands, cluster_size) + !isnothing(cluster_size) && push!(_operands, cluster_size) return IR.create_operation( "spv.GroupNonUniformFMin", @@ -6596,7 +6597,7 @@ function GroupNonUniformFMul( namedattribute("execution_scope", execution_scope), namedattribute("group_operation", group_operation), ] - !isnothing(cluster_size) && push!(operands, cluster_size) + !isnothing(cluster_size) && push!(_operands, cluster_size) return IR.create_operation( "spv.GroupNonUniformFMul", @@ -6666,7 +6667,7 @@ function GroupNonUniformIAdd( namedattribute("execution_scope", execution_scope), namedattribute("group_operation", group_operation), ] - !isnothing(cluster_size) && push!(operands, cluster_size) + !isnothing(cluster_size) && push!(_operands, cluster_size) return IR.create_operation( "spv.GroupNonUniformIAdd", @@ -6736,7 +6737,7 @@ function GroupNonUniformIMul( namedattribute("execution_scope", execution_scope), namedattribute("group_operation", group_operation), ] - !isnothing(cluster_size) && push!(operands, cluster_size) + !isnothing(cluster_size) && push!(_operands, cluster_size) return IR.create_operation( "spv.GroupNonUniformIMul", @@ -6806,7 +6807,7 @@ function GroupNonUniformSMax( namedattribute("execution_scope", execution_scope), namedattribute("group_operation", group_operation), ] - !isnothing(cluster_size) && push!(operands, cluster_size) + !isnothing(cluster_size) && push!(_operands, cluster_size) return IR.create_operation( "spv.GroupNonUniformSMax", @@ -6876,7 +6877,7 @@ function GroupNonUniformSMin( namedattribute("execution_scope", execution_scope), namedattribute("group_operation", group_operation), ] - !isnothing(cluster_size) && push!(operands, cluster_size) + !isnothing(cluster_size) && push!(_operands, cluster_size) return IR.create_operation( "spv.GroupNonUniformSMin", @@ -6947,7 +6948,7 @@ function GroupNonUniformUMax( namedattribute("execution_scope", execution_scope), namedattribute("group_operation", group_operation), ] - !isnothing(cluster_size) && push!(operands, cluster_size) + !isnothing(cluster_size) && push!(_operands, cluster_size) return IR.create_operation( "spv.GroupNonUniformUMax", @@ -7018,7 +7019,7 @@ function GroupNonUniformUMin( namedattribute("execution_scope", execution_scope), namedattribute("group_operation", group_operation), ] - !isnothing(cluster_size) && push!(operands, cluster_size) + !isnothing(cluster_size) && push!(_operands, cluster_size) return IR.create_operation( "spv.GroupNonUniformUMin", @@ -7391,7 +7392,7 @@ function ImageDrefGather( _successors = Block[] _attributes = NamedAttribute[] !isnothing(imageoperands) && - push!(attributes, namedattribute("imageoperands", imageoperands)) + push!(_attributes, namedattribute("imageoperands", imageoperands)) return IR.create_operation( "spv.ImageDrefGather", @@ -7676,8 +7677,8 @@ function Load( _successors = Block[] _attributes = NamedAttribute[] !isnothing(memory_access) && - push!(attributes, namedattribute("memory_access", memory_access)) - !isnothing(alignment) && push!(attributes, namedattribute("alignment", alignment)) + push!(_attributes, namedattribute("memory_access", memory_access)) + !isnothing(alignment) && push!(_attributes, namedattribute("alignment", alignment)) return IR.create_operation( "spv.Load", @@ -8200,8 +8201,8 @@ function module_(; namedattribute("addressing_model", addressing_model), namedattribute("memory_model", memory_model), ] - !isnothing(vce_triple) && push!(attributes, namedattribute("vce_triple", vce_triple)) - !isnothing(sym_name) && push!(attributes, namedattribute("sym_name", sym_name)) + !isnothing(vce_triple) && push!(_attributes, namedattribute("vce_triple", vce_triple)) + !isnothing(sym_name) && push!(_attributes, namedattribute("sym_name", sym_name)) return IR.create_operation( "spv.module", @@ -9444,8 +9445,8 @@ function Store( _successors = Block[] _attributes = NamedAttribute[] !isnothing(memory_access) && - push!(attributes, namedattribute("memory_access", memory_access)) - !isnothing(alignment) && push!(attributes, namedattribute("alignment", alignment)) + push!(_attributes, namedattribute("memory_access", memory_access)) + !isnothing(alignment) && push!(_attributes, namedattribute("alignment", alignment)) return IR.create_operation( "spv.Store", @@ -10151,7 +10152,7 @@ function Variable( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[namedattribute("storage_class", storage_class),] - !isnothing(initializer) && push!(operands, initializer) + !isnothing(initializer) && push!(_operands, initializer) return IR.create_operation( "spv.Variable", diff --git a/src/Dialects/15/Shape.jl b/src/Dialects/15/Shape.jl index 479c0d3c..1da65229 100644 --- a/src/Dialects/15/Shape.jl +++ b/src/Dialects/15/Shape.jl @@ -91,15 +91,12 @@ ready to execute. %wt = shape.assuming_all %w0, %w2 // Passing ``` """ -function assuming_all( - inputs::Vector{Value}; result=nothing::Union{Nothing,IR.Type}, location=Location() -) - _results = IR.Type[] +function assuming_all(inputs::Vector{Value}; result::IR.Type, location=Location()) + _results = IR.Type[result,] _operands = Value[inputs...,] _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(result) && push!(_results, result) return IR.create_operation( "shape.assuming_all", @@ -108,8 +105,8 @@ function assuming_all( owned_regions=_owned_regions, successors=_successors, attributes=_attributes, - results=(length(_results) == 0 ? nothing : _results), - result_inference=(length(_results) == 0 ? true : false), + results=_results, + result_inference=false, ) end @@ -202,7 +199,7 @@ function broadcast( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(error) && push!(attributes, namedattribute("error", error)) + !isnothing(error) && push!(_attributes, namedattribute("error", error)) return IR.create_operation( "shape.broadcast", @@ -360,15 +357,12 @@ shape.broadcast documents. %w1 = shape.cstr_broadcastable [2,2], [3,2] // Failure ``` """ -function cstr_broadcastable( - shapes::Vector{Value}; result=nothing::Union{Nothing,IR.Type}, location=Location() -) - _results = IR.Type[] +function cstr_broadcastable(shapes::Vector{Value}; result::IR.Type, location=Location()) + _results = IR.Type[result,] _operands = Value[shapes...,] _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(result) && push!(_results, result) return IR.create_operation( "shape.cstr_broadcastable", @@ -377,8 +371,8 @@ function cstr_broadcastable( owned_regions=_owned_regions, successors=_successors, attributes=_attributes, - results=(length(_results) == 0 ? nothing : _results), - result_inference=(length(_results) == 0 ? true : false), + results=_results, + result_inference=false, ) end @@ -395,15 +389,12 @@ Given 1 or more input shapes, determine if all shapes are the exact same. %w1 = shape.cstr_eq [2,2], [1,2] // Failure ``` """ -function cstr_eq( - shapes::Vector{Value}; result=nothing::Union{Nothing,IR.Type}, location=Location() -) - _results = IR.Type[] +function cstr_eq(shapes::Vector{Value}; result::IR.Type, location=Location()) + _results = IR.Type[result,] _operands = Value[shapes...,] _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(result) && push!(_results, result) return IR.create_operation( "shape.cstr_eq", @@ -412,8 +403,8 @@ function cstr_eq( owned_regions=_owned_regions, successors=_successors, attributes=_attributes, - results=(length(_results) == 0 ? nothing : _results), - result_inference=(length(_results) == 0 ? true : false), + results=_results, + result_inference=false, ) end @@ -565,15 +556,12 @@ the shape. %s1 = shape.from_extents ``` """ -function from_extents( - extents::Vector{Value}; shape=nothing::Union{Nothing,IR.Type}, location=Location() -) - _results = IR.Type[] +function from_extents(extents::Vector{Value}; shape::IR.Type, location=Location()) + _results = IR.Type[shape,] _operands = Value[extents...,] _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(shape) && push!(_results, shape) return IR.create_operation( "shape.from_extents", @@ -582,8 +570,8 @@ function from_extents( owned_regions=_owned_regions, successors=_successors, attributes=_attributes, - results=(length(_results) == 0 ? nothing : _results), - result_inference=(length(_results) == 0 ? true : false), + results=_results, + result_inference=false, ) end @@ -605,7 +593,7 @@ function func(; namedattribute("sym_name", sym_name), namedattribute("function_type", function_type) ] !isnothing(sym_visibility) && - push!(attributes, namedattribute("sym_visibility", sym_visibility)) + push!(_attributes, namedattribute("sym_visibility", sym_visibility)) return IR.create_operation( "shape.func", @@ -734,15 +722,12 @@ assertion failure. %false = shape.is_broadcastable [2,2], [3,2] ``` """ -function is_broadcastable( - shapes::Vector{Value}; result=nothing::Union{Nothing,IR.Type}, location=Location() -) - _results = IR.Type[] +function is_broadcastable(shapes::Vector{Value}; result::IR.Type, location=Location()) + _results = IR.Type[result,] _operands = Value[shapes...,] _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(result) && push!(_results, result) return IR.create_operation( "shape.is_broadcastable", @@ -751,8 +736,8 @@ function is_broadcastable( owned_regions=_owned_regions, successors=_successors, attributes=_attributes, - results=(length(_results) == 0 ? nothing : _results), - result_inference=(length(_results) == 0 ? true : false), + results=_results, + result_inference=false, ) end @@ -826,7 +811,7 @@ function meet( _successors = Block[] _attributes = NamedAttribute[] !isnothing(result) && push!(_results, result) - !isnothing(error) && push!(attributes, namedattribute("error", error)) + !isnothing(error) && push!(_attributes, namedattribute("error", error)) return IR.create_operation( "shape.meet", @@ -1050,15 +1035,12 @@ as their equivalent non-error shapes. Error shapes can be tested for equality like any other shape value, meaning that the error value is equal to itself. """ -function shape_eq( - shapes::Vector{Value}; result=nothing::Union{Nothing,IR.Type}, location=Location() -) - _results = IR.Type[] +function shape_eq(shapes::Vector{Value}; result::IR.Type, location=Location()) + _results = IR.Type[result,] _operands = Value[shapes...,] _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(result) && push!(_results, result) return IR.create_operation( "shape.shape_eq", @@ -1067,8 +1049,8 @@ function shape_eq( owned_regions=_owned_regions, successors=_successors, attributes=_attributes, - results=(length(_results) == 0 ? nothing : _results), - result_inference=(length(_results) == 0 ? true : false), + results=_results, + result_inference=false, ) end diff --git a/src/Dialects/15/SparseTensor.jl b/src/Dialects/15/SparseTensor.jl index 6e9c8004..18983dd7 100644 --- a/src/Dialects/15/SparseTensor.jl +++ b/src/Dialects/15/SparseTensor.jl @@ -121,9 +121,9 @@ function binary( _successors = Block[] _attributes = NamedAttribute[] !isnothing(left_identity) && - push!(attributes, namedattribute("left_identity", left_identity)) + push!(_attributes, namedattribute("left_identity", left_identity)) !isnothing(right_identity) && - push!(attributes, namedattribute("right_identity", right_identity)) + push!(_attributes, namedattribute("right_identity", right_identity)) return IR.create_operation( "sparse_tensor.binary", @@ -374,7 +374,7 @@ function load( _successors = Block[] _attributes = NamedAttribute[] !isnothing(result) && push!(_results, result) - !isnothing(hasInserts) && push!(attributes, namedattribute("hasInserts", hasInserts)) + !isnothing(hasInserts) && push!(_attributes, namedattribute("hasInserts", hasInserts)) return IR.create_operation( "sparse_tensor.load", diff --git a/src/Dialects/15/Tensor.jl b/src/Dialects/15/Tensor.jl index 6782c154..5a987c97 100644 --- a/src/Dialects/15/Tensor.jl +++ b/src/Dialects/15/Tensor.jl @@ -302,7 +302,7 @@ function extract_slice( namedattribute("static_strides", static_strides), ] push!( - attributes, + _attributes, operandsegmentsizes([1, length(offsets), length(sizes), length(strides)]), ) @@ -517,7 +517,7 @@ function insert_slice( namedattribute("static_strides", static_strides), ] push!( - attributes, + _attributes, operandsegmentsizes([1, 1, length(offsets), length(sizes), length(strides)]), ) @@ -623,8 +623,8 @@ function pad( _attributes = NamedAttribute[ namedattribute("static_low", static_low), namedattribute("static_high", static_high) ] - push!(attributes, operandsegmentsizes([1, length(low), length(high)])) - !isnothing(nofold) && push!(attributes, namedattribute("nofold", nofold)) + push!(_attributes, operandsegmentsizes([1, length(low), length(high)])) + !isnothing(nofold) && push!(_attributes, namedattribute("nofold", nofold)) return IR.create_operation( "tensor.pad", @@ -720,7 +720,7 @@ function parallel_insert_slice( namedattribute("static_strides", static_strides), ] push!( - attributes, + _attributes, operandsegmentsizes([1, 1, length(offsets), length(sizes), length(strides)]), ) diff --git a/src/Dialects/15/Tosa.jl b/src/Dialects/15/Tosa.jl index 7d795477..9da216f6 100644 --- a/src/Dialects/15/Tosa.jl +++ b/src/Dialects/15/Tosa.jl @@ -167,7 +167,7 @@ function avg_pool2d( namedattribute("pad", pad), ] !isnothing(quantization_info) && - push!(attributes, namedattribute("quantization_info", quantization_info)) + push!(_attributes, namedattribute("quantization_info", quantization_info)) return IR.create_operation( "tosa.avg_pool2d", @@ -483,7 +483,7 @@ function conv2d( namedattribute("dilation", dilation), ] !isnothing(quantization_info) && - push!(attributes, namedattribute("quantization_info", quantization_info)) + push!(_attributes, namedattribute("quantization_info", quantization_info)) return IR.create_operation( "tosa.conv2d", @@ -523,7 +523,7 @@ function conv3d( namedattribute("dilation", dilation), ] !isnothing(quantization_info) && - push!(attributes, namedattribute("quantization_info", quantization_info)) + push!(_attributes, namedattribute("quantization_info", quantization_info)) return IR.create_operation( "tosa.conv3d", @@ -593,7 +593,7 @@ function depthwise_conv2d( namedattribute("dilation", dilation), ] !isnothing(quantization_info) && - push!(attributes, namedattribute("quantization_info", quantization_info)) + push!(_attributes, namedattribute("quantization_info", quantization_info)) return IR.create_operation( "tosa.depthwise_conv2d", @@ -723,7 +723,7 @@ function fully_connected( _successors = Block[] _attributes = NamedAttribute[] !isnothing(quantization_info) && - push!(attributes, namedattribute("quantization_info", quantization_info)) + push!(_attributes, namedattribute("quantization_info", quantization_info)) return IR.create_operation( "tosa.fully_connected", @@ -1060,7 +1060,7 @@ function matmul( _successors = Block[] _attributes = NamedAttribute[] !isnothing(quantization_info) && - push!(attributes, namedattribute("quantization_info", quantization_info)) + push!(_attributes, namedattribute("quantization_info", quantization_info)) return IR.create_operation( "tosa.matmul", @@ -1194,7 +1194,7 @@ function negate( _successors = Block[] _attributes = NamedAttribute[] !isnothing(quantization_info) && - push!(attributes, namedattribute("quantization_info", quantization_info)) + push!(_attributes, namedattribute("quantization_info", quantization_info)) return IR.create_operation( "tosa.negate", @@ -1226,9 +1226,9 @@ function pad( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(pad_const) && push!(operands, pad_const) + !isnothing(pad_const) && push!(_operands, pad_const) !isnothing(quantization_info) && - push!(attributes, namedattribute("quantization_info", quantization_info)) + push!(_attributes, namedattribute("quantization_info", quantization_info)) return IR.create_operation( "tosa.pad", @@ -1892,7 +1892,7 @@ function transpose_conv2d( namedattribute("out_shape", out_shape), ] !isnothing(quantization_info) && - push!(attributes, namedattribute("quantization_info", quantization_info)) + push!(_attributes, namedattribute("quantization_info", quantization_info)) return IR.create_operation( "tosa.transpose_conv2d", diff --git a/src/Dialects/15/Transform.jl b/src/Dialects/15/Transform.jl index 3fba254a..57bdc847 100644 --- a/src/Dialects/15/Transform.jl +++ b/src/Dialects/15/Transform.jl @@ -42,21 +42,21 @@ function bufferization_one_shot_bufferize( _successors = Block[] _attributes = NamedAttribute[] !isnothing(allow_return_allocs) && - push!(attributes, namedattribute("allow_return_allocs", allow_return_allocs)) + push!(_attributes, namedattribute("allow_return_allocs", allow_return_allocs)) !isnothing(allow_unknown_ops) && - push!(attributes, namedattribute("allow_unknown_ops", allow_unknown_ops)) + push!(_attributes, namedattribute("allow_unknown_ops", allow_unknown_ops)) !isnothing(bufferize_function_boundaries) && push!( - attributes, + _attributes, namedattribute("bufferize_function_boundaries", bufferize_function_boundaries), ) !isnothing(create_deallocs) && - push!(attributes, namedattribute("create_deallocs", create_deallocs)) + push!(_attributes, namedattribute("create_deallocs", create_deallocs)) !isnothing(target_is_module) && - push!(attributes, namedattribute("target_is_module", target_is_module)) + push!(_attributes, namedattribute("target_is_module", target_is_module)) !isnothing(test_analysis_only) && - push!(attributes, namedattribute("test_analysis_only", test_analysis_only)) + push!(_attributes, namedattribute("test_analysis_only", test_analysis_only)) !isnothing(print_conflicts) && - push!(attributes, namedattribute("print_conflicts", print_conflicts)) + push!(_attributes, namedattribute("print_conflicts", print_conflicts)) return IR.create_operation( "transform.bufferization.one_shot_bufferize", @@ -152,9 +152,9 @@ function structured_fuse( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(tile_sizes) && push!(attributes, namedattribute("tile_sizes", tile_sizes)) + !isnothing(tile_sizes) && push!(_attributes, namedattribute("tile_sizes", tile_sizes)) !isnothing(tile_interchange) && - push!(attributes, namedattribute("tile_interchange", tile_interchange)) + push!(_attributes, namedattribute("tile_interchange", tile_interchange)) return IR.create_operation( "transform.structured.fuse", @@ -227,7 +227,7 @@ function structured_interchange( _successors = Block[] _attributes = NamedAttribute[] !isnothing(iterator_interchange) && - push!(attributes, namedattribute("iterator_interchange", iterator_interchange)) + push!(_attributes, namedattribute("iterator_interchange", iterator_interchange)) return IR.create_operation( "transform.structured.interchange", @@ -283,9 +283,9 @@ function structured_match( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(ops) && push!(attributes, namedattribute("ops", ops)) - !isnothing(interface) && push!(attributes, namedattribute("interface", interface)) - !isnothing(attribute) && push!(attributes, namedattribute("attribute", attribute)) + !isnothing(ops) && push!(_attributes, namedattribute("ops", ops)) + !isnothing(interface) && push!(_attributes, namedattribute("interface", interface)) + !isnothing(attribute) && push!(_attributes, namedattribute("attribute", attribute)) return IR.create_operation( "transform.structured.match", @@ -361,7 +361,7 @@ function structured_multitile_sizes( _attributes = NamedAttribute[ namedattribute("dimension", dimension), namedattribute("target_size", target_size) ] - !isnothing(divisor) && push!(attributes, namedattribute("divisor", divisor)) + !isnothing(divisor) && push!(_attributes, namedattribute("divisor", divisor)) return IR.create_operation( "transform.structured.multitile_sizes", @@ -407,15 +407,15 @@ function structured_pad( _successors = Block[] _attributes = NamedAttribute[] !isnothing(padding_values) && - push!(attributes, namedattribute("padding_values", padding_values)) + push!(_attributes, namedattribute("padding_values", padding_values)) !isnothing(padding_dimensions) && - push!(attributes, namedattribute("padding_dimensions", padding_dimensions)) + push!(_attributes, namedattribute("padding_dimensions", padding_dimensions)) !isnothing(pack_paddings) && - push!(attributes, namedattribute("pack_paddings", pack_paddings)) + push!(_attributes, namedattribute("pack_paddings", pack_paddings)) !isnothing(hoist_paddings) && - push!(attributes, namedattribute("hoist_paddings", hoist_paddings)) + push!(_attributes, namedattribute("hoist_paddings", hoist_paddings)) !isnothing(transpose_paddings) && - push!(attributes, namedattribute("transpose_paddings", transpose_paddings)) + push!(_attributes, namedattribute("transpose_paddings", transpose_paddings)) return IR.create_operation( "transform.structured.pad", @@ -464,15 +464,15 @@ function structured_promote( _successors = Block[] _attributes = NamedAttribute[] !isnothing(operands_to_promote) && - push!(attributes, namedattribute("operands_to_promote", operands_to_promote)) + push!(_attributes, namedattribute("operands_to_promote", operands_to_promote)) !isnothing(use_full_tile_buffers) && - push!(attributes, namedattribute("use_full_tile_buffers", use_full_tile_buffers)) + push!(_attributes, namedattribute("use_full_tile_buffers", use_full_tile_buffers)) !isnothing(use_full_tiles_by_default) && push!( - attributes, + _attributes, namedattribute("use_full_tiles_by_default", use_full_tiles_by_default), ) - !isnothing(use_alloca) && push!(attributes, namedattribute("use_alloca", use_alloca)) - !isnothing(alignment) && push!(attributes, namedattribute("alignment", alignment)) + !isnothing(use_alloca) && push!(_attributes, namedattribute("use_alloca", use_alloca)) + !isnothing(alignment) && push!(_attributes, namedattribute("alignment", alignment)) return IR.create_operation( "transform.structured.promote", @@ -567,7 +567,7 @@ function structured_split( namedattribute("dimension", dimension), namedattribute("static_split_point", static_split_point), ] - !isnothing(dynamic_split_point) && push!(operands, dynamic_split_point) + !isnothing(dynamic_split_point) && push!(_operands, dynamic_split_point) return IR.create_operation( "transform.structured.split", @@ -733,12 +733,12 @@ function structured_split_reduction( _successors = Block[] _attributes = NamedAttribute[] !isnothing(split_factor) && - push!(attributes, namedattribute("split_factor", split_factor)) + push!(_attributes, namedattribute("split_factor", split_factor)) !isnothing(insert_split_dimension) && - push!(attributes, namedattribute("insert_split_dimension", insert_split_dimension)) + push!(_attributes, namedattribute("insert_split_dimension", insert_split_dimension)) !isnothing(use_scaling_algorithm) && - push!(attributes, namedattribute("use_scaling_algorithm", use_scaling_algorithm)) - !isnothing(use_alloc) && push!(attributes, namedattribute("use_alloc", use_alloc)) + push!(_attributes, namedattribute("use_scaling_algorithm", use_scaling_algorithm)) + !isnothing(use_alloc) && push!(_attributes, namedattribute("use_alloc", use_alloc)) return IR.create_operation( "transform.structured.split_reduction", @@ -806,8 +806,9 @@ function structured_tile( _successors = Block[] _attributes = NamedAttribute[] !isnothing(static_sizes) && - push!(attributes, namedattribute("static_sizes", static_sizes)) - !isnothing(interchange) && push!(attributes, namedattribute("interchange", interchange)) + push!(_attributes, namedattribute("static_sizes", static_sizes)) + !isnothing(interchange) && + push!(_attributes, namedattribute("interchange", interchange)) return IR.create_operation( "transform.structured.tile", @@ -880,10 +881,11 @@ function structured_tile_to_foreach_thread_op( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(num_threads) && push!(attributes, namedattribute("num_threads", num_threads)) - !isnothing(tile_sizes) && push!(attributes, namedattribute("tile_sizes", tile_sizes)) + !isnothing(num_threads) && + push!(_attributes, namedattribute("num_threads", num_threads)) + !isnothing(tile_sizes) && push!(_attributes, namedattribute("tile_sizes", tile_sizes)) !isnothing(thread_dim_mapping) && - push!(attributes, namedattribute("thread_dim_mapping", thread_dim_mapping)) + push!(_attributes, namedattribute("thread_dim_mapping", thread_dim_mapping)) return IR.create_operation( "transform.structured.tile_to_foreach_thread_op", @@ -931,7 +933,7 @@ function structured_vectorize( _successors = Block[] _attributes = NamedAttribute[] !isnothing(vectorize_padding) && - push!(attributes, namedattribute("vectorize_padding", vectorize_padding)) + push!(_attributes, namedattribute("vectorize_padding", vectorize_padding)) return IR.create_operation( "transform.structured.vectorize", @@ -967,7 +969,7 @@ function loop_get_parent_for( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(num_loops) && push!(attributes, namedattribute("num_loops", num_loops)) + !isnothing(num_loops) && push!(_attributes, namedattribute("num_loops", num_loops)) return IR.create_operation( "transform.loop.get_parent_for", @@ -1050,7 +1052,7 @@ function loop_peel( _successors = Block[] _attributes = NamedAttribute[] !isnothing(fail_if_already_divisible) && push!( - attributes, + _attributes, namedattribute("fail_if_already_divisible", fail_if_already_divisible), ) @@ -1102,9 +1104,9 @@ function loop_pipeline( _successors = Block[] _attributes = NamedAttribute[] !isnothing(iteration_interval) && - push!(attributes, namedattribute("iteration_interval", iteration_interval)) + push!(_attributes, namedattribute("iteration_interval", iteration_interval)) !isnothing(read_latency) && - push!(attributes, namedattribute("read_latency", read_latency)) + push!(_attributes, namedattribute("read_latency", read_latency)) return IR.create_operation( "transform.loop.pipeline", @@ -1229,7 +1231,7 @@ function alternatives( _owned_regions = Region[alternatives...,] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(scope) && push!(operands, scope) + !isnothing(scope) && push!(_operands, scope) return IR.create_operation( "transform.alternatives", @@ -1337,7 +1339,8 @@ function merge_handles( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(deduplicate) && push!(attributes, namedattribute("deduplicate", deduplicate)) + !isnothing(deduplicate) && + push!(_attributes, namedattribute("deduplicate", deduplicate)) return IR.create_operation( "transform.merge_handles", @@ -1461,7 +1464,7 @@ function sequence( _owned_regions = Region[body,] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(root) && push!(operands, root) + !isnothing(root) && push!(_operands, root) return IR.create_operation( "transform.sequence", @@ -1519,7 +1522,7 @@ function with_pdl_patterns( _owned_regions = Region[body,] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(root) && push!(operands, root) + !isnothing(root) && push!(_operands, root) return IR.create_operation( "transform.with_pdl_patterns", diff --git a/src/Dialects/15/Vector.jl b/src/Dialects/15/Vector.jl index dfefd502..9d1d812c 100644 --- a/src/Dialects/15/Vector.jl +++ b/src/Dialects/15/Vector.jl @@ -373,7 +373,7 @@ function contract( namedattribute("indexing_maps", indexing_maps), namedattribute("iterator_types", iterator_types), ] - !isnothing(kind) && push!(attributes, namedattribute("kind", kind)) + !isnothing(kind) && push!(_attributes, namedattribute("kind", kind)) return IR.create_operation( "vector.contract", @@ -526,7 +526,7 @@ function extractelement( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(position) && push!(operands, position) + !isnothing(position) && push!(_operands, position) return IR.create_operation( "vector.extractelement", @@ -871,7 +871,7 @@ function insertelement( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(position) && push!(operands, position) + !isnothing(position) && push!(_operands, position) !isnothing(result) && push!(_results, result) return IR.create_operation( @@ -933,18 +933,13 @@ For instance: ``` """ function insert_map( - vector::Value, - dest::Value, - ids::Vector{Value}; - result=nothing::Union{Nothing,IR.Type}, - location=Location(), + vector::Value, dest::Value, ids::Vector{Value}; result::IR.Type, location=Location() ) - _results = IR.Type[] + _results = IR.Type[result,] _operands = Value[vector, dest, ids...] _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(result) && push!(_results, result) return IR.create_operation( "vector.insert_map", @@ -953,8 +948,8 @@ function insert_map( owned_regions=_owned_regions, successors=_successors, attributes=_attributes, - results=(length(_results) == 0 ? nothing : _results), - result_inference=(length(_results) == 0 ? true : false), + results=_results, + result_inference=false, ) end @@ -1398,7 +1393,7 @@ function outerproduct( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(kind) && push!(attributes, namedattribute("kind", kind)) + !isnothing(kind) && push!(_attributes, namedattribute("kind", kind)) return IR.create_operation( "vector.outerproduct", @@ -1489,7 +1484,7 @@ function reduction( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[namedattribute("kind", kind),] - !isnothing(acc) && push!(operands, acc) + !isnothing(acc) && push!(_operands, acc) return IR.create_operation( "vector.reduction", @@ -1600,7 +1595,7 @@ function reshape( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[namedattribute("fixed_vector_sizes", fixed_vector_sizes),] - push!(attributes, operandsegmentsizes([1, length(input_shape), length(output_shape)])) + push!(_attributes, operandsegmentsizes([1, length(input_shape), length(output_shape)])) return IR.create_operation( "vector.reshape", @@ -2111,9 +2106,11 @@ function transfer_read( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[namedattribute("permutation_map", permutation_map),] - !isnothing(mask) && push!(operands, mask) - push!(attributes, operandsegmentsizes([1, length(indices), 1, isnothing(mask) ? 0 : 1])) - !isnothing(in_bounds) && push!(attributes, namedattribute("in_bounds", in_bounds)) + !isnothing(mask) && push!(_operands, mask) + push!( + _attributes, operandsegmentsizes([1, length(indices), 1, isnothing(mask) ? 0 : 1]) + ) + !isnothing(in_bounds) && push!(_attributes, namedattribute("in_bounds", in_bounds)) return IR.create_operation( "vector.transfer_read", @@ -2222,10 +2219,12 @@ function transfer_write( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[namedattribute("permutation_map", permutation_map),] - !isnothing(mask) && push!(operands, mask) - push!(attributes, operandsegmentsizes([1, 1, length(indices), isnothing(mask) ? 0 : 1])) + !isnothing(mask) && push!(_operands, mask) + push!( + _attributes, operandsegmentsizes([1, 1, length(indices), isnothing(mask) ? 0 : 1]) + ) !isnothing(result) && push!(_results, result) - !isnothing(in_bounds) && push!(attributes, namedattribute("in_bounds", in_bounds)) + !isnothing(in_bounds) && push!(_attributes, namedattribute("in_bounds", in_bounds)) return IR.create_operation( "vector.transfer_write", diff --git a/src/Dialects/15/X86Vector.jl b/src/Dialects/15/X86Vector.jl index bd2beada..61bc575b 100644 --- a/src/Dialects/15/X86Vector.jl +++ b/src/Dialects/15/X86Vector.jl @@ -124,10 +124,10 @@ function avx512_mask_compress( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(src) && push!(operands, src) + !isnothing(src) && push!(_operands, src) !isnothing(dst) && push!(_results, dst) !isnothing(constant_src) && - push!(attributes, namedattribute("constant_src", constant_src)) + push!(_attributes, namedattribute("constant_src", constant_src)) return IR.create_operation( "x86vector.avx512.mask.compress", diff --git a/src/Dialects/16/AMDGPU.jl b/src/Dialects/16/AMDGPU.jl index a460edca..fce02f51 100644 --- a/src/Dialects/16/AMDGPU.jl +++ b/src/Dialects/16/AMDGPU.jl @@ -95,14 +95,14 @@ function mfma( namedattribute("k", k), namedattribute("blocks", blocks), ] - !isnothing(cbsz) && push!(attributes, namedattribute("cbsz", cbsz)) - !isnothing(abid) && push!(attributes, namedattribute("abid", abid)) - !isnothing(blgp) && push!(attributes, namedattribute("blgp", blgp)) + !isnothing(cbsz) && push!(_attributes, namedattribute("cbsz", cbsz)) + !isnothing(abid) && push!(_attributes, namedattribute("abid", abid)) + !isnothing(blgp) && push!(_attributes, namedattribute("blgp", blgp)) !isnothing(reducePrecision) && - push!(attributes, namedattribute("reducePrecision", reducePrecision)) - !isnothing(negateA) && push!(attributes, namedattribute("negateA", negateA)) - !isnothing(negateB) && push!(attributes, namedattribute("negateB", negateB)) - !isnothing(negateC) && push!(attributes, namedattribute("negateC", negateC)) + push!(_attributes, namedattribute("reducePrecision", reducePrecision)) + !isnothing(negateA) && push!(_attributes, namedattribute("negateA", negateA)) + !isnothing(negateB) && push!(_attributes, namedattribute("negateB", negateB)) + !isnothing(negateC) && push!(_attributes, namedattribute("negateC", negateC)) return IR.create_operation( "amdgpu.mfma", @@ -150,13 +150,15 @@ function raw_buffer_atomic_fadd( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(sgprOffset) && push!(operands, sgprOffset) + !isnothing(sgprOffset) && push!(_operands, sgprOffset) push!( - attributes, + _attributes, operandsegmentsizes([1, 1, length(indices), isnothing(sgprOffset) ? 0 : 1]), ) - !isnothing(boundsCheck) && push!(attributes, namedattribute("boundsCheck", boundsCheck)) - !isnothing(indexOffset) && push!(attributes, namedattribute("indexOffset", indexOffset)) + !isnothing(boundsCheck) && + push!(_attributes, namedattribute("boundsCheck", boundsCheck)) + !isnothing(indexOffset) && + push!(_attributes, namedattribute("indexOffset", indexOffset)) return IR.create_operation( "amdgpu.raw_buffer_atomic_fadd", @@ -216,12 +218,15 @@ function raw_buffer_load( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(sgprOffset) && push!(operands, sgprOffset) + !isnothing(sgprOffset) && push!(_operands, sgprOffset) push!( - attributes, operandsegmentsizes([1, length(indices), isnothing(sgprOffset) ? 0 : 1]) + _attributes, + operandsegmentsizes([1, length(indices), isnothing(sgprOffset) ? 0 : 1]), ) - !isnothing(boundsCheck) && push!(attributes, namedattribute("boundsCheck", boundsCheck)) - !isnothing(indexOffset) && push!(attributes, namedattribute("indexOffset", indexOffset)) + !isnothing(boundsCheck) && + push!(_attributes, namedattribute("boundsCheck", boundsCheck)) + !isnothing(indexOffset) && + push!(_attributes, namedattribute("indexOffset", indexOffset)) return IR.create_operation( "amdgpu.raw_buffer_load", @@ -269,13 +274,15 @@ function raw_buffer_store( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(sgprOffset) && push!(operands, sgprOffset) + !isnothing(sgprOffset) && push!(_operands, sgprOffset) push!( - attributes, + _attributes, operandsegmentsizes([1, 1, length(indices), isnothing(sgprOffset) ? 0 : 1]), ) - !isnothing(boundsCheck) && push!(attributes, namedattribute("boundsCheck", boundsCheck)) - !isnothing(indexOffset) && push!(attributes, namedattribute("indexOffset", indexOffset)) + !isnothing(boundsCheck) && + push!(_attributes, namedattribute("boundsCheck", boundsCheck)) + !isnothing(indexOffset) && + push!(_attributes, namedattribute("indexOffset", indexOffset)) return IR.create_operation( "amdgpu.raw_buffer_store", diff --git a/src/Dialects/16/AMX.jl b/src/Dialects/16/AMX.jl index d3ceb98b..4df6ab3e 100644 --- a/src/Dialects/16/AMX.jl +++ b/src/Dialects/16/AMX.jl @@ -346,8 +346,8 @@ function tile_muli( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(isZextLhs) && push!(attributes, namedattribute("isZextLhs", isZextLhs)) - !isnothing(isZextRhs) && push!(attributes, namedattribute("isZextRhs", isZextRhs)) + !isnothing(isZextLhs) && push!(_attributes, namedattribute("isZextLhs", isZextLhs)) + !isnothing(isZextRhs) && push!(_attributes, namedattribute("isZextRhs", isZextRhs)) return IR.create_operation( "amx.tile_muli", diff --git a/src/Dialects/16/Arith.jl b/src/Dialects/16/Arith.jl index a28c3782..137ed273 100644 --- a/src/Dialects/16/Arith.jl +++ b/src/Dialects/16/Arith.jl @@ -41,7 +41,7 @@ function addf( _successors = Block[] _attributes = NamedAttribute[] !isnothing(result) && push!(_results, result) - !isnothing(fastmath) && push!(attributes, namedattribute("fastmath", fastmath)) + !isnothing(fastmath) && push!(_attributes, namedattribute("fastmath", fastmath)) return IR.create_operation( "arith.addf", @@ -443,13 +443,12 @@ forms simple integer and floating point constants. %1 = \"arith.constant\"() {value = 42 : i32} : () -> i32 ``` """ -function constant(; result=nothing::Union{Nothing,IR.Type}, value, location=Location()) - _results = IR.Type[] +function constant(; result::IR.Type, value, location=Location()) + _results = IR.Type[result,] _operands = Value[] _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[namedattribute("value", value),] - !isnothing(result) && push!(_results, result) return IR.create_operation( "arith.constant", @@ -458,8 +457,8 @@ function constant(; result=nothing::Union{Nothing,IR.Type}, value, location=Loca owned_regions=_owned_regions, successors=_successors, attributes=_attributes, - results=(length(_results) == 0 ? nothing : _results), - result_inference=(length(_results) == 0 ? true : false), + results=_results, + result_inference=false, ) end @@ -480,7 +479,7 @@ function divf( _successors = Block[] _attributes = NamedAttribute[] !isnothing(result) && push!(_results, result) - !isnothing(fastmath) && push!(attributes, namedattribute("fastmath", fastmath)) + !isnothing(fastmath) && push!(_attributes, namedattribute("fastmath", fastmath)) return IR.create_operation( "arith.divf", @@ -862,7 +861,7 @@ function maxf( _successors = Block[] _attributes = NamedAttribute[] !isnothing(result) && push!(_results, result) - !isnothing(fastmath) && push!(attributes, namedattribute("fastmath", fastmath)) + !isnothing(fastmath) && push!(_attributes, namedattribute("fastmath", fastmath)) return IR.create_operation( "arith.maxf", @@ -960,7 +959,7 @@ function minf( _successors = Block[] _attributes = NamedAttribute[] !isnothing(result) && push!(_results, result) - !isnothing(fastmath) && push!(attributes, namedattribute("fastmath", fastmath)) + !isnothing(fastmath) && push!(_attributes, namedattribute("fastmath", fastmath)) return IR.create_operation( "arith.minf", @@ -1063,7 +1062,7 @@ function mulf( _successors = Block[] _attributes = NamedAttribute[] !isnothing(result) && push!(_results, result) - !isnothing(fastmath) && push!(attributes, namedattribute("fastmath", fastmath)) + !isnothing(fastmath) && push!(_attributes, namedattribute("fastmath", fastmath)) return IR.create_operation( "arith.mulf", @@ -1232,7 +1231,7 @@ function negf( _successors = Block[] _attributes = NamedAttribute[] !isnothing(result) && push!(_results, result) - !isnothing(fastmath) && push!(attributes, namedattribute("fastmath", fastmath)) + !isnothing(fastmath) && push!(_attributes, namedattribute("fastmath", fastmath)) return IR.create_operation( "arith.negf", @@ -1306,7 +1305,7 @@ function remf( _successors = Block[] _attributes = NamedAttribute[] !isnothing(result) && push!(_results, result) - !isnothing(fastmath) && push!(attributes, namedattribute("fastmath", fastmath)) + !isnothing(fastmath) && push!(_attributes, namedattribute("fastmath", fastmath)) return IR.create_operation( "arith.remf", @@ -1585,7 +1584,7 @@ function subf( _successors = Block[] _attributes = NamedAttribute[] !isnothing(result) && push!(_results, result) - !isnothing(fastmath) && push!(attributes, namedattribute("fastmath", fastmath)) + !isnothing(fastmath) && push!(_attributes, namedattribute("fastmath", fastmath)) return IR.create_operation( "arith.subf", diff --git a/src/Dialects/16/Async.jl b/src/Dialects/16/Async.jl index 2afd1d4f..08904fe6 100644 --- a/src/Dialects/16/Async.jl +++ b/src/Dialects/16/Async.jl @@ -410,7 +410,7 @@ function execute( _owned_regions = Region[bodyRegion,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(dependencies), length(bodyOperands)])) + push!(_attributes, operandsegmentsizes([length(dependencies), length(bodyOperands)])) return IR.create_operation( "async.execute", @@ -472,9 +472,9 @@ function func(; 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)) + 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)) return IR.create_operation( "async.func", diff --git a/src/Dialects/16/Bufferization.jl b/src/Dialects/16/Bufferization.jl index 70ffe865..69951f3c 100644 --- a/src/Dialects/16/Bufferization.jl +++ b/src/Dialects/16/Bufferization.jl @@ -68,16 +68,16 @@ function alloc_tensor( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(copy) && push!(operands, copy) - !isnothing(size_hint) && push!(operands, size_hint) + !isnothing(copy) && push!(_operands, copy) + !isnothing(size_hint) && push!(_operands, size_hint) push!( - attributes, + _attributes, operandsegmentsizes([ length(dynamic_sizes), isnothing(copy) ? 0 : 1, isnothing(size_hint) ? 0 : 1 ]), ) !isnothing(memory_space) && - push!(attributes, namedattribute("memory_space", memory_space)) + push!(_attributes, namedattribute("memory_space", memory_space)) return IR.create_operation( "bufferization.alloc_tensor", diff --git a/src/Dialects/16/Builtin.jl b/src/Dialects/16/Builtin.jl index 1a672bef..2ac242d8 100644 --- a/src/Dialects/16/Builtin.jl +++ b/src/Dialects/16/Builtin.jl @@ -31,9 +31,9 @@ function module_(; _owned_regions = Region[bodyRegion,] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(sym_name) && push!(attributes, namedattribute("sym_name", sym_name)) + !isnothing(sym_name) && push!(_attributes, namedattribute("sym_name", sym_name)) !isnothing(sym_visibility) && - push!(attributes, namedattribute("sym_visibility", sym_visibility)) + push!(_attributes, namedattribute("sym_visibility", sym_visibility)) return IR.create_operation( "builtin.module", diff --git a/src/Dialects/16/ControlFlow.jl b/src/Dialects/16/ControlFlow.jl index df39048c..23faa5a7 100644 --- a/src/Dialects/16/ControlFlow.jl +++ b/src/Dialects/16/ControlFlow.jl @@ -115,7 +115,7 @@ function cond_br( _successors = Block[trueDest, falseDest] _attributes = NamedAttribute[] push!( - attributes, + _attributes, operandsegmentsizes([1, length(trueDestOperands), length(falseDestOperands)]), ) @@ -168,9 +168,10 @@ function switch( "case_operand_segments", case_operand_segments ),] push!( - attributes, operandsegmentsizes([1, length(defaultOperands), length(caseOperands)]) + _attributes, operandsegmentsizes([1, length(defaultOperands), length(caseOperands)]) ) - !isnothing(case_values) && push!(attributes, namedattribute("case_values", case_values)) + !isnothing(case_values) && + push!(_attributes, namedattribute("case_values", case_values)) return IR.create_operation( "cf.switch", diff --git a/src/Dialects/16/EmitC.jl b/src/Dialects/16/EmitC.jl index 3df4e3f3..58124247 100644 --- a/src/Dialects/16/EmitC.jl +++ b/src/Dialects/16/EmitC.jl @@ -73,9 +73,9 @@ function call( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[namedattribute("callee", callee),] - !isnothing(args) && push!(attributes, namedattribute("args", args)) + !isnothing(args) && push!(_attributes, namedattribute("args", args)) !isnothing(template_args) && - push!(attributes, namedattribute("template_args", template_args)) + push!(_attributes, namedattribute("template_args", template_args)) return IR.create_operation( "emitc.call", @@ -196,7 +196,7 @@ function include_(; include_, is_standard_include=nothing, location=Location()) _successors = Block[] _attributes = NamedAttribute[namedattribute("include", include_),] !isnothing(is_standard_include) && - push!(attributes, namedattribute("is_standard_include", is_standard_include)) + push!(_attributes, namedattribute("is_standard_include", is_standard_include)) return IR.create_operation( "emitc.include", diff --git a/src/Dialects/16/Func.jl b/src/Dialects/16/Func.jl index 9f76a3e9..a95ab39a 100644 --- a/src/Dialects/16/Func.jl +++ b/src/Dialects/16/Func.jl @@ -176,9 +176,9 @@ function func_(; 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)) + 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)) return IR.create_operation( "func.func", diff --git a/src/Dialects/16/GPU.jl b/src/Dialects/16/GPU.jl index c1a94c7c..029430fe 100644 --- a/src/Dialects/16/GPU.jl +++ b/src/Dialects/16/GPU.jl @@ -43,8 +43,8 @@ function all_reduce( _successors = Block[] _attributes = NamedAttribute[] !isnothing(result_0) && push!(_results, result_0) - !isnothing(op) && push!(attributes, namedattribute("op", op)) - !isnothing(uniform) && push!(attributes, namedattribute("uniform", uniform)) + !isnothing(op) && push!(_attributes, namedattribute("op", op)) + !isnothing(uniform) && push!(_attributes, namedattribute("uniform", uniform)) return IR.create_operation( "gpu.all_reduce", @@ -95,13 +95,13 @@ function alloc( _successors = Block[] _attributes = NamedAttribute[] push!( - attributes, + _attributes, operandsegmentsizes([ length(asyncDependencies), length(dynamicSizes), length(symbolOperands) ]), ) !isnothing(asyncToken) && push!(_results, asyncToken) - !isnothing(hostShared) && push!(attributes, namedattribute("hostShared", hostShared)) + !isnothing(hostShared) && push!(_attributes, namedattribute("hostShared", hostShared)) return IR.create_operation( "gpu.alloc", @@ -341,8 +341,8 @@ function func(; _owned_regions = Region[body,] _successors = Block[] _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(arg_attrs) && push!(_attributes, namedattribute("arg_attrs", arg_attrs)) + !isnothing(res_attrs) && push!(_attributes, namedattribute("res_attrs", res_attrs)) return IR.create_operation( "gpu.func", @@ -640,9 +640,9 @@ function launch_func( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[namedattribute("kernel", kernel),] - !isnothing(dynamicSharedMemorySize) && push!(operands, dynamicSharedMemorySize) + !isnothing(dynamicSharedMemorySize) && push!(_operands, dynamicSharedMemorySize) push!( - attributes, + _attributes, operandsegmentsizes([ length(asyncDependencies), 1, @@ -769,9 +769,9 @@ function launch( _owned_regions = Region[body,] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(dynamicSharedMemorySize) && push!(operands, dynamicSharedMemorySize) + !isnothing(dynamicSharedMemorySize) && push!(_operands, dynamicSharedMemorySize) push!( - attributes, + _attributes, operandsegmentsizes([ length(asyncDependencies), 1, @@ -1144,8 +1144,10 @@ function subgroup_mma_compute( _successors = Block[] _attributes = NamedAttribute[] !isnothing(res) && push!(_results, res) - !isnothing(a_transpose) && push!(attributes, namedattribute("a_transpose", a_transpose)) - !isnothing(b_transpose) && push!(attributes, namedattribute("b_transpose", b_transpose)) + !isnothing(a_transpose) && + push!(_attributes, namedattribute("a_transpose", a_transpose)) + !isnothing(b_transpose) && + push!(_attributes, namedattribute("b_transpose", b_transpose)) return IR.create_operation( "gpu.subgroup_mma_compute", @@ -1279,7 +1281,7 @@ function subgroup_mma_load_matrix( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[namedattribute("leadDimension", leadDimension),] - !isnothing(transpose) && push!(attributes, namedattribute("transpose", transpose)) + !isnothing(transpose) && push!(_attributes, namedattribute("transpose", transpose)) return IR.create_operation( "gpu.subgroup_mma_load_matrix", @@ -1329,7 +1331,7 @@ function subgroup_mma_store_matrix( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[namedattribute("leadDimension", leadDimension),] - !isnothing(transpose) && push!(attributes, namedattribute("transpose", transpose)) + !isnothing(transpose) && push!(_attributes, namedattribute("transpose", transpose)) return IR.create_operation( "gpu.subgroup_mma_store_matrix", @@ -1371,7 +1373,7 @@ function subgroup_reduce( _successors = Block[] _attributes = NamedAttribute[namedattribute("op", op),] !isnothing(result_0) && push!(_results, result_0) - !isnothing(uniform) && push!(attributes, namedattribute("uniform", uniform)) + !isnothing(uniform) && push!(_attributes, namedattribute("uniform", uniform)) return IR.create_operation( "gpu.subgroup_reduce", diff --git a/src/Dialects/16/LLVMIR.jl b/src/Dialects/16/LLVMIR.jl index 3335bc01..7160b21c 100644 --- a/src/Dialects/16/LLVMIR.jl +++ b/src/Dialects/16/LLVMIR.jl @@ -172,7 +172,8 @@ function alias_scope_domain(; sym_name, description=nothing, location=Location() _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[namedattribute("sym_name", sym_name),] - !isnothing(description) && push!(attributes, namedattribute("description", description)) + !isnothing(description) && + push!(_attributes, namedattribute("description", description)) return IR.create_operation( "llvm.alias_scope_domain", @@ -226,7 +227,8 @@ function alias_scope(; sym_name, domain, description=nothing, location=Location( _attributes = NamedAttribute[ namedattribute("sym_name", sym_name), namedattribute("domain", domain) ] - !isnothing(description) && push!(attributes, namedattribute("description", description)) + !isnothing(description) && + push!(_attributes, namedattribute("description", description)) return IR.create_operation( "llvm.alias_scope", @@ -256,8 +258,8 @@ function alloca( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(alignment) && push!(attributes, namedattribute("alignment", alignment)) - !isnothing(elem_type) && push!(attributes, namedattribute("elem_type", elem_type)) + !isnothing(alignment) && push!(_attributes, namedattribute("alignment", alignment)) + !isnothing(elem_type) && push!(_attributes, namedattribute("elem_type", elem_type)) return IR.create_operation( "llvm.alloca", @@ -446,11 +448,11 @@ function call( _successors = Block[] _attributes = NamedAttribute[] !isnothing(result) && push!(_results, result) - !isnothing(callee) && push!(attributes, namedattribute("callee", callee)) + !isnothing(callee) && push!(_attributes, namedattribute("callee", callee)) !isnothing(fastmathFlags) && - push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) + push!(_attributes, namedattribute("fastmathFlags", fastmathFlags)) !isnothing(branch_weights) && - push!(attributes, namedattribute("branch_weights", branch_weights)) + push!(_attributes, namedattribute("branch_weights", branch_weights)) return IR.create_operation( "llvm.call", @@ -483,11 +485,11 @@ function cond_br( _successors = Block[trueDest, falseDest] _attributes = NamedAttribute[] push!( - attributes, + _attributes, operandsegmentsizes([1, length(trueDestOperands), length(falseDestOperands)]), ) !isnothing(branch_weights) && - push!(attributes, namedattribute("branch_weights", branch_weights)) + push!(_attributes, namedattribute("branch_weights", branch_weights)) return IR.create_operation( "llvm.cond_br", @@ -614,7 +616,7 @@ function fadd( _attributes = NamedAttribute[] !isnothing(res) && push!(_results, res) !isnothing(fastmathFlags) && - push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) + push!(_attributes, namedattribute("fastmathFlags", fastmathFlags)) return IR.create_operation( "llvm.fadd", @@ -646,7 +648,7 @@ function fcmp( _successors = Block[] _attributes = NamedAttribute[namedattribute("predicate", predicate),] !isnothing(fastmathFlags) && - push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) + push!(_attributes, namedattribute("fastmathFlags", fastmathFlags)) return IR.create_operation( "llvm.fcmp", @@ -678,7 +680,7 @@ function fdiv( _attributes = NamedAttribute[] !isnothing(res) && push!(_results, res) !isnothing(fastmathFlags) && - push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) + push!(_attributes, namedattribute("fastmathFlags", fastmathFlags)) return IR.create_operation( "llvm.fdiv", @@ -710,7 +712,7 @@ function fmul( _attributes = NamedAttribute[] !isnothing(res) && push!(_results, res) !isnothing(fastmathFlags) && - push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) + push!(_attributes, namedattribute("fastmathFlags", fastmathFlags)) return IR.create_operation( "llvm.fmul", @@ -741,7 +743,7 @@ function fneg( _attributes = NamedAttribute[] !isnothing(res) && push!(_results, res) !isnothing(fastmathFlags) && - push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) + push!(_attributes, namedattribute("fastmathFlags", fastmathFlags)) return IR.create_operation( "llvm.fneg", @@ -865,7 +867,7 @@ function frem( _attributes = NamedAttribute[] !isnothing(res) && push!(_results, res) !isnothing(fastmathFlags) && - push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) + push!(_attributes, namedattribute("fastmathFlags", fastmathFlags)) return IR.create_operation( "llvm.frem", @@ -897,7 +899,7 @@ function fsub( _attributes = NamedAttribute[] !isnothing(res) && push!(_results, res) !isnothing(fastmathFlags) && - push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) + push!(_attributes, namedattribute("fastmathFlags", fastmathFlags)) return IR.create_operation( "llvm.fsub", @@ -1001,8 +1003,8 @@ function getelementptr( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[namedattribute("rawConstantIndices", rawConstantIndices),] - !isnothing(elem_type) && push!(attributes, namedattribute("elem_type", elem_type)) - !isnothing(inbounds) && push!(attributes, namedattribute("inbounds", inbounds)) + !isnothing(elem_type) && push!(_attributes, namedattribute("elem_type", elem_type)) + !isnothing(inbounds) && push!(_attributes, namedattribute("inbounds", inbounds)) return IR.create_operation( "llvm.getelementptr", @@ -1220,16 +1222,16 @@ function mlir_global(; 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(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(value) && push!(attributes, namedattribute("value", value)) - !isnothing(alignment) && push!(attributes, namedattribute("alignment", alignment)) - !isnothing(addr_space) && push!(attributes, namedattribute("addr_space", addr_space)) + push!(_attributes, namedattribute("thread_local_", thread_local_)) + !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(section) && push!(attributes, namedattribute("section", section)) + push!(_attributes, namedattribute("unnamed_addr", unnamed_addr)) + !isnothing(section) && push!(_attributes, namedattribute("section", section)) return IR.create_operation( "llvm.mlir.global", @@ -1296,12 +1298,13 @@ function inline_asm( ] !isnothing(res) && push!(_results, res) !isnothing(has_side_effects) && - push!(attributes, namedattribute("has_side_effects", 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)) + 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)) + push!(_attributes, namedattribute("operand_attrs", operand_attrs)) return IR.create_operation( "llvm.inline_asm", @@ -1419,14 +1422,14 @@ function invoke( _successors = Block[normalDest, unwindDest] _attributes = NamedAttribute[] push!( - attributes, + _attributes, operandsegmentsizes([ length(callee_operands), length(normalDestOperands), length(unwindDestOperands) ]), ) - !isnothing(callee) && push!(attributes, namedattribute("callee", callee)) + !isnothing(callee) && push!(_attributes, namedattribute("callee", callee)) !isnothing(branch_weights) && - push!(attributes, namedattribute("branch_weights", branch_weights)) + push!(_attributes, namedattribute("branch_weights", branch_weights)) return IR.create_operation( "llvm.invoke", @@ -1492,18 +1495,20 @@ function func(; _attributes = NamedAttribute[ namedattribute("sym_name", sym_name), namedattribute("function_type", function_type) ] - !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(personality) && push!(attributes, namedattribute("personality", personality)) + !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(personality) && + push!(_attributes, namedattribute("personality", personality)) !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)) + 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) && push!(attributes, namedattribute("memory", memory)) + push!(_attributes, namedattribute("function_entry_count", function_entry_count)) + !isnothing(memory) && push!(_attributes, namedattribute("memory", memory)) return IR.create_operation( "llvm.func", @@ -1555,7 +1560,7 @@ function landingpad( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(cleanup) && push!(attributes, namedattribute("cleanup", cleanup)) + !isnothing(cleanup) && push!(_attributes, namedattribute("cleanup", cleanup)) return IR.create_operation( "llvm.landingpad", @@ -1590,14 +1595,15 @@ function load( _successors = Block[] _attributes = NamedAttribute[] !isnothing(access_groups) && - push!(attributes, namedattribute("access_groups", access_groups)) + push!(_attributes, namedattribute("access_groups", access_groups)) !isnothing(alias_scopes) && - push!(attributes, namedattribute("alias_scopes", alias_scopes)) + push!(_attributes, namedattribute("alias_scopes", alias_scopes)) !isnothing(noalias_scopes) && - push!(attributes, namedattribute("noalias_scopes", noalias_scopes)) - !isnothing(alignment) && push!(attributes, namedattribute("alignment", alignment)) - !isnothing(volatile_) && push!(attributes, namedattribute("volatile_", volatile_)) - !isnothing(nontemporal) && push!(attributes, namedattribute("nontemporal", nontemporal)) + push!(_attributes, namedattribute("noalias_scopes", noalias_scopes)) + !isnothing(alignment) && push!(_attributes, namedattribute("alignment", alignment)) + !isnothing(volatile_) && push!(_attributes, namedattribute("volatile_", volatile_)) + !isnothing(nontemporal) && + push!(_attributes, namedattribute("nontemporal", nontemporal)) return IR.create_operation( "llvm.load", @@ -1786,7 +1792,7 @@ function return_(arg=nothing::Union{Nothing,Value}; location=Location()) _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(arg) && push!(operands, arg) + !isnothing(arg) && push!(_operands, arg) return IR.create_operation( "llvm.return", @@ -1998,14 +2004,15 @@ function store( _successors = Block[] _attributes = NamedAttribute[] !isnothing(access_groups) && - push!(attributes, namedattribute("access_groups", access_groups)) + push!(_attributes, namedattribute("access_groups", access_groups)) !isnothing(alias_scopes) && - push!(attributes, namedattribute("alias_scopes", alias_scopes)) + push!(_attributes, namedattribute("alias_scopes", alias_scopes)) !isnothing(noalias_scopes) && - push!(attributes, namedattribute("noalias_scopes", noalias_scopes)) - !isnothing(alignment) && push!(attributes, namedattribute("alignment", alignment)) - !isnothing(volatile_) && push!(attributes, namedattribute("volatile_", volatile_)) - !isnothing(nontemporal) && push!(attributes, namedattribute("nontemporal", nontemporal)) + push!(_attributes, namedattribute("noalias_scopes", noalias_scopes)) + !isnothing(alignment) && push!(_attributes, namedattribute("alignment", alignment)) + !isnothing(volatile_) && push!(_attributes, namedattribute("volatile_", volatile_)) + !isnothing(nontemporal) && + push!(_attributes, namedattribute("nontemporal", nontemporal)) return IR.create_operation( "llvm.store", @@ -2068,11 +2075,12 @@ function switch( "case_operand_segments", case_operand_segments ),] push!( - attributes, operandsegmentsizes([1, length(defaultOperands), length(caseOperands)]) + _attributes, operandsegmentsizes([1, length(defaultOperands), length(caseOperands)]) ) - !isnothing(case_values) && push!(attributes, namedattribute("case_values", case_values)) + !isnothing(case_values) && + push!(_attributes, namedattribute("case_values", case_values)) !isnothing(branch_weights) && - push!(attributes, namedattribute("branch_weights", branch_weights)) + push!(_attributes, namedattribute("branch_weights", branch_weights)) return IR.create_operation( "llvm.switch", @@ -2181,7 +2189,7 @@ function tbaa_tag(; namedattribute("access_type", access_type), namedattribute("offset", offset), ] - !isnothing(constant) && push!(attributes, namedattribute("constant", constant)) + !isnothing(constant) && push!(_attributes, namedattribute("constant", constant)) return IR.create_operation( "llvm.tbaa_tag", @@ -2243,7 +2251,7 @@ function tbaa_type_desc(; sym_name, identity=nothing, members, offsets, location namedattribute("members", members), namedattribute("offsets", offsets), ] - !isnothing(identity) && push!(attributes, namedattribute("identity", identity)) + !isnothing(identity) && push!(_attributes, namedattribute("identity", identity)) return IR.create_operation( "llvm.tbaa_type_desc", @@ -2582,7 +2590,7 @@ function intr_copysign( _attributes = NamedAttribute[] !isnothing(res) && push!(_results, res) !isnothing(fastmathFlags) && - push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) + push!(_attributes, namedattribute("fastmathFlags", fastmathFlags)) return IR.create_operation( "llvm.intr.copysign", @@ -2827,7 +2835,7 @@ function intr_cos( _attributes = NamedAttribute[] !isnothing(res) && push!(_results, res) !isnothing(fastmathFlags) && - push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) + push!(_attributes, namedattribute("fastmathFlags", fastmathFlags)) return IR.create_operation( "llvm.intr.cos", @@ -3020,7 +3028,7 @@ function intr_exp2( _attributes = NamedAttribute[] !isnothing(res) && push!(_results, res) !isnothing(fastmathFlags) && - push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) + push!(_attributes, namedattribute("fastmathFlags", fastmathFlags)) return IR.create_operation( "llvm.intr.exp2", @@ -3051,7 +3059,7 @@ function intr_exp( _attributes = NamedAttribute[] !isnothing(res) && push!(_results, res) !isnothing(fastmathFlags) && - push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) + push!(_attributes, namedattribute("fastmathFlags", fastmathFlags)) return IR.create_operation( "llvm.intr.exp", @@ -3082,7 +3090,7 @@ function intr_fabs( _attributes = NamedAttribute[] !isnothing(res) && push!(_results, res) !isnothing(fastmathFlags) && - push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) + push!(_attributes, namedattribute("fastmathFlags", fastmathFlags)) return IR.create_operation( "llvm.intr.fabs", @@ -3113,7 +3121,7 @@ function intr_ceil( _attributes = NamedAttribute[] !isnothing(res) && push!(_results, res) !isnothing(fastmathFlags) && - push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) + push!(_attributes, namedattribute("fastmathFlags", fastmathFlags)) return IR.create_operation( "llvm.intr.ceil", @@ -3144,7 +3152,7 @@ function intr_floor( _attributes = NamedAttribute[] !isnothing(res) && push!(_results, res) !isnothing(fastmathFlags) && - push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) + push!(_attributes, namedattribute("fastmathFlags", fastmathFlags)) return IR.create_operation( "llvm.intr.floor", @@ -3177,7 +3185,7 @@ function intr_fma( _attributes = NamedAttribute[] !isnothing(res) && push!(_results, res) !isnothing(fastmathFlags) && - push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) + push!(_attributes, namedattribute("fastmathFlags", fastmathFlags)) return IR.create_operation( "llvm.intr.fma", @@ -3210,7 +3218,7 @@ function intr_fmuladd( _attributes = NamedAttribute[] !isnothing(res) && push!(_results, res) !isnothing(fastmathFlags) && - push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) + push!(_attributes, namedattribute("fastmathFlags", fastmathFlags)) return IR.create_operation( "llvm.intr.fmuladd", @@ -3241,7 +3249,7 @@ function intr_trunc( _attributes = NamedAttribute[] !isnothing(res) && push!(_results, res) !isnothing(fastmathFlags) && - push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) + push!(_attributes, namedattribute("fastmathFlags", fastmathFlags)) return IR.create_operation( "llvm.intr.trunc", @@ -3364,7 +3372,7 @@ function intr_log10( _attributes = NamedAttribute[] !isnothing(res) && push!(_results, res) !isnothing(fastmathFlags) && - push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) + push!(_attributes, namedattribute("fastmathFlags", fastmathFlags)) return IR.create_operation( "llvm.intr.log10", @@ -3395,7 +3403,7 @@ function intr_log2( _attributes = NamedAttribute[] !isnothing(res) && push!(_results, res) !isnothing(fastmathFlags) && - push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) + push!(_attributes, namedattribute("fastmathFlags", fastmathFlags)) return IR.create_operation( "llvm.intr.log2", @@ -3426,7 +3434,7 @@ function intr_log( _attributes = NamedAttribute[] !isnothing(res) && push!(_results, res) !isnothing(fastmathFlags) && - push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) + push!(_attributes, namedattribute("fastmathFlags", fastmathFlags)) return IR.create_operation( "llvm.intr.log", @@ -3639,7 +3647,7 @@ function intr_maxnum( _attributes = NamedAttribute[] !isnothing(res) && push!(_results, res) !isnothing(fastmathFlags) && - push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) + push!(_attributes, namedattribute("fastmathFlags", fastmathFlags)) return IR.create_operation( "llvm.intr.maxnum", @@ -3671,7 +3679,7 @@ function intr_maximum( _attributes = NamedAttribute[] !isnothing(res) && push!(_results, res) !isnothing(fastmathFlags) && - push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) + push!(_attributes, namedattribute("fastmathFlags", fastmathFlags)) return IR.create_operation( "llvm.intr.maximum", @@ -3803,7 +3811,7 @@ function intr_minnum( _attributes = NamedAttribute[] !isnothing(res) && push!(_results, res) !isnothing(fastmathFlags) && - push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) + push!(_attributes, namedattribute("fastmathFlags", fastmathFlags)) return IR.create_operation( "llvm.intr.minnum", @@ -3835,7 +3843,7 @@ function intr_minimum( _attributes = NamedAttribute[] !isnothing(res) && push!(_results, res) !isnothing(fastmathFlags) && - push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) + push!(_attributes, namedattribute("fastmathFlags", fastmathFlags)) return IR.create_operation( "llvm.intr.minimum", @@ -3862,7 +3870,7 @@ function intr_powi( _successors = Block[] _attributes = NamedAttribute[] !isnothing(fastmathFlags) && - push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) + push!(_attributes, namedattribute("fastmathFlags", fastmathFlags)) return IR.create_operation( "llvm.intr.powi", @@ -3894,7 +3902,7 @@ function intr_pow( _attributes = NamedAttribute[] !isnothing(res) && push!(_results, res) !isnothing(fastmathFlags) && - push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) + push!(_attributes, namedattribute("fastmathFlags", fastmathFlags)) return IR.create_operation( "llvm.intr.pow", @@ -3950,7 +3958,7 @@ function intr_roundeven( _attributes = NamedAttribute[] !isnothing(res) && push!(_results, res) !isnothing(fastmathFlags) && - push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) + push!(_attributes, namedattribute("fastmathFlags", fastmathFlags)) return IR.create_operation( "llvm.intr.roundeven", @@ -3981,7 +3989,7 @@ function intr_round( _attributes = NamedAttribute[] !isnothing(res) && push!(_results, res) !isnothing(fastmathFlags) && - push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) + push!(_attributes, namedattribute("fastmathFlags", fastmathFlags)) return IR.create_operation( "llvm.intr.round", @@ -4139,7 +4147,7 @@ function intr_sin( _attributes = NamedAttribute[] !isnothing(res) && push!(_results, res) !isnothing(fastmathFlags) && - push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) + push!(_attributes, namedattribute("fastmathFlags", fastmathFlags)) return IR.create_operation( "llvm.intr.sin", @@ -4170,7 +4178,7 @@ function intr_sqrt( _attributes = NamedAttribute[] !isnothing(res) && push!(_results, res) !isnothing(fastmathFlags) && - push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) + push!(_attributes, namedattribute("fastmathFlags", fastmathFlags)) return IR.create_operation( "llvm.intr.sqrt", @@ -5992,7 +6000,7 @@ function intr_vector_reduce_fadd( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(reassoc) && push!(attributes, namedattribute("reassoc", reassoc)) + !isnothing(reassoc) && push!(_attributes, namedattribute("reassoc", reassoc)) return IR.create_operation( "llvm.intr.vector.reduce.fadd", @@ -6064,7 +6072,7 @@ function intr_vector_reduce_fmul( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(reassoc) && push!(attributes, namedattribute("reassoc", reassoc)) + !isnothing(reassoc) && push!(_attributes, namedattribute("reassoc", reassoc)) return IR.create_operation( "llvm.intr.vector.reduce.fmul", @@ -6462,7 +6470,7 @@ function cp_async_shared_global( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[namedattribute("size", size),] - !isnothing(bypass_l1) && push!(attributes, namedattribute("bypass_l1", bypass_l1)) + !isnothing(bypass_l1) && push!(_attributes, namedattribute("bypass_l1", bypass_l1)) return IR.create_operation( "nvvm.cp.async.shared.global", @@ -6708,16 +6716,16 @@ function mma_sync( namedattribute("layoutB", layoutB), ] push!( - attributes, + _attributes, operandsegmentsizes([length(operandA), length(operandB), length(operandC)]), ) - !isnothing(b1Op) && push!(attributes, namedattribute("b1Op", b1Op)) + !isnothing(b1Op) && push!(_attributes, namedattribute("b1Op", b1Op)) !isnothing(intOverflowBehavior) && - push!(attributes, namedattribute("intOverflowBehavior", intOverflowBehavior)) + push!(_attributes, namedattribute("intOverflowBehavior", intOverflowBehavior)) !isnothing(multiplicandAPtxType) && - push!(attributes, namedattribute("multiplicandAPtxType", multiplicandAPtxType)) + push!(_attributes, namedattribute("multiplicandAPtxType", multiplicandAPtxType)) !isnothing(multiplicandBPtxType) && - push!(attributes, namedattribute("multiplicandBPtxType", multiplicandBPtxType)) + push!(_attributes, namedattribute("multiplicandBPtxType", multiplicandBPtxType)) return IR.create_operation( "nvvm.mma.sync", @@ -6799,7 +6807,7 @@ function shfl_sync( _successors = Block[] _attributes = NamedAttribute[namedattribute("kind", kind),] !isnothing(return_value_and_is_valid) && push!( - attributes, + _attributes, namedattribute("return_value_and_is_valid", return_value_and_is_valid), ) diff --git a/src/Dialects/16/Linalg.jl b/src/Dialects/16/Linalg.jl index 574361cc..41ff99a9 100644 --- a/src/Dialects/16/Linalg.jl +++ b/src/Dialects/16/Linalg.jl @@ -115,7 +115,7 @@ function batch_matmul( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) return IR.create_operation( "linalg.batch_matmul", @@ -149,7 +149,7 @@ function batch_matmul_transpose_b( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) return IR.create_operation( "linalg.batch_matmul_transpose_b", @@ -181,7 +181,7 @@ function batch_matvec( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) return IR.create_operation( "linalg.batch_matvec", @@ -215,7 +215,7 @@ function batch_reduce_matmul( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) return IR.create_operation( "linalg.batch_reduce_matmul", @@ -292,9 +292,9 @@ function conv_1d_ncw_fcw( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.conv_1d_ncw_fcw", @@ -328,9 +328,9 @@ function conv_1d_nwc_wcf( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.conv_1d_nwc_wcf", @@ -362,7 +362,7 @@ function conv_1d( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) return IR.create_operation( "linalg.conv_1d", @@ -400,9 +400,9 @@ function conv_2d_nchw_fchw( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.conv_2d_nchw_fchw", @@ -440,9 +440,9 @@ function conv_2d_ngchw_fgchw( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.conv_2d_ngchw_fgchw", @@ -480,9 +480,9 @@ function conv_2d_nhwc_fhwc( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.conv_2d_nhwc_fhwc", @@ -520,9 +520,9 @@ function conv_2d_nhwc_hwcf( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.conv_2d_nhwc_hwcf", @@ -561,9 +561,9 @@ function conv_2d_nhwc_hwcf_q( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.conv_2d_nhwc_hwcf_q", @@ -595,7 +595,7 @@ function conv_2d( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) return IR.create_operation( "linalg.conv_2d", @@ -629,9 +629,9 @@ function conv_3d_ndhwc_dhwcf( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.conv_3d_ndhwc_dhwcf", @@ -666,9 +666,9 @@ function conv_3d_ndhwc_dhwcf_q( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.conv_3d_ndhwc_dhwcf_q", @@ -700,7 +700,7 @@ function conv_3d( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) return IR.create_operation( "linalg.conv_3d", @@ -733,8 +733,8 @@ function copy( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(cast) && push!(attributes, namedattribute("cast", cast)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(cast) && push!(_attributes, namedattribute("cast", cast)) return IR.create_operation( "linalg.copy", @@ -769,9 +769,9 @@ function depthwise_conv_1d_nwc_wc( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.depthwise_conv_1d_nwc_wc", @@ -805,9 +805,9 @@ function depthwise_conv_1d_nwc_wcm( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.depthwise_conv_1d_nwc_wcm", @@ -842,9 +842,9 @@ function depthwise_conv_2d_nchw_chw( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.depthwise_conv_2d_nchw_chw", @@ -879,9 +879,9 @@ function depthwise_conv_2d_nhwc_hwc( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.depthwise_conv_2d_nhwc_hwc", @@ -915,9 +915,9 @@ function depthwise_conv_2d_nhwc_hwc_q( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.depthwise_conv_2d_nhwc_hwc_q", @@ -951,9 +951,9 @@ function depthwise_conv_2d_nhwc_hwcm( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.depthwise_conv_2d_nhwc_hwcm", @@ -987,9 +987,9 @@ function depthwise_conv_2d_nhwc_hwcm_q( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.depthwise_conv_2d_nhwc_hwcm_q", @@ -1024,9 +1024,9 @@ function depthwise_conv_3d_ndhwc_dhwc( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.depthwise_conv_3d_ndhwc_dhwc", @@ -1060,9 +1060,9 @@ function depthwise_conv_3d_ndhwc_dhwcm( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.depthwise_conv_3d_ndhwc_dhwcm", @@ -1094,7 +1094,7 @@ function dot( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) return IR.create_operation( "linalg.dot", @@ -1128,9 +1128,9 @@ function elemwise_binary( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(fun) && push!(attributes, namedattribute("fun", fun)) - !isnothing(cast) && push!(attributes, namedattribute("cast", cast)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(fun) && push!(_attributes, namedattribute("fun", fun)) + !isnothing(cast) && push!(_attributes, namedattribute("cast", cast)) return IR.create_operation( "linalg.elemwise_binary", @@ -1164,9 +1164,9 @@ function elemwise_unary( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(fun) && push!(attributes, namedattribute("fun", fun)) - !isnothing(cast) && push!(attributes, namedattribute("cast", cast)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(fun) && push!(_attributes, namedattribute("fun", fun)) + !isnothing(cast) && push!(_attributes, namedattribute("cast", cast)) return IR.create_operation( "linalg.elemwise_unary", @@ -1199,7 +1199,7 @@ function fill( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) return IR.create_operation( "linalg.fill", @@ -1236,7 +1236,7 @@ function fill_rng_2d( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) return IR.create_operation( "linalg.fill_rng_2d", @@ -1368,10 +1368,10 @@ function generic( namedattribute("indexing_maps", indexing_maps), namedattribute("iterator_types", iterator_types), ] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(doc) && push!(attributes, namedattribute("doc", doc)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(doc) && push!(_attributes, namedattribute("doc", doc)) !isnothing(library_call) && - push!(attributes, namedattribute("library_call", library_call)) + push!(_attributes, namedattribute("library_call", library_call)) return IR.create_operation( "linalg.generic", @@ -1456,8 +1456,8 @@ function matmul( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(cast) && push!(attributes, namedattribute("cast", cast)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(cast) && push!(_attributes, namedattribute("cast", cast)) return IR.create_operation( "linalg.matmul", @@ -1490,8 +1490,8 @@ function matmul_transpose_b( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(cast) && push!(attributes, namedattribute("cast", cast)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(cast) && push!(_attributes, namedattribute("cast", cast)) return IR.create_operation( "linalg.matmul_transpose_b", @@ -1523,7 +1523,7 @@ function matmul_unsigned( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) return IR.create_operation( "linalg.matmul_unsigned", @@ -1555,7 +1555,7 @@ function matvec( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) return IR.create_operation( "linalg.matvec", @@ -1592,7 +1592,7 @@ function mmt4d( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) return IR.create_operation( "linalg.mmt4d", @@ -1626,9 +1626,9 @@ function pooling_nchw_max( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.pooling_nchw_max", @@ -1666,9 +1666,9 @@ function pooling_nchw_sum( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.pooling_nchw_sum", @@ -1702,9 +1702,9 @@ function pooling_ncw_max( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.pooling_ncw_max", @@ -1742,9 +1742,9 @@ function pooling_ncw_sum( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.pooling_ncw_sum", @@ -1778,9 +1778,9 @@ function pooling_ndhwc_max( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.pooling_ndhwc_max", @@ -1814,9 +1814,9 @@ function pooling_ndhwc_min( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.pooling_ndhwc_min", @@ -1850,9 +1850,9 @@ function pooling_ndhwc_sum( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.pooling_ndhwc_sum", @@ -1886,9 +1886,9 @@ function pooling_nhwc_max( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.pooling_nhwc_max", @@ -1922,9 +1922,9 @@ function pooling_nhwc_max_unsigned( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.pooling_nhwc_max_unsigned", @@ -1958,9 +1958,9 @@ function pooling_nhwc_min( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.pooling_nhwc_min", @@ -1994,9 +1994,9 @@ function pooling_nhwc_min_unsigned( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.pooling_nhwc_min_unsigned", @@ -2034,9 +2034,9 @@ function pooling_nhwc_sum( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.pooling_nhwc_sum", @@ -2070,9 +2070,9 @@ function pooling_nwc_max( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.pooling_nwc_max", @@ -2106,9 +2106,9 @@ function pooling_nwc_max_unsigned( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.pooling_nwc_max_unsigned", @@ -2142,9 +2142,9 @@ function pooling_nwc_min( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.pooling_nwc_min", @@ -2178,9 +2178,9 @@ function pooling_nwc_min_unsigned( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.pooling_nwc_min_unsigned", @@ -2218,9 +2218,9 @@ function pooling_nwc_sum( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.pooling_nwc_sum", @@ -2254,7 +2254,7 @@ function quantized_batch_matmul( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) return IR.create_operation( "linalg.quantized_batch_matmul", @@ -2288,7 +2288,7 @@ function quantized_matmul( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) return IR.create_operation( "linalg.quantized_matmul", @@ -2420,7 +2420,7 @@ function vecmat( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) return IR.create_operation( "linalg.vecmat", diff --git a/src/Dialects/16/MLProgram.jl b/src/Dialects/16/MLProgram.jl index c5851cfa..877a3cde 100644 --- a/src/Dialects/16/MLProgram.jl +++ b/src/Dialects/16/MLProgram.jl @@ -40,10 +40,10 @@ function func(; _attributes = NamedAttribute[ namedattribute("sym_name", sym_name), 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(arg_attrs) && push!(_attributes, namedattribute("arg_attrs", arg_attrs)) + !isnothing(res_attrs) && push!(_attributes, namedattribute("res_attrs", res_attrs)) !isnothing(sym_visibility) && - push!(attributes, namedattribute("sym_visibility", sym_visibility)) + push!(_attributes, namedattribute("sym_visibility", sym_visibility)) return IR.create_operation( "ml_program.func", @@ -219,10 +219,10 @@ function global_(; _attributes = NamedAttribute[ namedattribute("sym_name", sym_name), namedattribute("type", type) ] - !isnothing(is_mutable) && push!(attributes, namedattribute("is_mutable", is_mutable)) - !isnothing(value) && push!(attributes, namedattribute("value", value)) + !isnothing(is_mutable) && push!(_attributes, namedattribute("is_mutable", is_mutable)) + !isnothing(value) && push!(_attributes, namedattribute("value", value)) !isnothing(sym_visibility) && - push!(attributes, namedattribute("sym_visibility", sym_visibility)) + push!(_attributes, namedattribute("sym_visibility", sym_visibility)) return IR.create_operation( "ml_program.global", @@ -412,10 +412,10 @@ function subgraph(; _attributes = NamedAttribute[ namedattribute("sym_name", sym_name), 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(arg_attrs) && push!(_attributes, namedattribute("arg_attrs", arg_attrs)) + !isnothing(res_attrs) && push!(_attributes, namedattribute("res_attrs", res_attrs)) !isnothing(sym_visibility) && - push!(attributes, namedattribute("sym_visibility", sym_visibility)) + push!(_attributes, namedattribute("sym_visibility", sym_visibility)) return IR.create_operation( "ml_program.subgraph", diff --git a/src/Dialects/16/Math.jl b/src/Dialects/16/Math.jl index b449c462..a16123dc 100644 --- a/src/Dialects/16/Math.jl +++ b/src/Dialects/16/Math.jl @@ -30,7 +30,7 @@ function absf( _successors = Block[] _attributes = NamedAttribute[] !isnothing(result) && push!(_results, result) - !isnothing(fastmath) && push!(attributes, namedattribute("fastmath", fastmath)) + !isnothing(fastmath) && push!(_attributes, namedattribute("fastmath", fastmath)) return IR.create_operation( "math.absf", @@ -118,7 +118,7 @@ function atan2( _successors = Block[] _attributes = NamedAttribute[] !isnothing(result) && push!(_results, result) - !isnothing(fastmath) && push!(attributes, namedattribute("fastmath", fastmath)) + !isnothing(fastmath) && push!(_attributes, namedattribute("fastmath", fastmath)) return IR.create_operation( "math.atan2", @@ -164,7 +164,7 @@ function atan( _successors = Block[] _attributes = NamedAttribute[] !isnothing(result) && push!(_results, result) - !isnothing(fastmath) && push!(attributes, namedattribute("fastmath", fastmath)) + !isnothing(fastmath) && push!(_attributes, namedattribute("fastmath", fastmath)) return IR.create_operation( "math.atan", @@ -206,7 +206,7 @@ function cbrt( _successors = Block[] _attributes = NamedAttribute[] !isnothing(result) && push!(_results, result) - !isnothing(fastmath) && push!(attributes, namedattribute("fastmath", fastmath)) + !isnothing(fastmath) && push!(_attributes, namedattribute("fastmath", fastmath)) return IR.create_operation( "math.cbrt", @@ -252,7 +252,7 @@ function ceil( _successors = Block[] _attributes = NamedAttribute[] !isnothing(result) && push!(_results, result) - !isnothing(fastmath) && push!(attributes, namedattribute("fastmath", fastmath)) + !isnothing(fastmath) && push!(_attributes, namedattribute("fastmath", fastmath)) return IR.create_operation( "math.ceil", @@ -300,7 +300,7 @@ function copysign( _successors = Block[] _attributes = NamedAttribute[] !isnothing(result) && push!(_results, result) - !isnothing(fastmath) && push!(attributes, namedattribute("fastmath", fastmath)) + !isnothing(fastmath) && push!(_attributes, namedattribute("fastmath", fastmath)) return IR.create_operation( "math.copysign", @@ -346,7 +346,7 @@ function cos( _successors = Block[] _attributes = NamedAttribute[] !isnothing(result) && push!(_results, result) - !isnothing(fastmath) && push!(attributes, namedattribute("fastmath", fastmath)) + !isnothing(fastmath) && push!(_attributes, namedattribute("fastmath", fastmath)) return IR.create_operation( "math.cos", @@ -491,7 +491,7 @@ function erf( _successors = Block[] _attributes = NamedAttribute[] !isnothing(result) && push!(_results, result) - !isnothing(fastmath) && push!(attributes, namedattribute("fastmath", fastmath)) + !isnothing(fastmath) && push!(_attributes, namedattribute("fastmath", fastmath)) return IR.create_operation( "math.erf", @@ -537,7 +537,7 @@ function exp2( _successors = Block[] _attributes = NamedAttribute[] !isnothing(result) && push!(_results, result) - !isnothing(fastmath) && push!(attributes, namedattribute("fastmath", fastmath)) + !isnothing(fastmath) && push!(_attributes, namedattribute("fastmath", fastmath)) return IR.create_operation( "math.exp2", @@ -585,7 +585,7 @@ function expm1( _successors = Block[] _attributes = NamedAttribute[] !isnothing(result) && push!(_results, result) - !isnothing(fastmath) && push!(attributes, namedattribute("fastmath", fastmath)) + !isnothing(fastmath) && push!(_attributes, namedattribute("fastmath", fastmath)) return IR.create_operation( "math.expm1", @@ -631,7 +631,7 @@ function exp( _successors = Block[] _attributes = NamedAttribute[] !isnothing(result) && push!(_results, result) - !isnothing(fastmath) && push!(attributes, namedattribute("fastmath", fastmath)) + !isnothing(fastmath) && push!(_attributes, namedattribute("fastmath", fastmath)) return IR.create_operation( "math.exp", @@ -690,7 +690,7 @@ function fpowi( _successors = Block[] _attributes = NamedAttribute[] !isnothing(result) && push!(_results, result) - !isnothing(fastmath) && push!(attributes, namedattribute("fastmath", fastmath)) + !isnothing(fastmath) && push!(_attributes, namedattribute("fastmath", fastmath)) return IR.create_operation( "math.fpowi", @@ -736,7 +736,7 @@ function floor( _successors = Block[] _attributes = NamedAttribute[] !isnothing(result) && push!(_results, result) - !isnothing(fastmath) && push!(attributes, namedattribute("fastmath", fastmath)) + !isnothing(fastmath) && push!(_attributes, namedattribute("fastmath", fastmath)) return IR.create_operation( "math.floor", @@ -789,7 +789,7 @@ function fma( _successors = Block[] _attributes = NamedAttribute[] !isnothing(result) && push!(_results, result) - !isnothing(fastmath) && push!(attributes, namedattribute("fastmath", fastmath)) + !isnothing(fastmath) && push!(_attributes, namedattribute("fastmath", fastmath)) return IR.create_operation( "math.fma", @@ -871,7 +871,7 @@ function log10( _successors = Block[] _attributes = NamedAttribute[] !isnothing(result) && push!(_results, result) - !isnothing(fastmath) && push!(attributes, namedattribute("fastmath", fastmath)) + !isnothing(fastmath) && push!(_attributes, namedattribute("fastmath", fastmath)) return IR.create_operation( "math.log10", @@ -913,7 +913,7 @@ function log1p( _successors = Block[] _attributes = NamedAttribute[] !isnothing(result) && push!(_results, result) - !isnothing(fastmath) && push!(attributes, namedattribute("fastmath", fastmath)) + !isnothing(fastmath) && push!(_attributes, namedattribute("fastmath", fastmath)) return IR.create_operation( "math.log1p", @@ -953,7 +953,7 @@ function log2( _successors = Block[] _attributes = NamedAttribute[] !isnothing(result) && push!(_results, result) - !isnothing(fastmath) && push!(attributes, namedattribute("fastmath", fastmath)) + !isnothing(fastmath) && push!(_attributes, namedattribute("fastmath", fastmath)) return IR.create_operation( "math.log2", @@ -993,7 +993,7 @@ function log( _successors = Block[] _attributes = NamedAttribute[] !isnothing(result) && push!(_results, result) - !isnothing(fastmath) && push!(attributes, namedattribute("fastmath", fastmath)) + !isnothing(fastmath) && push!(_attributes, namedattribute("fastmath", fastmath)) return IR.create_operation( "math.log", @@ -1040,7 +1040,7 @@ function powf( _successors = Block[] _attributes = NamedAttribute[] !isnothing(result) && push!(_results, result) - !isnothing(fastmath) && push!(attributes, namedattribute("fastmath", fastmath)) + !isnothing(fastmath) && push!(_attributes, namedattribute("fastmath", fastmath)) return IR.create_operation( "math.powf", @@ -1089,7 +1089,7 @@ function roundeven( _successors = Block[] _attributes = NamedAttribute[] !isnothing(result) && push!(_results, result) - !isnothing(fastmath) && push!(attributes, namedattribute("fastmath", fastmath)) + !isnothing(fastmath) && push!(_attributes, namedattribute("fastmath", fastmath)) return IR.create_operation( "math.roundeven", @@ -1138,7 +1138,7 @@ function round( _successors = Block[] _attributes = NamedAttribute[] !isnothing(result) && push!(_results, result) - !isnothing(fastmath) && push!(attributes, namedattribute("fastmath", fastmath)) + !isnothing(fastmath) && push!(_attributes, namedattribute("fastmath", fastmath)) return IR.create_operation( "math.round", @@ -1178,7 +1178,7 @@ function rsqrt( _successors = Block[] _attributes = NamedAttribute[] !isnothing(result) && push!(_results, result) - !isnothing(fastmath) && push!(attributes, namedattribute("fastmath", fastmath)) + !isnothing(fastmath) && push!(_attributes, namedattribute("fastmath", fastmath)) return IR.create_operation( "math.rsqrt", @@ -1224,7 +1224,7 @@ function sin( _successors = Block[] _attributes = NamedAttribute[] !isnothing(result) && push!(_results, result) - !isnothing(fastmath) && push!(attributes, namedattribute("fastmath", fastmath)) + !isnothing(fastmath) && push!(_attributes, namedattribute("fastmath", fastmath)) return IR.create_operation( "math.sin", @@ -1264,7 +1264,7 @@ function sqrt( _successors = Block[] _attributes = NamedAttribute[] !isnothing(result) && push!(_results, result) - !isnothing(fastmath) && push!(attributes, namedattribute("fastmath", fastmath)) + !isnothing(fastmath) && push!(_attributes, namedattribute("fastmath", fastmath)) return IR.create_operation( "math.sqrt", @@ -1304,7 +1304,7 @@ function tan( _successors = Block[] _attributes = NamedAttribute[] !isnothing(result) && push!(_results, result) - !isnothing(fastmath) && push!(attributes, namedattribute("fastmath", fastmath)) + !isnothing(fastmath) && push!(_attributes, namedattribute("fastmath", fastmath)) return IR.create_operation( "math.tan", @@ -1344,7 +1344,7 @@ function tanh( _successors = Block[] _attributes = NamedAttribute[] !isnothing(result) && push!(_results, result) - !isnothing(fastmath) && push!(attributes, namedattribute("fastmath", fastmath)) + !isnothing(fastmath) && push!(_attributes, namedattribute("fastmath", fastmath)) return IR.create_operation( "math.tanh", @@ -1392,7 +1392,7 @@ function trunc( _successors = Block[] _attributes = NamedAttribute[] !isnothing(result) && push!(_results, result) - !isnothing(fastmath) && push!(attributes, namedattribute("fastmath", fastmath)) + !isnothing(fastmath) && push!(_attributes, namedattribute("fastmath", fastmath)) return IR.create_operation( "math.trunc", diff --git a/src/Dialects/16/MemRef.jl b/src/Dialects/16/MemRef.jl index a7708e16..fad9b64d 100644 --- a/src/Dialects/16/MemRef.jl +++ b/src/Dialects/16/MemRef.jl @@ -54,16 +54,15 @@ function atomic_rmw( value::Value, memref::Value, indices::Vector{Value}; - result=nothing::Union{Nothing,IR.Type}, + result::IR.Type, kind, location=Location(), ) - _results = IR.Type[] + _results = IR.Type[result,] _operands = Value[value, memref, indices...] _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[namedattribute("kind", kind),] - !isnothing(result) && push!(_results, result) return IR.create_operation( "memref.atomic_rmw", @@ -72,8 +71,8 @@ function atomic_rmw( owned_regions=_owned_regions, successors=_successors, attributes=_attributes, - results=(length(_results) == 0 ? nothing : _results), - result_inference=(length(_results) == 0 ? true : false), + results=_results, + result_inference=false, ) end @@ -294,8 +293,8 @@ function alloc( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(dynamicSizes), length(symbolOperands)])) - !isnothing(alignment) && push!(attributes, namedattribute("alignment", alignment)) + push!(_attributes, operandsegmentsizes([length(dynamicSizes), length(symbolOperands)])) + !isnothing(alignment) && push!(_attributes, namedattribute("alignment", alignment)) return IR.create_operation( "memref.alloc", @@ -358,8 +357,8 @@ function alloca( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(dynamicSizes), length(symbolOperands)])) - !isnothing(alignment) && push!(attributes, namedattribute("alignment", alignment)) + push!(_attributes, operandsegmentsizes([length(dynamicSizes), length(symbolOperands)])) + !isnothing(alignment) && push!(_attributes, namedattribute("alignment", alignment)) return IR.create_operation( "memref.alloca", @@ -1049,11 +1048,11 @@ function global_(; namedattribute("sym_name", sym_name), namedattribute("type", type) ] !isnothing(sym_visibility) && - push!(attributes, namedattribute("sym_visibility", sym_visibility)) + push!(_attributes, namedattribute("sym_visibility", sym_visibility)) !isnothing(initial_value) && - push!(attributes, namedattribute("initial_value", initial_value)) - !isnothing(constant) && push!(attributes, namedattribute("constant", constant)) - !isnothing(alignment) && push!(attributes, namedattribute("alignment", alignment)) + push!(_attributes, namedattribute("initial_value", initial_value)) + !isnothing(constant) && push!(_attributes, namedattribute("constant", constant)) + !isnothing(alignment) && push!(_attributes, namedattribute("alignment", alignment)) return IR.create_operation( "memref.global", @@ -1217,8 +1216,8 @@ function realloc( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(dynamicResultSize) && push!(operands, dynamicResultSize) - !isnothing(alignment) && push!(attributes, namedattribute("alignment", alignment)) + !isnothing(dynamicResultSize) && push!(_operands, dynamicResultSize) + !isnothing(alignment) && push!(_attributes, namedattribute("alignment", alignment)) return IR.create_operation( "memref.realloc", @@ -1291,7 +1290,7 @@ function reinterpret_cast( namedattribute("static_strides", static_strides), ] push!( - attributes, + _attributes, operandsegmentsizes([1, length(offsets), length(sizes), length(strides)]), ) @@ -1660,7 +1659,7 @@ function subview( namedattribute("static_strides", static_strides), ] push!( - attributes, + _attributes, operandsegmentsizes([1, length(offsets), length(sizes), length(strides)]), ) diff --git a/src/Dialects/16/NVGPU.jl b/src/Dialects/16/NVGPU.jl index f9a1fc18..887d8fe9 100644 --- a/src/Dialects/16/NVGPU.jl +++ b/src/Dialects/16/NVGPU.jl @@ -70,14 +70,14 @@ function device_async_copy( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[namedattribute("dstElements", dstElements),] - !isnothing(srcElements) && push!(operands, srcElements) + !isnothing(srcElements) && push!(_operands, srcElements) push!( - attributes, + _attributes, operandsegmentsizes([ 1, length(dstIndices), 1, length(srcIndices), isnothing(srcElements) ? 0 : 1 ]), ) - !isnothing(bypassL1) && push!(attributes, namedattribute("bypassL1", bypassL1)) + !isnothing(bypassL1) && push!(_attributes, namedattribute("bypassL1", bypassL1)) return IR.create_operation( "nvgpu.device_async_copy", @@ -153,7 +153,7 @@ function device_async_wait(asyncDependencies::Value; numGroups=nothing, location _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(numGroups) && push!(attributes, namedattribute("numGroups", numGroups)) + !isnothing(numGroups) && push!(_attributes, namedattribute("numGroups", numGroups)) return IR.create_operation( "nvgpu.device_async_wait", @@ -254,8 +254,9 @@ function mma_sp_sync( _successors = Block[] _attributes = NamedAttribute[namedattribute("mmaShape", mmaShape),] !isnothing(sparsitySelector) && - push!(attributes, namedattribute("sparsitySelector", sparsitySelector)) - !isnothing(tf32Enabled) && push!(attributes, namedattribute("tf32Enabled", tf32Enabled)) + push!(_attributes, namedattribute("sparsitySelector", sparsitySelector)) + !isnothing(tf32Enabled) && + push!(_attributes, namedattribute("tf32Enabled", tf32Enabled)) return IR.create_operation( "nvgpu.mma.sp.sync", @@ -305,7 +306,8 @@ function mma_sync( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[namedattribute("mmaShape", mmaShape),] - !isnothing(tf32Enabled) && push!(attributes, namedattribute("tf32Enabled", tf32Enabled)) + !isnothing(tf32Enabled) && + push!(_attributes, namedattribute("tf32Enabled", tf32Enabled)) return IR.create_operation( "nvgpu.mma.sync", diff --git a/src/Dialects/16/OpenACC.jl b/src/Dialects/16/OpenACC.jl index 2907d651..0779ee39 100644 --- a/src/Dialects/16/OpenACC.jl +++ b/src/Dialects/16/OpenACC.jl @@ -56,9 +56,9 @@ function data( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(ifCond) && push!(operands, ifCond) + !isnothing(ifCond) && push!(_operands, ifCond) push!( - attributes, + _attributes, operandsegmentsizes([ isnothing(ifCond) ? 0 : 1, length(copyOperands), @@ -74,7 +74,8 @@ function data( length(attachOperands), ]), ) - !isnothing(defaultAttr) && push!(attributes, namedattribute("defaultAttr", defaultAttr)) + !isnothing(defaultAttr) && + push!(_attributes, namedattribute("defaultAttr", defaultAttr)) return IR.create_operation( "acc.data", @@ -123,11 +124,11 @@ function enter_data( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(ifCond) && push!(operands, ifCond) - !isnothing(asyncOperand) && push!(operands, asyncOperand) - !isnothing(waitDevnum) && push!(operands, waitDevnum) + !isnothing(ifCond) && push!(_operands, ifCond) + !isnothing(asyncOperand) && push!(_operands, asyncOperand) + !isnothing(waitDevnum) && push!(_operands, waitDevnum) push!( - attributes, + _attributes, operandsegmentsizes([ isnothing(ifCond) ? 0 : 1, isnothing(asyncOperand) ? 0 : 1, @@ -139,8 +140,8 @@ function enter_data( length(attachOperands), ]), ) - !isnothing(async) && push!(attributes, namedattribute("async", async)) - !isnothing(wait) && push!(attributes, namedattribute("wait", wait)) + !isnothing(async) && push!(_attributes, namedattribute("async", async)) + !isnothing(wait) && push!(_attributes, namedattribute("wait", wait)) return IR.create_operation( "acc.enter_data", @@ -185,11 +186,11 @@ function exit_data( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(ifCond) && push!(operands, ifCond) - !isnothing(asyncOperand) && push!(operands, asyncOperand) - !isnothing(waitDevnum) && push!(operands, waitDevnum) + !isnothing(ifCond) && push!(_operands, ifCond) + !isnothing(asyncOperand) && push!(_operands, asyncOperand) + !isnothing(waitDevnum) && push!(_operands, waitDevnum) push!( - attributes, + _attributes, operandsegmentsizes([ isnothing(ifCond) ? 0 : 1, isnothing(asyncOperand) ? 0 : 1, @@ -200,9 +201,9 @@ function exit_data( length(detachOperands), ]), ) - !isnothing(async) && push!(attributes, namedattribute("async", async)) - !isnothing(wait) && push!(attributes, namedattribute("wait", wait)) - !isnothing(finalize) && push!(attributes, namedattribute("finalize", finalize)) + !isnothing(async) && push!(_attributes, namedattribute("async", async)) + !isnothing(wait) && push!(_attributes, namedattribute("wait", wait)) + !isnothing(finalize) && push!(_attributes, namedattribute("finalize", finalize)) return IR.create_operation( "acc.exit_data", @@ -240,10 +241,10 @@ function init( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(deviceNumOperand) && push!(operands, deviceNumOperand) - !isnothing(ifCond) && push!(operands, ifCond) + !isnothing(deviceNumOperand) && push!(_operands, deviceNumOperand) + !isnothing(ifCond) && push!(_operands, ifCond) push!( - attributes, + _attributes, operandsegmentsizes([ length(deviceTypeOperands), isnothing(deviceNumOperand) ? 0 : 1, @@ -306,12 +307,12 @@ function loop( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(gangNum) && push!(operands, gangNum) - !isnothing(gangStatic) && push!(operands, gangStatic) - !isnothing(workerNum) && push!(operands, workerNum) - !isnothing(vectorLength) && push!(operands, vectorLength) + !isnothing(gangNum) && push!(_operands, gangNum) + !isnothing(gangStatic) && push!(_operands, gangStatic) + !isnothing(workerNum) && push!(_operands, workerNum) + !isnothing(vectorLength) && push!(_operands, vectorLength) push!( - attributes, + _attributes, operandsegmentsizes([ isnothing(gangNum) ? 0 : 1, isnothing(gangStatic) ? 0 : 1, @@ -322,13 +323,15 @@ function loop( length(reductionOperands), ]), ) - !isnothing(collapse) && push!(attributes, namedattribute("collapse", collapse)) - !isnothing(seq) && push!(attributes, namedattribute("seq", seq)) - !isnothing(independent) && push!(attributes, namedattribute("independent", independent)) - !isnothing(auto_) && push!(attributes, namedattribute("auto_", auto_)) - !isnothing(reductionOp) && push!(attributes, namedattribute("reductionOp", reductionOp)) + !isnothing(collapse) && push!(_attributes, namedattribute("collapse", collapse)) + !isnothing(seq) && push!(_attributes, namedattribute("seq", seq)) + !isnothing(independent) && + push!(_attributes, namedattribute("independent", independent)) + !isnothing(auto_) && push!(_attributes, namedattribute("auto_", auto_)) + !isnothing(reductionOp) && + push!(_attributes, namedattribute("reductionOp", reductionOp)) !isnothing(exec_mapping) && - push!(attributes, namedattribute("exec_mapping", exec_mapping)) + push!(_attributes, namedattribute("exec_mapping", exec_mapping)) return IR.create_operation( "acc.loop", @@ -408,14 +411,14 @@ function parallel( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(async) && push!(operands, async) - !isnothing(numGangs) && push!(operands, numGangs) - !isnothing(numWorkers) && push!(operands, numWorkers) - !isnothing(vectorLength) && push!(operands, vectorLength) - !isnothing(ifCond) && push!(operands, ifCond) - !isnothing(selfCond) && push!(operands, selfCond) + !isnothing(async) && push!(_operands, async) + !isnothing(numGangs) && push!(_operands, numGangs) + !isnothing(numWorkers) && push!(_operands, numWorkers) + !isnothing(vectorLength) && push!(_operands, vectorLength) + !isnothing(ifCond) && push!(_operands, ifCond) + !isnothing(selfCond) && push!(_operands, selfCond) push!( - attributes, + _attributes, operandsegmentsizes([ isnothing(async) ? 0 : 1, length(waitOperands), @@ -440,11 +443,13 @@ function parallel( length(gangFirstPrivateOperands), ]), ) - !isnothing(asyncAttr) && push!(attributes, namedattribute("asyncAttr", asyncAttr)) - !isnothing(waitAttr) && push!(attributes, namedattribute("waitAttr", waitAttr)) - !isnothing(selfAttr) && push!(attributes, namedattribute("selfAttr", selfAttr)) - !isnothing(reductionOp) && push!(attributes, namedattribute("reductionOp", reductionOp)) - !isnothing(defaultAttr) && push!(attributes, namedattribute("defaultAttr", defaultAttr)) + !isnothing(asyncAttr) && push!(_attributes, namedattribute("asyncAttr", asyncAttr)) + !isnothing(waitAttr) && push!(_attributes, namedattribute("waitAttr", waitAttr)) + !isnothing(selfAttr) && push!(_attributes, namedattribute("selfAttr", selfAttr)) + !isnothing(reductionOp) && + push!(_attributes, namedattribute("reductionOp", reductionOp)) + !isnothing(defaultAttr) && + push!(_attributes, namedattribute("defaultAttr", defaultAttr)) return IR.create_operation( "acc.parallel", @@ -482,10 +487,10 @@ function shutdown( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(deviceNumOperand) && push!(operands, deviceNumOperand) - !isnothing(ifCond) && push!(operands, ifCond) + !isnothing(deviceNumOperand) && push!(_operands, deviceNumOperand) + !isnothing(ifCond) && push!(_operands, ifCond) push!( - attributes, + _attributes, operandsegmentsizes([ length(deviceTypeOperands), isnothing(deviceNumOperand) ? 0 : 1, @@ -566,11 +571,11 @@ function update( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(ifCond) && push!(operands, ifCond) - !isnothing(asyncOperand) && push!(operands, asyncOperand) - !isnothing(waitDevnum) && push!(operands, waitDevnum) + !isnothing(ifCond) && push!(_operands, ifCond) + !isnothing(asyncOperand) && push!(_operands, asyncOperand) + !isnothing(waitDevnum) && push!(_operands, waitDevnum) push!( - attributes, + _attributes, operandsegmentsizes([ isnothing(ifCond) ? 0 : 1, isnothing(asyncOperand) ? 0 : 1, @@ -581,9 +586,9 @@ function update( length(deviceOperands), ]), ) - !isnothing(async) && push!(attributes, namedattribute("async", async)) - !isnothing(wait) && push!(attributes, namedattribute("wait", wait)) - !isnothing(ifPresent) && push!(attributes, namedattribute("ifPresent", ifPresent)) + !isnothing(async) && push!(_attributes, namedattribute("async", async)) + !isnothing(wait) && push!(_attributes, namedattribute("wait", wait)) + !isnothing(ifPresent) && push!(_attributes, namedattribute("ifPresent", ifPresent)) return IR.create_operation( "acc.update", @@ -623,11 +628,11 @@ function wait( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(asyncOperand) && push!(operands, asyncOperand) - !isnothing(waitDevnum) && push!(operands, waitDevnum) - !isnothing(ifCond) && push!(operands, ifCond) + !isnothing(asyncOperand) && push!(_operands, asyncOperand) + !isnothing(waitDevnum) && push!(_operands, waitDevnum) + !isnothing(ifCond) && push!(_operands, ifCond) push!( - attributes, + _attributes, operandsegmentsizes([ length(waitOperands), isnothing(asyncOperand) ? 0 : 1, @@ -635,7 +640,7 @@ function wait( isnothing(ifCond) ? 0 : 1, ]), ) - !isnothing(async) && push!(attributes, namedattribute("async", async)) + !isnothing(async) && push!(_attributes, namedattribute("async", async)) return IR.create_operation( "acc.wait", diff --git a/src/Dialects/16/OpenMP.jl b/src/Dialects/16/OpenMP.jl index 26173815..f2b6ce9a 100644 --- a/src/Dialects/16/OpenMP.jl +++ b/src/Dialects/16/OpenMP.jl @@ -45,9 +45,9 @@ function atomic_capture(; _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(hint_val) && push!(attributes, namedattribute("hint_val", hint_val)) + !isnothing(hint_val) && push!(_attributes, namedattribute("hint_val", hint_val)) !isnothing(memory_order_val) && - push!(attributes, namedattribute("memory_order_val", memory_order_val)) + push!(_attributes, namedattribute("memory_order_val", memory_order_val)) return IR.create_operation( "omp.atomic.capture", @@ -84,9 +84,9 @@ function atomic_read( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(hint_val) && push!(attributes, namedattribute("hint_val", hint_val)) + !isnothing(hint_val) && push!(_attributes, namedattribute("hint_val", hint_val)) !isnothing(memory_order_val) && - push!(attributes, namedattribute("memory_order_val", memory_order_val)) + push!(_attributes, namedattribute("memory_order_val", memory_order_val)) return IR.create_operation( "omp.atomic.read", @@ -142,9 +142,9 @@ function atomic_update( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(hint_val) && push!(attributes, namedattribute("hint_val", hint_val)) + !isnothing(hint_val) && push!(_attributes, namedattribute("hint_val", hint_val)) !isnothing(memory_order_val) && - push!(attributes, namedattribute("memory_order_val", memory_order_val)) + push!(_attributes, namedattribute("memory_order_val", memory_order_val)) return IR.create_operation( "omp.atomic.update", @@ -187,9 +187,9 @@ function atomic_write( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(hint_val) && push!(attributes, namedattribute("hint_val", hint_val)) + !isnothing(hint_val) && push!(_attributes, namedattribute("hint_val", hint_val)) !isnothing(memory_order_val) && - push!(attributes, namedattribute("memory_order_val", memory_order_val)) + push!(_attributes, namedattribute("memory_order_val", memory_order_val)) return IR.create_operation( "omp.atomic.write", @@ -246,7 +246,7 @@ function cancel( _attributes = NamedAttribute[namedattribute( "cancellation_construct_type_val", cancellation_construct_type_val ),] - !isnothing(if_expr) && push!(operands, if_expr) + !isnothing(if_expr) && push!(_operands, if_expr) return IR.create_operation( "omp.cancel", @@ -301,7 +301,7 @@ function critical_declare(; sym_name, hint_val=nothing, location=Location()) _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[namedattribute("sym_name", sym_name),] - !isnothing(hint_val) && push!(attributes, namedattribute("hint_val", hint_val)) + !isnothing(hint_val) && push!(_attributes, namedattribute("hint_val", hint_val)) return IR.create_operation( "omp.critical.declare", @@ -327,7 +327,7 @@ function critical(; name=nothing, region::Region, location=Location()) _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(name) && push!(attributes, namedattribute("name", name)) + !isnothing(name) && push!(_attributes, namedattribute("name", name)) return IR.create_operation( "omp.critical", @@ -423,9 +423,9 @@ function ordered( _successors = Block[] _attributes = NamedAttribute[] !isnothing(depend_type_val) && - push!(attributes, namedattribute("depend_type_val", depend_type_val)) + push!(_attributes, namedattribute("depend_type_val", depend_type_val)) !isnothing(num_loops_val) && - push!(attributes, namedattribute("num_loops_val", num_loops_val)) + push!(_attributes, namedattribute("num_loops_val", num_loops_val)) return IR.create_operation( "omp.ordered", @@ -456,7 +456,7 @@ function ordered_region(; simd=nothing, region::Region, location=Location()) _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(simd) && push!(attributes, namedattribute("simd", simd)) + !isnothing(simd) && push!(_attributes, namedattribute("simd", simd)) return IR.create_operation( "omp.ordered_region", @@ -518,10 +518,10 @@ function parallel( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(if_expr_var) && push!(operands, if_expr_var) - !isnothing(num_threads_var) && push!(operands, num_threads_var) + !isnothing(if_expr_var) && push!(_operands, if_expr_var) + !isnothing(num_threads_var) && push!(_operands, num_threads_var) push!( - attributes, + _attributes, operandsegmentsizes([ isnothing(if_expr_var) ? 0 : 1, isnothing(num_threads_var) ? 0 : 1, @@ -530,9 +530,9 @@ function parallel( length(reduction_vars), ]), ) - !isnothing(reductions) && push!(attributes, namedattribute("reductions", reductions)) + !isnothing(reductions) && push!(_attributes, namedattribute("reductions", reductions)) !isnothing(proc_bind_val) && - push!(attributes, namedattribute("proc_bind_val", proc_bind_val)) + push!(_attributes, namedattribute("proc_bind_val", proc_bind_val)) return IR.create_operation( "omp.parallel", @@ -694,13 +694,13 @@ function sections( _successors = Block[] _attributes = NamedAttribute[] push!( - attributes, + _attributes, operandsegmentsizes([ length(reduction_vars), length(allocate_vars), length(allocators_vars) ]), ) - !isnothing(reductions) && push!(attributes, namedattribute("reductions", reductions)) - !isnothing(nowait) && push!(attributes, namedattribute("nowait", nowait)) + !isnothing(reductions) && push!(_attributes, namedattribute("reductions", reductions)) + !isnothing(nowait) && push!(_attributes, namedattribute("nowait", nowait)) return IR.create_operation( "omp.sections", @@ -781,9 +781,9 @@ function simdloop( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(if_expr) && push!(operands, if_expr) + !isnothing(if_expr) && push!(_operands, if_expr) push!( - attributes, + _attributes, operandsegmentsizes([ length(lowerBound), length(upperBound), @@ -794,11 +794,11 @@ function simdloop( ]), ) !isnothing(alignment_values) && - push!(attributes, namedattribute("alignment_values", alignment_values)) - !isnothing(order_val) && push!(attributes, namedattribute("order_val", order_val)) - !isnothing(simdlen) && push!(attributes, namedattribute("simdlen", simdlen)) - !isnothing(safelen) && push!(attributes, namedattribute("safelen", safelen)) - !isnothing(inclusive) && push!(attributes, namedattribute("inclusive", inclusive)) + push!(_attributes, namedattribute("alignment_values", alignment_values)) + !isnothing(order_val) && push!(_attributes, namedattribute("order_val", order_val)) + !isnothing(simdlen) && push!(_attributes, namedattribute("simdlen", simdlen)) + !isnothing(safelen) && push!(_attributes, namedattribute("safelen", safelen)) + !isnothing(inclusive) && push!(_attributes, namedattribute("inclusive", inclusive)) return IR.create_operation( "omp.simdloop", @@ -833,8 +833,10 @@ function single( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(allocate_vars), length(allocators_vars)])) - !isnothing(nowait) && push!(attributes, namedattribute("nowait", nowait)) + push!( + _attributes, operandsegmentsizes([length(allocate_vars), length(allocators_vars)]) + ) + !isnothing(nowait) && push!(_attributes, namedattribute("nowait", nowait)) return IR.create_operation( "omp.single", @@ -881,18 +883,18 @@ function target( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(if_expr) && push!(operands, if_expr) - !isnothing(device) && push!(operands, device) - !isnothing(thread_limit) && push!(operands, thread_limit) + !isnothing(if_expr) && push!(_operands, if_expr) + !isnothing(device) && push!(_operands, device) + !isnothing(thread_limit) && push!(_operands, thread_limit) push!( - attributes, + _attributes, operandsegmentsizes([ isnothing(if_expr) ? 0 : 1, isnothing(device) ? 0 : 1, isnothing(thread_limit) ? 0 : 1, ]), ) - !isnothing(nowait) && push!(attributes, namedattribute("nowait", nowait)) + !isnothing(nowait) && push!(_attributes, namedattribute("nowait", nowait)) return IR.create_operation( "omp.target", @@ -952,10 +954,10 @@ function target_data( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[namedattribute("map_types", map_types),] - !isnothing(if_expr) && push!(operands, if_expr) - !isnothing(device) && push!(operands, device) + !isnothing(if_expr) && push!(_operands, if_expr) + !isnothing(device) && push!(_operands, device) push!( - attributes, + _attributes, operandsegmentsizes([ isnothing(if_expr) ? 0 : 1, isnothing(device) ? 0 : 1, @@ -1014,15 +1016,15 @@ function target_enter_data( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[namedattribute("map_types", map_types),] - !isnothing(if_expr) && push!(operands, if_expr) - !isnothing(device) && push!(operands, device) + !isnothing(if_expr) && push!(_operands, if_expr) + !isnothing(device) && push!(_operands, device) push!( - attributes, + _attributes, operandsegmentsizes([ isnothing(if_expr) ? 0 : 1, isnothing(device) ? 0 : 1, length(map_operands) ]), ) - !isnothing(nowait) && push!(attributes, namedattribute("nowait", nowait)) + !isnothing(nowait) && push!(_attributes, namedattribute("nowait", nowait)) return IR.create_operation( "omp.target_enter_data", @@ -1073,15 +1075,15 @@ function target_exit_data( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[namedattribute("map_types", map_types),] - !isnothing(if_expr) && push!(operands, if_expr) - !isnothing(device) && push!(operands, device) + !isnothing(if_expr) && push!(_operands, if_expr) + !isnothing(device) && push!(_operands, device) push!( - attributes, + _attributes, operandsegmentsizes([ isnothing(if_expr) ? 0 : 1, isnothing(device) ? 0 : 1, length(map_operands) ]), ) - !isnothing(nowait) && push!(attributes, namedattribute("nowait", nowait)) + !isnothing(nowait) && push!(_attributes, namedattribute("nowait", nowait)) return IR.create_operation( "omp.target_exit_data", @@ -1133,13 +1135,13 @@ function taskgroup( _successors = Block[] _attributes = NamedAttribute[] push!( - attributes, + _attributes, operandsegmentsizes([ length(task_reduction_vars), length(allocate_vars), length(allocators_vars) ]), ) !isnothing(task_reductions) && - push!(attributes, namedattribute("task_reductions", task_reductions)) + push!(_attributes, namedattribute("task_reductions", task_reductions)) return IR.create_operation( "omp.taskgroup", @@ -1286,13 +1288,13 @@ function taskloop( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(if_expr) && push!(operands, if_expr) - !isnothing(final_expr) && push!(operands, final_expr) - !isnothing(priority) && push!(operands, priority) - !isnothing(grain_size) && push!(operands, grain_size) - !isnothing(num_tasks) && push!(operands, num_tasks) + !isnothing(if_expr) && push!(_operands, if_expr) + !isnothing(final_expr) && push!(_operands, final_expr) + !isnothing(priority) && push!(_operands, priority) + !isnothing(grain_size) && push!(_operands, grain_size) + !isnothing(num_tasks) && push!(_operands, num_tasks) push!( - attributes, + _attributes, operandsegmentsizes([ length(lowerBound), length(upperBound), @@ -1308,13 +1310,13 @@ function taskloop( isnothing(num_tasks) ? 0 : 1, ]), ) - !isnothing(inclusive) && push!(attributes, namedattribute("inclusive", inclusive)) - !isnothing(untied) && push!(attributes, namedattribute("untied", untied)) - !isnothing(mergeable) && push!(attributes, namedattribute("mergeable", mergeable)) + !isnothing(inclusive) && push!(_attributes, namedattribute("inclusive", inclusive)) + !isnothing(untied) && push!(_attributes, namedattribute("untied", untied)) + !isnothing(mergeable) && push!(_attributes, namedattribute("mergeable", mergeable)) !isnothing(in_reductions) && - push!(attributes, namedattribute("in_reductions", in_reductions)) - !isnothing(reductions) && push!(attributes, namedattribute("reductions", reductions)) - !isnothing(nogroup) && push!(attributes, namedattribute("nogroup", nogroup)) + push!(_attributes, namedattribute("in_reductions", in_reductions)) + !isnothing(reductions) && push!(_attributes, namedattribute("reductions", reductions)) + !isnothing(nogroup) && push!(_attributes, namedattribute("nogroup", nogroup)) return IR.create_operation( "omp.taskloop", @@ -1388,11 +1390,11 @@ function task( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(if_expr) && push!(operands, if_expr) - !isnothing(final_expr) && push!(operands, final_expr) - !isnothing(priority) && push!(operands, priority) + !isnothing(if_expr) && push!(_operands, if_expr) + !isnothing(final_expr) && push!(_operands, final_expr) + !isnothing(priority) && push!(_operands, priority) push!( - attributes, + _attributes, operandsegmentsizes([ isnothing(if_expr) ? 0 : 1, isnothing(final_expr) ? 0 : 1, @@ -1402,10 +1404,10 @@ function task( length(allocators_vars), ]), ) - !isnothing(untied) && push!(attributes, namedattribute("untied", untied)) - !isnothing(mergeable) && push!(attributes, namedattribute("mergeable", mergeable)) + !isnothing(untied) && push!(_attributes, namedattribute("untied", untied)) + !isnothing(mergeable) && push!(_attributes, namedattribute("mergeable", mergeable)) !isnothing(in_reductions) && - push!(attributes, namedattribute("in_reductions", in_reductions)) + push!(_attributes, namedattribute("in_reductions", in_reductions)) return IR.create_operation( "omp.task", @@ -1625,9 +1627,9 @@ function wsloop( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(schedule_chunk_var) && push!(operands, schedule_chunk_var) + !isnothing(schedule_chunk_var) && push!(_operands, schedule_chunk_var) push!( - attributes, + _attributes, operandsegmentsizes([ length(lowerBound), length(upperBound), @@ -1638,17 +1640,18 @@ function wsloop( isnothing(schedule_chunk_var) ? 0 : 1, ]), ) - !isnothing(reductions) && push!(attributes, namedattribute("reductions", reductions)) + !isnothing(reductions) && push!(_attributes, namedattribute("reductions", reductions)) !isnothing(schedule_val) && - push!(attributes, namedattribute("schedule_val", schedule_val)) + push!(_attributes, namedattribute("schedule_val", schedule_val)) !isnothing(schedule_modifier) && - push!(attributes, namedattribute("schedule_modifier", schedule_modifier)) + push!(_attributes, namedattribute("schedule_modifier", schedule_modifier)) !isnothing(simd_modifier) && - push!(attributes, namedattribute("simd_modifier", simd_modifier)) - !isnothing(nowait) && push!(attributes, namedattribute("nowait", nowait)) - !isnothing(ordered_val) && push!(attributes, namedattribute("ordered_val", ordered_val)) - !isnothing(order_val) && push!(attributes, namedattribute("order_val", order_val)) - !isnothing(inclusive) && push!(attributes, namedattribute("inclusive", inclusive)) + push!(_attributes, namedattribute("simd_modifier", simd_modifier)) + !isnothing(nowait) && push!(_attributes, namedattribute("nowait", nowait)) + !isnothing(ordered_val) && + push!(_attributes, namedattribute("ordered_val", ordered_val)) + !isnothing(order_val) && push!(_attributes, namedattribute("order_val", order_val)) + !isnothing(inclusive) && push!(_attributes, namedattribute("inclusive", inclusive)) return IR.create_operation( "omp.wsloop", diff --git a/src/Dialects/16/PDL.jl b/src/Dialects/16/PDL.jl index 8379d2cc..d819792d 100644 --- a/src/Dialects/16/PDL.jl +++ b/src/Dialects/16/PDL.jl @@ -122,8 +122,8 @@ function attribute( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(valueType) && push!(operands, valueType) - !isnothing(value) && push!(attributes, namedattribute("value", value)) + !isnothing(valueType) && push!(_operands, valueType) + !isnothing(value) && push!(_attributes, namedattribute("value", value)) return IR.create_operation( "pdl.attribute", @@ -198,7 +198,7 @@ function operand( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(valueType) && push!(operands, valueType) + !isnothing(valueType) && push!(_operands, valueType) return IR.create_operation( "pdl.operand", @@ -241,7 +241,7 @@ function operands( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(valueType) && push!(operands, valueType) + !isnothing(valueType) && push!(_operands, valueType) return IR.create_operation( "pdl.operands", @@ -367,12 +367,12 @@ function operation( _successors = Block[] _attributes = NamedAttribute[namedattribute("attributeValueNames", attributeValueNames),] push!( - attributes, + _attributes, operandsegmentsizes([ length(operandValues), length(attributeValues), length(typeValues) ]), ) - !isnothing(opName) && push!(attributes, namedattribute("opName", opName)) + !isnothing(opName) && push!(_attributes, namedattribute("opName", opName)) return IR.create_operation( "pdl.operation", @@ -416,7 +416,7 @@ function pattern(; benefit, sym_name=nothing, bodyRegion::Region, location=Locat _owned_regions = Region[bodyRegion,] _successors = Block[] _attributes = NamedAttribute[namedattribute("benefit", benefit),] - !isnothing(sym_name) && push!(attributes, namedattribute("sym_name", sym_name)) + !isnothing(sym_name) && push!(_attributes, namedattribute("sym_name", sym_name)) return IR.create_operation( "pdl.pattern", @@ -512,9 +512,9 @@ function replace( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(replOperation) && push!(operands, replOperation) + !isnothing(replOperation) && push!(_operands, replOperation) push!( - attributes, + _attributes, operandsegmentsizes([1, isnothing(replOperation) ? 0 : 1, length(replValues)]), ) @@ -606,7 +606,7 @@ function results(parent::Value; val::IR.Type, index=nothing, location=Location() _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(index) && push!(attributes, namedattribute("index", index)) + !isnothing(index) && push!(_attributes, namedattribute("index", index)) return IR.create_operation( "pdl.results", @@ -671,9 +671,9 @@ function rewrite( _owned_regions = Region[bodyRegion,] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(root) && push!(operands, root) - push!(attributes, operandsegmentsizes([isnothing(root) ? 0 : 1, length(externalArgs)])) - !isnothing(name) && push!(attributes, namedattribute("name", name)) + !isnothing(root) && push!(_operands, root) + push!(_attributes, operandsegmentsizes([isnothing(root) ? 0 : 1, length(externalArgs)])) + !isnothing(name) && push!(_attributes, namedattribute("name", name)) return IR.create_operation( "pdl.rewrite", @@ -712,7 +712,7 @@ function type(; result::IR.Type, constantType=nothing, location=Location()) _successors = Block[] _attributes = NamedAttribute[] !isnothing(constantType) && - push!(attributes, namedattribute("constantType", constantType)) + push!(_attributes, namedattribute("constantType", constantType)) return IR.create_operation( "pdl.type", @@ -751,7 +751,7 @@ function types(; result::IR.Type, constantTypes=nothing, location=Location()) _successors = Block[] _attributes = NamedAttribute[] !isnothing(constantTypes) && - push!(attributes, namedattribute("constantTypes", constantTypes)) + push!(_attributes, namedattribute("constantTypes", constantTypes)) return IR.create_operation( "pdl.types", diff --git a/src/Dialects/16/PDLInterp.jl b/src/Dialects/16/PDLInterp.jl index 93560277..23673f60 100644 --- a/src/Dialects/16/PDLInterp.jl +++ b/src/Dialects/16/PDLInterp.jl @@ -217,7 +217,7 @@ function check_operand_count( _successors = Block[trueDest, falseDest] _attributes = NamedAttribute[namedattribute("count", count),] !isnothing(compareAtLeast) && - push!(attributes, namedattribute("compareAtLeast", compareAtLeast)) + push!(_attributes, namedattribute("compareAtLeast", compareAtLeast)) return IR.create_operation( "pdl_interp.check_operand_count", @@ -298,7 +298,7 @@ function check_result_count( _successors = Block[trueDest, falseDest] _attributes = NamedAttribute[namedattribute("count", count),] !isnothing(compareAtLeast) && - push!(attributes, namedattribute("compareAtLeast", compareAtLeast)) + push!(_attributes, namedattribute("compareAtLeast", compareAtLeast)) return IR.create_operation( "pdl_interp.check_result_count", @@ -481,13 +481,13 @@ function create_operation( namedattribute("inputAttributeNames", inputAttributeNames), ] push!( - attributes, + _attributes, operandsegmentsizes([ length(inputOperands), length(inputAttributes), length(inputResultTypes) ]), ) !isnothing(inferredResultTypes) && - push!(attributes, namedattribute("inferredResultTypes", inferredResultTypes)) + push!(_attributes, namedattribute("inferredResultTypes", inferredResultTypes)) return IR.create_operation( "pdl_interp.create_operation", @@ -769,8 +769,8 @@ function func(; _attributes = NamedAttribute[ namedattribute("sym_name", sym_name), 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(arg_attrs) && push!(_attributes, namedattribute("arg_attrs", arg_attrs)) + !isnothing(res_attrs) && push!(_attributes, namedattribute("res_attrs", res_attrs)) return IR.create_operation( "pdl_interp.func", @@ -941,7 +941,7 @@ function get_operands(inputOp::Value; value::IR.Type, index=nothing, location=Lo _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(index) && push!(attributes, namedattribute("index", index)) + !isnothing(index) && push!(_attributes, namedattribute("index", index)) return IR.create_operation( "pdl_interp.get_operands", @@ -1016,7 +1016,7 @@ function get_results(inputOp::Value; value::IR.Type, index=nothing, location=Loc _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(index) && push!(attributes, namedattribute("index", index)) + !isnothing(index) && push!(_attributes, namedattribute("index", index)) return IR.create_operation( "pdl_interp.get_results", @@ -1166,10 +1166,10 @@ function record_match( _attributes = NamedAttribute[ namedattribute("rewriter", rewriter), namedattribute("benefit", benefit) ] - push!(attributes, operandsegmentsizes([length(inputs), length(matchedOps)])) - !isnothing(rootKind) && push!(attributes, namedattribute("rootKind", rootKind)) + push!(_attributes, operandsegmentsizes([length(inputs), length(matchedOps)])) + !isnothing(rootKind) && push!(_attributes, namedattribute("rootKind", rootKind)) !isnothing(generatedOps) && - push!(attributes, namedattribute("generatedOps", generatedOps)) + push!(_attributes, namedattribute("generatedOps", generatedOps)) return IR.create_operation( "pdl_interp.record_match", diff --git a/src/Dialects/16/SCF.jl b/src/Dialects/16/SCF.jl index d78e4e1b..544512d4 100644 --- a/src/Dialects/16/SCF.jl +++ b/src/Dialects/16/SCF.jl @@ -345,8 +345,8 @@ function foreach_thread( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(num_threads), length(outputs)])) - !isnothing(mapping) && push!(attributes, namedattribute("mapping", mapping)) + push!(_attributes, operandsegmentsizes([length(num_threads), length(outputs)])) + !isnothing(mapping) && push!(_attributes, namedattribute("mapping", mapping)) return IR.create_operation( "scf.foreach_thread", @@ -549,7 +549,7 @@ function parallel( _successors = Block[] _attributes = NamedAttribute[] push!( - attributes, + _attributes, operandsegmentsizes([ length(lowerBound), length(upperBound), length(step), length(initVals) ]), diff --git a/src/Dialects/16/SPIRV.jl b/src/Dialects/16/SPIRV.jl index c167f213..65c5c7d6 100644 --- a/src/Dialects/16/SPIRV.jl +++ b/src/Dialects/16/SPIRV.jl @@ -1524,11 +1524,11 @@ function BranchConditional( _successors = Block[trueTarget, falseTarget] _attributes = NamedAttribute[] push!( - attributes, + _attributes, operandsegmentsizes([1, length(trueTargetOperands), length(falseTargetOperands)]), ) !isnothing(branch_weights) && - push!(attributes, namedattribute("branch_weights", branch_weights)) + push!(_attributes, namedattribute("branch_weights", branch_weights)) return IR.create_operation( "spirv.BranchConditional", @@ -3093,12 +3093,12 @@ function CopyMemory( _successors = Block[] _attributes = NamedAttribute[] !isnothing(memory_access) && - push!(attributes, namedattribute("memory_access", memory_access)) - !isnothing(alignment) && push!(attributes, namedattribute("alignment", alignment)) + push!(_attributes, namedattribute("memory_access", memory_access)) + !isnothing(alignment) && push!(_attributes, namedattribute("alignment", alignment)) !isnothing(source_memory_access) && - push!(attributes, namedattribute("source_memory_access", source_memory_access)) + push!(_attributes, namedattribute("source_memory_access", source_memory_access)) !isnothing(source_alignment) && - push!(attributes, namedattribute("source_alignment", source_alignment)) + push!(_attributes, namedattribute("source_alignment", source_alignment)) return IR.create_operation( "spirv.CopyMemory", @@ -4297,8 +4297,8 @@ function func(; namedattribute("sym_name", sym_name), namedattribute("function_control", function_control), ] - !isnothing(arg_attrs) && push!(attributes, namedattribute("arg_attrs", arg_attrs)) - !isnothing(res_attrs) && push!(attributes, namedattribute("res_attrs", res_attrs)) + !isnothing(arg_attrs) && push!(_attributes, namedattribute("arg_attrs", arg_attrs)) + !isnothing(res_attrs) && push!(_attributes, namedattribute("res_attrs", res_attrs)) return IR.create_operation( "spirv.func", @@ -6225,12 +6225,13 @@ function GlobalVariable(; _attributes = NamedAttribute[ namedattribute("type", type), namedattribute("sym_name", sym_name) ] - !isnothing(initializer) && push!(attributes, namedattribute("initializer", initializer)) - !isnothing(location) && push!(attributes, namedattribute("location", location_)) - !isnothing(binding) && push!(attributes, namedattribute("binding", binding)) + !isnothing(initializer) && + push!(_attributes, namedattribute("initializer", initializer)) + !isnothing(location) && push!(_attributes, namedattribute("location", location_)) + !isnothing(binding) && push!(_attributes, namedattribute("binding", binding)) !isnothing(descriptor_set) && - push!(attributes, namedattribute("descriptor_set", descriptor_set)) - !isnothing(builtin) && push!(attributes, namedattribute("builtin", builtin)) + push!(_attributes, namedattribute("descriptor_set", descriptor_set)) + !isnothing(builtin) && push!(_attributes, namedattribute("builtin", builtin)) return IR.create_operation( "spirv.GlobalVariable", @@ -6901,7 +6902,7 @@ function GroupNonUniformFAdd( namedattribute("execution_scope", execution_scope), namedattribute("group_operation", group_operation), ] - !isnothing(cluster_size) && push!(operands, cluster_size) + !isnothing(cluster_size) && push!(_operands, cluster_size) return IR.create_operation( "spirv.GroupNonUniformFAdd", @@ -6976,7 +6977,7 @@ function GroupNonUniformFMax( namedattribute("execution_scope", execution_scope), namedattribute("group_operation", group_operation), ] - !isnothing(cluster_size) && push!(operands, cluster_size) + !isnothing(cluster_size) && push!(_operands, cluster_size) return IR.create_operation( "spirv.GroupNonUniformFMax", @@ -7051,7 +7052,7 @@ function GroupNonUniformFMin( namedattribute("execution_scope", execution_scope), namedattribute("group_operation", group_operation), ] - !isnothing(cluster_size) && push!(operands, cluster_size) + !isnothing(cluster_size) && push!(_operands, cluster_size) return IR.create_operation( "spirv.GroupNonUniformFMin", @@ -7123,7 +7124,7 @@ function GroupNonUniformFMul( namedattribute("execution_scope", execution_scope), namedattribute("group_operation", group_operation), ] - !isnothing(cluster_size) && push!(operands, cluster_size) + !isnothing(cluster_size) && push!(_operands, cluster_size) return IR.create_operation( "spirv.GroupNonUniformFMul", @@ -7193,7 +7194,7 @@ function GroupNonUniformIAdd( namedattribute("execution_scope", execution_scope), namedattribute("group_operation", group_operation), ] - !isnothing(cluster_size) && push!(operands, cluster_size) + !isnothing(cluster_size) && push!(_operands, cluster_size) return IR.create_operation( "spirv.GroupNonUniformIAdd", @@ -7263,7 +7264,7 @@ function GroupNonUniformIMul( namedattribute("execution_scope", execution_scope), namedattribute("group_operation", group_operation), ] - !isnothing(cluster_size) && push!(operands, cluster_size) + !isnothing(cluster_size) && push!(_operands, cluster_size) return IR.create_operation( "spirv.GroupNonUniformIMul", @@ -7333,7 +7334,7 @@ function GroupNonUniformSMax( namedattribute("execution_scope", execution_scope), namedattribute("group_operation", group_operation), ] - !isnothing(cluster_size) && push!(operands, cluster_size) + !isnothing(cluster_size) && push!(_operands, cluster_size) return IR.create_operation( "spirv.GroupNonUniformSMax", @@ -7403,7 +7404,7 @@ function GroupNonUniformSMin( namedattribute("execution_scope", execution_scope), namedattribute("group_operation", group_operation), ] - !isnothing(cluster_size) && push!(operands, cluster_size) + !isnothing(cluster_size) && push!(_operands, cluster_size) return IR.create_operation( "spirv.GroupNonUniformSMin", @@ -7674,7 +7675,7 @@ function GroupNonUniformUMax( namedattribute("execution_scope", execution_scope), namedattribute("group_operation", group_operation), ] - !isnothing(cluster_size) && push!(operands, cluster_size) + !isnothing(cluster_size) && push!(_operands, cluster_size) return IR.create_operation( "spirv.GroupNonUniformUMax", @@ -7745,7 +7746,7 @@ function GroupNonUniformUMin( namedattribute("execution_scope", execution_scope), namedattribute("group_operation", group_operation), ] - !isnothing(cluster_size) && push!(operands, cluster_size) + !isnothing(cluster_size) && push!(_operands, cluster_size) return IR.create_operation( "spirv.GroupNonUniformUMin", @@ -8259,8 +8260,8 @@ function INTEL_JointMatrixLoad( namedattribute("layout", layout), namedattribute("scope", scope) ] !isnothing(memory_access) && - push!(attributes, namedattribute("memory_access", memory_access)) - !isnothing(alignment) && push!(attributes, namedattribute("alignment", alignment)) + push!(_attributes, namedattribute("memory_access", memory_access)) + !isnothing(alignment) && push!(_attributes, namedattribute("alignment", alignment)) return IR.create_operation( "spirv.INTEL.JointMatrixLoad", @@ -8387,8 +8388,8 @@ function INTEL_JointMatrixStore( namedattribute("layout", layout), namedattribute("scope", scope) ] !isnothing(memory_access) && - push!(attributes, namedattribute("memory_access", memory_access)) - !isnothing(alignment) && push!(attributes, namedattribute("alignment", alignment)) + push!(_attributes, namedattribute("memory_access", memory_access)) + !isnothing(alignment) && push!(_attributes, namedattribute("alignment", alignment)) return IR.create_operation( "spirv.INTEL.JointMatrixStore", @@ -8746,7 +8747,7 @@ function ImageDrefGather( _successors = Block[] _attributes = NamedAttribute[] !isnothing(imageoperands) && - push!(attributes, namedattribute("imageoperands", imageoperands)) + push!(_attributes, namedattribute("imageoperands", imageoperands)) return IR.create_operation( "spirv.ImageDrefGather", @@ -9116,8 +9117,8 @@ function Load( _successors = Block[] _attributes = NamedAttribute[] !isnothing(memory_access) && - push!(attributes, namedattribute("memory_access", memory_access)) - !isnothing(alignment) && push!(attributes, namedattribute("alignment", alignment)) + push!(_attributes, namedattribute("memory_access", memory_access)) + !isnothing(alignment) && push!(_attributes, namedattribute("alignment", alignment)) return IR.create_operation( "spirv.Load", @@ -9643,8 +9644,8 @@ function module_(; namedattribute("addressing_model", addressing_model), namedattribute("memory_model", memory_model), ] - !isnothing(vce_triple) && push!(attributes, namedattribute("vce_triple", vce_triple)) - !isnothing(sym_name) && push!(attributes, namedattribute("sym_name", sym_name)) + !isnothing(vce_triple) && push!(_attributes, namedattribute("vce_triple", vce_triple)) + !isnothing(sym_name) && push!(_attributes, namedattribute("sym_name", sym_name)) return IR.create_operation( "spirv.module", @@ -9770,7 +9771,7 @@ function NV_CooperativeMatrixLoad( _successors = Block[] _attributes = NamedAttribute[] !isnothing(memory_access) && - push!(attributes, namedattribute("memory_access", memory_access)) + push!(_attributes, namedattribute("memory_access", memory_access)) return IR.create_operation( "spirv.NV.CooperativeMatrixLoad", @@ -9910,7 +9911,7 @@ function NV_CooperativeMatrixStore( _successors = Block[] _attributes = NamedAttribute[] !isnothing(memory_access) && - push!(attributes, namedattribute("memory_access", memory_access)) + push!(_attributes, namedattribute("memory_access", memory_access)) return IR.create_operation( "spirv.NV.CooperativeMatrixStore", @@ -10387,7 +10388,7 @@ function SDotAccSat( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(format) && push!(attributes, namedattribute("format", format)) + !isnothing(format) && push!(_attributes, namedattribute("format", format)) return IR.create_operation( "spirv.SDotAccSat", @@ -10443,7 +10444,7 @@ function SDot( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(format) && push!(attributes, namedattribute("format", format)) + !isnothing(format) && push!(_attributes, namedattribute("format", format)) return IR.create_operation( "spirv.SDot", @@ -10893,7 +10894,7 @@ function SUDotAccSat( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(format) && push!(attributes, namedattribute("format", format)) + !isnothing(format) && push!(_attributes, namedattribute("format", format)) return IR.create_operation( "spirv.SUDotAccSat", @@ -10951,7 +10952,7 @@ function SUDot( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(format) && push!(attributes, namedattribute("format", format)) + !isnothing(format) && push!(_attributes, namedattribute("format", format)) return IR.create_operation( "spirv.SUDot", @@ -11485,8 +11486,8 @@ function Store( _successors = Block[] _attributes = NamedAttribute[] !isnothing(memory_access) && - push!(attributes, namedattribute("memory_access", memory_access)) - !isnothing(alignment) && push!(attributes, namedattribute("alignment", alignment)) + push!(_attributes, namedattribute("memory_access", memory_access)) + !isnothing(alignment) && push!(_attributes, namedattribute("alignment", alignment)) return IR.create_operation( "spirv.Store", @@ -11698,7 +11699,7 @@ function UDotAccSat( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(format) && push!(attributes, namedattribute("format", format)) + !isnothing(format) && push!(_attributes, namedattribute("format", format)) return IR.create_operation( "spirv.UDotAccSat", @@ -11756,7 +11757,7 @@ function UDot( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(format) && push!(attributes, namedattribute("format", format)) + !isnothing(format) && push!(_attributes, namedattribute("format", format)) return IR.create_operation( "spirv.UDot", @@ -12217,7 +12218,7 @@ function Variable( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[namedattribute("storage_class", storage_class),] - !isnothing(initializer) && push!(operands, initializer) + !isnothing(initializer) && push!(_operands, initializer) return IR.create_operation( "spirv.Variable", diff --git a/src/Dialects/16/Shape.jl b/src/Dialects/16/Shape.jl index 14e4dff3..01df0109 100644 --- a/src/Dialects/16/Shape.jl +++ b/src/Dialects/16/Shape.jl @@ -91,15 +91,12 @@ ready to execute. %wt = shape.assuming_all %w0, %w2 // Passing ``` """ -function assuming_all( - inputs::Vector{Value}; result=nothing::Union{Nothing,IR.Type}, location=Location() -) - _results = IR.Type[] +function assuming_all(inputs::Vector{Value}; result::IR.Type, location=Location()) + _results = IR.Type[result,] _operands = Value[inputs...,] _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(result) && push!(_results, result) return IR.create_operation( "shape.assuming_all", @@ -108,8 +105,8 @@ function assuming_all( owned_regions=_owned_regions, successors=_successors, attributes=_attributes, - results=(length(_results) == 0 ? nothing : _results), - result_inference=(length(_results) == 0 ? true : false), + results=_results, + result_inference=false, ) end @@ -202,7 +199,7 @@ function broadcast( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(error) && push!(attributes, namedattribute("error", error)) + !isnothing(error) && push!(_attributes, namedattribute("error", error)) return IR.create_operation( "shape.broadcast", @@ -360,15 +357,12 @@ shape.broadcast documents. %w1 = shape.cstr_broadcastable [2,2], [3,2] // Failure ``` """ -function cstr_broadcastable( - shapes::Vector{Value}; result=nothing::Union{Nothing,IR.Type}, location=Location() -) - _results = IR.Type[] +function cstr_broadcastable(shapes::Vector{Value}; result::IR.Type, location=Location()) + _results = IR.Type[result,] _operands = Value[shapes...,] _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(result) && push!(_results, result) return IR.create_operation( "shape.cstr_broadcastable", @@ -377,8 +371,8 @@ function cstr_broadcastable( owned_regions=_owned_regions, successors=_successors, attributes=_attributes, - results=(length(_results) == 0 ? nothing : _results), - result_inference=(length(_results) == 0 ? true : false), + results=_results, + result_inference=false, ) end @@ -395,15 +389,12 @@ Given 1 or more input shapes, determine if all shapes are the exact same. %w1 = shape.cstr_eq [2,2], [1,2] // Failure ``` """ -function cstr_eq( - shapes::Vector{Value}; result=nothing::Union{Nothing,IR.Type}, location=Location() -) - _results = IR.Type[] +function cstr_eq(shapes::Vector{Value}; result::IR.Type, location=Location()) + _results = IR.Type[result,] _operands = Value[shapes...,] _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(result) && push!(_results, result) return IR.create_operation( "shape.cstr_eq", @@ -412,8 +403,8 @@ function cstr_eq( owned_regions=_owned_regions, successors=_successors, attributes=_attributes, - results=(length(_results) == 0 ? nothing : _results), - result_inference=(length(_results) == 0 ? true : false), + results=_results, + result_inference=false, ) end @@ -597,15 +588,12 @@ the shape. %s1 = shape.from_extents ``` """ -function from_extents( - extents::Vector{Value}; shape=nothing::Union{Nothing,IR.Type}, location=Location() -) - _results = IR.Type[] +function from_extents(extents::Vector{Value}; shape::IR.Type, location=Location()) + _results = IR.Type[shape,] _operands = Value[extents...,] _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(shape) && push!(_results, shape) return IR.create_operation( "shape.from_extents", @@ -614,8 +602,8 @@ function from_extents( owned_regions=_owned_regions, successors=_successors, attributes=_attributes, - results=(length(_results) == 0 ? nothing : _results), - result_inference=(length(_results) == 0 ? true : false), + results=_results, + result_inference=false, ) end @@ -642,10 +630,10 @@ function func(; _attributes = NamedAttribute[ namedattribute("sym_name", sym_name), 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(arg_attrs) && push!(_attributes, namedattribute("arg_attrs", arg_attrs)) + !isnothing(res_attrs) && push!(_attributes, namedattribute("res_attrs", res_attrs)) !isnothing(sym_visibility) && - push!(attributes, namedattribute("sym_visibility", sym_visibility)) + push!(_attributes, namedattribute("sym_visibility", sym_visibility)) return IR.create_operation( "shape.func", @@ -689,7 +677,7 @@ function function_library(; namedattribute("sym_name", sym_name), namedattribute("mapping", mapping) ] !isnothing(sym_visibility) && - push!(attributes, namedattribute("sym_visibility", sym_visibility)) + push!(_attributes, namedattribute("sym_visibility", sym_visibility)) return IR.create_operation( "shape.function_library", @@ -780,15 +768,12 @@ assertion failure. %false = shape.is_broadcastable [2,2], [3,2] ``` """ -function is_broadcastable( - shapes::Vector{Value}; result=nothing::Union{Nothing,IR.Type}, location=Location() -) - _results = IR.Type[] +function is_broadcastable(shapes::Vector{Value}; result::IR.Type, location=Location()) + _results = IR.Type[result,] _operands = Value[shapes...,] _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(result) && push!(_results, result) return IR.create_operation( "shape.is_broadcastable", @@ -797,8 +782,8 @@ function is_broadcastable( owned_regions=_owned_regions, successors=_successors, attributes=_attributes, - results=(length(_results) == 0 ? nothing : _results), - result_inference=(length(_results) == 0 ? true : false), + results=_results, + result_inference=false, ) end @@ -872,7 +857,7 @@ function meet( _successors = Block[] _attributes = NamedAttribute[] !isnothing(result) && push!(_results, result) - !isnothing(error) && push!(attributes, namedattribute("error", error)) + !isnothing(error) && push!(_attributes, namedattribute("error", error)) return IR.create_operation( "shape.meet", @@ -1098,15 +1083,12 @@ regarded as their equivalent non-error shapes. Error shapes can be tested for equality like any other shape value, meaning that the error value is equal to itself. """ -function shape_eq( - shapes::Vector{Value}; result=nothing::Union{Nothing,IR.Type}, location=Location() -) - _results = IR.Type[] +function shape_eq(shapes::Vector{Value}; result::IR.Type, location=Location()) + _results = IR.Type[result,] _operands = Value[shapes...,] _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(result) && push!(_results, result) return IR.create_operation( "shape.shape_eq", @@ -1115,8 +1097,8 @@ function shape_eq( owned_regions=_owned_regions, successors=_successors, attributes=_attributes, - results=(length(_results) == 0 ? nothing : _results), - result_inference=(length(_results) == 0 ? true : false), + results=_results, + result_inference=false, ) end diff --git a/src/Dialects/16/SparseTensor.jl b/src/Dialects/16/SparseTensor.jl index 5fd50467..49d2ebf4 100644 --- a/src/Dialects/16/SparseTensor.jl +++ b/src/Dialects/16/SparseTensor.jl @@ -122,9 +122,9 @@ function binary( _successors = Block[] _attributes = NamedAttribute[] !isnothing(left_identity) && - push!(attributes, namedattribute("left_identity", left_identity)) + push!(_attributes, namedattribute("left_identity", left_identity)) !isnothing(right_identity) && - push!(attributes, namedattribute("right_identity", right_identity)) + push!(_attributes, namedattribute("right_identity", right_identity)) return IR.create_operation( "sparse_tensor.binary", @@ -168,15 +168,14 @@ function compress( count::Value, tensor::Value, indices::Vector{Value}; - result=nothing::Union{Nothing,IR.Type}, + result::IR.Type, location=Location(), ) - _results = IR.Type[] + _results = IR.Type[result,] _operands = Value[values, filled, added, count, tensor, indices...] _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(result) && push!(_results, result) return IR.create_operation( "sparse_tensor.compress", @@ -185,8 +184,8 @@ function compress( owned_regions=_owned_regions, successors=_successors, attributes=_attributes, - results=(length(_results) == 0 ? nothing : _results), - result_inference=(length(_results) == 0 ? true : false), + results=_results, + result_inference=false, ) end @@ -451,7 +450,7 @@ function storage_specifier_get( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[namedattribute("specifierKind", specifierKind),] - !isnothing(dim) && push!(attributes, namedattribute("dim", dim)) + !isnothing(dim) && push!(_attributes, namedattribute("dim", dim)) return IR.create_operation( "sparse_tensor.storage_specifier.get", @@ -499,15 +498,14 @@ function insert( value::Value, tensor::Value, indices::Vector{Value}; - result=nothing::Union{Nothing,IR.Type}, + result::IR.Type, location=Location(), ) - _results = IR.Type[] + _results = IR.Type[result,] _operands = Value[value, tensor, indices...] _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(result) && push!(_results, result) return IR.create_operation( "sparse_tensor.insert", @@ -516,8 +514,8 @@ function insert( owned_regions=_owned_regions, successors=_successors, attributes=_attributes, - results=(length(_results) == 0 ? nothing : _results), - result_inference=(length(_results) == 0 ? true : false), + results=_results, + result_inference=false, ) end @@ -561,7 +559,7 @@ function load( _successors = Block[] _attributes = NamedAttribute[] !isnothing(result) && push!(_results, result) - !isnothing(hasInserts) && push!(attributes, namedattribute("hasInserts", hasInserts)) + !isnothing(hasInserts) && push!(_attributes, namedattribute("hasInserts", hasInserts)) return IR.create_operation( "sparse_tensor.load", @@ -607,7 +605,7 @@ function new(source::Value; result::IR.Type, expandSymmetry=nothing, location=Lo _successors = Block[] _attributes = NamedAttribute[] !isnothing(expandSymmetry) && - push!(attributes, namedattribute("expandSymmetry", expandSymmetry)) + push!(_attributes, namedattribute("expandSymmetry", expandSymmetry)) return IR.create_operation( "sparse_tensor.new", @@ -754,10 +752,10 @@ function push_back( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(n) && push!(operands, n) + !isnothing(n) && push!(_operands, n) !isnothing(outBuffer) && push!(_results, outBuffer) !isnothing(newSize) && push!(_results, newSize) - !isnothing(inbounds) && push!(attributes, namedattribute("inbounds", inbounds)) + !isnothing(inbounds) && push!(_attributes, namedattribute("inbounds", inbounds)) return IR.create_operation( "sparse_tensor.push_back", @@ -936,7 +934,7 @@ function storage_specifier_set( _successors = Block[] _attributes = NamedAttribute[namedattribute("specifierKind", specifierKind),] !isnothing(result) && push!(_results, result) - !isnothing(dim) && push!(attributes, namedattribute("dim", dim)) + !isnothing(dim) && push!(_attributes, namedattribute("dim", dim)) return IR.create_operation( "sparse_tensor.storage_specifier.set", @@ -991,9 +989,9 @@ function sort_coo( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(nx) && push!(attributes, namedattribute("nx", nx)) - !isnothing(ny) && push!(attributes, namedattribute("ny", ny)) - !isnothing(stable) && push!(attributes, namedattribute("stable", stable)) + !isnothing(nx) && push!(_attributes, namedattribute("nx", nx)) + !isnothing(ny) && push!(_attributes, namedattribute("ny", ny)) + !isnothing(stable) && push!(_attributes, namedattribute("stable", stable)) return IR.create_operation( "sparse_tensor.sort_coo", @@ -1054,8 +1052,8 @@ function sort( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([1, length(xs), length(ys)])) - !isnothing(stable) && push!(attributes, namedattribute("stable", stable)) + push!(_attributes, operandsegmentsizes([1, length(xs), length(ys)])) + !isnothing(stable) && push!(_attributes, namedattribute("stable", stable)) return IR.create_operation( "sparse_tensor.sort", @@ -1365,7 +1363,7 @@ function yield(result=nothing::Union{Nothing,Value}; location=Location()) _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(result) && push!(operands, result) + !isnothing(result) && push!(_operands, result) return IR.create_operation( "sparse_tensor.yield", diff --git a/src/Dialects/16/Tensor.jl b/src/Dialects/16/Tensor.jl index 4241bb43..25660d20 100644 --- a/src/Dialects/16/Tensor.jl +++ b/src/Dialects/16/Tensor.jl @@ -334,7 +334,7 @@ function extract_slice( namedattribute("static_strides", static_strides), ] push!( - attributes, + _attributes, operandsegmentsizes([1, length(offsets), length(sizes), length(strides)]), ) @@ -497,7 +497,7 @@ function gather( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[namedattribute("gather_dims", gather_dims),] - !isnothing(unique) && push!(attributes, namedattribute("unique", unique)) + !isnothing(unique) && push!(_attributes, namedattribute("unique", unique)) return IR.create_operation( "tensor.gather", @@ -671,7 +671,7 @@ function insert_slice( namedattribute("static_strides", static_strides), ] push!( - attributes, + _attributes, operandsegmentsizes([1, 1, length(offsets), length(sizes), length(strides)]), ) @@ -745,13 +745,13 @@ function pack( namedattribute("inner_dims_pos", inner_dims_pos), namedattribute("static_inner_tiles", static_inner_tiles), ] - !isnothing(padding_value) && push!(operands, padding_value) + !isnothing(padding_value) && push!(_operands, padding_value) push!( - attributes, + _attributes, operandsegmentsizes([1, 1, isnothing(padding_value) ? 0 : 1, length(inner_tiles)]), ) !isnothing(outer_dims_perm) && - push!(attributes, namedattribute("outer_dims_perm", outer_dims_perm)) + push!(_attributes, namedattribute("outer_dims_perm", outer_dims_perm)) return IR.create_operation( "tensor.pack", @@ -855,8 +855,8 @@ function pad( _attributes = NamedAttribute[ namedattribute("static_low", static_low), namedattribute("static_high", static_high) ] - push!(attributes, operandsegmentsizes([1, length(low), length(high)])) - !isnothing(nofold) && push!(attributes, namedattribute("nofold", nofold)) + push!(_attributes, operandsegmentsizes([1, length(low), length(high)])) + !isnothing(nofold) && push!(_attributes, namedattribute("nofold", nofold)) return IR.create_operation( "tensor.pad", @@ -952,7 +952,7 @@ function parallel_insert_slice( namedattribute("static_strides", static_strides), ] push!( - attributes, + _attributes, operandsegmentsizes([1, 1, length(offsets), length(sizes), length(strides)]), ) @@ -1167,7 +1167,7 @@ function scatter( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[namedattribute("scatter_dims", scatter_dims),] - !isnothing(unique) && push!(attributes, namedattribute("unique", unique)) + !isnothing(unique) && push!(_attributes, namedattribute("unique", unique)) return IR.create_operation( "tensor.scatter", @@ -1268,7 +1268,7 @@ function unpack( namedattribute("static_inner_tiles", static_inner_tiles), ] !isnothing(outer_dims_perm) && - push!(attributes, namedattribute("outer_dims_perm", outer_dims_perm)) + push!(_attributes, namedattribute("outer_dims_perm", outer_dims_perm)) return IR.create_operation( "tensor.unpack", diff --git a/src/Dialects/16/Tosa.jl b/src/Dialects/16/Tosa.jl index 8b7549fa..e5d20427 100644 --- a/src/Dialects/16/Tosa.jl +++ b/src/Dialects/16/Tosa.jl @@ -167,7 +167,7 @@ function avg_pool2d( namedattribute("pad", pad), ] !isnothing(quantization_info) && - push!(attributes, namedattribute("quantization_info", quantization_info)) + push!(_attributes, namedattribute("quantization_info", quantization_info)) return IR.create_operation( "tosa.avg_pool2d", @@ -483,7 +483,7 @@ function conv2d( namedattribute("dilation", dilation), ] !isnothing(quantization_info) && - push!(attributes, namedattribute("quantization_info", quantization_info)) + push!(_attributes, namedattribute("quantization_info", quantization_info)) return IR.create_operation( "tosa.conv2d", @@ -523,7 +523,7 @@ function conv3d( namedattribute("dilation", dilation), ] !isnothing(quantization_info) && - push!(attributes, namedattribute("quantization_info", quantization_info)) + push!(_attributes, namedattribute("quantization_info", quantization_info)) return IR.create_operation( "tosa.conv3d", @@ -616,7 +616,7 @@ function depthwise_conv2d( namedattribute("dilation", dilation), ] !isnothing(quantization_info) && - push!(attributes, namedattribute("quantization_info", quantization_info)) + push!(_attributes, namedattribute("quantization_info", quantization_info)) return IR.create_operation( "tosa.depthwise_conv2d", @@ -752,7 +752,7 @@ function fully_connected( _successors = Block[] _attributes = NamedAttribute[] !isnothing(quantization_info) && - push!(attributes, namedattribute("quantization_info", quantization_info)) + push!(_attributes, namedattribute("quantization_info", quantization_info)) return IR.create_operation( "tosa.fully_connected", @@ -1092,7 +1092,7 @@ function matmul( _successors = Block[] _attributes = NamedAttribute[] !isnothing(quantization_info) && - push!(attributes, namedattribute("quantization_info", quantization_info)) + push!(_attributes, namedattribute("quantization_info", quantization_info)) return IR.create_operation( "tosa.matmul", @@ -1226,7 +1226,7 @@ function negate( _successors = Block[] _attributes = NamedAttribute[] !isnothing(quantization_info) && - push!(attributes, namedattribute("quantization_info", quantization_info)) + push!(_attributes, namedattribute("quantization_info", quantization_info)) return IR.create_operation( "tosa.negate", @@ -1258,9 +1258,9 @@ function pad( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(pad_const) && push!(operands, pad_const) + !isnothing(pad_const) && push!(_operands, pad_const) !isnothing(quantization_info) && - push!(attributes, namedattribute("quantization_info", quantization_info)) + push!(_attributes, namedattribute("quantization_info", quantization_info)) return IR.create_operation( "tosa.pad", @@ -1919,7 +1919,7 @@ function transpose_conv2d( namedattribute("out_shape", out_shape), ] !isnothing(quantization_info) && - push!(attributes, namedattribute("quantization_info", quantization_info)) + push!(_attributes, namedattribute("quantization_info", quantization_info)) return IR.create_operation( "tosa.transpose_conv2d", diff --git a/src/Dialects/16/Transform.jl b/src/Dialects/16/Transform.jl index be7d0768..0e46184e 100644 --- a/src/Dialects/16/Transform.jl +++ b/src/Dialects/16/Transform.jl @@ -136,27 +136,27 @@ function bufferization_one_shot_bufferize( _successors = Block[] _attributes = NamedAttribute[] !isnothing(function_boundary_type_conversion) && push!( - attributes, + _attributes, namedattribute( "function_boundary_type_conversion", function_boundary_type_conversion ), ) !isnothing(allow_return_allocs) && - push!(attributes, namedattribute("allow_return_allocs", allow_return_allocs)) + push!(_attributes, namedattribute("allow_return_allocs", allow_return_allocs)) !isnothing(allow_unknown_ops) && - push!(attributes, namedattribute("allow_unknown_ops", allow_unknown_ops)) + push!(_attributes, namedattribute("allow_unknown_ops", allow_unknown_ops)) !isnothing(bufferize_function_boundaries) && push!( - attributes, + _attributes, namedattribute("bufferize_function_boundaries", bufferize_function_boundaries), ) !isnothing(create_deallocs) && - push!(attributes, namedattribute("create_deallocs", create_deallocs)) + push!(_attributes, namedattribute("create_deallocs", create_deallocs)) !isnothing(target_is_module) && - push!(attributes, namedattribute("target_is_module", target_is_module)) + push!(_attributes, namedattribute("target_is_module", target_is_module)) !isnothing(test_analysis_only) && - push!(attributes, namedattribute("test_analysis_only", test_analysis_only)) + push!(_attributes, namedattribute("test_analysis_only", test_analysis_only)) !isnothing(print_conflicts) && - push!(attributes, namedattribute("print_conflicts", print_conflicts)) + push!(_attributes, namedattribute("print_conflicts", print_conflicts)) return IR.create_operation( "transform.bufferization.one_shot_bufferize", @@ -224,9 +224,9 @@ function gpu_map_foreach_to_blocks( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(gridDim) && push!(attributes, namedattribute("gridDim", gridDim)) + !isnothing(gridDim) && push!(_attributes, namedattribute("gridDim", gridDim)) !isnothing(generate_gpu_launch) && - push!(attributes, namedattribute("generate_gpu_launch", generate_gpu_launch)) + push!(_attributes, namedattribute("generate_gpu_launch", generate_gpu_launch)) return IR.create_operation( "transform.gpu.map_foreach_to_blocks", @@ -331,9 +331,9 @@ function gpu_map_nested_foreach_to_threads( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(blockDim) && push!(attributes, namedattribute("blockDim", blockDim)) + !isnothing(blockDim) && push!(_attributes, namedattribute("blockDim", blockDim)) !isnothing(syncAfterDistribute) && - push!(attributes, namedattribute("syncAfterDistribute", syncAfterDistribute)) + push!(_attributes, namedattribute("syncAfterDistribute", syncAfterDistribute)) return IR.create_operation( "transform.gpu.map_nested_foreach_to_threads", @@ -459,9 +459,9 @@ function structured_fuse( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(tile_sizes) && push!(attributes, namedattribute("tile_sizes", tile_sizes)) + !isnothing(tile_sizes) && push!(_attributes, namedattribute("tile_sizes", tile_sizes)) !isnothing(tile_interchange) && - push!(attributes, namedattribute("tile_interchange", tile_interchange)) + push!(_attributes, namedattribute("tile_interchange", tile_interchange)) return IR.create_operation( "transform.structured.fuse", @@ -534,7 +534,7 @@ function structured_interchange( _successors = Block[] _attributes = NamedAttribute[] !isnothing(iterator_interchange) && - push!(attributes, namedattribute("iterator_interchange", iterator_interchange)) + push!(_attributes, namedattribute("iterator_interchange", iterator_interchange)) return IR.create_operation( "transform.structured.interchange", @@ -577,7 +577,7 @@ function structured_masked_vectorize( _successors = Block[] _attributes = NamedAttribute[] !isnothing(static_vector_sizes) && - push!(attributes, namedattribute("static_vector_sizes", static_vector_sizes)) + push!(_attributes, namedattribute("static_vector_sizes", static_vector_sizes)) return IR.create_operation( "transform.structured.masked_vectorize", @@ -635,11 +635,11 @@ function structured_match( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(ops) && push!(attributes, namedattribute("ops", ops)) - !isnothing(interface) && push!(attributes, namedattribute("interface", interface)) - !isnothing(op_attrs) && push!(attributes, namedattribute("op_attrs", op_attrs)) + !isnothing(ops) && push!(_attributes, namedattribute("ops", ops)) + !isnothing(interface) && push!(_attributes, namedattribute("interface", interface)) + !isnothing(op_attrs) && push!(_attributes, namedattribute("op_attrs", op_attrs)) !isnothing(filter_result_type) && - push!(attributes, namedattribute("filter_result_type", filter_result_type)) + push!(_attributes, namedattribute("filter_result_type", filter_result_type)) return IR.create_operation( "transform.structured.match", @@ -726,7 +726,7 @@ function structured_multitile_sizes( _attributes = NamedAttribute[ namedattribute("dimension", dimension), namedattribute("target_size", target_size) ] - !isnothing(divisor) && push!(attributes, namedattribute("divisor", divisor)) + !isnothing(divisor) && push!(_attributes, namedattribute("divisor", divisor)) return IR.create_operation( "transform.structured.multitile_sizes", @@ -814,7 +814,7 @@ function structured_pack( _successors = Block[] _attributes = NamedAttribute[] !isnothing(static_packed_sizes) && - push!(attributes, namedattribute("static_packed_sizes", static_packed_sizes)) + push!(_attributes, namedattribute("static_packed_sizes", static_packed_sizes)) return IR.create_operation( "transform.structured.pack", @@ -881,8 +881,8 @@ function structured_pack_transpose( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(outer_perm) && push!(attributes, namedattribute("outer_perm", outer_perm)) - !isnothing(inner_perm) && push!(attributes, namedattribute("inner_perm", inner_perm)) + !isnothing(outer_perm) && push!(_attributes, namedattribute("outer_perm", outer_perm)) + !isnothing(inner_perm) && push!(_attributes, namedattribute("inner_perm", inner_perm)) return IR.create_operation( "transform.structured.pack_transpose", @@ -928,15 +928,15 @@ function structured_pad( _successors = Block[] _attributes = NamedAttribute[] !isnothing(padding_values) && - push!(attributes, namedattribute("padding_values", padding_values)) + push!(_attributes, namedattribute("padding_values", padding_values)) !isnothing(padding_dimensions) && - push!(attributes, namedattribute("padding_dimensions", padding_dimensions)) + push!(_attributes, namedattribute("padding_dimensions", padding_dimensions)) !isnothing(pack_paddings) && - push!(attributes, namedattribute("pack_paddings", pack_paddings)) + push!(_attributes, namedattribute("pack_paddings", pack_paddings)) !isnothing(hoist_paddings) && - push!(attributes, namedattribute("hoist_paddings", hoist_paddings)) + push!(_attributes, namedattribute("hoist_paddings", hoist_paddings)) !isnothing(transpose_paddings) && - push!(attributes, namedattribute("transpose_paddings", transpose_paddings)) + push!(_attributes, namedattribute("transpose_paddings", transpose_paddings)) return IR.create_operation( "transform.structured.pad", @@ -985,15 +985,15 @@ function structured_promote( _successors = Block[] _attributes = NamedAttribute[] !isnothing(operands_to_promote) && - push!(attributes, namedattribute("operands_to_promote", operands_to_promote)) + push!(_attributes, namedattribute("operands_to_promote", operands_to_promote)) !isnothing(use_full_tile_buffers) && - push!(attributes, namedattribute("use_full_tile_buffers", use_full_tile_buffers)) + push!(_attributes, namedattribute("use_full_tile_buffers", use_full_tile_buffers)) !isnothing(use_full_tiles_by_default) && push!( - attributes, + _attributes, namedattribute("use_full_tiles_by_default", use_full_tiles_by_default), ) - !isnothing(use_alloca) && push!(attributes, namedattribute("use_alloca", use_alloca)) - !isnothing(alignment) && push!(attributes, namedattribute("alignment", alignment)) + !isnothing(use_alloca) && push!(_attributes, namedattribute("use_alloca", use_alloca)) + !isnothing(alignment) && push!(_attributes, namedattribute("alignment", alignment)) return IR.create_operation( "transform.structured.promote", @@ -1122,7 +1122,7 @@ function structured_split( namedattribute("dimension", dimension), namedattribute("static_split_point", static_split_point), ] - !isnothing(dynamic_split_point) && push!(operands, dynamic_split_point) + !isnothing(dynamic_split_point) && push!(_operands, dynamic_split_point) return IR.create_operation( "transform.structured.split", @@ -1291,14 +1291,14 @@ function structured_split_reduction( _successors = Block[] _attributes = NamedAttribute[] !isnothing(split_factor) && - push!(attributes, namedattribute("split_factor", split_factor)) + push!(_attributes, namedattribute("split_factor", split_factor)) !isnothing(insert_split_dimension) && - push!(attributes, namedattribute("insert_split_dimension", insert_split_dimension)) + push!(_attributes, namedattribute("insert_split_dimension", insert_split_dimension)) !isnothing(inner_parallel) && - push!(attributes, namedattribute("inner_parallel", inner_parallel)) + push!(_attributes, namedattribute("inner_parallel", inner_parallel)) !isnothing(use_scaling_algorithm) && - push!(attributes, namedattribute("use_scaling_algorithm", use_scaling_algorithm)) - !isnothing(use_alloc) && push!(attributes, namedattribute("use_alloc", use_alloc)) + push!(_attributes, namedattribute("use_scaling_algorithm", use_scaling_algorithm)) + !isnothing(use_alloc) && push!(_attributes, namedattribute("use_alloc", use_alloc)) return IR.create_operation( "transform.structured.split_reduction", @@ -1366,8 +1366,9 @@ function structured_tile( _successors = Block[] _attributes = NamedAttribute[] !isnothing(static_sizes) && - push!(attributes, namedattribute("static_sizes", static_sizes)) - !isnothing(interchange) && push!(attributes, namedattribute("interchange", interchange)) + push!(_attributes, namedattribute("static_sizes", static_sizes)) + !isnothing(interchange) && + push!(_attributes, namedattribute("interchange", interchange)) return IR.create_operation( "transform.structured.tile", @@ -1464,9 +1465,10 @@ function structured_tile_reduction_using_foreach_thread( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(num_threads) && push!(attributes, namedattribute("num_threads", num_threads)) - !isnothing(tile_sizes) && push!(attributes, namedattribute("tile_sizes", tile_sizes)) - !isnothing(mapping) && push!(attributes, namedattribute("mapping", mapping)) + !isnothing(num_threads) && + push!(_attributes, namedattribute("num_threads", num_threads)) + !isnothing(tile_sizes) && push!(_attributes, namedattribute("tile_sizes", tile_sizes)) + !isnothing(mapping) && push!(_attributes, namedattribute("mapping", mapping)) return IR.create_operation( "transform.structured.tile_reduction_using_foreach_thread", @@ -1564,7 +1566,7 @@ function structured_tile_reduction_using_scf( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(tile_sizes) && push!(attributes, namedattribute("tile_sizes", tile_sizes)) + !isnothing(tile_sizes) && push!(_attributes, namedattribute("tile_sizes", tile_sizes)) return IR.create_operation( "transform.structured.tile_reduction_using_scf", @@ -1653,10 +1655,10 @@ function structured_tile_to_foreach_thread_op( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(packed_num_threads) && push!(operands, packed_num_threads) - !isnothing(packed_tile_sizes) && push!(operands, packed_tile_sizes) + !isnothing(packed_num_threads) && push!(_operands, packed_num_threads) + !isnothing(packed_tile_sizes) && push!(_operands, packed_tile_sizes) push!( - attributes, + _attributes, operandsegmentsizes([ 1, length(num_threads), @@ -1666,10 +1668,10 @@ function structured_tile_to_foreach_thread_op( ]), ) !isnothing(static_num_threads) && - push!(attributes, namedattribute("static_num_threads", static_num_threads)) + push!(_attributes, namedattribute("static_num_threads", static_num_threads)) !isnothing(static_tile_sizes) && - push!(attributes, namedattribute("static_tile_sizes", static_tile_sizes)) - !isnothing(mapping) && push!(attributes, namedattribute("mapping", mapping)) + push!(_attributes, namedattribute("static_tile_sizes", static_tile_sizes)) + !isnothing(mapping) && push!(_attributes, namedattribute("mapping", mapping)) return IR.create_operation( "transform.structured.tile_to_foreach_thread_op", @@ -1737,8 +1739,9 @@ function structured_tile_to_scf_for( _successors = Block[] _attributes = NamedAttribute[] !isnothing(static_sizes) && - push!(attributes, namedattribute("static_sizes", static_sizes)) - !isnothing(interchange) && push!(attributes, namedattribute("interchange", interchange)) + push!(_attributes, namedattribute("static_sizes", static_sizes)) + !isnothing(interchange) && + push!(_attributes, namedattribute("interchange", interchange)) return IR.create_operation( "transform.structured.tile_to_scf_for", @@ -1804,18 +1807,18 @@ function structured_vectorize( _successors = Block[] _attributes = NamedAttribute[] !isnothing(vectorize_padding) && - push!(attributes, namedattribute("vectorize_padding", vectorize_padding)) + push!(_attributes, namedattribute("vectorize_padding", vectorize_padding)) !isnothing(vectorize_nd_extract) && - push!(attributes, namedattribute("vectorize_nd_extract", vectorize_nd_extract)) + push!(_attributes, namedattribute("vectorize_nd_extract", vectorize_nd_extract)) !isnothing(disable_multi_reduction_to_contract_patterns) && push!( - attributes, + _attributes, namedattribute( "disable_multi_reduction_to_contract_patterns", disable_multi_reduction_to_contract_patterns, ), ) !isnothing(disable_transfer_permutation_map_lowering_patterns) && push!( - attributes, + _attributes, namedattribute( "disable_transfer_permutation_map_lowering_patterns", disable_transfer_permutation_map_lowering_patterns, @@ -1895,8 +1898,8 @@ function loop_get_parent_for( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(num_loops) && push!(attributes, namedattribute("num_loops", num_loops)) - !isnothing(affine) && push!(attributes, namedattribute("affine", affine)) + !isnothing(num_loops) && push!(_attributes, namedattribute("num_loops", num_loops)) + !isnothing(affine) && push!(_attributes, namedattribute("affine", affine)) return IR.create_operation( "transform.loop.get_parent_for", @@ -2009,7 +2012,7 @@ function loop_peel( _successors = Block[] _attributes = NamedAttribute[] !isnothing(fail_if_already_divisible) && push!( - attributes, + _attributes, namedattribute("fail_if_already_divisible", fail_if_already_divisible), ) @@ -2061,9 +2064,9 @@ function loop_pipeline( _successors = Block[] _attributes = NamedAttribute[] !isnothing(iteration_interval) && - push!(attributes, namedattribute("iteration_interval", iteration_interval)) + push!(_attributes, namedattribute("iteration_interval", iteration_interval)) !isnothing(read_latency) && - push!(attributes, namedattribute("read_latency", read_latency)) + push!(_attributes, namedattribute("read_latency", read_latency)) return IR.create_operation( "transform.loop.pipeline", @@ -2189,7 +2192,7 @@ function alternatives( _owned_regions = Region[alternatives...,] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(scope) && push!(operands, scope) + !isnothing(scope) && push!(_operands, scope) return IR.create_operation( "transform.alternatives", @@ -2391,7 +2394,8 @@ function merge_handles( _successors = Block[] _attributes = NamedAttribute[] !isnothing(result) && push!(_results, result) - !isnothing(deduplicate) && push!(attributes, namedattribute("deduplicate", deduplicate)) + !isnothing(deduplicate) && + push!(_attributes, namedattribute("deduplicate", deduplicate)) return IR.create_operation( "transform.merge_handles", @@ -2457,8 +2461,8 @@ function print(target=nothing::Union{Nothing,Value}; name=nothing, location=Loca _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(target) && push!(operands, target) - !isnothing(name) && push!(attributes, namedattribute("name", name)) + !isnothing(target) && push!(_operands, target) + !isnothing(name) && push!(_attributes, namedattribute("name", name)) return IR.create_operation( "transform.print", @@ -2563,7 +2567,7 @@ function sequence( _attributes = NamedAttribute[namedattribute( "failure_propagation_mode", failure_propagation_mode ),] - !isnothing(root) && push!(operands, root) + !isnothing(root) && push!(_operands, root) return IR.create_operation( "transform.sequence", @@ -2656,7 +2660,7 @@ function with_pdl_patterns( _owned_regions = Region[body,] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(root) && push!(operands, root) + !isnothing(root) && push!(_operands, root) return IR.create_operation( "transform.with_pdl_patterns", @@ -2728,19 +2732,19 @@ function vector_lower_vectors( _successors = Block[] _attributes = NamedAttribute[] !isnothing(contraction_lowering) && - push!(attributes, namedattribute("contraction_lowering", contraction_lowering)) + push!(_attributes, namedattribute("contraction_lowering", contraction_lowering)) !isnothing(multireduction_lowering) && push!( - attributes, namedattribute("multireduction_lowering", multireduction_lowering) + _attributes, namedattribute("multireduction_lowering", multireduction_lowering) ) !isnothing(split_transfers) && - push!(attributes, namedattribute("split_transfers", split_transfers)) + push!(_attributes, namedattribute("split_transfers", split_transfers)) !isnothing(transpose_lowering) && - push!(attributes, namedattribute("transpose_lowering", transpose_lowering)) + push!(_attributes, namedattribute("transpose_lowering", transpose_lowering)) !isnothing(transpose_avx2_lowering) && push!( - attributes, namedattribute("transpose_avx2_lowering", transpose_avx2_lowering) + _attributes, namedattribute("transpose_avx2_lowering", transpose_avx2_lowering) ) !isnothing(unroll_vector_transfers) && push!( - attributes, namedattribute("unroll_vector_transfers", unroll_vector_transfers) + _attributes, namedattribute("unroll_vector_transfers", unroll_vector_transfers) ) return IR.create_operation( diff --git a/src/Dialects/16/Vector.jl b/src/Dialects/16/Vector.jl index fa4a593c..7a68ad38 100644 --- a/src/Dialects/16/Vector.jl +++ b/src/Dialects/16/Vector.jl @@ -374,7 +374,7 @@ function contract( namedattribute("indexing_maps", indexing_maps), namedattribute("iterator_types", iterator_types), ] - !isnothing(kind) && push!(attributes, namedattribute("kind", kind)) + !isnothing(kind) && push!(_attributes, namedattribute("kind", kind)) return IR.create_operation( "vector.contract", @@ -527,7 +527,7 @@ function extractelement( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(position) && push!(operands, position) + !isnothing(position) && push!(_operands, position) return IR.create_operation( "vector.extractelement", @@ -805,7 +805,7 @@ function insertelement( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(position) && push!(operands, position) + !isnothing(position) && push!(_operands, position) !isnothing(result) && push!(_results, result) return IR.create_operation( @@ -1046,7 +1046,7 @@ function mask( _owned_regions = Region[maskRegion,] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(passthru) && push!(operands, passthru) + !isnothing(passthru) && push!(_operands, passthru) return IR.create_operation( "vector.mask", @@ -1334,7 +1334,7 @@ function outerproduct( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(kind) && push!(attributes, namedattribute("kind", kind)) + !isnothing(kind) && push!(_attributes, namedattribute("kind", kind)) return IR.create_operation( "vector.outerproduct", @@ -1425,7 +1425,7 @@ function reduction( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[namedattribute("kind", kind),] - !isnothing(acc) && push!(operands, acc) + !isnothing(acc) && push!(_operands, acc) return IR.create_operation( "vector.reduction", @@ -1536,7 +1536,7 @@ function reshape( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[namedattribute("fixed_vector_sizes", fixed_vector_sizes),] - push!(attributes, operandsegmentsizes([1, length(input_shape), length(output_shape)])) + push!(_attributes, operandsegmentsizes([1, length(input_shape), length(output_shape)])) return IR.create_operation( "vector.reshape", @@ -2162,9 +2162,11 @@ function transfer_read( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[namedattribute("permutation_map", permutation_map),] - !isnothing(mask) && push!(operands, mask) - push!(attributes, operandsegmentsizes([1, length(indices), 1, isnothing(mask) ? 0 : 1])) - !isnothing(in_bounds) && push!(attributes, namedattribute("in_bounds", in_bounds)) + !isnothing(mask) && push!(_operands, mask) + push!( + _attributes, operandsegmentsizes([1, length(indices), 1, isnothing(mask) ? 0 : 1]) + ) + !isnothing(in_bounds) && push!(_attributes, namedattribute("in_bounds", in_bounds)) return IR.create_operation( "vector.transfer_read", @@ -2292,10 +2294,12 @@ function transfer_write( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[namedattribute("permutation_map", permutation_map),] - !isnothing(mask) && push!(operands, mask) - push!(attributes, operandsegmentsizes([1, 1, length(indices), isnothing(mask) ? 0 : 1])) + !isnothing(mask) && push!(_operands, mask) + push!( + _attributes, operandsegmentsizes([1, 1, length(indices), isnothing(mask) ? 0 : 1]) + ) !isnothing(result) && push!(_results, result) - !isnothing(in_bounds) && push!(attributes, namedattribute("in_bounds", in_bounds)) + !isnothing(in_bounds) && push!(_attributes, namedattribute("in_bounds", in_bounds)) return IR.create_operation( "vector.transfer_write", diff --git a/src/Dialects/16/X86Vector.jl b/src/Dialects/16/X86Vector.jl index bd2beada..61bc575b 100644 --- a/src/Dialects/16/X86Vector.jl +++ b/src/Dialects/16/X86Vector.jl @@ -124,10 +124,10 @@ function avx512_mask_compress( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(src) && push!(operands, src) + !isnothing(src) && push!(_operands, src) !isnothing(dst) && push!(_results, dst) !isnothing(constant_src) && - push!(attributes, namedattribute("constant_src", constant_src)) + push!(_attributes, namedattribute("constant_src", constant_src)) return IR.create_operation( "x86vector.avx512.mask.compress", diff --git a/src/Dialects/17/AMDGPU.jl b/src/Dialects/17/AMDGPU.jl index fdef60d2..c8b03ab9 100644 --- a/src/Dialects/17/AMDGPU.jl +++ b/src/Dialects/17/AMDGPU.jl @@ -95,14 +95,14 @@ function mfma( namedattribute("k", k), namedattribute("blocks", blocks), ] - !isnothing(cbsz) && push!(attributes, namedattribute("cbsz", cbsz)) - !isnothing(abid) && push!(attributes, namedattribute("abid", abid)) - !isnothing(blgp) && push!(attributes, namedattribute("blgp", blgp)) + !isnothing(cbsz) && push!(_attributes, namedattribute("cbsz", cbsz)) + !isnothing(abid) && push!(_attributes, namedattribute("abid", abid)) + !isnothing(blgp) && push!(_attributes, namedattribute("blgp", blgp)) !isnothing(reducePrecision) && - push!(attributes, namedattribute("reducePrecision", reducePrecision)) - !isnothing(negateA) && push!(attributes, namedattribute("negateA", negateA)) - !isnothing(negateB) && push!(attributes, namedattribute("negateB", negateB)) - !isnothing(negateC) && push!(attributes, namedattribute("negateC", negateC)) + push!(_attributes, namedattribute("reducePrecision", reducePrecision)) + !isnothing(negateA) && push!(_attributes, namedattribute("negateA", negateA)) + !isnothing(negateB) && push!(_attributes, namedattribute("negateB", negateB)) + !isnothing(negateC) && push!(_attributes, namedattribute("negateC", negateC)) return IR.create_operation( "amdgpu.mfma", @@ -151,13 +151,15 @@ function raw_buffer_atomic_cmpswap( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(sgprOffset) && push!(operands, sgprOffset) + !isnothing(sgprOffset) && push!(_operands, sgprOffset) push!( - attributes, + _attributes, operandsegmentsizes([1, 1, 1, length(indices), isnothing(sgprOffset) ? 0 : 1]), ) - !isnothing(boundsCheck) && push!(attributes, namedattribute("boundsCheck", boundsCheck)) - !isnothing(indexOffset) && push!(attributes, namedattribute("indexOffset", indexOffset)) + !isnothing(boundsCheck) && + push!(_attributes, namedattribute("boundsCheck", boundsCheck)) + !isnothing(indexOffset) && + push!(_attributes, namedattribute("indexOffset", indexOffset)) return IR.create_operation( "amdgpu.raw_buffer_atomic_cmpswap", @@ -205,13 +207,15 @@ function raw_buffer_atomic_fadd( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(sgprOffset) && push!(operands, sgprOffset) + !isnothing(sgprOffset) && push!(_operands, sgprOffset) push!( - attributes, + _attributes, operandsegmentsizes([1, 1, length(indices), isnothing(sgprOffset) ? 0 : 1]), ) - !isnothing(boundsCheck) && push!(attributes, namedattribute("boundsCheck", boundsCheck)) - !isnothing(indexOffset) && push!(attributes, namedattribute("indexOffset", indexOffset)) + !isnothing(boundsCheck) && + push!(_attributes, namedattribute("boundsCheck", boundsCheck)) + !isnothing(indexOffset) && + push!(_attributes, namedattribute("indexOffset", indexOffset)) return IR.create_operation( "amdgpu.raw_buffer_atomic_fadd", @@ -258,13 +262,15 @@ function raw_buffer_atomic_fmax( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(sgprOffset) && push!(operands, sgprOffset) + !isnothing(sgprOffset) && push!(_operands, sgprOffset) push!( - attributes, + _attributes, operandsegmentsizes([1, 1, length(indices), isnothing(sgprOffset) ? 0 : 1]), ) - !isnothing(boundsCheck) && push!(attributes, namedattribute("boundsCheck", boundsCheck)) - !isnothing(indexOffset) && push!(attributes, namedattribute("indexOffset", indexOffset)) + !isnothing(boundsCheck) && + push!(_attributes, namedattribute("boundsCheck", boundsCheck)) + !isnothing(indexOffset) && + push!(_attributes, namedattribute("indexOffset", indexOffset)) return IR.create_operation( "amdgpu.raw_buffer_atomic_fmax", @@ -311,13 +317,15 @@ function raw_buffer_atomic_smax( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(sgprOffset) && push!(operands, sgprOffset) + !isnothing(sgprOffset) && push!(_operands, sgprOffset) push!( - attributes, + _attributes, operandsegmentsizes([1, 1, length(indices), isnothing(sgprOffset) ? 0 : 1]), ) - !isnothing(boundsCheck) && push!(attributes, namedattribute("boundsCheck", boundsCheck)) - !isnothing(indexOffset) && push!(attributes, namedattribute("indexOffset", indexOffset)) + !isnothing(boundsCheck) && + push!(_attributes, namedattribute("boundsCheck", boundsCheck)) + !isnothing(indexOffset) && + push!(_attributes, namedattribute("indexOffset", indexOffset)) return IR.create_operation( "amdgpu.raw_buffer_atomic_smax", @@ -364,13 +372,15 @@ function raw_buffer_atomic_umin( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(sgprOffset) && push!(operands, sgprOffset) + !isnothing(sgprOffset) && push!(_operands, sgprOffset) push!( - attributes, + _attributes, operandsegmentsizes([1, 1, length(indices), isnothing(sgprOffset) ? 0 : 1]), ) - !isnothing(boundsCheck) && push!(attributes, namedattribute("boundsCheck", boundsCheck)) - !isnothing(indexOffset) && push!(attributes, namedattribute("indexOffset", indexOffset)) + !isnothing(boundsCheck) && + push!(_attributes, namedattribute("boundsCheck", boundsCheck)) + !isnothing(indexOffset) && + push!(_attributes, namedattribute("indexOffset", indexOffset)) return IR.create_operation( "amdgpu.raw_buffer_atomic_umin", @@ -430,12 +440,15 @@ function raw_buffer_load( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(sgprOffset) && push!(operands, sgprOffset) + !isnothing(sgprOffset) && push!(_operands, sgprOffset) push!( - attributes, operandsegmentsizes([1, length(indices), isnothing(sgprOffset) ? 0 : 1]) + _attributes, + operandsegmentsizes([1, length(indices), isnothing(sgprOffset) ? 0 : 1]), ) - !isnothing(boundsCheck) && push!(attributes, namedattribute("boundsCheck", boundsCheck)) - !isnothing(indexOffset) && push!(attributes, namedattribute("indexOffset", indexOffset)) + !isnothing(boundsCheck) && + push!(_attributes, namedattribute("boundsCheck", boundsCheck)) + !isnothing(indexOffset) && + push!(_attributes, namedattribute("indexOffset", indexOffset)) return IR.create_operation( "amdgpu.raw_buffer_load", @@ -483,13 +496,15 @@ function raw_buffer_store( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(sgprOffset) && push!(operands, sgprOffset) + !isnothing(sgprOffset) && push!(_operands, sgprOffset) push!( - attributes, + _attributes, operandsegmentsizes([1, 1, length(indices), isnothing(sgprOffset) ? 0 : 1]), ) - !isnothing(boundsCheck) && push!(attributes, namedattribute("boundsCheck", boundsCheck)) - !isnothing(indexOffset) && push!(attributes, namedattribute("indexOffset", indexOffset)) + !isnothing(boundsCheck) && + push!(_attributes, namedattribute("boundsCheck", boundsCheck)) + !isnothing(indexOffset) && + push!(_attributes, namedattribute("indexOffset", indexOffset)) return IR.create_operation( "amdgpu.raw_buffer_store", @@ -537,10 +552,10 @@ function wmma( _successors = Block[] _attributes = NamedAttribute[] !isnothing(subwordOffset) && - push!(attributes, namedattribute("subwordOffset", subwordOffset)) - !isnothing(unsignedA) && push!(attributes, namedattribute("unsignedA", unsignedA)) - !isnothing(unsignedB) && push!(attributes, namedattribute("unsignedB", unsignedB)) - !isnothing(clamp) && push!(attributes, namedattribute("clamp", clamp)) + push!(_attributes, namedattribute("subwordOffset", subwordOffset)) + !isnothing(unsignedA) && push!(_attributes, namedattribute("unsignedA", unsignedA)) + !isnothing(unsignedB) && push!(_attributes, namedattribute("unsignedB", unsignedB)) + !isnothing(clamp) && push!(_attributes, namedattribute("clamp", clamp)) return IR.create_operation( "amdgpu.wmma", diff --git a/src/Dialects/17/AMX.jl b/src/Dialects/17/AMX.jl index d3ceb98b..4df6ab3e 100644 --- a/src/Dialects/17/AMX.jl +++ b/src/Dialects/17/AMX.jl @@ -346,8 +346,8 @@ function tile_muli( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(isZextLhs) && push!(attributes, namedattribute("isZextLhs", isZextLhs)) - !isnothing(isZextRhs) && push!(attributes, namedattribute("isZextRhs", isZextRhs)) + !isnothing(isZextLhs) && push!(_attributes, namedattribute("isZextLhs", isZextLhs)) + !isnothing(isZextRhs) && push!(_attributes, namedattribute("isZextRhs", isZextRhs)) return IR.create_operation( "amx.tile_muli", diff --git a/src/Dialects/17/Arith.jl b/src/Dialects/17/Arith.jl index a28c3782..137ed273 100644 --- a/src/Dialects/17/Arith.jl +++ b/src/Dialects/17/Arith.jl @@ -41,7 +41,7 @@ function addf( _successors = Block[] _attributes = NamedAttribute[] !isnothing(result) && push!(_results, result) - !isnothing(fastmath) && push!(attributes, namedattribute("fastmath", fastmath)) + !isnothing(fastmath) && push!(_attributes, namedattribute("fastmath", fastmath)) return IR.create_operation( "arith.addf", @@ -443,13 +443,12 @@ forms simple integer and floating point constants. %1 = \"arith.constant\"() {value = 42 : i32} : () -> i32 ``` """ -function constant(; result=nothing::Union{Nothing,IR.Type}, value, location=Location()) - _results = IR.Type[] +function constant(; result::IR.Type, value, location=Location()) + _results = IR.Type[result,] _operands = Value[] _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[namedattribute("value", value),] - !isnothing(result) && push!(_results, result) return IR.create_operation( "arith.constant", @@ -458,8 +457,8 @@ function constant(; result=nothing::Union{Nothing,IR.Type}, value, location=Loca owned_regions=_owned_regions, successors=_successors, attributes=_attributes, - results=(length(_results) == 0 ? nothing : _results), - result_inference=(length(_results) == 0 ? true : false), + results=_results, + result_inference=false, ) end @@ -480,7 +479,7 @@ function divf( _successors = Block[] _attributes = NamedAttribute[] !isnothing(result) && push!(_results, result) - !isnothing(fastmath) && push!(attributes, namedattribute("fastmath", fastmath)) + !isnothing(fastmath) && push!(_attributes, namedattribute("fastmath", fastmath)) return IR.create_operation( "arith.divf", @@ -862,7 +861,7 @@ function maxf( _successors = Block[] _attributes = NamedAttribute[] !isnothing(result) && push!(_results, result) - !isnothing(fastmath) && push!(attributes, namedattribute("fastmath", fastmath)) + !isnothing(fastmath) && push!(_attributes, namedattribute("fastmath", fastmath)) return IR.create_operation( "arith.maxf", @@ -960,7 +959,7 @@ function minf( _successors = Block[] _attributes = NamedAttribute[] !isnothing(result) && push!(_results, result) - !isnothing(fastmath) && push!(attributes, namedattribute("fastmath", fastmath)) + !isnothing(fastmath) && push!(_attributes, namedattribute("fastmath", fastmath)) return IR.create_operation( "arith.minf", @@ -1063,7 +1062,7 @@ function mulf( _successors = Block[] _attributes = NamedAttribute[] !isnothing(result) && push!(_results, result) - !isnothing(fastmath) && push!(attributes, namedattribute("fastmath", fastmath)) + !isnothing(fastmath) && push!(_attributes, namedattribute("fastmath", fastmath)) return IR.create_operation( "arith.mulf", @@ -1232,7 +1231,7 @@ function negf( _successors = Block[] _attributes = NamedAttribute[] !isnothing(result) && push!(_results, result) - !isnothing(fastmath) && push!(attributes, namedattribute("fastmath", fastmath)) + !isnothing(fastmath) && push!(_attributes, namedattribute("fastmath", fastmath)) return IR.create_operation( "arith.negf", @@ -1306,7 +1305,7 @@ function remf( _successors = Block[] _attributes = NamedAttribute[] !isnothing(result) && push!(_results, result) - !isnothing(fastmath) && push!(attributes, namedattribute("fastmath", fastmath)) + !isnothing(fastmath) && push!(_attributes, namedattribute("fastmath", fastmath)) return IR.create_operation( "arith.remf", @@ -1585,7 +1584,7 @@ function subf( _successors = Block[] _attributes = NamedAttribute[] !isnothing(result) && push!(_results, result) - !isnothing(fastmath) && push!(attributes, namedattribute("fastmath", fastmath)) + !isnothing(fastmath) && push!(_attributes, namedattribute("fastmath", fastmath)) return IR.create_operation( "arith.subf", diff --git a/src/Dialects/17/Async.jl b/src/Dialects/17/Async.jl index 2afd1d4f..08904fe6 100644 --- a/src/Dialects/17/Async.jl +++ b/src/Dialects/17/Async.jl @@ -410,7 +410,7 @@ function execute( _owned_regions = Region[bodyRegion,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(dependencies), length(bodyOperands)])) + push!(_attributes, operandsegmentsizes([length(dependencies), length(bodyOperands)])) return IR.create_operation( "async.execute", @@ -472,9 +472,9 @@ function func(; 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)) + 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)) return IR.create_operation( "async.func", diff --git a/src/Dialects/17/Bufferization.jl b/src/Dialects/17/Bufferization.jl index e552b520..cc54ae02 100644 --- a/src/Dialects/17/Bufferization.jl +++ b/src/Dialects/17/Bufferization.jl @@ -71,16 +71,16 @@ function alloc_tensor( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(copy) && push!(operands, copy) - !isnothing(size_hint) && push!(operands, size_hint) + !isnothing(copy) && push!(_operands, copy) + !isnothing(size_hint) && push!(_operands, size_hint) push!( - attributes, + _attributes, operandsegmentsizes([ length(dynamic_sizes), isnothing(copy) ? 0 : 1, isnothing(size_hint) ? 0 : 1 ]), ) !isnothing(memory_space) && - push!(attributes, namedattribute("memory_space", memory_space)) + push!(_attributes, namedattribute("memory_space", memory_space)) return IR.create_operation( "bufferization.alloc_tensor", @@ -197,7 +197,7 @@ function dealloc( _successors = Block[] _attributes = NamedAttribute[] push!( - attributes, + _attributes, operandsegmentsizes([length(memrefs), length(conditions), length(retained)]), ) !isnothing(updatedConditions) && push!(_results, updatedConditions...) @@ -283,7 +283,7 @@ function to_memref(tensor::Value; memref::IR.Type, read_only=nothing, location=L _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(read_only) && push!(attributes, namedattribute("read_only", read_only)) + !isnothing(read_only) && push!(_attributes, namedattribute("read_only", read_only)) return IR.create_operation( "bufferization.to_memref", @@ -348,8 +348,8 @@ function to_tensor( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(restrict) && push!(attributes, namedattribute("restrict", restrict)) - !isnothing(writable) && push!(attributes, namedattribute("writable", writable)) + !isnothing(restrict) && push!(_attributes, namedattribute("restrict", restrict)) + !isnothing(writable) && push!(_attributes, namedattribute("writable", writable)) return IR.create_operation( "bufferization.to_tensor", diff --git a/src/Dialects/17/Builtin.jl b/src/Dialects/17/Builtin.jl index 1a672bef..2ac242d8 100644 --- a/src/Dialects/17/Builtin.jl +++ b/src/Dialects/17/Builtin.jl @@ -31,9 +31,9 @@ function module_(; _owned_regions = Region[bodyRegion,] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(sym_name) && push!(attributes, namedattribute("sym_name", sym_name)) + !isnothing(sym_name) && push!(_attributes, namedattribute("sym_name", sym_name)) !isnothing(sym_visibility) && - push!(attributes, namedattribute("sym_visibility", sym_visibility)) + push!(_attributes, namedattribute("sym_visibility", sym_visibility)) return IR.create_operation( "builtin.module", diff --git a/src/Dialects/17/ControlFlow.jl b/src/Dialects/17/ControlFlow.jl index df39048c..23faa5a7 100644 --- a/src/Dialects/17/ControlFlow.jl +++ b/src/Dialects/17/ControlFlow.jl @@ -115,7 +115,7 @@ function cond_br( _successors = Block[trueDest, falseDest] _attributes = NamedAttribute[] push!( - attributes, + _attributes, operandsegmentsizes([1, length(trueDestOperands), length(falseDestOperands)]), ) @@ -168,9 +168,10 @@ function switch( "case_operand_segments", case_operand_segments ),] push!( - attributes, operandsegmentsizes([1, length(defaultOperands), length(caseOperands)]) + _attributes, operandsegmentsizes([1, length(defaultOperands), length(caseOperands)]) ) - !isnothing(case_values) && push!(attributes, namedattribute("case_values", case_values)) + !isnothing(case_values) && + push!(_attributes, namedattribute("case_values", case_values)) return IR.create_operation( "cf.switch", diff --git a/src/Dialects/17/EmitC.jl b/src/Dialects/17/EmitC.jl index 16fa0a93..313d1d4e 100644 --- a/src/Dialects/17/EmitC.jl +++ b/src/Dialects/17/EmitC.jl @@ -111,9 +111,9 @@ function call( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[namedattribute("callee", callee),] - !isnothing(args) && push!(attributes, namedattribute("args", args)) + !isnothing(args) && push!(_attributes, namedattribute("args", args)) !isnothing(template_args) && - push!(attributes, namedattribute("template_args", template_args)) + push!(_attributes, namedattribute("template_args", template_args)) return IR.create_operation( "emitc.call", @@ -272,7 +272,7 @@ function include_(; include_, is_standard_include=nothing, location=Location()) _successors = Block[] _attributes = NamedAttribute[namedattribute("include", include_),] !isnothing(is_standard_include) && - push!(attributes, namedattribute("is_standard_include", is_standard_include)) + push!(_attributes, namedattribute("is_standard_include", is_standard_include)) return IR.create_operation( "emitc.include", diff --git a/src/Dialects/17/Func.jl b/src/Dialects/17/Func.jl index 9f76a3e9..a95ab39a 100644 --- a/src/Dialects/17/Func.jl +++ b/src/Dialects/17/Func.jl @@ -176,9 +176,9 @@ function func_(; 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)) + 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)) return IR.create_operation( "func.func", diff --git a/src/Dialects/17/GPU.jl b/src/Dialects/17/GPU.jl index f9c5959f..fe604145 100644 --- a/src/Dialects/17/GPU.jl +++ b/src/Dialects/17/GPU.jl @@ -43,8 +43,8 @@ function all_reduce( _successors = Block[] _attributes = NamedAttribute[] !isnothing(result_0) && push!(_results, result_0) - !isnothing(op) && push!(attributes, namedattribute("op", op)) - !isnothing(uniform) && push!(attributes, namedattribute("uniform", uniform)) + !isnothing(op) && push!(_attributes, namedattribute("op", op)) + !isnothing(uniform) && push!(_attributes, namedattribute("uniform", uniform)) return IR.create_operation( "gpu.all_reduce", @@ -95,13 +95,13 @@ function alloc( _successors = Block[] _attributes = NamedAttribute[] push!( - attributes, + _attributes, operandsegmentsizes([ length(asyncDependencies), length(dynamicSizes), length(symbolOperands) ]), ) !isnothing(asyncToken) && push!(_results, asyncToken) - !isnothing(hostShared) && push!(attributes, namedattribute("hostShared", hostShared)) + !isnothing(hostShared) && push!(_attributes, namedattribute("hostShared", hostShared)) return IR.create_operation( "gpu.alloc", @@ -453,7 +453,7 @@ function create_dn_tensor( _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!(_results, asyncToken) return IR.create_operation( @@ -678,12 +678,12 @@ function func(; _owned_regions = Region[body,] _successors = Block[] _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(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)) + push!(_attributes, namedattribute("workgroup_attrib_attrs", workgroup_attrib_attrs)) !isnothing(private_attrib_attrs) && - push!(attributes, namedattribute("private_attrib_attrs", private_attrib_attrs)) + push!(_attributes, namedattribute("private_attrib_attrs", private_attrib_attrs)) return IR.create_operation( "gpu.func", @@ -1008,9 +1008,9 @@ function launch_func( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[namedattribute("kernel", kernel),] - !isnothing(dynamicSharedMemorySize) && push!(operands, dynamicSharedMemorySize) + !isnothing(dynamicSharedMemorySize) && push!(_operands, dynamicSharedMemorySize) push!( - attributes, + _attributes, operandsegmentsizes([ length(asyncDependencies), 1, @@ -1154,9 +1154,9 @@ function launch( _owned_regions = Region[body,] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(dynamicSharedMemorySize) && push!(operands, dynamicSharedMemorySize) + !isnothing(dynamicSharedMemorySize) && push!(_operands, dynamicSharedMemorySize) push!( - attributes, + _attributes, operandsegmentsizes([ length(asyncDependencies), 1, @@ -1419,8 +1419,8 @@ function sddmm_buffer_size( _successors = Block[] _attributes = NamedAttribute[namedattribute("computeType", computeType),] !isnothing(asyncToken) && push!(_results, asyncToken) - !isnothing(modeA) && push!(attributes, namedattribute("modeA", modeA)) - !isnothing(modeB) && push!(attributes, namedattribute("modeB", modeB)) + !isnothing(modeA) && push!(_attributes, namedattribute("modeA", modeA)) + !isnothing(modeB) && push!(_attributes, namedattribute("modeB", modeB)) return IR.create_operation( "gpu.sddmm_buffer_size", @@ -1474,8 +1474,8 @@ function sddmm( _successors = Block[] _attributes = NamedAttribute[namedattribute("computeType", computeType),] !isnothing(asyncToken) && push!(_results, asyncToken) - !isnothing(modeA) && push!(attributes, namedattribute("modeA", modeA)) - !isnothing(modeB) && push!(attributes, namedattribute("modeB", modeB)) + !isnothing(modeA) && push!(_attributes, namedattribute("modeA", modeA)) + !isnothing(modeB) && push!(_attributes, namedattribute("modeB", modeB)) return IR.create_operation( "gpu.sddmm", @@ -1605,8 +1605,8 @@ function spmm_buffer_size( _successors = Block[] _attributes = NamedAttribute[namedattribute("computeType", computeType),] !isnothing(asyncToken) && push!(_results, asyncToken) - !isnothing(modeA) && push!(attributes, namedattribute("modeA", modeA)) - !isnothing(modeB) && push!(attributes, namedattribute("modeB", modeB)) + !isnothing(modeA) && push!(_attributes, namedattribute("modeA", modeA)) + !isnothing(modeB) && push!(_attributes, namedattribute("modeB", modeB)) return IR.create_operation( "gpu.spmm_buffer_size", @@ -1660,12 +1660,12 @@ function spmm( _successors = Block[] _attributes = NamedAttribute[namedattribute("computeType", computeType),] push!( - attributes, + _attributes, operandsegmentsizes([length(asyncDependencies), 1, 1, 1, length(buffers)]), ) !isnothing(asyncToken) && push!(_results, asyncToken) - !isnothing(modeA) && push!(attributes, namedattribute("modeA", modeA)) - !isnothing(modeB) && push!(attributes, namedattribute("modeB", modeB)) + !isnothing(modeA) && push!(_attributes, namedattribute("modeA", modeA)) + !isnothing(modeB) && push!(_attributes, namedattribute("modeB", modeB)) return IR.create_operation( "gpu.spmm", @@ -1718,7 +1718,7 @@ function spmv_buffer_size( _successors = Block[] _attributes = NamedAttribute[namedattribute("computeType", computeType),] !isnothing(asyncToken) && push!(_results, asyncToken) - !isnothing(modeA) && push!(attributes, namedattribute("modeA", modeA)) + !isnothing(modeA) && push!(_attributes, namedattribute("modeA", modeA)) return IR.create_operation( "gpu.spmv_buffer_size", @@ -1771,7 +1771,7 @@ function spmv( _successors = Block[] _attributes = NamedAttribute[namedattribute("computeType", computeType),] !isnothing(asyncToken) && push!(_results, asyncToken) - !isnothing(modeA) && push!(attributes, namedattribute("modeA", modeA)) + !isnothing(modeA) && push!(_attributes, namedattribute("modeA", modeA)) return IR.create_operation( "gpu.spmv", @@ -1863,8 +1863,10 @@ function subgroup_mma_compute( _successors = Block[] _attributes = NamedAttribute[] !isnothing(res) && push!(_results, res) - !isnothing(a_transpose) && push!(attributes, namedattribute("a_transpose", a_transpose)) - !isnothing(b_transpose) && push!(attributes, namedattribute("b_transpose", b_transpose)) + !isnothing(a_transpose) && + push!(_attributes, namedattribute("a_transpose", a_transpose)) + !isnothing(b_transpose) && + push!(_attributes, namedattribute("b_transpose", b_transpose)) return IR.create_operation( "gpu.subgroup_mma_compute", @@ -2002,7 +2004,7 @@ function subgroup_mma_load_matrix( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[namedattribute("leadDimension", leadDimension),] - !isnothing(transpose) && push!(attributes, namedattribute("transpose", transpose)) + !isnothing(transpose) && push!(_attributes, namedattribute("transpose", transpose)) return IR.create_operation( "gpu.subgroup_mma_load_matrix", @@ -2052,7 +2054,7 @@ function subgroup_mma_store_matrix( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[namedattribute("leadDimension", leadDimension),] - !isnothing(transpose) && push!(attributes, namedattribute("transpose", transpose)) + !isnothing(transpose) && push!(_attributes, namedattribute("transpose", transpose)) return IR.create_operation( "gpu.subgroup_mma_store_matrix", @@ -2094,7 +2096,7 @@ function subgroup_reduce( _successors = Block[] _attributes = NamedAttribute[namedattribute("op", op),] !isnothing(result_0) && push!(_results, result_0) - !isnothing(uniform) && push!(attributes, namedattribute("uniform", uniform)) + !isnothing(uniform) && push!(_attributes, namedattribute("uniform", uniform)) return IR.create_operation( "gpu.subgroup_reduce", diff --git a/src/Dialects/17/IRDL.jl b/src/Dialects/17/IRDL.jl index df885abc..a703e7af 100644 --- a/src/Dialects/17/IRDL.jl +++ b/src/Dialects/17/IRDL.jl @@ -531,18 +531,12 @@ irdl.dialect @cmath { The above program defines an operation `norm` inside the dialect `cmath` that for any `T` takes a `cmath.complex` with parameter `T` and returns a `T`. """ -function parametric( - args::Vector{Value}; - output=nothing::Union{Nothing,IR.Type}, - base_type, - location=Location(), -) - _results = IR.Type[] +function parametric(args::Vector{Value}; output::IR.Type, base_type, location=Location()) + _results = IR.Type[output,] _operands = Value[args...,] _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[namedattribute("base_type", base_type),] - !isnothing(output) && push!(_results, output) return IR.create_operation( "irdl.parametric", @@ -551,8 +545,8 @@ function parametric( owned_regions=_owned_regions, successors=_successors, attributes=_attributes, - results=(length(_results) == 0 ? nothing : _results), - result_inference=(length(_results) == 0 ? true : false), + results=_results, + result_inference=false, ) end diff --git a/src/Dialects/17/LLVMIR.jl b/src/Dialects/17/LLVMIR.jl index 9591fafd..d2fa731d 100644 --- a/src/Dialects/17/LLVMIR.jl +++ b/src/Dialects/17/LLVMIR.jl @@ -144,9 +144,9 @@ function alloca( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(alignment) && push!(attributes, namedattribute("alignment", alignment)) - !isnothing(elem_type) && push!(attributes, namedattribute("elem_type", elem_type)) - !isnothing(inalloca) && push!(attributes, namedattribute("inalloca", inalloca)) + !isnothing(alignment) && push!(_attributes, namedattribute("alignment", alignment)) + !isnothing(elem_type) && push!(_attributes, namedattribute("elem_type", elem_type)) + !isnothing(inalloca) && push!(_attributes, namedattribute("inalloca", inalloca)) return IR.create_operation( "llvm.alloca", @@ -215,17 +215,17 @@ function cmpxchg( namedattribute("success_ordering", success_ordering), namedattribute("failure_ordering", failure_ordering), ] - !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(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)) + push!(_attributes, namedattribute("access_groups", access_groups)) !isnothing(alias_scopes) && - push!(attributes, namedattribute("alias_scopes", 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)) + push!(_attributes, namedattribute("noalias_scopes", noalias_scopes)) + !isnothing(tbaa) && push!(_attributes, namedattribute("tbaa", tbaa)) return IR.create_operation( "llvm.cmpxchg", @@ -265,16 +265,16 @@ function atomicrmw( _attributes = NamedAttribute[ namedattribute("bin_op", bin_op), namedattribute("ordering", ordering) ] - !isnothing(syncscope) && push!(attributes, namedattribute("syncscope", syncscope)) - !isnothing(alignment) && push!(attributes, namedattribute("alignment", alignment)) - !isnothing(volatile_) && push!(attributes, namedattribute("volatile_", volatile_)) + !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)) + push!(_attributes, namedattribute("access_groups", access_groups)) !isnothing(alias_scopes) && - push!(attributes, namedattribute("alias_scopes", 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)) + push!(_attributes, namedattribute("noalias_scopes", noalias_scopes)) + !isnothing(tbaa) && push!(_attributes, namedattribute("tbaa", tbaa)) return IR.create_operation( "llvm.atomicrmw", @@ -324,7 +324,7 @@ function br( _successors = Block[dest,] _attributes = NamedAttribute[] !isnothing(loop_annotation) && - push!(attributes, namedattribute("loop_annotation", loop_annotation)) + push!(_attributes, namedattribute("loop_annotation", loop_annotation)) return IR.create_operation( "llvm.br", @@ -385,18 +385,18 @@ function call( _successors = Block[] _attributes = NamedAttribute[] !isnothing(result) && push!(_results, result) - !isnothing(callee) && push!(attributes, namedattribute("callee", callee)) + !isnothing(callee) && push!(_attributes, namedattribute("callee", callee)) !isnothing(fastmathFlags) && - push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) + push!(_attributes, namedattribute("fastmathFlags", fastmathFlags)) !isnothing(branch_weights) && - push!(attributes, namedattribute("branch_weights", branch_weights)) + push!(_attributes, namedattribute("branch_weights", branch_weights)) !isnothing(access_groups) && - push!(attributes, namedattribute("access_groups", access_groups)) + push!(_attributes, namedattribute("access_groups", access_groups)) !isnothing(alias_scopes) && - push!(attributes, namedattribute("alias_scopes", 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)) + push!(_attributes, namedattribute("noalias_scopes", noalias_scopes)) + !isnothing(tbaa) && push!(_attributes, namedattribute("tbaa", tbaa)) return IR.create_operation( "llvm.call", @@ -496,13 +496,13 @@ function cond_br( _successors = Block[trueDest, falseDest] _attributes = NamedAttribute[] push!( - attributes, + _attributes, operandsegmentsizes([1, length(trueDestOperands), length(falseDestOperands)]), ) !isnothing(branch_weights) && - push!(attributes, namedattribute("branch_weights", branch_weights)) + push!(_attributes, namedattribute("branch_weights", branch_weights)) !isnothing(loop_annotation) && - push!(attributes, namedattribute("loop_annotation", loop_annotation)) + push!(_attributes, namedattribute("loop_annotation", loop_annotation)) return IR.create_operation( "llvm.cond_br", @@ -629,7 +629,7 @@ function fadd( _attributes = NamedAttribute[] !isnothing(res) && push!(_results, res) !isnothing(fastmathFlags) && - push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) + push!(_attributes, namedattribute("fastmathFlags", fastmathFlags)) return IR.create_operation( "llvm.fadd", @@ -661,7 +661,7 @@ function fcmp( _successors = Block[] _attributes = NamedAttribute[namedattribute("predicate", predicate),] !isnothing(fastmathFlags) && - push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) + push!(_attributes, namedattribute("fastmathFlags", fastmathFlags)) return IR.create_operation( "llvm.fcmp", @@ -693,7 +693,7 @@ function fdiv( _attributes = NamedAttribute[] !isnothing(res) && push!(_results, res) !isnothing(fastmathFlags) && - push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) + push!(_attributes, namedattribute("fastmathFlags", fastmathFlags)) return IR.create_operation( "llvm.fdiv", @@ -725,7 +725,7 @@ function fmul( _attributes = NamedAttribute[] !isnothing(res) && push!(_results, res) !isnothing(fastmathFlags) && - push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) + push!(_attributes, namedattribute("fastmathFlags", fastmathFlags)) return IR.create_operation( "llvm.fmul", @@ -756,7 +756,7 @@ function fneg( _attributes = NamedAttribute[] !isnothing(res) && push!(_results, res) !isnothing(fastmathFlags) && - push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) + push!(_attributes, namedattribute("fastmathFlags", fastmathFlags)) return IR.create_operation( "llvm.fneg", @@ -880,7 +880,7 @@ function frem( _attributes = NamedAttribute[] !isnothing(res) && push!(_results, res) !isnothing(fastmathFlags) && - push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) + push!(_attributes, namedattribute("fastmathFlags", fastmathFlags)) return IR.create_operation( "llvm.frem", @@ -912,7 +912,7 @@ function fsub( _attributes = NamedAttribute[] !isnothing(res) && push!(_results, res) !isnothing(fastmathFlags) && - push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) + push!(_attributes, namedattribute("fastmathFlags", fastmathFlags)) return IR.create_operation( "llvm.fsub", @@ -936,7 +936,7 @@ function fence(; ordering, syncscope=nothing, location=Location()) _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[namedattribute("ordering", ordering),] - !isnothing(syncscope) && push!(attributes, namedattribute("syncscope", syncscope)) + !isnothing(syncscope) && push!(_attributes, namedattribute("syncscope", syncscope)) return IR.create_operation( "llvm.fence", @@ -1015,8 +1015,8 @@ function getelementptr( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[namedattribute("rawConstantIndices", rawConstantIndices),] - !isnothing(elem_type) && push!(attributes, namedattribute("elem_type", elem_type)) - !isnothing(inbounds) && push!(attributes, namedattribute("inbounds", inbounds)) + !isnothing(elem_type) && push!(_attributes, namedattribute("elem_type", elem_type)) + !isnothing(inbounds) && push!(_attributes, namedattribute("inbounds", inbounds)) return IR.create_operation( "llvm.getelementptr", @@ -1236,18 +1236,19 @@ function mlir_global(; 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(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(value) && push!(attributes, namedattribute("value", value)) - !isnothing(alignment) && push!(attributes, namedattribute("alignment", alignment)) - !isnothing(addr_space) && push!(attributes, namedattribute("addr_space", addr_space)) + push!(_attributes, namedattribute("thread_local_", thread_local_)) + !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(section) && push!(attributes, namedattribute("section", section)) - !isnothing(comdat) && push!(attributes, namedattribute("comdat", comdat)) - !isnothing(visibility_) && push!(attributes, namedattribute("visibility_", visibility_)) + push!(_attributes, namedattribute("unnamed_addr", unnamed_addr)) + !isnothing(section) && push!(_attributes, namedattribute("section", section)) + !isnothing(comdat) && push!(_attributes, namedattribute("comdat", comdat)) + !isnothing(visibility_) && + push!(_attributes, namedattribute("visibility_", visibility_)) return IR.create_operation( "llvm.mlir.global", @@ -1314,12 +1315,13 @@ function inline_asm( ] !isnothing(res) && push!(_results, res) !isnothing(has_side_effects) && - push!(attributes, namedattribute("has_side_effects", 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)) + 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)) + push!(_attributes, namedattribute("operand_attrs", operand_attrs)) return IR.create_operation( "llvm.inline_asm", @@ -1437,14 +1439,14 @@ function invoke( _successors = Block[normalDest, unwindDest] _attributes = NamedAttribute[] push!( - attributes, + _attributes, operandsegmentsizes([ length(callee_operands), length(normalDestOperands), length(unwindDestOperands) ]), ) - !isnothing(callee) && push!(attributes, namedattribute("callee", callee)) + !isnothing(callee) && push!(_attributes, namedattribute("callee", callee)) !isnothing(branch_weights) && - push!(attributes, namedattribute("branch_weights", branch_weights)) + push!(_attributes, namedattribute("branch_weights", branch_weights)) return IR.create_operation( "llvm.invoke", @@ -1517,28 +1519,31 @@ function func(; _attributes = NamedAttribute[ namedattribute("sym_name", sym_name), namedattribute("function_type", function_type) ] - !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(personality) && push!(attributes, namedattribute("personality", personality)) + !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(personality) && + push!(_attributes, namedattribute("personality", personality)) !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)) + 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) && push!(attributes, namedattribute("memory", memory)) - !isnothing(visibility_) && push!(attributes, namedattribute("visibility_", visibility_)) + push!(_attributes, namedattribute("function_entry_count", function_entry_count)) + !isnothing(memory) && push!(_attributes, namedattribute("memory", memory)) + !isnothing(visibility_) && + push!(_attributes, namedattribute("visibility_", visibility_)) !isnothing(arm_streaming) && - push!(attributes, namedattribute("arm_streaming", arm_streaming)) + push!(_attributes, namedattribute("arm_streaming", arm_streaming)) !isnothing(arm_locally_streaming) && - push!(attributes, namedattribute("arm_locally_streaming", arm_locally_streaming)) - !isnothing(section) && push!(attributes, namedattribute("section", section)) + push!(_attributes, namedattribute("arm_locally_streaming", arm_locally_streaming)) + !isnothing(section) && push!(_attributes, namedattribute("section", section)) !isnothing(unnamed_addr) && - push!(attributes, namedattribute("unnamed_addr", unnamed_addr)) - !isnothing(alignment) && push!(attributes, namedattribute("alignment", alignment)) + push!(_attributes, namedattribute("unnamed_addr", unnamed_addr)) + !isnothing(alignment) && push!(_attributes, namedattribute("alignment", alignment)) return IR.create_operation( "llvm.func", @@ -1590,7 +1595,7 @@ function landingpad( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(cleanup) && push!(attributes, namedattribute("cleanup", cleanup)) + !isnothing(cleanup) && push!(_attributes, namedattribute("cleanup", cleanup)) return IR.create_operation( "llvm.landingpad", @@ -1649,18 +1654,19 @@ function load( _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(ordering) && push!(attributes, namedattribute("ordering", ordering)) - !isnothing(syncscope) && push!(attributes, namedattribute("syncscope", syncscope)) + !isnothing(alignment) && push!(_attributes, namedattribute("alignment", alignment)) + !isnothing(volatile_) && push!(_attributes, namedattribute("volatile_", volatile_)) + !isnothing(nontemporal) && + push!(_attributes, namedattribute("nontemporal", nontemporal)) + !isnothing(ordering) && push!(_attributes, namedattribute("ordering", ordering)) + !isnothing(syncscope) && push!(_attributes, namedattribute("syncscope", syncscope)) !isnothing(access_groups) && - push!(attributes, namedattribute("access_groups", access_groups)) + push!(_attributes, namedattribute("access_groups", access_groups)) !isnothing(alias_scopes) && - push!(attributes, namedattribute("alias_scopes", 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)) + push!(_attributes, namedattribute("noalias_scopes", noalias_scopes)) + !isnothing(tbaa) && push!(_attributes, namedattribute("tbaa", tbaa)) return IR.create_operation( "llvm.load", @@ -1886,7 +1892,7 @@ function return_(arg=nothing::Union{Nothing,Value}; location=Location()) _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(arg) && push!(operands, arg) + !isnothing(arg) && push!(_operands, arg) return IR.create_operation( "llvm.return", @@ -2017,7 +2023,7 @@ function select( _attributes = NamedAttribute[] !isnothing(res) && push!(_results, res) !isnothing(fastmathFlags) && - push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) + push!(_attributes, namedattribute("fastmathFlags", fastmathFlags)) return IR.create_operation( "llvm.select", @@ -2125,18 +2131,19 @@ function store( _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(ordering) && push!(attributes, namedattribute("ordering", ordering)) - !isnothing(syncscope) && push!(attributes, namedattribute("syncscope", syncscope)) + !isnothing(alignment) && push!(_attributes, namedattribute("alignment", alignment)) + !isnothing(volatile_) && push!(_attributes, namedattribute("volatile_", volatile_)) + !isnothing(nontemporal) && + push!(_attributes, namedattribute("nontemporal", nontemporal)) + !isnothing(ordering) && push!(_attributes, namedattribute("ordering", ordering)) + !isnothing(syncscope) && push!(_attributes, namedattribute("syncscope", syncscope)) !isnothing(access_groups) && - push!(attributes, namedattribute("access_groups", access_groups)) + push!(_attributes, namedattribute("access_groups", access_groups)) !isnothing(alias_scopes) && - push!(attributes, namedattribute("alias_scopes", 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)) + push!(_attributes, namedattribute("noalias_scopes", noalias_scopes)) + !isnothing(tbaa) && push!(_attributes, namedattribute("tbaa", tbaa)) return IR.create_operation( "llvm.store", @@ -2199,11 +2206,12 @@ function switch( "case_operand_segments", case_operand_segments ),] push!( - attributes, operandsegmentsizes([1, length(defaultOperands), length(caseOperands)]) + _attributes, operandsegmentsizes([1, length(defaultOperands), length(caseOperands)]) ) - !isnothing(case_values) && push!(attributes, namedattribute("case_values", case_values)) + !isnothing(case_values) && + push!(_attributes, namedattribute("case_values", case_values)) !isnothing(branch_weights) && - push!(attributes, namedattribute("branch_weights", branch_weights)) + push!(_attributes, namedattribute("branch_weights", branch_weights)) return IR.create_operation( "llvm.switch", @@ -2571,7 +2579,7 @@ function call_intrinsic( _successors = Block[] _attributes = NamedAttribute[namedattribute("intrin", intrin),] !isnothing(fastmathFlags) && - push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) + push!(_attributes, namedattribute("fastmathFlags", fastmathFlags)) return IR.create_operation( "llvm.call_intrinsic", @@ -2603,7 +2611,7 @@ function intr_copysign( _attributes = NamedAttribute[] !isnothing(res) && push!(_results, res) !isnothing(fastmathFlags) && - push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) + push!(_attributes, namedattribute("fastmathFlags", fastmathFlags)) return IR.create_operation( "llvm.intr.copysign", @@ -2848,7 +2856,7 @@ function intr_cos( _attributes = NamedAttribute[] !isnothing(res) && push!(_results, res) !isnothing(fastmathFlags) && - push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) + push!(_attributes, namedattribute("fastmathFlags", fastmathFlags)) return IR.create_operation( "llvm.intr.cos", @@ -3064,7 +3072,7 @@ function intr_exp2( _attributes = NamedAttribute[] !isnothing(res) && push!(_results, res) !isnothing(fastmathFlags) && - push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) + push!(_attributes, namedattribute("fastmathFlags", fastmathFlags)) return IR.create_operation( "llvm.intr.exp2", @@ -3095,7 +3103,7 @@ function intr_exp( _attributes = NamedAttribute[] !isnothing(res) && push!(_results, res) !isnothing(fastmathFlags) && - push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) + push!(_attributes, namedattribute("fastmathFlags", fastmathFlags)) return IR.create_operation( "llvm.intr.exp", @@ -3182,7 +3190,7 @@ function intr_fabs( _attributes = NamedAttribute[] !isnothing(res) && push!(_results, res) !isnothing(fastmathFlags) && - push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) + push!(_attributes, namedattribute("fastmathFlags", fastmathFlags)) return IR.create_operation( "llvm.intr.fabs", @@ -3213,7 +3221,7 @@ function intr_ceil( _attributes = NamedAttribute[] !isnothing(res) && push!(_results, res) !isnothing(fastmathFlags) && - push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) + push!(_attributes, namedattribute("fastmathFlags", fastmathFlags)) return IR.create_operation( "llvm.intr.ceil", @@ -3244,7 +3252,7 @@ function intr_floor( _attributes = NamedAttribute[] !isnothing(res) && push!(_results, res) !isnothing(fastmathFlags) && - push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) + push!(_attributes, namedattribute("fastmathFlags", fastmathFlags)) return IR.create_operation( "llvm.intr.floor", @@ -3277,7 +3285,7 @@ function intr_fma( _attributes = NamedAttribute[] !isnothing(res) && push!(_results, res) !isnothing(fastmathFlags) && - push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) + push!(_attributes, namedattribute("fastmathFlags", fastmathFlags)) return IR.create_operation( "llvm.intr.fma", @@ -3310,7 +3318,7 @@ function intr_fmuladd( _attributes = NamedAttribute[] !isnothing(res) && push!(_results, res) !isnothing(fastmathFlags) && - push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) + push!(_attributes, namedattribute("fastmathFlags", fastmathFlags)) return IR.create_operation( "llvm.intr.fmuladd", @@ -3341,7 +3349,7 @@ function intr_trunc( _attributes = NamedAttribute[] !isnothing(res) && push!(_results, res) !isnothing(fastmathFlags) && - push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) + push!(_attributes, namedattribute("fastmathFlags", fastmathFlags)) return IR.create_operation( "llvm.intr.trunc", @@ -3588,7 +3596,7 @@ function intr_log10( _attributes = NamedAttribute[] !isnothing(res) && push!(_results, res) !isnothing(fastmathFlags) && - push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) + push!(_attributes, namedattribute("fastmathFlags", fastmathFlags)) return IR.create_operation( "llvm.intr.log10", @@ -3619,7 +3627,7 @@ function intr_log2( _attributes = NamedAttribute[] !isnothing(res) && push!(_results, res) !isnothing(fastmathFlags) && - push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) + push!(_attributes, namedattribute("fastmathFlags", fastmathFlags)) return IR.create_operation( "llvm.intr.log2", @@ -3650,7 +3658,7 @@ function intr_log( _attributes = NamedAttribute[] !isnothing(res) && push!(_results, res) !isnothing(fastmathFlags) && - push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) + push!(_attributes, namedattribute("fastmathFlags", fastmathFlags)) return IR.create_operation( "llvm.intr.log", @@ -3909,7 +3917,7 @@ function intr_maxnum( _attributes = NamedAttribute[] !isnothing(res) && push!(_results, res) !isnothing(fastmathFlags) && - push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) + push!(_attributes, namedattribute("fastmathFlags", fastmathFlags)) return IR.create_operation( "llvm.intr.maxnum", @@ -3941,7 +3949,7 @@ function intr_maximum( _attributes = NamedAttribute[] !isnothing(res) && push!(_results, res) !isnothing(fastmathFlags) && - push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) + push!(_attributes, namedattribute("fastmathFlags", fastmathFlags)) return IR.create_operation( "llvm.intr.maximum", @@ -3978,12 +3986,12 @@ function intr_memcpy_inline( namedattribute("len", len), namedattribute("isVolatile", isVolatile) ] !isnothing(access_groups) && - push!(attributes, namedattribute("access_groups", access_groups)) + push!(_attributes, namedattribute("access_groups", access_groups)) !isnothing(alias_scopes) && - push!(attributes, namedattribute("alias_scopes", 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)) + push!(_attributes, namedattribute("noalias_scopes", noalias_scopes)) + !isnothing(tbaa) && push!(_attributes, namedattribute("tbaa", tbaa)) return IR.create_operation( "llvm.intr.memcpy.inline", @@ -4018,12 +4026,12 @@ function intr_memcpy( _successors = Block[] _attributes = NamedAttribute[namedattribute("isVolatile", isVolatile),] !isnothing(access_groups) && - push!(attributes, namedattribute("access_groups", access_groups)) + push!(_attributes, namedattribute("access_groups", access_groups)) !isnothing(alias_scopes) && - push!(attributes, namedattribute("alias_scopes", 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)) + push!(_attributes, namedattribute("noalias_scopes", noalias_scopes)) + !isnothing(tbaa) && push!(_attributes, namedattribute("tbaa", tbaa)) return IR.create_operation( "llvm.intr.memcpy", @@ -4058,12 +4066,12 @@ function intr_memmove( _successors = Block[] _attributes = NamedAttribute[namedattribute("isVolatile", isVolatile),] !isnothing(access_groups) && - push!(attributes, namedattribute("access_groups", access_groups)) + push!(_attributes, namedattribute("access_groups", access_groups)) !isnothing(alias_scopes) && - push!(attributes, namedattribute("alias_scopes", 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)) + push!(_attributes, namedattribute("noalias_scopes", noalias_scopes)) + !isnothing(tbaa) && push!(_attributes, namedattribute("tbaa", tbaa)) return IR.create_operation( "llvm.intr.memmove", @@ -4098,12 +4106,12 @@ function intr_memset( _successors = Block[] _attributes = NamedAttribute[namedattribute("isVolatile", isVolatile),] !isnothing(access_groups) && - push!(attributes, namedattribute("access_groups", access_groups)) + push!(_attributes, namedattribute("access_groups", access_groups)) !isnothing(alias_scopes) && - push!(attributes, namedattribute("alias_scopes", 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)) + push!(_attributes, namedattribute("noalias_scopes", noalias_scopes)) + !isnothing(tbaa) && push!(_attributes, namedattribute("tbaa", tbaa)) return IR.create_operation( "llvm.intr.memset", @@ -4135,7 +4143,7 @@ function intr_minnum( _attributes = NamedAttribute[] !isnothing(res) && push!(_results, res) !isnothing(fastmathFlags) && - push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) + push!(_attributes, namedattribute("fastmathFlags", fastmathFlags)) return IR.create_operation( "llvm.intr.minnum", @@ -4167,7 +4175,7 @@ function intr_minimum( _attributes = NamedAttribute[] !isnothing(res) && push!(_results, res) !isnothing(fastmathFlags) && - push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) + push!(_attributes, namedattribute("fastmathFlags", fastmathFlags)) return IR.create_operation( "llvm.intr.minimum", @@ -4198,7 +4206,7 @@ function intr_nearbyint( _attributes = NamedAttribute[] !isnothing(res) && push!(_results, res) !isnothing(fastmathFlags) && - push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) + push!(_attributes, namedattribute("fastmathFlags", fastmathFlags)) return IR.create_operation( "llvm.intr.nearbyint", @@ -4248,7 +4256,7 @@ function intr_powi( _successors = Block[] _attributes = NamedAttribute[] !isnothing(fastmathFlags) && - push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) + push!(_attributes, namedattribute("fastmathFlags", fastmathFlags)) return IR.create_operation( "llvm.intr.powi", @@ -4280,7 +4288,7 @@ function intr_pow( _attributes = NamedAttribute[] !isnothing(res) && push!(_results, res) !isnothing(fastmathFlags) && - push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) + push!(_attributes, namedattribute("fastmathFlags", fastmathFlags)) return IR.create_operation( "llvm.intr.pow", @@ -4370,7 +4378,7 @@ function intr_rint( _attributes = NamedAttribute[] !isnothing(res) && push!(_results, res) !isnothing(fastmathFlags) && - push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) + push!(_attributes, namedattribute("fastmathFlags", fastmathFlags)) return IR.create_operation( "llvm.intr.rint", @@ -4401,7 +4409,7 @@ function intr_roundeven( _attributes = NamedAttribute[] !isnothing(res) && push!(_results, res) !isnothing(fastmathFlags) && - push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) + push!(_attributes, namedattribute("fastmathFlags", fastmathFlags)) return IR.create_operation( "llvm.intr.roundeven", @@ -4432,7 +4440,7 @@ function intr_round( _attributes = NamedAttribute[] !isnothing(res) && push!(_results, res) !isnothing(fastmathFlags) && - push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) + push!(_attributes, namedattribute("fastmathFlags", fastmathFlags)) return IR.create_operation( "llvm.intr.round", @@ -4694,7 +4702,7 @@ function intr_sin( _attributes = NamedAttribute[] !isnothing(res) && push!(_results, res) !isnothing(fastmathFlags) && - push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) + push!(_attributes, namedattribute("fastmathFlags", fastmathFlags)) return IR.create_operation( "llvm.intr.sin", @@ -4725,7 +4733,7 @@ function intr_sqrt( _attributes = NamedAttribute[] !isnothing(res) && push!(_results, res) !isnothing(fastmathFlags) && - push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) + push!(_attributes, namedattribute("fastmathFlags", fastmathFlags)) return IR.create_operation( "llvm.intr.sqrt", @@ -6755,7 +6763,7 @@ function intr_vector_reduce_fadd( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(reassoc) && push!(attributes, namedattribute("reassoc", reassoc)) + !isnothing(reassoc) && push!(_attributes, namedattribute("reassoc", reassoc)) return IR.create_operation( "llvm.intr.vector.reduce.fadd", @@ -6782,7 +6790,7 @@ function intr_vector_reduce_fmax( _successors = Block[] _attributes = NamedAttribute[] !isnothing(fastmathFlags) && - push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) + push!(_attributes, namedattribute("fastmathFlags", fastmathFlags)) return IR.create_operation( "llvm.intr.vector.reduce.fmax", @@ -6809,7 +6817,7 @@ function intr_vector_reduce_fmaximum( _successors = Block[] _attributes = NamedAttribute[] !isnothing(fastmathFlags) && - push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) + push!(_attributes, namedattribute("fastmathFlags", fastmathFlags)) return IR.create_operation( "llvm.intr.vector.reduce.fmaximum", @@ -6836,7 +6844,7 @@ function intr_vector_reduce_fmin( _successors = Block[] _attributes = NamedAttribute[] !isnothing(fastmathFlags) && - push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) + push!(_attributes, namedattribute("fastmathFlags", fastmathFlags)) return IR.create_operation( "llvm.intr.vector.reduce.fmin", @@ -6863,7 +6871,7 @@ function intr_vector_reduce_fminimum( _successors = Block[] _attributes = NamedAttribute[] !isnothing(fastmathFlags) && - push!(attributes, namedattribute("fastmathFlags", fastmathFlags)) + push!(_attributes, namedattribute("fastmathFlags", fastmathFlags)) return IR.create_operation( "llvm.intr.vector.reduce.fminimum", @@ -6889,7 +6897,7 @@ function intr_vector_reduce_fmul( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(reassoc) && push!(attributes, namedattribute("reassoc", reassoc)) + !isnothing(reassoc) && push!(_attributes, namedattribute("reassoc", reassoc)) return IR.create_operation( "llvm.intr.vector.reduce.fmul", @@ -7323,7 +7331,7 @@ function cp_async_shared_global( _attributes = NamedAttribute[ namedattribute("size", size), namedattribute("modifier", modifier) ] - !isnothing(cpSize) && push!(operands, cpSize) + !isnothing(cpSize) && push!(_operands, cpSize) return IR.create_operation( "nvvm.cp.async.shared.global", @@ -7901,16 +7909,16 @@ function mma_sync( namedattribute("layoutB", layoutB), ] push!( - attributes, + _attributes, operandsegmentsizes([length(operandA), length(operandB), length(operandC)]), ) - !isnothing(b1Op) && push!(attributes, namedattribute("b1Op", b1Op)) + !isnothing(b1Op) && push!(_attributes, namedattribute("b1Op", b1Op)) !isnothing(intOverflowBehavior) && - push!(attributes, namedattribute("intOverflowBehavior", intOverflowBehavior)) + push!(_attributes, namedattribute("intOverflowBehavior", intOverflowBehavior)) !isnothing(multiplicandAPtxType) && - push!(attributes, namedattribute("multiplicandAPtxType", multiplicandAPtxType)) + push!(_attributes, namedattribute("multiplicandAPtxType", multiplicandAPtxType)) !isnothing(multiplicandBPtxType) && - push!(attributes, namedattribute("multiplicandBPtxType", multiplicandBPtxType)) + push!(_attributes, namedattribute("multiplicandBPtxType", multiplicandBPtxType)) return IR.create_operation( "nvvm.mma.sync", @@ -7992,7 +8000,7 @@ function shfl_sync( _successors = Block[] _attributes = NamedAttribute[namedattribute("kind", kind),] !isnothing(return_value_and_is_valid) && push!( - attributes, + _attributes, namedattribute("return_value_and_is_valid", return_value_and_is_valid), ) diff --git a/src/Dialects/17/Linalg.jl b/src/Dialects/17/Linalg.jl index ebc0add8..03e1008d 100644 --- a/src/Dialects/17/Linalg.jl +++ b/src/Dialects/17/Linalg.jl @@ -155,7 +155,7 @@ function abs( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) return IR.create_operation( "linalg.abs", @@ -192,7 +192,7 @@ function add( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) return IR.create_operation( "linalg.add", @@ -224,7 +224,7 @@ function batch_matmul( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) return IR.create_operation( "linalg.batch_matmul", @@ -258,7 +258,7 @@ function batch_matmul_transpose_a( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) return IR.create_operation( "linalg.batch_matmul_transpose_a", @@ -292,7 +292,7 @@ function batch_matmul_transpose_b( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) return IR.create_operation( "linalg.batch_matmul_transpose_b", @@ -324,7 +324,7 @@ function batch_matvec( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) return IR.create_operation( "linalg.batch_matvec", @@ -358,7 +358,7 @@ function batch_reduce_matmul( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) return IR.create_operation( "linalg.batch_reduce_matmul", @@ -428,7 +428,7 @@ function ceil( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) return IR.create_operation( "linalg.ceil", @@ -466,9 +466,9 @@ function conv_1d_ncw_fcw( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.conv_1d_ncw_fcw", @@ -502,9 +502,9 @@ function conv_1d_nwc_wcf( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.conv_1d_nwc_wcf", @@ -536,7 +536,7 @@ function conv_1d( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) return IR.create_operation( "linalg.conv_1d", @@ -574,9 +574,9 @@ function conv_2d_nchw_fchw( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.conv_2d_nchw_fchw", @@ -614,9 +614,9 @@ function conv_2d_ngchw_fgchw( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.conv_2d_ngchw_fgchw", @@ -654,9 +654,9 @@ function conv_2d_nhwc_fhwc( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.conv_2d_nhwc_fhwc", @@ -694,9 +694,9 @@ function conv_2d_nhwc_hwcf( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.conv_2d_nhwc_hwcf", @@ -735,9 +735,9 @@ function conv_2d_nhwc_hwcf_q( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.conv_2d_nhwc_hwcf_q", @@ -769,7 +769,7 @@ function conv_2d( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) return IR.create_operation( "linalg.conv_2d", @@ -803,9 +803,9 @@ function conv_3d_ncdhw_fcdhw( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.conv_3d_ncdhw_fcdhw", @@ -839,9 +839,9 @@ function conv_3d_ndhwc_dhwcf( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.conv_3d_ndhwc_dhwcf", @@ -876,9 +876,9 @@ function conv_3d_ndhwc_dhwcf_q( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.conv_3d_ndhwc_dhwcf_q", @@ -910,7 +910,7 @@ function conv_3d( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) return IR.create_operation( "linalg.conv_3d", @@ -943,8 +943,8 @@ function copy( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(cast) && push!(attributes, namedattribute("cast", cast)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(cast) && push!(_attributes, namedattribute("cast", cast)) return IR.create_operation( "linalg.copy", @@ -979,9 +979,9 @@ function depthwise_conv_1d_ncw_cw( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.depthwise_conv_1d_ncw_cw", @@ -1016,9 +1016,9 @@ function depthwise_conv_1d_nwc_wc( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.depthwise_conv_1d_nwc_wc", @@ -1052,9 +1052,9 @@ function depthwise_conv_1d_nwc_wcm( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.depthwise_conv_1d_nwc_wcm", @@ -1089,9 +1089,9 @@ function depthwise_conv_2d_nchw_chw( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.depthwise_conv_2d_nchw_chw", @@ -1126,9 +1126,9 @@ function depthwise_conv_2d_nhwc_hwc( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.depthwise_conv_2d_nhwc_hwc", @@ -1162,9 +1162,9 @@ function depthwise_conv_2d_nhwc_hwc_q( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.depthwise_conv_2d_nhwc_hwc_q", @@ -1198,9 +1198,9 @@ function depthwise_conv_2d_nhwc_hwcm( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.depthwise_conv_2d_nhwc_hwcm", @@ -1234,9 +1234,9 @@ function depthwise_conv_2d_nhwc_hwcm_q( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.depthwise_conv_2d_nhwc_hwcm_q", @@ -1271,9 +1271,9 @@ function depthwise_conv_3d_ncdhw_cdhw( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.depthwise_conv_3d_ncdhw_cdhw", @@ -1308,9 +1308,9 @@ function depthwise_conv_3d_ndhwc_dhwc( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.depthwise_conv_3d_ndhwc_dhwc", @@ -1344,9 +1344,9 @@ function depthwise_conv_3d_ndhwc_dhwcm( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.depthwise_conv_3d_ndhwc_dhwcm", @@ -1385,7 +1385,7 @@ function div( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) return IR.create_operation( "linalg.div", @@ -1424,7 +1424,7 @@ function div_unsigned( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) return IR.create_operation( "linalg.div_unsigned", @@ -1456,7 +1456,7 @@ function dot( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) return IR.create_operation( "linalg.dot", @@ -1490,9 +1490,9 @@ function elemwise_binary( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(fun) && push!(attributes, namedattribute("fun", fun)) - !isnothing(cast) && push!(attributes, namedattribute("cast", cast)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(fun) && push!(_attributes, namedattribute("fun", fun)) + !isnothing(cast) && push!(_attributes, namedattribute("cast", cast)) return IR.create_operation( "linalg.elemwise_binary", @@ -1526,9 +1526,9 @@ function elemwise_unary( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(fun) && push!(attributes, namedattribute("fun", fun)) - !isnothing(cast) && push!(attributes, namedattribute("cast", cast)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(fun) && push!(_attributes, namedattribute("fun", fun)) + !isnothing(cast) && push!(_attributes, namedattribute("cast", cast)) return IR.create_operation( "linalg.elemwise_unary", @@ -1559,7 +1559,7 @@ function exp( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) return IR.create_operation( "linalg.exp", @@ -1592,7 +1592,7 @@ function fill( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) return IR.create_operation( "linalg.fill", @@ -1629,7 +1629,7 @@ function fill_rng_2d( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) return IR.create_operation( "linalg.fill_rng_2d", @@ -1660,7 +1660,7 @@ function floor( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) return IR.create_operation( "linalg.floor", @@ -1792,10 +1792,10 @@ function generic( namedattribute("indexing_maps", indexing_maps), namedattribute("iterator_types", iterator_types), ] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(doc) && push!(attributes, namedattribute("doc", doc)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(doc) && push!(_attributes, namedattribute("doc", doc)) !isnothing(library_call) && - push!(attributes, namedattribute("library_call", library_call)) + push!(_attributes, namedattribute("library_call", library_call)) return IR.create_operation( "linalg.generic", @@ -1826,7 +1826,7 @@ function log( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) return IR.create_operation( "linalg.log", @@ -1911,8 +1911,8 @@ function matmul( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(cast) && push!(attributes, namedattribute("cast", cast)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(cast) && push!(_attributes, namedattribute("cast", cast)) return IR.create_operation( "linalg.matmul", @@ -1947,8 +1947,8 @@ function matmul_transpose_a( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(cast) && push!(attributes, namedattribute("cast", cast)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(cast) && push!(_attributes, namedattribute("cast", cast)) return IR.create_operation( "linalg.matmul_transpose_a", @@ -1983,8 +1983,8 @@ function matmul_transpose_b( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(cast) && push!(attributes, namedattribute("cast", cast)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(cast) && push!(_attributes, namedattribute("cast", cast)) return IR.create_operation( "linalg.matmul_transpose_b", @@ -2016,7 +2016,7 @@ function matmul_unsigned( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) return IR.create_operation( "linalg.matmul_unsigned", @@ -2048,7 +2048,7 @@ function matvec( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) return IR.create_operation( "linalg.matvec", @@ -2085,7 +2085,7 @@ function max( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) return IR.create_operation( "linalg.max", @@ -2122,7 +2122,7 @@ function mmt4d( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) return IR.create_operation( "linalg.mmt4d", @@ -2159,7 +2159,7 @@ function mul( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) return IR.create_operation( "linalg.mul", @@ -2190,7 +2190,7 @@ function negf( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) return IR.create_operation( "linalg.negf", @@ -2224,9 +2224,9 @@ function pooling_nchw_max( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.pooling_nchw_max", @@ -2264,9 +2264,9 @@ function pooling_nchw_sum( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.pooling_nchw_sum", @@ -2300,9 +2300,9 @@ function pooling_ncw_max( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.pooling_ncw_max", @@ -2340,9 +2340,9 @@ function pooling_ncw_sum( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.pooling_ncw_sum", @@ -2376,9 +2376,9 @@ function pooling_ndhwc_max( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.pooling_ndhwc_max", @@ -2412,9 +2412,9 @@ function pooling_ndhwc_min( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.pooling_ndhwc_min", @@ -2448,9 +2448,9 @@ function pooling_ndhwc_sum( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.pooling_ndhwc_sum", @@ -2484,9 +2484,9 @@ function pooling_nhwc_max( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.pooling_nhwc_max", @@ -2520,9 +2520,9 @@ function pooling_nhwc_max_unsigned( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.pooling_nhwc_max_unsigned", @@ -2556,9 +2556,9 @@ function pooling_nhwc_min( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.pooling_nhwc_min", @@ -2592,9 +2592,9 @@ function pooling_nhwc_min_unsigned( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.pooling_nhwc_min_unsigned", @@ -2632,9 +2632,9 @@ function pooling_nhwc_sum( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.pooling_nhwc_sum", @@ -2668,9 +2668,9 @@ function pooling_nwc_max( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.pooling_nwc_max", @@ -2704,9 +2704,9 @@ function pooling_nwc_max_unsigned( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.pooling_nwc_max_unsigned", @@ -2740,9 +2740,9 @@ function pooling_nwc_min( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.pooling_nwc_min", @@ -2776,9 +2776,9 @@ function pooling_nwc_min_unsigned( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.pooling_nwc_min_unsigned", @@ -2816,9 +2816,9 @@ function pooling_nwc_sum( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) - !isnothing(strides) && push!(attributes, namedattribute("strides", strides)) - !isnothing(dilations) && push!(attributes, namedattribute("dilations", dilations)) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) + !isnothing(strides) && push!(_attributes, namedattribute("strides", strides)) + !isnothing(dilations) && push!(_attributes, namedattribute("dilations", dilations)) return IR.create_operation( "linalg.pooling_nwc_sum", @@ -2852,7 +2852,7 @@ function quantized_batch_matmul( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) return IR.create_operation( "linalg.quantized_batch_matmul", @@ -2886,7 +2886,7 @@ function quantized_matmul( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) return IR.create_operation( "linalg.quantized_matmul", @@ -2980,7 +2980,7 @@ function sub( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) return IR.create_operation( "linalg.sub", @@ -3055,7 +3055,7 @@ function vecmat( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(inputs), length(outputs)])) + push!(_attributes, operandsegmentsizes([length(inputs), length(outputs)])) return IR.create_operation( "linalg.vecmat", diff --git a/src/Dialects/17/MLProgram.jl b/src/Dialects/17/MLProgram.jl index c5851cfa..877a3cde 100644 --- a/src/Dialects/17/MLProgram.jl +++ b/src/Dialects/17/MLProgram.jl @@ -40,10 +40,10 @@ function func(; _attributes = NamedAttribute[ namedattribute("sym_name", sym_name), 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(arg_attrs) && push!(_attributes, namedattribute("arg_attrs", arg_attrs)) + !isnothing(res_attrs) && push!(_attributes, namedattribute("res_attrs", res_attrs)) !isnothing(sym_visibility) && - push!(attributes, namedattribute("sym_visibility", sym_visibility)) + push!(_attributes, namedattribute("sym_visibility", sym_visibility)) return IR.create_operation( "ml_program.func", @@ -219,10 +219,10 @@ function global_(; _attributes = NamedAttribute[ namedattribute("sym_name", sym_name), namedattribute("type", type) ] - !isnothing(is_mutable) && push!(attributes, namedattribute("is_mutable", is_mutable)) - !isnothing(value) && push!(attributes, namedattribute("value", value)) + !isnothing(is_mutable) && push!(_attributes, namedattribute("is_mutable", is_mutable)) + !isnothing(value) && push!(_attributes, namedattribute("value", value)) !isnothing(sym_visibility) && - push!(attributes, namedattribute("sym_visibility", sym_visibility)) + push!(_attributes, namedattribute("sym_visibility", sym_visibility)) return IR.create_operation( "ml_program.global", @@ -412,10 +412,10 @@ function subgraph(; _attributes = NamedAttribute[ namedattribute("sym_name", sym_name), 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(arg_attrs) && push!(_attributes, namedattribute("arg_attrs", arg_attrs)) + !isnothing(res_attrs) && push!(_attributes, namedattribute("res_attrs", res_attrs)) !isnothing(sym_visibility) && - push!(attributes, namedattribute("sym_visibility", sym_visibility)) + push!(_attributes, namedattribute("sym_visibility", sym_visibility)) return IR.create_operation( "ml_program.subgraph", diff --git a/src/Dialects/17/Math.jl b/src/Dialects/17/Math.jl index b449c462..a16123dc 100644 --- a/src/Dialects/17/Math.jl +++ b/src/Dialects/17/Math.jl @@ -30,7 +30,7 @@ function absf( _successors = Block[] _attributes = NamedAttribute[] !isnothing(result) && push!(_results, result) - !isnothing(fastmath) && push!(attributes, namedattribute("fastmath", fastmath)) + !isnothing(fastmath) && push!(_attributes, namedattribute("fastmath", fastmath)) return IR.create_operation( "math.absf", @@ -118,7 +118,7 @@ function atan2( _successors = Block[] _attributes = NamedAttribute[] !isnothing(result) && push!(_results, result) - !isnothing(fastmath) && push!(attributes, namedattribute("fastmath", fastmath)) + !isnothing(fastmath) && push!(_attributes, namedattribute("fastmath", fastmath)) return IR.create_operation( "math.atan2", @@ -164,7 +164,7 @@ function atan( _successors = Block[] _attributes = NamedAttribute[] !isnothing(result) && push!(_results, result) - !isnothing(fastmath) && push!(attributes, namedattribute("fastmath", fastmath)) + !isnothing(fastmath) && push!(_attributes, namedattribute("fastmath", fastmath)) return IR.create_operation( "math.atan", @@ -206,7 +206,7 @@ function cbrt( _successors = Block[] _attributes = NamedAttribute[] !isnothing(result) && push!(_results, result) - !isnothing(fastmath) && push!(attributes, namedattribute("fastmath", fastmath)) + !isnothing(fastmath) && push!(_attributes, namedattribute("fastmath", fastmath)) return IR.create_operation( "math.cbrt", @@ -252,7 +252,7 @@ function ceil( _successors = Block[] _attributes = NamedAttribute[] !isnothing(result) && push!(_results, result) - !isnothing(fastmath) && push!(attributes, namedattribute("fastmath", fastmath)) + !isnothing(fastmath) && push!(_attributes, namedattribute("fastmath", fastmath)) return IR.create_operation( "math.ceil", @@ -300,7 +300,7 @@ function copysign( _successors = Block[] _attributes = NamedAttribute[] !isnothing(result) && push!(_results, result) - !isnothing(fastmath) && push!(attributes, namedattribute("fastmath", fastmath)) + !isnothing(fastmath) && push!(_attributes, namedattribute("fastmath", fastmath)) return IR.create_operation( "math.copysign", @@ -346,7 +346,7 @@ function cos( _successors = Block[] _attributes = NamedAttribute[] !isnothing(result) && push!(_results, result) - !isnothing(fastmath) && push!(attributes, namedattribute("fastmath", fastmath)) + !isnothing(fastmath) && push!(_attributes, namedattribute("fastmath", fastmath)) return IR.create_operation( "math.cos", @@ -491,7 +491,7 @@ function erf( _successors = Block[] _attributes = NamedAttribute[] !isnothing(result) && push!(_results, result) - !isnothing(fastmath) && push!(attributes, namedattribute("fastmath", fastmath)) + !isnothing(fastmath) && push!(_attributes, namedattribute("fastmath", fastmath)) return IR.create_operation( "math.erf", @@ -537,7 +537,7 @@ function exp2( _successors = Block[] _attributes = NamedAttribute[] !isnothing(result) && push!(_results, result) - !isnothing(fastmath) && push!(attributes, namedattribute("fastmath", fastmath)) + !isnothing(fastmath) && push!(_attributes, namedattribute("fastmath", fastmath)) return IR.create_operation( "math.exp2", @@ -585,7 +585,7 @@ function expm1( _successors = Block[] _attributes = NamedAttribute[] !isnothing(result) && push!(_results, result) - !isnothing(fastmath) && push!(attributes, namedattribute("fastmath", fastmath)) + !isnothing(fastmath) && push!(_attributes, namedattribute("fastmath", fastmath)) return IR.create_operation( "math.expm1", @@ -631,7 +631,7 @@ function exp( _successors = Block[] _attributes = NamedAttribute[] !isnothing(result) && push!(_results, result) - !isnothing(fastmath) && push!(attributes, namedattribute("fastmath", fastmath)) + !isnothing(fastmath) && push!(_attributes, namedattribute("fastmath", fastmath)) return IR.create_operation( "math.exp", @@ -690,7 +690,7 @@ function fpowi( _successors = Block[] _attributes = NamedAttribute[] !isnothing(result) && push!(_results, result) - !isnothing(fastmath) && push!(attributes, namedattribute("fastmath", fastmath)) + !isnothing(fastmath) && push!(_attributes, namedattribute("fastmath", fastmath)) return IR.create_operation( "math.fpowi", @@ -736,7 +736,7 @@ function floor( _successors = Block[] _attributes = NamedAttribute[] !isnothing(result) && push!(_results, result) - !isnothing(fastmath) && push!(attributes, namedattribute("fastmath", fastmath)) + !isnothing(fastmath) && push!(_attributes, namedattribute("fastmath", fastmath)) return IR.create_operation( "math.floor", @@ -789,7 +789,7 @@ function fma( _successors = Block[] _attributes = NamedAttribute[] !isnothing(result) && push!(_results, result) - !isnothing(fastmath) && push!(attributes, namedattribute("fastmath", fastmath)) + !isnothing(fastmath) && push!(_attributes, namedattribute("fastmath", fastmath)) return IR.create_operation( "math.fma", @@ -871,7 +871,7 @@ function log10( _successors = Block[] _attributes = NamedAttribute[] !isnothing(result) && push!(_results, result) - !isnothing(fastmath) && push!(attributes, namedattribute("fastmath", fastmath)) + !isnothing(fastmath) && push!(_attributes, namedattribute("fastmath", fastmath)) return IR.create_operation( "math.log10", @@ -913,7 +913,7 @@ function log1p( _successors = Block[] _attributes = NamedAttribute[] !isnothing(result) && push!(_results, result) - !isnothing(fastmath) && push!(attributes, namedattribute("fastmath", fastmath)) + !isnothing(fastmath) && push!(_attributes, namedattribute("fastmath", fastmath)) return IR.create_operation( "math.log1p", @@ -953,7 +953,7 @@ function log2( _successors = Block[] _attributes = NamedAttribute[] !isnothing(result) && push!(_results, result) - !isnothing(fastmath) && push!(attributes, namedattribute("fastmath", fastmath)) + !isnothing(fastmath) && push!(_attributes, namedattribute("fastmath", fastmath)) return IR.create_operation( "math.log2", @@ -993,7 +993,7 @@ function log( _successors = Block[] _attributes = NamedAttribute[] !isnothing(result) && push!(_results, result) - !isnothing(fastmath) && push!(attributes, namedattribute("fastmath", fastmath)) + !isnothing(fastmath) && push!(_attributes, namedattribute("fastmath", fastmath)) return IR.create_operation( "math.log", @@ -1040,7 +1040,7 @@ function powf( _successors = Block[] _attributes = NamedAttribute[] !isnothing(result) && push!(_results, result) - !isnothing(fastmath) && push!(attributes, namedattribute("fastmath", fastmath)) + !isnothing(fastmath) && push!(_attributes, namedattribute("fastmath", fastmath)) return IR.create_operation( "math.powf", @@ -1089,7 +1089,7 @@ function roundeven( _successors = Block[] _attributes = NamedAttribute[] !isnothing(result) && push!(_results, result) - !isnothing(fastmath) && push!(attributes, namedattribute("fastmath", fastmath)) + !isnothing(fastmath) && push!(_attributes, namedattribute("fastmath", fastmath)) return IR.create_operation( "math.roundeven", @@ -1138,7 +1138,7 @@ function round( _successors = Block[] _attributes = NamedAttribute[] !isnothing(result) && push!(_results, result) - !isnothing(fastmath) && push!(attributes, namedattribute("fastmath", fastmath)) + !isnothing(fastmath) && push!(_attributes, namedattribute("fastmath", fastmath)) return IR.create_operation( "math.round", @@ -1178,7 +1178,7 @@ function rsqrt( _successors = Block[] _attributes = NamedAttribute[] !isnothing(result) && push!(_results, result) - !isnothing(fastmath) && push!(attributes, namedattribute("fastmath", fastmath)) + !isnothing(fastmath) && push!(_attributes, namedattribute("fastmath", fastmath)) return IR.create_operation( "math.rsqrt", @@ -1224,7 +1224,7 @@ function sin( _successors = Block[] _attributes = NamedAttribute[] !isnothing(result) && push!(_results, result) - !isnothing(fastmath) && push!(attributes, namedattribute("fastmath", fastmath)) + !isnothing(fastmath) && push!(_attributes, namedattribute("fastmath", fastmath)) return IR.create_operation( "math.sin", @@ -1264,7 +1264,7 @@ function sqrt( _successors = Block[] _attributes = NamedAttribute[] !isnothing(result) && push!(_results, result) - !isnothing(fastmath) && push!(attributes, namedattribute("fastmath", fastmath)) + !isnothing(fastmath) && push!(_attributes, namedattribute("fastmath", fastmath)) return IR.create_operation( "math.sqrt", @@ -1304,7 +1304,7 @@ function tan( _successors = Block[] _attributes = NamedAttribute[] !isnothing(result) && push!(_results, result) - !isnothing(fastmath) && push!(attributes, namedattribute("fastmath", fastmath)) + !isnothing(fastmath) && push!(_attributes, namedattribute("fastmath", fastmath)) return IR.create_operation( "math.tan", @@ -1344,7 +1344,7 @@ function tanh( _successors = Block[] _attributes = NamedAttribute[] !isnothing(result) && push!(_results, result) - !isnothing(fastmath) && push!(attributes, namedattribute("fastmath", fastmath)) + !isnothing(fastmath) && push!(_attributes, namedattribute("fastmath", fastmath)) return IR.create_operation( "math.tanh", @@ -1392,7 +1392,7 @@ function trunc( _successors = Block[] _attributes = NamedAttribute[] !isnothing(result) && push!(_results, result) - !isnothing(fastmath) && push!(attributes, namedattribute("fastmath", fastmath)) + !isnothing(fastmath) && push!(_attributes, namedattribute("fastmath", fastmath)) return IR.create_operation( "math.trunc", diff --git a/src/Dialects/17/MemRef.jl b/src/Dialects/17/MemRef.jl index 54824c85..79674e7f 100644 --- a/src/Dialects/17/MemRef.jl +++ b/src/Dialects/17/MemRef.jl @@ -54,16 +54,15 @@ function atomic_rmw( value::Value, memref::Value, indices::Vector{Value}; - result=nothing::Union{Nothing,IR.Type}, + result::IR.Type, kind, location=Location(), ) - _results = IR.Type[] + _results = IR.Type[result,] _operands = Value[value, memref, indices...] _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[namedattribute("kind", kind),] - !isnothing(result) && push!(_results, result) return IR.create_operation( "memref.atomic_rmw", @@ -72,8 +71,8 @@ function atomic_rmw( owned_regions=_owned_regions, successors=_successors, attributes=_attributes, - results=(length(_results) == 0 ? nothing : _results), - result_inference=(length(_results) == 0 ? true : false), + results=_results, + result_inference=false, ) end @@ -234,7 +233,8 @@ function load( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(nontemporal) && push!(attributes, namedattribute("nontemporal", nontemporal)) + !isnothing(nontemporal) && + push!(_attributes, namedattribute("nontemporal", nontemporal)) return IR.create_operation( "memref.load", @@ -301,8 +301,8 @@ function alloc( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(dynamicSizes), length(symbolOperands)])) - !isnothing(alignment) && push!(attributes, namedattribute("alignment", alignment)) + push!(_attributes, operandsegmentsizes([length(dynamicSizes), length(symbolOperands)])) + !isnothing(alignment) && push!(_attributes, namedattribute("alignment", alignment)) return IR.create_operation( "memref.alloc", @@ -365,8 +365,8 @@ function alloca( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(dynamicSizes), length(symbolOperands)])) - !isnothing(alignment) && push!(attributes, namedattribute("alignment", alignment)) + push!(_attributes, operandsegmentsizes([length(dynamicSizes), length(symbolOperands)])) + !isnothing(alignment) && push!(_attributes, namedattribute("alignment", alignment)) return IR.create_operation( "memref.alloca", @@ -1056,11 +1056,11 @@ function global_(; namedattribute("sym_name", sym_name), namedattribute("type", type) ] !isnothing(sym_visibility) && - push!(attributes, namedattribute("sym_visibility", sym_visibility)) + push!(_attributes, namedattribute("sym_visibility", sym_visibility)) !isnothing(initial_value) && - push!(attributes, namedattribute("initial_value", initial_value)) - !isnothing(constant) && push!(attributes, namedattribute("constant", constant)) - !isnothing(alignment) && push!(attributes, namedattribute("alignment", alignment)) + push!(_attributes, namedattribute("initial_value", initial_value)) + !isnothing(constant) && push!(_attributes, namedattribute("constant", constant)) + !isnothing(alignment) && push!(_attributes, namedattribute("alignment", alignment)) return IR.create_operation( "memref.global", @@ -1268,8 +1268,8 @@ function realloc( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(dynamicResultSize) && push!(operands, dynamicResultSize) - !isnothing(alignment) && push!(attributes, namedattribute("alignment", alignment)) + !isnothing(dynamicResultSize) && push!(_operands, dynamicResultSize) + !isnothing(alignment) && push!(_attributes, namedattribute("alignment", alignment)) return IR.create_operation( "memref.realloc", @@ -1342,7 +1342,7 @@ function reinterpret_cast( namedattribute("static_strides", static_strides), ] push!( - attributes, + _attributes, operandsegmentsizes([1, length(offsets), length(sizes), length(strides)]), ) @@ -1454,7 +1454,8 @@ function store( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(nontemporal) && push!(attributes, namedattribute("nontemporal", nontemporal)) + !isnothing(nontemporal) && + push!(_attributes, namedattribute("nontemporal", nontemporal)) return IR.create_operation( "memref.store", @@ -1717,7 +1718,7 @@ function subview( namedattribute("static_strides", static_strides), ] push!( - attributes, + _attributes, operandsegmentsizes([1, length(offsets), length(sizes), length(strides)]), ) diff --git a/src/Dialects/17/NVGPU.jl b/src/Dialects/17/NVGPU.jl index 5695d417..fdbfcc1c 100644 --- a/src/Dialects/17/NVGPU.jl +++ b/src/Dialects/17/NVGPU.jl @@ -70,14 +70,14 @@ function device_async_copy( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[namedattribute("dstElements", dstElements),] - !isnothing(srcElements) && push!(operands, srcElements) + !isnothing(srcElements) && push!(_operands, srcElements) push!( - attributes, + _attributes, operandsegmentsizes([ 1, length(dstIndices), 1, length(srcIndices), isnothing(srcElements) ? 0 : 1 ]), ) - !isnothing(bypassL1) && push!(attributes, namedattribute("bypassL1", bypassL1)) + !isnothing(bypassL1) && push!(_attributes, namedattribute("bypassL1", bypassL1)) return IR.create_operation( "nvgpu.device_async_copy", @@ -156,7 +156,7 @@ function device_async_wait(asyncDependencies::Value; numGroups=nothing, location _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(numGroups) && push!(attributes, namedattribute("numGroups", numGroups)) + !isnothing(numGroups) && push!(_attributes, namedattribute("numGroups", numGroups)) return IR.create_operation( "nvgpu.device_async_wait", @@ -490,8 +490,9 @@ function mma_sp_sync( _successors = Block[] _attributes = NamedAttribute[namedattribute("mmaShape", mmaShape),] !isnothing(sparsitySelector) && - push!(attributes, namedattribute("sparsitySelector", sparsitySelector)) - !isnothing(tf32Enabled) && push!(attributes, namedattribute("tf32Enabled", tf32Enabled)) + push!(_attributes, namedattribute("sparsitySelector", sparsitySelector)) + !isnothing(tf32Enabled) && + push!(_attributes, namedattribute("tf32Enabled", tf32Enabled)) return IR.create_operation( "nvgpu.mma.sp.sync", @@ -541,7 +542,8 @@ function mma_sync( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[namedattribute("mmaShape", mmaShape),] - !isnothing(tf32Enabled) && push!(attributes, namedattribute("tf32Enabled", tf32Enabled)) + !isnothing(tf32Enabled) && + push!(_attributes, namedattribute("tf32Enabled", tf32Enabled)) return IR.create_operation( "nvgpu.mma.sync", diff --git a/src/Dialects/17/OpenACC.jl b/src/Dialects/17/OpenACC.jl index d95eaf33..7b8c8dc7 100644 --- a/src/Dialects/17/OpenACC.jl +++ b/src/Dialects/17/OpenACC.jl @@ -42,14 +42,14 @@ function attach( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(varPtrPtr) && push!(operands, varPtrPtr) + !isnothing(varPtrPtr) && push!(_operands, varPtrPtr) push!( - attributes, operandsegmentsizes([1, isnothing(varPtrPtr) ? 0 : 1, length(bounds)]) + _attributes, operandsegmentsizes([1, isnothing(varPtrPtr) ? 0 : 1, length(bounds)]) ) - !isnothing(dataClause) && push!(attributes, namedattribute("dataClause", dataClause)) - !isnothing(structured) && push!(attributes, namedattribute("structured", structured)) - !isnothing(implicit) && push!(attributes, namedattribute("implicit", implicit)) - !isnothing(name) && push!(attributes, namedattribute("name", name)) + !isnothing(dataClause) && push!(_attributes, namedattribute("dataClause", dataClause)) + !isnothing(structured) && push!(_attributes, namedattribute("structured", structured)) + !isnothing(implicit) && push!(_attributes, namedattribute("implicit", implicit)) + !isnothing(name) && push!(_attributes, namedattribute("name", name)) return IR.create_operation( "acc.attach", @@ -101,14 +101,14 @@ function copyin( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(varPtrPtr) && push!(operands, varPtrPtr) + !isnothing(varPtrPtr) && push!(_operands, varPtrPtr) push!( - attributes, operandsegmentsizes([1, isnothing(varPtrPtr) ? 0 : 1, length(bounds)]) + _attributes, operandsegmentsizes([1, isnothing(varPtrPtr) ? 0 : 1, length(bounds)]) ) - !isnothing(dataClause) && push!(attributes, namedattribute("dataClause", dataClause)) - !isnothing(structured) && push!(attributes, namedattribute("structured", structured)) - !isnothing(implicit) && push!(attributes, namedattribute("implicit", implicit)) - !isnothing(name) && push!(attributes, namedattribute("name", name)) + !isnothing(dataClause) && push!(_attributes, namedattribute("dataClause", dataClause)) + !isnothing(structured) && push!(_attributes, namedattribute("structured", structured)) + !isnothing(implicit) && push!(_attributes, namedattribute("implicit", implicit)) + !isnothing(name) && push!(_attributes, namedattribute("name", name)) return IR.create_operation( "acc.copyin", @@ -158,12 +158,12 @@ function copyout( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(varPtr) && push!(operands, varPtr) - push!(attributes, operandsegmentsizes([1, isnothing(varPtr) ? 0 : 1, length(bounds)])) - !isnothing(dataClause) && push!(attributes, namedattribute("dataClause", dataClause)) - !isnothing(structured) && push!(attributes, namedattribute("structured", structured)) - !isnothing(implicit) && push!(attributes, namedattribute("implicit", implicit)) - !isnothing(name) && push!(attributes, namedattribute("name", name)) + !isnothing(varPtr) && push!(_operands, varPtr) + push!(_attributes, operandsegmentsizes([1, isnothing(varPtr) ? 0 : 1, length(bounds)])) + !isnothing(dataClause) && push!(_attributes, namedattribute("dataClause", dataClause)) + !isnothing(structured) && push!(_attributes, namedattribute("structured", structured)) + !isnothing(implicit) && push!(_attributes, namedattribute("implicit", implicit)) + !isnothing(name) && push!(_attributes, namedattribute("name", name)) return IR.create_operation( "acc.copyout", @@ -215,14 +215,14 @@ function create( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(varPtrPtr) && push!(operands, varPtrPtr) + !isnothing(varPtrPtr) && push!(_operands, varPtrPtr) push!( - attributes, operandsegmentsizes([1, isnothing(varPtrPtr) ? 0 : 1, length(bounds)]) + _attributes, operandsegmentsizes([1, isnothing(varPtrPtr) ? 0 : 1, length(bounds)]) ) - !isnothing(dataClause) && push!(attributes, namedattribute("dataClause", dataClause)) - !isnothing(structured) && push!(attributes, namedattribute("structured", structured)) - !isnothing(implicit) && push!(attributes, namedattribute("implicit", implicit)) - !isnothing(name) && push!(attributes, namedattribute("name", name)) + !isnothing(dataClause) && push!(_attributes, namedattribute("dataClause", dataClause)) + !isnothing(structured) && push!(_attributes, namedattribute("structured", structured)) + !isnothing(implicit) && push!(_attributes, namedattribute("implicit", implicit)) + !isnothing(name) && push!(_attributes, namedattribute("name", name)) return IR.create_operation( "acc.create", @@ -288,13 +288,13 @@ function bounds( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(lowerbound) && push!(operands, lowerbound) - !isnothing(upperbound) && push!(operands, upperbound) - !isnothing(extent) && push!(operands, extent) - !isnothing(stride) && push!(operands, stride) - !isnothing(startIdx) && push!(operands, startIdx) + !isnothing(lowerbound) && push!(_operands, lowerbound) + !isnothing(upperbound) && push!(_operands, upperbound) + !isnothing(extent) && push!(_operands, extent) + !isnothing(stride) && push!(_operands, stride) + !isnothing(startIdx) && push!(_operands, startIdx) push!( - attributes, + _attributes, operandsegmentsizes([ isnothing(lowerbound) ? 0 : 1, isnothing(upperbound) ? 0 : 1, @@ -304,7 +304,7 @@ function bounds( ]), ) !isnothing(strideInBytes) && - push!(attributes, namedattribute("strideInBytes", strideInBytes)) + push!(_attributes, namedattribute("strideInBytes", strideInBytes)) return IR.create_operation( "acc.bounds", @@ -353,11 +353,11 @@ function data( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(ifCond) && push!(operands, ifCond) - !isnothing(async) && push!(operands, async) - !isnothing(waitDevnum) && push!(operands, waitDevnum) + !isnothing(ifCond) && push!(_operands, ifCond) + !isnothing(async) && push!(_operands, async) + !isnothing(waitDevnum) && push!(_operands, waitDevnum) push!( - attributes, + _attributes, operandsegmentsizes([ isnothing(ifCond) ? 0 : 1, isnothing(async) ? 0 : 1, @@ -366,9 +366,10 @@ function data( length(dataClauseOperands), ]), ) - !isnothing(asyncAttr) && push!(attributes, namedattribute("asyncAttr", asyncAttr)) - !isnothing(waitAttr) && push!(attributes, namedattribute("waitAttr", waitAttr)) - !isnothing(defaultAttr) && push!(attributes, namedattribute("defaultAttr", defaultAttr)) + !isnothing(asyncAttr) && push!(_attributes, namedattribute("asyncAttr", asyncAttr)) + !isnothing(waitAttr) && push!(_attributes, namedattribute("waitAttr", waitAttr)) + !isnothing(defaultAttr) && + push!(_attributes, namedattribute("defaultAttr", defaultAttr)) return IR.create_operation( "acc.data", @@ -420,14 +421,14 @@ function declare_device_resident( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(varPtrPtr) && push!(operands, varPtrPtr) + !isnothing(varPtrPtr) && push!(_operands, varPtrPtr) push!( - attributes, operandsegmentsizes([1, isnothing(varPtrPtr) ? 0 : 1, length(bounds)]) + _attributes, operandsegmentsizes([1, isnothing(varPtrPtr) ? 0 : 1, length(bounds)]) ) - !isnothing(dataClause) && push!(attributes, namedattribute("dataClause", dataClause)) - !isnothing(structured) && push!(attributes, namedattribute("structured", structured)) - !isnothing(implicit) && push!(attributes, namedattribute("implicit", implicit)) - !isnothing(name) && push!(attributes, namedattribute("name", name)) + !isnothing(dataClause) && push!(_attributes, namedattribute("dataClause", dataClause)) + !isnothing(structured) && push!(_attributes, namedattribute("structured", structured)) + !isnothing(implicit) && push!(_attributes, namedattribute("implicit", implicit)) + !isnothing(name) && push!(_attributes, namedattribute("name", name)) return IR.create_operation( "acc.declare_device_resident", @@ -546,14 +547,14 @@ function declare_link( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(varPtrPtr) && push!(operands, varPtrPtr) + !isnothing(varPtrPtr) && push!(_operands, varPtrPtr) push!( - attributes, operandsegmentsizes([1, isnothing(varPtrPtr) ? 0 : 1, length(bounds)]) + _attributes, operandsegmentsizes([1, isnothing(varPtrPtr) ? 0 : 1, length(bounds)]) ) - !isnothing(dataClause) && push!(attributes, namedattribute("dataClause", dataClause)) - !isnothing(structured) && push!(attributes, namedattribute("structured", structured)) - !isnothing(implicit) && push!(attributes, namedattribute("implicit", implicit)) - !isnothing(name) && push!(attributes, namedattribute("name", name)) + !isnothing(dataClause) && push!(_attributes, namedattribute("dataClause", dataClause)) + !isnothing(structured) && push!(_attributes, namedattribute("structured", structured)) + !isnothing(implicit) && push!(_attributes, namedattribute("implicit", implicit)) + !isnothing(name) && push!(_attributes, namedattribute("name", name)) return IR.create_operation( "acc.declare_link", @@ -603,12 +604,12 @@ function delete( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(varPtr) && push!(operands, varPtr) - push!(attributes, operandsegmentsizes([1, isnothing(varPtr) ? 0 : 1, length(bounds)])) - !isnothing(dataClause) && push!(attributes, namedattribute("dataClause", dataClause)) - !isnothing(structured) && push!(attributes, namedattribute("structured", structured)) - !isnothing(implicit) && push!(attributes, namedattribute("implicit", implicit)) - !isnothing(name) && push!(attributes, namedattribute("name", name)) + !isnothing(varPtr) && push!(_operands, varPtr) + push!(_attributes, operandsegmentsizes([1, isnothing(varPtr) ? 0 : 1, length(bounds)])) + !isnothing(dataClause) && push!(_attributes, namedattribute("dataClause", dataClause)) + !isnothing(structured) && push!(_attributes, namedattribute("structured", structured)) + !isnothing(implicit) && push!(_attributes, namedattribute("implicit", implicit)) + !isnothing(name) && push!(_attributes, namedattribute("name", name)) return IR.create_operation( "acc.delete", @@ -658,12 +659,12 @@ function detach( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(varPtr) && push!(operands, varPtr) - push!(attributes, operandsegmentsizes([1, isnothing(varPtr) ? 0 : 1, length(bounds)])) - !isnothing(dataClause) && push!(attributes, namedattribute("dataClause", dataClause)) - !isnothing(structured) && push!(attributes, namedattribute("structured", structured)) - !isnothing(implicit) && push!(attributes, namedattribute("implicit", implicit)) - !isnothing(name) && push!(attributes, namedattribute("name", name)) + !isnothing(varPtr) && push!(_operands, varPtr) + push!(_attributes, operandsegmentsizes([1, isnothing(varPtr) ? 0 : 1, length(bounds)])) + !isnothing(dataClause) && push!(_attributes, namedattribute("dataClause", dataClause)) + !isnothing(structured) && push!(_attributes, namedattribute("structured", structured)) + !isnothing(implicit) && push!(_attributes, namedattribute("implicit", implicit)) + !isnothing(name) && push!(_attributes, namedattribute("name", name)) return IR.create_operation( "acc.detach", @@ -715,14 +716,14 @@ function deviceptr( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(varPtrPtr) && push!(operands, varPtrPtr) + !isnothing(varPtrPtr) && push!(_operands, varPtrPtr) push!( - attributes, operandsegmentsizes([1, isnothing(varPtrPtr) ? 0 : 1, length(bounds)]) + _attributes, operandsegmentsizes([1, isnothing(varPtrPtr) ? 0 : 1, length(bounds)]) ) - !isnothing(dataClause) && push!(attributes, namedattribute("dataClause", dataClause)) - !isnothing(structured) && push!(attributes, namedattribute("structured", structured)) - !isnothing(implicit) && push!(attributes, namedattribute("implicit", implicit)) - !isnothing(name) && push!(attributes, namedattribute("name", name)) + !isnothing(dataClause) && push!(_attributes, namedattribute("dataClause", dataClause)) + !isnothing(structured) && push!(_attributes, namedattribute("structured", structured)) + !isnothing(implicit) && push!(_attributes, namedattribute("implicit", implicit)) + !isnothing(name) && push!(_attributes, namedattribute("name", name)) return IR.create_operation( "acc.deviceptr", @@ -762,11 +763,11 @@ function enter_data( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(ifCond) && push!(operands, ifCond) - !isnothing(asyncOperand) && push!(operands, asyncOperand) - !isnothing(waitDevnum) && push!(operands, waitDevnum) + !isnothing(ifCond) && push!(_operands, ifCond) + !isnothing(asyncOperand) && push!(_operands, asyncOperand) + !isnothing(waitDevnum) && push!(_operands, waitDevnum) push!( - attributes, + _attributes, operandsegmentsizes([ isnothing(ifCond) ? 0 : 1, isnothing(asyncOperand) ? 0 : 1, @@ -775,8 +776,8 @@ function enter_data( length(dataClauseOperands), ]), ) - !isnothing(async) && push!(attributes, namedattribute("async", async)) - !isnothing(wait) && push!(attributes, namedattribute("wait", wait)) + !isnothing(async) && push!(_attributes, namedattribute("async", async)) + !isnothing(wait) && push!(_attributes, namedattribute("wait", wait)) return IR.create_operation( "acc.enter_data", @@ -817,11 +818,11 @@ function exit_data( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(ifCond) && push!(operands, ifCond) - !isnothing(asyncOperand) && push!(operands, asyncOperand) - !isnothing(waitDevnum) && push!(operands, waitDevnum) + !isnothing(ifCond) && push!(_operands, ifCond) + !isnothing(asyncOperand) && push!(_operands, asyncOperand) + !isnothing(waitDevnum) && push!(_operands, waitDevnum) push!( - attributes, + _attributes, operandsegmentsizes([ isnothing(ifCond) ? 0 : 1, isnothing(asyncOperand) ? 0 : 1, @@ -830,9 +831,9 @@ function exit_data( length(dataClauseOperands), ]), ) - !isnothing(async) && push!(attributes, namedattribute("async", async)) - !isnothing(wait) && push!(attributes, namedattribute("wait", wait)) - !isnothing(finalize) && push!(attributes, namedattribute("finalize", finalize)) + !isnothing(async) && push!(_attributes, namedattribute("async", async)) + !isnothing(wait) && push!(_attributes, namedattribute("wait", wait)) + !isnothing(finalize) && push!(_attributes, namedattribute("finalize", finalize)) return IR.create_operation( "acc.exit_data", @@ -884,14 +885,14 @@ function firstprivate( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(varPtrPtr) && push!(operands, varPtrPtr) + !isnothing(varPtrPtr) && push!(_operands, varPtrPtr) push!( - attributes, operandsegmentsizes([1, isnothing(varPtrPtr) ? 0 : 1, length(bounds)]) + _attributes, operandsegmentsizes([1, isnothing(varPtrPtr) ? 0 : 1, length(bounds)]) ) - !isnothing(dataClause) && push!(attributes, namedattribute("dataClause", dataClause)) - !isnothing(structured) && push!(attributes, namedattribute("structured", structured)) - !isnothing(implicit) && push!(attributes, namedattribute("implicit", implicit)) - !isnothing(name) && push!(attributes, namedattribute("name", name)) + !isnothing(dataClause) && push!(_attributes, namedattribute("dataClause", dataClause)) + !isnothing(structured) && push!(_attributes, namedattribute("structured", structured)) + !isnothing(implicit) && push!(_attributes, namedattribute("implicit", implicit)) + !isnothing(name) && push!(_attributes, namedattribute("name", name)) return IR.create_operation( "acc.firstprivate", @@ -1021,14 +1022,14 @@ function getdeviceptr( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(varPtrPtr) && push!(operands, varPtrPtr) + !isnothing(varPtrPtr) && push!(_operands, varPtrPtr) push!( - attributes, operandsegmentsizes([1, isnothing(varPtrPtr) ? 0 : 1, length(bounds)]) + _attributes, operandsegmentsizes([1, isnothing(varPtrPtr) ? 0 : 1, length(bounds)]) ) - !isnothing(dataClause) && push!(attributes, namedattribute("dataClause", dataClause)) - !isnothing(structured) && push!(attributes, namedattribute("structured", structured)) - !isnothing(implicit) && push!(attributes, namedattribute("implicit", implicit)) - !isnothing(name) && push!(attributes, namedattribute("name", name)) + !isnothing(dataClause) && push!(_attributes, namedattribute("dataClause", dataClause)) + !isnothing(structured) && push!(_attributes, namedattribute("structured", structured)) + !isnothing(implicit) && push!(_attributes, namedattribute("implicit", implicit)) + !isnothing(name) && push!(_attributes, namedattribute("name", name)) return IR.create_operation( "acc.getdeviceptr", @@ -1149,12 +1150,12 @@ function host_data( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(ifCond) && push!(operands, ifCond) + !isnothing(ifCond) && push!(_operands, ifCond) push!( - attributes, + _attributes, operandsegmentsizes([isnothing(ifCond) ? 0 : 1, length(dataClauseOperands)]), ) - !isnothing(ifPresent) && push!(attributes, namedattribute("ifPresent", ifPresent)) + !isnothing(ifPresent) && push!(_attributes, namedattribute("ifPresent", ifPresent)) return IR.create_operation( "acc.host_data", @@ -1192,10 +1193,10 @@ function init( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(deviceNumOperand) && push!(operands, deviceNumOperand) - !isnothing(ifCond) && push!(operands, ifCond) + !isnothing(deviceNumOperand) && push!(_operands, deviceNumOperand) + !isnothing(ifCond) && push!(_operands, ifCond) push!( - attributes, + _attributes, operandsegmentsizes([ length(deviceTypeOperands), isnothing(deviceNumOperand) ? 0 : 1, @@ -1252,13 +1253,13 @@ function kernels( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(async) && push!(operands, async) - !isnothing(numWorkers) && push!(operands, numWorkers) - !isnothing(vectorLength) && push!(operands, vectorLength) - !isnothing(ifCond) && push!(operands, ifCond) - !isnothing(selfCond) && push!(operands, selfCond) + !isnothing(async) && push!(_operands, async) + !isnothing(numWorkers) && push!(_operands, numWorkers) + !isnothing(vectorLength) && push!(_operands, vectorLength) + !isnothing(ifCond) && push!(_operands, ifCond) + !isnothing(selfCond) && push!(_operands, selfCond) push!( - attributes, + _attributes, operandsegmentsizes([ isnothing(async) ? 0 : 1, length(waitOperands), @@ -1270,10 +1271,11 @@ function kernels( length(dataClauseOperands), ]), ) - !isnothing(asyncAttr) && push!(attributes, namedattribute("asyncAttr", asyncAttr)) - !isnothing(waitAttr) && push!(attributes, namedattribute("waitAttr", waitAttr)) - !isnothing(selfAttr) && push!(attributes, namedattribute("selfAttr", selfAttr)) - !isnothing(defaultAttr) && push!(attributes, namedattribute("defaultAttr", defaultAttr)) + !isnothing(asyncAttr) && push!(_attributes, namedattribute("asyncAttr", asyncAttr)) + !isnothing(waitAttr) && push!(_attributes, namedattribute("waitAttr", waitAttr)) + !isnothing(selfAttr) && push!(_attributes, namedattribute("selfAttr", selfAttr)) + !isnothing(defaultAttr) && + push!(_attributes, namedattribute("defaultAttr", defaultAttr)) return IR.create_operation( "acc.kernels", @@ -1334,13 +1336,13 @@ function loop( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(gangNum) && push!(operands, gangNum) - !isnothing(gangDim) && push!(operands, gangDim) - !isnothing(gangStatic) && push!(operands, gangStatic) - !isnothing(workerNum) && push!(operands, workerNum) - !isnothing(vectorLength) && push!(operands, vectorLength) + !isnothing(gangNum) && push!(_operands, gangNum) + !isnothing(gangDim) && push!(_operands, gangDim) + !isnothing(gangStatic) && push!(_operands, gangStatic) + !isnothing(workerNum) && push!(_operands, workerNum) + !isnothing(vectorLength) && push!(_operands, vectorLength) push!( - attributes, + _attributes, operandsegmentsizes([ isnothing(gangNum) ? 0 : 1, isnothing(gangDim) ? 0 : 1, @@ -1352,17 +1354,18 @@ function loop( length(reductionOperands), ]), ) - !isnothing(collapse) && push!(attributes, namedattribute("collapse", collapse)) - !isnothing(seq) && push!(attributes, namedattribute("seq", seq)) - !isnothing(independent) && push!(attributes, namedattribute("independent", independent)) - !isnothing(auto_) && push!(attributes, namedattribute("auto_", auto_)) - !isnothing(hasGang) && push!(attributes, namedattribute("hasGang", hasGang)) - !isnothing(hasWorker) && push!(attributes, namedattribute("hasWorker", hasWorker)) - !isnothing(hasVector) && push!(attributes, namedattribute("hasVector", hasVector)) + !isnothing(collapse) && push!(_attributes, namedattribute("collapse", collapse)) + !isnothing(seq) && push!(_attributes, namedattribute("seq", seq)) + !isnothing(independent) && + push!(_attributes, namedattribute("independent", independent)) + !isnothing(auto_) && push!(_attributes, namedattribute("auto_", auto_)) + !isnothing(hasGang) && push!(_attributes, namedattribute("hasGang", hasGang)) + !isnothing(hasWorker) && push!(_attributes, namedattribute("hasWorker", hasWorker)) + !isnothing(hasVector) && push!(_attributes, namedattribute("hasVector", hasVector)) !isnothing(privatizations) && - push!(attributes, namedattribute("privatizations", privatizations)) + push!(_attributes, namedattribute("privatizations", privatizations)) !isnothing(reductionRecipes) && - push!(attributes, namedattribute("reductionRecipes", reductionRecipes)) + push!(_attributes, namedattribute("reductionRecipes", reductionRecipes)) return IR.create_operation( "acc.loop", @@ -1414,14 +1417,14 @@ function nocreate( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(varPtrPtr) && push!(operands, varPtrPtr) + !isnothing(varPtrPtr) && push!(_operands, varPtrPtr) push!( - attributes, operandsegmentsizes([1, isnothing(varPtrPtr) ? 0 : 1, length(bounds)]) + _attributes, operandsegmentsizes([1, isnothing(varPtrPtr) ? 0 : 1, length(bounds)]) ) - !isnothing(dataClause) && push!(attributes, namedattribute("dataClause", dataClause)) - !isnothing(structured) && push!(attributes, namedattribute("structured", structured)) - !isnothing(implicit) && push!(attributes, namedattribute("implicit", implicit)) - !isnothing(name) && push!(attributes, namedattribute("name", name)) + !isnothing(dataClause) && push!(_attributes, namedattribute("dataClause", dataClause)) + !isnothing(structured) && push!(_attributes, namedattribute("structured", structured)) + !isnothing(implicit) && push!(_attributes, namedattribute("implicit", implicit)) + !isnothing(name) && push!(_attributes, namedattribute("name", name)) return IR.create_operation( "acc.nocreate", @@ -1484,13 +1487,13 @@ function parallel( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(async) && push!(operands, async) - !isnothing(numWorkers) && push!(operands, numWorkers) - !isnothing(vectorLength) && push!(operands, vectorLength) - !isnothing(ifCond) && push!(operands, ifCond) - !isnothing(selfCond) && push!(operands, selfCond) + !isnothing(async) && push!(_operands, async) + !isnothing(numWorkers) && push!(_operands, numWorkers) + !isnothing(vectorLength) && push!(_operands, vectorLength) + !isnothing(ifCond) && push!(_operands, ifCond) + !isnothing(selfCond) && push!(_operands, selfCond) push!( - attributes, + _attributes, operandsegmentsizes([ isnothing(async) ? 0 : 1, length(waitOperands), @@ -1505,16 +1508,17 @@ function parallel( length(dataClauseOperands), ]), ) - !isnothing(asyncAttr) && push!(attributes, namedattribute("asyncAttr", asyncAttr)) - !isnothing(waitAttr) && push!(attributes, namedattribute("waitAttr", waitAttr)) - !isnothing(selfAttr) && push!(attributes, namedattribute("selfAttr", selfAttr)) + !isnothing(asyncAttr) && push!(_attributes, namedattribute("asyncAttr", asyncAttr)) + !isnothing(waitAttr) && push!(_attributes, namedattribute("waitAttr", waitAttr)) + !isnothing(selfAttr) && push!(_attributes, namedattribute("selfAttr", selfAttr)) !isnothing(reductionRecipes) && - push!(attributes, namedattribute("reductionRecipes", reductionRecipes)) + push!(_attributes, namedattribute("reductionRecipes", reductionRecipes)) !isnothing(privatizations) && - push!(attributes, namedattribute("privatizations", privatizations)) + push!(_attributes, namedattribute("privatizations", privatizations)) !isnothing(firstprivatizations) && - push!(attributes, namedattribute("firstprivatizations", firstprivatizations)) - !isnothing(defaultAttr) && push!(attributes, namedattribute("defaultAttr", defaultAttr)) + push!(_attributes, namedattribute("firstprivatizations", firstprivatizations)) + !isnothing(defaultAttr) && + push!(_attributes, namedattribute("defaultAttr", defaultAttr)) return IR.create_operation( "acc.parallel", @@ -1566,14 +1570,14 @@ function present( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(varPtrPtr) && push!(operands, varPtrPtr) + !isnothing(varPtrPtr) && push!(_operands, varPtrPtr) push!( - attributes, operandsegmentsizes([1, isnothing(varPtrPtr) ? 0 : 1, length(bounds)]) + _attributes, operandsegmentsizes([1, isnothing(varPtrPtr) ? 0 : 1, length(bounds)]) ) - !isnothing(dataClause) && push!(attributes, namedattribute("dataClause", dataClause)) - !isnothing(structured) && push!(attributes, namedattribute("structured", structured)) - !isnothing(implicit) && push!(attributes, namedattribute("implicit", implicit)) - !isnothing(name) && push!(attributes, namedattribute("name", name)) + !isnothing(dataClause) && push!(_attributes, namedattribute("dataClause", dataClause)) + !isnothing(structured) && push!(_attributes, namedattribute("structured", structured)) + !isnothing(implicit) && push!(_attributes, namedattribute("implicit", implicit)) + !isnothing(name) && push!(_attributes, namedattribute("name", name)) return IR.create_operation( "acc.present", @@ -1625,14 +1629,14 @@ function private( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(varPtrPtr) && push!(operands, varPtrPtr) + !isnothing(varPtrPtr) && push!(_operands, varPtrPtr) push!( - attributes, operandsegmentsizes([1, isnothing(varPtrPtr) ? 0 : 1, length(bounds)]) + _attributes, operandsegmentsizes([1, isnothing(varPtrPtr) ? 0 : 1, length(bounds)]) ) - !isnothing(dataClause) && push!(attributes, namedattribute("dataClause", dataClause)) - !isnothing(structured) && push!(attributes, namedattribute("structured", structured)) - !isnothing(implicit) && push!(attributes, namedattribute("implicit", implicit)) - !isnothing(name) && push!(attributes, namedattribute("name", name)) + !isnothing(dataClause) && push!(_attributes, namedattribute("dataClause", dataClause)) + !isnothing(structured) && push!(_attributes, namedattribute("structured", structured)) + !isnothing(implicit) && push!(_attributes, namedattribute("implicit", implicit)) + !isnothing(name) && push!(_attributes, namedattribute("name", name)) return IR.create_operation( "acc.private", @@ -1743,14 +1747,14 @@ function reduction( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(varPtrPtr) && push!(operands, varPtrPtr) + !isnothing(varPtrPtr) && push!(_operands, varPtrPtr) push!( - attributes, operandsegmentsizes([1, isnothing(varPtrPtr) ? 0 : 1, length(bounds)]) + _attributes, operandsegmentsizes([1, isnothing(varPtrPtr) ? 0 : 1, length(bounds)]) ) - !isnothing(dataClause) && push!(attributes, namedattribute("dataClause", dataClause)) - !isnothing(structured) && push!(attributes, namedattribute("structured", structured)) - !isnothing(implicit) && push!(attributes, namedattribute("implicit", implicit)) - !isnothing(name) && push!(attributes, namedattribute("name", name)) + !isnothing(dataClause) && push!(_attributes, namedattribute("dataClause", dataClause)) + !isnothing(structured) && push!(_attributes, namedattribute("structured", structured)) + !isnothing(implicit) && push!(_attributes, namedattribute("implicit", implicit)) + !isnothing(name) && push!(_attributes, namedattribute("name", name)) return IR.create_operation( "acc.reduction", @@ -1896,11 +1900,11 @@ function serial( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(async) && push!(operands, async) - !isnothing(ifCond) && push!(operands, ifCond) - !isnothing(selfCond) && push!(operands, selfCond) + !isnothing(async) && push!(_operands, async) + !isnothing(ifCond) && push!(_operands, ifCond) + !isnothing(selfCond) && push!(_operands, selfCond) push!( - attributes, + _attributes, operandsegmentsizes([ isnothing(async) ? 0 : 1, length(waitOperands), @@ -1912,16 +1916,17 @@ function serial( length(dataClauseOperands), ]), ) - !isnothing(asyncAttr) && push!(attributes, namedattribute("asyncAttr", asyncAttr)) - !isnothing(waitAttr) && push!(attributes, namedattribute("waitAttr", waitAttr)) - !isnothing(selfAttr) && push!(attributes, namedattribute("selfAttr", selfAttr)) + !isnothing(asyncAttr) && push!(_attributes, namedattribute("asyncAttr", asyncAttr)) + !isnothing(waitAttr) && push!(_attributes, namedattribute("waitAttr", waitAttr)) + !isnothing(selfAttr) && push!(_attributes, namedattribute("selfAttr", selfAttr)) !isnothing(reductionRecipes) && - push!(attributes, namedattribute("reductionRecipes", reductionRecipes)) + push!(_attributes, namedattribute("reductionRecipes", reductionRecipes)) !isnothing(privatizations) && - push!(attributes, namedattribute("privatizations", privatizations)) + push!(_attributes, namedattribute("privatizations", privatizations)) !isnothing(firstprivatizations) && - push!(attributes, namedattribute("firstprivatizations", firstprivatizations)) - !isnothing(defaultAttr) && push!(attributes, namedattribute("defaultAttr", defaultAttr)) + push!(_attributes, namedattribute("firstprivatizations", firstprivatizations)) + !isnothing(defaultAttr) && + push!(_attributes, namedattribute("defaultAttr", defaultAttr)) return IR.create_operation( "acc.serial", @@ -1959,10 +1964,10 @@ function shutdown( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(deviceNumOperand) && push!(operands, deviceNumOperand) - !isnothing(ifCond) && push!(operands, ifCond) + !isnothing(deviceNumOperand) && push!(_operands, deviceNumOperand) + !isnothing(ifCond) && push!(_operands, ifCond) push!( - attributes, + _attributes, operandsegmentsizes([ length(deviceTypeOperands), isnothing(deviceNumOperand) ? 0 : 1, @@ -2047,14 +2052,14 @@ function update_device( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(varPtrPtr) && push!(operands, varPtrPtr) + !isnothing(varPtrPtr) && push!(_operands, varPtrPtr) push!( - attributes, operandsegmentsizes([1, isnothing(varPtrPtr) ? 0 : 1, length(bounds)]) + _attributes, operandsegmentsizes([1, isnothing(varPtrPtr) ? 0 : 1, length(bounds)]) ) - !isnothing(dataClause) && push!(attributes, namedattribute("dataClause", dataClause)) - !isnothing(structured) && push!(attributes, namedattribute("structured", structured)) - !isnothing(implicit) && push!(attributes, namedattribute("implicit", implicit)) - !isnothing(name) && push!(attributes, namedattribute("name", name)) + !isnothing(dataClause) && push!(_attributes, namedattribute("dataClause", dataClause)) + !isnothing(structured) && push!(_attributes, namedattribute("structured", structured)) + !isnothing(implicit) && push!(_attributes, namedattribute("implicit", implicit)) + !isnothing(name) && push!(_attributes, namedattribute("name", name)) return IR.create_operation( "acc.update_device", @@ -2104,12 +2109,12 @@ function update_host( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(varPtr) && push!(operands, varPtr) - push!(attributes, operandsegmentsizes([1, isnothing(varPtr) ? 0 : 1, length(bounds)])) - !isnothing(dataClause) && push!(attributes, namedattribute("dataClause", dataClause)) - !isnothing(structured) && push!(attributes, namedattribute("structured", structured)) - !isnothing(implicit) && push!(attributes, namedattribute("implicit", implicit)) - !isnothing(name) && push!(attributes, namedattribute("name", name)) + !isnothing(varPtr) && push!(_operands, varPtr) + push!(_attributes, operandsegmentsizes([1, isnothing(varPtr) ? 0 : 1, length(bounds)])) + !isnothing(dataClause) && push!(_attributes, namedattribute("dataClause", dataClause)) + !isnothing(structured) && push!(_attributes, namedattribute("structured", structured)) + !isnothing(implicit) && push!(_attributes, namedattribute("implicit", implicit)) + !isnothing(name) && push!(_attributes, namedattribute("name", name)) return IR.create_operation( "acc.update_host", @@ -2154,11 +2159,11 @@ function update( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(ifCond) && push!(operands, ifCond) - !isnothing(asyncOperand) && push!(operands, asyncOperand) - !isnothing(waitDevnum) && push!(operands, waitDevnum) + !isnothing(ifCond) && push!(_operands, ifCond) + !isnothing(asyncOperand) && push!(_operands, asyncOperand) + !isnothing(waitDevnum) && push!(_operands, waitDevnum) push!( - attributes, + _attributes, operandsegmentsizes([ isnothing(ifCond) ? 0 : 1, isnothing(asyncOperand) ? 0 : 1, @@ -2168,9 +2173,9 @@ function update( length(dataClauseOperands), ]), ) - !isnothing(async) && push!(attributes, namedattribute("async", async)) - !isnothing(wait) && push!(attributes, namedattribute("wait", wait)) - !isnothing(ifPresent) && push!(attributes, namedattribute("ifPresent", ifPresent)) + !isnothing(async) && push!(_attributes, namedattribute("async", async)) + !isnothing(wait) && push!(_attributes, namedattribute("wait", wait)) + !isnothing(ifPresent) && push!(_attributes, namedattribute("ifPresent", ifPresent)) return IR.create_operation( "acc.update", @@ -2222,14 +2227,14 @@ function use_device( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(varPtrPtr) && push!(operands, varPtrPtr) + !isnothing(varPtrPtr) && push!(_operands, varPtrPtr) push!( - attributes, operandsegmentsizes([1, isnothing(varPtrPtr) ? 0 : 1, length(bounds)]) + _attributes, operandsegmentsizes([1, isnothing(varPtrPtr) ? 0 : 1, length(bounds)]) ) - !isnothing(dataClause) && push!(attributes, namedattribute("dataClause", dataClause)) - !isnothing(structured) && push!(attributes, namedattribute("structured", structured)) - !isnothing(implicit) && push!(attributes, namedattribute("implicit", implicit)) - !isnothing(name) && push!(attributes, namedattribute("name", name)) + !isnothing(dataClause) && push!(_attributes, namedattribute("dataClause", dataClause)) + !isnothing(structured) && push!(_attributes, namedattribute("structured", structured)) + !isnothing(implicit) && push!(_attributes, namedattribute("implicit", implicit)) + !isnothing(name) && push!(_attributes, namedattribute("name", name)) return IR.create_operation( "acc.use_device", @@ -2269,11 +2274,11 @@ function wait( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(asyncOperand) && push!(operands, asyncOperand) - !isnothing(waitDevnum) && push!(operands, waitDevnum) - !isnothing(ifCond) && push!(operands, ifCond) + !isnothing(asyncOperand) && push!(_operands, asyncOperand) + !isnothing(waitDevnum) && push!(_operands, waitDevnum) + !isnothing(ifCond) && push!(_operands, ifCond) push!( - attributes, + _attributes, operandsegmentsizes([ length(waitOperands), isnothing(asyncOperand) ? 0 : 1, @@ -2281,7 +2286,7 @@ function wait( isnothing(ifCond) ? 0 : 1, ]), ) - !isnothing(async) && push!(attributes, namedattribute("async", async)) + !isnothing(async) && push!(_attributes, namedattribute("async", async)) return IR.create_operation( "acc.wait", diff --git a/src/Dialects/17/OpenMP.jl b/src/Dialects/17/OpenMP.jl index 1153b4ac..ff554ded 100644 --- a/src/Dialects/17/OpenMP.jl +++ b/src/Dialects/17/OpenMP.jl @@ -45,9 +45,9 @@ function atomic_capture(; _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(hint_val) && push!(attributes, namedattribute("hint_val", hint_val)) + !isnothing(hint_val) && push!(_attributes, namedattribute("hint_val", hint_val)) !isnothing(memory_order_val) && - push!(attributes, namedattribute("memory_order_val", memory_order_val)) + push!(_attributes, namedattribute("memory_order_val", memory_order_val)) return IR.create_operation( "omp.atomic.capture", @@ -89,9 +89,9 @@ function atomic_read( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[namedattribute("element_type", element_type),] - !isnothing(hint_val) && push!(attributes, namedattribute("hint_val", hint_val)) + !isnothing(hint_val) && push!(_attributes, namedattribute("hint_val", hint_val)) !isnothing(memory_order_val) && - push!(attributes, namedattribute("memory_order_val", memory_order_val)) + push!(_attributes, namedattribute("memory_order_val", memory_order_val)) return IR.create_operation( "omp.atomic.read", @@ -147,9 +147,9 @@ function atomic_update( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(hint_val) && push!(attributes, namedattribute("hint_val", hint_val)) + !isnothing(hint_val) && push!(_attributes, namedattribute("hint_val", hint_val)) !isnothing(memory_order_val) && - push!(attributes, namedattribute("memory_order_val", memory_order_val)) + push!(_attributes, namedattribute("memory_order_val", memory_order_val)) return IR.create_operation( "omp.atomic.update", @@ -192,9 +192,9 @@ function atomic_write( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(hint_val) && push!(attributes, namedattribute("hint_val", hint_val)) + !isnothing(hint_val) && push!(_attributes, namedattribute("hint_val", hint_val)) !isnothing(memory_order_val) && - push!(attributes, namedattribute("memory_order_val", memory_order_val)) + push!(_attributes, namedattribute("memory_order_val", memory_order_val)) return IR.create_operation( "omp.atomic.write", @@ -251,7 +251,7 @@ function cancel( _attributes = NamedAttribute[namedattribute( "cancellation_construct_type_val", cancellation_construct_type_val ),] - !isnothing(if_expr) && push!(operands, if_expr) + !isnothing(if_expr) && push!(_operands, if_expr) return IR.create_operation( "omp.cancel", @@ -306,7 +306,7 @@ function critical_declare(; sym_name, hint_val=nothing, location=Location()) _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[namedattribute("sym_name", sym_name),] - !isnothing(hint_val) && push!(attributes, namedattribute("hint_val", hint_val)) + !isnothing(hint_val) && push!(_attributes, namedattribute("hint_val", hint_val)) return IR.create_operation( "omp.critical.declare", @@ -332,7 +332,7 @@ function critical(; name=nothing, region::Region, location=Location()) _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(name) && push!(attributes, namedattribute("name", name)) + !isnothing(name) && push!(_attributes, namedattribute("name", name)) return IR.create_operation( "omp.critical", @@ -428,9 +428,9 @@ function ordered( _successors = Block[] _attributes = NamedAttribute[] !isnothing(depend_type_val) && - push!(attributes, namedattribute("depend_type_val", depend_type_val)) + push!(_attributes, namedattribute("depend_type_val", depend_type_val)) !isnothing(num_loops_val) && - push!(attributes, namedattribute("num_loops_val", num_loops_val)) + push!(_attributes, namedattribute("num_loops_val", num_loops_val)) return IR.create_operation( "omp.ordered", @@ -461,7 +461,7 @@ function ordered_region(; simd=nothing, region::Region, location=Location()) _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(simd) && push!(attributes, namedattribute("simd", simd)) + !isnothing(simd) && push!(_attributes, namedattribute("simd", simd)) return IR.create_operation( "omp.ordered_region", @@ -523,10 +523,10 @@ function parallel( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(if_expr_var) && push!(operands, if_expr_var) - !isnothing(num_threads_var) && push!(operands, num_threads_var) + !isnothing(if_expr_var) && push!(_operands, if_expr_var) + !isnothing(num_threads_var) && push!(_operands, num_threads_var) push!( - attributes, + _attributes, operandsegmentsizes([ isnothing(if_expr_var) ? 0 : 1, isnothing(num_threads_var) ? 0 : 1, @@ -535,9 +535,9 @@ function parallel( length(reduction_vars), ]), ) - !isnothing(reductions) && push!(attributes, namedattribute("reductions", reductions)) + !isnothing(reductions) && push!(_attributes, namedattribute("reductions", reductions)) !isnothing(proc_bind_val) && - push!(attributes, namedattribute("proc_bind_val", proc_bind_val)) + push!(_attributes, namedattribute("proc_bind_val", proc_bind_val)) return IR.create_operation( "omp.parallel", @@ -699,13 +699,13 @@ function sections( _successors = Block[] _attributes = NamedAttribute[] push!( - attributes, + _attributes, operandsegmentsizes([ length(reduction_vars), length(allocate_vars), length(allocators_vars) ]), ) - !isnothing(reductions) && push!(attributes, namedattribute("reductions", reductions)) - !isnothing(nowait) && push!(attributes, namedattribute("nowait", nowait)) + !isnothing(reductions) && push!(_attributes, namedattribute("reductions", reductions)) + !isnothing(nowait) && push!(_attributes, namedattribute("nowait", nowait)) return IR.create_operation( "omp.sections", @@ -786,9 +786,9 @@ function simdloop( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(if_expr) && push!(operands, if_expr) + !isnothing(if_expr) && push!(_operands, if_expr) push!( - attributes, + _attributes, operandsegmentsizes([ length(lowerBound), length(upperBound), @@ -799,11 +799,11 @@ function simdloop( ]), ) !isnothing(alignment_values) && - push!(attributes, namedattribute("alignment_values", alignment_values)) - !isnothing(order_val) && push!(attributes, namedattribute("order_val", order_val)) - !isnothing(simdlen) && push!(attributes, namedattribute("simdlen", simdlen)) - !isnothing(safelen) && push!(attributes, namedattribute("safelen", safelen)) - !isnothing(inclusive) && push!(attributes, namedattribute("inclusive", inclusive)) + push!(_attributes, namedattribute("alignment_values", alignment_values)) + !isnothing(order_val) && push!(_attributes, namedattribute("order_val", order_val)) + !isnothing(simdlen) && push!(_attributes, namedattribute("simdlen", simdlen)) + !isnothing(safelen) && push!(_attributes, namedattribute("safelen", safelen)) + !isnothing(inclusive) && push!(_attributes, namedattribute("inclusive", inclusive)) return IR.create_operation( "omp.simdloop", @@ -838,8 +838,10 @@ function single( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - push!(attributes, operandsegmentsizes([length(allocate_vars), length(allocators_vars)])) - !isnothing(nowait) && push!(attributes, namedattribute("nowait", nowait)) + push!( + _attributes, operandsegmentsizes([length(allocate_vars), length(allocators_vars)]) + ) + !isnothing(nowait) && push!(_attributes, namedattribute("nowait", nowait)) return IR.create_operation( "omp.single", @@ -888,11 +890,11 @@ function target( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(if_expr) && push!(operands, if_expr) - !isnothing(device) && push!(operands, device) - !isnothing(thread_limit) && push!(operands, thread_limit) + !isnothing(if_expr) && push!(_operands, if_expr) + !isnothing(device) && push!(_operands, device) + !isnothing(thread_limit) && push!(_operands, thread_limit) push!( - attributes, + _attributes, operandsegmentsizes([ isnothing(if_expr) ? 0 : 1, isnothing(device) ? 0 : 1, @@ -900,8 +902,8 @@ function target( length(map_operands), ]), ) - !isnothing(nowait) && push!(attributes, namedattribute("nowait", nowait)) - !isnothing(map_types) && push!(attributes, namedattribute("map_types", map_types)) + !isnothing(nowait) && push!(_attributes, namedattribute("nowait", nowait)) + !isnothing(map_types) && push!(_attributes, namedattribute("map_types", map_types)) return IR.create_operation( "omp.target", @@ -961,10 +963,10 @@ function target_data( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[namedattribute("map_types", map_types),] - !isnothing(if_expr) && push!(operands, if_expr) - !isnothing(device) && push!(operands, device) + !isnothing(if_expr) && push!(_operands, if_expr) + !isnothing(device) && push!(_operands, device) push!( - attributes, + _attributes, operandsegmentsizes([ isnothing(if_expr) ? 0 : 1, isnothing(device) ? 0 : 1, @@ -1023,15 +1025,15 @@ function target_enter_data( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[namedattribute("map_types", map_types),] - !isnothing(if_expr) && push!(operands, if_expr) - !isnothing(device) && push!(operands, device) + !isnothing(if_expr) && push!(_operands, if_expr) + !isnothing(device) && push!(_operands, device) push!( - attributes, + _attributes, operandsegmentsizes([ isnothing(if_expr) ? 0 : 1, isnothing(device) ? 0 : 1, length(map_operands) ]), ) - !isnothing(nowait) && push!(attributes, namedattribute("nowait", nowait)) + !isnothing(nowait) && push!(_attributes, namedattribute("nowait", nowait)) return IR.create_operation( "omp.target_enter_data", @@ -1082,15 +1084,15 @@ function target_exit_data( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[namedattribute("map_types", map_types),] - !isnothing(if_expr) && push!(operands, if_expr) - !isnothing(device) && push!(operands, device) + !isnothing(if_expr) && push!(_operands, if_expr) + !isnothing(device) && push!(_operands, device) push!( - attributes, + _attributes, operandsegmentsizes([ isnothing(if_expr) ? 0 : 1, isnothing(device) ? 0 : 1, length(map_operands) ]), ) - !isnothing(nowait) && push!(attributes, namedattribute("nowait", nowait)) + !isnothing(nowait) && push!(_attributes, namedattribute("nowait", nowait)) return IR.create_operation( "omp.target_exit_data", @@ -1142,13 +1144,13 @@ function taskgroup( _successors = Block[] _attributes = NamedAttribute[] push!( - attributes, + _attributes, operandsegmentsizes([ length(task_reduction_vars), length(allocate_vars), length(allocators_vars) ]), ) !isnothing(task_reductions) && - push!(attributes, namedattribute("task_reductions", task_reductions)) + push!(_attributes, namedattribute("task_reductions", task_reductions)) return IR.create_operation( "omp.taskgroup", @@ -1295,13 +1297,13 @@ function taskloop( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(if_expr) && push!(operands, if_expr) - !isnothing(final_expr) && push!(operands, final_expr) - !isnothing(priority) && push!(operands, priority) - !isnothing(grain_size) && push!(operands, grain_size) - !isnothing(num_tasks) && push!(operands, num_tasks) + !isnothing(if_expr) && push!(_operands, if_expr) + !isnothing(final_expr) && push!(_operands, final_expr) + !isnothing(priority) && push!(_operands, priority) + !isnothing(grain_size) && push!(_operands, grain_size) + !isnothing(num_tasks) && push!(_operands, num_tasks) push!( - attributes, + _attributes, operandsegmentsizes([ length(lowerBound), length(upperBound), @@ -1317,13 +1319,13 @@ function taskloop( isnothing(num_tasks) ? 0 : 1, ]), ) - !isnothing(inclusive) && push!(attributes, namedattribute("inclusive", inclusive)) - !isnothing(untied) && push!(attributes, namedattribute("untied", untied)) - !isnothing(mergeable) && push!(attributes, namedattribute("mergeable", mergeable)) + !isnothing(inclusive) && push!(_attributes, namedattribute("inclusive", inclusive)) + !isnothing(untied) && push!(_attributes, namedattribute("untied", untied)) + !isnothing(mergeable) && push!(_attributes, namedattribute("mergeable", mergeable)) !isnothing(in_reductions) && - push!(attributes, namedattribute("in_reductions", in_reductions)) - !isnothing(reductions) && push!(attributes, namedattribute("reductions", reductions)) - !isnothing(nogroup) && push!(attributes, namedattribute("nogroup", nogroup)) + push!(_attributes, namedattribute("in_reductions", in_reductions)) + !isnothing(reductions) && push!(_attributes, namedattribute("reductions", reductions)) + !isnothing(nogroup) && push!(_attributes, namedattribute("nogroup", nogroup)) return IR.create_operation( "omp.taskloop", @@ -1405,11 +1407,11 @@ function task( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(if_expr) && push!(operands, if_expr) - !isnothing(final_expr) && push!(operands, final_expr) - !isnothing(priority) && push!(operands, priority) + !isnothing(if_expr) && push!(_operands, if_expr) + !isnothing(final_expr) && push!(_operands, final_expr) + !isnothing(priority) && push!(_operands, priority) push!( - attributes, + _attributes, operandsegmentsizes([ isnothing(if_expr) ? 0 : 1, isnothing(final_expr) ? 0 : 1, @@ -1420,11 +1422,11 @@ function task( length(allocators_vars), ]), ) - !isnothing(untied) && push!(attributes, namedattribute("untied", untied)) - !isnothing(mergeable) && push!(attributes, namedattribute("mergeable", mergeable)) + !isnothing(untied) && push!(_attributes, namedattribute("untied", untied)) + !isnothing(mergeable) && push!(_attributes, namedattribute("mergeable", mergeable)) !isnothing(in_reductions) && - push!(attributes, namedattribute("in_reductions", in_reductions)) - !isnothing(depends) && push!(attributes, namedattribute("depends", depends)) + push!(_attributes, namedattribute("in_reductions", in_reductions)) + !isnothing(depends) && push!(_attributes, namedattribute("depends", depends)) return IR.create_operation( "omp.task", @@ -1527,12 +1529,12 @@ function teams( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(num_teams_lower) && push!(operands, num_teams_lower) - !isnothing(num_teams_upper) && push!(operands, num_teams_upper) - !isnothing(if_expr) && push!(operands, if_expr) - !isnothing(thread_limit) && push!(operands, thread_limit) + !isnothing(num_teams_lower) && push!(_operands, num_teams_lower) + !isnothing(num_teams_upper) && push!(_operands, num_teams_upper) + !isnothing(if_expr) && push!(_operands, if_expr) + !isnothing(thread_limit) && push!(_operands, thread_limit) push!( - attributes, + _attributes, operandsegmentsizes([ isnothing(num_teams_lower) ? 0 : 1, isnothing(num_teams_upper) ? 0 : 1, @@ -1543,7 +1545,7 @@ function teams( length(reduction_vars), ]), ) - !isnothing(reductions) && push!(attributes, namedattribute("reductions", reductions)) + !isnothing(reductions) && push!(_attributes, namedattribute("reductions", reductions)) return IR.create_operation( "omp.teams", @@ -1713,9 +1715,9 @@ function wsloop( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(schedule_chunk_var) && push!(operands, schedule_chunk_var) + !isnothing(schedule_chunk_var) && push!(_operands, schedule_chunk_var) push!( - attributes, + _attributes, operandsegmentsizes([ length(lowerBound), length(upperBound), @@ -1726,17 +1728,18 @@ function wsloop( isnothing(schedule_chunk_var) ? 0 : 1, ]), ) - !isnothing(reductions) && push!(attributes, namedattribute("reductions", reductions)) + !isnothing(reductions) && push!(_attributes, namedattribute("reductions", reductions)) !isnothing(schedule_val) && - push!(attributes, namedattribute("schedule_val", schedule_val)) + push!(_attributes, namedattribute("schedule_val", schedule_val)) !isnothing(schedule_modifier) && - push!(attributes, namedattribute("schedule_modifier", schedule_modifier)) + push!(_attributes, namedattribute("schedule_modifier", schedule_modifier)) !isnothing(simd_modifier) && - push!(attributes, namedattribute("simd_modifier", simd_modifier)) - !isnothing(nowait) && push!(attributes, namedattribute("nowait", nowait)) - !isnothing(ordered_val) && push!(attributes, namedattribute("ordered_val", ordered_val)) - !isnothing(order_val) && push!(attributes, namedattribute("order_val", order_val)) - !isnothing(inclusive) && push!(attributes, namedattribute("inclusive", inclusive)) + push!(_attributes, namedattribute("simd_modifier", simd_modifier)) + !isnothing(nowait) && push!(_attributes, namedattribute("nowait", nowait)) + !isnothing(ordered_val) && + push!(_attributes, namedattribute("ordered_val", ordered_val)) + !isnothing(order_val) && push!(_attributes, namedattribute("order_val", order_val)) + !isnothing(inclusive) && push!(_attributes, namedattribute("inclusive", inclusive)) return IR.create_operation( "omp.wsloop", diff --git a/src/Dialects/17/PDL.jl b/src/Dialects/17/PDL.jl index 8379d2cc..d819792d 100644 --- a/src/Dialects/17/PDL.jl +++ b/src/Dialects/17/PDL.jl @@ -122,8 +122,8 @@ function attribute( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(valueType) && push!(operands, valueType) - !isnothing(value) && push!(attributes, namedattribute("value", value)) + !isnothing(valueType) && push!(_operands, valueType) + !isnothing(value) && push!(_attributes, namedattribute("value", value)) return IR.create_operation( "pdl.attribute", @@ -198,7 +198,7 @@ function operand( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(valueType) && push!(operands, valueType) + !isnothing(valueType) && push!(_operands, valueType) return IR.create_operation( "pdl.operand", @@ -241,7 +241,7 @@ function operands( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(valueType) && push!(operands, valueType) + !isnothing(valueType) && push!(_operands, valueType) return IR.create_operation( "pdl.operands", @@ -367,12 +367,12 @@ function operation( _successors = Block[] _attributes = NamedAttribute[namedattribute("attributeValueNames", attributeValueNames),] push!( - attributes, + _attributes, operandsegmentsizes([ length(operandValues), length(attributeValues), length(typeValues) ]), ) - !isnothing(opName) && push!(attributes, namedattribute("opName", opName)) + !isnothing(opName) && push!(_attributes, namedattribute("opName", opName)) return IR.create_operation( "pdl.operation", @@ -416,7 +416,7 @@ function pattern(; benefit, sym_name=nothing, bodyRegion::Region, location=Locat _owned_regions = Region[bodyRegion,] _successors = Block[] _attributes = NamedAttribute[namedattribute("benefit", benefit),] - !isnothing(sym_name) && push!(attributes, namedattribute("sym_name", sym_name)) + !isnothing(sym_name) && push!(_attributes, namedattribute("sym_name", sym_name)) return IR.create_operation( "pdl.pattern", @@ -512,9 +512,9 @@ function replace( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(replOperation) && push!(operands, replOperation) + !isnothing(replOperation) && push!(_operands, replOperation) push!( - attributes, + _attributes, operandsegmentsizes([1, isnothing(replOperation) ? 0 : 1, length(replValues)]), ) @@ -606,7 +606,7 @@ function results(parent::Value; val::IR.Type, index=nothing, location=Location() _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(index) && push!(attributes, namedattribute("index", index)) + !isnothing(index) && push!(_attributes, namedattribute("index", index)) return IR.create_operation( "pdl.results", @@ -671,9 +671,9 @@ function rewrite( _owned_regions = Region[bodyRegion,] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(root) && push!(operands, root) - push!(attributes, operandsegmentsizes([isnothing(root) ? 0 : 1, length(externalArgs)])) - !isnothing(name) && push!(attributes, namedattribute("name", name)) + !isnothing(root) && push!(_operands, root) + push!(_attributes, operandsegmentsizes([isnothing(root) ? 0 : 1, length(externalArgs)])) + !isnothing(name) && push!(_attributes, namedattribute("name", name)) return IR.create_operation( "pdl.rewrite", @@ -712,7 +712,7 @@ function type(; result::IR.Type, constantType=nothing, location=Location()) _successors = Block[] _attributes = NamedAttribute[] !isnothing(constantType) && - push!(attributes, namedattribute("constantType", constantType)) + push!(_attributes, namedattribute("constantType", constantType)) return IR.create_operation( "pdl.type", @@ -751,7 +751,7 @@ function types(; result::IR.Type, constantTypes=nothing, location=Location()) _successors = Block[] _attributes = NamedAttribute[] !isnothing(constantTypes) && - push!(attributes, namedattribute("constantTypes", constantTypes)) + push!(_attributes, namedattribute("constantTypes", constantTypes)) return IR.create_operation( "pdl.types", diff --git a/src/Dialects/17/PDLInterp.jl b/src/Dialects/17/PDLInterp.jl index 93560277..23673f60 100644 --- a/src/Dialects/17/PDLInterp.jl +++ b/src/Dialects/17/PDLInterp.jl @@ -217,7 +217,7 @@ function check_operand_count( _successors = Block[trueDest, falseDest] _attributes = NamedAttribute[namedattribute("count", count),] !isnothing(compareAtLeast) && - push!(attributes, namedattribute("compareAtLeast", compareAtLeast)) + push!(_attributes, namedattribute("compareAtLeast", compareAtLeast)) return IR.create_operation( "pdl_interp.check_operand_count", @@ -298,7 +298,7 @@ function check_result_count( _successors = Block[trueDest, falseDest] _attributes = NamedAttribute[namedattribute("count", count),] !isnothing(compareAtLeast) && - push!(attributes, namedattribute("compareAtLeast", compareAtLeast)) + push!(_attributes, namedattribute("compareAtLeast", compareAtLeast)) return IR.create_operation( "pdl_interp.check_result_count", @@ -481,13 +481,13 @@ function create_operation( namedattribute("inputAttributeNames", inputAttributeNames), ] push!( - attributes, + _attributes, operandsegmentsizes([ length(inputOperands), length(inputAttributes), length(inputResultTypes) ]), ) !isnothing(inferredResultTypes) && - push!(attributes, namedattribute("inferredResultTypes", inferredResultTypes)) + push!(_attributes, namedattribute("inferredResultTypes", inferredResultTypes)) return IR.create_operation( "pdl_interp.create_operation", @@ -769,8 +769,8 @@ function func(; _attributes = NamedAttribute[ namedattribute("sym_name", sym_name), 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(arg_attrs) && push!(_attributes, namedattribute("arg_attrs", arg_attrs)) + !isnothing(res_attrs) && push!(_attributes, namedattribute("res_attrs", res_attrs)) return IR.create_operation( "pdl_interp.func", @@ -941,7 +941,7 @@ function get_operands(inputOp::Value; value::IR.Type, index=nothing, location=Lo _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(index) && push!(attributes, namedattribute("index", index)) + !isnothing(index) && push!(_attributes, namedattribute("index", index)) return IR.create_operation( "pdl_interp.get_operands", @@ -1016,7 +1016,7 @@ function get_results(inputOp::Value; value::IR.Type, index=nothing, location=Loc _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(index) && push!(attributes, namedattribute("index", index)) + !isnothing(index) && push!(_attributes, namedattribute("index", index)) return IR.create_operation( "pdl_interp.get_results", @@ -1166,10 +1166,10 @@ function record_match( _attributes = NamedAttribute[ namedattribute("rewriter", rewriter), namedattribute("benefit", benefit) ] - push!(attributes, operandsegmentsizes([length(inputs), length(matchedOps)])) - !isnothing(rootKind) && push!(attributes, namedattribute("rootKind", rootKind)) + push!(_attributes, operandsegmentsizes([length(inputs), length(matchedOps)])) + !isnothing(rootKind) && push!(_attributes, namedattribute("rootKind", rootKind)) !isnothing(generatedOps) && - push!(attributes, namedattribute("generatedOps", generatedOps)) + push!(_attributes, namedattribute("generatedOps", generatedOps)) return IR.create_operation( "pdl_interp.record_match", diff --git a/src/Dialects/17/SCF.jl b/src/Dialects/17/SCF.jl index 69b7a065..3e6c060b 100644 --- a/src/Dialects/17/SCF.jl +++ b/src/Dialects/17/SCF.jl @@ -399,7 +399,7 @@ function forall( namedattribute("staticStep", staticStep), ] push!( - attributes, + _attributes, operandsegmentsizes([ length(dynamicLowerBound), length(dynamicUpperBound), @@ -407,7 +407,7 @@ function forall( length(outputs), ]), ) - !isnothing(mapping) && push!(attributes, namedattribute("mapping", mapping)) + !isnothing(mapping) && push!(_attributes, namedattribute("mapping", mapping)) return IR.create_operation( "scf.forall", @@ -645,7 +645,7 @@ function parallel( _successors = Block[] _attributes = NamedAttribute[] push!( - attributes, + _attributes, operandsegmentsizes([ length(lowerBound), length(upperBound), length(step), length(initVals) ]), diff --git a/src/Dialects/17/SPIRV.jl b/src/Dialects/17/SPIRV.jl index f68711e5..4d6b4a41 100644 --- a/src/Dialects/17/SPIRV.jl +++ b/src/Dialects/17/SPIRV.jl @@ -1524,11 +1524,11 @@ function BranchConditional( _successors = Block[trueTarget, falseTarget] _attributes = NamedAttribute[] push!( - attributes, + _attributes, operandsegmentsizes([1, length(trueTargetOperands), length(falseTargetOperands)]), ) !isnothing(branch_weights) && - push!(attributes, namedattribute("branch_weights", branch_weights)) + push!(_attributes, namedattribute("branch_weights", branch_weights)) return IR.create_operation( "spirv.BranchConditional", @@ -3224,12 +3224,12 @@ function CopyMemory( _successors = Block[] _attributes = NamedAttribute[] !isnothing(memory_access) && - push!(attributes, namedattribute("memory_access", memory_access)) - !isnothing(alignment) && push!(attributes, namedattribute("alignment", alignment)) + push!(_attributes, namedattribute("memory_access", memory_access)) + !isnothing(alignment) && push!(_attributes, namedattribute("alignment", alignment)) !isnothing(source_memory_access) && - push!(attributes, namedattribute("source_memory_access", source_memory_access)) + push!(_attributes, namedattribute("source_memory_access", source_memory_access)) !isnothing(source_alignment) && - push!(attributes, namedattribute("source_alignment", source_alignment)) + push!(_attributes, namedattribute("source_alignment", source_alignment)) return IR.create_operation( "spirv.CopyMemory", @@ -4429,10 +4429,10 @@ function func(; namedattribute("sym_name", sym_name), namedattribute("function_control", function_control), ] - !isnothing(arg_attrs) && push!(attributes, namedattribute("arg_attrs", arg_attrs)) - !isnothing(res_attrs) && push!(attributes, namedattribute("res_attrs", res_attrs)) + !isnothing(arg_attrs) && push!(_attributes, namedattribute("arg_attrs", arg_attrs)) + !isnothing(res_attrs) && push!(_attributes, namedattribute("res_attrs", res_attrs)) !isnothing(linkage_attributes) && - push!(attributes, namedattribute("linkage_attributes", linkage_attributes)) + push!(_attributes, namedattribute("linkage_attributes", linkage_attributes)) return IR.create_operation( "spirv.func", @@ -6360,14 +6360,15 @@ function GlobalVariable(; _attributes = NamedAttribute[ namedattribute("type", type), namedattribute("sym_name", sym_name) ] - !isnothing(initializer) && push!(attributes, namedattribute("initializer", initializer)) - !isnothing(location) && push!(attributes, namedattribute("location", location_)) - !isnothing(binding) && push!(attributes, namedattribute("binding", binding)) + !isnothing(initializer) && + push!(_attributes, namedattribute("initializer", initializer)) + !isnothing(location) && push!(_attributes, namedattribute("location", location_)) + !isnothing(binding) && push!(_attributes, namedattribute("binding", binding)) !isnothing(descriptor_set) && - push!(attributes, namedattribute("descriptor_set", descriptor_set)) - !isnothing(builtin) && push!(attributes, namedattribute("builtin", builtin)) + push!(_attributes, namedattribute("descriptor_set", descriptor_set)) + !isnothing(builtin) && push!(_attributes, namedattribute("builtin", builtin)) !isnothing(linkage_attributes) && - push!(attributes, namedattribute("linkage_attributes", linkage_attributes)) + push!(_attributes, namedattribute("linkage_attributes", linkage_attributes)) return IR.create_operation( "spirv.GlobalVariable", @@ -7038,7 +7039,7 @@ function GroupNonUniformFAdd( namedattribute("execution_scope", execution_scope), namedattribute("group_operation", group_operation), ] - !isnothing(cluster_size) && push!(operands, cluster_size) + !isnothing(cluster_size) && push!(_operands, cluster_size) return IR.create_operation( "spirv.GroupNonUniformFAdd", @@ -7113,7 +7114,7 @@ function GroupNonUniformFMax( namedattribute("execution_scope", execution_scope), namedattribute("group_operation", group_operation), ] - !isnothing(cluster_size) && push!(operands, cluster_size) + !isnothing(cluster_size) && push!(_operands, cluster_size) return IR.create_operation( "spirv.GroupNonUniformFMax", @@ -7188,7 +7189,7 @@ function GroupNonUniformFMin( namedattribute("execution_scope", execution_scope), namedattribute("group_operation", group_operation), ] - !isnothing(cluster_size) && push!(operands, cluster_size) + !isnothing(cluster_size) && push!(_operands, cluster_size) return IR.create_operation( "spirv.GroupNonUniformFMin", @@ -7260,7 +7261,7 @@ function GroupNonUniformFMul( namedattribute("execution_scope", execution_scope), namedattribute("group_operation", group_operation), ] - !isnothing(cluster_size) && push!(operands, cluster_size) + !isnothing(cluster_size) && push!(_operands, cluster_size) return IR.create_operation( "spirv.GroupNonUniformFMul", @@ -7330,7 +7331,7 @@ function GroupNonUniformIAdd( namedattribute("execution_scope", execution_scope), namedattribute("group_operation", group_operation), ] - !isnothing(cluster_size) && push!(operands, cluster_size) + !isnothing(cluster_size) && push!(_operands, cluster_size) return IR.create_operation( "spirv.GroupNonUniformIAdd", @@ -7400,7 +7401,7 @@ function GroupNonUniformIMul( namedattribute("execution_scope", execution_scope), namedattribute("group_operation", group_operation), ] - !isnothing(cluster_size) && push!(operands, cluster_size) + !isnothing(cluster_size) && push!(_operands, cluster_size) return IR.create_operation( "spirv.GroupNonUniformIMul", @@ -7470,7 +7471,7 @@ function GroupNonUniformSMax( namedattribute("execution_scope", execution_scope), namedattribute("group_operation", group_operation), ] - !isnothing(cluster_size) && push!(operands, cluster_size) + !isnothing(cluster_size) && push!(_operands, cluster_size) return IR.create_operation( "spirv.GroupNonUniformSMax", @@ -7540,7 +7541,7 @@ function GroupNonUniformSMin( namedattribute("execution_scope", execution_scope), namedattribute("group_operation", group_operation), ] - !isnothing(cluster_size) && push!(operands, cluster_size) + !isnothing(cluster_size) && push!(_operands, cluster_size) return IR.create_operation( "spirv.GroupNonUniformSMin", @@ -7811,7 +7812,7 @@ function GroupNonUniformUMax( namedattribute("execution_scope", execution_scope), namedattribute("group_operation", group_operation), ] - !isnothing(cluster_size) && push!(operands, cluster_size) + !isnothing(cluster_size) && push!(_operands, cluster_size) return IR.create_operation( "spirv.GroupNonUniformUMax", @@ -7882,7 +7883,7 @@ function GroupNonUniformUMin( namedattribute("execution_scope", execution_scope), namedattribute("group_operation", group_operation), ] - !isnothing(cluster_size) && push!(operands, cluster_size) + !isnothing(cluster_size) && push!(_operands, cluster_size) return IR.create_operation( "spirv.GroupNonUniformUMin", @@ -8484,8 +8485,8 @@ function INTEL_JointMatrixLoad( namedattribute("layout", layout), namedattribute("scope", scope) ] !isnothing(memory_access) && - push!(attributes, namedattribute("memory_access", memory_access)) - !isnothing(alignment) && push!(attributes, namedattribute("alignment", alignment)) + push!(_attributes, namedattribute("memory_access", memory_access)) + !isnothing(alignment) && push!(_attributes, namedattribute("alignment", alignment)) return IR.create_operation( "spirv.INTEL.JointMatrixLoad", @@ -8612,8 +8613,8 @@ function INTEL_JointMatrixStore( namedattribute("layout", layout), namedattribute("scope", scope) ] !isnothing(memory_access) && - push!(attributes, namedattribute("memory_access", memory_access)) - !isnothing(alignment) && push!(attributes, namedattribute("alignment", alignment)) + push!(_attributes, namedattribute("memory_access", memory_access)) + !isnothing(alignment) && push!(_attributes, namedattribute("alignment", alignment)) return IR.create_operation( "spirv.INTEL.JointMatrixStore", @@ -8971,7 +8972,7 @@ function ImageDrefGather( _successors = Block[] _attributes = NamedAttribute[] !isnothing(imageoperands) && - push!(attributes, namedattribute("imageoperands", imageoperands)) + push!(_attributes, namedattribute("imageoperands", imageoperands)) return IR.create_operation( "spirv.ImageDrefGather", @@ -9352,7 +9353,7 @@ function KHR_CooperativeMatrixLoad( _successors = Block[] _attributes = NamedAttribute[namedattribute("matrix_layout", matrix_layout),] !isnothing(memory_operand) && - push!(attributes, namedattribute("memory_operand", memory_operand)) + push!(_attributes, namedattribute("memory_operand", memory_operand)) return IR.create_operation( "spirv.KHR.CooperativeMatrixLoad", @@ -9427,7 +9428,7 @@ function KHR_CooperativeMatrixStore( _successors = Block[] _attributes = NamedAttribute[namedattribute("matrix_layout", matrix_layout),] !isnothing(memory_operand) && - push!(attributes, namedattribute("memory_operand", memory_operand)) + push!(_attributes, namedattribute("memory_operand", memory_operand)) return IR.create_operation( "spirv.KHR.CooperativeMatrixStore", @@ -9536,8 +9537,8 @@ function Load( _successors = Block[] _attributes = NamedAttribute[] !isnothing(memory_access) && - push!(attributes, namedattribute("memory_access", memory_access)) - !isnothing(alignment) && push!(attributes, namedattribute("alignment", alignment)) + push!(_attributes, namedattribute("memory_access", memory_access)) + !isnothing(alignment) && push!(_attributes, namedattribute("alignment", alignment)) return IR.create_operation( "spirv.Load", @@ -10063,8 +10064,8 @@ function module_(; namedattribute("addressing_model", addressing_model), namedattribute("memory_model", memory_model), ] - !isnothing(vce_triple) && push!(attributes, namedattribute("vce_triple", vce_triple)) - !isnothing(sym_name) && push!(attributes, namedattribute("sym_name", sym_name)) + !isnothing(vce_triple) && push!(_attributes, namedattribute("vce_triple", vce_triple)) + !isnothing(sym_name) && push!(_attributes, namedattribute("sym_name", sym_name)) return IR.create_operation( "spirv.module", @@ -10190,7 +10191,7 @@ function NV_CooperativeMatrixLoad( _successors = Block[] _attributes = NamedAttribute[] !isnothing(memory_access) && - push!(attributes, namedattribute("memory_access", memory_access)) + push!(_attributes, namedattribute("memory_access", memory_access)) return IR.create_operation( "spirv.NV.CooperativeMatrixLoad", @@ -10330,7 +10331,7 @@ function NV_CooperativeMatrixStore( _successors = Block[] _attributes = NamedAttribute[] !isnothing(memory_access) && - push!(attributes, namedattribute("memory_access", memory_access)) + push!(_attributes, namedattribute("memory_access", memory_access)) return IR.create_operation( "spirv.NV.CooperativeMatrixStore", @@ -10807,7 +10808,7 @@ function SDotAccSat( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(format) && push!(attributes, namedattribute("format", format)) + !isnothing(format) && push!(_attributes, namedattribute("format", format)) return IR.create_operation( "spirv.SDotAccSat", @@ -10863,7 +10864,7 @@ function SDot( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(format) && push!(attributes, namedattribute("format", format)) + !isnothing(format) && push!(_attributes, namedattribute("format", format)) return IR.create_operation( "spirv.SDot", @@ -11313,7 +11314,7 @@ function SUDotAccSat( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(format) && push!(attributes, namedattribute("format", format)) + !isnothing(format) && push!(_attributes, namedattribute("format", format)) return IR.create_operation( "spirv.SUDotAccSat", @@ -11371,7 +11372,7 @@ function SUDot( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(format) && push!(attributes, namedattribute("format", format)) + !isnothing(format) && push!(_attributes, namedattribute("format", format)) return IR.create_operation( "spirv.SUDot", @@ -11905,8 +11906,8 @@ function Store( _successors = Block[] _attributes = NamedAttribute[] !isnothing(memory_access) && - push!(attributes, namedattribute("memory_access", memory_access)) - !isnothing(alignment) && push!(attributes, namedattribute("alignment", alignment)) + push!(_attributes, namedattribute("memory_access", memory_access)) + !isnothing(alignment) && push!(_attributes, namedattribute("alignment", alignment)) return IR.create_operation( "spirv.Store", @@ -12118,7 +12119,7 @@ function UDotAccSat( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(format) && push!(attributes, namedattribute("format", format)) + !isnothing(format) && push!(_attributes, namedattribute("format", format)) return IR.create_operation( "spirv.UDotAccSat", @@ -12176,7 +12177,7 @@ function UDot( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(format) && push!(attributes, namedattribute("format", format)) + !isnothing(format) && push!(_attributes, namedattribute("format", format)) return IR.create_operation( "spirv.UDot", @@ -12637,7 +12638,7 @@ function Variable( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[namedattribute("storage_class", storage_class),] - !isnothing(initializer) && push!(operands, initializer) + !isnothing(initializer) && push!(_operands, initializer) return IR.create_operation( "spirv.Variable", diff --git a/src/Dialects/17/Shape.jl b/src/Dialects/17/Shape.jl index 14e4dff3..01df0109 100644 --- a/src/Dialects/17/Shape.jl +++ b/src/Dialects/17/Shape.jl @@ -91,15 +91,12 @@ ready to execute. %wt = shape.assuming_all %w0, %w2 // Passing ``` """ -function assuming_all( - inputs::Vector{Value}; result=nothing::Union{Nothing,IR.Type}, location=Location() -) - _results = IR.Type[] +function assuming_all(inputs::Vector{Value}; result::IR.Type, location=Location()) + _results = IR.Type[result,] _operands = Value[inputs...,] _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(result) && push!(_results, result) return IR.create_operation( "shape.assuming_all", @@ -108,8 +105,8 @@ function assuming_all( owned_regions=_owned_regions, successors=_successors, attributes=_attributes, - results=(length(_results) == 0 ? nothing : _results), - result_inference=(length(_results) == 0 ? true : false), + results=_results, + result_inference=false, ) end @@ -202,7 +199,7 @@ function broadcast( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(error) && push!(attributes, namedattribute("error", error)) + !isnothing(error) && push!(_attributes, namedattribute("error", error)) return IR.create_operation( "shape.broadcast", @@ -360,15 +357,12 @@ shape.broadcast documents. %w1 = shape.cstr_broadcastable [2,2], [3,2] // Failure ``` """ -function cstr_broadcastable( - shapes::Vector{Value}; result=nothing::Union{Nothing,IR.Type}, location=Location() -) - _results = IR.Type[] +function cstr_broadcastable(shapes::Vector{Value}; result::IR.Type, location=Location()) + _results = IR.Type[result,] _operands = Value[shapes...,] _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(result) && push!(_results, result) return IR.create_operation( "shape.cstr_broadcastable", @@ -377,8 +371,8 @@ function cstr_broadcastable( owned_regions=_owned_regions, successors=_successors, attributes=_attributes, - results=(length(_results) == 0 ? nothing : _results), - result_inference=(length(_results) == 0 ? true : false), + results=_results, + result_inference=false, ) end @@ -395,15 +389,12 @@ Given 1 or more input shapes, determine if all shapes are the exact same. %w1 = shape.cstr_eq [2,2], [1,2] // Failure ``` """ -function cstr_eq( - shapes::Vector{Value}; result=nothing::Union{Nothing,IR.Type}, location=Location() -) - _results = IR.Type[] +function cstr_eq(shapes::Vector{Value}; result::IR.Type, location=Location()) + _results = IR.Type[result,] _operands = Value[shapes...,] _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(result) && push!(_results, result) return IR.create_operation( "shape.cstr_eq", @@ -412,8 +403,8 @@ function cstr_eq( owned_regions=_owned_regions, successors=_successors, attributes=_attributes, - results=(length(_results) == 0 ? nothing : _results), - result_inference=(length(_results) == 0 ? true : false), + results=_results, + result_inference=false, ) end @@ -597,15 +588,12 @@ the shape. %s1 = shape.from_extents ``` """ -function from_extents( - extents::Vector{Value}; shape=nothing::Union{Nothing,IR.Type}, location=Location() -) - _results = IR.Type[] +function from_extents(extents::Vector{Value}; shape::IR.Type, location=Location()) + _results = IR.Type[shape,] _operands = Value[extents...,] _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(shape) && push!(_results, shape) return IR.create_operation( "shape.from_extents", @@ -614,8 +602,8 @@ function from_extents( owned_regions=_owned_regions, successors=_successors, attributes=_attributes, - results=(length(_results) == 0 ? nothing : _results), - result_inference=(length(_results) == 0 ? true : false), + results=_results, + result_inference=false, ) end @@ -642,10 +630,10 @@ function func(; _attributes = NamedAttribute[ namedattribute("sym_name", sym_name), 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(arg_attrs) && push!(_attributes, namedattribute("arg_attrs", arg_attrs)) + !isnothing(res_attrs) && push!(_attributes, namedattribute("res_attrs", res_attrs)) !isnothing(sym_visibility) && - push!(attributes, namedattribute("sym_visibility", sym_visibility)) + push!(_attributes, namedattribute("sym_visibility", sym_visibility)) return IR.create_operation( "shape.func", @@ -689,7 +677,7 @@ function function_library(; namedattribute("sym_name", sym_name), namedattribute("mapping", mapping) ] !isnothing(sym_visibility) && - push!(attributes, namedattribute("sym_visibility", sym_visibility)) + push!(_attributes, namedattribute("sym_visibility", sym_visibility)) return IR.create_operation( "shape.function_library", @@ -780,15 +768,12 @@ assertion failure. %false = shape.is_broadcastable [2,2], [3,2] ``` """ -function is_broadcastable( - shapes::Vector{Value}; result=nothing::Union{Nothing,IR.Type}, location=Location() -) - _results = IR.Type[] +function is_broadcastable(shapes::Vector{Value}; result::IR.Type, location=Location()) + _results = IR.Type[result,] _operands = Value[shapes...,] _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(result) && push!(_results, result) return IR.create_operation( "shape.is_broadcastable", @@ -797,8 +782,8 @@ function is_broadcastable( owned_regions=_owned_regions, successors=_successors, attributes=_attributes, - results=(length(_results) == 0 ? nothing : _results), - result_inference=(length(_results) == 0 ? true : false), + results=_results, + result_inference=false, ) end @@ -872,7 +857,7 @@ function meet( _successors = Block[] _attributes = NamedAttribute[] !isnothing(result) && push!(_results, result) - !isnothing(error) && push!(attributes, namedattribute("error", error)) + !isnothing(error) && push!(_attributes, namedattribute("error", error)) return IR.create_operation( "shape.meet", @@ -1098,15 +1083,12 @@ regarded as their equivalent non-error shapes. Error shapes can be tested for equality like any other shape value, meaning that the error value is equal to itself. """ -function shape_eq( - shapes::Vector{Value}; result=nothing::Union{Nothing,IR.Type}, location=Location() -) - _results = IR.Type[] +function shape_eq(shapes::Vector{Value}; result::IR.Type, location=Location()) + _results = IR.Type[result,] _operands = Value[shapes...,] _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(result) && push!(_results, result) return IR.create_operation( "shape.shape_eq", @@ -1115,8 +1097,8 @@ function shape_eq( owned_regions=_owned_regions, successors=_successors, attributes=_attributes, - results=(length(_results) == 0 ? nothing : _results), - result_inference=(length(_results) == 0 ? true : false), + results=_results, + result_inference=false, ) end diff --git a/src/Dialects/17/SparseTensor.jl b/src/Dialects/17/SparseTensor.jl index 43feb7d9..c7616b53 100644 --- a/src/Dialects/17/SparseTensor.jl +++ b/src/Dialects/17/SparseTensor.jl @@ -127,9 +127,9 @@ function binary( _successors = Block[] _attributes = NamedAttribute[] !isnothing(left_identity) && - push!(attributes, namedattribute("left_identity", left_identity)) + push!(_attributes, namedattribute("left_identity", left_identity)) !isnothing(right_identity) && - push!(attributes, namedattribute("right_identity", right_identity)) + push!(_attributes, namedattribute("right_identity", right_identity)) return IR.create_operation( "sparse_tensor.binary", @@ -174,15 +174,14 @@ function compress( count::Value, tensor::Value, lvlCoords::Vector{Value}; - result=nothing::Union{Nothing,IR.Type}, + result::IR.Type, location=Location(), ) - _results = IR.Type[] + _results = IR.Type[result,] _operands = Value[values, filled, added, count, tensor, lvlCoords...] _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(result) && push!(_results, result) return IR.create_operation( "sparse_tensor.compress", @@ -191,8 +190,8 @@ function compress( owned_regions=_owned_regions, successors=_successors, attributes=_attributes, - results=(length(_results) == 0 ? nothing : _results), - result_inference=(length(_results) == 0 ? true : false), + results=_results, + result_inference=false, ) end @@ -439,7 +438,7 @@ function foreach( _owned_regions = Region[region,] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(order) && push!(attributes, namedattribute("order", order)) + !isnothing(order) && push!(_attributes, namedattribute("order", order)) return IR.create_operation( "sparse_tensor.foreach", @@ -478,7 +477,7 @@ function storage_specifier_get( _successors = Block[] _attributes = NamedAttribute[namedattribute("specifierKind", specifierKind),] !isnothing(result) && push!(_results, result) - !isnothing(level) && push!(attributes, namedattribute("level", level)) + !isnothing(level) && push!(_attributes, namedattribute("level", level)) return IR.create_operation( "sparse_tensor.storage_specifier.get", @@ -525,15 +524,14 @@ function insert( value::Value, tensor::Value, lvlCoords::Vector{Value}; - result=nothing::Union{Nothing,IR.Type}, + result::IR.Type, location=Location(), ) - _results = IR.Type[] + _results = IR.Type[result,] _operands = Value[value, tensor, lvlCoords...] _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(result) && push!(_results, result) return IR.create_operation( "sparse_tensor.insert", @@ -542,8 +540,8 @@ function insert( owned_regions=_owned_regions, successors=_successors, attributes=_attributes, - results=(length(_results) == 0 ? nothing : _results), - result_inference=(length(_results) == 0 ? true : false), + results=_results, + result_inference=false, ) end @@ -587,7 +585,7 @@ function load( _successors = Block[] _attributes = NamedAttribute[] !isnothing(result) && push!(_results, result) - !isnothing(hasInserts) && push!(attributes, namedattribute("hasInserts", hasInserts)) + !isnothing(hasInserts) && push!(_attributes, namedattribute("hasInserts", hasInserts)) return IR.create_operation( "sparse_tensor.load", @@ -831,10 +829,10 @@ function push_back( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(n) && push!(operands, n) + !isnothing(n) && push!(_operands, n) !isnothing(outBuffer) && push!(_results, outBuffer) !isnothing(newSize) && push!(_results, newSize) - !isnothing(inbounds) && push!(attributes, namedattribute("inbounds", inbounds)) + !isnothing(inbounds) && push!(_attributes, namedattribute("inbounds", inbounds)) return IR.create_operation( "sparse_tensor.push_back", @@ -1016,7 +1014,7 @@ function storage_specifier_set( _successors = Block[] _attributes = NamedAttribute[namedattribute("specifierKind", specifierKind),] !isnothing(result) && push!(_results, result) - !isnothing(level) && push!(attributes, namedattribute("level", level)) + !isnothing(level) && push!(_attributes, namedattribute("level", level)) return IR.create_operation( "sparse_tensor.storage_specifier.set", @@ -1072,8 +1070,8 @@ function sort_coo( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[namedattribute("algorithm", algorithm),] - !isnothing(nx) && push!(attributes, namedattribute("nx", nx)) - !isnothing(ny) && push!(attributes, namedattribute("ny", ny)) + !isnothing(nx) && push!(_attributes, namedattribute("nx", nx)) + !isnothing(ny) && push!(_attributes, namedattribute("ny", ny)) return IR.create_operation( "sparse_tensor.sort_coo", @@ -1136,7 +1134,7 @@ function sort( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[namedattribute("algorithm", algorithm),] - push!(attributes, operandsegmentsizes([1, length(xs), length(ys)])) + push!(_attributes, operandsegmentsizes([1, length(xs), length(ys)])) return IR.create_operation( "sparse_tensor.sort", @@ -1185,7 +1183,7 @@ function storage_specifier_init( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(source) && push!(operands, source) + !isnothing(source) && push!(_operands, source) return IR.create_operation( "sparse_tensor.storage_specifier.init", @@ -1640,7 +1638,7 @@ function yield(result=nothing::Union{Nothing,Value}; location=Location()) _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(result) && push!(operands, result) + !isnothing(result) && push!(_operands, result) return IR.create_operation( "sparse_tensor.yield", diff --git a/src/Dialects/17/Tensor.jl b/src/Dialects/17/Tensor.jl index 952b556e..7d7a630e 100644 --- a/src/Dialects/17/Tensor.jl +++ b/src/Dialects/17/Tensor.jl @@ -366,7 +366,7 @@ function extract_slice( namedattribute("static_strides", static_strides), ] push!( - attributes, + _attributes, operandsegmentsizes([1, length(offsets), length(sizes), length(strides)]), ) @@ -529,7 +529,7 @@ function gather( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[namedattribute("gather_dims", gather_dims),] - !isnothing(unique) && push!(attributes, namedattribute("unique", unique)) + !isnothing(unique) && push!(_attributes, namedattribute("unique", unique)) return IR.create_operation( "tensor.gather", @@ -702,7 +702,7 @@ function insert_slice( namedattribute("static_strides", static_strides), ] push!( - attributes, + _attributes, operandsegmentsizes([1, 1, length(offsets), length(sizes), length(strides)]), ) @@ -776,13 +776,13 @@ function pack( namedattribute("inner_dims_pos", inner_dims_pos), namedattribute("static_inner_tiles", static_inner_tiles), ] - !isnothing(padding_value) && push!(operands, padding_value) + !isnothing(padding_value) && push!(_operands, padding_value) push!( - attributes, + _attributes, operandsegmentsizes([1, 1, isnothing(padding_value) ? 0 : 1, length(inner_tiles)]), ) !isnothing(outer_dims_perm) && - push!(attributes, namedattribute("outer_dims_perm", outer_dims_perm)) + push!(_attributes, namedattribute("outer_dims_perm", outer_dims_perm)) return IR.create_operation( "tensor.pack", @@ -886,8 +886,8 @@ function pad( _attributes = NamedAttribute[ namedattribute("static_low", static_low), namedattribute("static_high", static_high) ] - push!(attributes, operandsegmentsizes([1, length(low), length(high)])) - !isnothing(nofold) && push!(attributes, namedattribute("nofold", nofold)) + push!(_attributes, operandsegmentsizes([1, length(low), length(high)])) + !isnothing(nofold) && push!(_attributes, namedattribute("nofold", nofold)) return IR.create_operation( "tensor.pad", @@ -982,7 +982,7 @@ function parallel_insert_slice( namedattribute("static_strides", static_strides), ] push!( - attributes, + _attributes, operandsegmentsizes([1, 1, length(offsets), length(sizes), length(strides)]), ) @@ -1197,7 +1197,7 @@ function scatter( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[namedattribute("scatter_dims", scatter_dims),] - !isnothing(unique) && push!(attributes, namedattribute("unique", unique)) + !isnothing(unique) && push!(_attributes, namedattribute("unique", unique)) return IR.create_operation( "tensor.scatter", @@ -1298,7 +1298,7 @@ function unpack( namedattribute("static_inner_tiles", static_inner_tiles), ] !isnothing(outer_dims_perm) && - push!(attributes, namedattribute("outer_dims_perm", outer_dims_perm)) + push!(_attributes, namedattribute("outer_dims_perm", outer_dims_perm)) return IR.create_operation( "tensor.unpack", diff --git a/src/Dialects/17/Tosa.jl b/src/Dialects/17/Tosa.jl index 980cd346..42430c5c 100644 --- a/src/Dialects/17/Tosa.jl +++ b/src/Dialects/17/Tosa.jl @@ -169,7 +169,7 @@ function avg_pool2d( namedattribute("acc_type", acc_type), ] !isnothing(quantization_info) && - push!(attributes, namedattribute("quantization_info", quantization_info)) + push!(_attributes, namedattribute("quantization_info", quantization_info)) return IR.create_operation( "tosa.avg_pool2d", @@ -491,7 +491,7 @@ function conv2d( namedattribute("dilation", dilation), ] !isnothing(quantization_info) && - push!(attributes, namedattribute("quantization_info", quantization_info)) + push!(_attributes, namedattribute("quantization_info", quantization_info)) return IR.create_operation( "tosa.conv2d", @@ -531,7 +531,7 @@ function conv3d( namedattribute("dilation", dilation), ] !isnothing(quantization_info) && - push!(attributes, namedattribute("quantization_info", quantization_info)) + push!(_attributes, namedattribute("quantization_info", quantization_info)) return IR.create_operation( "tosa.conv3d", @@ -624,7 +624,7 @@ function depthwise_conv2d( namedattribute("dilation", dilation), ] !isnothing(quantization_info) && - push!(attributes, namedattribute("quantization_info", quantization_info)) + push!(_attributes, namedattribute("quantization_info", quantization_info)) return IR.create_operation( "tosa.depthwise_conv2d", @@ -822,7 +822,7 @@ function fully_connected( _successors = Block[] _attributes = NamedAttribute[] !isnothing(quantization_info) && - push!(attributes, namedattribute("quantization_info", quantization_info)) + push!(_attributes, namedattribute("quantization_info", quantization_info)) return IR.create_operation( "tosa.fully_connected", @@ -1159,7 +1159,7 @@ function matmul( _successors = Block[] _attributes = NamedAttribute[] !isnothing(quantization_info) && - push!(attributes, namedattribute("quantization_info", quantization_info)) + push!(_attributes, namedattribute("quantization_info", quantization_info)) return IR.create_operation( "tosa.matmul", @@ -1294,7 +1294,7 @@ function negate( _successors = Block[] _attributes = NamedAttribute[] !isnothing(quantization_info) && - push!(attributes, namedattribute("quantization_info", quantization_info)) + push!(_attributes, namedattribute("quantization_info", quantization_info)) return IR.create_operation( "tosa.negate", @@ -1342,9 +1342,9 @@ function pad( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(pad_const) && push!(operands, pad_const) + !isnothing(pad_const) && push!(_operands, pad_const) !isnothing(quantization_info) && - push!(attributes, namedattribute("quantization_info", quantization_info)) + push!(_attributes, namedattribute("quantization_info", quantization_info)) return IR.create_operation( "tosa.pad", @@ -2024,7 +2024,7 @@ function transpose_conv2d( namedattribute("out_shape", out_shape), ] !isnothing(quantization_info) && - push!(attributes, namedattribute("quantization_info", quantization_info)) + push!(_attributes, namedattribute("quantization_info", quantization_info)) return IR.create_operation( "tosa.transpose_conv2d", diff --git a/src/Dialects/17/Transform.jl b/src/Dialects/17/Transform.jl index 38d8fcdf..fa70e144 100644 --- a/src/Dialects/17/Transform.jl +++ b/src/Dialects/17/Transform.jl @@ -230,26 +230,26 @@ function bufferization_one_shot_bufferize( _successors = Block[] _attributes = NamedAttribute[] !isnothing(function_boundary_type_conversion) && push!( - attributes, + _attributes, namedattribute( "function_boundary_type_conversion", function_boundary_type_conversion ), ) !isnothing(allow_return_allocs) && - push!(attributes, namedattribute("allow_return_allocs", allow_return_allocs)) + push!(_attributes, namedattribute("allow_return_allocs", allow_return_allocs)) !isnothing(allow_unknown_ops) && - push!(attributes, namedattribute("allow_unknown_ops", allow_unknown_ops)) + push!(_attributes, namedattribute("allow_unknown_ops", allow_unknown_ops)) !isnothing(bufferize_function_boundaries) && push!( - attributes, + _attributes, namedattribute("bufferize_function_boundaries", bufferize_function_boundaries), ) !isnothing(create_deallocs) && - push!(attributes, namedattribute("create_deallocs", create_deallocs)) + push!(_attributes, namedattribute("create_deallocs", create_deallocs)) !isnothing(test_analysis_only) && - push!(attributes, namedattribute("test_analysis_only", test_analysis_only)) + push!(_attributes, namedattribute("test_analysis_only", test_analysis_only)) !isnothing(print_conflicts) && - push!(attributes, namedattribute("print_conflicts", print_conflicts)) - !isnothing(memcpy_op) && push!(attributes, namedattribute("memcpy_op", memcpy_op)) + push!(_attributes, namedattribute("print_conflicts", print_conflicts)) + !isnothing(memcpy_op) && push!(_attributes, namedattribute("memcpy_op", memcpy_op)) return IR.create_operation( "transform.bufferization.one_shot_bufferize", @@ -363,9 +363,9 @@ function gpu_map_forall_to_blocks( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(grid_dims) && push!(attributes, namedattribute("grid_dims", grid_dims)) + !isnothing(grid_dims) && push!(_attributes, namedattribute("grid_dims", grid_dims)) !isnothing(generate_gpu_launch) && - push!(attributes, namedattribute("generate_gpu_launch", generate_gpu_launch)) + push!(_attributes, namedattribute("generate_gpu_launch", generate_gpu_launch)) return IR.create_operation( "transform.gpu.map_forall_to_blocks", @@ -483,10 +483,10 @@ function gpu_map_nested_forall_to_threads( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(block_dims) && push!(attributes, namedattribute("block_dims", block_dims)) - !isnothing(warp_dims) && push!(attributes, namedattribute("warp_dims", warp_dims)) + !isnothing(block_dims) && push!(_attributes, namedattribute("block_dims", block_dims)) + !isnothing(warp_dims) && push!(_attributes, namedattribute("warp_dims", warp_dims)) !isnothing(sync_after_distribute) && - push!(attributes, namedattribute("sync_after_distribute", sync_after_distribute)) + push!(_attributes, namedattribute("sync_after_distribute", sync_after_distribute)) return IR.create_operation( "transform.gpu.map_nested_forall_to_threads", @@ -548,9 +548,11 @@ function match_structured_body( _successors = Block[] _attributes = NamedAttribute[] !isnothing(reduction_position) && - push!(attributes, namedattribute("reduction_position", reduction_position)) - !isnothing(passthrough) && push!(attributes, namedattribute("passthrough", passthrough)) - !isnothing(contraction) && push!(attributes, namedattribute("contraction", contraction)) + push!(_attributes, namedattribute("reduction_position", reduction_position)) + !isnothing(passthrough) && + push!(_attributes, namedattribute("passthrough", passthrough)) + !isnothing(contraction) && + push!(_attributes, namedattribute("contraction", contraction)) return IR.create_operation( "transform.match.structured.body", @@ -683,10 +685,11 @@ function match_structured_dim( _successors = Block[] _attributes = NamedAttribute[namedattribute("raw_dim_list", raw_dim_list),] !isnothing(result) && push!(_results, result) - !isnothing(is_inverted) && push!(attributes, namedattribute("is_inverted", is_inverted)) - !isnothing(is_all) && push!(attributes, namedattribute("is_all", is_all)) - !isnothing(parallel) && push!(attributes, namedattribute("parallel", parallel)) - !isnothing(reduction) && push!(attributes, namedattribute("reduction", reduction)) + !isnothing(is_inverted) && + push!(_attributes, namedattribute("is_inverted", is_inverted)) + !isnothing(is_all) && push!(_attributes, namedattribute("is_all", is_all)) + !isnothing(parallel) && push!(_attributes, namedattribute("parallel", parallel)) + !isnothing(reduction) && push!(_attributes, namedattribute("reduction", reduction)) return IR.create_operation( "transform.match.structured.dim", @@ -813,11 +816,13 @@ function match_structured_init( _successors = Block[] _attributes = NamedAttribute[namedattribute("raw_position_list", raw_position_list),] !isnothing(result) && push!(_results, result) - !isnothing(is_inverted) && push!(attributes, namedattribute("is_inverted", is_inverted)) - !isnothing(is_all) && push!(attributes, namedattribute("is_all", is_all)) - !isnothing(permutation) && push!(attributes, namedattribute("permutation", permutation)) + !isnothing(is_inverted) && + push!(_attributes, namedattribute("is_inverted", is_inverted)) + !isnothing(is_all) && push!(_attributes, namedattribute("is_all", is_all)) + !isnothing(permutation) && + push!(_attributes, namedattribute("permutation", permutation)) !isnothing(projected_permutation) && - push!(attributes, namedattribute("projected_permutation", projected_permutation)) + push!(_attributes, namedattribute("projected_permutation", projected_permutation)) return IR.create_operation( "transform.match.structured.init", @@ -909,11 +914,13 @@ function match_structured_input( _successors = Block[] _attributes = NamedAttribute[namedattribute("raw_position_list", raw_position_list),] !isnothing(result) && push!(_results, result) - !isnothing(is_inverted) && push!(attributes, namedattribute("is_inverted", is_inverted)) - !isnothing(is_all) && push!(attributes, namedattribute("is_all", is_all)) - !isnothing(permutation) && push!(attributes, namedattribute("permutation", permutation)) + !isnothing(is_inverted) && + push!(_attributes, namedattribute("is_inverted", is_inverted)) + !isnothing(is_all) && push!(_attributes, namedattribute("is_all", is_all)) + !isnothing(permutation) && + push!(_attributes, namedattribute("permutation", permutation)) !isnothing(projected_permutation) && - push!(attributes, namedattribute("projected_permutation", projected_permutation)) + push!(_attributes, namedattribute("projected_permutation", projected_permutation)) return IR.create_operation( "transform.match.structured.input", @@ -1055,7 +1062,8 @@ function match_structured( _successors = Block[] _attributes = NamedAttribute[] !isnothing(failure_propagation_mode) && push!( - attributes, namedattribute("failure_propagation_mode", failure_propagation_mode) + _attributes, + namedattribute("failure_propagation_mode", failure_propagation_mode), ) return IR.create_operation( @@ -1152,8 +1160,8 @@ function match_structured_result( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[namedattribute("position", position),] - !isnothing(any) && push!(attributes, namedattribute("any", any)) - !isnothing(single) && push!(attributes, namedattribute("single", single)) + !isnothing(any) && push!(_attributes, namedattribute("any", any)) + !isnothing(single) && push!(_attributes, namedattribute("single", single)) return IR.create_operation( "transform.match.structured.result", @@ -1372,11 +1380,11 @@ function structured_bufferize_to_allocation( _successors = Block[] _attributes = NamedAttribute[] !isnothing(memory_space) && - push!(attributes, namedattribute("memory_space", memory_space)) - !isnothing(memcpy_op) && push!(attributes, namedattribute("memcpy_op", memcpy_op)) - !isnothing(alloc_op) && push!(attributes, namedattribute("alloc_op", alloc_op)) + push!(_attributes, namedattribute("memory_space", memory_space)) + !isnothing(memcpy_op) && push!(_attributes, namedattribute("memcpy_op", memcpy_op)) + !isnothing(alloc_op) && push!(_attributes, namedattribute("alloc_op", alloc_op)) !isnothing(bufferize_destination_only) && push!( - attributes, + _attributes, namedattribute("bufferize_destination_only", bufferize_destination_only), ) @@ -1673,9 +1681,9 @@ function structured_fuse( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(tile_sizes) && push!(attributes, namedattribute("tile_sizes", tile_sizes)) + !isnothing(tile_sizes) && push!(_attributes, namedattribute("tile_sizes", tile_sizes)) !isnothing(tile_interchange) && - push!(attributes, namedattribute("tile_interchange", tile_interchange)) + push!(_attributes, namedattribute("tile_interchange", tile_interchange)) return IR.create_operation( "transform.structured.fuse", @@ -1753,7 +1761,7 @@ function structured_hoist_pad_build_packing_loop_nest( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(transpose) && push!(attributes, namedattribute("transpose", transpose)) + !isnothing(transpose) && push!(_attributes, namedattribute("transpose", transpose)) return IR.create_operation( "transform.structured.hoist_pad.build_packing_loop_nest", @@ -1796,7 +1804,7 @@ function structured_hoist_pad( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[namedattribute("num_loops", num_loops),] - !isnothing(transpose) && push!(attributes, namedattribute("transpose", transpose)) + !isnothing(transpose) && push!(_attributes, namedattribute("transpose", transpose)) return IR.create_operation( "transform.structured.hoist_pad", @@ -1954,7 +1962,7 @@ function structured_interchange( _successors = Block[] _attributes = NamedAttribute[] !isnothing(iterator_interchange) && - push!(attributes, namedattribute("iterator_interchange", iterator_interchange)) + push!(_attributes, namedattribute("iterator_interchange", iterator_interchange)) return IR.create_operation( "transform.structured.interchange", @@ -2137,11 +2145,11 @@ function structured_masked_vectorize( _successors = Block[] _attributes = NamedAttribute[] !isnothing(vectorize_nd_extract) && - push!(attributes, namedattribute("vectorize_nd_extract", vectorize_nd_extract)) + push!(_attributes, namedattribute("vectorize_nd_extract", vectorize_nd_extract)) !isnothing(scalable_sizes) && - push!(attributes, namedattribute("scalable_sizes", scalable_sizes)) + push!(_attributes, namedattribute("scalable_sizes", scalable_sizes)) !isnothing(static_vector_sizes) && - push!(attributes, namedattribute("static_vector_sizes", static_vector_sizes)) + push!(_attributes, namedattribute("static_vector_sizes", static_vector_sizes)) return IR.create_operation( "transform.structured.masked_vectorize", @@ -2199,11 +2207,11 @@ function structured_match( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(ops) && push!(attributes, namedattribute("ops", ops)) - !isnothing(interface) && push!(attributes, namedattribute("interface", interface)) - !isnothing(op_attrs) && push!(attributes, namedattribute("op_attrs", op_attrs)) + !isnothing(ops) && push!(_attributes, namedattribute("ops", ops)) + !isnothing(interface) && push!(_attributes, namedattribute("interface", interface)) + !isnothing(op_attrs) && push!(_attributes, namedattribute("op_attrs", op_attrs)) !isnothing(filter_result_type) && - push!(attributes, namedattribute("filter_result_type", filter_result_type)) + push!(_attributes, namedattribute("filter_result_type", filter_result_type)) return IR.create_operation( "transform.structured.match", @@ -2290,7 +2298,7 @@ function structured_multitile_sizes( _attributes = NamedAttribute[ namedattribute("dimension", dimension), namedattribute("target_size", target_size) ] - !isnothing(divisor) && push!(attributes, namedattribute("divisor", divisor)) + !isnothing(divisor) && push!(_attributes, namedattribute("divisor", divisor)) return IR.create_operation( "transform.structured.multitile_sizes", @@ -2376,17 +2384,17 @@ function structured_pack_greedily( _successors = Block[] _attributes = NamedAttribute[] !isnothing(static_matmul_packed_sizes) && push!( - attributes, + _attributes, namedattribute("static_matmul_packed_sizes", static_matmul_packed_sizes), ) !isnothing(matmul_padded_sizes_next_multiple_of) && push!( - attributes, + _attributes, namedattribute( "matmul_padded_sizes_next_multiple_of", matmul_padded_sizes_next_multiple_of ), ) !isnothing(matmul_inner_dims_order) && push!( - attributes, namedattribute("matmul_inner_dims_order", matmul_inner_dims_order) + _attributes, namedattribute("matmul_inner_dims_order", matmul_inner_dims_order) ) return IR.create_operation( @@ -2475,7 +2483,7 @@ function structured_pack( _successors = Block[] _attributes = NamedAttribute[] !isnothing(static_packed_sizes) && - push!(attributes, namedattribute("static_packed_sizes", static_packed_sizes)) + push!(_attributes, namedattribute("static_packed_sizes", static_packed_sizes)) return IR.create_operation( "transform.structured.pack", @@ -2542,8 +2550,8 @@ function structured_pack_transpose( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(outer_perm) && push!(attributes, namedattribute("outer_perm", outer_perm)) - !isnothing(inner_perm) && push!(attributes, namedattribute("inner_perm", inner_perm)) + !isnothing(outer_perm) && push!(_attributes, namedattribute("outer_perm", outer_perm)) + !isnothing(inner_perm) && push!(_attributes, namedattribute("inner_perm", inner_perm)) return IR.create_operation( "transform.structured.pack_transpose", @@ -2593,16 +2601,16 @@ function structured_pad( _successors = Block[] _attributes = NamedAttribute[] !isnothing(padding_values) && - push!(attributes, namedattribute("padding_values", padding_values)) + push!(_attributes, namedattribute("padding_values", padding_values)) !isnothing(padding_dimensions) && - push!(attributes, namedattribute("padding_dimensions", padding_dimensions)) + push!(_attributes, namedattribute("padding_dimensions", padding_dimensions)) !isnothing(pad_to_multiple_of) && - push!(attributes, namedattribute("pad_to_multiple_of", pad_to_multiple_of)) + push!(_attributes, namedattribute("pad_to_multiple_of", pad_to_multiple_of)) !isnothing(pack_paddings) && - push!(attributes, namedattribute("pack_paddings", pack_paddings)) + push!(_attributes, namedattribute("pack_paddings", pack_paddings)) !isnothing(transpose_paddings) && - push!(attributes, namedattribute("transpose_paddings", transpose_paddings)) - !isnothing(copy_back) && push!(attributes, namedattribute("copy_back", copy_back)) + push!(_attributes, namedattribute("transpose_paddings", transpose_paddings)) + !isnothing(copy_back) && push!(_attributes, namedattribute("copy_back", copy_back)) return IR.create_operation( "transform.structured.pad", @@ -2652,16 +2660,16 @@ function structured_promote( _successors = Block[] _attributes = NamedAttribute[] !isnothing(operands_to_promote) && - push!(attributes, namedattribute("operands_to_promote", operands_to_promote)) + push!(_attributes, namedattribute("operands_to_promote", operands_to_promote)) !isnothing(use_full_tile_buffers) && - push!(attributes, namedattribute("use_full_tile_buffers", use_full_tile_buffers)) + push!(_attributes, namedattribute("use_full_tile_buffers", use_full_tile_buffers)) !isnothing(use_full_tiles_by_default) && push!( - attributes, + _attributes, namedattribute("use_full_tiles_by_default", use_full_tiles_by_default), ) - !isnothing(use_alloca) && push!(attributes, namedattribute("use_alloca", use_alloca)) - !isnothing(mapping) && push!(attributes, namedattribute("mapping", mapping)) - !isnothing(alignment) && push!(attributes, namedattribute("alignment", alignment)) + !isnothing(use_alloca) && push!(_attributes, namedattribute("use_alloca", use_alloca)) + !isnothing(mapping) && push!(_attributes, namedattribute("mapping", mapping)) + !isnothing(alignment) && push!(_attributes, namedattribute("alignment", alignment)) return IR.create_operation( "transform.structured.promote", @@ -2834,7 +2842,7 @@ function structured_split( namedattribute("dimension", dimension), namedattribute("static_split_point", static_split_point), ] - !isnothing(dynamic_split_point) && push!(operands, dynamic_split_point) + !isnothing(dynamic_split_point) && push!(_operands, dynamic_split_point) return IR.create_operation( "transform.structured.split", @@ -3003,14 +3011,14 @@ function structured_split_reduction( _successors = Block[] _attributes = NamedAttribute[] !isnothing(split_factor) && - push!(attributes, namedattribute("split_factor", split_factor)) + push!(_attributes, namedattribute("split_factor", split_factor)) !isnothing(insert_split_dimension) && - push!(attributes, namedattribute("insert_split_dimension", insert_split_dimension)) + push!(_attributes, namedattribute("insert_split_dimension", insert_split_dimension)) !isnothing(inner_parallel) && - push!(attributes, namedattribute("inner_parallel", inner_parallel)) + push!(_attributes, namedattribute("inner_parallel", inner_parallel)) !isnothing(use_scaling_algorithm) && - push!(attributes, namedattribute("use_scaling_algorithm", use_scaling_algorithm)) - !isnothing(use_alloc) && push!(attributes, namedattribute("use_alloc", use_alloc)) + push!(_attributes, namedattribute("use_scaling_algorithm", use_scaling_algorithm)) + !isnothing(use_alloc) && push!(_attributes, namedattribute("use_alloc", use_alloc)) return IR.create_operation( "transform.structured.split_reduction", @@ -3079,10 +3087,11 @@ function structured_tile( _successors = Block[] _attributes = NamedAttribute[] !isnothing(static_sizes) && - push!(attributes, namedattribute("static_sizes", static_sizes)) - !isnothing(interchange) && push!(attributes, namedattribute("interchange", interchange)) + push!(_attributes, namedattribute("static_sizes", static_sizes)) + !isnothing(interchange) && + push!(_attributes, namedattribute("interchange", interchange)) !isnothing(scalable_sizes) && - push!(attributes, namedattribute("scalable_sizes", scalable_sizes)) + push!(_attributes, namedattribute("scalable_sizes", scalable_sizes)) return IR.create_operation( "transform.structured.tile", @@ -3179,9 +3188,10 @@ function structured_tile_reduction_using_forall( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(num_threads) && push!(attributes, namedattribute("num_threads", num_threads)) - !isnothing(tile_sizes) && push!(attributes, namedattribute("tile_sizes", tile_sizes)) - !isnothing(mapping) && push!(attributes, namedattribute("mapping", mapping)) + !isnothing(num_threads) && + push!(_attributes, namedattribute("num_threads", num_threads)) + !isnothing(tile_sizes) && push!(_attributes, namedattribute("tile_sizes", tile_sizes)) + !isnothing(mapping) && push!(_attributes, namedattribute("mapping", mapping)) return IR.create_operation( "transform.structured.tile_reduction_using_forall", @@ -3279,7 +3289,7 @@ function structured_tile_reduction_using_scf( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(tile_sizes) && push!(attributes, namedattribute("tile_sizes", tile_sizes)) + !isnothing(tile_sizes) && push!(_attributes, namedattribute("tile_sizes", tile_sizes)) return IR.create_operation( "transform.structured.tile_reduction_using_scf", @@ -3368,10 +3378,10 @@ function structured_tile_to_forall_op( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(packed_num_threads) && push!(operands, packed_num_threads) - !isnothing(packed_tile_sizes) && push!(operands, packed_tile_sizes) + !isnothing(packed_num_threads) && push!(_operands, packed_num_threads) + !isnothing(packed_tile_sizes) && push!(_operands, packed_tile_sizes) push!( - attributes, + _attributes, operandsegmentsizes([ 1, length(num_threads), @@ -3381,10 +3391,10 @@ function structured_tile_to_forall_op( ]), ) !isnothing(static_num_threads) && - push!(attributes, namedattribute("static_num_threads", static_num_threads)) + push!(_attributes, namedattribute("static_num_threads", static_num_threads)) !isnothing(static_tile_sizes) && - push!(attributes, namedattribute("static_tile_sizes", static_tile_sizes)) - !isnothing(mapping) && push!(attributes, namedattribute("mapping", mapping)) + push!(_attributes, namedattribute("static_tile_sizes", static_tile_sizes)) + !isnothing(mapping) && push!(_attributes, namedattribute("mapping", mapping)) return IR.create_operation( "transform.structured.tile_to_forall_op", @@ -3452,8 +3462,9 @@ function structured_tile_to_scf_for( _successors = Block[] _attributes = NamedAttribute[] !isnothing(static_sizes) && - push!(attributes, namedattribute("static_sizes", static_sizes)) - !isnothing(interchange) && push!(attributes, namedattribute("interchange", interchange)) + push!(_attributes, namedattribute("static_sizes", static_sizes)) + !isnothing(interchange) && + push!(_attributes, namedattribute("interchange", interchange)) return IR.create_operation( "transform.structured.tile_to_scf_for", @@ -3519,18 +3530,18 @@ function structured_vectorize( _successors = Block[] _attributes = NamedAttribute[] !isnothing(vectorize_padding) && - push!(attributes, namedattribute("vectorize_padding", vectorize_padding)) + push!(_attributes, namedattribute("vectorize_padding", vectorize_padding)) !isnothing(vectorize_nd_extract) && - push!(attributes, namedattribute("vectorize_nd_extract", vectorize_nd_extract)) + push!(_attributes, namedattribute("vectorize_nd_extract", vectorize_nd_extract)) !isnothing(disable_multi_reduction_to_contract_patterns) && push!( - attributes, + _attributes, namedattribute( "disable_multi_reduction_to_contract_patterns", disable_multi_reduction_to_contract_patterns, ), ) !isnothing(disable_transfer_permutation_map_lowering_patterns) && push!( - attributes, + _attributes, namedattribute( "disable_transfer_permutation_map_lowering_patterns", disable_transfer_permutation_map_lowering_patterns, @@ -3770,7 +3781,7 @@ function memref_multibuffer( _successors = Block[] _attributes = NamedAttribute[namedattribute("factor", factor),] !isnothing(skip_analysis) && - push!(attributes, namedattribute("skip_analysis", skip_analysis)) + push!(_attributes, namedattribute("skip_analysis", skip_analysis)) return IR.create_operation( "transform.memref.multibuffer", @@ -3815,7 +3826,7 @@ function nvgpu_create_async_groups( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(bypass_l1) && push!(attributes, namedattribute("bypass_l1", bypass_l1)) + !isnothing(bypass_l1) && push!(_attributes, namedattribute("bypass_l1", bypass_l1)) return IR.create_operation( "transform.nvgpu.create_async_groups", @@ -3877,9 +3888,10 @@ function nvgpu_pipeline_shared_memory_copies( _successors = Block[] _attributes = NamedAttribute[namedattribute("depth", depth),] !isnothing(peel_epilogue) && - push!(attributes, namedattribute("peel_epilogue", peel_epilogue)) + push!(_attributes, namedattribute("peel_epilogue", peel_epilogue)) !isnothing(failure_propagation_mode) && push!( - attributes, namedattribute("failure_propagation_mode", failure_propagation_mode) + _attributes, + namedattribute("failure_propagation_mode", failure_propagation_mode), ) return IR.create_operation( @@ -3970,8 +3982,8 @@ function loop_get_parent_for( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(num_loops) && push!(attributes, namedattribute("num_loops", num_loops)) - !isnothing(affine) && push!(attributes, namedattribute("affine", affine)) + !isnothing(num_loops) && push!(_attributes, namedattribute("num_loops", num_loops)) + !isnothing(affine) && push!(_attributes, namedattribute("affine", affine)) return IR.create_operation( "transform.loop.get_parent_for", @@ -4092,7 +4104,7 @@ function loop_peel( _successors = Block[] _attributes = NamedAttribute[] !isnothing(fail_if_already_divisible) && push!( - attributes, + _attributes, namedattribute("fail_if_already_divisible", fail_if_already_divisible), ) @@ -4144,9 +4156,9 @@ function loop_pipeline( _successors = Block[] _attributes = NamedAttribute[] !isnothing(iteration_interval) && - push!(attributes, namedattribute("iteration_interval", iteration_interval)) + push!(_attributes, namedattribute("iteration_interval", iteration_interval)) !isnothing(read_latency) && - push!(attributes, namedattribute("read_latency", read_latency)) + push!(_attributes, namedattribute("read_latency", read_latency)) return IR.create_operation( "transform.loop.pipeline", @@ -4258,7 +4270,7 @@ function scf_take_assumed_branch( _successors = Block[] _attributes = NamedAttribute[] !isnothing(take_else_branch) && - push!(attributes, namedattribute("take_else_branch", take_else_branch)) + push!(_attributes, namedattribute("take_else_branch", take_else_branch)) return IR.create_operation( "transform.scf.take_assumed_branch", @@ -4347,7 +4359,7 @@ function apply_patterns_tensor_fold_tensor_empty(; _successors = Block[] _attributes = NamedAttribute[] !isnothing(fold_single_use_only) && - push!(attributes, namedattribute("fold_single_use_only", fold_single_use_only)) + push!(_attributes, namedattribute("fold_single_use_only", fold_single_use_only)) return IR.create_operation( "transform.apply_patterns.tensor.fold_tensor_empty", @@ -4616,7 +4628,7 @@ function alternatives( _owned_regions = Region[alternatives...,] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(scope) && push!(operands, scope) + !isnothing(scope) && push!(_operands, scope) return IR.create_operation( "transform.alternatives", @@ -4650,7 +4662,7 @@ function annotate( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[namedattribute("name", name),] - !isnothing(param) && push!(operands, param) + !isnothing(param) && push!(_operands, param) return IR.create_operation( "transform.annotate", @@ -4821,7 +4833,7 @@ function apply_patterns( _owned_regions = Region[patterns,] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(apply_cse) && push!(attributes, namedattribute("apply_cse", apply_cse)) + !isnothing(apply_cse) && push!(_attributes, namedattribute("apply_cse", apply_cse)) return IR.create_operation( "transform.apply_patterns", @@ -4858,7 +4870,7 @@ function apply_registered_pass( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[namedattribute("pass_name", pass_name),] - !isnothing(options) && push!(attributes, namedattribute("options", options)) + !isnothing(options) && push!(_attributes, namedattribute("options", options)) return IR.create_operation( "transform.apply_registered_pass", @@ -5106,9 +5118,10 @@ function get_parent_op( _successors = Block[] _attributes = NamedAttribute[] !isnothing(isolated_from_above) && - push!(attributes, namedattribute("isolated_from_above", isolated_from_above)) - !isnothing(op_name) && push!(attributes, namedattribute("op_name", op_name)) - !isnothing(deduplicate) && push!(attributes, namedattribute("deduplicate", deduplicate)) + push!(_attributes, namedattribute("isolated_from_above", isolated_from_above)) + !isnothing(op_name) && push!(_attributes, namedattribute("op_name", op_name)) + !isnothing(deduplicate) && + push!(_attributes, namedattribute("deduplicate", deduplicate)) return IR.create_operation( "transform.get_parent_op", @@ -5195,7 +5208,7 @@ function get_type(value::Value; type_param::IR.Type, elemental=nothing, location _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(elemental) && push!(attributes, namedattribute("elemental", elemental)) + !isnothing(elemental) && push!(_attributes, namedattribute("elemental", elemental)) return IR.create_operation( "transform.get_type", @@ -5336,7 +5349,8 @@ function merge_handles( _successors = Block[] _attributes = NamedAttribute[] !isnothing(result) && push!(_results, result) - !isnothing(deduplicate) && push!(attributes, namedattribute("deduplicate", deduplicate)) + !isnothing(deduplicate) && + push!(_attributes, namedattribute("deduplicate", deduplicate)) return IR.create_operation( "transform.merge_handles", @@ -5394,9 +5408,9 @@ function named_sequence(; 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)) + 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)) return IR.create_operation( "transform.named_sequence", @@ -5452,8 +5466,8 @@ function print(target=nothing::Union{Nothing,Value}; name=nothing, location=Loca _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(target) && push!(operands, target) - !isnothing(name) && push!(attributes, namedattribute("name", name)) + !isnothing(target) && push!(_operands, target) + !isnothing(name) && push!(_attributes, namedattribute("name", name)) return IR.create_operation( "transform.print", @@ -5611,9 +5625,9 @@ function sequence( _attributes = NamedAttribute[namedattribute( "failure_propagation_mode", failure_propagation_mode ),] - !isnothing(root) && push!(operands, root) + !isnothing(root) && push!(_operands, root) push!( - attributes, operandsegmentsizes([isnothing(root) ? 0 : 1, length(extra_bindings)]) + _attributes, operandsegmentsizes([isnothing(root) ? 0 : 1, length(extra_bindings)]) ) return IR.create_operation( @@ -5666,15 +5680,15 @@ function split_handle( _successors = Block[] _attributes = NamedAttribute[] !isnothing(pass_through_empty_handle) && push!( - attributes, + _attributes, namedattribute("pass_through_empty_handle", pass_through_empty_handle), ) !isnothing(fail_on_payload_too_small) && push!( - attributes, + _attributes, namedattribute("fail_on_payload_too_small", fail_on_payload_too_small), ) !isnothing(overflow_result) && - push!(attributes, namedattribute("overflow_result", overflow_result)) + push!(_attributes, namedattribute("overflow_result", overflow_result)) return IR.create_operation( "transform.split_handle", @@ -5825,7 +5839,7 @@ function apply_patterns_vector_lower_contraction(; _successors = Block[] _attributes = NamedAttribute[] !isnothing(lowering_strategy) && - push!(attributes, namedattribute("lowering_strategy", lowering_strategy)) + push!(_attributes, namedattribute("lowering_strategy", lowering_strategy)) return IR.create_operation( "transform.apply_patterns.vector.lower_contraction", @@ -5938,7 +5952,7 @@ function apply_patterns_vector_lower_multi_reduction(; _successors = Block[] _attributes = NamedAttribute[] !isnothing(lowering_strategy) && - push!(attributes, namedattribute("lowering_strategy", lowering_strategy)) + push!(_attributes, namedattribute("lowering_strategy", lowering_strategy)) return IR.create_operation( "transform.apply_patterns.vector.lower_multi_reduction", @@ -6051,7 +6065,7 @@ function apply_patterns_vector_lower_transfer(; _successors = Block[] _attributes = NamedAttribute[] !isnothing(max_transfer_rank) && - push!(attributes, namedattribute("max_transfer_rank", max_transfer_rank)) + push!(_attributes, namedattribute("max_transfer_rank", max_transfer_rank)) return IR.create_operation( "transform.apply_patterns.vector.lower_transfer", @@ -6083,9 +6097,9 @@ function apply_patterns_vector_lower_transpose(; _successors = Block[] _attributes = NamedAttribute[] !isnothing(lowering_strategy) && - push!(attributes, namedattribute("lowering_strategy", lowering_strategy)) + push!(_attributes, namedattribute("lowering_strategy", lowering_strategy)) !isnothing(avx2_lowering_strategy) && - push!(attributes, namedattribute("avx2_lowering_strategy", avx2_lowering_strategy)) + push!(_attributes, namedattribute("avx2_lowering_strategy", avx2_lowering_strategy)) return IR.create_operation( "transform.apply_patterns.vector.lower_transpose", @@ -6175,7 +6189,7 @@ function apply_patterns_vector_split_transfer_full_partial(; _successors = Block[] _attributes = NamedAttribute[] !isnothing(split_transfer_strategy) && push!( - attributes, namedattribute("split_transfer_strategy", split_transfer_strategy) + _attributes, namedattribute("split_transfer_strategy", split_transfer_strategy) ) return IR.create_operation( @@ -6243,8 +6257,9 @@ function apply_patterns_vector_transfer_to_scf(; _successors = Block[] _attributes = NamedAttribute[] !isnothing(max_transfer_rank) && - push!(attributes, namedattribute("max_transfer_rank", max_transfer_rank)) - !isnothing(full_unroll) && push!(attributes, namedattribute("full_unroll", full_unroll)) + push!(_attributes, namedattribute("max_transfer_rank", max_transfer_rank)) + !isnothing(full_unroll) && + push!(_attributes, namedattribute("full_unroll", full_unroll)) return IR.create_operation( "transform.apply_patterns.vector.transfer_to_scf", diff --git a/src/Dialects/17/UB.jl b/src/Dialects/17/UB.jl index 8c793ed7..e7e81163 100644 --- a/src/Dialects/17/UB.jl +++ b/src/Dialects/17/UB.jl @@ -34,7 +34,7 @@ function poison(; result::IR.Type, value=nothing, location=Location()) _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(value) && push!(attributes, namedattribute("value", value)) + !isnothing(value) && push!(_attributes, namedattribute("value", value)) return IR.create_operation( "ub.poison", diff --git a/src/Dialects/17/Vector.jl b/src/Dialects/17/Vector.jl index c629e1e9..5ce7c8d8 100644 --- a/src/Dialects/17/Vector.jl +++ b/src/Dialects/17/Vector.jl @@ -371,7 +371,7 @@ function contract( namedattribute("indexing_maps", indexing_maps), namedattribute("iterator_types", iterator_types), ] - !isnothing(kind) && push!(attributes, namedattribute("kind", kind)) + !isnothing(kind) && push!(_attributes, namedattribute("kind", kind)) return IR.create_operation( "vector.contract", @@ -529,7 +529,7 @@ function extractelement( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(position) && push!(operands, position) + !isnothing(position) && push!(_operands, position) return IR.create_operation( "vector.extractelement", @@ -814,7 +814,7 @@ function insertelement( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(position) && push!(operands, position) + !isnothing(position) && push!(_operands, position) !isnothing(result) && push!(_results, result) return IR.create_operation( @@ -1057,7 +1057,7 @@ function mask( _owned_regions = Region[maskRegion,] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(passthru) && push!(operands, passthru) + !isnothing(passthru) && push!(_operands, passthru) return IR.create_operation( "vector.mask", @@ -1357,7 +1357,7 @@ function outerproduct( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(kind) && push!(attributes, namedattribute("kind", kind)) + !isnothing(kind) && push!(_attributes, namedattribute("kind", kind)) return IR.create_operation( "vector.outerproduct", @@ -1448,7 +1448,7 @@ function reduction( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[namedattribute("kind", kind),] - !isnothing(acc) && push!(operands, acc) + !isnothing(acc) && push!(_operands, acc) return IR.create_operation( "vector.reduction", @@ -1559,7 +1559,7 @@ function reshape( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[namedattribute("fixed_vector_sizes", fixed_vector_sizes),] - push!(attributes, operandsegmentsizes([1, length(input_shape), length(output_shape)])) + push!(_attributes, operandsegmentsizes([1, length(input_shape), length(output_shape)])) return IR.create_operation( "vector.reshape", @@ -2200,9 +2200,11 @@ function transfer_read( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[namedattribute("permutation_map", permutation_map),] - !isnothing(mask) && push!(operands, mask) - push!(attributes, operandsegmentsizes([1, length(indices), 1, isnothing(mask) ? 0 : 1])) - !isnothing(in_bounds) && push!(attributes, namedattribute("in_bounds", in_bounds)) + !isnothing(mask) && push!(_operands, mask) + push!( + _attributes, operandsegmentsizes([1, length(indices), 1, isnothing(mask) ? 0 : 1]) + ) + !isnothing(in_bounds) && push!(_attributes, namedattribute("in_bounds", in_bounds)) return IR.create_operation( "vector.transfer_read", @@ -2330,10 +2332,12 @@ function transfer_write( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[namedattribute("permutation_map", permutation_map),] - !isnothing(mask) && push!(operands, mask) - push!(attributes, operandsegmentsizes([1, 1, length(indices), isnothing(mask) ? 0 : 1])) + !isnothing(mask) && push!(_operands, mask) + push!( + _attributes, operandsegmentsizes([1, 1, length(indices), isnothing(mask) ? 0 : 1]) + ) !isnothing(result) && push!(_results, result) - !isnothing(in_bounds) && push!(attributes, namedattribute("in_bounds", in_bounds)) + !isnothing(in_bounds) && push!(_attributes, namedattribute("in_bounds", in_bounds)) return IR.create_operation( "vector.transfer_write", diff --git a/src/Dialects/17/X86Vector.jl b/src/Dialects/17/X86Vector.jl index bd2beada..61bc575b 100644 --- a/src/Dialects/17/X86Vector.jl +++ b/src/Dialects/17/X86Vector.jl @@ -124,10 +124,10 @@ function avx512_mask_compress( _owned_regions = Region[] _successors = Block[] _attributes = NamedAttribute[] - !isnothing(src) && push!(operands, src) + !isnothing(src) && push!(_operands, src) !isnothing(dst) && push!(_results, dst) !isnothing(constant_src) && - push!(attributes, namedattribute("constant_src", constant_src)) + push!(_attributes, namedattribute("constant_src", constant_src)) return IR.create_operation( "x86vector.avx512.mask.compress",