Skip to content

Conversation

@cyb70289
Copy link
Contributor

@cyb70289 cyb70289 commented Apr 16, 2020

  • Include all necessary SIMD header files in a single header "simd.h".
  • Simplify architecture dependent CRC code in hash_util.h.
  • Remove SSEUtil namespace which contains some SSE constants.
    These codes are not used and I can't find proper place to hold them.
  • Remove sse_util.h, neon_util.h, and hash_util.h.

@cyb70289
Copy link
Contributor Author

cc @jianxind

@github-actions
Copy link

Copy link
Contributor

@frankdjx frankdjx left a comment

Choose a reason for hiding this comment

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

I like the ideal to has one unified SIMD head file for all ARCH. Cool.

Copy link
Contributor

Choose a reason for hiding this comment

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

I personally prefer to keep the NONE(zero) level here though it may duplicate to ARROW_USE_SIMD. Level usually start from zero.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for review. NONE restored.

@wesm
Copy link
Member

wesm commented Apr 20, 2020

I thought we had discussed removing the ARROW_USE_SIMD option altogether

@cyb70289
Copy link
Contributor Author

I thought we had discussed removing the ARROW_USE_SIMD option altogether

@wesm remove ARROW_USE_SIMD? I remember a thread about default simd level( #6907 (comment)), but not ARROW_USE_SIMD.
That said, I would like to remove it as it overlaps other setting.

@wesm
Copy link
Member

wesm commented Apr 20, 2020

Maybe it was just a thought I had in my head but never expressed. Opened https://issues.apache.org/jira/browse/ARROW-8531

@cyb70289
Copy link
Contributor Author

Maybe it was just a thought I had in my head but never expressed. Opened https://issues.apache.org/jira/browse/ARROW-8531

Updated this patch to remove ARROW_USE_SIMD

Copy link
Contributor

Choose a reason for hiding this comment

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

I guess it should be SSE4_2 as it's the default option. ARROW_USE_SIMD is on as default also. Or just rm the cmake-extras?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The context is to show how to pass extra cmake flags. Default value looks not very useful. Maybe change to AVX2?

Copy link
Contributor

Choose a reason for hiding this comment

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

Get it, then ARROW_SIMD_LEVEL=NONE is fine:)

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 moving this part into simd.h? We can reduce the number of places that depends on the target hardware.

Copy link
Member

Choose a reason for hiding this comment

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

Also, regardless of whether we move them or not, you should put them in the arrow::internal namespace.

Copy link
Contributor

@emkornfield emkornfield Apr 26, 2020

Choose a reason for hiding this comment

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

I'd be concerned about putting too much in SIMD directly. If we expect these to be used in other places that don't depend on this header we should create a specific header targetted at hardware. digests/hashing. I think the way bit_util.h wraps special instructions is a reasonable path to follow.

@kiszk
Copy link
Member

kiszk commented Apr 22, 2020

Is the function Armv8CrcHashParallel used somewhere? Sorry if I overlook it.

Copy link
Member

@pitrou pitrou left a comment

Choose a reason for hiding this comment

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

Thank you for doing this. This looks like a good idea.

Copy link
Member

Choose a reason for hiding this comment

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

Also, regardless of whether we move them or not, you should put them in the arrow::internal namespace.

@pitrou
Copy link
Member

pitrou commented Apr 23, 2020

cc @emkornfield

@cyb70289
Copy link
Contributor Author

Is the function Armv8CrcHashParallel used somewhere? Sorry if I overlook it.

It's not used. Actually the whole file hash_util.h is not used per this comment. From git
history, I see crc based hash is replaced with xxhash3.

I'm glad to remove this file if community think it's ok.

Copy link
Contributor

@emkornfield emkornfield Apr 26, 2020

Choose a reason for hiding this comment

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

style nits: If possible les spell out the type instead of using auto (its not all clear what the types are without looking up these exact functions.

Since these are functions, it would be nice to use standard function casing for them. e.g. Crc32U16, even better might be to define something like:
HardwareCrc(uint16) ..
HardwareCrc(uint16) ..

Copy link
Contributor

Choose a reason for hiding this comment

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

Just an FYI in #6985 relies on BMI2 do you think adding that here would be appropriate?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, I think so

@emkornfield
Copy link
Contributor

Is the function Armv8CrcHashParallel used somewhere? Sorry if I overlook it.

It's not used. Actually the whole file hash_util.h is not used per this comment. From git
history, I see crc based hash is replaced with xxhash3.

I'm glad to remove this file if community think it's ok.

Sorry I missed this, I think we can probably remove these for now (we can always reinstate from git history if needed). Parquet CRC uses standard CRC32 and at least for intel, the intrinsic does CRC32C. This might be useful for digests for Arrow File/Stream but that hasn't been approved by the community yet.

- Include all necessary SIMD header files in a single header "simd.h".
- Simplify architecture dependent CRC code in hash_util.h.
- Remove SSEUtil namespace which contains some SSE constants.
  These codes are not used and I can't find proper place to hold them.
- Remove sse_util.h and neon_util.h.
- Remove ARROW_SIMD_LEVEL=NONE which duplicates ARROW_USE_SIMD=OFF.
@cyb70289
Copy link
Contributor Author

cyb70289 commented Apr 27, 2020

Sorry I missed this, I think we can probably remove these for now (we can always reinstate from git history if needed). Parquet CRC uses standard CRC32 and at least for intel, the intrinsic does CRC32C. This might be useful for digests for Arrow File/Stream but that hasn't been approved by the community yet.

@kiszk @emkornfield @pitrou , removed hash_util.h, easiest path for me :) , we can pick it back and refine per actual use case if it will be used in future.

Copy link
Member

@pitrou pitrou left a comment

Choose a reason for hiding this comment

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

+1, LGTM. @emkornfield, do you have further comments on this PR? Otherwise I think we can merge.

@emkornfield
Copy link
Contributor

Nothing more from me

@pitrou pitrou closed this in 8e1b5b8 May 5, 2020
@cyb70289 cyb70289 deleted the simd branch May 5, 2020 10:54
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.

6 participants