openxla / stablehlo

Backward compatible ML compute opset inspired by HLO/MHLO
Apache License 2.0
357 stars 100 forks source link

Add testdata files for quantized stablohlo programs #2404

Closed sdasgup3 closed 2 weeks ago

sdasgup3 commented 2 weeks ago

Add quantized tests for the following stablehlo operations

abs
cbrt
ceil
cosine
divide
exponential
exponential_minus_one
floor
log
log_plus_one
logistic
multiply
negate
sign
sine
sqrt
subtract
tanh

A few details

A few limitations

  1. Currently we are using the Stablehlo Quantizer to generate quantized program which currently supports quantization of f32 floating point programs only. In future this case be improved.
    • Corollary: If the input test files have non-f32 based pograms, then it will be preserved unquantized in the output file. That is why we can see some of the generated files have non-quantized programs as well.
  2. While scraping the input programs from https://github.com/openxla/stablehlo/tree/main/stablehlo/tests/interpret or https://github.com/openxla/stablehlo/tree/main/stablehlo/testdata we choose only those programs which tests single stablehlo operations. This what the testdata-generator tool currently supports, but in very near future we can expect the tool to work on input test files with mutiple operations being tested.

Keep an eye on more quantized tests to be populated!