platform/upstream/dotnet/runtime.git
12 months ago[RISC-V] Flush-to-zero behavior for float-to-int conversion (#94762)
Denis Paranichev [Thu, 7 Dec 2023 11:15:59 +0000 (14:15 +0300)]
[RISC-V] Flush-to-zero behavior for float-to-int conversion (#94762)

* Implemented several RISC-V csr instructions and enabled flush-to-zero behavior for float-to-int conversion instruction

* Apply comments

* Replace branch solution with feq

* Fixed typo

* Fixed typo

* Fixed csr instructions emitter

* Apply comments

* Apply jit-format

* Apply comments

* Temp register fix

* Fixed dstSize

* Wrong temporary register selection fix

* Fixed typo

12 months ago[RISC-V] LoongArch code sync (#95673)
Tomasz Sowiński [Thu, 7 Dec 2023 10:33:55 +0000 (11:33 +0100)]
[RISC-V] LoongArch code sync (#95673)

* [RISC-V] Use largeframe condition like on LoongArch

* [RISC-V] Use REG_DEFAULT_HELPER_CALL_TARGET instead of REG_T2

* [RISC-V] #ifdef DEBUG entire if (needCheckOv) section since assert are only active in debug mode

* [RISC-V] Encode stack pointer as 1 in gcinfo

Change similar to #85092. Sp(x2) was encoded as 2^8=10, which is 4 bits long and the encoding won't fit in a single chunk of STACK_BASE_REGISTER_ENCBASE=2 bits.

* [RISC-V] Sign-extend index in genRangeCheck

Analogous fix to #86435 on Loongarch, fixes System.Linq.Expressions.Tests.RuntimeVariablesTests.MixedScope failing with IndexOutOfRangeException.

* [RISC-V] Rename variables in genRangeCheck to something more meaningful

12 months ago[RISC-V] Implement NativeWalker. (#94853)
Mikhail Kurinnoi [Mon, 4 Dec 2023 19:48:37 +0000 (22:48 +0300)]
[RISC-V] Implement NativeWalker. (#94853)

* [RISC-V] Implement NativeWalker.

* [RISC-V] Add asserts for X0 value.

12 months ago[RISC-V] Replace rsGetRsvdReg with ordinary temp registers (#95317)
Tomasz Sowiński [Mon, 4 Dec 2023 10:31:47 +0000 (11:31 +0100)]
[RISC-V] Replace rsGetRsvdReg with ordinary temp registers (#95317)

* [RISC-V] Replace rsGetRsvdReg calls in emitInsTernary with ordinary temps

* [RISC-V] Give emitInsTernary a haircut

* [RISC-V] Add missing newline when printf is exceeds MAX_LEN

* [RISC-V] Replace rsGetRsvdReg with a normal constant in genLcLHeap. Plus a small optimization, fuse addi+and into andi to avoid using a temp reg.

* [RISC-V] Replace rsGetRsvdReg with ordinary temp regs in GT_(MOD|DIV|MULHI)

* [RISC-V] Replace rsGetRsvdReg with ordinary temp reg in switch tables

* [RISC-V] Replace rsGetRsvdReg with ordinary temps in genCodeForCompare

* [RISC-V] Replace rsGetRsvdReg with ordinary temps in genCodeForShift

* [RISC-V] Replace rsGetRsvdReg with ordinary temp reg in genCodeForIndexAddr and genLeaInstruction

* [RISC-V] Replace rsGetRsvdReg with ordinary temp reg in genIntCastOverflowCheck

* [RISC-V] Code review: remove an always true if and don't enter divisor checking when we know we need a temp

* [RISC-V] Small refactorings after review

12 months ago[RISC-V] Add X0 field init at capture context. (#95470)
Mikhail Kurinnoi [Fri, 1 Dec 2023 17:38:51 +0000 (20:38 +0300)]
[RISC-V] Add X0 field init at capture context. (#95470)

12 months ago[RISC-V] Add support for fcvt.w instructions to CodeGen::genIntToFloatCast (#95327)
Tymoteusz Wenerski [Wed, 29 Nov 2023 09:13:35 +0000 (10:13 +0100)]
[RISC-V] Add support for fcvt.w instructions to CodeGen::genIntToFloatCast (#95327)

12 months ago[RISC-V] Implement some of the NYI methods in unwindriscv64 (#95128)
Tymoteusz Wenerski [Tue, 28 Nov 2023 11:53:19 +0000 (12:53 +0100)]
[RISC-V] Implement some of the NYI methods in unwindriscv64 (#95128)

* [RISC-V] Implement Compiler::mapRegNumToDwarfReg

* [RISC-V] Add BAD_CODE definition

* [RISC-V] Implement GetUnwindSizeFromUnwindHeader

* [RISC-V] Implement UnwindPrologCodes::Dump

* [RISC-V] Implement UnwindEpilogCodes::Dump

* [RISC-V] Implement UnwindEpilogInfo::Dump

* [Risc-V] Implement UnwindFragmentInfo::Dump

* [RISC-V] Implement UnwindInfo::HotColdSplitCodes

* [RISC-V] Implement UnwindInfo::Dump

* [RISC-V] Partly fix for previous implementation of GetUnwindSizeFromUnwindHeader

* [RISC-V] Mark s_UnwindSize as const

Co-authored-by: Tomasz Sowiński <tomeksowi@gmail.com>
* [RISC-V] Replace NULL with nullptr in new functions

* [RISC-V] Fix formatting and shorten mapRegNumToDwarfReg

* [RISC-V] Apply format.linux.x64.patch

* [RISC-V] Add braces according to coding standard in jit

* [RISC-V] Correct array of unwind sizes

* [RISC-V] Fix s_UnwindSize: 0xDE=2, 0xDD=3

---------

Co-authored-by: Tomasz Sowiński <tomeksowi@gmail.com>
12 months ago[RISC-V] Add DynamicHelpers to riscv64 stubs (#94735)
Aleksandr Shaurtaev [Wed, 22 Nov 2023 13:24:21 +0000 (16:24 +0300)]
[RISC-V] Add DynamicHelpers to riscv64 stubs (#94735)

* Add DynamicHelpers to riscv64 stubs

* Code review feedback

* Apply suggestions from code review

---------

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
12 months ago[RISC-V] Clean up NYI_RISCV64 in CodeGen and Emitter (#94666)
yurai007 [Tue, 21 Nov 2023 15:09:34 +0000 (16:09 +0100)]
[RISC-V] Clean up NYI_RISCV64 in CodeGen and Emitter (#94666)

* [RISC-V] Remove redundant GT_NEG/GT_NOT switch cases

In 6ca0784d82e4 commit, function genCodeForNegNot diverged from her LoongArch friend
and didn't call genGetInsForOper since then. Therefore we can remove
GT_NEG/GT_NOT integer cases and GT_NEG float case as there are all dead.

* [RISC-V] Remove redundant genCodeForLoadOffset definition

Given that such function doesn't make sense outside x86/x64 mov instruction context
we can get rid of definition.

* [RISC-V] Remove redundant emitInsToJumpKind definition

It looks like emitInsToJumpKind is helper function coming from ARM large jump handling logic.
Currently RISC-V emitter doesn't rely on instruction format
and probably won't need anything like ARM large jump handling.

* [RISC-V] Replace NYI_RISCV64 with NO_WAY in switch statements

For the cases when unreachability is easy to prove we can
express that fact by using proper NO_WAY macro.

* [RISC-V] Clean up emitInsTernary function from NYI_RISCV64

When control flow reach needCheckOv in intConst block,
only addi/addiw instructions can be handled there and first NYI_RISCV64 is redundant.
Remaining condition statements starting with GT_MUL case can be replaced
with more straightforward switch statement and then second NYI_RISCV64 is redundant.

* [RISC-V] Update some NYI_RISCV64 with comments

* [RISC-V] Implement remaining NYI_RISCV64 in genJumpToThrowHlpBlk_la

When no helper for codeKind is available we need to emit
appropriate code directly.

12 months ago[RISC-V] Implement eval (ICorDebugEval related). (#95020)
Mikhail Kurinnoi [Tue, 21 Nov 2023 02:30:21 +0000 (05:30 +0300)]
[RISC-V] Implement eval (ICorDebugEval related). (#95020)

12 months ago[RISC-V] Implement emulate single step feature. (#94711)
Mikhail Kurinnoi [Wed, 15 Nov 2023 01:52:53 +0000 (04:52 +0300)]
[RISC-V] Implement emulate single step feature. (#94711)

* [RISC-V] Implement emulate single step feature.

* [RISC-V] Fix clang16 build error.

Error message  /home/clamp/runtime/src/coreclr/debug/inc/riscv64/primitives.h:52:5: error: integer value -1 is outside the valid range of values [0, 255] for this enumeration type [-Wenum-constexpr-conversion]
              (CorDebugRegister)(-1), // X0 is zero register that is not a real register. We need padding here for proper mapping with ICorDebugInfo::RegNum.
              ^

* [RISC-V] Fix sign bit.

12 months ago[RISC-V] Add more gcdump and gcinfo code. (#94219)
Mikhail Kurinnoi [Fri, 10 Nov 2023 04:14:27 +0000 (07:14 +0300)]
[RISC-V] Add more gcdump and gcinfo code. (#94219)

* [RISC-V] Add more gcdump and gcinfo code.

* Add more comments.

12 months ago[RISC-V] Initial patch to fix RISCV64 interpreter (#94548)
JongHeonChoi [Fri, 10 Nov 2023 04:12:12 +0000 (13:12 +0900)]
[RISC-V] Initial patch to fix RISCV64 interpreter (#94548)

* [RISC-V] Initial patch to fix RISCV64 interpreter

* Code review feedback

12 months ago[RISC-V] Implement SOS related Debugger API code. (#94454)
Mikhail Kurinnoi [Thu, 9 Nov 2023 17:20:58 +0000 (20:20 +0300)]
[RISC-V] Implement SOS related Debugger API code. (#94454)

* [RISC-V] Implement SOS related Debugger API code.

* [RISC-V] Fix R0 copy.

* [RISC-V] Remove R0 from DebuggerREGDISPLAY.

12 months ago[RISC-V] Add branch label offset to disasm (#94512)
Tomasz Sowiński [Thu, 9 Nov 2023 10:03:14 +0000 (11:03 +0100)]
[RISC-V] Add branch label offset to disasm (#94512)

* [RISC-V] Add branch label offset to disasm

Label offset is easier to look for than raw instruction offset.

* Remove redundant #ifdef and fold printfs.

* [RISC-V] Fold offset printing

12 months agoFix interpreter for x64 (#94501)
JongHeonChoi [Wed, 8 Nov 2023 11:15:37 +0000 (20:15 +0900)]
Fix interpreter for x64 (#94501)

12 months ago[RISC-V]Delete unused code in LowerConstIntDivOrMod (#94328)
monstercat [Mon, 6 Nov 2023 17:57:59 +0000 (01:57 +0800)]
[RISC-V]Delete unused code in LowerConstIntDivOrMod (#94328)

Co-authored-by: magus <mangypotatoes1@gmail.com>
12 months ago[RISC-V] Clear build warnings in Mono (#94344)
Tomasz Sowiński [Fri, 3 Nov 2023 15:59:21 +0000 (16:59 +0100)]
[RISC-V] Clear build warnings in Mono (#94344)

12 months ago[RISC-V] Fix Microsoft.VisualBasic.Tests.ConversionTests (#94042)
yurai007 [Wed, 1 Nov 2023 07:48:30 +0000 (08:48 +0100)]
[RISC-V] Fix Microsoft.VisualBasic.Tests.ConversionTests (#94042)

* [RISC-V] Implement float/double registers initialization in genZeroInitFltRegs

This change fixes assertion triggered by Microsoft.VisualBasic.Tests.ConversionTests.Val_InvalidCastException test case:

Assert failure(PID 87929 [0x00015779], Thread: 87929 [0x15779]): Assertion failed 'NYI_RISCV64: genZeroInitFltRegs is not implemented.'
in 'Microsoft.VisualBasic.Conversion:Val(System.String):double' during 'Generate code' (IL size 821; hash 0x7f66efb6; Tier0-FullOpts)

    File: /runtime/src/coreclr/jit/codegencommon.cpp Line: 4626
    Image: /runtime/artifacts/tests/corefx/coreroot/corerun

* [RISC-V] Clean up and improve debugging experience in emitJumpDistBind

It's non-functional change.

* [RISC-V] Perform INS_OPTS_J_cond jump transformation when jmpDist exceed the maximum short distance

This change fixes assertion triggered by Microsoft.VisualBasic.Tests.ConversionTests.Val_InvalidCastException test case
and HugeField2 test on top of previous commits:

Assert failure(PID 71778 [0x00011862], Thread: 72086 [0x11996]): Assertion failed 'isValidSimm13(imm)'
in 'System.Number:NumberToStringFormat[ushort](byref,byref,System.ReadOnlySpan`1[ushort],System.Globalization.NumberFormatInfo)'
during 'Emit code' (IL size 2152; hash 0x48702a2a; Tier0-FullOpts)

    File: /runtime/src/coreclr/jit/emitriscv64.cpp Line: 2677
    Image: /runtime/artifacts/tests/corefx/coreroot/corerun

12 months ago[RISC-V] Disable FastTailCall in case of split arg (#93655)
t-mustafin [Fri, 27 Oct 2023 21:54:08 +0000 (00:54 +0300)]
[RISC-V] Disable FastTailCall in case of split arg (#93655)

12 months agoFix double delims at the end of dirnames in tpa string when using corerun (#93962)
Tymoteusz Wenerski [Thu, 26 Oct 2023 19:13:59 +0000 (21:13 +0200)]
Fix double delims at the end of dirnames in tpa string when using corerun (#93962)

12 months agoTest NFloat.IsNegative against its native type equivalent (#93734)
Tomasz Sowiński [Tue, 24 Oct 2023 15:23:39 +0000 (17:23 +0200)]
Test NFloat.IsNegative against its native type equivalent (#93734)

Comparing it with the result of float.IsNegative failed for RISC-V64 because NFloat.IsNegative implicitly converts to NFloat, which upcasts to NativeType (double), which canonicalizes the NaN value (drops the sign and payload) on RISC-V.

12 months ago[RISC-V] Disable not-yet-implemented EnC assertion (#93864)
Tomasz Sowiński [Tue, 24 Oct 2023 13:34:38 +0000 (15:34 +0200)]
[RISC-V] Disable not-yet-implemented EnC assertion (#93864)

Proper EnC support for RISC-V would require development similar to #69679, for now disable the section.

12 months ago[RISC-V] Fixing createdump for RISC-V (#93374)
Dong-Heon Jung [Mon, 23 Oct 2023 15:29:36 +0000 (00:29 +0900)]
[RISC-V] Fixing createdump for RISC-V (#93374)

* Fixing createdump for RISC-V

* Fix for IMAGE_FILE_MACHINE_RISCV64

12 months ago[RISC-V] NaN-box float arguments (#93665)
Tomasz Sowiński [Sat, 21 Oct 2023 09:16:00 +0000 (11:16 +0200)]
[RISC-V] NaN-box float arguments (#93665)

* [RISC-V] NaN-box the arguments passed to CallDescrWorkerInternal because that stub is unaware of floating-point argument sizes

* [RISC-V] Use variant of fmv.?.x appropriate for the size of the floating-point argument

Floats passed in integer registers need to be NaN-boxed.

* [RISC-V] NaN-box floats in CopyStructToRegisters

* [RISC-V] Fix InvokeUtil::CopyArg to properly (sign|zero)-extend small integers

12 months ago[RISC-V] Fix CodeGen::instGen_Set_Reg_To_Imm (#93411)
Aleksandr Shaurtaev [Wed, 18 Oct 2023 15:31:17 +0000 (18:31 +0300)]
[RISC-V] Fix CodeGen::instGen_Set_Reg_To_Imm (#93411)

12 months ago[RISC-V] Fix dropping NaN sign and payload when importing float constants (#93285)
Tomasz Sowiński [Wed, 11 Oct 2023 11:43:04 +0000 (13:43 +0200)]
[RISC-V] Fix dropping NaN sign and payload when importing float constants (#93285)

RISC-V float-to-double conversion canonicalizes the constant NaN value. Use soft conversion to double.

Since gtNewDconNode is used in quite a few places, the offending conversion is silent (float to double), and most programmers are unaware of NaN propagation issues on uncommon platforms like RISC-V, introduce factory functions dedicated to float and double that do the necessary conversions and make unintended upcasts more difficult.

Also fix printing NaN constants in dumps.

12 months ago[RISC-V] Use standard NaNs in FP ops for cross-compiling RISC-V on x86 (#93098)
Tomasz Sowiński [Fri, 6 Oct 2023 23:50:29 +0000 (01:50 +0200)]
[RISC-V] Use standard NaNs in FP ops for cross-compiling RISC-V on x86 (#93098)

12 months agoCBOR Writer: Use canonical NaN representation for NaN values (#92934)
Tomasz Sowiński [Fri, 6 Oct 2023 20:11:55 +0000 (22:11 +0200)]
CBOR Writer: Use canonical NaN representation for NaN values (#92934)

* Use canonical NaN representation for NaN values

RFC 7049 (CBOR) specifies "If NaN is an allowed value, it must always be represented as 0xf97e00". The only exception is when the user explicitly requests precision (FP size) is preserved.

The problem occurred for x86, C# defines NaN as 0.0/0.0 which yields -NaN on x86 FP units, which gets encoded as 0xf9fe00.

Fixes issue #92080

* Use canonical CBOR (positive) NaN in WriteHalf

* Put canonical CBOR NaNs into named constants

* Add CborReader tests to verify the previously emitted negative NaN bit patterns are still readable as NaN.

* Use only half-float canonical CBOR representation for NaNs

NaNs only get written as 4 or 8 bytes only in CTAP2 mode, which requires to preserve all bits anyway.

+ review fixes

12 months ago[RISC-V] Fix target type unsignedness detection in genFloatToIntCast() (#92694)
Tomasz Sowiński [Mon, 2 Oct 2023 09:08:08 +0000 (11:08 +0200)]
[RISC-V] Fix target type unsignedness detection in genFloatToIntCast() (#92694)

* [RISC-V] Fix target type unsignedness detection in genFloatToIntCast()

treeNode->gtFlags & GTF_UNSIGNED means unsignedness of the source type. Use varTypeIsUnsigned instead which checks for VTF_UNS on target type classification.

Fixes TryConvertToSaturatingUInt64Test and TryConvertToTruncatingUInt64Test from System.Runtime.Numerics.ComplexTests_GenericMath.

* Fix compilation without FEATURE_TIERED_COMPILATION

12 months ago[RISC-V] regArg dependcies unrolling in genFnPrologCalleeRegArgs() (#91904)
t-mustafin [Mon, 2 Oct 2023 08:03:04 +0000 (11:03 +0300)]
[RISC-V] regArg dependcies unrolling in genFnPrologCalleeRegArgs() (#91904)

12 months agoFix Common.Tests.GetPrettyName_CannotRead_ReturnsNull test for root user (#92695)
Tymoteusz Wenerski [Fri, 29 Sep 2023 17:25:34 +0000 (19:25 +0200)]
Fix Common.Tests.GetPrettyName_CannotRead_ReturnsNull test for root user (#92695)

* fix Common.Tests.GetPrettyName_CannotRead_ReturnsNull test for root user

* remove direct call to libc in Common.Tests.GetPrettyName_CannotRead_ReturnsNull

* Update src/libraries/Common/tests/Tests/Interop/OSReleaseTests.cs

* split Common.Tests.OSReleaseTests.GetPrettyName_CannotRead_ReturnsNull into two test cases

* replace ifs with ConditionalFact in Common.Tests.OSReleaseTests class

---------

Co-authored-by: Dan Moseley <danmose@microsoft.com>
12 months ago[RISC-V] Replace Riscv with RiscV (#92318)
JongHeonChoi [Fri, 22 Sep 2023 04:37:15 +0000 (13:37 +0900)]
[RISC-V] Replace Riscv with RiscV (#92318)

12 months ago[RISC-V] Set the HAVE_FUNCTIONAL_PTHREAD_ROBUST_MUTEXES_EXITCOD value to 0 in RISCV64...
JongHeonChoi [Thu, 21 Sep 2023 09:38:47 +0000 (18:38 +0900)]
[RISC-V] Set the HAVE_FUNCTIONAL_PTHREAD_ROBUST_MUTEXES_EXITCOD value to 0 in RISCV64 (#92324)

12 months ago[RISC-V] Atomics (#92102)
Tomasz Sowiński [Thu, 21 Sep 2023 09:24:16 +0000 (11:24 +0200)]
[RISC-V] Atomics (#92102)

* [RISC-V] Add atomics to JIT

* [RISC-V] Intrinsify Interlocked.ExchangeAdd|Exchange|Or|And with RV64 atomics

* [RISC-V] Intrinsify CompareExchange with load-reserved/store-conditional loop

* [ARM64] Fix assertion as it was always passing due to precedence misevaluation

12 months agoFix some assert's errors for ARM64-LoongArch64-RISCV64. (#92319)
Qiao Pengcheng [Thu, 21 Sep 2023 09:21:44 +0000 (17:21 +0800)]
Fix some assert's errors for ARM64-LoongArch64-RISCV64. (#92319)

Also fix some errors about codegen for LoongArch64-RISCV64.

12 months ago[RISC-V] Initial commit for libraries directory (#90203)
t-mustafin [Wed, 13 Sep 2023 18:57:49 +0000 (21:57 +0300)]
[RISC-V] Initial commit for libraries directory (#90203)

* [RISC-V] Initial commit for libraries directory

* Update src/libraries/System.Reflection.Metadata/tests/PortableExecutable/PEHeadersTests.cs

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
---------

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
12 months ago[LoongArch64-RISCV64] Refactor the profiler for LoongArch64 and also fix some errors...
Qiao Pengcheng [Fri, 8 Sep 2023 23:30:46 +0000 (07:30 +0800)]
[LoongArch64-RISCV64] Refactor the profiler for LoongArch64 and also fix some errors for RISCV64. (#91722)

* [LoongArch64-RISCV64] Refactor the profiler for LoongArch64
and also fix some errors for RISCV64.

* add aligned assert for `SIZEOF__PROFILE_PLATFORM_SPECIFIC_DATA`

* update the args registers within the GenerateProfileHelper.
fix some conflicts within registers.

* add `assert(!compiler->compProfilerMethHndIndirected)` within the
`genProfilingLeaveCallback()` and `genProfilingEnterCallback()`.

12 months ago[RISC-V] ELT profiler: fix reconstruction of struct args passed partially on the...
Tomasz Sowiński [Fri, 8 Sep 2023 23:30:09 +0000 (01:30 +0200)]
[RISC-V] ELT profiler: fix reconstruction of struct args passed partially on the stack (#91797)

* [RISC-V] Additional corner-cases for ELT profiler argument reading

* [RISC-V] Cover the case where struct is partially spilled on the stack

12 months agoAdd an option to set maximum processes to run tests (#91737)
Tymoteusz Wenerski [Thu, 7 Sep 2023 18:51:29 +0000 (20:51 +0200)]
Add an option to set maximum processes to run tests (#91737)

12 months agoFactor out hardcoded offsets to PROFILE_PLATFORM_SPECIFIC_DATA struct (#91595)
Tomasz Sowiński [Thu, 7 Sep 2023 07:00:24 +0000 (09:00 +0200)]
Factor out hardcoded offsets to PROFILE_PLATFORM_SPECIFIC_DATA struct (#91595)

These offsets are now in asmconstants.h validated against the C struct with static asserts.

12 months ago[LoongArch64, RISC-V] Fix handling ThreadAbortException at the end of catch for Loong...
Xu Liangyu [Thu, 7 Sep 2023 06:19:31 +0000 (14:19 +0800)]
[LoongArch64, RISC-V] Fix handling ThreadAbortException at the end of catch for LoongArch64 and RISC-V. (#91531)

* Fix handling ThreadAbortException at the end of catch for LoongArch64.

* Fix handling ThreadAbortException at the end of catch for RISC-V.

* Update asmhelpers.S

* Update src/coreclr/vm/exceptionhandling.cpp

* Update asmhelpers.S

Use RedirectForThreadAbort to call ThrowControlForThread directly.

* Update asmhelpers.S

Use RedirectForThreadAbort to call ThrowControlForThread directly.

---------

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
12 months ago[RISC-V, LoongArch64] Fix assert(!regArgMaskLive) in genFnPrologCalleeRegArgs (#91414)
t-mustafin [Wed, 6 Sep 2023 08:11:54 +0000 (11:11 +0300)]
[RISC-V, LoongArch64] Fix assert(!regArgMaskLive) in genFnPrologCalleeRegArgs (#91414)

* [LoongArch64] Fix assert(!regArgMaskLive) in genFnPrologCalleeRegArgs

* [RISC-V] Fix assert(!regArgMaskLive) in genFnPrologCalleeRegArgs

12 months ago[RISC-V] ELT Profiler Bring-Up (#91313)
Tomasz Sowiński [Tue, 5 Sep 2023 20:21:55 +0000 (22:21 +0200)]
[RISC-V] ELT Profiler Bring-Up (#91313)

* [RISC-V] Generate profiling function callbacks

Initial implementation based on ARM64 code.

* [RISC-V] Fix asm stub for calling profiler callbacks

* Fix argument registers according to RISC-V calling convention
* Fix field offsets for PROFILE_PLATFORM_SPECIFIC_DATA
* Make sure field offsets for PROFILE_PLATFORM_SPECIFIC_DATA stay fixed by static asserting the offsets in asmconstants.h

* [RISC-V] Pass arguments for Profile(Enter|Leave|Tailcall)Naked stubs in t0 and t1 because t2 is used to store the call address of the stub

* [RISC-V] Remove unimplemented definition of EmitRet

* [RISC-V] Copy struct from registers into a buffer so that profiler can see whole struct arguments laid out in memory

* [RISC-V] Implement ProfileArgIterator::GetReturnBufferAddr()

Since the RISC-V ABI says values are returned like the first named argument, re-use the struct copying routine from argument parsing as much as possible.

* Factor out duplicated test results checking routine in SlowPathELTProfiler::Shutdown()

* [RISC-V] Clean up PROFILE_PLATFORM_SPECIFIC_DATA

* Remove unused t0 field
* Remove 'unused' field and widen 'flags' to 64 bits to maintain alignment and shave off one sw instruction

* [RISC-V] Remove commented out code

* [RISC-V] Fix formatting

* [RISC-V] Apply format patch from failed check

* [RISC-V] Post-review fixes

12 months ago[LoongArch64, RISC-V] Fix the assertion error for MethodTable::GetLoongArch64PassStru...
Xu Liangyu [Tue, 5 Sep 2023 05:34:21 +0000 (13:34 +0800)]
[LoongArch64, RISC-V] Fix the assertion error for MethodTable::GetLoongArch64PassStructInRegisterFlags() and MethodTable::GetRiscv64PassStructInRegisterFlags(). (#91570)

12 months ago[RISC-V] Implement ThisPtrRetBufPrecode::Init (#91451)
Dong-Heon Jung [Mon, 4 Sep 2023 00:47:49 +0000 (09:47 +0900)]
[RISC-V] Implement ThisPtrRetBufPrecode::Init (#91451)

12 months ago[ARM64] Add g_GCShadowEnd to JIT_WriteBarrier_Table (#91342)
Alexander Soldatov [Fri, 1 Sep 2023 13:13:09 +0000 (16:13 +0300)]
[ARM64] Add g_GCShadowEnd to JIT_WriteBarrier_Table (#91342)

* [ARM64] Add g_GCShadowEnd to JIT_WriteBarrier_Table

This change moves address of g_GCShadowEnd to JIT_WriteBarrier_Table like
others variables used in Write Barrier.

This fix simmilar to RISC-V one https://github.com/dotnet/runtime/pull/90036

* [ARM64] Move GCShadow vars to the end of the wbs block

* Update src/coreclr/vm/arm64/asmhelpers.asm

---------

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
12 months ago[RISC-V] UMEntryThunkCode::Poison() (#91221)
t-mustafin [Wed, 30 Aug 2023 16:21:21 +0000 (19:21 +0300)]
[RISC-V] UMEntryThunkCode::Poison() (#91221)

12 months ago[RISC-V] Fix MarshalStructAsLayoutSeq (#90719)
Dong-Heon Jung [Tue, 29 Aug 2023 14:43:42 +0000 (23:43 +0900)]
[RISC-V] Fix MarshalStructAsLayoutSeq (#90719)

- Fix MarshalStructAsParam_AsSeqByValFixedBufferClassificationTest
- Fix MarshalStructAsParam_AsSeqByValUnicodeCharArrayClassification

12 months ago[RISC-V] Fix tmpReg in emitInsTernary (#90770)
t-mustafin [Fri, 25 Aug 2023 10:29:05 +0000 (13:29 +0300)]
[RISC-V] Fix tmpReg in emitInsTernary (#90770)

12 months agoAdd check for tizen in ilc and crossgen2 (#90310)
Aleksandr Shaurtaev [Thu, 17 Aug 2023 20:07:38 +0000 (23:07 +0300)]
Add check for tizen in ilc and crossgen2 (#90310)

12 months agoFix Shuffling Thunks part 2 (#90707)
Tomasz Sowiński [Thu, 17 Aug 2023 05:54:09 +0000 (07:54 +0200)]
Fix Shuffling Thunks part 2 (#90707)

* Remove running setup-stress-dependencies.sh

That script was removed in commit 7d6b73e9.

* [RISC-V] Fix shuffling floating registers

* Don't offset ShuffleEntry's by 10, because that is likely to go out of bounds.
* Base for floating argument regs (fa) is 10 on RISC-V, not 1.
* Src and dst registers in emit fld were reversed
* Restore arguments stashed in temporary registers

* [RISC-V] Simplify Emit* methods

* Remove unused Emit* methods
* Centralize instruction creation in *TypeInstr functions to limit the potential for mistakes in hard-coded shifts, masks, etc
* Replace Emit32 calls with hard-coded opcodes with proper Emit* names.

12 months ago[Tizen] Omit SIGTERM handler
Hyungju Lee [Mon, 10 Jul 2023 00:33:42 +0000 (09:33 +0900)]
[Tizen] Omit SIGTERM handler

SIGTERM handling in Tizen requires _exit() call to avoid SIGSEGV during exit() call.
Usually, SIGSEGV occurs due to resource use in shared pointer after cleanup in exit() call.

12 months ago[Tizen] Move createdump to CoreCLR binary part.
Mikhail Kurinnoi [Tue, 22 Feb 2022 15:03:42 +0000 (07:03 -0800)]
[Tizen] Move createdump to CoreCLR binary part.

12 months ago[Tizen] Add Linux x86 createdump code.
Mikhail Kurinnoi [Tue, 22 Feb 2022 14:58:35 +0000 (06:58 -0800)]
[Tizen] Add Linux x86 createdump code.

12 months ago[Tizen] Enable Hot Reload debugger API.
Mikhail Kurinnoi [Thu, 7 Apr 2022 12:21:54 +0000 (15:21 +0300)]
[Tizen] Enable Hot Reload debugger API.

Note, we use part debugger API related to EnC in order to work with Hot Reload from debugger.
EnC itself not implemented (runtime don't have code for Linux arm32/arm64/x86 that could "jump" from old method version into new method version).
At this moment, runtime don't support Hot Reload for Linux/Tizen x86.

12 months ago[Tizen] Enable TC_QuickJitForLoops by default
Gleb Balykov [Fri, 10 Sep 2021 15:48:36 +0000 (18:48 +0300)]
[Tizen] Enable TC_QuickJitForLoops by default

12 months ago[Tizen] Fix continuous unsuccessful pthread_setschedparam if there's no CAP_SYS_NICE...
Gleb Balykov [Wed, 16 Feb 2022 11:38:36 +0000 (14:38 +0300)]
[Tizen] Fix continuous unsuccessful pthread_setschedparam if there's no CAP_SYS_NICE capability

12 months ago[Tizen] add pie linker option to createdump
Woongsuk Cho [Thu, 12 Dec 2019 11:41:39 +0000 (20:41 +0900)]
[Tizen] add pie linker option to createdump

12 months ago[Tizen] Use simple name without suffix in MulticoreJit
Gleb Balykov [Mon, 7 Jun 2021 07:52:00 +0000 (10:52 +0300)]
[Tizen] Use simple name without suffix in MulticoreJit

After this change name of resulting profile on disk matches the one passed with COMPlus_MultiCoreJitProfile env variable

12 months ago[Tizen] Disable jithost arena cache
Gleb Balykov [Fri, 2 Aug 2019 14:28:27 +0000 (17:28 +0300)]
[Tizen] Disable jithost arena cache

12 months ago[Tizen] separate PIC and PIE to fix x86_64 build error
Woongsuk Cho [Thu, 9 May 2019 09:02:22 +0000 (18:02 +0900)]
[Tizen] separate PIC and PIE to fix x86_64 build error

12 months ago[Tizen] skip dotnet specific arguments in corerun
Konstantin Baladurin [Fri, 4 Oct 2019 16:45:44 +0000 (19:45 +0300)]
[Tizen] skip dotnet specific arguments in corerun

Now we use corerun to run corefx tests instead of dotnet, because last
one isn't available for Tizen/armel. So we need to skip dotnet specific
arguments, we patch corerun for it because Microsoft.DotNet.RemoteExecutor
tries to execute binary that it gets from /proc/self/maps, so we need a
binary that will behave like dotnet.

12 months ago[Tizen] add access(2) call before dlopening files
Yaroslav Yamshchikov [Thu, 18 Jul 2019 10:14:14 +0000 (13:14 +0300)]
[Tizen] add access(2) call before dlopening files

12 months ago[Tizen] Update .gitignore
Hyungju Lee [Wed, 13 Mar 2019 00:28:54 +0000 (09:28 +0900)]
[Tizen] Update .gitignore

12 months ago[Tizen] Add support for gbs build for x86_64, armv7l, armv7hl, aarch64, x86, riscv64...
Gleb Balykov [Tue, 28 Nov 2023 11:08:06 +0000 (14:08 +0300)]
[Tizen] Add support for gbs build for x86_64, armv7l, armv7hl, aarch64, x86, riscv64 (including CoreCLR and CoreFX tests)

Co-authored by: leee.lee@samsung.com, j-h.choi@samsung.com

To add dotnet tool dependencies:
1. Remove .gitignore
2. Remove all previous build artifacts and non-used files (make output of "git status" clear)
3. export DOTNET_CLI_HOME=`pwd`/.dotnet_cli_home
4. Cross build coreclr tests for required arches (arm, armel, arm64, x86, x64, riscv64) and build for x64
5. Commit cache for tools from .dotnet_cli_home with local nuget packages path replaced with TIZEN_NUGET_PACKAGES_DIR (gbs build will fail if smth is missed)

12 months ago[Tizen] Hardcode LD_GNU for tizen
Gleb Balykov [Tue, 28 Nov 2023 12:48:03 +0000 (15:48 +0300)]
[Tizen] Hardcode LD_GNU for tizen

13 months ago[Tizen] Add coreclr tests build dependencies v8.0.0
Gleb Balykov [Tue, 21 Nov 2023 15:04:00 +0000 (18:04 +0300)]
[Tizen] Add coreclr tests build dependencies v8.0.0

To add these files do next steps:
1. Remove .gitignore
2. Remove all previous build artifacts and non-used files (make output of "git status" clear)
3. export NUGET_PACKAGES=`pwd`/.packages
4. Cross build coreclr tests for required arches (arm, armel, arm64, x86, x64, riscv64) and build for x64
5. Commit .packages

Notes:
- If some of these nuget packages are not commited or missed for other reasons, gbs build will fail.

13 months ago[Tizen] Add prebuilt libicu-57.1 libraries for x64
Gleb Balykov [Mon, 12 Apr 2021 14:20:02 +0000 (17:20 +0300)]
[Tizen] Add prebuilt libicu-57.1 libraries for x64

These are required for x64 BuildTools in order to run under gbs.

13 months ago[Tizen] Add nuget packages for corefx-managed-ref for clr <= 3.1
Gleb Balykov [Mon, 12 Apr 2021 14:43:01 +0000 (17:43 +0300)]
[Tizen] Add nuget packages for corefx-managed-ref for clr <= 3.1

These are nuget packages, which are used during application build.
To generate these, build TizenFX and put downloaded nuget packages in nuget/ dir.

13 months ago[Tizen] Add x64 build tools and nuget dependencies v8.0.0
Gleb Balykov [Mon, 20 Nov 2023 16:56:47 +0000 (19:56 +0300)]
[Tizen] Add x64 build tools and nuget dependencies v8.0.0

To add these files do next steps:
1. Remove .gitignore
2. Remove all previous build artifacts and non-used files (make output of "git status" clear)
3. export NUGET_PACKAGES=`pwd`/.packages
4. Cross build runtime (coreclr, libraries/corefx, corefx tests) for required arches (arm, armel, arm64, x86, x64, riscv64) and build for x64
5. Commit .dotnet, .packages

Notes:
- If some dir names change in future, this will be seen in "git status" after step 4. Add those dirs too.
- If some of these dirs are not commited or missed for other reasons, gbs build will fail.
- These build tools are for x64, thus, gbs build without clang-accel is not supported.

13 months ago[Tizen] Enable corefx tests build for riscv64 and x86
Gleb Balykov [Sun, 26 Nov 2023 09:47:21 +0000 (12:47 +0300)]
[Tizen] Enable corefx tests build for riscv64 and x86

13 months agoRollback Tizen toolchain versions except RISC-V (#14149)
Hyungju Lee [Mon, 23 Oct 2023 09:12:43 +0000 (02:12 -0700)]
Rollback Tizen toolchain versions except RISC-V (#14149)

13 months agoAdd tizen riscv64 rootfs and cross build support (#14035)
Gleb Balykov [Wed, 11 Oct 2023 07:46:33 +0000 (16:46 +0900)]
Add tizen riscv64 rootfs and cross build support (#14035)

13 months agoMerge in 'release/8.0' changes
dotnet-bot [Tue, 31 Oct 2023 14:37:06 +0000 (14:37 +0000)]
Merge in 'release/8.0' changes

13 months agoUpdate dependencies from https://github.com/dotnet/emsdk build 20231030.2 (#94196)
dotnet-maestro[bot] [Tue, 31 Oct 2023 14:25:35 +0000 (07:25 -0700)]
Update dependencies from https://github.com/dotnet/emsdk build 20231030.2 (#94196)

Microsoft.SourceBuild.Intermediate.emsdk , Microsoft.NET.Workload.Emscripten.Current.Manifest-8.0.100
 From Version 8.0.0-rtm.23523.2 -> To Version 8.0.0-rtm.23530.2

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
13 months agoMerge in 'release/8.0' changes
dotnet-bot [Tue, 31 Oct 2023 00:11:56 +0000 (00:11 +0000)]
Merge in 'release/8.0' changes

13 months ago[release/8.0] Bump net7 downlevel version to 7.0.14 (#94192)
Steve Pfister [Mon, 30 Oct 2023 23:59:55 +0000 (16:59 -0700)]
[release/8.0] Bump net7 downlevel version to 7.0.14 (#94192)

Co-authored-by: Steve Pfister <steve.pfister@microsoft.com>
14 months agoMerge in 'release/8.0' changes
dotnet-bot [Wed, 25 Oct 2023 20:45:25 +0000 (20:45 +0000)]
Merge in 'release/8.0' changes

14 months ago[8.0] Update MsQuic (#93979)
Carlos Sánchez López [Wed, 25 Oct 2023 20:34:17 +0000 (14:34 -0600)]
[8.0] Update MsQuic (#93979)

14 months agoMerged PR 34793: [internal/release/8.0] Merge from public
Matt Mitchell [Wed, 25 Oct 2023 17:16:31 +0000 (17:16 +0000)]
Merged PR 34793: [internal/release/8.0] Merge from public

Merge from public release/8.0 to internal/release/8.0 and resolve conflicts if necessary

14 months agoApply suggestions from code review
Matt Mitchell [Wed, 25 Oct 2023 17:13:10 +0000 (17:13 +0000)]
Apply suggestions from code review

14 months ago[release/8.0] Honor JsonSerializerOptions.PropertyNameCaseInsensitive in property...
github-actions[bot] [Tue, 24 Oct 2023 20:21:59 +0000 (13:21 -0700)]
[release/8.0] Honor JsonSerializerOptions.PropertyNameCaseInsensitive in property name conflict resolution. (#93935)

* Honor JsonSerializerOptions.PropertyNameCaseInsensitive in property name conflict resolution.

* Update src/libraries/System.Text.Json/tests/Common/PropertyNameTests.cs

Co-authored-by: Jeff Handley <jeffhandley@users.noreply.github.com>
* Address feedback

---------

Co-authored-by: Eirik Tsarpalis <eirik.tsarpalis@gmail.com>
Co-authored-by: Jeff Handley <jeffhandley@users.noreply.github.com>
14 months ago[release/8.0][wasm] Fix perf pipeline runs (#93888)
Ankit Jain [Tue, 24 Oct 2023 02:26:57 +0000 (22:26 -0400)]
[release/8.0][wasm] Fix perf pipeline runs (#93888)

* Remove --experimental-wasm-eh argument from the wasm_args used for wasm performance runs. (#93357)

(cherry picked from commit a770017fea3549e0bf88f7c619b79a731271e305)

* performance-setup.sh: Use `release/8.0` as the default channel

* performance-setup.ps1: use release/8.0 as the default channel

* Fix passing wasmArgs for bdn

---------

Co-authored-by: Parker Bibus <parkerbibus@microsoft.com>
14 months agoMerge pull request #93807 from carlossanlop/StableBranding8
Carlos Sánchez López [Mon, 23 Oct 2023 20:42:54 +0000 (14:42 -0600)]
Merge pull request #93807 from carlossanlop/StableBranding8

[release/8.0] Stable branding for .NET 8 GA

14 months ago[release/8.0] Update dependencies from dnceng/internal/dotnet-optimization (#93827)
dotnet-maestro[bot] [Mon, 23 Oct 2023 20:37:10 +0000 (13:37 -0700)]
[release/8.0] Update dependencies from dnceng/internal/dotnet-optimization (#93827)

* Update dependencies from https://dev.azure.com/dnceng/internal/_git/dotnet-optimization build 20231021.3

optimization.linux-arm64.MIBC.Runtime , optimization.linux-x64.MIBC.Runtime , optimization.windows_nt-arm64.MIBC.Runtime , optimization.windows_nt-x64.MIBC.Runtime , optimization.windows_nt-x86.MIBC.Runtime , optimization.PGO.CoreCLR
 From Version 1.0.0-prerelease.23519.5 -> To Version 1.0.0-prerelease.23521.3

* Update dependencies from https://dev.azure.com/dnceng/internal/_git/dotnet-optimization build 20231021.3

optimization.linux-arm64.MIBC.Runtime , optimization.linux-x64.MIBC.Runtime , optimization.windows_nt-arm64.MIBC.Runtime , optimization.windows_nt-x64.MIBC.Runtime , optimization.windows_nt-x86.MIBC.Runtime , optimization.PGO.CoreCLR
 From Version 1.0.0-prerelease.23519.5 -> To Version 1.0.0-prerelease.23521.3

---------

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
14 months agoUpdate dependencies from https://github.com/dotnet/emsdk build 20231023.2 (#93881)
dotnet-maestro[bot] [Mon, 23 Oct 2023 20:36:15 +0000 (13:36 -0700)]
Update dependencies from https://github.com/dotnet/emsdk build 20231023.2 (#93881)

Microsoft.SourceBuild.Intermediate.emsdk , Microsoft.NET.Workload.Emscripten.Current.Manifest-8.0.100
 From Version 8.0.0-rtm.23520.2 -> To Version 8.0.0-rtm.23523.2

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
14 months ago[release/8.0] Improve performance of UnmanagedMemoryStream (#93812)
github-actions[bot] [Mon, 23 Oct 2023 20:34:35 +0000 (13:34 -0700)]
[release/8.0] Improve performance of UnmanagedMemoryStream (#93812)

* Improve performance of UnmanagedMemoryStream

UnmanagedMemoryStream used Interlocked operations to update its state to prevent tearing of 64-bit values on 32-bit platforms. This pattern is expensive in general and it was found to be prohibitively expensive on recent hardware..

This change removes the expensive Interlocked operations and addresses
the tearing issues in alternative way:
- The _length field is converted to nuint that is guaranteed to be
  updated atomically.
- Writes to _length field are volatile to guaranteed the
  unininitialized memory cannot be read.
- The _position field remains long and it has a risk of tearing. It is
  not a problem since tearing of this field cannot lead to buffer
  overruns.

Fixes #93624

* Add comment

---------

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
14 months agoOverride InformationalVersion for NativeAOT corelib too
Alexander Köplinger [Mon, 23 Oct 2023 17:48:04 +0000 (19:48 +0200)]
Override InformationalVersion for NativeAOT corelib too

14 months ago[release/8.0] Update APICompat settings under source build (#93865)
github-actions[bot] [Mon, 23 Oct 2023 15:22:57 +0000 (17:22 +0200)]
[release/8.0] Update APICompat settings under source build (#93865)

* Update APICompat settings under source build

* Update resolveContract.targets

---------

Co-authored-by: Viktor Hofer <viktor.hofer@microsoft.com>
14 months agoMerge branch 'release/8.0' into StableBranding8
Larry Ewing [Mon, 23 Oct 2023 11:27:30 +0000 (06:27 -0500)]
Merge branch 'release/8.0' into StableBranding8

14 months ago[release/8.0] Update dependencies from dotnet/emsdk (#93801)
dotnet-maestro[bot] [Mon, 23 Oct 2023 11:26:29 +0000 (06:26 -0500)]
[release/8.0] Update dependencies from dotnet/emsdk (#93801)

* Update dependencies from https://github.com/dotnet/emsdk build 20231020.2

Microsoft.NET.Workload.Emscripten.Current.Manifest-8.0.100.Transport
 From Version 8.0.0-rtm.23511.3 -> To Version 8.0.0-rtm.23520.2

* switch to the stable version now

* Update dependencies

* Also fix the trigger

* pin the wbt sdk to avoid the latest analizer nonsense

* Use source generation for the serializer

* Try to make sourcebuild happy

* Try again to make sourcebuild happy

* Use reflection and suppress trim analysis instead

This reverts commit 768b65bab585f303bca6e0e9a36cf06d59e90387.

* Fix reverting too much

---------

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: Larry Ewing <lewing@microsoft.com>
14 months agoHandle an empty bandPreleaseVersion
Larry Ewing [Sat, 21 Oct 2023 02:40:23 +0000 (21:40 -0500)]
Handle an empty bandPreleaseVersion

14 months ago[release/8.0] Stable branding for .NET 8 GA
Carlos Sánchez López [Fri, 20 Oct 2023 23:22:43 +0000 (16:22 -0700)]
[release/8.0] Stable branding for .NET 8 GA

14 months agoAdd runtime base address to Native AOT crash info JSON (#93791)
github-actions[bot] [Fri, 20 Oct 2023 23:16:14 +0000 (16:16 -0700)]
Add runtime base address to Native AOT crash info JSON (#93791)

The Native AOT Watson and SOS support needs to the module's base address containing
the runtime for adequate performance. Add the module base address in the crash info
as "runtime_base". Changed the "runtime" to the clearer "runtime_version" property.

Verified the address in local testing. Modified the !crashinfo command in SOS to display this new base address.

Very low. Native AOT unhandled exception crash info.

Co-authored-by: Mike McLaughlin <mikem@microsoft.com>
14 months ago[release/8.0] Add package readme to System.Numerics.Tensors (#93806)
github-actions[bot] [Fri, 20 Oct 2023 23:07:05 +0000 (16:07 -0700)]
[release/8.0] Add package readme to System.Numerics.Tensors (#93806)

* Add package readme to System.Numerics.Tensors

* Update src/libraries/System.Numerics.Tensors/src/PACKAGE.md

* Update src/libraries/System.Numerics.Tensors/src/PACKAGE.md

* Update src/libraries/System.Numerics.Tensors/src/PACKAGE.md

Co-authored-by: Stephen Toub <stoub@microsoft.com>
---------

Co-authored-by: Eric StJohn <ericstj@microsoft.com>
Co-authored-by: Stephen Toub <stoub@microsoft.com>
14 months ago[release/8.0] Vectorize TensorPrimitives APIs (#93746)
Michael Sharp [Fri, 20 Oct 2023 23:01:42 +0000 (16:01 -0700)]
[release/8.0] Vectorize TensorPrimitives APIs (#93746)

* Use FMA in TensorPrimitives (#92205)

* Simplify TensorPrimitive's AbsoluteOperator (#92577)

Vector{128/256/512} all provide Abs; no need to do this manually.

* Reduce some boilerplate in TensorPrimitive's IBinaryOperator (#92576)

Change a few of the static abstract interface methods to be virtual, as most implementations throw from these methods; we can consolidate that throwing to the base.

* Minor code cleanup in TensorPrimitives tests (#92575)

* Normalize some test naming

* Alphabetize tests

* Improve mistmatched length tests with all positions of the shorter tensor

* Alphabetize methods in TensorPrimitives.cs

* Vectorize TensorPrimitives.Min/Max{Magnitude} (#92618)

* Vectorize TensorPrimitives.Min/Max{Magnitude}

* Use AdvSimd.Max/Min

* Rename some parameters/locals for consistency

* Improve HorizontalAggregate

* Move a few helpers

* Avoid scalar path for returning found NaN

* Update TensorPrimitives aggregations to vectorize handling of remaining elements (#92672)

* Update TensorPrimitives.CosineSimilarity to vectorize handling of remaining elements

* Vectorize remainder handling for Aggregate helpers

* Flesh out TensorPrimitives XML docs (#92749)

* Flesh out TensorPrimitives XML docs

* Address PR feedback

- Remove use of FusedMultiplyAdd from all but CosineSimilarity
- Remove comments about platform/OS-specific behavior from Add/AddMultiply/Subtract/Multiply/MultiplyAdd/Divide/Negate
- Loosen comments about NaN and which exact one is returned

* Address PR feedback

* Vectorize TensorPrimitives.ConvertToHalf (#92715)

* Enable TensorPrimitives to perform in-place operations (#92820)

Some operations would produce incorrect results if the same span was passed as both an input and an output.  When vectorization was employed but the span's length wasn't a perfect multiple of a vector, we'd do the standard trick of performing one last operation on the last vector's worth of data; however, that relies on the operation being idempotent, and if a previous operation has overwritten input with a new value due to the same memory being used for input and output, some operations won't be idempotent.  This fixes that by masking off the already processed elements.  It adds tests to validate in-place use works, and it updates the docs to carve out this valid overlapping.

* Vectorize TensorPrimitives.ConvertToSingle (#92779)

* Vectorize TensorPrimitives.ConvertToSingle

* Address PR feedback

* Throw exception in TensorPrimitives for unsupported span overlaps (#92838)

* This vectorizes TensorPrimitives.Log2 (#92897)

* Add a way to support operations that can't be vectorized on netstandard

* Updating TensorPrimitives.Log2 to be vectorized on .NET Core

* Update src/libraries/System.Numerics.Tensors/src/System/Numerics/Tensors/TensorPrimitives.netstandard.cs

Co-authored-by: Stephen Toub <stoub@microsoft.com>
* Ensure we do an arithmetic right shift in the Log2 vectorization

* Ensure the code can compile on .NET 7

* Ensure that edge cases are properly handled and don't resolve to `x`

* Ensure that Log2 special results are explicitly handled.

---------

Co-authored-by: Stephen Toub <stoub@microsoft.com>
* Adding Log2 tests covering some special values (#92946)

* [wasm] Disable `TensorPrimitivesTests.ConvertToHalf_SpecialValues` (#92953)

Failing test: `System.Numerics.Tensors.Tests.TensorPrimitivesTests.ConvertToHalf_SpecialValues`

Issue: https://github.com/dotnet/runtime/issues/92885

* Adding a vectorized implementation of TensorPrimitives.Log (#92960)

* Adding a vectorized implementation of TensorPrimitives.Log

* Make sure to hit Ctrl+S

* Consolidate some TensorPrimitivesTests logic around special values (#92982)

* Vectorize TensorPrimitives.Exp (#93018)

* Vectorize TensorPrimitives.Exp

* Update src/libraries/System.Numerics.Tensors/src/System/Numerics/Tensors/TensorPrimitives.netstandard.cs

* Vectorize TensorPrimitives.Sigmoid and TensorPrimitives.SoftMax (#93029)

* Vectorize TensorPrimitives.Sigmoid and TensorPrimitives.SoftMax

- Adds a SigmoidOperator that just wraps the ExpOperator
- Vectorizes both passes of SoftMax, on top of ExpOperator. Simplest way to do this was to augment the existing InvokeSpanScalarIntoSpan to take a transform operator.
- In doing so, found some naming inconsistencies I'd previously introduced, so I did some automatic renaming to make things more consistent.
- Added XML comments to all the internal/private surface area.
- Fleshes out some tests (and test values).

* Disable tests on mono

* Address PR feedback

* Vectorize TensorPrimitives.Tanh/Cosh/Sinh (#93093)

* Vectorize TensorPrimitives.Tanh/Cosh/Sinh

Tanh and Cosh are based on AOCL-LibM.

AOCL-LibM doesn't appear to have a sinh implementation, so this Sinh is just based on the sinh formula based on exp(x).

I also augmented the tests further, including:
- Added more tests for sinh/cosh/tanh
- Add an equality routine that supports comparing larger values with a tolerance
- Tightened the tolerance for most functions
- Changed some tests to be theories to be consistent with style elsewhere in the tests
- Fixed some use of Math to be MathF

* Remove unnecessary special-handling path from cosh

* Remove unnecessary special-handling path from tanh

* Redo sinh based on cosh

* Address PR feedback

* Replace confusing new T[] { ... }

* Remove a few unnecessary `unsafe` keyword uses in TensorPrimitives (#93219)

* Consolidate a few exception throws in TensorPrimitives (#93168)

* Fix TensorPrimitives.IndexOfXx corner-case when first element is seed value (#93169)

* Fix TensorPrimitives.IndexOfXx corner-case when first element is seed value

Found as part of adding more tests for Min/Max{Magnitude} to validate they match their IndexOfXx variants.

* Address PR feedback

* Improve a vector implementation to support alignment and non-temporal tores (#93296)

* Improve a vector implementation to support alignment and non-temporal stores

* Fix a build error and mark a couple methods as AggressiveInlining

* Fix the remaining block count computation

* Ensure overlapping for small data on the V256/512 is handled

* Ensure we only go down the vectorized path when supported for netstandard

* Mark TensorPrimitives as unsafe (#93412)

* Use the improved vectorization algorithm for binary and ternary TensorPrimitives operations (#93409)

* Update InvokeSpanSpanIntoSpan<TBinaryOperator> for TensorPrimitives to use the better SIMD algorithm

* Update InvokeSpanScalarIntoSpan<TTransformOperator, TBinaryOperator> for TensorPrimitives to use the better SIMD algorithm

* Update InvokeSpanSpanSpanIntoSpan<TTernaryOperator> for TensorPrimitives to use the better SIMD algorithm

* Update InvokeSpanSpanScalarIntoSpan<TTernaryOperator> for TensorPrimitives to use the better SIMD algorithm

* Update InvokeSpanScalarSpanIntoSpan<TTernaryOperator> for TensorPrimitives to use the better SIMD algorithm

* Improve codegen slightly by using case 0, rather than default

* Adjust the canAlign check to be latter, to reduce branch count for data under the threshold

* Add a comment explaining the NonTemporalByteThreshold

* Make sure xTransformOp.CanVectorize is checked on .NET Standard

* Use the improved vectorization algorithm for aggregate TensorPrimitives operations (#93695)

* Improve the handling of the IAggregationOperator implementations

* Update Aggregate<TTransformOperator, TAggregationOperator> for TensorPrimitives to use the better SIMD algorithm

* Update Aggregate<TBinaryOperator, TAggregationOperator> for TensorPrimitives to use the better SIMD algorithm

* Respond to PR feedback

* [wasm] Remove more active issues for #92885 (#93596)

* adding patch from pr 93556

* Vectorizes IndexOfMin/Max/Magnitude (#93469)

* resolved merge conflicts

* net core full done

* minor code cleanup

* NetStandard and PR fixes.

* minor pr changes

* Fix IndexOfMaxMagnitudeOperator

* Fix IndexOfMaxMagnitudeOperator on netcore

* updates from PR comments

* netcore fixed

* net standard updated

* add reference assembly exclusions

* made naive approach better

* resolved PR comments

* minor comment changes

* minor formatting fixes

* added inlining

* fixes from PR comments

* comments from pr

* fixed spacing

---------

Co-authored-by: Eric StJohn <ericstj@microsoft.com>
---------

Co-authored-by: Stephen Toub <stoub@microsoft.com>
Co-authored-by: Tanner Gooding <tagoo@outlook.com>
Co-authored-by: Ankit Jain <radical@gmail.com>
Co-authored-by: Radek Doulik <radek.doulik@gmail.com>
Co-authored-by: Eric StJohn <ericstj@microsoft.com>
14 months ago[release/8.0] Update dependencies from dotnet/sdk (#93783)
dotnet-maestro[bot] [Fri, 20 Oct 2023 23:00:17 +0000 (16:00 -0700)]
[release/8.0] Update dependencies from dotnet/sdk (#93783)

* Update dependencies from https://github.com/dotnet/sdk build 20231020.8

Microsoft.DotNet.ApiCompat.Task
 From Version 8.0.100-preview.7.23329.3 -> To Version 8.0.100-rtm.23520.8

* Update CompatibilitySuppressions.xml

* Update ApiCompatBaseline.netstandard2.0.xml

* Update ApiCompatBaseline.netstandard2.1.xml

* Suppress intentional ObsoleteAttribute parameter change

---------

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: Viktor Hofer <viktor.hofer@microsoft.com>
14 months ago[release/8.0] [iOS][non-icu] HybridGlobalization Get available locales (#93751)
github-actions[bot] [Fri, 20 Oct 2023 22:58:53 +0000 (15:58 -0700)]
[release/8.0] [iOS][non-icu] HybridGlobalization Get available locales (#93751)

* Get available locales hybrid mode

* Fix the exception when value is empty

* Apply changes requested by review,fix currencyCode

* Add test case

* Add braces and fix order in csproj

---------

Co-authored-by: Meri Khamoyan <merikhamoyan@microsoft.com>
14 months agoFix options source gen test (#93782)
github-actions[bot] [Fri, 20 Oct 2023 20:25:28 +0000 (13:25 -0700)]
Fix options source gen test (#93782)

Co-authored-by: Tarek Mahmoud Sayed <tarekms@microsoft.com>