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

Wasm.simd Negation, Splat, ReplaceLane + tests #3237

Merged
merged 1 commit into from Jul 1, 2017

Conversation

Krovatkin
Copy link
Collaborator

@Krovatkin Krovatkin commented Jun 27, 2017

This PR includes:

  • Negation op + tests
  • Splat op + tests
  • ReplaceLane op + tests

This change is Reviewable

@Krovatkin
Copy link
Collaborator Author

@Cellule @MikeHolman please ignore this PR for now until I fix any possible issues w/ x-plat.

fyi @arunetm

@Krovatkin Krovatkin changed the title Negation, Splat, ReplaceLane + tests Wasm.simd Negation, Splat, ReplaceLane + tests Jun 27, 2017
let typeIndex = Math.log2(len) - 2;
let arr = arrays [typeIndex];

if (len == 32) { //special case for floats
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

we could change the indexing to a dict w/ an array view per each type where the type comes from a test name if this version is too ugly :-)

@Krovatkin
Copy link
Collaborator Author

@Cellule could you please take a look when you have a moment? The tests seem to have cleared

@Krovatkin
Copy link
Collaborator Author

@Cellule hate to bug you that often; could you please take a look when you have a moment?

@Cellule
Copy link
Contributor

Cellule commented Jun 30, 2017

Reviewed 15 of 15 files at r1.
Review status: all files reviewed at latest revision, 5 unresolved discussions.


lib/WasmReader/WasmByteCodeGenerator.cpp, line 1286 at r1 (raw file):

EmitInfo WasmBytecodeGenerator::EnregisterIndex() 
{
    const uint offset = GetReader()->m_currentNode.lane.index;

I think I would put the code in CheckLaneIndex in here that way if you register an index you have to check the index is not out of range.
Also, could we rename this function to something like EmitLaneIndex(Js::OpCode requestingOp)


lib/WasmReader/WasmByteCodeGenerator.cpp, line 1303 at r1 (raw file):

    }

    EmitInfo simdArg = PopEvalStack();

use PopEvalStack(WasmTypes::M128, _u("simd argument type mismatch")) instead of checking the type manually after


test/wasm.simd/replaceLaneTests.js, line 31 at r1 (raw file):

Previously, Krovatkin (Nick Korovaiko) wrote…

we could change the indexing to a dict w/ an array view per each type where the type comes from a test name if this version is too ugly :-)

Yeah this is a little hard to read and it feels hacky. I would just pass the typed array and the length by arguments.


test/wasm.simd/rlexe.xml, line 47 at r1 (raw file):

<test>
  <default>
    <files>splatNegTests.js</files>

This is not needed, rl will do a second run with prejit


test/wasm.simd/rlexe.xml, line 59 at r1 (raw file):

<test>
  <default>
    <files>replaceLaneTests.js</files>

This is not needed, rl will do a second run with prejit


Comments from Reviewable

@Krovatkin
Copy link
Collaborator Author

Review status: 10 of 15 files reviewed at latest revision, 5 unresolved discussions.


lib/WasmReader/WasmByteCodeGenerator.cpp, line 1286 at r1 (raw file):

Previously, Cellule (Michael Ferris) wrote…

I think I would put the code in CheckLaneIndex in here that way if you register an index you have to check the index is not out of range.
Also, could we rename this function to something like EmitLaneIndex(Js::OpCode requestingOp)

yup, looks much better that way


lib/WasmReader/WasmByteCodeGenerator.cpp, line 1303 at r1 (raw file):

Previously, Cellule (Michael Ferris) wrote…

use PopEvalStack(WasmTypes::M128, _u("simd argument type mismatch")) instead of checking the type manually after

fixed


test/wasm.simd/replaceLaneTests.js, line 31 at r1 (raw file):

Previously, Cellule (Michael Ferris) wrote…

Yeah this is a little hard to read and it feels hacky. I would just pass the typed array and the length by arguments.

I tried passing both, the array view and length, and it seems like a lot of boilerplate that can be avoided. Also, it makes harder to add new tests since w/ two additional parameters it's easier to pass the wrong thing.
I think the dict approach offers a nice compromise

  • it's much easier to add new tests
  • there's very little magic in helper functions to get the length and array view.

https://github.com/Krovatkin/ChakraCore/blob/b998a530697ff2902e8666c6847f2798148ab8cc/test/wasm.simd/splatNegTests.js#L34
https://github.com/Krovatkin/ChakraCore/blob/b998a530697ff2902e8666c6847f2798148ab8cc/test/wasm.simd/splatNegTests.js#L47
https://github.com/Krovatkin/ChakraCore/blob/b998a530697ff2902e8666c6847f2798148ab8cc/test/wasm.simd/splatNegTests.js#L63

But if you insist on passing those as extra parameters, we could definitely do it.


test/wasm.simd/rlexe.xml, line 47 at r1 (raw file):

Previously, Cellule (Michael Ferris) wrote…

This is not needed, rl will do a second run with prejit

fixed


test/wasm.simd/rlexe.xml, line 59 at r1 (raw file):

Previously, Cellule (Michael Ferris) wrote…

This is not needed, rl will do a second run with prejit

fixed


Comments from Reviewable

@Krovatkin
Copy link
Collaborator Author

@Cellule I was wondering if you could take another quick look? If everything looks good, I'll squash the commits and ask you to help me to merge this PR. @arunetm is still trying to figure out his perms issue.

@Cellule
Copy link
Contributor

Cellule commented Jun 30, 2017

:lgtm:


Reviewed 5 of 5 files at r2.
Review status: all files reviewed at latest revision, 1 unresolved discussion.


test/wasm.simd/replaceLaneTests.js, line 31 at r1 (raw file):

Previously, Krovatkin (Nick Korovaiko) wrote…

I tried passing both, the array view and length, and it seems like a lot of boilerplate that can be avoided. Also, it makes harder to add new tests since w/ two additional parameters it's easier to pass the wrong thing.
I think the dict approach offers a nice compromise

  • it's much easier to add new tests
  • there's very little magic in helper functions to get the length and array view.

https://github.com/Krovatkin/ChakraCore/blob/b998a530697ff2902e8666c6847f2798148ab8cc/test/wasm.simd/splatNegTests.js#L34
https://github.com/Krovatkin/ChakraCore/blob/b998a530697ff2902e8666c6847f2798148ab8cc/test/wasm.simd/splatNegTests.js#L47
https://github.com/Krovatkin/ChakraCore/blob/b998a530697ff2902e8666c6847f2798148ab8cc/test/wasm.simd/splatNegTests.js#L63

But if you insist on passing those as extra parameters, we could definitely do it.

This looks pretty good!


Comments from Reviewable

@Cellule
Copy link
Contributor

Cellule commented Jun 30, 2017

I'll try to merge it this afternoon

extractlane fix

add missing wasm files for negation and splat tests

addressing Mike's feedback
@Krovatkin
Copy link
Collaborator Author

@Cellule Thank you very much!
We'll try to figure out perms issues on our end, so we at least don't have to burden you w/ merges.

@chakrabot chakrabot merged commit 8798239 into chakra-core:wasm.simd Jul 1, 2017
chakrabot pushed a commit that referenced this pull request Jul 1, 2017
Merge pull request #3237 from Krovatkin:replacelane

This PR includes:
* Negation op  + tests
* Splat op + tests
* ReplaceLane op + tests
@Krovatkin
Copy link
Collaborator Author

@Cellule, awesome! Thanks a lot!

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.

None yet

4 participants