Skip to content

ISimdVector vector intrinsics fixes#113288

Merged
lewing merged 13 commits into
dotnet:mainfrom
lewing:test-sn-vector-interp
Mar 13, 2025
Merged

ISimdVector vector intrinsics fixes#113288
lewing merged 13 commits into
dotnet:mainfrom
lewing:test-sn-vector-interp

Conversation

@lewing

@lewing lewing commented Mar 8, 2025

Copy link
Copy Markdown
Member

#104983 added filtering for explicit ISimdVector implementations. It appears it used the wrong namespace for System.Numerics.Vector<T> when removing the expanded interface and types from the method name. Fix the explicit interface implementation filtering and call SN Vector interpreter intrinsics.

@lewing lewing force-pushed the test-sn-vector-interp branch 3 times, most recently from 934ec82 to b6f4172 Compare March 11, 2025 16:42
@lewing lewing force-pushed the test-sn-vector-interp branch from b6f4172 to b3560ab Compare March 11, 2025 18:03
@lewing lewing marked this pull request as ready for review March 11, 2025 22:11
Copilot AI review requested due to automatic review settings March 11, 2025 22:11
@lewing lewing force-pushed the test-sn-vector-interp branch from 418452e to ddb2b8f Compare March 12, 2025 18:38
@lewing

lewing commented Mar 12, 2025

Copy link
Copy Markdown
Member Author

@tannergooding I assume this was the intent of the original code? if so I'm happy to do the same change in jitimporter/CorInfoImpl.cs?

done

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @BrzVlad, @kotlarmilos
See info in area-owners.md if you want to be subscribed.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @steveisok, @vitek-karas
See info in area-owners.md if you want to be subscribed.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @dotnet/area-system-runtime-intrinsics
See info in area-owners.md if you want to be subscribed.

@lewing lewing requested a review from EgorBo March 12, 2025 19:16
@lewing lewing force-pushed the test-sn-vector-interp branch from 04516ad to 35bfdea Compare March 12, 2025 19:24
@EgorBo

EgorBo commented Mar 12, 2025

Copy link
Copy Markdown
Member

@MihuBot

@lewing lewing force-pushed the test-sn-vector-interp branch from 750fdc6 to f318510 Compare March 12, 2025 20:11
@jeffhandley jeffhandley requested a review from Copilot March 12, 2025 23:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes the filtering for explicit ISimdVector implementations by addressing the incorrect namespace used for the Vector intrinsics. Key changes include adjusting the string slicing for processing method names and adding a new branch to handle the Runtime.Intrinsics.Vector namespace.

Comments suppressed due to low confidence (1)

src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs:4442

  • Consider using an 'else if' here if the 'Numerics.Vector' branch is mutually exclusive, to prevent potential double processing of the method name.
if (partialMethodName.StartsWith("Runtime.Intrinsics.Vector"))

@jeffhandley jeffhandley left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good to me and I agree with this capturing the original intent, but we should get signoff from a jit expert.

@EgorBo EgorBo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM. It's a bit unfortunate that we use magic constants here, any C++ compiler should be able to constant fold strlen("const"), but it's out of the scope of this PR

(strncmp(cmethod_name + 70, "256<T>,T>.", 10) == 0) ||
(strncmp(cmethod_name + 70, "512<T>,T>.", 10) == 0)) {
cmethod_name += 80;
if (strncmp(cmethod_name, "System.Runtime.Intrinsics.ISimdVector<System.", 45) == 0) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks like we duplicate this code block 3 times, maybe put it into some shared function?

@radekdoulik radekdoulik left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Besides the code duplication it LGTM.

@lewing lewing merged commit ee74dc9 into dotnet:main Mar 13, 2025
@lewing lewing deleted the test-sn-vector-interp branch March 13, 2025 14:59

@tannergooding tannergooding left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

(Sorry for the delay, was out last week)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants