From 952a3a66c0f150bd5b2684d704d3bc76aec98c5f Mon Sep 17 00:00:00 2001 From: Kunal Pathak Date: Fri, 28 Jun 2024 12:25:05 -0700 Subject: [PATCH 1/4] Enable InstructionSet_Sve only if system VL == 128 --- src/coreclr/vm/codeman.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/coreclr/vm/codeman.cpp b/src/coreclr/vm/codeman.cpp index 1010f21d59aaa..2ec2b865a545c 100644 --- a/src/coreclr/vm/codeman.cpp +++ b/src/coreclr/vm/codeman.cpp @@ -1514,8 +1514,8 @@ void EEJitManager::SetCpuInfo() uint32_t maxVectorTLength = (maxVectorTBitWidth / 8); uint64_t sveLengthFromOS = GetSveLengthFromOS(); - // Do not enable SVE when the user specified vector length is smaller than the one offered by underlying OS. - if ((maxVectorTLength >= sveLengthFromOS) || (maxVectorTBitWidth == 0)) + // Do not enable SVE when the system vector length is not 128-bits + if (sveLengthFromOS == 128) { CPUCompileFlags.Set(InstructionSet_Sve); } From 611754689ce1bbf6268bb91b56aec011f6b59685 Mon Sep 17 00:00:00 2001 From: Kunal Pathak Date: Fri, 28 Jun 2024 12:47:40 -0700 Subject: [PATCH 2/4] Update src/coreclr/vm/codeman.cpp Co-authored-by: Jan Kotas --- src/coreclr/vm/codeman.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/coreclr/vm/codeman.cpp b/src/coreclr/vm/codeman.cpp index 2ec2b865a545c..5f37d7dfee67a 100644 --- a/src/coreclr/vm/codeman.cpp +++ b/src/coreclr/vm/codeman.cpp @@ -1514,8 +1514,10 @@ void EEJitManager::SetCpuInfo() uint32_t maxVectorTLength = (maxVectorTBitWidth / 8); uint64_t sveLengthFromOS = GetSveLengthFromOS(); - // Do not enable SVE when the system vector length is not 128-bits + // For now, enable only SVE when the system vector length is 128-bits + // TODO: https://github.com/dotnet/runtime/issues/101477 if (sveLengthFromOS == 128) + // if ((maxVectorTLength >= sveLengthFromOS) || (maxVectorTBitWidth == 0)) { CPUCompileFlags.Set(InstructionSet_Sve); } From 3d8b63abb05835f033e42e370b4e4becbe547373 Mon Sep 17 00:00:00 2001 From: Jan Kotas Date: Fri, 28 Jun 2024 12:48:10 -0700 Subject: [PATCH 3/4] Update src/coreclr/vm/codeman.cpp --- src/coreclr/vm/codeman.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/coreclr/vm/codeman.cpp b/src/coreclr/vm/codeman.cpp index 5f37d7dfee67a..d93e43ea48e0e 100644 --- a/src/coreclr/vm/codeman.cpp +++ b/src/coreclr/vm/codeman.cpp @@ -1514,7 +1514,7 @@ void EEJitManager::SetCpuInfo() uint32_t maxVectorTLength = (maxVectorTBitWidth / 8); uint64_t sveLengthFromOS = GetSveLengthFromOS(); - // For now, enable only SVE when the system vector length is 128-bits + // For now, enable SVE only when the system vector length is 128-bits // TODO: https://github.com/dotnet/runtime/issues/101477 if (sveLengthFromOS == 128) // if ((maxVectorTLength >= sveLengthFromOS) || (maxVectorTBitWidth == 0)) From 7cf376c5fee6e07d2c6adb1f722520d05f68401b Mon Sep 17 00:00:00 2001 From: Kunal Pathak Date: Fri, 28 Jun 2024 12:58:39 -0700 Subject: [PATCH 4/4] Remove hardcoding of 128 for windows --- src/coreclr/vm/arm64/asmhelpers.asm | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/coreclr/vm/arm64/asmhelpers.asm b/src/coreclr/vm/arm64/asmhelpers.asm index d5a49cd200eaa..b602b2cf9fc94 100644 --- a/src/coreclr/vm/arm64/asmhelpers.asm +++ b/src/coreclr/vm/arm64/asmhelpers.asm @@ -80,9 +80,7 @@ ;; uint64_t GetSveLengthFromOS(void); LEAF_ENTRY GetSveLengthFromOS - ;; TODO-SVE: Remove the hardcoded value 128 and uncomment once CI machines are updated to use MASM 14.4 or later - ;; rdvl x0, 1 - mov x0, #128 + rdvl x0, 1 ret lr LEAF_END