rib / gputop

A GPU profiling tool
160 stars 37 forks source link

Kabylake (GT2/3) support #173

Closed raymanfx closed 6 years ago

raymanfx commented 6 years ago

I'm working on a Kabylake GT2 consumer variant platform. Running the following:

python scripts/i915-perf-kernelgen.py --guids data/guids.xml --chipset KBLGT2 --c-out i915_oa_kblgt2.c --h-out i915_oa_kblgt2.h data/oa-kblgt2.xml

Produces mostly usable data, however, flex_eu_config_test_oa is always empty, thus lots of performance counters are missing:

static const struct i915_oa_reg flex_eu_config_test_oa[] = { };

b_counter_config_test_oa and mux_config_test_oa seem to be fine. I patched my kernel to add kblgt2/kblgt3 support to i915_perf, but running GPUTop only reveals stuff like the avg frequency, core clock, etc, but many figures are missing/not changing as I would expect them to.

djdeath commented 6 years ago

There is a makefile in the data directory to generate all these files for you :

cd data/
make -f Makefile.xml
djdeath commented 6 years ago

Note that, more recent kernels (4.14+) have introduced a mechanism to load new configurations into the kernel from userspace. You probably want that feature for gputop to display all available figures.

raymanfx commented 6 years ago

Using the makefile does exactly the same from what I can tell and it results in the same .c/.h being generated, where the _flex_eu_config_testoa[] array is empty.

I'm stuck on a 4.1 kernel (with Xen HV and Kabylake stuff on top) for various reasons, so I backported most of the perf commits that are necessary for GPUTop. However, many metrics are 0 and never change, but I think this is due to the generated i915_oa_kblgt2.c which lacks data in comparison to e.g. Haswell classes, or do I have that backwards?

djdeath commented 6 years ago

Like I wrote, most of the configs (including the flex eu registers) have been removed from the kernel. We left only the test config which is useful for debugging but not much else.

It's up to userspace application/libraries (including GPUTop & Mesa) to upload the configuration they need.

In this particular case, the flex eu registers are not set because it's not useful for the test configuration. The purpose of this config is just to verify that hardware counters tick at the appropriate frequency.

There isn't a magic recipe for backporting features back to 4.1 (that's really old for Kabylake...). Everything you need should be in 4.14 though.

You could potentially go back to a previous version of the script prior to:

commit ab0c50cf0e3e4c3ca345fce8c33af495f08ff489 Author: Lionel Landwerlin lionel.g.landwerlin@intel.com Date: Thu Jul 6 15:27:22 2017 +0100

scripts: i915: only generate test configs
raymanfx commented 6 years ago

Understood, thanks. I got it working now (even on my ancient Frankenstein 4.1 kernel), GPUTop reports proper data too, without resetting the script version.

Btw, when I first tried to make GPUTop work and the kernel perf counters were botched, I ran into a segfault with GPUTop, which is probably ... not too nice? I went and debugged it with gdb, do you want me to push the following patch as a pull request?

https://hastebin.com/uweviwawij.vbs

djdeath commented 6 years ago

Sure, some of that code is written with assumptions about the kernel (so might crash with Frankenstein backports).