Skip to content
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

Introduce platform-agnostic ALWAYS_INLINE macro #27575

Merged
merged 2 commits into from
May 9, 2023

Conversation

hebasto
Copy link
Member

@hebasto hebasto commented May 4, 2023

Split from #24773 as requested in #24773 (comment).

@DrahtBot
Copy link
Contributor

DrahtBot commented May 4, 2023

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Reviews

See the guideline for information on the review process.

Type Reviewers
ACK theuni, fanquake

If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #24773 (Enable HW-accelerated implementations of SHA256 for MSVC builds by hebasto)

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

Copy link
Member

@theuni theuni left a comment

Choose a reason for hiding this comment

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

Concept ACK.

src/attributes.h Outdated
#elif defined(_MSC_VER)
# define ALWAYS_INLINE __forceinline
#else
# define ALWAYS_INLINE inline
Copy link
Member

Choose a reason for hiding this comment

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

I think it'd be better to error in this case so that we can add another platform exception if necessary. IIRC for the places that we use it, inlining is critical and we might want to design functions differently for platforms where it's not possible.

Especially given the gcc semantics:

Failure to inline such a function is diagnosed as an error.

As-is, I think this is currently a theoretical regression as we might now compile on a platform that would be an error on master.

Copy link
Member Author

Choose a reason for hiding this comment

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

Mind suggesting an error wording?

Copy link
Member

Choose a reason for hiding this comment

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

How about: #error No known always_inline attribute for this platform.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks! Updated.

hebasto added 2 commits May 4, 2023 20:57
`<attributes.h>` has been included in anticipation of the following
commit.
-BEGIN VERIFY SCRIPT-
sed -i 's/ inline __attribute__((always_inline)) / ALWAYS_INLINE /g' $(git grep -l "inline __attribute__((always_inline))")
sed -i 's/ inline  __attribute__((always_inline)) / ALWAYS_INLINE /g' $(git grep -l "inline  __attribute__((always_inline))")
-END VERIFY SCRIPT-
@hebasto
Copy link
Member Author

hebasto commented May 4, 2023

Updated d66232f -> 3f19875 (pr27575.01 -> pr27575.03, diff):

Copy link
Member

@theuni theuni left a comment

Choose a reason for hiding this comment

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

utACK 3f19875

@DrahtBot
Copy link
Contributor

DrahtBot commented May 9, 2023

Guix builds

File commit fa53611
(master)
commit d179d74
(master and this pull)
SHA256SUMS.part a926c0d34bfbdcad... 12d68e8280fc191b...
*-aarch64-linux-gnu-debug.tar.gz 163a8f60dd616570... 945adbfb0c02975c...
*-aarch64-linux-gnu.tar.gz b77781360a714e5b... e93ac2fc7f2d2a05...
*-arm-linux-gnueabihf-debug.tar.gz 14e94cfef0742385... c9c57feca999a5d2...
*-arm-linux-gnueabihf.tar.gz 7cec718d874e98c0... 40c68f222fe3655f...
*-powerpc64-linux-gnu-debug.tar.gz 55c53bb7314c17c9... 429a4c2185b51bd1...
*-powerpc64-linux-gnu.tar.gz dd7a3f300323f1dc... 4937ab90b143dfc5...
*-powerpc64le-linux-gnu-debug.tar.gz 73afe8f75e5aece9... 98994794305f5754...
*-powerpc64le-linux-gnu.tar.gz 5f2d881ceaba899d... a27aadace3d0b2ab...
*-riscv64-linux-gnu-debug.tar.gz f41fa430c59d39a4... 7a461106deee0708...
*-riscv64-linux-gnu.tar.gz 661b41a6d9528c7a... cde23d48e9e208da...
*-x86_64-linux-gnu-debug.tar.gz 0e8c6161d8542b03... 37e7d0b3d28ef5ec...
*-x86_64-linux-gnu.tar.gz 32988f6959b35357... 06eb7380aa451240...
*.tar.gz c97a743e67b67c4b... 7c3fa569ab59d34f...
guix_build.log 72977f2167a4f143... 62c3b127d5059386...
guix_build.log.diff 002cff8f4f7c028a...

@fanquake
Copy link
Member

fanquake commented May 9, 2023

Guix Build:

4c75c6675a758f8bfddaf3ca395eec58f82078486273bd13c7f03fa949f05f91  guix-build-3f19875d6675/output/aarch64-linux-gnu/SHA256SUMS.part
9736762959e2d9d06c33093ff08db157548fd3f82529cfbace0ceddce0151996  guix-build-3f19875d6675/output/aarch64-linux-gnu/bitcoin-3f19875d6675-aarch64-linux-gnu-debug.tar.gz
a82ceeae1e2b98e65bc363f61648a28e7a0985a2d2e1acc7142c3540ec71e5c4  guix-build-3f19875d6675/output/aarch64-linux-gnu/bitcoin-3f19875d6675-aarch64-linux-gnu.tar.gz
16b8bf25ad364757690cdad86746718e27102895484cecb3e8b7d1c755f5afc9  guix-build-3f19875d6675/output/arm-linux-gnueabihf/SHA256SUMS.part
7453fdbbc1618069db59a0d09c2606e0912ceacc525b53da24f6ea69aa3302f3  guix-build-3f19875d6675/output/arm-linux-gnueabihf/bitcoin-3f19875d6675-arm-linux-gnueabihf-debug.tar.gz
49adcd44a089326474188d83e7dba12c9e4c0cd5dbb14b3c329ddf4580546822  guix-build-3f19875d6675/output/arm-linux-gnueabihf/bitcoin-3f19875d6675-arm-linux-gnueabihf.tar.gz
763a0ae579e28afcfdb388762651668e62811eceed8990771d8069c7d580c51d  guix-build-3f19875d6675/output/arm64-apple-darwin/SHA256SUMS.part
c06e23bc828e660cdcddd0ae610700c7d0cbdda1b7603c2dc32a2414bc27e66d  guix-build-3f19875d6675/output/arm64-apple-darwin/bitcoin-3f19875d6675-arm64-apple-darwin-unsigned.dmg
da740b2fa3d9bfc372882509ae8ba93edc2bd08d28e1b2559174b764444e2124  guix-build-3f19875d6675/output/arm64-apple-darwin/bitcoin-3f19875d6675-arm64-apple-darwin-unsigned.tar.gz
87a28abfa9b4bf37b374b3a86cb016761e9eceaaaf97d405e43cd1745cbfb03f  guix-build-3f19875d6675/output/arm64-apple-darwin/bitcoin-3f19875d6675-arm64-apple-darwin.tar.gz
303683b5c76e7b99ecbcbdea6c6ab80df57b585b5aadf7c19561314ddcc87612  guix-build-3f19875d6675/output/dist-archive/bitcoin-3f19875d6675.tar.gz
86462a494ca5a26afb3d03376e7ccb47a2b347c607d05f517d3de81819256563  guix-build-3f19875d6675/output/powerpc64-linux-gnu/SHA256SUMS.part
43dd3b070b94e63ef570ec5f63e782fe62aaff62795798d3bd9fe3ce95ec3011  guix-build-3f19875d6675/output/powerpc64-linux-gnu/bitcoin-3f19875d6675-powerpc64-linux-gnu-debug.tar.gz
a85a56378b5806945202334afaf0b9f74664cf53ad4cd56159fd6de79c709df8  guix-build-3f19875d6675/output/powerpc64-linux-gnu/bitcoin-3f19875d6675-powerpc64-linux-gnu.tar.gz
9b7b422b55f28bcda4fe9df3cb46a2d2e18295421258a418e2e83b1bb74ad77b  guix-build-3f19875d6675/output/powerpc64le-linux-gnu/SHA256SUMS.part
5bb6fd27c3a6880de51928f9149a62e30e5f9e180ba0615628d2a6a2ec931307  guix-build-3f19875d6675/output/powerpc64le-linux-gnu/bitcoin-3f19875d6675-powerpc64le-linux-gnu-debug.tar.gz
8586dfe73c3c8dcc27494c27c2bf122f22f04efeff0d793cf02efd70d2e1f518  guix-build-3f19875d6675/output/powerpc64le-linux-gnu/bitcoin-3f19875d6675-powerpc64le-linux-gnu.tar.gz
1840ba4c99f1e11f19f3587b98cda655b679210420f2a7dd839b89c893fa61f2  guix-build-3f19875d6675/output/riscv64-linux-gnu/SHA256SUMS.part
0239b5a11cd0b04336a49beed03e60cb62117e4eb7c7a288acd649e2facf7a20  guix-build-3f19875d6675/output/riscv64-linux-gnu/bitcoin-3f19875d6675-riscv64-linux-gnu-debug.tar.gz
09bf89ef4675d4fb41b896d1745fe603e8faf2cb047797e399c32a0922e0ddca  guix-build-3f19875d6675/output/riscv64-linux-gnu/bitcoin-3f19875d6675-riscv64-linux-gnu.tar.gz
ec9bbabe136249028395992055cc579ffad61f699012d970863131f040273abe  guix-build-3f19875d6675/output/x86_64-apple-darwin/SHA256SUMS.part
ef62895c9aad19ebd926a0b7cfa361d7d0d27c43611ae6339c21fa6a8a9b7caa  guix-build-3f19875d6675/output/x86_64-apple-darwin/bitcoin-3f19875d6675-x86_64-apple-darwin-unsigned.dmg
a5d2c4f25c02a86a8000d1b45721720d57ff4e5ce8a446a63ac3aea5c6a30329  guix-build-3f19875d6675/output/x86_64-apple-darwin/bitcoin-3f19875d6675-x86_64-apple-darwin-unsigned.tar.gz
f17f94993412e1d9330edca93f00b1b81daddad78ca6a945e3dd3be6356b50a4  guix-build-3f19875d6675/output/x86_64-apple-darwin/bitcoin-3f19875d6675-x86_64-apple-darwin.tar.gz
26eab9761ec719c19ee1eb070d8c7bd43a481e834d6b820c1af7e9223418324f  guix-build-3f19875d6675/output/x86_64-linux-gnu/SHA256SUMS.part
a7a73e55336f99f4258494e4635918acf66e533eaf3133b80d7d6dfdc57002c4  guix-build-3f19875d6675/output/x86_64-linux-gnu/bitcoin-3f19875d6675-x86_64-linux-gnu-debug.tar.gz
4d0df4c4277bebac6576b7e47f68d8cf7785195aeef21cae5348fcfcce5a6810  guix-build-3f19875d6675/output/x86_64-linux-gnu/bitcoin-3f19875d6675-x86_64-linux-gnu.tar.gz
81fe0fd97c1d5fb7991ba07a0555d1f7cf25f671b0b376b8586dbecd09a841d2  guix-build-3f19875d6675/output/x86_64-w64-mingw32/SHA256SUMS.part
e656cfb9854930d8f9a84c7ed3751121259c0fbef1c4ac8421e44a1a900d0438  guix-build-3f19875d6675/output/x86_64-w64-mingw32/bitcoin-3f19875d6675-win64-debug.zip
469255c111b52977954fe9db2a555447eb19963c64bcb2ceb02feb79509e4a7c  guix-build-3f19875d6675/output/x86_64-w64-mingw32/bitcoin-3f19875d6675-win64-setup-unsigned.exe
41783b4f94917e184c05696e1bff6c896797c38d0d492f96bf55071dd7d06ae3  guix-build-3f19875d6675/output/x86_64-w64-mingw32/bitcoin-3f19875d6675-win64-unsigned.tar.gz
45adf6a0d032b3a207652393888e731f3ca899bb2980688f330a637ded92d11c  guix-build-3f19875d6675/output/x86_64-w64-mingw32/bitcoin-3f19875d6675-win64.zip

Copy link
Member

@fanquake fanquake left a comment

Choose a reason for hiding this comment

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

ACK 3f19875

@fanquake fanquake merged commit b13830e into bitcoin:master May 9, 2023
@hebasto hebasto deleted the 230504-inline branch May 9, 2023 14:40
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request May 9, 2023
@bitcoin bitcoin locked and limited conversation to collaborators May 8, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants