Skip to content

PERF: Reorder header for philox - #34

Merged
mattip merged 3 commits into
mattip:randomgenfrom
bashtage:philox-reorder-uint128
May 27, 2019
Merged

mattip merged 3 commits into
mattip:randomgenfrom
bashtage:philox-reorder-uint128

Conversation

@bashtage

Copy link
Copy Markdown

Reorder header so that support uint128 is always used if available, irrespective of platform

Reorder header so that support uint128 is always used if avilable, irrespective of platform
@bashtage

Copy link
Copy Markdown
Author

This patch improves performance on Win64 if built using ICC or Clang (I think, not verified) since they support uint128.

Comment thread numpy/random/src/philox/philox.h Outdated
}

/* Prefer uint128 if available: GCC, clang, ICC */
#if __SIZEOF_INT128__

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

this would be clearer as #ifdef

@bashtage

Copy link
Copy Markdown
Author

Thanks, fixed 2 places.

Comment thread numpy/random/src/philox/philox.h Outdated

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

here too

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

This one doesn't work _Win64 is defined for 32 bit windows.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Nope, I was wrong.

Use ifdef to detec uint128
@bashtage
bashtage force-pushed the philox-reorder-uint128 branch from 390ecf4 to 8e0165d Compare May 27, 2019 06:57
Comment thread numpy/random/src/philox/philox.h Outdated
#include <intrin.h>
/* TODO: This isn't correct for many platforms */
#ifdef _WIN64
#ifdef _WIN64 && _M_AMD64

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Sorry, I should have been more explicit: #if defined(_WIN64) && defined(_M_AMD64) which will work even if they have values that will fail for && like 2 and 1: 2 && 1 -> 0

@mattip
mattip merged this pull request into mattip:randomgen May 27, 2019
@mattip

mattip commented May 27, 2019

Copy link
Copy Markdown
Owner

thanks

mattip pushed a commit that referenced this pull request May 27, 2019
* PERF: Reorder header for philox

Reorder header so that support uint128 is always used if avilable, irrespective of platform
@bashtage
bashtage deleted the philox-reorder-uint128 branch May 12, 2020 21:38
mattip pushed a commit that referenced this pull request Nov 15, 2023
Merge in ~STEPAN.SINDELAR_ORACLE.COM/numpy-hpy from fa/fix_universal_crashes to labs-hpy-port

* commit '3e21b1a35e92fa196650a9a4cf6c438337b5342f':
  Migrate is_known_scalar_type_function
  Correctly convert to/from HPyArrayMethod_Context
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants