GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-130317: Skip test_pack_unpack_roundtrip_for_nans() on x86 by vstinner · Pull Request #133155 · python/cpython

Conversation

@vstinner

@vstinner vstinner commented Apr 29, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Reduce also the number of iterations from 1000 to 10 to ease
debugging failures and prevent "command line too line" error when
tests are re-run.

  • Issue: struct (un)packing of half-precision nan floats is non-invertible #130317

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@vstinner vstinner added the skip news label Apr 29, 2025
@bedevere-app bedevere-app Bot added the awaiting core review label Apr 29, 2025
@bedevere-app bedevere-app Bot mentioned this pull request Apr 29, 2025
struct (un)packing of half-precision nan floats is non-invertible #130317
Closed
@vstinner

vstinner commented Apr 29, 2025

Copy link
Copy Markdown
Member Author

cc @skirpichev

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vstinner vstinner mentioned this pull request Apr 29, 2025
gh-130317: Fix strict aliasing in PyFloat_Pack8() #133150
Merged
@skirpichev
skirpichev self-requested a review April 29, 2025 14:33
skirpichev
skirpichev reviewed Apr 29, 2025
View reviewed changes
Comment thread Lib/test/test_capi/test_float.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Lib/test/test_capi/test_float.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Modules/_testcapi/float.c Resolved

Uh oh!

There was an error while loading. Please reload this page.

@vstinner

vstinner commented Apr 29, 2025

Copy link
Copy Markdown
Member Author

Example of failure with 32-bit float on x86:

float_pack:  {0x00,0x00,0x00,0x20,0xdc,0xd1,0xf2,0x7f}
Float_Pack4: {0x00,0x00,0x00,0x20,0xdc,0xd1,0xfa,0x7f}

0xf2 in _testcapi.float_pack() becomes 0xfa in PyFloat_Pack4(). The sNaN becomes a qNaN just by the calling convention, there is nothing that we can do.

There is a similar problem with PyFloat_Pack2().

I'm not sure why it works with PyFloat_Pack8().

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

skirpichev
skirpichev approved these changes Apr 29, 2025
View reviewed changes

@skirpichev skirpichev left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

LGTM (as a temporary fix). Don't close issue.

0xf2 in _testcapi.float_pack() becomes 0xfa in PyFloat_Pack4(). The sNaN becomes a qNaN just by the calling convention, there is nothing that we can do.

I'm not sure why it works with PyFloat_Pack8().

It shouldn't, if your explanation is valid.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@skirpichev

skirpichev commented Apr 29, 2025

Copy link
Copy Markdown
Member

I'm not sure why it works with PyFloat_Pack8().

Hmm, my tests show that on 32-bit sNaN becomes qNaN after calling. Are you sure that size=8 tests works?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vstinner

vstinner commented Apr 29, 2025

Copy link
Copy Markdown
Member Author

!buildbot x86

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-bot

bedevere-bot commented Apr 29, 2025

Copy link
Copy Markdown

🤖 New build scheduled with the buildbot fleet by @vstinner for commit 2d62e7b 🤖

Results will be shown at:

https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F133155%2Fmerge

The command will test the builders whose names match following regular expression: x86

The builders matched are:

  • x86 Debian Non-Debug with X PR
  • x86-64 MacOS Intel NoGIL PR
  • x86-64 macOS PR
  • x86-64 MacOS Intel ASAN NoGIL PR
  • x86 Debian Installed with X PR
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vstinner

vstinner commented Apr 30, 2025

Copy link
Copy Markdown
Member Author

Are you sure that size=8 tests works?

It works on Python built with gcc -O3. But it failed on the x86 Debian buildbot :-(

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vstinner
pythongh-130317: Skip test_pack_unpack_roundtrip_for_nans() on x86
c39b3c7
Reduce also the number of iterations from 1000 to 10 to ease
debugging failures and prevent "command line too line" error when
tests are re-run.
@vstinner
vstinner force-pushed the test_float_roundtrip branch from 2d62e7b to c39b3c7 Compare April 30, 2025 09:33
@vstinner vstinner changed the title gh-130317: Fix test_pack_unpack_roundtrip_for_nans() on x86 gh-130317: Skip test_pack_unpack_roundtrip_for_nans() on x86 Apr 30, 2025
@skirpichev

skirpichev commented Apr 30, 2025

Copy link
Copy Markdown
Member

It works on Python built with gcc -O3

I guess, optimizer avoid using FPU registers

As a quick fix I suggest to disable testing in 32-bit mode. And also reduce number of tests as suggested, 10 should be enough.

In a follow-up PR I'll do cleanup. Probably float_set_snan() is not helpful, as well as other attempts to workaround passing of sNaN.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vstinner

vstinner commented Apr 30, 2025

Copy link
Copy Markdown
Member Author

@skirpichev: I rewrote my PR to simply skip the test on x86 Debian, but not skip the test on x86 Windows. Please review the updated PR.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vstinner

vstinner commented Apr 30, 2025

Copy link
Copy Markdown
Member Author

!buildbot x86 Debian

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-bot

bedevere-bot commented Apr 30, 2025

Copy link
Copy Markdown

🤖 New build scheduled with the buildbot fleet by @vstinner for commit c39b3c7 🤖

Results will be shown at:

https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F133155%2Fmerge

The command will test the builders whose names match following regular expression: x86 Debian

The builders matched are:

  • x86 Debian Installed with X PR
  • x86 Debian Non-Debug with X PR
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

skirpichev
skirpichev approved these changes Apr 30, 2025
View reviewed changes

@skirpichev skirpichev left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Lets merge when bots pass.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@vstinner
vstinner merged commit 0f23e84 into python:main Apr 30, 2025
@vstinner
vstinner deleted the test_float_roundtrip branch April 30, 2025 10:01
@bedevere-app bedevere-app Bot removed the awaiting core review label Apr 30, 2025
@vstinner

vstinner commented Apr 30, 2025

Copy link
Copy Markdown
Member Author

Merged, thanks for the review.

Sadly, I don't think that we can work around "compiler bugs" if sNaN becomes qNaN as soon as we call a simple function taking a double. Skipping the test sounds like the only option.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@skirpichev skirpichev skirpichev approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

skip news

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@vstinner @skirpichev @bedevere-bot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.