Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion eng/pipelines/common/templates/runtimes/run-test-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,23 @@ jobs:
msbuildParallelism: '/maxcpucount:55'

${{ if in(parameters.testGroup, 'innerloop', 'outerloop') }}:
${{ if eq(parameters.runtimeFlavor, 'mono') }}:
${{ if and(eq(parameters.runInterpreter, 'true'),eq(variables['Build.Reason'], 'PullRequest')) }}:
scenarios:
- interpmode3_no_tiered_compilation
- interpmode2_no_tiered_compilation
- interpmode1_no_tiered_compilation
- no_tiered_compilation
${{ elseif eq(parameters.runInterpreter, 'true') }}:
scenarios:
- interpmode3_no_tiered_compilation
- interpmode3
- interpmode2_no_tiered_compilation
- interpmode2
- normal
- no_tiered_compilation
- interpmode1_no_tiered_compilation
- interpmode1
${{ elseif eq(parameters.runtimeFlavor, 'mono') }}:
# tiered compilation isn't done on mono yet
scenarios:
- normal
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/interpreter/eeinterp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,12 @@ CorJitResult CILInterp::compileMethod(ICorJitInfo* compHnd,
break;
}

// 2: use interpreter for everything except intrinsics. All intrinsics fallback to JIT. Implies DOTNET_ReadyToRun=0.
// 2: use interpreter for everything except intrinsics. All intrinsics fallback to JIT. Implies DOTNET_ReadyToRun=0
case 2:
doInterpret = !(compHnd->getMethodAttribs(methodInfo->ftn) & CORINFO_FLG_INTRINSIC);
break;

// 3: use interpreter for everything, the full interpreter-only mode, no fallbacks to R2R or JIT whatsoever. Implies DOTNET_ReadyToRun=0, DOTNET_EnableHWIntrinsic=0
// 3: use interpreter for everything, the full interpreter-only mode, no fallbacks to R2R or JIT whatsoever. Implies DOTNET_ReadyToRun=0, DOTNET_EnableHWIntrinsic=0, DOTNET_MaxVectorTBitWidth=128, DOTNET_PreferredVectorBitWidth=128
case 3:
doInterpret = true;
break;
Expand Down
22 changes: 19 additions & 3 deletions src/coreclr/vm/codeman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1196,6 +1196,14 @@ void EEJitManager::SetCpuInfo()
// Get the maximum bitwidth of Vector<T>, rounding down to the nearest multiple of 128-bits
uint32_t maxVectorTBitWidth = (CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_MaxVectorTBitWidth) / 128) * 128;

#if defined(FEATURE_INTERPRETER)
if (maxVectorTBitWidth != 128 && CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_InterpMode) == 3)
{
// Disable larger Vector<T> sizes when interpreter is enabled
maxVectorTBitWidth = 128;
}
#endif

#if defined(TARGET_X86) || defined(TARGET_AMD64)
CPUCompileFlags.Set(InstructionSet_VectorT128);

Expand All @@ -1213,7 +1221,7 @@ void EEJitManager::SetCpuInfo()

// x86-64-v2

if (CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_EnableHWIntrinsic))
if (g_pConfig->EnableHWIntrinsic())
{
CPUCompileFlags.Set(InstructionSet_X86Base);
}
Expand Down Expand Up @@ -1324,7 +1332,7 @@ void EEJitManager::SetCpuInfo()
#elif defined(TARGET_ARM64)
CPUCompileFlags.Set(InstructionSet_VectorT128);

if (CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_EnableHWIntrinsic))
if (g_pConfig->EnableHWIntrinsic())
{
CPUCompileFlags.Set(InstructionSet_ArmBase);
CPUCompileFlags.Set(InstructionSet_AdvSimd);
Expand Down Expand Up @@ -1408,7 +1416,7 @@ void EEJitManager::SetCpuInfo()
g_arm64_atomics_present = true;
}
#elif defined(TARGET_RISCV64)
if (CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_EnableHWIntrinsic))
if (g_pConfig->EnableHWIntrinsic())
{
CPUCompileFlags.Set(InstructionSet_RiscV64Base);
}
Expand Down Expand Up @@ -1509,6 +1517,14 @@ void EEJitManager::SetCpuInfo()

uint32_t preferredVectorBitWidth = (CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_PreferredVectorBitWidth) / 128) * 128;

#ifdef FEATURE_INTERPRETER
if (CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_InterpMode) == 3)
{
// Disable larger Vector<T> sizes when interpreter is enabled, and not compiling S.P.Corelib
preferredVectorBitWidth = 128;
}
#endif

if ((preferredVectorBitWidth == 0) && throttleVector512)
{
preferredVectorBitWidth = 256;
Expand Down
37 changes: 37 additions & 0 deletions src/coreclr/vm/eeconfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -454,8 +454,45 @@ HRESULT EEConfig::sync()

pReadyToRunExcludeList = NULL;

#ifdef FEATURE_INTERPRETER
#ifdef FEATURE_JIT
LPWSTR interpreterConfig;
IfFailThrow(CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_Interpreter, &interpreterConfig));
if (interpreterConfig == NULL)
{
if ((CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_InterpMode) != 0))
{
enableInterpreter = true;
}
}
else
{
enableInterpreter = true;
}
#else
enableInterpreter = true;
#endif // FEATURE_JIT
#endif // FEATURE_INTERPRETER

enableHWIntrinsic = (CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_EnableHWIntrinsic) != 0);
#ifdef FEATURE_INTERPRETER
if (CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_InterpMode) == 3)
{
// InterpMode 3 disables all hw intrinsics
enableHWIntrinsic = false;
}
#endif // FEATURE_INTERPRETER

#if defined(FEATURE_READYTORUN)
fReadyToRun = CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_ReadyToRun);
#if defined(FEATURE_INTERPRETER)
if (fReadyToRun && CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_InterpMode) >= 2)
{
// ReadyToRun and Interpreter modes 2 and 3 are mutually exclusive.
// If both are set, Interpreter wins.
fReadyToRun = false;
}
#endif // defined(FEATURE_INTERPRETER)

if (fReadyToRun)
{
Expand Down
11 changes: 11 additions & 0 deletions src/coreclr/vm/eeconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,11 @@ class EEConfig

bool RuntimeAsync() const { LIMITED_METHOD_CONTRACT; return runtimeAsync; }

#ifdef FEATURE_INTERPRETER
bool EnableInterpreter() const { LIMITED_METHOD_CONTRACT; return enableInterpreter; }
#endif
bool EnableHWIntrinsic() const { LIMITED_METHOD_CONTRACT; return enableHWIntrinsic; }

private: //----------------------------------------------------------------

bool fInited; // have we synced to the registry at least once?
Expand Down Expand Up @@ -612,6 +617,12 @@ class EEConfig
bool fReadyToRun;
#endif

bool enableHWIntrinsic;

#ifdef FEATURE_INTERPRETER
bool enableInterpreter;
#endif

#if defined(FEATURE_ON_STACK_REPLACEMENT)
DWORD dwOSR_HitLimit;
DWORD dwOSR_CounterBump;
Expand Down
5 changes: 5 additions & 0 deletions src/coreclr/vm/jithost.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ int JitHost::getIntConfigValue(const char* name, int defaultValue)
{
WRAPPER_NO_CONTRACT;

if (!strcmp(name, "EnableHWIntrinsic"))
{
return g_pConfig->EnableHWIntrinsic() ? 1 : 0;
}

StackSString str;
SString(SString::Utf8Literal, name).ConvertToUnicode(str);

Expand Down
8 changes: 1 addition & 7 deletions src/coreclr/vm/jitinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13423,15 +13423,9 @@ PCODE UnsafeJitFunction(PrepareCodeConfig* config,

#ifdef FEATURE_INTERPRETER
InterpreterJitManager* interpreterMgr = ExecutionManager::GetInterpreterJitManager();
if (!interpreterMgr->IsInterpreterLoaded())
if (!interpreterMgr->IsInterpreterLoaded() && g_pConfig->EnableInterpreter())
{
LPWSTR interpreterConfig;
IfFailThrow(CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_Interpreter, &interpreterConfig));
if (
#ifdef FEATURE_JIT
// If both JIT and interpret are available, load the interpreter for testing purposes only if the config switch is set
(interpreterConfig != NULL) &&
#endif
!interpreterMgr->LoadInterpreter())
{
EEPOLICY_HANDLE_FATAL_ERROR_WITH_MESSAGE(COR_E_EXECUTIONENGINE, W("Failed to load interpreter"));
Expand Down
10 changes: 8 additions & 2 deletions src/tests/Common/CLRTest.Execute.Bash.targets
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@ fi
<BashCLRTestEnvironmentCompatibilityCheck Condition="'$(InterpreterIncompatible)' == 'true'"><![CDATA[
$(BashCLRTestEnvironmentCompatibilityCheck)
if [ ! -z "$RunInterpreter" ]
then
echo SKIPPING EXECUTION BECAUSE the test is incompatible with the interpreter
exit $(IncompatibleTestBashScriptExitCode)
fi
if [ ! -z "$DOTNET_InterpMode" ]
then
echo SKIPPING EXECUTION BECAUSE the test is incompatible with the interpreter
exit $(IncompatibleTestBashScriptExitCode)
Expand Down Expand Up @@ -407,8 +412,9 @@ if [ ! -z ${RunCrossGen2+x} ]%3B then
fi

if [ ! -z "$RunInterpreter" ]; then
# $(InputAssemblyName)
export DOTNET_Interpreter='$(AssemblyName)!*'
if [ -z "$DOTNET_InterpMode" ]; then
export DOTNET_Interpreter='$(AssemblyName)!*'
fi
fi

echo $LAUNCHER $ExePath %24(printf "'%s' " "${CLRTestExecutionArguments[@]}")
Expand Down
9 changes: 8 additions & 1 deletion src/tests/Common/CLRTest.Execute.Batch.targets
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ IF NOT "%RunInterpreter%"=="" (
ECHO SKIPPING EXECUTION BECAUSE the test is incompatible with the interpreter
popd
Exit /b 0
)
IF NOT "%DOTNET_InterpMode%"=="" (
ECHO SKIPPING EXECUTION BECAUSE the test is incompatible with the interpreter
popd
Exit /b 0
)
]]></BatchCLRTestEnvironmentCompatibilityCheck>
<BatchCLRTestEnvironmentCompatibilityCheck Condition="'$(TieringTestIncompatible)' == 'true'"><![CDATA[
Expand Down Expand Up @@ -345,7 +350,9 @@ if defined RunCrossGen2 (
)

if defined RunInterpreter (
SET "DOTNET_Interpreter=$(AssemblyName)^!*"
if "%DOTNET_InterpMode%"=="" (
SET "DOTNET_Interpreter=$(AssemblyName)^!*"
)
)

ECHO %LAUNCHER% %ExePath% %CLRTestExecutionArguments%
Expand Down
7 changes: 7 additions & 0 deletions src/tests/Common/testenvironment.proj
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
-->
<PropertyGroup>
<DOTNETVariables>
DOTNET_InterpMode;
DOTNET_TieredCompilation;
DOTNET_DbgEnableMiniDump;
DOTNET_EnableCrashReport;
Expand Down Expand Up @@ -95,6 +96,12 @@
while other scenarios use the default values of DOTNET_* variables defined in ItemDefinitionGroup above -->
<TestEnvironment Include="normal" TieredCompilation="" />
<TestEnvironment Include="jitminopts" JITMinOpts="1" />
<TestEnvironment Include="interpmode1" TieredCompilation="" InterpMode="1" />
<TestEnvironment Include="interpmode2" TieredCompilation="" InterpMode="2" />
<TestEnvironment Include="interpmode3" TieredCompilation="" InterpMode="3" />
<TestEnvironment Include="interpmode1_no_tiered_compilation" InterpMode="1" TieredCompilation="0"/>
<TestEnvironment Include="interpmode2_no_tiered_compilation" InterpMode="2" TieredCompilation="0"/>
<TestEnvironment Include="interpmode3_no_tiered_compilation" InterpMode="3" TieredCompilation="0"/>
<TestEnvironment Include="no_tiered_compilation" TieredCompilation="0" />
<TestEnvironment Include="forcerelocs" ForceRelocs="1" />
<TestEnvironment Include="jitstress1" JitStress="1" />
Expand Down
Loading