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: Trunc & Conv ops for 64x2 types #4074

Merged

Conversation

arunetm-zz
Copy link
Contributor

Truncation & conversion operstions for 64x2 types.

Xplat link error fixes

@arunetm-zz
Copy link
Contributor Author

arunetm-zz commented Oct 26, 2017

@Cellule, @MikeHolman please review.

@@ -4672,7 +4672,6 @@ IRBuilderAsmJs::BuildInt64x2_3(Js::OpCodeAsmJs newOpcode, uint32 offset, BUILD_S
void
IRBuilderAsmJs::BuildInt64x2_2(Js::OpCodeAsmJs newOpcode, uint32 offset, BUILD_SIMD_ARGS_REG2)
{
Assert(newOpcode == Js::OpCodeAsmJs::Simd128_Neg_I2);
Copy link
Contributor

Choose a reason for hiding this comment

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

I would prefer that you add the new possible opcode in the assert.
It helps to figure out which opcode produces which IR

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! will do.

@@ -772,6 +772,18 @@ IR::Instr* LowererMD::Simd128LowerUnMappedInstruction(IR::Instr *instr)
case Js::OpCode::Simd128_FromFloat32x4_U4:
return Simd128LowerUint32x4FromFloat32x4(instr);

case Js::OpCode::Simd128_FromInt64x2_D2:
EmitSimdConversion(instr, IR::HelperSimd128ConvertSD2);
Copy link
Contributor

Choose a reason for hiding this comment

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

Since you are going to remove the Instr. You could pass the dst and src1 to EmitSimdConversion like
EmitSimdConversion(instr->UnlinkDst(), instr->UnlinkSrc1(), IR::Helper...);;
This way, we won't have to clone 2 operands that are about to be freed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah thanks. Will do,

@@ -3803,13 +3803,15 @@ namespace Js
case AsmJsRetType::Uint32x4:
case AsmJsRetType::Uint16x8:
case AsmJsRetType::Uint8x16:
#if _WIN32 || _WIN64 //WASM.SIMD ToDo: Enable thunk for Xplat
Copy link
Contributor

Choose a reason for hiding this comment

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

_WIN32 is good enough to detect that we're building for Windows

Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder though if we should just disable ENABLE_WASM_SIMD on xplat ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can, but his way will allow us to ensure that the rest of the simd code is xplat compliant until we fix and test the thunks. Would it make sense to keep this as is?

Will do the _WIN32 check alone. I wasn't sure if that was enough until now. Thanks!

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh you're right, it makes sense to at least try to compile on xplat. ignore ENABLE_WASM_SIMD then

@arunetm-zz
Copy link
Contributor Author

@Cellule could you help to sign off this change if it looks OK?

@@ -915,14 +915,13 @@ IR::Instr* LowererMD::Simd128CanonicalizeToBools(IR::Instr* instr, const Js::OpC

void LowererMD::EmitSimdConversion(IR::Instr *instr, IR::JnHelperMethod helper)
{
IR::Opnd* dst = instr->GetDst();
Copy link
Contributor

Choose a reason for hiding this comment

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

I think I would prefer if the function doing the Unlink is the same freeing the instr.
It makes it more clear that the opnd cannot be used in between without looking at the implementation.
I recommend changing the signature of this function to EmitSimdConversion(IR::Opnd* dst, IR::Opnd* src, IR::JnHelperMethod helper) and call unlink at the call site

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we still need to pass the instr as an argument to EmitSimdConversion because of its use in loading helper memref arguments.

Shall we move removeInstr() to be inside EmitSimdConversion?

Copy link
Contributor

Choose a reason for hiding this comment

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

You can move the remove inside this function if you prefer.
The instr is only used as a reference to where to insert the argument.
Usually (well sometimes) we call it insertBeforeInstr to mean that we don't actually operate on that instr, but we need to insert new ones before it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That makes sense. Thanks @Cellule . Please take a look.

@arunetm-zz
Copy link
Contributor Author

@Cellule can you take a look.

@arunetm-zz
Copy link
Contributor Author

squashed commits for merge.

@chakrabot chakrabot merged commit e12dac3 into chakra-core:wasm.simd Oct 30, 2017
chakrabot pushed a commit that referenced this pull request Oct 30, 2017
Merge pull request #4074 from arunetm:arunetm/wasm.simd.trunc64x2

Truncation & conversion operstions for 64x2 types.

Xplat link error fixes
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.

4 participants