|
4 | 4 | // |
5 | 5 | // codeman.cpp - a managment class for handling multiple code managers |
6 | 6 | // |
7 | | -#if defined(TARGET_LINUX) |
8 | | -#include <sys/prctl.h> |
9 | | -#include <sys/syscall.h> |
10 | | -#endif // defined(TARGET_LINUX) |
| 7 | + |
11 | 8 | #include "common.h" |
12 | 9 | #include "jitinterface.h" |
13 | 10 | #include "corjit.h" |
|
45 | 42 | #include "perfmap.h" |
46 | 43 | #endif |
47 | 44 |
|
48 | | -#if defined(TARGET_LINUX) && !defined(PR_SVE_GET_VL) |
49 | | -#define PR_SVE_SET_VL 50 /* set task vector length */ |
50 | | -#define PR_SVE_GET_VL 51 /* get task vector length */ |
51 | | -#define PR_SVE_VL_LEN_MASK 0xffff |
52 | | -#define PR_SVE_VL_INHERIT (1 << 17) /* inherit across exec */ |
53 | | -#endif // defined(TARGET_LINUX) && !defined(PR_SVE_GET_VL) |
54 | | - |
55 | 45 | // Default number of jump stubs in a jump stub block |
56 | 46 | #define DEFAULT_JUMPSTUBS_PER_BLOCK 32 |
57 | 47 |
|
@@ -1535,23 +1525,16 @@ void EEJitManager::SetCpuInfo() |
1535 | 1525 |
|
1536 | 1526 | if (((cpuFeatures & ARM64IntrinsicConstants_Sve) != 0) && CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_EnableArm64Sve)) |
1537 | 1527 | { |
1538 | | -#if defined(TARGET_LINUX) |
1539 | | - // prctl() expects vector length in bytes. |
1540 | 1528 | int maxVectorLength = (maxVectorTBitWidth >> 3); |
| 1529 | + uint64_t systemVectorTLength = GetSystemVectorLength(); |
1541 | 1530 |
|
1542 | | - // Limit the SVE vector length to 'maxVectorLength' if the underlying hardware offers longer vectors. |
1543 | | - if ((prctl(PR_SVE_GET_VL, 0,0,0,0) & PR_SVE_VL_LEN_MASK) > maxVectorLength) |
| 1531 | + if (maxVectorLength >= systemVectorTLength) |
1544 | 1532 | { |
1545 | | - if (prctl(PR_SVE_SET_VL, (maxVectorLength | PR_SVE_VL_INHERIT), 0, 0, 0) == -1) |
1546 | | - { |
1547 | | - LogErrorToHost("LoadAndInitializeJIT: prctl() FAILED - unable to set maxVectorLength to %d", maxVectorLength); |
1548 | | - } |
| 1533 | + // Enable SVE only when user specified vector length larger than or equal to the system |
| 1534 | + // vector length. When eabled, SVE would use full vector length available to the process. |
| 1535 | + // For a 256-bit machine, if user provides DOTNET_MaxVectorTBitWidth=128, disable SVE. |
| 1536 | + CPUCompileFlags.Set(InstructionSet_Sve); |
1549 | 1537 | } |
1550 | | -#elif defined(TARGET_WINDOWS) |
1551 | | - // TODO-SVE: Add prctl() equivalent for windows. |
1552 | | -#endif |
1553 | | - |
1554 | | - CPUCompileFlags.Set(InstructionSet_Sve); |
1555 | 1538 | } |
1556 | 1539 |
|
1557 | 1540 | // DCZID_EL0<4> (DZP) indicates whether use of DC ZVA instructions is permitted (0) or prohibited (1). |
|
0 commit comments