Skip to content

Remove 128-bit limit on Vector<T> size for ARM64#129852

Open
snickolls-arm wants to merge 4 commits into
dotnet:mainfrom
snickolls-arm:256-base
Open

Remove 128-bit limit on Vector<T> size for ARM64#129852
snickolls-arm wants to merge 4 commits into
dotnet:mainfrom
snickolls-arm:256-base

Conversation

@snickolls-arm

Copy link
Copy Markdown
Contributor

If InstructionSet_VectorT is available, set the class instance size to the process SVE vector length.

Increase the maximum bound in structMightRepresentSIMDType to allow the JIT to detect this when the ISA is present.

If InstructionSet_VectorT is available, set the class instance size to the
process SVE vector length.

Increase the maximum bound in structMightRepresentSIMDType to allow the JIT
to detect this when the ISA is present.
@github-actions github-actions Bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Jun 25, 2026
@dotnet-policy-service dotnet-policy-service Bot added the community-contribution Indicates that the PR has been added by a community member label Jun 25, 2026
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

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

Comment thread src/coreclr/jit/compiler.h Outdated
Comment thread src/coreclr/vm/methodtablebuilder.cpp
…Type

Refactor the function to take in the class handle and query flag and
size properties from the handle. Use the flag properties to optimize the
function.
Comment thread src/coreclr/jit/compiler.h Outdated
#ifdef FEATURE_SIMD
return (structSize >= getMinVectorByteLength()) && (structSize <= getMaxVectorByteLength());
#ifdef TARGET_ARM64
const uint32_t max = compExactlyDependsOn(InstructionSet_VectorT) ? MAX_SVE_REGSIZE_BYTES : FP_REGSIZE_BYTES;

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.

nit: Might be good to have a comment explaining why we check MAX_SVE_REGSIZE_BYTES (256) instead of getMaxVectorByteLength and the size that Vector<T> will be here....

In particular, I'd expect that Vector<T> be either 0 or SIZE_UNKNOWN here, and so it isn't clear why the check will "pass" for it.

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.

Ah, I guess SIZE_UNKNOWN is 255, so it'd qualify as under 256.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We shouldn't see the VM report SIZE_UNKNOWN anyway at the moment. There was greater risk of that happening while the function was taking in a size integer, passing the class handle mitigates that use as well.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I do agree a comment is needed here though. IIUC, AVX will support compilation for a number of VLs up to the maximum value available (is it ever possible to see AVX-512 on it's own?).

For SVE it's just going to be one VL somewhere in the range 128-2048 bit, so getMaxVectorByteLength doesn't quite have the same use case here.

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.

(is it ever possible to see AVX-512 on it's own?).

It is not, xarch currently requires that it be incremental and so V512 support implies V256 support, which itself implies V128 support (which technically implies V64 support, but MMX is legacy/slow and we don't support or expose it)

For SVE it's just going to be one VL somewhere in the range 128-2048 bit, so getMaxVectorByteLength doesn't quite have the same use case here.

Right. I wonder even if that means it should be "special" and effectively a check for "is within this range or exactly this well known type", so in the case of Arm64 being (size is >= 8 and <= 16) || (size == SIZE_UNKNOWN).

Probably not impactful now that we're filtering to only intrinsic types, but it is a bit unique in the overall setup.

@tannergooding

Copy link
Copy Markdown
Member

CC. @dotnet/jit-contrib, @EgorBo, @dhartglassMSFT for secondary review on this Arm contribution.

Comment thread src/coreclr/jit/compiler.h Outdated
Comment thread src/coreclr/jit/compiler.h Outdated
@@ -10596,10 +10596,27 @@ class Compiler

// Use to determine if a struct *might* be a SIMD type. As this function only takes a size, many

@dhartglassMSFT dhartglassMSFT Jun 29, 2026

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.

"As this function only takes a size..." is out of date now :)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I've updated the comment on this function.

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

Labels

area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants