dotnet / dotnet/BenchmarkDotNet

Unable to read some hardware counters on ZEN2 CPU

Open
#1,520 18 comments 3 reactions 0 assignees View on GitHub
Area:Diagnosers good first issue up-for-grabs
Dominant language
C#
Stars
11.5k
Forks
1.1k
Avg merge
4d 11h
Merged PRs (30d)
11

Description

Having trouble reading 'CacheMisses' and 'InstructionsRetired' whenever I run the [dotnet/performance](https://github.com/dotnet/performance) benchmark suite. If I run the command from within the `src\benchmarks\micro` directory:

```powershell
dotnet run -c Release -f netcoreapp5.0 --filter '*Bilinear*' --counters CacheMisses InstructionsRetired
```

I get the following error message:

```
// Validating benchmarks:
The counter CacheMisses is not available. Please make sure you are Windows 8+ without Hyper-V
The counter InstructionRetired is not available. Please make sure you are Windows 8+ without Hyper-V
```

I am able to get some counters to read by enabling IBS in my BIOS (technically wasn't called IBS, I had to disable SVM to get it to work). So the following command does work for me:

```powershell
dotnet run -c Release -f netcoreapp5.0 --filter '*Bilinear*' --counters BranchMispredictions
```

If I profile a C# application outside of BenchmarkDotNet using AMD uProf, I can get cache miss and instructions retired statistics. I am also able to read all of the counters on my Skylake machine using the BenchmarkDotNet CLI without any issues.

Would appreciate any help that can be provided!

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.