1. 03 11月, 2022 1 次提交
  2. 02 11月, 2022 3 次提交
    • A
      Revert "[wasm] browser profiler (#77449)" (#77759) · d3a3eda6
      Ankit Jain 提交于
      This reverts commit 0e24ea7c.
      
      It broke all the perf pipeline wasm builds. It happens with v8 `10.9.130`:
      
      ```
      Error: Invalid 'startMark' argument: No numeric 'startTime' field
          at pe (/home/helixbot/work/B2E7090F/w/A520093B/e/performance/artifacts/bin/for-running/MicroBenchmarks/659adab0-5c86-4e74-8913-672bd56fd58e/bin/net7.0/browser-wasm/AppBundle/dotnet.js:3:12994)
          at /home/helixbot/work/B2E7090F/w/A520093B/e/performance/artifacts/bin/for-running/MicroBenchmarks/659adab0-5c86-4e74-8913-672bd56fd58e/bin/net7.0/browser-wasm/AppBundle/dotnet.js:5:95874
      exiting due to exception: Error: Invalid 'startMark' argument: No numeric 'startTime' field
      ```
      
      - It works fine with older versions like `10.7.193` (current stable).
      - It wasn't caught in the CI checks because those are using an older version of v8.
      d3a3eda6
    • P
      [wasm] browser profiler (#77449) · 0e24ea7c
      Pavel Savara 提交于
      * wip
      
      * wip
      
      * cleanup
      
      * feedback
      
      * feedback
      0e24ea7c
    • A
      [wasm] Fix analyzer support in templates (#77704) · 6631b478
      Ankit Jain 提交于
      - Add
        `[assembly:System.Runtime.Versioning.SupportedOSPlatform("browser")]`
        to the browser, and console templates. This would allow the analyzers,
        if enabled, to treat the assembly as one that will run only on
        browser.
      
      - Populate `@(SupportedPlatform)` with only `browser`, for *wasm*
        projects, similar to https://github.com/dotnet/sdk/blob/fef8cedfb6b4ac85a7e135f3e4f155e29cdcbdf1/src/BlazorWasmSdk/Targets/Microsoft.NET.Sdk.BlazorWebAssembly.5_0.targets#L75-L79
      
      - This also fixes the firefox CI build which regressed recently
      6631b478
  3. 20 10月, 2022 1 次提交
  4. 14 10月, 2022 1 次提交
    • P
      [wasm] event pipe tweaks (#76994) · 54c4a4bb
      Pavel Savara 提交于
      - the EP sample will download .nettrace when compiled with MonoDiagnosticsMock (debug)
      
      To allow the app and the mock communicate
      - added postMessageToBrowser and addEventListenerFromBrowser to mock environment
      - exposed INTERNAL.diagnosticServerThread when built with MonoDiagnosticsMock
      - added processSend to MockScriptEngineImpl so that mock could process more than just first message
      
      - fixed EP serializer of empty string vs null
      
      - make mime types and http headers more configurable for all samples
      - move CSP policy header just into advanced sample (it prevents the EP socket to be open on another port)
      - added README
      - minor cleanup of async stuff
      54c4a4bb
  5. 10 10月, 2022 1 次提交
    • R
      [wasm] Vector128's Sum and Dot SIMD implementation (#76446) · e2b67a87
      Radek Doulik 提交于
      * [wasm] Vector128's Sum and Dot SIMD implementation
      
      Implements `Vector128.Sum` and `Vector128.Dot` SIMD intrinsics on WebAssembly. It calculates the sum by shuffling (with swizzle instruction) the lanes around and doing vector addition. This way it takes log2(number of lanes) additions.
      
      An example of emitted code:
      ```
      (func Wasm_Browser_Bench_Sample_Sample_VectorTask_DotFloat_RunStep(param $0 i32, $1 i32))
       local $2 v128
       local.get $0
       i32.eqz
       if
        call mini_llvmonly_throw_nullref_exception
        unreachable
      
       local.get $0
       local.get $0
       v128.load offset:16    [SIMD]
       local.get $0
       v128.load offset:32    [SIMD]
       f32x4.mul    [SIMD]
       local.tee $2
       local.get $2
       v128.const 0x0b0a09080f0e0d0c0302010007060504    [SIMD]
       i8x16.swizzle    [SIMD]
       f32x4.add    [SIMD]
       local.tee $2
       local.get $2
       v128.const 0x07060504030201000f0e0d0c0b0a0908    [SIMD]
       i8x16.swizzle    [SIMD]
       f32x4.add    [SIMD]
       f32x4.extract.lane 0    [SIMD]
       f32.store offset:48 align:2
      ```
      C# method:
      ```
      public override void RunStep() {
          result = Vector128.Dot(vector1, vector2);
      }
      ```
      
      bench sample measurements on amd64 desktop:
      
      Chrome/amd64
      
      | measurement | before | after | times faster |
      |-:|-:|-:|-:|
      |                Vector, Dot product int |     0.4398us |     0.0463us |  9.5 |
      |              Vector, Dot product ulong |     0.2567us |     0.0474us |  5.4 |
      |              Vector, Dot product float |     0.4305us |     0.0482us |  8.9 |
      |             Vector, Dot product double |     0.2519us |     0.0458us |  5.5 |
      |                      Vector, Sum sbyte |     0.8576us |     0.0463us | 18.5 |
      |                      Vector, Sum short |     0.4632us |     0.0457us | 10.1 |
      |                       Vector, Sum uint |     0.2686us |     0.0454us |  5.9 |
      |                     Vector, Sum double |     0.1633us |     0.0480us |  3.4 |
      
      Firefox/amd64
      
      | measurement | before | after | times faster |
      |-:|-:|-:|-:|
      |                Vector, Dot product int |     0.3993us |     0.1108us | 3.6 |
      |              Vector, Dot product ulong |     0.2668us |     0.1081us | 2.5 |
      |              Vector, Dot product float |     0.3897us |     0.1032us | 3.8 |
      |             Vector, Dot product double |     0.2592us |     0.1096us | 2.4 |
      |                      Vector, Sum sbyte |     0.6510us |     0.1047us | 6.2 |
      |                      Vector, Sum short |     0.4038us |     0.1025us | 3.9 |
      |                       Vector, Sum uint |     0.2631us |     0.1025us | 2.6 |
      |                     Vector, Sum double |     0.1928us |     0.1022us | 1.9 |
      
      * Use XREG instead of VREG
      
      * Update signature
      
      * Fix result types
      
      * Fix after merge
      
      * Fix white space
      e2b67a87
  6. 06 10月, 2022 1 次提交
  7. 30 9月, 2022 1 次提交
  8. 14 9月, 2022 1 次提交
    • S
      [wasm-mt] Disable and fix remaining failing tests on Browser with... · 9d8be445
      Simon Rozsival 提交于
      [wasm-mt] Disable and fix remaining failing tests on Browser with multi-threading and perf tracing enabled (#75286)
      
      * Disable failing tests that make HTTP requests
      
      * Fix eventpipe sample test
      
      * Add missing issue links
      
      * Bump pthread pool size for tests
      
      * Disable failing test
      
      * Increase pthread pool size for CI
      
      * Try using diagnostics mock for the browser-eventpipe sample in Release mode on CI
      
      * Update active issue link
      
      * TMP add debugging information for CI
      
      * Revert "TMP add debugging information for CI"
      
      This reverts commit 1e5c88e131373eb1fd3e553071b2ceb21dce764b.
      
      * Decrease pthread pool size to just 8
      
      * [wasm] samples: use WasmXHarnessArgs so we can get the --web-server-use-cop argument
      Co-authored-by: NAnkit Jain <radical@gmail.com>
      9d8be445
  9. 13 9月, 2022 1 次提交
    • R
      [wasm] Add common vector min/max implementation (#75451) · cb072612
      Radek Doulik 提交于
      Emit fcmp,select for common case of OP_FMIN/FMAX
      
      This avoids reaching an assert in the aot compiler on wasm and produces
      reasonable code:
      
          (func Wasm_Browser_Bench_Sample_Sample_VectorTask_MaxFloat_RunStep(param $0 i32, $1 i32))
           local.get $0
           i32.eqz
           if
            call mini_llvmonly_throw_nullref_exception
            unreachable
      
           local.get $0
           local.get $0
           v128.load offset:16    [SIMD]
           local.get $0
           v128.load offset:32    [SIMD]
           f32x4.pmax    [SIMD]
           v128.store offset:48    [SIMD]
      
          (func Wasm_Browser_Bench_Sample_Sample_VectorTask_MinFloat_RunStep(param $0 i32, $1 i32))
           local $2 v128
           local $3 v128
           local.get $0
           i32.eqz
           if
            call mini_llvmonly_throw_nullref_exception
            unreachable
      
           local.get $0
           local.get $0
           v128.load offset:32    [SIMD]
           local.tee $2
           local.get $0
           v128.load offset:16    [SIMD]
           local.tee $3
           local.get $3
           local.get $2
           f32x4.gt    [SIMD]
           v128.bitselect    [SIMD]
           v128.store offset:48    [SIMD]
      
      Also added measurements for these to the browser-bench
      cb072612
  10. 12 9月, 2022 1 次提交
  11. 07 9月, 2022 2 次提交
  12. 01 9月, 2022 1 次提交
  13. 31 8月, 2022 5 次提交
    • P
      appstart benchmark improvements (#74799) · b82f2545
      Pavel Savara 提交于
      appstart benchmark improvements
      b82f2545
    • P
      [wasm] trim System.Private.Uri.dll (#74826) · d48dd6c9
      Pavel Savara 提交于
      change interop code so that ILLink would not protect Uri class
      d48dd6c9
    • R
      [wasm] shorten JSInterop bench detection phase (#74802) · 4c927373
      Radek Doulik 提交于
      Some of the JSInterop measurements have long steps, so tune down
      the detection phase steps to avoid overly long detection, which resulted
      in 3x bench run times in some cases on arm64/linux SBC.
      4c927373
    • R
      [wasm] SIMD support improvements (#73289) · 4190ef87
      Radek Doulik 提交于
      * Initial wasm SIMD support
      
      * Enable Vector intrinsic on wasm
      
      The llvm code generator works nicely with them.
      
      * Add missing files
      
      * Make SIMD support conditional
      
      * Remove test code
      
      * Fix debug build
      
      * Update after merge
      
      * Add Splat and ExcractLane methods
      
      * Switch i64 values for Constant method
      
      So that C#
      
          WasmBase.Constant(0xff11ff22ff33ff44, 0xff55ff66ff77ff88)
      
      is compiled into wasm code
      
          v128.const 0xff11ff22ff33ff44ff55ff66ff77ff88    [SIMD]
      
      * Update PlatformNotSupported version of WasmBase
      
      * Fix CI build
      
      * Add ReplaceLane and Swizzle
      
      * Change WasmBase.Constant to get Vector128 as input
      
      * Add Shuffle methods
      
      This will need more work, as it crashes clang during 'WebAssembly
      Instruction Selection' pass:
      
          WasmApp.Native.targets(353,5): error : 3.    Running pass 'WebAssembly Instruction Selection' on function '@corlib_System_Runtime_Intrinsics_Wasm_WasmBase_Shuffle_System_Runtime_Intrinsics_Vector128_1_byte_System_Runtime_Intrinsics_Vector128_1_byte_System_Runtime_Intrinsics_Vector128_1_byte'
      
      * Handle SN_Shuffle
      
      * Fix crash in OP_STOREX_MEMBASE
      
      * Add build test
      
      * Fix remaining conflict
      
      * Remove unused prop
      
      * IsSupported should be static
      
      * Handle SN_get_IsSupported
      
      * Keep passing --enable-simd to wasm-opt
      
      * Add Span reverse measurements
      
      * Use WasmBase to improve perf of Span reverse
      
      | measurement | no SIMD | SIMD |
      |-:|-:|-:|
      |                    Span, Reverse bytes |     0.0341ms |     0.0028ms |
      |                    Span, Reverse chars |     0.0394ms |     0.0062ms |
      
      * Remove debug prints
      
      * Do not expose WasmBase API
      
      * Add BuildAdditionalArgs prop
      
      To pass args to sample builds
      
      * Handle WasmBase.get_IsSupported in the interpreter
      
      * Add IndexOf measurements
      
      * Add And intrinsic methods
      
      * Add more methods to WasmBase classes
      
      * Add implementation of the new WasmBase methods
      
      * Use WasmBase to improve Span.IndexOf performance
      
      Measurements chrome/aot/amd64:
      
      | measurement | no SIMD | SIMD |
      |-:|-:|-:|
      |                    Span, Reverse bytes |     0.0332ms |     0.0025ms |
      |                    Span, Reverse chars |     0.0332ms |     0.0060ms |
      |                    Span, IndexOf bytes |     0.2068us |     0.1002us |
      |                    Span, IndexOf chars |     0.0146ms |     0.0028ms |
      
      Measurements firefox/aot/amd64:
      
      | measurement | no SIMD | SIMD |
      |-:|-:|-:|
      |                    Span, Reverse bytes |     0.0338ms |     0.0022ms |
      |                    Span, Reverse chars |     0.0339ms |     0.0048ms |
      |                    Span, IndexOf bytes |     0.2533us |     0.1394us |
      |                    Span, IndexOf chars |     0.0201ms |     0.0039ms |
      
      * Feedback, fix string length in the comparison
      
      * Feedback, remove OP_WASM_SIMD_V128_CONST
      
      * s/WasmBase/PackedSimd
      
      And update parameter names and indentation
      
      * Remove Constant method implementation
      
      * Remove `using` clauses
      
      * One more place to remove Constant method
      
      * Fix white space
      4190ef87
    • S
      [wasm-mt] Log exit codes in browser samples to prevent tests from timeouting (#74637) · 704c739c
      Simon Rozsival 提交于
      * Update browser-thread sample
      
      * Update the browser-eventpipe sample
      
      * Fix wasm_exit
      
      * Revert eventpipe sample changes that didn't resolve the problem
      
      * Use new JS api
      
      * Try to use the new API also for the eventpipe sample
      
      * Revert "Try to use the new API also for the eventpipe sample"
      
      This reverts commit 9a10dc4abefcb7a27314be8349b3b93fcc00c3f7.
      704c739c
  14. 25 8月, 2022 2 次提交
    • A
      [wasm] Move all the wasm jobs from runtime-staging to runtime (#73596) · e130a89c
      Ankit Jain 提交于
      * [wasm] Move stable jobs from runtime-staging to runtime
      
      - library tests: windows
      - AOT tests: windows
      - Debugger tests (chrome): windows, and linux
      - Wasm.Build.Tests: windows
      
      * Move last remaining wasm-firefox tests to runtime too
      
      * Move firefox debugger tests to runtime-extra-platforms
      
      * Fix browser-eventpipe build
      
      ```
      src/mono/sample/wasm/browser-eventpipe/Program.cs(80,13): error IDE0074: (NETCORE_ENGINEERING_TELEMETRY=Build) Use compound assignment
      ```
      e130a89c
    • P
      improved perf test (#74514) · c7a4e28c
      Pavel Savara 提交于
      c7a4e28c
  15. 24 8月, 2022 3 次提交
  16. 23 8月, 2022 1 次提交
  17. 22 8月, 2022 1 次提交
  18. 17 8月, 2022 1 次提交
  19. 16 8月, 2022 1 次提交
    • D
      [main] Update dependencies from dotnet/linker (#73894) · 86f1fb55
      dotnet-maestro[bot] 提交于
      * Update dependencies from https://github.com/dotnet/linker build 20220812.4
      
      Microsoft.NET.ILLink.Tasks
       From Version 7.0.100-1.22412.3 -> To Version 7.0.100-1.22412.4
      
      * `System.Runtime.Serialization.Json.ReflectionOnly.Tests` - fix linker
      
      .. errors.
      
      ```
      [22:32:27] fail: [FAIL] DataContractJsonSerializerTests.DCJS_VerifyDateTimeForFormatStringDCJsonSerSettings
      [22:32:27] info: System.InvalidOperationException : No set method for property 'UtcDateTime' in type 'System.Runtime.Serialization.DateTimeOffsetAdapter'.
      [22:32:27] info:    at System.Runtime.Serialization.XmlObjectSerializer.ReadObjectHandleExceptions(XmlReaderDelegator reader, Boolean verifyObjectName, DataContractResolver dataContractResolver)
      [22:32:27] info:    at DataContractJsonSerializerTests.SerializeAndDeserialize[DateTimeOffset](DateTimeOffset value, String baseline, DataContractJsonSerializerSettings settings, Func`1 serializerFactory, Boolean skipStringCompare)
      [22:32:27] info:    at System.Reflection.MethodInvoker.InterpretedInvoke(Object , Span`1 , BindingFlags )
      [22:32:27] fail: [FAIL] DataContractJsonSerializerTests.DCJS_ClassWithDatetimeOffsetTypeProperty
      [22:32:27] info: System.InvalidOperationException : No set method for property 'UtcDateTime' in type 'System.Runtime.Serialization.DateTimeOffsetAdapter'.
      [22:32:27] info:    at System.Runtime.Serialization.XmlObjectSerializer.ReadObjectHandleExceptions(XmlReaderDelegator reader, Boolean verifyObjectName, DataContractResolver dataContractResolver)
      [22:32:27] info:    at DataContractJsonSerializerTests.SerializeAndDeserialize[TypeWithDateTimeOffsetTypeProperty](TypeWithDateTimeOffsetTypeProperty value, String baseline, DataContractJsonSerializerSettings settings, Func`1 serializerFactory, Boolean skipStringCompare)
      [22:32:27] info:    at System.Reflection.MethodInvoker.InterpretedInvoke(Object , Span`1 , BindingFlags )
      ```
      
      * [wasm] System.Runtime.Serialization.Schema.Tests - fix linker errors
      
      ```
        fail: [FAIL] System.Runtime.Serialization.Schema.Tests.ImporterTests.Import(import: Action`1 { Method = Void <Import_MemberData>b__7(System.Runtime.S
      erialization.XsdDataContractImporter), Target = <>c__DisplayClass7_1 { schemaSet = XmlSchemaSet { ... }, typeName = http://schemas.datacontract.org/200
      4/07/System.Runtime.Serialization.Schema.Tests:ImporterTests.SerializableFormatClass } }, codeLength: -1)
        info: System.MissingMethodException : No parameterless constructor defined for type 'Microsoft.CSharp.CSharpCodeProvider'.
        info:    at System.RuntimeType.CreateInstanceMono(Boolean , Boolean )
        info:    at System.RuntimeType.CreateInstanceDefaultCtor(Boolean , Boolean )
        info:    at System.Activator.CreateInstance(Type type, Boolean nonPublic, Boolean wrapExceptions)
        info:    at System.Activator.CreateInstance(Type type, Boolean nonPublic)
        info:    at System.Activator.CreateInstance(Type type)
        info:    at System.CodeDom.Compiler.CompilerInfo.CreateProvider()
        info:    at System.CodeDom.Compiler.CodeDomProvider.CreateProvider(String )
        info:    at System.Runtime.Serialization.Schema.Tests.SchemaUtils.DumpCode(CodeCompileUnit ccu, CodeDomProvider provider)
        info:    at System.Runtime.Serialization.Schema.Tests.ImporterTests.Import(Action`1 import, Int32 codeLength)
        info:    at System.Reflection.MethodInvoker.InterpretedInvoke(Object , Span`1 , BindingFlags )
      ```
      
      * [wasm] System.Runtime.Serialization.Xml.ReflectionOnly.Tests - fix
      
      .. linker errors.
      
      ```
      [02:47:16] fail: [FAIL] DataContractSerializerTests.DCS_MemoryStream_Serialize_UsesBuiltInAdapter
      [02:47:16] info: System.Runtime.Serialization.InvalidDataContractException : No get method for property 'Capacity' in type 'System.Runtime.Serialization.MemoryStreamAdapter'.
      [02:47:16] info:    at System.Runtime.Serialization.DataContracts.DataContract.DataContractCriticalHelper.ThrowInvalidDataContractException(String , Type )
      [02:47:16] info:    at System.Runtime.Serialization.DataContracts.DataContract.DataContractCriticalHelper.ThrowInvalidDataContractException(String )
      [02:47:16] info:    at System.Runtime.Serialization.DataContracts.ClassDataContract.ClassDataContractCriticalHelper.ImportDataMembers()
      [02:47:16] info:    at System.Runtime.Serialization.DataContracts.ClassDataContract.ClassDataContractCriticalHelper..ctor(Type )
      [02:47:16] info:    at System.Runtime.Serialization.DataContracts.ClassDataContract..ctor(Type )
      [02:47:16] info:    at System.Runtime.Serialization.DataContracts.DataContract.DataContractCriticalHelper.CreateDataContract(Type )
      [02:47:16] info:    at System.Runtime.Serialization.DataContracts.DataContract.DataContractCriticalHelper.CreateDataContract(Int32 , RuntimeTypeHandle , Type )
      [02:47:16] info:    at System.Runtime.Serialization.DataContracts.DataContract.DataContractCriticalHelper.GetDataContractSkipValidation(Int32 , RuntimeTypeHandle , Type )
      [02:47:16] info:    at System.Runtime.Serialization.DataContracts.DataContract.GetDataContractSkipValidation(Int32 id, RuntimeTypeHandle typeHandle, Type type)
      [02:47:16] info:    at System.Runtime.Serialization.DataContracts.DataContract.GetDataContract(RuntimeTypeHandle typeHandle, Type type)
      [02:47:16] info:    at System.Runtime.Serialization.DataContracts.DataContract.GetDataContract(Type type)
      [02:47:16] info:    at System.Runtime.Serialization.DataContractSerializer.get_RootContract()
      [02:47:16] info:    at System.Runtime.Serialization.DataContractSerializer.InternalWriteStartObject(XmlWriterDelegator writer, Object graph)
      [02:47:16] info:    at System.Runtime.Serialization.DataContractSerializer.InternalWriteObject(XmlWriterDelegator writer, Object graph, DataContractResolver dataContractResolver)
      [02:47:16] info:    at System.Runtime.Serialization.XmlObjectSerializer.WriteObjectHandleExceptions(XmlWriterDelegator writer, Object graph, DataContractResolver dataContractResolver)
      [02:47:16] info:    at System.Runtime.Serialization.XmlObjectSerializer.WriteObjectHandleExceptions(XmlWriterDelegator writer, Object graph)
      [02:47:16] info:    at System.Runtime.Serialization.XmlObjectSerializer.WriteObject(XmlDictionaryWriter , Object )
      [02:47:16] info:    at System.Runtime.Serialization.XmlObjectSerializer.WriteObject(Stream , Object )
      [02:47:16] info:    at System.Runtime.Serialization.Tests.DataContractSerializerHelper.SerializeAndDeserialize[MemoryStream](MemoryStream value, String baseline, DataContractSerializerSettings settings, Func`1 serializerFactory, Boolean skipStringCompare)
      [02:47:16] info:    at DataContractSerializerTests.<DCS_MemoryStream_Serialize_UsesBuiltInAdapter>g__ValidateObject|240_0(MemoryStream original, String expectedXml, Byte[] expectedData, Int32 expectedPosition, Boolean expectedExposable)
      [02:47:16] info:    at DataContractSerializerTests.DCS_MemoryStream_Serialize_UsesBuiltInAdapter()
      [02:47:16] info:    at System.Reflection.MethodInvoker.InterpretedInvoke(Object , Span`1 , BindingFlags )
      ```
      
      * Fix linker errors - System.Xml.XmlSerializer.ReflectionOnly.Tests
      
      ```
      [02:47:21] fail: [FAIL] XmlSerializerTests.Xml_ImmutableCollections(type: typeof(System.Collections.Immutable.ImmutableArray<int>), collection: [42], createException: null, addException: typeof(System.InvalidOperationException), expectedXml: "<?xml version=\"1.0\" encoding=\"utf-8\"?><ArrayOf"..., exMsg: "Specified method is not supported.")
      [02:47:21] info: System.InvalidOperationException : There was an error generating the XML document.
      [02:47:21] info: ---- System.InvalidOperationException : To be XML serializable, types which inherit from ICollection must have an implementation of Add(System.Int32) at all levels of their inheritance hierarchy. System.Collections.Immutable.ImmutableArray`1[[System.Int32, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]] does not implement Add(System.Int32).
      [02:47:21] info:    at System.Xml.Serialization.XmlSerializer.Serialize(XmlWriter xmlWriter, Object o, XmlSerializerNamespaces namespaces, String encodingStyle, String id)
      [02:47:21] info:    at System.Xml.Serialization.XmlSerializer.Serialize(XmlWriter xmlWriter, Object o, XmlSerializerNamespaces namespaces, String encodingStyle)
      [02:47:21] info:    at System.Xml.Serialization.XmlSerializer.Serialize(XmlWriter xmlWriter, Object o, XmlSerializerNamespaces namespaces)
      [02:47:21] info:    at System.Xml.Serialization.XmlSerializer.Serialize(Stream stream, Object o, XmlSerializerNamespaces namespaces)
      [02:47:21] info:    at System.Xml.Serialization.XmlSerializer.Serialize(Stream stream, Object o)
      [02:47:21] info:    at XmlSerializerTests.Serialize[Object](Object value, String baseline, Func`1 serializerFactory, Boolean skipStringCompare, XmlSerializerNamespaces xns)
      [02:47:21] info:    at XmlSerializerTests.Xml_ImmutableCollections(Type type, Object collection, Type createException, Type addException, String expectedXml, String exMsg)
      [02:47:21] info:    at System.Reflection.MethodInvoker.InterpretedInvoke(Object , Span`1 , BindingFlags )
      [02:47:21] info: ----- Inner Stack Trace -----
      [02:47:21] info:    at System.Xml.Serialization.TypeScope.GetDefaultIndexer(Type , String )
      [02:47:21] info:    at System.Xml.Serialization.TypeScope.GetCollectionElementType(Type , String )
      [02:47:21] info:    at System.Xml.Serialization.TypeScope.ImportTypeDesc(Type , MemberInfo , Boolean )
      [02:47:21] info:    at System.Xml.Serialization.TypeScope.GetTypeDesc(Type , MemberInfo , Boolean , Boolean )
      [02:47:21] info:    at System.Xml.Serialization.TypeScope.GetTypeDesc(Type , MemberInfo , Boolean )
      [02:47:21] info:    at System.Xml.Serialization.ModelScope.GetTypeModel(Type , Boolean )
      [02:47:21] info:    at System.Xml.Serialization.ModelScope.GetTypeModel(Type )
      [02:47:21] info:    at System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping(Type , XmlRootAttribute , String )
      [02:47:21] info:    at System.Xml.Serialization.XmlSerializer.GenerateXmlTypeMapping(Type type, XmlAttributeOverrides overrides, Type[] extraTypes, XmlRootAttribute root, String defaultNamespace)
      [02:47:21] info:    at System.Xml.Serialization.XmlSerializer.GetMapping()
      [02:47:21] info:    at System.Xml.Serialization.XmlSerializer.SerializeUsingReflection(XmlWriter xmlWriter, Object o, XmlSerializerNamespaces namespaces, String encodingStyle, String id)
      [02:47:21] info:    at System.Xml.Serialization.XmlSerializer.Serialize(XmlWriter xmlWriter, Object o, XmlSerializerNamespaces namespaces, String encodingStyle, String id)
      ```
      
      * [wasm] Fix trimming errors in event-pipe sample
      
      `IL2121` was disabled for samples, but the project discard the value of
      `$(NoWarn)`, thus missing the warning code.
      
      ```
      ILLink : Trim analysis error IL2121: System.Diagnostics.Tracing.EventSource: Unused 'UnconditionalSuppressMessageAttribute' for warning 'IL2113'. Consi
      der removing the unused warning suppression. [/workspaces/runtime/src/mono/sample/wasm/browser-eventpipe/Wasm.Browser.EventPipe.Sample.csproj]
      ILLink : Trim analysis error IL2121: System.Diagnostics.Tracing.EventSource: Unused 'UnconditionalSuppressMessageAttribute' for warning 'IL2115'. Consi
      der removing the unused warning suppression. [/workspaces/runtime/src/mono/sample/wasm/browser-eventpipe/Wasm.Browser.EventPipe.Sample.csproj]
      /workspaces/runtime/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventSource.cs(885,9): Trim analysis error IL2121: System.Diagn
      ostics.Tracing.EventSource.WriteEvent(Int32, Int64, Int64, Int64): Unused 'UnconditionalSuppressMessageAttribute' for warning 'IL2026'. Consider removi
      ng the unused warning suppression. [/workspaces/runtime/src/mono/sample/wasm/browser-eventpipe/Wasm.Browser.EventPipe.Sample.csproj]
      /workspaces/runtime/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventSource.cs(1067,9): Trim analysis error IL2121: System.Diag
      nostics.Tracing.EventSource.WriteEvent(Int32, Int32, String): Unused 'UnconditionalSuppressMessageAttribute' for warning 'IL2026'. Consider removing th
      e unused warning suppression. [/workspaces/runtime/src/mono/sample/wasm/browser-eventpipe/Wasm.Browser.EventPipe.Sample.csproj]
      /workspaces/runtime/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventSource.cs(955,9): Trim analysis error IL2121: System.Diagn
      ostics.Tracing.EventSource.WriteEvent(Int32, String, String, String): Unused 'UnconditionalSuppressMessageAttribute' for warning 'IL2026'. Consider rem
      oving the unused warning suppression. [/workspaces/runtime/src/mono/sample/wasm/browser-eventpipe/Wasm.Browser.EventPipe.Sample.csproj]
      /workspaces/runtime/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventSource.cs(927,9): Trim analysis error IL2121: System.Diagnostics.Tracing.EventSource.WriteEvent(Int32, String, String): Unused 'UnconditionalSuppressMessageAttribute' for warning 'IL2026'. Consider removing the unused warning suppression. [/workspaces/runtime/src/mono/sample/wasm/browser-eventpipe/Wasm.Browser.EventPipe.Sample.csproj]
      /workspaces/runtime/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventSource.cs(796,9): Trim analysis error IL2121: System.Diagnostics.Tracing.EventSource.WriteEvent(Int32, Int32): Unused 'UnconditionalSuppressMessageAttribute' for warning 'IL2026'. Consider removing the unused warning suppression. [/workspaces/runtime/src/mono/sample/wasm/browser-eventpipe/Wasm.Browser.EventPipe.Sample.csproj]
      /workspaces/runtime/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventSource.cs(1366,13): Trim analysis error IL2121: System.Diagnostics.Tracing.EventSource.WriteEvent(Int32, Object[]): Unused 'UnconditionalSuppressMessageAttribute' for warning 'IL2112'. Consider removing the unused warning suppression. [/workspaces/runtime/src/mono/sample/wasm/browser-eventpipe/Wasm.Browser.EventPipe.Sample.csproj]
      /workspaces/runtime/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventSource.cs(904,9): Trim analysis error IL2121: System.Diagnostics.Tracing.EventSource.WriteEvent(Int32, String): Unused 'UnconditionalSuppressMessageAttribute' for warning 'IL2026'. Consider removing the unused warning suppression. [/workspaces/runtime/src/mono/sample/wasm/browser-eventpipe/Wasm.Browser.EventPipe.Sample.csproj]
      /workspaces/runtime/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventSource.cs(1236,13): Trim analysis error IL2121: System.Diagnostics.Tracing.EventSource.WriteEventCore(Int32, Int32, EventData*): Unused 'UnconditionalSuppressMessageAttribute' for warning 'IL2112'. Consider removing the unused warning suppression. [/workspaces/runtime/src/mono/sample/wasm/browser-eventpipe/Wasm.Browser.EventPipe.Sample.csproj]
      /workspaces/runtime/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventSource.cs(1959,9): Trim analysis error IL2121: System.Diagnostics.Tracing.EventSource.WriteEventVarargs(Int32, Guid*, Object[]): Unused 'UnconditionalSuppressMessageAttribute' for warning 'IL2112'. Consider removing the unused warning suppression. [/workspaces/runtime/src/mono/sample/wasm/browser-eventpipe/Wasm.Browser.EventPipe.Sample.csproj]
      /workspaces/runtime/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventSource.cs(1350,9): Trim analysis error IL2121: System.Diagnostics.Tracing.EventSource.WriteEventWithRelatedActivityIdCore(Int32, Guid*, Int32, EventData*): Unused 'UnconditionalSuppressMessageAttribute' for warning 'IL2112'. Consider removing the unused warning suppression. [/workspaces/runtime/src/mono/sample/wasm/browser-eventpipe/Wasm.Browser.EventPipe.Sa
      mple.csproj]
      ILLink : Trim analysis error IL2121: System.Resources.ResourceReader.DeserializeObject(Int32): Unused 'UnconditionalSuppressMessageAttribute' for warni
      ng 'IL2026'. Consider removing the unused warning suppression. [/workspaces/runtime/src/mono/sample/wasm/browser-eventpipe/Wasm.Browser.EventPipe.Sampl
      e.csproj]
      ```
      
      Fixes https://github.com/dotnet/runtime/issues/73933 .
      
      * [wasm] Disable tests failing with trimming
      Co-authored-by: Ndotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
      Co-authored-by: NAnkit Jain <radical@gmail.com>
      86f1fb55
  20. 15 8月, 2022 1 次提交
    • P
      [wasm] cleanup testing and host support in templatest and tests (#73785) · 906ec1d3
      Pavel Savara 提交于
      * wip
      
      * wip
      
      * wip
      
      * Single instance in create method.
      
      * withMainAssembly
      
      * withAsyncFlushOnExit
      
      * Fix exporting INTERNAL api.
      
      Move all legacy API object creation to dotnet.es6.post.js where module export is created.
      
      * fix release build
      
      * Move virtualWorkingDirectory initialization to the create method, so it is used in both scenarios (run & create).
      
      * Fix applicationArguments in templates.
      
      * Update WBT.
      
      * Fix ENVIRONMENT_IS_*.
      
      * Move pthreadPoolSize to MonoConfig (from internal).
      
      Fix merge error.
      
      * Fix ConsolePublishAndRun.
      
      * Update readme.md in templates.
      
      * Update WasmAppHost to always pass application arguments as query string.
      
      Add API for parsing applications arguments passed by the WasmAppHost.
      Co-authored-by: NMarek Fišera <mara@neptuo.com>
      906ec1d3
  21. 14 8月, 2022 2 次提交
    • A
      [wasm] Misc tests related fixes (#73884) · 7d986fa0
      Ankit Jain 提交于
      * [wasm] Stop running crypto tests with subtlecrypto
      
      * [wasm] Add --web-server-use-cop for samples when running on helix for a threaded build
      
      * [wasm] Makefile, honor V=1 and emit binlog
      
      * [wasm] PInvokeTableGenerator: emit the type name also, for the warning
      
      * [wasm] Improve build for non-default runtime packs
      
      .. by using `MSBuild` task to build them instead of invoking
      `dotnet.sh`.
      - And fix incremental builds
      
      * [wasm] Run smoke tests only for AOT
      
      - Building, and running all the tests for EAT case will help catch
      linker errors that can slip through.
      
      * [wasm] Fix linker errors for tests
      
      Fixes https://github.com/dotnet/runtime/issues/73901
      7d986fa0
    • A
      [wasm-mt] Use asset loading for dotnet.worker.js; update WasmAppBuilder (#73697) · 88ba0454
      Aleksey Kliger (λgeek) 提交于
      Enables using asset loading to get the `dotnet.worker.js` file that provides the emscripten pthread worker code.
      Also allows specifying the number of pre-allocated workers that will be created at startup using MSBuild properties.
      
      Fixes https://github.com/dotnet/runtime/issues/68509 and fixes https://github.com/dotnet/runtime/issues/68397 and fixes https://github.com/dotnet/runtime/issues/72606
      
      - Override Emscripten `PThread.allocateUnusedWorker`
         We want to use our own allocateUnusedWorker because we want to load
         `dotnet.worker.js` using our asset loading machinery.
      
         Unfortunately, Emscripten first calls allocateUnusedWorker very early (from
         `PThread.init`) to pre-allocate the pthread worker pool.
      
         So we set Emscripten's own pthread worker pool to size 0 and make our own.  This requires calling `loadWasmModuleToWorker` during our startup because Emscripten deletes their code that normally does it (in "receiveInstance" in "createWasm" in "emscripten/src/preamble.js") when the pthread pool size is 0.
      
         Also added a pthreadPoolSize field to MonoConfig to allow specifying the initial pthread pool size in mono-config.json
      
      - Add `IncludeThreadsWorker` and `PThreadPoolSize` props to WasmAppBuilder
      
         `IncludeThreadsWorker` adds the `"js-module-threads"` asset to the `mono-config.json`
      
         `PThreadPoolSize` can be -1 or >=0 to specify the number of workers that will be pre-allocated at startup for the pthread worker pool.  -1 means use the default compiled into `dotnet.js`
      
      - Reorganize the pthreads TS code by moving `Internals` (access API that digs through Emscripten's pthreads implementation) to its own module. And add types.
      
      - Replace emscripten's `allocateUnusedWorker` function with our own that goes through the asset loading API.
      
      - Update samples
      
      - Set up console proxying for the workers.
         This is done by sending a message from the main thread to the pthread workers with the current `MonoConfig` on our
          dedicated channel.  (This means the proxying is setup asynchronously, so if the worker is busy before it receives the message, it may not start redirecting messages right away).
      
      ---
      
      * [wasm-mt] Override Emscripten PThread.allocateUnusedWorker
      
      We want to use our own allocateUnusedWorker because we want to load `dotnet.worker.js` using our asset loading machinery.
      
      Unfortunately, Emscripten first calls allocateUnusedWorker very early (from `PThread.init`) to pre-allocate the pthread worker pool.
      
      So we set Emscripten's own pthread worker pool to size 0 and make our own.  This requires calling `loadWasmModuleToWorker` during our startup because Emscripten deletes their code that normally does
      it (in "receiveInstance" in "createWasm" in "emscripten/src/preamble.js") when the pthread pool size is 0.
      
      Also added a pthreadPoolSize field to MonoConfig to allow specifying the initial pthread pool size in mono-config.json
      
      * Add IncludeThreadsWorker and PThreadPoolSize props to WasmAppBuilder
      
      IncludeThreadsWorker adds the js-module-threads asset to the mono-config
      
      PThreadPoolSize can be -1 or >=0 to specify the number of workers that will be pre-allocated at startup for the pthread worker pool.  -1 means use the default compiled into dotnet.js
      
      * Move emscripten PThread internals access to a separate module
      
         and add types
      
      * Load js-module-threads asset in replacement allocateUnusedWorker
      
      * Update samples to explicitly enable threading / perftracing
      
         Makes the WasmAppBuilder include the threads worker module
      
      * tighten up Internals types
      
      * apply review feedback
      
      * fix import
      
      * Apply suggestions from code review
      
      * proxy pthread worker messages to websocket, if enabled
      
      use a new MonoThreadMessageApplyMonoConfig message to send the MonoConfig from the main thread to each worker when the workers set up the communication channel to the main thread.
      
      then if the diagnosticTracing property is true, redirect the worker console logging to a websocket.
      
      Fixes https://github.com/dotnet/runtime/issues/72606Co-authored-by: NMarek Fišera <mara@neptuo.com>
      Co-authored-by: NAnkit Jain <radical@gmail.com>
      88ba0454
  22. 13 8月, 2022 1 次提交
  23. 12 8月, 2022 1 次提交
    • K
      Introduce a default synchronization context for wasm (#72652) · 55f5c7c0
      Katelyn Gadd 提交于
      Introduce a JSSynchronizationContext that automatically remotes function calls back to the browser thread and queues them as background jobs.
      Exercise sync context in threads sample to display the complete progress indicator
      Clean up an old copy-paste error in the typescript
      55f5c7c0
  24. 11 8月, 2022 1 次提交
  25. 10 8月, 2022 2 次提交
    • M
      [wasm] Update javascript API usage in samples and tests (#73367) · 30c1c2c2
      Marek Fišera 提交于
      - Use object instead of callback.
      - Replace bind_static_method with getAssemblyExports.
      - Drop MethodImplAttribute where JSExport is present.
      - Drop es6 from sample folder names.
      30c1c2c2
    • P
      [wasm] asset loading for workers (#73484) · de03d8a8
      Pavel Savara 提交于
      - move asset related logic to separate file`assets.ts`
      - split logging code into separate file `logging.ts`
      - add `dotnet.wasm` and `dotnet-crypto-worker.js` to mono-config.json
      - moved `readSymbolMapFile()` call to `startup.ts`
      - fixed bug in `setup_proxy_console()` which didn't really copy the original `log` and `error` functions of the console and caused recursion on error.
      - moved `init_crypto` after `mono_wasm_load_config` in `mono_wasm_pre_init_essential_async`
      - added new resource type `js-module-crypto` and `js-module-threads`
      - changed the detection of blazor startup sequence to not be disabled by presence of config, but only by config.assets having some assembly in it.
      Co-authored-by: NMarek Fišera <mara@neptuo.com>
      de03d8a8
  26. 09 8月, 2022 2 次提交
    • A
      [wasm-ep] Remove old sample and JS-based diagnostics (#73586) · f1959180
      Aleksey Kliger (λgeek) 提交于
      * [wasm-ep] remove in-JS VFS tracing support
      
      use the websocket diagnostic server support instead
      
      * remove browser-mt-eventpipe sample
      
      use the browser-threading sample for working with threading
      use the browser-eventpipe sample for working with tracing
      
      * remove the EventPipeSessionOptions, too
      f1959180
    • A
      [wasm-ep] Use DOTNET_DiagnosticPorts to configure Diagnostic Server (#73370) · 89db9c05
      Aleksey Kliger (λgeek) 提交于
      * [wasm-ep] Use DOTNET_DiagnosticPorts to configure Diagnostic Server
      
      Parse it the same way that the C code does:
      
      ```
         <uri>[,<connect|listen>][,<suspend|nosuspend>]
      ```
      
      - uri should be a websocket uri
      - listen is not supported as it doesn't make sense with a WebSocket
      - connect is the default if omitted
      - suspend is the default if omitted
      
      ---
      
      Additionally, move `mono_wasm_diagnostics_init` to later in the
      startup flow.  This gives Blazor a chance to set
      DOTNET_DiagnosticPorts from their `onRuntimeInitialized` callback.
      
      Fixes https://github.com/dotnet/runtime/issues/73011
      
      * Initialize diagnostic server in different places for Blazor and non-Blazor
      
      It has to be after environment variables are set, but before
      mono_wasm_load_runtime is called.
      
      There is no good place that's common to both startup paths. Try it on
      both.  Use a flag to make diagnostics initialization run at most
      once
      
      * update browser-eventpipe sample to use DOTNET_DiagnosticPorts
      
      * remove unused imports
      89db9c05
  27. 06 8月, 2022 1 次提交
    • A
      [wasm-mt] Remove two-phase suspend; fix state transitions in DS server; fix merge (#73305) · 2ad7b1af
      Aleksey Kliger (λgeek) 提交于
      Grab bag of threading fixes:
      
      1. Remove the coop two-phase transition (Partially revert 6726fae1).  This was based on a misunderstanding of how Emscripten works: when the main thread is blocked in a concurrency primitive like `sem_wait`, it is still processing queued calls from other threads.  So there is no need to first suspend the worker threads and then suspend the main thread.  The implementation of two-phase suspend had a bug where it would suspend worker threads twice, making the suspend increase by 2. Since resume only decremented the count by 1, this lead to a suspend count overflow.  Fixes #72857 
      2. Once the diagnostic server attaches to the runtime, switch it to GC Safe mode when it returns to JavaScript.  That is, while the diagnostic server is reacting to messages in the JS event loop, it is considered suspended by the runtime.  When it calls into C, switch to GC Unsafe (which may block if there's a STW happening).  Add thread state transitions when we come back to C, and when we wait.
      3. Mark the wasm diagnostic server thread as "no sample; no gc" which means that we don't consider it for STW when there's a GC or a sample profiler active.  This is how we treat utility threads (including the non-wasm diagnostic server thread) on other platforms.
      4. Fix a bad signature for `cwraps.mono_wasm_event_pipe_enable` due to a mistake in a previous merge
      5. Added a new `browser-threads` sample
      
      ---
      
      * [coop] Don't call begin_suspend_request_suspension_cordially twice
      
      Each call to begin_suspend_request_suspension_cordially may increment
      the suspend count.  But in STW we only resume each thread once.
      
      In 6726fae1 we added a second phase of
      STW to full coop on WebAssembly in order to suspend the browser thread
      after all the worker threads have been suspended in order to avoid
      some deadlocks that rely on the main thread continuing to process
      async work on behalf of the workers before they reach a safepoint.
      
      The problem is that for worker threads we could end up calling
      begin_suspend_request_suspension_cordially twice. If the thread
      self-suspends after the first call, the second call will increment the
      suspend count.  As a result, when we restart the world, the thread
      will decrement its suspend count, but still stay suspended.  Worse, on
      the _next_ stw, we will increment the suspend count two more times and
      decrement once on the next restart, etc.
      
      Eventually the thread will overflow the suspend counter and we will
      assert `!(suspend_count > 0)`.
      
      Also change `THREAD_SUSPEND_COUNT_MAX` to `0x7F` (from `0xFF`) - the
      suspend count is signed, so the roll-over from 127 to -128 is where we
      should assert
      
      Fixes https://github.com/dotnet/runtime/issues/72857
      
      * improve thread state machine assertion messages
      
         include thread states and thread ids where available
      
      * fix typo
      
      * Revert "[coop] Don't call begin_suspend_request_suspension_cordially twice"
      
      This reverts commit 92f52ab7ed1cfaa1a4f66e869a8d9404e066f1b2.
      
      * [threads] Revert coop two-phase STW
      
      Remove mono_threads_platform_stw_defer_initial_suspend
      
      The motivation for it in 6726fae1
      was unfounded.  There is no need to suspend the main browser thread
      after the other threads: suspension on wasm uses `sem_wait` which on
      Emscripten on the main thread is implemented using a busy wait
      `__timedwait_cp` which processes queued calls.  So even if we suspend
      the main thread first, it will still allow other threads in GC Safe to
      make progress if they're using syscalls.
      
      * Switch the diagnostics server to GC Safe when returning to JS; set NO_GC flag
      
      The diagnostic server worker spends most of its time in the JS event
      loop waiting for messages.  After we attach to the runtime, we need to
      switch to GC Safe mode because the diagnostic server may not ever
      reach a safepoint (for example if no more DS events arrive).
      
      Conversely, when we call from JS into the C diagnostic server, we need
      to enter GC Unsafe mode (and potentially safepoint).
      
      Also mark the diagnostic server threads with the NO_GC flag - this
      thread does not manipulate managed objects so it doesn't need to stop
      for GC STW.
      
      * cwraps: fix bad signature for mono_wasm_event_pipe_enable
      
         Mistake from a previous merge
      
      * Add new browser-threads sample
      
      * exclude the browser-threads sample unless wasm threads are enabled
      
      * Update browser-threads sample
      
      * Update src/mono/mono/component/diagnostics_server.c
      
      * Update src/mono/mono/utils/mono-threads-state-machine.c
      Co-authored-by: NKatelyn Gadd <kg@luminance.org>
      2ad7b1af