It returns a pointer to the code, its size, and additional GC, EH and (optionally) debug info.
* `getVersionIdentifier` is the mechanism by which the JIT/EE interface is versioned.
There is a single GUID (manually generated) which the JIT and EE must agree on.
- * `getMaxIntrinsicSIMDVectorLength` communicates to the EE the largest SIMD vector length that the JIT can support.
-* `ICorJitInfo` – this is the interface that the EE implements. It has many methods defined on it that allow the JIT to
+ * `ICorJitInfo` – this is the interface that the EE implements. It has many methods defined on it that allow the JIT to
look up metadata tokens, traverse type signatures, compute field and vtable offsets, find method entry points,
construct string literals, etc. This bulk of this interface is inherited from `ICorDynamicInfo` which is defined in
[src/inc/corinfo.h](https://github.com/dotnet/runtime/blob/main/src/coreclr/inc/corinfo.h). The implementation
GUID* versionIdentifier /* OUT */
) = 0;
- // When the EE loads the System.Numerics.Vectors assembly, it asks the JIT what length (in bytes) of
- // SIMD vector it supports as an intrinsic type. Zero means that the JIT does not support SIMD
- // intrinsics, so the EE should use the default size (i.e. the size of the IL implementation).
- virtual unsigned getMaxIntrinsicSIMDVectorLength(CORJIT_FLAGS cpuCompileFlags) { return 0; }
-
// Some JIT's may support multiple OSs. This api provides a means to specify to the JIT what OS it should
// be trying to compile. This api does not produce any errors, any errors are to be generated by the
// the compileMethod call, which will call back into the VM to ensure bits are correctly setup.
//
// SAMPLE_INTERVAL must be >= SIZE. SAMPLE_INTERVAL / SIZE
// gives the average number of calls between table updates.
- //
+ //
struct HandleHistogram32
{
enum
#define GUID_DEFINED
#endif // !GUID_DEFINED
-constexpr GUID JITEEVersionIdentifier = { /* c540b287-0d17-4fc0-bac8-abd055acccb8 */
- 0xc540b287,
- 0x0d17,
- 0x4fc0,
- {0xba, 0xc8, 0xab, 0xd0, 0x55, 0xac, 0xcc, 0xb8}
+constexpr GUID JITEEVersionIdentifier = { /* dfc41bc9-f134-4c50-897e-fc9304a82059 */
+ 0xdfc41bc9,
+ 0xf134,
+ 0x4c50,
+ {0x89, 0x7e, 0xfc, 0x93, 0x04, 0xa8, 0x20, 0x59}
};
//////////////////////////////////////////////////////////////////////////////////////////////////////////
// Some architectures can experience frequency throttling when
// executing 512-bit width instructions. To account for this we set the
// default preferred vector width to 256-bits in some scenarios. Power
- // users can override this with `DOTNET_PreferredVectorBitWith=512` to
+ // users can override this with `DOTNET_PreferredVectorBitWidth=512` to
// allow using such instructions where hardware support is available.
preferredVectorByteLength = 256;
#endif
}
-/*****************************************************************************
- * Determine the maximum length of SIMD vector supported by this JIT.
- */
-
-unsigned CILJit::getMaxIntrinsicSIMDVectorLength(CORJIT_FLAGS cpuCompileFlags)
-{
- JitFlags jitFlags;
- jitFlags.SetFromFlags(cpuCompileFlags);
-
-#ifdef FEATURE_SIMD
-#if defined(TARGET_XARCH)
- if (!jitFlags.IsSet(JitFlags::JIT_FLAG_PREJIT) &&
- jitFlags.GetInstructionSetFlags().HasInstructionSet(InstructionSet_AVX2))
- {
- if (GetJitTls() != nullptr && JitTls::GetCompiler() != nullptr)
- {
- JITDUMP("getMaxIntrinsicSIMDVectorLength: returning 32\n");
- }
- return 32;
- }
-#endif // defined(TARGET_XARCH)
- if (GetJitTls() != nullptr && JitTls::GetCompiler() != nullptr)
- {
- JITDUMP("getMaxIntrinsicSIMDVectorLength: returning 16\n");
- }
- return 16;
-#else // !FEATURE_SIMD
- if (GetJitTls() != nullptr && JitTls::GetCompiler() != nullptr)
- {
- JITDUMP("getMaxIntrinsicSIMDVectorLength: returning 0\n");
- }
- return 0;
-#endif // !FEATURE_SIMD
-}
-
//------------------------------------------------------------------------
// eeGetArgSize: Returns the number of bytes required for the given type argument
// including padding after the actual value.
void getVersionIdentifier(GUID* versionIdentifier /* OUT */
);
- unsigned getMaxIntrinsicSIMDVectorLength(CORJIT_FLAGS cpuCompileFlags);
-
void setTargetOS(CORINFO_OS os);
};
ref CORINFO_METHOD_INFO info, uint flags, out IntPtr nativeEntry, out uint codeSize);
[DllImport(JitSupportLibrary)]
- private static extern uint GetMaxIntrinsicSIMDVectorLength(IntPtr jit, CORJIT_FLAGS* flags);
-
- [DllImport(JitSupportLibrary)]
private static extern IntPtr AllocException([MarshalAs(UnmanagedType.LPWStr)]string message, int messageLength);
[DllImport(JitSupportLibrary)]
{
return pJit->ProcessShutdownWork(nullptr);
}
-
-DLL_EXPORT unsigned GetMaxIntrinsicSIMDVectorLength(
- ICorJitCompiler * pJit,
- CORJIT_FLAGS * flags)
-{
- return pJit->getMaxIntrinsicSIMDVectorLength(*flags);
-}
void getVersionIdentifier(GUID* versionIdentifier /* OUT */
);
-// When the EE loads the System.Numerics.Vectors assembly, it asks the JIT what length (in bytes) of
-// SIMD vector it supports as an intrinsic type. Zero means that the JIT does not support SIMD
-// intrinsics, so the EE should use the default size (i.e. the size of the IL implementation).
-unsigned getMaxIntrinsicSIMDVectorLength(CORJIT_FLAGS cpuCompileFlags); /* { return 0; } */
-
// Some JIT's may support multiple OSs. This api provides a means to specify to the JIT what OS it should
// be trying to compile. This api does not produce any errors, any errors are to be generated by the
// the compileMethod call, which will call back into the VM to ensure bits are correctly setup.
{
original_ICorJitCompiler->getVersionIdentifier(versionIdentifier);
}
-
-unsigned interceptor_ICJC::getMaxIntrinsicSIMDVectorLength(CORJIT_FLAGS cpuCompileFlags)
-{
- return original_ICorJitCompiler->getMaxIntrinsicSIMDVectorLength(cpuCompileFlags);
-}
mcs->AddCall("getVersionIdentifier");
original_ICorJitCompiler->getVersionIdentifier(versionIdentifier);
}
-
-unsigned interceptor_ICJC::getMaxIntrinsicSIMDVectorLength(CORJIT_FLAGS cpuCompileFlags)
-{
- mcs->AddCall("getMaxIntrinsicSIMDVectorLength");
- return original_ICorJitCompiler->getMaxIntrinsicSIMDVectorLength(cpuCompileFlags);
-}
{
original_ICorJitCompiler->getVersionIdentifier(versionIdentifier);
}
-
-unsigned interceptor_ICJC::getMaxIntrinsicSIMDVectorLength(CORJIT_FLAGS cpuCompileFlags)
-{
- return original_ICorJitCompiler->getMaxIntrinsicSIMDVectorLength(cpuCompileFlags);
-}
extern "C" DWORD avx512StateSupport();
#endif
-inline bool TargetHasAVXSupport()
-{
-#if (defined(TARGET_X86) || defined(TARGET_AMD64))
- int cpuInfo[4];
- __cpuid(cpuInfo, 0x00000001); // All x86/AMD64 targets support cpuid.
- const int CPUID_ECX = 2;
- return ((cpuInfo[CPUID_ECX] & (1 << 28)) != 0); // The AVX feature is ECX bit 28.
-#endif // (defined(TARGET_X86) || defined(TARGET_AMD64))
- return false;
-}
-
#ifdef DACCESS_COMPILE
// Used by dac/strike to make sense of non-jit/non-jit-helper call targets
m_storeRichDebugInfo = false;
m_cleanupList = NULL;
+
+ SetCpuInfo();
}
#if defined(TARGET_X86) || defined(TARGET_AMD64)
// Some architectures can experience frequency throttling when executing
// executing 512-bit width instructions. To account for this we set the
// default preferred vector width to 256-bits in some scenarios. Power
- // users can override this with `DOTNET_PreferredVectorBitWith=512` to
+ // users can override this with `DOTNET_PreferredVectorBitWidth=512` to
// allow using such instructions where hardware support is available.
if (xarchCpuInfo.FamilyId == 0x06)
if (IsJitLoaded())
return TRUE;
- SetCpuInfo();
-
m_storeRichDebugInfo = CLRConfig::GetConfigValue(CLRConfig::UNSUPPORTED_RichDebugInfo) != 0;
ICorJitCompiler* newJitCompiler = NULL;
if (strcmp(className, "Vector`1") != 0 || strcmp(nameSpace, "System.Numerics") != 0)
return false;
- if (!TargetHasAVXSupport())
- return false;
+ CORJIT_FLAGS CPUCompileFlags = ExecutionManager::GetEEJitManager()->GetCPUCompileFlags();
+ uint32_t numInstanceFieldBytes = 16;
+
+ if (CPUCompileFlags.IsSet(InstructionSet_AVX2))
+ {
+ numInstanceFieldBytes = 32;
+ }
- EEJitManager *jitMgr = ExecutionManager::GetEEJitManager();
- if (jitMgr->LoadJIT())
+ if (numInstanceFieldBytes != 16)
{
- CORJIT_FLAGS cpuCompileFlags = jitMgr->GetCPUCompileFlags();
- unsigned intrinsicSIMDVectorLength = jitMgr->m_jit->getMaxIntrinsicSIMDVectorLength(cpuCompileFlags);
- if (intrinsicSIMDVectorLength != 0)
+ bmtFP->NumInstanceFieldBytes = numInstanceFieldBytes;
+
+ if (HasLayout())
{
- bmtFP->NumInstanceFieldBytes = intrinsicSIMDVectorLength;
- if (HasLayout())
- {
- GetLayoutInfo()->m_cbManagedSize = intrinsicSIMDVectorLength;
- }
- return true;
+ GetLayoutInfo()->m_cbManagedSize = numInstanceFieldBytes;
}
+
+ return true;
}
-#endif // defined(TARGET_X86) || defined(TARGET_AMD64)
+#endif // TARGET_X86 || TARGET_AMD64
+
return false;
}