| {"id": "01_reduce_sum_1d", "nl": "Sum a 1-D f32 tensor of 16 elements using stablehlo.reduce with an add body.", "mlir": "module {\n func.func @f(%a: tensor<16xf32>) -> tensor<f32> {\n %init = stablehlo.constant dense<0.0> : tensor<f32>\n %0 = stablehlo.reduce(%a init: %init) across dimensions = [0] : (tensor<16xf32>, tensor<f32>) -> tensor<f32>\n reducer(%arg0: tensor<f32>, %arg1: tensor<f32>) {\n %sum = stablehlo.add %arg0, %arg1 : tensor<f32>\n stablehlo.return %sum : tensor<f32>\n }\n return %0 : tensor<f32>\n }\n}", "op": "reduce", "dialect": "stablehlo+func", "source": "outofgrammar_phase_f"} |
| {"id": "02_conv_2d", "nl": "Apply a 2-D convolution of an input tensor 1x4x4x3 (NHWC) with a filter 3x3x3x8.", "mlir": "module {\n func.func @f(%a: tensor<1x4x4x3xf32>, %w: tensor<3x3x3x8xf32>) -> tensor<1x2x2x8xf32> {\n %0 = stablehlo.convolution(%a, %w)\n dim_numbers = [b, 0, 1, f]x[0, 1, i, o]->[b, 0, 1, f],\n window = {stride = [1, 1], pad = [[0, 0], [0, 0]]}\n {batch_group_count = 1 : i64, feature_group_count = 1 : i64}\n : (tensor<1x4x4x3xf32>, tensor<3x3x3x8xf32>) -> tensor<1x2x2x8xf32>\n return %0 : tensor<1x2x2x8xf32>\n }\n}", "op": "convolution", "dialect": "stablehlo+func", "source": "outofgrammar_phase_f"} |
| {"id": "03_pad_2d", "nl": "Pad a 4x4 f32 tensor with 1-pixel borders of zero on each side, producing 6x6.", "mlir": "module {\n func.func @f(%a: tensor<4x4xf32>) -> tensor<6x6xf32> {\n %pad = stablehlo.constant dense<0.0> : tensor<f32>\n %0 = stablehlo.pad %a, %pad, low = [1, 1], high = [1, 1], interior = [0, 0]\n : (tensor<4x4xf32>, tensor<f32>) -> tensor<6x6xf32>\n return %0 : tensor<6x6xf32>\n }\n}", "op": "pad", "dialect": "stablehlo+func", "source": "outofgrammar_phase_f"} |
| {"id": "04_dynamic_slice_1d", "nl": "Slice 8 elements from a 1-D f32 tensor of 32 starting at dynamic index.", "mlir": "module {\n func.func @f(%a: tensor<32xf32>, %i: tensor<i32>) -> tensor<8xf32> {\n %0 = stablehlo.dynamic_slice %a, %i, sizes = [8] : (tensor<32xf32>, tensor<i32>) -> tensor<8xf32>\n return %0 : tensor<8xf32>\n }\n}", "op": "dynamic_slice", "dialect": "stablehlo+func", "source": "outofgrammar_phase_f"} |
| {"id": "05_iota_1d", "nl": "Produce a 1-D i32 iota tensor of 16 elements (values 0..15).", "mlir": "module {\n func.func @f() -> tensor<16xi32> {\n %0 = stablehlo.iota dim = 0 : tensor<16xi32>\n return %0 : tensor<16xi32>\n }\n}", "op": "iota", "dialect": "stablehlo+func", "source": "outofgrammar_phase_f"} |
| {"id": "06_clamp_f32", "nl": "Clamp a 1-D f32 tensor of 16 elements to the [0, 1] range.", "mlir": "module {\n func.func @f(%a: tensor<16xf32>) -> tensor<16xf32> {\n %lo = stablehlo.constant dense<0.0> : tensor<16xf32>\n %hi = stablehlo.constant dense<1.0> : tensor<16xf32>\n %0 = stablehlo.clamp %lo, %a, %hi : tensor<16xf32>\n return %0 : tensor<16xf32>\n }\n}", "op": "clamp", "dialect": "stablehlo+func", "source": "outofgrammar_phase_f"} |
| {"id": "07_select_f32", "nl": "Elementwise select between two f32 tensors of shape 16 based on a bool mask.", "mlir": "module {\n func.func @f(%p: tensor<16xi1>, %x: tensor<16xf32>, %y: tensor<16xf32>) -> tensor<16xf32> {\n %0 = stablehlo.select %p, %x, %y : (tensor<16xi1>, tensor<16xf32>, tensor<16xf32>) -> tensor<16xf32>\n return %0 : tensor<16xf32>\n }\n}", "op": "select", "dialect": "stablehlo+func", "source": "outofgrammar_phase_f"} |
| {"id": "08_compare_lt", "nl": "Elementwise less-than comparison of two f32 tensors of shape 16.", "mlir": "module {\n func.func @f(%a: tensor<16xf32>, %b: tensor<16xf32>) -> tensor<16xi1> {\n %0 = stablehlo.compare LT, %a, %b, FLOAT : (tensor<16xf32>, tensor<16xf32>) -> tensor<16xi1>\n return %0 : tensor<16xi1>\n }\n}", "op": "compare", "dialect": "stablehlo+func", "source": "outofgrammar_phase_f"} |
| {"id": "09_concatenate", "nl": "Concatenate two 4x4 f32 tensors along axis 0 to produce an 8x4 tensor.", "mlir": "module {\n func.func @f(%a: tensor<4x4xf32>, %b: tensor<4x4xf32>) -> tensor<8x4xf32> {\n %0 = stablehlo.concatenate %a, %b, dim = 0 : (tensor<4x4xf32>, tensor<4x4xf32>) -> tensor<8x4xf32>\n return %0 : tensor<8x4xf32>\n }\n}", "op": "concatenate", "dialect": "stablehlo+func", "source": "outofgrammar_phase_f"} |
| {"id": "10_reduce_max_2d", "nl": "Reduce max across rows of a 4x8 f32 tensor, producing a 4-element vector.", "mlir": "module {\n func.func @f(%a: tensor<4x8xf32>) -> tensor<4xf32> {\n %init = stablehlo.constant dense<0xFF800000> : tensor<f32>\n %0 = stablehlo.reduce(%a init: %init) across dimensions = [1] : (tensor<4x8xf32>, tensor<f32>) -> tensor<4xf32>\n reducer(%arg0: tensor<f32>, %arg1: tensor<f32>) {\n %m = stablehlo.maximum %arg0, %arg1 : tensor<f32>\n stablehlo.return %m : tensor<f32>\n }\n return %0 : tensor<4xf32>\n }\n}", "op": "reduce", "dialect": "stablehlo+func", "source": "outofgrammar_phase_f"} |
| {"id": "11_conv_1d", "nl": "Apply a 1-D convolution to an input tensor of shape 1x16x4 (NWC) with filter 3x4x8.", "mlir": "module {\n func.func @f(%a: tensor<1x16x4xf32>, %w: tensor<3x4x8xf32>) -> tensor<1x14x8xf32> {\n %0 = stablehlo.convolution(%a, %w)\n dim_numbers = [b, 0, f]x[0, i, o]->[b, 0, f],\n window = {stride = [1], pad = [[0, 0]]}\n {batch_group_count = 1 : i64, feature_group_count = 1 : i64}\n : (tensor<1x16x4xf32>, tensor<3x4x8xf32>) -> tensor<1x14x8xf32>\n return %0 : tensor<1x14x8xf32>\n }\n}", "op": "convolution", "dialect": "stablehlo+func", "source": "outofgrammar_phase_f"} |
| {"id": "12_gather_simple", "nl": "Gather 4 rows from an 8x16 f32 tensor using a 4-element i32 index vector.", "mlir": "module {\n func.func @f(%a: tensor<8x16xf32>, %idx: tensor<4x1xi32>) -> tensor<4x16xf32> {\n %0 = \"stablehlo.gather\"(%a, %idx) {\n dimension_numbers = #stablehlo.gather<\n offset_dims = [1],\n collapsed_slice_dims = [0],\n start_index_map = [0],\n index_vector_dim = 1\n >,\n slice_sizes = array<i64: 1, 16>,\n indices_are_sorted = false\n } : (tensor<8x16xf32>, tensor<4x1xi32>) -> tensor<4x16xf32>\n return %0 : tensor<4x16xf32>\n }\n}", "op": "gather", "dialect": "stablehlo+func", "source": "outofgrammar_phase_f"} |
| {"id": "13_slice_static", "nl": "Take the first 4x4 block of an 8x8 f32 tensor using stablehlo.slice.", "mlir": "module {\n func.func @f(%a: tensor<8x8xf32>) -> tensor<4x4xf32> {\n %0 = stablehlo.slice %a [0:4, 0:4] : (tensor<8x8xf32>) -> tensor<4x4xf32>\n return %0 : tensor<4x4xf32>\n }\n}", "op": "slice", "dialect": "stablehlo+func", "source": "outofgrammar_phase_f"} |
| {"id": "14_rsqrt", "nl": "Compute elementwise reciprocal square root of a 16-element f32 tensor.", "mlir": "module {\n func.func @f(%a: tensor<16xf32>) -> tensor<16xf32> {\n %0 = stablehlo.rsqrt %a : tensor<16xf32>\n return %0 : tensor<16xf32>\n }\n}", "op": "rsqrt", "dialect": "stablehlo+func", "source": "outofgrammar_phase_f"} |
| {"id": "15_sign", "nl": "Compute elementwise sign of a 16-element f32 tensor.", "mlir": "module {\n func.func @f(%a: tensor<16xf32>) -> tensor<16xf32> {\n %0 = stablehlo.sign %a : tensor<16xf32>\n return %0 : tensor<16xf32>\n }\n}", "op": "sign", "dialect": "stablehlo+func", "source": "outofgrammar_phase_f"} |
| {"id": "16_tanh", "nl": "Compute elementwise hyperbolic tangent of a 16-element f32 tensor.", "mlir": "module {\n func.func @f(%a: tensor<16xf32>) -> tensor<16xf32> {\n %0 = stablehlo.tanh %a : tensor<16xf32>\n return %0 : tensor<16xf32>\n }\n}", "op": "tanh", "dialect": "stablehlo+func", "source": "outofgrammar_phase_f"} |
| {"id": "17_sort_1d", "nl": "Sort a 1-D f32 tensor of 16 elements in ascending order using stablehlo.sort.", "mlir": "module {\n func.func @f(%a: tensor<16xf32>) -> tensor<16xf32> {\n %0 = \"stablehlo.sort\"(%a) ({\n ^bb0(%x: tensor<f32>, %y: tensor<f32>):\n %cmp = stablehlo.compare LT, %x, %y, FLOAT : (tensor<f32>, tensor<f32>) -> tensor<i1>\n stablehlo.return %cmp : tensor<i1>\n }) {dimension = 0 : i64, is_stable = true} : (tensor<16xf32>) -> tensor<16xf32>\n return %0 : tensor<16xf32>\n }\n}", "op": "sort", "dialect": "stablehlo+func", "source": "outofgrammar_phase_f"} |
| {"id": "18_power", "nl": "Compute elementwise power a^b of two 16-element f32 tensors.", "mlir": "module {\n func.func @f(%a: tensor<16xf32>, %b: tensor<16xf32>) -> tensor<16xf32> {\n %0 = stablehlo.power %a, %b : tensor<16xf32>\n return %0 : tensor<16xf32>\n }\n}", "op": "power", "dialect": "stablehlo+func", "source": "outofgrammar_phase_f"} |
| {"id": "19_dynamic_update_slice", "nl": "Update a 4-element slice of a 32-element f32 tensor at a dynamic index.", "mlir": "module {\n func.func @f(%a: tensor<32xf32>, %u: tensor<4xf32>, %i: tensor<i32>) -> tensor<32xf32> {\n %0 = stablehlo.dynamic_update_slice %a, %u, %i : (tensor<32xf32>, tensor<4xf32>, tensor<i32>) -> tensor<32xf32>\n return %0 : tensor<32xf32>\n }\n}", "op": "dynamic_update_slice", "dialect": "stablehlo+func", "source": "outofgrammar_phase_f"} |
| {"id": "20_reverse", "nl": "Reverse the order of elements in a 1-D f32 tensor of 16 elements.", "mlir": "module {\n func.func @f(%a: tensor<16xf32>) -> tensor<16xf32> {\n %0 = stablehlo.reverse %a, dims = [0] : tensor<16xf32>\n return %0 : tensor<16xf32>\n }\n}", "op": "reverse", "dialect": "stablehlo+func", "source": "outofgrammar_phase_f"} |
| {"id": "21_round", "nl": "Round elementwise to nearest even integer on a 16-element f32 tensor.", "mlir": "module {\n func.func @f(%a: tensor<16xf32>) -> tensor<16xf32> {\n %0 = stablehlo.round_nearest_even %a : tensor<16xf32>\n return %0 : tensor<16xf32>\n }\n}", "op": "round", "dialect": "stablehlo+func", "source": "outofgrammar_phase_f"} |
| {"id": "22_is_finite", "nl": "Elementwise is_finite on a 16-element f32 tensor, returning a bool tensor.", "mlir": "module {\n func.func @f(%a: tensor<16xf32>) -> tensor<16xi1> {\n %0 = stablehlo.is_finite %a : (tensor<16xf32>) -> tensor<16xi1>\n return %0 : tensor<16xi1>\n }\n}", "op": "is_finite", "dialect": "stablehlo+func", "source": "outofgrammar_phase_f"} |
| {"id": "23_shift_left", "nl": "Elementwise left-shift of two 16-element i32 tensors.", "mlir": "module {\n func.func @f(%a: tensor<16xi32>, %b: tensor<16xi32>) -> tensor<16xi32> {\n %0 = stablehlo.shift_left %a, %b : tensor<16xi32>\n return %0 : tensor<16xi32>\n }\n}", "op": "shift_left", "dialect": "stablehlo+func", "source": "outofgrammar_phase_f"} |
| {"id": "24_xor", "nl": "Elementwise bitwise xor of two 16-element i32 tensors.", "mlir": "module {\n func.func @f(%a: tensor<16xi32>, %b: tensor<16xi32>) -> tensor<16xi32> {\n %0 = stablehlo.xor %a, %b : tensor<16xi32>\n return %0 : tensor<16xi32>\n }\n}", "op": "xor", "dialect": "stablehlo+func", "source": "outofgrammar_phase_f"} |
| {"id": "25_popcnt", "nl": "Elementwise population-count of a 16-element i32 tensor.", "mlir": "module {\n func.func @f(%a: tensor<16xi32>) -> tensor<16xi32> {\n %0 = stablehlo.popcnt %a : tensor<16xi32>\n return %0 : tensor<16xi32>\n }\n}", "op": "popcnt", "dialect": "stablehlo+func", "source": "outofgrammar_phase_f"} |
|
|