dotnet / performance

This repo contains benchmarks used for testing the performance of all .NET Runtimes
MIT License
701 stars 272 forks source link

Customer Request: Add Wasm to issue ADX query #4531

Open LoopedBard3 opened 3 weeks ago

LoopedBard3 commented 3 weeks ago

Request is to update the generated ADX query in autofiled issues to include WASM similar to how Mono is included. New base query is as follows:

Measurements
| where BuildRepo == 'dotnet/runtime'
| where BuildBranch == 'refs/heads/main'
| where BuildArchitecture in ('x64', 'arm64')
| where TestName == @'System.Memory.Span<Byte>.Clear(Size: 512)'
// Mono
// | where RunConfigurations['CompilationMode'] =~ 'tiered'
// | where RunConfigurations['RunKind'] =~ 'micro_mono'
// | where RunConfigurations['LLVM'] =~ 'true'
// | where RunConfigurations['MonoAOT'] =~ 'true'
// | where RunConfigurations['MonoInterpreter'] =~ 'false'
// WASM
// | where RunConfigurations['AOT'] =~ 'true'
// | where RunConfigurations['RunKind'] =~ 'micro'
| where (RunConfigurations['CompilationMode'] =~ 'tiered' and RunConfigurations['RunKind'] =~ 'micro_mono') or (RunConfigurations['CompilationMode'] =~ 'wasm' and RunConfigurations['RunKind'] =~ 'micro')
| where isempty(RunConfigurationsIosLlvmBuild)
| where isempty(RunConfigurationsJsEngine)
| where isempty(RunConfigurationsPgoType)
| where isempty(RunConfigurationsPhysicalPromotionType)
| where isempty(RunConfigurationsHybridGlobalization)
| where isempty(RunConfigurationsR2RType)
| where isempty(RunConfigurationsExperimentName)
| where TestCounterTopCounter
| where BuildTimeStamp > datetime(2024-08-15T09:19:27.5358056+00:00)
| extend RuntimeName=iff(RunConfigurations['RunKind'] =~ 'micro_mono', "mono", "wasm")
| extend Series=strcat(RuntimeName, "-", FriendlyQueueName(RunQueue), iff(tobool(RunConfigurationsMonoAot) or tobool(RunConfigurationsAot), "-AOT", ""), iff(tobool(RunConfigurationsMonoInterpreter), "-Interp", ""), iff(tobool(RunConfigurationsLlvm), "-LLVM", ""))
| summarize arg_max(BuildName, *) by BuildTimeStamp, TestName, Series
| project BuildTimeStamp, Result=round(TestCounterResultAverage, 3), Series
| render timechart with (series=Series, xcolumn=BuildTimeStamp, ycolumns=Result, xtitle='Date', ytitle='Time (ns)')
matouskozak commented 2 weeks ago

fyi: @radekdoulik

caaavik-msft commented 2 weeks ago

Instead of updating the query in our autofiler code everytime, I'm working on a stored function for our Azure Data Explorer cluster that we can define this in instead. Here is the function I have defined as a work-in-progress so far and it is already available on our ADX to experiment with:

.create-or-alter function GetHistoricalDataWithComparisons(test: string, counter: string = "", repo: string = "", branch: string = "", after: datetime = datetime(null)) 
{
    let afterValue = iff(isnull(after), ago(60d), after);
    Measurements 
    | where repo == "" or BuildRepo == repo
    | where (branch == "" and (BuildBranch  == "refs/heads/main" or BuildBranch == "9.0")) or BuildBranch == branch
    | where TestName == test
    | where iff(counter == "", TestCounterTopCounter, TestCounterName == counter)
    | where BuildTimeStamp > afterValue
    | summarize arg_max(QualityLevel, *) by RunId, TestId
    | extend ConfigShort = strcat(
      iff(RunConfigurationsCompilationMode == "wasm", "-wasm", ""),
      iff(RunConfigurationsRunKind == "micro_mono", "-mono", ""),
      iff(RunConfigurationsExperimentName != "", strcat("-", RunConfigurationsExperimentName), ""),
      iff(RunConfigurationsPgoType != "", strcat("-", RunConfigurationsPgoType), ""),
      iff(RunConfigurationsHybridGlobalization != "", "-HybridGlobalization", ""),
      iff(RunConfigurationsR2RType != "", strcat("-", RunConfigurationsR2RType), ""),
      iff(tobool(RunConfigurationsAot) or tobool(RunConfigurationsMonoAot),"-AOT", ""),
      iff(tobool(RunConfigurationsMonoInterpreter),"-Interp", ""),
      iff(tostring(RunConfigurations["RuntimeType"]) != "", strcat("-", tostring(RunConfigurations["RuntimeType"])), ""),
      iff(tobool(RunConfigurations["iOSStripSymbols"]),"-iOSStripSymbols", ""),
      iff(tobool(RunConfigurationsLlvm) or tobool(RunConfigurationsIosLlvmBuild),"-LLVM", ""),
      iff(tobool(RunConfigurationsJsEngine),strcat("-", RunConfigurationsJsEngine), ""),
      iff(RunConfigurationsPhysicalPromotionType != "", strcat("-", RunConfigurationsPhysicalPromotionType), ""))
    | extend Series = strcat(FriendlyQueueName(RunQueue), iff(BuildArchitecture == "x86", "-x86", ""), ConfigShort)
}

Then an example usage of this which renders the chart would be

GetHistoricalDataWithComparisons(@'System.Memory.Span<Byte>.BinarySearch(Size: 512)', after=datetime(2024-08-22T09:01:51.8330745+00:00))
// | where RunConfigurationsRunKind == "micro_mono" or RunConfigurationsCompilationMode == "wasm"
| project BuildTimeStamp, Result=round(TestCounterResultAverage, 3), Series
| render timechart with (series=Series, xcolumn=BuildTimeStamp, ycolumns=Result, xtitle='Date', ytitle='Time (ns)')

So we would just generate this query inside our auto-filter instead of the full query.

What did we think of this approach? For most microbenchmarks this causes way too many series by default so need to decide what might be some sensible default filters to apply on top of the result from GetHistoricalDataWithComparisons.

matouskozak commented 2 weeks ago

Instead of updating the query in our autofiler code everytime, I'm working on a stored function for our Azure Data Explorer cluster that we can define this in instead. Here is the function I have defined as a work-in-progress so far and it is already available on our ADX to experiment with:

.create-or-alter function GetHistoricalDataWithComparisons(test: string, counter: string = "", repo: string = "", branch: string = "", after: datetime = datetime(null)) { let afterValue = iff(isnull(after), ago(60d), after); Measurements | where repo == "" or BuildRepo == repo | where (branch == "" and (BuildBranch == "refs/heads/main" or BuildBranch == "9.0")) or BuildBranch == branch | where TestName == test | where iff(counter == "", TestCounterTopCounter, TestCounterName == counter) | where BuildTimeStamp > afterValue | summarize arg_max(QualityLevel, *) by RunId, TestId | extend ConfigShort = strcat( iff(RunConfigurationsCompilationMode == "wasm", "-wasm", ""), iff(RunConfigurationsRunKind == "micro_mono", "-mono", ""), iff(RunConfigurationsExperimentName != "", strcat("-", RunConfigurationsExperimentName), ""), iff(RunConfigurationsPgoType != "", strcat("-", RunConfigurationsPgoType), ""), iff(RunConfigurationsHybridGlobalization != "", "-HybridGlobalization", ""), iff(RunConfigurationsR2RType != "", strcat("-", RunConfigurationsR2RType), ""), iff(tobool(RunConfigurationsAot) or tobool(RunConfigurationsMonoAot),"-AOT", ""), iff(tobool(RunConfigurationsMonoInterpreter),"-Interp", ""), iff(tostring(RunConfigurations["RuntimeType"]) != "", strcat("-", tostring(RunConfigurations["RuntimeType"])), ""), iff(tobool(RunConfigurations["iOSStripSymbols"]),"-iOSStripSymbols", ""), iff(tobool(RunConfigurationsLlvm) or tobool(RunConfigurationsIosLlvmBuild),"-LLVM", ""), iff(tobool(RunConfigurationsJsEngine),strcat("-", RunConfigurationsJsEngine), ""), iff(RunConfigurationsPhysicalPromotionType != "", strcat("-", RunConfigurationsPhysicalPromotionType), "")) | extend Series = strcat(FriendlyQueueName(RunQueue), iff(BuildArchitecture == "x86", "-x86", ""), ConfigShort) } Then an example usage of this which renders the chart would be

GetHistoricalDataWithComparisons(@'System.Memory.Span.BinarySearch(Size: 512)', after=datetime(2024-08-22T09:01:51.8330745+00:00)) // | where RunConfigurationsRunKind == "micro_mono" or RunConfigurationsCompilationMode == "wasm" | project BuildTimeStamp, Result=round(TestCounterResultAverage, 3), Series | render timechart with (series=Series, xcolumn=BuildTimeStamp, ycolumns=Result, xtitle='Date', ytitle='Time (ns)') So we would just generate this query inside our auto-filter instead of the full query.

What did we think of this approach? For most microbenchmarks this causes way too many series by default so need to decide what might be some sensible default filters to apply on top of the result from GetHistoricalDataWithComparisons.

Looking good @caaavik-msft, thank you! I think for Mono, it is sensible to have | where RunConfigurationsRunKind == "micro_mono" or RunConfigurationsCompilationMode == "wasm" enabled by default. It would be nice to have e.g., one CoreCLR job included as well just for comparison between CoreCLR and Mono. However, if that would be too complicated, I think having Mono-only by default is good enough and if we need to, we can always comment it out.