-
Notifications
You must be signed in to change notification settings - Fork 1.7k
[JSC] Implement fromHex and setFromHex in SIMD #30897
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
[JSC] Implement fromHex and setFromHex in SIMD #30897
Conversation
|
EWS run on previous version of this PR (hash 13e7211) |
13e7211 to
8253efb
Compare
|
EWS run on previous version of this PR (hash 8253efb) |
8253efb to
8457448
Compare
|
EWS run on previous version of this PR (hash 8457448) |
8457448 to
899e62d
Compare
|
EWS run on previous version of this PR (hash 899e62d) |
899e62d to
2a9cb1e
Compare
|
EWS run on previous version of this PR (hash 2a9cb1e) |
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.
Since the memory will be fully written, couldn't uninitialized memory be used?
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.
Done.
justinmichaud
left a comment
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.
rs=me
kmiller68
left a comment
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.
r=me with comments
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.
Nit: I think this would be easier to read if this lambda wasn't defined inside the if condition. So something like:
if (span.size() >= stride) {
auto doStridedDecode = [&]() ALWAYS_INLINE_LAMBDA { ... };
if (!doStridedDecode())
return WTF::notFound;
}
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.
Done
Constellation
left a comment
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.
Thanks
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.
Done.
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.
Done
2a9cb1e to
c13071f
Compare
|
EWS run on current version of this PR (hash c13071f) |
https://bugs.webkit.org/show_bug.cgi?id=276705 rdar://131903377 Reviewed by Keith Miller and Justin Michaud. This patch implements fromHex / setFromHex in SIMD. The new implementation is roughly 17x faster. We use http://0x80.pl/notesen/2022-01-17-validating-hex-parse.html 's algorithm 3 approach to decode hex in SIMD with validation. For 16bit string, we load high and low bytes separately, checking high bytes are all zero, and decoding low bytes as the same to 8bit string with validation. ToT Patched from-hex 46.8263+-0.1123 ^ 2.7441+-0.0149 ^ definitely 17.0641x faster * JSTests/microbenchmarks/from-hex.js: Added. (test): * JSTests/stress/uint8array-fromHex.js: (shouldBeArray.Uint8Array.fromHex): (shouldBeArray): * Source/JavaScriptCore/runtime/JSGenericTypedArrayViewConstructor.cpp: (JSC::decodeHexImpl): (JSC::decodeHex): (JSC::JSC_DEFINE_HOST_FUNCTION): * Source/JavaScriptCore/runtime/JSGenericTypedArrayViewConstructor.h: * Source/JavaScriptCore/runtime/JSGenericTypedArrayViewPrototype.cpp: (JSC::JSC_DEFINE_HOST_FUNCTION): Canonical link: https://commits.webkit.org/281053@main
c13071f to
2a040cb
Compare
|
Committed 281053@main (2a040cb): https://commits.webkit.org/281053@main Reviewed commits have been landed. Closing PR #30897 and removing active labels. |
🧪 services
2a040cb
c13071f
🧪 wpe-wk2🧪 wincairo-tests🧪 ios-wk2🧪 api-mac🧪 api-wpe🧪 ios-wk2-wpt🧪 mac-wk1🧪 api-ios🧪 mac-wk2🧪 mac-AS-debug-wk2🧪 gtk-wk2🧪 mac-wk2-stress🧪 api-gtk🧪 vision-wk2🧪 jsc-armv7-tests