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

StableHLO-OutOfGrammar-25

Hand-authored NL→StableHLO pairs using ops outside our 10-op grammar scope (n=25, stress set).

Composition

  • Instances: 25
  • Format: one JSON record per line in data/test.jsonl
  • Schema: fields = dialect, id, mlir, nl, op, source
  • Verifier: stablehlo-opt v1.4.0 (upstream truth) and iree-compile --compile-to=input (substitute, 50/50 concordant on a stratified n=50 sample)
  • License: Apache-2.0 (SPDX: Apache-2.0). No third-party IP restrictions.

Loading

from datasets import load_dataset
ds = load_dataset("plawanrath/StableHLO-OutOfGrammar-25", split="test")
print(ds[0])

Each record is a self-contained natural-language→MLIR pair; verify-valid pass-rate under the dialect's verifier is the primary evaluation metric.

Source format

The JSONL file at data/test.jsonl is the canonical HuggingFace interface. MLCommons Croissant 1.0 metadata (croissant.json) ships alongside the release.

Datasheet

Key points (full Gebru-style datasheet ships with the dataset archive):

  • All reference MLIR programs are verifier-clean at the time of release.
  • Hand-authored (no crowdsourcing, no LLM-authored references).
  • Test-only — fine-tuning on these benchmarks contaminates future evaluation and is explicitly out of scope.

License

Apache-2.0. See LICENSE.

Downloads last month
32