Skip to content

[ntuple] Cast min/max to the actual type when quantizing/unquantizing in Real32Quant #18629

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 19, 2025

Conversation

silverweed
Copy link
Contributor

@silverweed silverweed commented May 7, 2025

See the commit message for more details.

This PR should be backported, probably even to 6.34 to make it work with the rntuple validation suite.

Checklist:

  • tested changes locally
  • updated the docs (if necessary)

@silverweed silverweed self-assigned this May 7, 2025
@silverweed silverweed requested a review from jblomer as a code owner May 7, 2025 07:41
@hahnjo
Copy link
Member

hahnjo commented May 7, 2025

probably even to 6.34 to make it work with the rntuple validation suite.

The goal is to use exactly 6.34.00, the first public version to produce the final RNTuple format. If that version has implementation bugs, I think I would rather skip Real32Quant for the first set of reference files.

@silverweed
Copy link
Contributor Author

Right, we cannot magically change 6.34.00...then I'd just backport it to 6.36.

Copy link

github-actions bot commented May 7, 2025

Test Results

    19 files      19 suites   3d 14h 1m 30s ⏱️
 2 745 tests  2 745 ✅ 0 💤 0 ❌
50 685 runs  50 685 ✅ 0 💤 0 ❌

Results for commit 8b07973.

♻️ This comment has been updated with latest results.

@silverweed silverweed marked this pull request as draft May 9, 2025 06:45
@silverweed
Copy link
Contributor Author

As it's apparent from the unit test failures (which I'm not sure why I didn't see when I ran them locally the first time), either this change is incorrect or some of our tests are (in regards to the max error they allow in respect to the bit width).
I need to think more about this and what really is the correct solution to this conundrum.

@silverweed silverweed force-pushed the ntuple_quant_fixes2 branch 3 times, most recently from 6002780 to 3515a83 Compare May 13, 2025 13:29
@silverweed silverweed force-pushed the ntuple_quant_fixes2 branch 2 times, most recently from 2150616 to e0aa335 Compare May 14, 2025 07:19
@silverweed silverweed marked this pull request as ready for review May 14, 2025 12:08
The min and max value of the range are now given by the user as `T`
rather than always being `double`, guaranteeing that the outOfRange
check is consistent with the user's expectation (in particular this
guarantees that the given `min` and `max` are always considered
in range - which is not the case if the compared values use different
precisions).
The expectations on the unquantized values are as follows:
  - the `min` value will always quantize to 0 and unquantize back to
    exactly the original `min` value (as represented by the type `T`
    of the original RField used to quantize it);
  - the `max` value will always quantize to 1 and unquantize back to
    a value that is never larger than the given `max` (as represented
    by `T`) and that is within "an epsilon" from it (where "epsilon"
    is defined as `max(1, value) * numeric_limits<double>::epsilon()`).
Some internal checks are adjusted to reflect the new expectations.
@silverweed silverweed force-pushed the ntuple_quant_fixes2 branch from e0aa335 to 8b07973 Compare May 16, 2025 07:54
@silverweed silverweed added this to the 6.36.00 milestone May 19, 2025
Copy link
Member

@hahnjo hahnjo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but a second approval would be good since I was involved in the offline discussions around this PR.

Copy link
Contributor

@enirolf enirolf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@silverweed silverweed merged commit d681d65 into root-project:master May 19, 2025
23 checks passed
@silverweed silverweed deleted the ntuple_quant_fixes2 branch May 19, 2025 14:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants