Blyx Nest Blyx language
Registry / Framework
framework · v0.1.1

Flightdeck int8-roundtrip

Simulate symmetric per-row INT8 weight quantization with nearest-even rounding. Return FP32 codes, reconstruction and scale for error analysis.

Source repository · Package JSON

Use Flightdeck int8-roundtrip

use vendor::fd_int8_roundtrip::int8_roundtrip;

Run the example

nest demo fd_int8_roundtrip@0.1.1
blyxc native-run fd_int8_roundtrip-demo/main.blyx
Example source and expected output
use vendor::fd_int8_roundtrip::int8_roundtrip;
fn main() { fd_int8_roundtrip(2, 7); }

Expected output

module {
  func.func @main(%x: tensor<2x7xf32>) -> (tensor<2x7xf32>, tensor<2x7xf32>, tensor<2x7xf32>) {
    %v0 = stablehlo.constant dense<0.00000000000000000e+00> : tensor<2x7xf32>
    %v1 = stablehlo.abs %x : tensor<2x7xf32>
    %v2 = stablehlo.constant dense<-3.40282346000000007e+38> : tensor<f32>
    %v3 = stablehlo.reduce(%v1 init: %v2) applies stablehlo.maximum across dimensions = [1] : (tensor<2x7xf32>, tensor<f32>) -> tensor<2xf32>
    %v4 = stablehlo.broadcast_in_dim %v3, dims = [0] : (tensor<2xf32>) -> tensor<2x7xf32>
    %v5 = stablehlo.constant dense<1.27000000000000000e+02> : tensor<2x7xf32>
    %v6 = stablehlo.divide %v4, %v5 : tensor<2x7xf32>
    %v7 = stablehlo.constant dense<9.99999999999999945e-21> : tensor<2x7xf32>
    %v8 = stablehlo.maximum %v6, %v7 : tensor<2x7xf32>
    %v9 = stablehlo.divide %x, %v8 : tensor<2x7xf32>
    %v10 = stablehlo.round_nearest_even %v9 : tensor<2x7xf32>
    %v11 = stablehlo.negate %v5 : tensor<2x7xf32>
    %v12 = stablehlo.maximum %v10, %v11 : tensor<2x7xf32>
    %v13 = stablehlo.minimum %v12, %v5 : tensor<2x7xf32>
    %v14 = stablehlo.multiply %v13, %v8 : tensor<2x7xf32>
    return %v13, %v14, %v8 : tensor<2x7xf32>, tensor<2x7xf32>, tensor<2x7xf32>
  }
}

Published versions

VersionPackageSource commitSHA-256
0.1.1Download ZIP · Browse filesbf9c3d50030601d11476510f5d380f268ee253a4bc5bd5f5306a65f89e2a04926b9a856f23
0.1.0Download ZIP · Browse filesd5835c51097c2cbe82776f0d7cc3e5512f69ee7687f78e20a3f504ca3d16e1eb35bdfd17f4