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

Apply ConstantExpected attribute in runtime repo APIs as needed #63426

Open
Tracked by #64603
buyaa-n opened this issue Jan 6, 2022 · 5 comments
Open
Tracked by #64603

Apply ConstantExpected attribute in runtime repo APIs as needed #63426

buyaa-n opened this issue Jan 6, 2022 · 5 comments

Comments

@buyaa-n
Copy link
Contributor

buyaa-n commented Jan 6, 2022

With #62436 we added a new ConstantExpectedAttribute to express that only constant value is expected for a parameter. Now we need to apply that parameter to the APIs parameters needs it. This issue is for tracking the APIs needs this attribute

As far as I know, we need to add this to the byte count parameter for the following APIs:

public static Vector256<short> ShiftLeftLogical(Vector256<short> value, byte count) => ShiftLeftLogical(value, count);
/// <summary>
/// __m256i _mm256_slli_epi16 (__m256i a, int imm8)
/// VPSLLW ymm, ymm, imm8
/// </summary>
public static Vector256<ushort> ShiftLeftLogical(Vector256<ushort> value, byte count) => ShiftLeftLogical(value, count);
/// <summary>
/// __m256i _mm256_slli_epi32 (__m256i a, int imm8)
/// VPSLLD ymm, ymm, imm8
/// </summary>
public static Vector256<int> ShiftLeftLogical(Vector256<int> value, byte count) => ShiftLeftLogical(value, count);
/// <summary>
/// __m256i _mm256_slli_epi32 (__m256i a, int imm8)
/// VPSLLD ymm, ymm, imm8
/// </summary>
public static Vector256<uint> ShiftLeftLogical(Vector256<uint> value, byte count) => ShiftLeftLogical(value, count);
/// <summary>
/// __m256i _mm256_slli_epi64 (__m256i a, int imm8)
/// VPSLLQ ymm, ymm, imm8
/// </summary>
public static Vector256<long> ShiftLeftLogical(Vector256<long> value, byte count) => ShiftLeftLogical(value, count);
/// <summary>
/// __m256i _mm256_slli_epi64 (__m256i a, int imm8)
/// VPSLLQ ymm, ymm, imm8
/// </summary>
public static Vector256<ulong> ShiftLeftLogical(Vector256<ulong> value, byte count) => ShiftLeftLogical(value, count);

@GrabYourPitchforks @tannergooding please add the other APIs/parameters needs the attribute.

See @stephentoub's comment in #62436 (comment)

@dotnet-issue-labeler
Copy link

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged New issue has not been triaged by the area owner label Jan 6, 2022
@ghost
Copy link

ghost commented Jan 6, 2022

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

Issue Details

With #62436 we added a new ConstantExpectedAttribute to express that only constant value is expected for a parameter. Now we need to apply that parameter to the APIs parameters needs it. This issue is for tracking the APIs needs this attribute

As far as I know, we need to add this to the byte count parameter for the following APIs:

public static Vector256<short> ShiftLeftLogical(Vector256<short> value, byte count) => ShiftLeftLogical(value, count);
/// <summary>
/// __m256i _mm256_slli_epi16 (__m256i a, int imm8)
/// VPSLLW ymm, ymm, imm8
/// </summary>
public static Vector256<ushort> ShiftLeftLogical(Vector256<ushort> value, byte count) => ShiftLeftLogical(value, count);
/// <summary>
/// __m256i _mm256_slli_epi32 (__m256i a, int imm8)
/// VPSLLD ymm, ymm, imm8
/// </summary>
public static Vector256<int> ShiftLeftLogical(Vector256<int> value, byte count) => ShiftLeftLogical(value, count);
/// <summary>
/// __m256i _mm256_slli_epi32 (__m256i a, int imm8)
/// VPSLLD ymm, ymm, imm8
/// </summary>
public static Vector256<uint> ShiftLeftLogical(Vector256<uint> value, byte count) => ShiftLeftLogical(value, count);
/// <summary>
/// __m256i _mm256_slli_epi64 (__m256i a, int imm8)
/// VPSLLQ ymm, ymm, imm8
/// </summary>
public static Vector256<long> ShiftLeftLogical(Vector256<long> value, byte count) => ShiftLeftLogical(value, count);
/// <summary>
/// __m256i _mm256_slli_epi64 (__m256i a, int imm8)
/// VPSLLQ ymm, ymm, imm8
/// </summary>
public static Vector256<ulong> ShiftLeftLogical(Vector256<ulong> value, byte count) => ShiftLeftLogical(value, count);

@GrabYourPitchforks @tannergooding please add the other APIs/parameters needs the attribute.

Originally posted by @stephentoub in #62436 (comment)

Author: buyaa-n
Assignees: -
Labels:

area-System.Runtime, untriaged

Milestone: -

@buyaa-n buyaa-n added this to the 7.0.0 milestone Jan 6, 2022
@jeffschwMSFT jeffschwMSFT removed the untriaged New issue has not been triaged by the area owner label Jan 11, 2022
@wzchua
Copy link
Contributor

wzchua commented May 29, 2022

If I'm not mistaken the intrinsic that has imm8 would need the attribute

@wzchua
Copy link
Contributor

wzchua commented Jul 30, 2022

I have looked into this as part of testing the analyzer in dotnet/roslyn-analyzers#5766

what I have at the moment https://github.com/wzchua/runtime/commits/constantexpected

@buyaa-n
Copy link
Contributor Author

buyaa-n commented Aug 2, 2022

@tannergooding please check @wzchua's commits that applying the attributes, or do you want them to raise a PR? Probably that is easier for review and discuss if needed

@dakersnar dakersnar modified the milestones: 7.0.0, Future Aug 8, 2022
@dakersnar dakersnar added the code-analyzer Marks an issue that suggests a Roslyn analyzer label Aug 8, 2022
@buyaa-n buyaa-n removed the code-analyzer Marks an issue that suggests a Roslyn analyzer label Nov 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants