Skip to content

[libc++] add floating point type check for uniform real distribution #70564

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

Conversation

changkhothuychung
Copy link
Contributor

@changkhothuychung changkhothuychung commented Oct 28, 2023

Created a PR to fix this issue - #62433

@changkhothuychung changkhothuychung requested a review from a team as a code owner October 28, 2023 18:31
@llvmbot llvmbot added the libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. label Oct 28, 2023
@changkhothuychung
Copy link
Contributor Author

Can anyone tell me what is the issue with the Modular Build? I dont quite understand. How should I fix this?

@tschuett
Copy link

The error message says that there is a missing include for std::is_floating_point.

@changkhothuychung changkhothuychung force-pushed the uniform-real-distrubiton-type-check branch from 18ffd01 to 3473e1e Compare October 29, 2023 21:53
@changkhothuychung changkhothuychung changed the title add floating point type check for uniform real distrubtion [libcxx] add floating point type check for uniform real distrubtion Oct 29, 2023
@changkhothuychung changkhothuychung changed the title [libcxx] add floating point type check for uniform real distrubtion [libc++] add floating point type check for uniform real distrubtion Oct 29, 2023
@changkhothuychung changkhothuychung force-pushed the uniform-real-distrubiton-type-check branch 2 times, most recently from ffcacfa to a8b9c70 Compare October 29, 2023 23:19
@changkhothuychung
Copy link
Contributor Author

@philnik777 phik
can you let me know how I can fix the test file? I dont understand the error log and have no idea how to fix.

@github-actions
Copy link

github-actions bot commented Oct 30, 2023

✅ With the latest revision this PR passed the C/C++ code formatter.

@changkhothuychung changkhothuychung force-pushed the uniform-real-distrubiton-type-check branch 2 times, most recently from e763c80 to da2c18f Compare October 30, 2023 03:32
@AdvenamTacet
Copy link
Member

@NhatNguyen1810 could you add a better description to the test? I looked at that file first and wasn't sure what's the purpose without reading the whole test carefully.

@changkhothuychung changkhothuychung force-pushed the uniform-real-distrubiton-type-check branch from da2c18f to 7fc260c Compare October 30, 2023 09:48
@changkhothuychung
Copy link
Contributor Author

@NhatNguyen1810 could you add a better description to the test? I looked at that file first and wasn't sure what's the purpose without reading the whole test carefully.

I added more descriptions to the test file.

@changkhothuychung changkhothuychung force-pushed the uniform-real-distrubiton-type-check branch from 7fc260c to bcc3db1 Compare October 30, 2023 10:35
@changkhothuychung
Copy link
Contributor Author

@philnik777 can you review when you have time and let me know if it looks good to be approved? There is a workflow awaiting approval, can you run it for me?

Thanks!

Copy link
Contributor

@philnik777 philnik777 left a comment

Choose a reason for hiding this comment

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

Thanks for working on this! Some minor comments.

@changkhothuychung changkhothuychung force-pushed the uniform-real-distrubiton-type-check branch 3 times, most recently from 9924012 to 661bcdb Compare October 31, 2023 00:31
@changkhothuychung
Copy link
Contributor Author

@philnik777 phik
can you take a quick look with my change? Basically I follow this file to do the regex matcher. I can't find a similar case where it does not use the regex. Let me know what I should put without the regex matcher. Thanks.

https://github.com/llvm/llvm-project/blob/main/libcxx/test/libcxx/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add.verify.cpp#L49

@changkhothuychung changkhothuychung force-pushed the uniform-real-distrubiton-type-check branch 6 times, most recently from 661848b to 46a046c Compare October 31, 2023 09:42
@ldionne
Copy link
Member

ldionne commented Oct 31, 2023

We have a utility called __libcpp_random_is_valid_urng in libcxx/include/__random/is_valid.h -- should we instead create something similar to it and handle http://eel.is/c++draft/rand.req.genl more generally?

@AdvenamTacet
Copy link
Member

@NhatNguyen1810 you can see error report by clicking details next to the buildkite and then on the job which failed. It looks like your code works with GCC only. You can find details here: https://buildkite.com/llvm-project/libcxx-ci/builds/31338#018b8dda-3da3-4049-af36-d3bbe1bf054c

FAIL: llvm-libc++-shared.cfg.in :: libcxx/random/random.uniform.real/traits_mismatch.verify.cpp (1664 of 9610) - that's the test which failed.

# .---command stderr------------
--
  | # \| error: 'expected-error' diagnostics seen but not expected:
  | # \|   File /home/libcxx-builder/.buildkite-agent/builds/google-libcxx-builder-6be6c9a4344c-1/llvm-project/libcxx-ci/build/generic-cxx26/include/c++/v1/__random/uniform_real_distribution.h Line 31: static assertion failed due to requirement 'is_floating_point<int>::value': result_type must be floating type
  | # \|   File /home/libcxx-builder/.buildkite-agent/builds/google-libcxx-builder-6be6c9a4344c-1/llvm-project/libcxx-ci/libcxx/test/libcxx/random/random.uniform.real/traits_mismatch.verify.cpp Line 20: cannot find end ('}}') of expected string
  | # \| 2 errors generated.
  | # `-----------------------------

@changkhothuychung
Copy link
Contributor Author

@philnik777 phil
can you take a look when you have time? thanks.

@ldionne ldionne self-assigned this Nov 21, 2023
@mordante mordante changed the title [libc++] add floating point type check for uniform real distrubtion [libc++] add floating point type check for uniform real distribution Nov 25, 2023
@changkhothuychung
Copy link
Contributor Author

@mordante mordanta
there are timed out and failed tests that are not related to my PR at all. Can you take a look and let me know how to fix this? Thanks.

@AdvenamTacet
Copy link
Member

It's a known problem at the moment. There is no need to take any action at the moment.

Copy link
Member

@ldionne ldionne left a comment

Choose a reason for hiding this comment

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

LGTM with latest changes. I will merge once CI is done.

Update libcxx/test/libcxx/random/random.uniform.real/traits_mismatch.verify.cpp

Co-authored-by: Mark de Wever <[email protected]>
@changkhothuychung changkhothuychung force-pushed the uniform-real-distrubiton-type-check branch from a6b7b6b to a30ac88 Compare November 27, 2023 23:46
@changkhothuychung
Copy link
Contributor Author

@ldionne ld
there was an error with code formatter, I made a push to fix it. Does everything look good to be merged now? Can you help me merge? Thanks.

Copy link
Member

@EricWF EricWF left a comment

Choose a reason for hiding this comment

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

Please give me 24 hours to test this change at Google to see what the impact is.

@ldionne
Copy link
Member

ldionne commented Nov 28, 2023

@changkhothuychung You have a setting on your Github account to "hide your email". Please disable it, otherwise upon committing this the email address will be [email protected]. We're trying to prevent that from happening for commit attribution purposes.

@changkhothuychung
Copy link
Contributor Author

@changkhothuychung You have a setting on your Github account to "hide your email". Please disable it, otherwise upon committing this the email address will be [email protected]. We're trying to prevent that from happening for commit attribution purposes.

Do you see my email now? it should show up as [email protected], thanks!

@ldionne
Copy link
Member

ldionne commented Nov 29, 2023

Yes I can see it now, thanks.

@EricWF Do you have any results internally? We've been sitting on this for a while and I'd like to merge it by EOD if possible, since it looks otherwise good to go.

@EricWF
Copy link
Member

EricWF commented Nov 29, 2023

@ldionne I have to run the tests off hours, they're set up to run tonight.

@ldionne
Copy link
Member

ldionne commented Nov 29, 2023

Sounds good, I'll check again tomorrow morning or mid-day. I'm eager to close this PR :)

@EricWF
Copy link
Member

EricWF commented Nov 30, 2023

@ldionne For one reason or another, the test runs got aborted last night. I'm rerunning them again tonight.

@ldionne
Copy link
Member

ldionne commented Dec 4, 2023

@ldionne For one reason or another, the test runs got aborted last night. I'm rerunning them again tonight.

Do you have any news about this?

@EricWF
Copy link
Member

EricWF commented Dec 4, 2023

Yes, there are a few users in Google3. I would like to clean them up before this lands, but that will take until Wednesday. None of them seem show-stopping though. All of the usages are weird, but otherwise fine, code.

If you're so inclined, I would love the extra time. Otherwise, this LGTM.

Copy link
Member

@EricWF EricWF left a comment

Choose a reason for hiding this comment

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

I would ask kindly that you wait a day or two, but that's only a request.

LGTM.

@ldionne
Copy link
Member

ldionne commented Dec 5, 2023

Cool, thanks a bunch for the information. I'll land this on Thursday. This is not an emergency at all but it would be good to get it done. Hopefully that should give you enough time.

@ldionne ldionne merged commit 727fef7 into llvm:main Dec 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants