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

Avx512: Abs, ceil, floor, min, max #84937

Merged
merged 32 commits into from
Apr 22, 2023
Merged
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
c44a922
Minmax implementation
jkrishnavs Apr 14, 2023
20d19f1
Fixing new instruction issues
jkrishnavs Apr 15, 2023
4692e6f
Merge branch 'main' into avx512minmax
jkrishnavs Apr 15, 2023
179dca9
Abs, Ceil and Floor implementation.
jkrishnavs Apr 15, 2023
964e7c4
Merge branch 'main' into avx512minmax
jkrishnavs Apr 16, 2023
024123a
Merge branch 'main' into avx512minmax
jkrishnavs Apr 17, 2023
f9d9664
Merge branch 'main' into avx512minmax
jkrishnavs Apr 17, 2023
ce78b0a
unary oprations: Sqrt, Negate, Addition
jkrishnavs Apr 17, 2023
5448d87
Removing debug function for condition
jkrishnavs Apr 17, 2023
a73f4ca
Merge branch 'main' into avx512minmax
jkrishnavs Apr 18, 2023
fd002fb
Fixing formatting issues
jkrishnavs Apr 18, 2023
28fc029
Merge branch 'main' into avx512minmax
jkrishnavs Apr 18, 2023
3fa7343
fixing merge issue
jkrishnavs Apr 18, 2023
a4006e1
Fixing rebase formatting
jkrishnavs Apr 18, 2023
def94d5
Reverting changes to fix rebase issues
jkrishnavs Apr 18, 2023
3e40982
Update src/coreclr/jit/hwintrinsiclistxarch.h
jkrishnavs Apr 20, 2023
e48582d
Update src/coreclr/jit/hwintrinsiclistxarch.h
jkrishnavs Apr 20, 2023
e1f2a0d
Update src/coreclr/jit/hwintrinsiclistxarch.h
jkrishnavs Apr 20, 2023
1951811
Update src/coreclr/jit/gentree.cpp
jkrishnavs Apr 20, 2023
07a2380
Update src/coreclr/jit/gentree.cpp
jkrishnavs Apr 20, 2023
3884491
Addressing review comments. Merging AVX512 Abs conditions
jkrishnavs Apr 20, 2023
f7b3613
Merge branch 'main' into avx512minmax
jkrishnavs Apr 20, 2023
9ef0734
formatting issues
jkrishnavs Apr 20, 2023
615c4ee
Merge branch 'main' into avx512minmax
jkrishnavs Apr 20, 2023
669316a
removing AVX only flag from 512 floor
jkrishnavs Apr 20, 2023
4eb918c
Merge branch 'main' into avx512minmax
tannergooding Apr 21, 2023
cf87f4f
Update src/coreclr/jit/gentree.cpp
jkrishnavs Apr 21, 2023
31163e0
adding appropriate round functions
jkrishnavs Apr 21, 2023
6fc01fb
Merge branch 'avx512minmax' of https://github.com/jkrishnavs/runtime …
jkrishnavs Apr 21, 2023
d8ef86b
Reverting creating new instruction for AVX512 round and just updating…
jkrishnavs Apr 22, 2023
03178ee
Update src/coreclr/jit/instrsxarch.h
jkrishnavs Apr 22, 2023
5ef03f6
Fix formatting issue
tannergooding Apr 22, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
65 changes: 64 additions & 1 deletion src/coreclr/jit/gentree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19338,7 +19338,12 @@ GenTree* Compiler::gtNewSimdAbsNode(var_types type, GenTree* op1, CorInfoType si

if (simdBaseType == TYP_LONG)
{
if (compOpportunisticallyDependsOn(InstructionSet_AVX512F_VL))
if (simdSize == 64)
{
assert(compIsaSupportedDebugOnly(InstructionSet_AVX512F));
intrinsic = NI_AVX512F_Abs;
}
else if (compOpportunisticallyDependsOn(InstructionSet_AVX512F_VL))
{
intrinsic = NI_AVX512F_VL_Abs;
}
Expand All @@ -19348,6 +19353,19 @@ GenTree* Compiler::gtNewSimdAbsNode(var_types type, GenTree* op1, CorInfoType si
assert(compIsaSupportedDebugOnly(InstructionSet_AVX2));
intrinsic = NI_AVX2_Abs;
}
else if (simdSize == 64)
{
if (simdBaseType == TYP_INT)
{
assert(compIsaSupportedDebugOnly(InstructionSet_AVX512F));
intrinsic = NI_AVX512F_Abs;
}
else if (varTypeIsSmall(simdBaseType))
{
assert(compIsaSupportedDebugOnly(InstructionSet_AVX512BW));
intrinsic = NI_AVX512BW_Abs;
}
jkrishnavs marked this conversation as resolved.
Show resolved Hide resolved
}
else if (compOpportunisticallyDependsOn(InstructionSet_SSSE3))
{
intrinsic = NI_SSSE3_Abs;
Expand Down Expand Up @@ -20348,6 +20366,11 @@ GenTree* Compiler::gtNewSimdCeilNode(var_types type, GenTree* op1, CorInfoType s
assert(compIsaSupportedDebugOnly(InstructionSet_AVX));
intrinsic = NI_AVX_Ceiling;
}
else if (simdSize == 64)
{
assert(compIsaSupportedDebugOnly(InstructionSet_AVX512F));
intrinsic = NI_AVX512F_Ceiling;
}
else
{
assert(compIsaSupportedDebugOnly(InstructionSet_SSE41));
Expand Down Expand Up @@ -21914,6 +21937,11 @@ GenTree* Compiler::gtNewSimdFloorNode(var_types type, GenTree* op1, CorInfoType
{
intrinsic = NI_AVX_Floor;
}
else if (simdSize == 64)
{
assert(compIsaSupportedDebugOnly(InstructionSet_AVX512F));
intrinsic = NI_AVX512F_Floor;
}
else
{
assert(compIsaSupportedDebugOnly(InstructionSet_SSE41));
Expand Down Expand Up @@ -22288,6 +22316,19 @@ GenTree* Compiler::gtNewSimdMaxNode(
}
}
}
else if (simdSize == 64)
{
if (varTypeIsSmall(simdBaseType))
{
assert(compIsaSupportedDebugOnly(InstructionSet_AVX512BW));
intrinsic = NI_AVX512BW_Max;
}
else
{
assert(compIsaSupportedDebugOnly(InstructionSet_AVX512F));
intrinsic = NI_AVX512F_Max;
}
}
else
{
switch (simdBaseType)
Expand Down Expand Up @@ -22482,6 +22523,19 @@ GenTree* Compiler::gtNewSimdMinNode(
}
}
}
else if (simdSize == 64)
{
if (varTypeIsSmall(simdBaseType))
{
assert(compIsaSupportedDebugOnly(InstructionSet_AVX512BW));
intrinsic = NI_AVX512BW_Min;
}
else
{
assert(compIsaSupportedDebugOnly(InstructionSet_AVX512F));
intrinsic = NI_AVX512F_Min;
}
}
else
{
switch (simdBaseType)
Expand Down Expand Up @@ -23432,6 +23486,11 @@ GenTree* Compiler::gtNewSimdSqrtNode(var_types type, GenTree* op1, CorInfoType s
assert(compIsaSupportedDebugOnly(InstructionSet_AVX));
intrinsic = NI_AVX_Sqrt;
}
else if (simdSize == 64)
{
assert(compIsaSupportedDebugOnly(InstructionSet_AVX512F));
intrinsic = NI_AVX512F_Sqrt;
}
else if (simdBaseType == TYP_FLOAT)
{
intrinsic = NI_SSE_Sqrt;
Expand Down Expand Up @@ -23772,6 +23831,10 @@ GenTree* Compiler::gtNewSimdUnOpNode(
assert(compIsaSupportedDebugOnly(InstructionSet_AVX));
assert(varTypeIsFloating(simdBaseType) || compIsaSupportedDebugOnly(InstructionSet_AVX2));
}
else if (simdSize == 64)
{
assert(compIsaSupportedDebugOnly(InstructionSet_AVX512F));
}
op2 = gtNewZeroConNode(type);

// Zero - op1
Expand Down
2 changes: 2 additions & 0 deletions src/coreclr/jit/hwintrinsic.h
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,7 @@ struct HWIntrinsicInfo
case NI_SSE41_RoundToPositiveInfinity:
case NI_SSE41_RoundToPositiveInfinityScalar:
case NI_AVX_Ceiling:
case NI_AVX512F_Ceiling:
case NI_AVX_RoundToPositiveInfinity:
jkrishnavs marked this conversation as resolved.
Show resolved Hide resolved
{
return static_cast<int>(FloatRoundingMode::ToPositiveInfinity);
Expand All @@ -547,6 +548,7 @@ struct HWIntrinsicInfo
case NI_SSE41_RoundToNegativeInfinity:
case NI_SSE41_RoundToNegativeInfinityScalar:
case NI_AVX_Floor:
case NI_AVX512F_Floor:
case NI_AVX_RoundToNegativeInfinity:
jkrishnavs marked this conversation as resolved.
Show resolved Hide resolved
{
return static_cast<int>(FloatRoundingMode::ToNegativeInfinity);
Expand Down