-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Accelerate Half with FP16 ISA
#122649
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
base: main
Are you sure you want to change the base?
Accelerate Half with FP16 ISA
#122649
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -4725,6 +4725,11 @@ class Compiler | |||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| NamedIntrinsic lookupPrimitiveFloatNamedIntrinsic(CORINFO_METHOD_HANDLE method, const char* methodName); | ||||||||||||||||||||||||||||||||||||
| NamedIntrinsic lookupPrimitiveIntNamedIntrinsic(CORINFO_METHOD_HANDLE method, const char* methodName); | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| NamedIntrinsic lookupHalfIntrinsic(NamedIntrinsic ni); | ||||||||||||||||||||||||||||||||||||
| NamedIntrinsic lookupHalfConversionIntrinsic(var_types fromType, var_types toType); | ||||||||||||||||||||||||||||||||||||
| int lookupHalfRoundingMode(NamedIntrinsic ni); | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| GenTree* impUnsupportedNamedIntrinsic(unsigned helper, | ||||||||||||||||||||||||||||||||||||
| CORINFO_METHOD_HANDLE method, | ||||||||||||||||||||||||||||||||||||
| CORINFO_SIG_INFO* sig, | ||||||||||||||||||||||||||||||||||||
|
|
@@ -5925,6 +5930,7 @@ class Compiler | |||||||||||||||||||||||||||||||||||
| // Returns true if the provided type should be treated as a primitive type | ||||||||||||||||||||||||||||||||||||
| // for the unmanaged calling conventions. | ||||||||||||||||||||||||||||||||||||
| bool isNativePrimitiveStructType(CORINFO_CLASS_HANDLE clsHnd); | ||||||||||||||||||||||||||||||||||||
| bool isNativeHalfStructType(CORINFO_CLASS_HANDLE clsHnd); | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| enum structPassingKind | ||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||
|
|
@@ -9971,8 +9977,11 @@ class Compiler | |||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| // Use to determine if a struct *might* be a SIMD type. As this function only takes a size, many | ||||||||||||||||||||||||||||||||||||
| // structs will fit the criteria. | ||||||||||||||||||||||||||||||||||||
| bool structSizeMightRepresentSIMDType(size_t structSize) | ||||||||||||||||||||||||||||||||||||
| bool structSizeMightRepresentAcceleratedType(size_t structSize) | ||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||
| if (structSize == 2) | ||||||||||||||||||||||||||||||||||||
| return true; | ||||||||||||||||||||||||||||||||||||
kg marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| #ifdef FEATURE_SIMD | ||||||||||||||||||||||||||||||||||||
| return (structSize >= getMinVectorByteLength()) && (structSize <= getMaxVectorByteLength()); | ||||||||||||||||||||||||||||||||||||
|
Comment on lines
+9982
to
9986
|
||||||||||||||||||||||||||||||||||||
| if (structSize == 2) | |
| return true; | |
| #ifdef FEATURE_SIMD | |
| return (structSize >= getMinVectorByteLength()) && (structSize <= getMaxVectorByteLength()); | |
| #if defined(TARGET_XARCH) && defined(FEATURE_SIMD) | |
| // On xarch with AVX10v1 support, 2-byte structs may represent accelerated Half types. | |
| // Restrict the 2-byte fast-path to this configuration to avoid sending arbitrary 2-byte | |
| // user structs down accelerated-type code paths on other targets. | |
| if ((structSize == 2) && compSupports(InstructionSet_AVX10v1)) | |
| { | |
| return true; | |
| } | |
| return (structSize >= getMinVectorByteLength()) && (structSize <= getMaxVectorByteLength()); | |
| #elif defined(FEATURE_SIMD) | |
| return (structSize >= getMinVectorByteLength()) && (structSize <= getMaxVectorByteLength()); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
|
|
||
| /***************************************************************************** | ||
| Both simd.cpp, gentree.cpp, and utils.cpp need a definition of float16_t | ||
| but do not share a common header. | ||
|
|
||
| Defining here so as to not create accidental implicit include dependencies. | ||
| This definition can be removed once .NET moves to C++23 support. | ||
| ******************************************************************************/ | ||
|
|
||
| #ifndef _FLOAT16_H_ | ||
| #define _FLOAT16_H_ | ||
|
|
||
| #include <cstdint> | ||
|
|
||
| typedef uint16_t float16_t; | ||
|
|
||
| #endif // _FLOAT16_H_ |
Uh oh!
There was an error while loading. Please reload this page.