Skip to content

Ensure we consistently broadcast the result of simd dot product#105888

Merged
tannergooding merged 1 commit intodotnet:mainfrom
tannergooding:fix-99391
Aug 6, 2024
Merged

Ensure we consistently broadcast the result of simd dot product#105888
tannergooding merged 1 commit intodotnet:mainfrom
tannergooding:fix-99391

Conversation

@tannergooding
Copy link
Member

This resolves #99391

@ghost ghost added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Aug 2, 2024
Comment on lines -9919 to -9927
#if defined(TARGET_XARCH)
if ((simdSize == 8) && !compOpportunisticallyDependsOn(InstructionSet_SSE41))
{
// When SSE4.1 isn't supported then Vector2 only needs a single horizontal add
// which means the result isn't broadcast across the entire vector and we can't
// optimize
break;
}
#endif // TARGET_XARCH
Copy link
Member Author

Choose a reason for hiding this comment

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

This code was incorrect, as we expect that broadcast should always be occurring.

The lowering logic was doing the right thing already for SSE2 and SSE41+ machines, but not for SSE3 or SSSE3 machines where HorizontalAdd exists

@tannergooding
Copy link
Member Author

/azp run runtime-coreclr jitstress-isas-x86

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@tannergooding
Copy link
Member Author

This is going to need backport to .NET 8 since its a customer reported codegen issue.

@tannergooding
Copy link
Member Author

CC. @dotnet/jit-contrib, this is ready for review

JitStress failures are unrelated and fixed by #105889, I've updated the branch and restarted CI so it can pass cleanly now that the fix has been merged (force pushed so this remains trivial to backport).

@tannergooding
Copy link
Member Author

/azp run runtime-coreclr jitstress-isas-x86

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@tannergooding
Copy link
Member Author

CC. @dotnet/jit-contrib, this is ready for review and resolves #99391. It likely needs backport after merge.

(just repinging now that the weekend is over)

@tannergooding tannergooding merged commit c28adf1 into dotnet:main Aug 6, 2024
@tannergooding tannergooding deleted the fix-99391 branch August 6, 2024 16:58
@tannergooding
Copy link
Member Author

/backport to release/8.0-staging

@github-actions
Copy link
Contributor

github-actions bot commented Aug 6, 2024

@github-actions
Copy link
Contributor

github-actions bot commented Aug 6, 2024

@tannergooding backporting to release/8.0-staging failed, the patch most likely resulted in conflicts:

$ git am --3way --ignore-whitespace --keep-non-patch changes.patch

Applying: Ensure we consistently broadcast the result of simd dot product
Using index info to reconstruct a base tree...
M	src/coreclr/jit/lowerxarch.cpp
M	src/coreclr/jit/morph.cpp
Falling back to patching base and 3-way merge...
Auto-merging src/coreclr/jit/morph.cpp
CONFLICT (content): Merge conflict in src/coreclr/jit/morph.cpp
Auto-merging src/coreclr/jit/lowerxarch.cpp
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config advice.mergeConflict false"
Patch failed at 0001 Ensure we consistently broadcast the result of simd dot product
Error: The process '/usr/bin/git' failed with exit code 128

Please backport manually!

@github-actions
Copy link
Contributor

github-actions bot commented Aug 6, 2024

@tannergooding an error occurred while backporting to release/8.0-staging, please check the run log for details!

Error: git am failed, most likely due to a merge conflict.

@JulieLeeMSFT JulieLeeMSFT added this to the 9.0.0 milestone Aug 12, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Sep 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Net8 - Vector2.Normalize and old(?) CPU - wrong result

3 participants