Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[perf pipeline] Perf_BigInteger.ModPow failing with System.ArgumentException: Destination is too short. (Parameter 'destination') #2575

Closed
radical opened this issue Aug 24, 2022 · 8 comments · Fixed by dotnet/runtime#74585
Labels
pipeline blocker issue blocks perf pipeline stays green. This be considered high priority.

Comments

@radical
Copy link
Member

radical commented Aug 24, 2022

Log from runtime-wasm-perf run on dotnet/runtime#74097:

// **************************
// Benchmark: Perf_BigInteger.ModPow: Job-BJXMHI(PowerPlanMode=00000000-0000-0000-0000-000000000000, Runtime=Wasm, Toolchain=Wasm, InvocationCount=1, IterationCount=1, IterationTime=250.0000 ms, MaxIterationCount=20, MinIterationCount=15, RunStrategy=ColdStart, UnrollFactor=1, WarmupCount=0) [arguments=1024,1024,64 bits]
// *** Execute ***
// Launch: 1 / 1
// Execute: /home/helixbot/.jsvu/v8 --expose_wasm test-main.js -- --run 95a3fee8-6d92-4c8b-8059-369b73cd756f.dll --benchmarkName "System.Numerics.Tests.Perf_BigInteger.ModPow(arguments: 1024,1024,64 bits)" --job "PowerPlanMode=00000000-0000-0000-0000-000000000000, Runtime=Wasm, Toolchain=Wasm, InvocationCount=1, IterationCount=1, IterationTime=250.0000 ms, MaxIterationCount=20, MinIterationCount=15, RunStrategy=ColdStart, UnrollFactor=1, WarmupCount=0" --benchmarkId 67  in /datadisks/disk1/work/A6C10953/w/B67009A6/e/performance/artifacts/bin/for-running/MicroBenchmarks/95a3fee8-6d92-4c8b-8059-369b73cd756f/bin/net7.0/browser-wasm/AppBundle
Failed to set up high priority. Make sure you have the right permissions. Message: Permission denied
Incoming arguments: --run 95a3fee8-6d92-4c8b-8059-369b73cd756f.dll --benchmarkName System.Numerics.Tests.Perf_BigInteger.ModPow(arguments: 1024,1024,64 bits) --job PowerPlanMode=00000000-0000-0000-0000-000000000000, Runtime=Wasm, Toolchain=Wasm, InvocationCount=1, IterationCount=1, IterationTime=250.0000 ms, MaxIterationCount=20, MinIterationCount=15, RunStrategy=ColdStart, UnrollFactor=1, WarmupCount=0 --benchmarkId 67
Application arguments: --run 95a3fee8-6d92-4c8b-8059-369b73cd756f.dll --benchmarkName System.Numerics.Tests.Perf_BigInteger.ModPow(arguments: 1024,1024,64 bits) --job PowerPlanMode=00000000-0000-0000-0000-000000000000, Runtime=Wasm, Toolchain=Wasm, InvocationCount=1, IterationCount=1, IterationTime=250.0000 ms, MaxIterationCount=20, MinIterationCount=15, RunStrategy=ColdStart, UnrollFactor=1, WarmupCount=0 --benchmarkId 67
console.debug: mono_wasm_runtime_ready fe00e07a-5519-4dfe-b35a-f867dbaf2e28
console.info: Initializing.....
// BeforeAnythingElse

// Benchmark Process Environment Information:
// Runtime=.NET Core (Mono) 8.0.0-ci, Wasm NativeAOT
// GC=Non-concurrent Workstation
// HardwareIntrinsics=
// Job: Job-WFMUPX(PowerPlanMode=00000000-0000-0000-0000-000000000000, InvocationCount=1, IterationCount=1, IterationTime=250.0000 ms, MaxIterationCount=20, MinIterationCount=15, RunStrategy=ColdStart, UnrollFactor=1, WarmupCount=0)

// BeforeActualRun

...

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
 ---> System.ArgumentException: Destination is too short. (Parameter 'destination')
   at System.Numerics.BigIntegerCalculator.PowCore(Span`1 , Int32 , ReadOnlySpan`1 , ReadOnlySpan`1 , Span`1 , Span`1 )
   at System.Numerics.BigIntegerCalculator.Pow(ReadOnlySpan`1 , ReadOnlySpan`1 , ReadOnlySpan`1 , Span`1 )
   at System.Numerics.BigInteger.ModPow(BigInteger , BigInteger , BigInteger )
   at System.Numerics.Tests.Perf_BigInteger.ModPow(BigIntegers arguments)
   at BenchmarkDotNet.Autogenerated.Runnable_67.WorkloadActionUnroll(Int64 invokeCount)
   at BenchmarkDotNet.Engines.Engine.RunIteration(IterationData data)
   at BenchmarkDotNet.Engines.EngineStage.RunIteration(IterationMode mode, IterationStage stage, Int32 index, Int64 invokeCount, Int32 unrollFactor)
   at BenchmarkDotNet.Engines.EngineActualStage.RunSpecific(Int64 invokeCount, IterationMode iterationMode, Int32 iterationCount, Int32 unrollFactor)
   at BenchmarkDotNet.Engines.EngineActualStage.Run(Int64 invokeCount, IterationMode iterationMode, Boolean runAuto, Int32 unrollFactor, Boolean forceSpecific)
   at BenchmarkDotNet.Engines.EngineActualStage.RunWorkload(Int64 invokeCount, Int32 unrollFactor, Boolean forceSpecific)
   at BenchmarkDotNet.Engines.Engine.Run()
   at BenchmarkDotNet.Autogenerated.Runnable_67.Run(IHost host, String benchmarkName)
   at System.Reflection.MethodInvoker.InterpretedInvoke(Object , Span`1 , BindingFlags )
   --- End of inner exception stack trace ---
   at System.Reflection.RuntimeMethodInfo.Invoke(Object , BindingFlags , Binder , Object[] , CultureInfo )
   at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
   at BenchmarkDotNet.Autogenerated.UniqueProgramName.AfterAssemblyLoadingAttached(String[] args)
// AfterAll
{"name":"ExitStatus","message":"Program terminated with exit(-1)","status":-1}
No Workload Results were obtained from the run.
// Benchmark Process 4941 has exited with code 255.

This is reproducible on main, with interpreter.

cc @adamsitnik @LoopedBard3 @lewing

@radical radical added the pipeline blocker issue blocks perf pipeline stays green. This be considered high priority. label Aug 24, 2022
@adamsitnik
Copy link
Member

It's also reproducible with CLR. Repro:

py .\scripts\benchmarks_ci.py -f net7.0 --filter System.Numerics.Tests.Perf_BigInteger.ModPow
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
 ---> System.ArgumentException: Destination is too short. (Parameter 'destination')
   at System.Numerics.BigIntegerCalculator.PowCore(Span`1 value, Int32 valueLength, ReadOnlySpan`1 power, ReadOnlySpan`1 modulus, Span`1 temp, Span`1 bits)
   at System.Numerics.BigIntegerCalculator.Pow(ReadOnlySpan`1 value, ReadOnlySpan`1 power, ReadOnlySpan`1 modulus, Span`1 bits)
   at System.Numerics.BigInteger.ModPow(BigInteger value, BigInteger exponent, BigInteger modulus)
   at System.Numerics.Tests.Perf_BigInteger.ModPow(BigIntegers arguments) in D:\projects\performance\src\benchmarks\micro\libraries\System.Runtime.Numerics\Perf.BigInteger.cs:line 101
   at BenchmarkDotNet.Autogenerated.Runnable_0.WorkloadActionNoUnroll(Int64 invokeCount) in D:\projects\performance\artifacts\bin\MicroBenchmarks\Release\net7.0\faa7e6d1-41e0-4e3d-8e1e-9d83759c269a\faa7e6d1-41e0-4e3d-8e1e-9d83759c269a.notcs:line 329
   at BenchmarkDotNet.Engines.Engine.RunIteration(IterationData data)
   at BenchmarkDotNet.Engines.EngineFactory.Jit(Engine engine, Int32 jitIndex, Int32 invokeCount, Int32 unrollFactor)
   at BenchmarkDotNet.Engines.EngineFactory.CreateReadyToRun(EngineParameters engineParameters)
   at BenchmarkDotNet.Autogenerated.Runnable_0.Run(IHost host, String benchmarkName) in D:\projects\performance\artifacts\bin\MicroBenchmarks\Release\net7.0\faa7e6d1-41e0-4e3d-8e1e-9d83759c269a\faa7e6d1-41e0-4e3d-8e1e-9d83759c269a.notcs:line 179
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
   at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
   --- End of inner exception stack trace ---
   at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
   at BenchmarkDotNet.Autogenerated.UniqueProgramName.AfterAssemblyLoadingAttached(String[] args) in D:\projects\performance\artifacts\bin\MicroBenchmarks\Release\net7.0\faa7e6d1-41e0-4e3d-8e1e-9d83759c269a\faa7e6d1-41e0-4e3d-8e1e-9d83759c269a.notcs:line 58
// AfterAll

@dakersnar @tannergooding Has a recent change in dotnet/runtime introduced a product bug or exposed a benchmark bug?

@tannergooding
Copy link
Member

Looks like a product bug, investigating. Most likely caused by dotnet/runtime#74112

@adamsitnik
Copy link
Member

Closed by #2578

tannergooding added a commit to dotnet/runtime that referenced this issue Aug 26, 2022
* Adding a regression test for dotnet/performance#2575

* Ensure that the result span is fully initialized.
github-actions bot pushed a commit to dotnet/runtime that referenced this issue Aug 26, 2022
carlossanlop pushed a commit to dotnet/runtime that referenced this issue Aug 28, 2022
…74672)

* Adding a regression test for dotnet/performance#2575

* Ensure that the result span is fully initialized.

Co-authored-by: Tanner Gooding <tagoo@outlook.com>
radical added a commit to radical/performance that referenced this issue Sep 2, 2022
@radical
Copy link
Member Author

radical commented Sep 6, 2022

This doesn't seem to have been fixed by dotnet/runtime#74585. #2590 re-enables the benchmark, but gets the same error.
cc @tannergooding

@radical radical reopened this Sep 6, 2022
@dakersnar
Copy link
Contributor

Looking into this right now.

@tannergooding
Copy link
Member

I'd expect we're just not on the right build. A regression test for the exact value the perf test fails on was added.

@dakersnar
Copy link
Contributor

dakersnar commented Sep 6, 2022

It looks like dotnet/installer is still pointing to https://github.com/dotnet/runtime/tree/ef077d0b58ffddcf54fa73bd85dace6b999b8992, which is 3 days before the ModPow fix was merged into main. This should be resolved once dotnet/installer points to an updated dotnet/runtime.

@adamsitnik
Copy link
Member

fixed by dotnet/runtime#74585 and #2590

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pipeline blocker issue blocks perf pipeline stays green. This be considered high priority.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants