dotnet / jitutils

MIT License
144 stars 59 forks source link

Latest dotnet --info no longer includes RID or Platform #366

Closed tannergooding closed 1 year ago

tannergooding commented 1 year ago

We could update the tool to infer this information via the OSPlatform APIs as a fallback or at least allow them to be explicitly specified via the command line.

As it is right now, we get the following:

Couldn't find RID in 'dotnet --info' output:
stdout:

Host:
  Version:      7.0.2
  Architecture: x64
  Commit:       d037e070eb

.NET SDKs installed:
  7.0.100 [C:\Program Files\dotnet\sdk]
  7.0.102 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 6.0.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 7.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 7.0.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 6.0.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 7.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 7.0.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 6.0.11 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 7.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 7.0.2 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Other architectures found:
  x86   [C:\Program Files (x86)\dotnet]
    registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]

Environment variables:
  Not set

global.json file:
  D:\Users\tagoo\source\repos\runtime_base\global.json

Learn more:
  https://aka.ms/dotnet/info

Download .NET:
  https://aka.ms/dotnet/download

stderr:

Couldn't find Platform in 'dotnet --info' output:
stdout:

Host:
  Version:      7.0.2
  Architecture: x64
  Commit:       d037e070eb

.NET SDKs installed:
  7.0.100 [C:\Program Files\dotnet\sdk]
  7.0.102 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 6.0.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 7.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 7.0.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 6.0.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 7.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 7.0.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 6.0.11 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 7.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 7.0.2 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Other architectures found:
  x86   [C:\Program Files (x86)\dotnet]
    registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]

Environment variables:
  Not set

global.json file:
  D:\Users\tagoo\source\repos\runtime_base\global.json

Learn more:
  https://aka.ms/dotnet/info

Download .NET:
  https://aka.ms/dotnet/download

stderr:

Using --output D:\Users\tagoo\source\repos\runtime_base\artifacts\diffs
No platform mapping! (Platform name = )
No platform mapping! (Platform moniker = )
No platform mapping! (Platform name = )
No platform mapping! (Platform moniker = )
No platform mapping! (Platform name = )
No platform mapping! (Platform moniker = )
No platform mapping! (Platform name = )
No platform mapping! (Platform moniker = )
No platform mapping! (Platform name = )
No platform mapping! (Platform moniker = )
No platform mapping! (Platform name = )
No platform mapping! (Platform moniker = )
No platform mapping! (Platform name = )
No platform mapping! (Platform moniker = )
No platform mapping! (Platform name = )
No platform mapping! (Platform moniker = )
No platform mapping! (Platform name = )
No platform mapping! (Platform moniker = )
No platform mapping! (Platform name = )
No platform mapping! (Platform moniker = )
error: didn't find --core_root default
error: didn't find --diff default
error: Specify --core_root <path>
error: Specify either --base or --diff or both.

usage: jit-diff diff [-b [arg]] [-d [arg]] [--crossgen <arg>] [-o <arg>] [--noanalyze] [-s]
                [-t <arg>] [-c] [-f] [-m [arg]] [--benchmarks] [--tests] [--gcinfo] [--debuginfo]
                [-v] [--nodiffable] [--core_root <arg>] [--test_root <arg>] [--base_root <arg>]
                [--diff_root <arg>] [--arch <arg>] [--build <arg>] [--altjit <arg>] [--pmi]
                [--cctors] [--assembly <arg>...] [--tsv] [--tier0] [--count <arg>]

    -b, --base [arg]       The base compiler directory or tag. Will use crossgen, corerun, or clrjit
                           from this directory.
    -d, --diff [arg]       The diff compiler directory or tag. Will use crossgen, corerun, or clrjit
                           from this directory.
    --crossgen <arg>       The crossgen or crossgen2 compiler exe. When this is specified, will use
                           clrjit from the --base and --diff directories with this crossgen.
    -o, --output <arg>     The output path.
    --noanalyze            Do not analyze resulting base, diff dasm directories. (By default, the
                           directories are analyzed for diffs.)
    -s, --sequential       Run sequentially; don't do parallel compiles.
    -t, --tag <arg>        Name of root in output directory. Allows for many sets of output.
    -c, --corelib          Diff System.Private.CoreLib.dll.
    -f, --frameworks       Diff frameworks.
    -m, --metrics [arg]    Comma-separated metric to use for diff computations. Available metrics:
                           CodeSize(default), PerfScore, PrologSize, InstrCount, AllocSize,
                           ExtraAllocBytes, DebugClauseCount, DebugVarCount
    --benchmarks           Diff core benchmarks.
    --tests                Diff all tests.
    --gcinfo               Add GC info to the disasm output.
    --debuginfo            Add Debug info to the disasm output.
    -v, --verbose          Enable verbose output.
    --nodiffable           Generate non-diffable asm (pointer values will be left in output).
    --core_root <arg>      Path to test CORE_ROOT.
    --test_root <arg>      Path to test tree. Use with --benchmarks or --tests.
    --base_root <arg>      Path to root of base dotnet/runtime repo.
    --diff_root <arg>      Path to root of diff dotnet/runtime repo.
    --arch <arg>           Architecture to diff (x86, x64).
    --build <arg>          Build flavor to diff (Checked, Debug).
    --altjit <arg>         If set, the name of the altjit to use (e.g., clrjit_win_arm64_x64.dll).
    --pmi                  Run asm diffs via pmi.
    --cctors               With --pmi, jit and run cctors before jitting other methods
    --assembly <arg>...    Run asm diffs on a given set of assemblies. An individual item can be an
                           assembly or a directory tree containing assemblies.
    --tsv                  Dump analysis data to diffs.tsv in output directory.
    --tier0                Diff tier0 codegen where possible.
    --count <arg>          provide the count parameter to jit-analyze (default 20)
jakobbotsch commented 1 year ago

As far as I understand the current code on main should still be printing this (or is supposed to):

https://github.com/dotnet/sdk/blob/fac2452744d0a0ca945be4f7ab0b6fcfe3063c0c/src/Cli/dotnet/Program.cs#L157-L161 https://github.com/dotnet/sdk/blob/fac2452744d0a0ca945be4f7ab0b6fcfe3063c0c/src/Cli/dotnet/CommandLineInfo.cs#L19-L33

jakobbotsch commented 1 year ago

It seems related to using dotnet.exe when inside a dotnet/runtime checkout, I can reproduce it in that situation too. Weirdly .\dotnet.cmd --info works correctly in that case (so this might already be fixed in a new nightly SDK).

jakobbotsch commented 1 year ago

It looks like https://github.com/dotnet/runtime/pull/80234 updated dotnet/runtime to require a 8.0 alpha SDK (specified in global.json) so that just needs to be installed. Verified that it fixes the issue for me, will close this.