question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Feature Request] A tool to inspect PPTC caches

See original GitHub issue

Feature Request

What feature are you suggesting?

Overview:

A tool to inspect PPTC caches. The tool would dump the codegen of each translation and other information such as relocations. It may have other options to dump only a single translation and stuff like that.

Smaller Details:

Ideally PPTC cache serialization would be decoupled enough to allow external code to re-use the code, but this is not the case right now. I think it might be worth doing so and modify the format while we’re at it. I propose replacing the parallel arrays/sections with something close to this:

struct PtcCache {
  public byte[] Hash;
  public byte[] Magic;
  public Entry[] Entries;
  public int Version;

  struct Entry {
    public bool HighCq;
    public ulong GuestAddress;
    public ulong GuestSize;
    public byte[] GuestHash;
    public byte[] Code;
    public RelocInfo RelocInfo;
    public UnwindInfo UnwindInfo;
    public string Log;
  }
}

The format is simple and makes adding extra fields trivial. The Log field is the only new field added. The idea is that dev builds can store the logging information there, then this can inspected later on. This maybe less compressible than the current format because of how data is layouted out. Will require measurements to know by how much though.

Would this reside under Ryujinx.CpuTools or ARMeilleure.Tools?

Nature of Request:

  • Tooling/Addition

Why would this feature be useful?

This will allow one to quickly get the codegen differential of two versions of ARMeilleure. The differential is very helpful when identifying improvements and regressions. Furthermore this makes identifying points where the codegen could be improved easier. Dumping logging information facilitates identifying bugs and things along those lines.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
FICTURE7commented, Oct 1, 2021

Been chipping away at this, here is a rough prototype, probably needs to be rewritten. Decided to push it anyways, since its proving to be quite useful already.

0reactions
FICTURE7commented, Oct 1, 2021

Why wouldn’t it be just a separate tool? I assumed thats what was being suggested here.

Well yeah, for inspecting the PPTC cache it would be a different tool, but I thought maybe we could re-use the headless client to rebuild the cache. I should have been more clear; I already tried doing something like that in the past and ran into the following issues (IIRC):

  1. Program loading
    • We have to load the guest code in a memory manager somehow. PPTC caches do not contain guest code, they only contain the guest code hash. I was loading the guest code by creating a completely headless client, then loading the program through ApplicationLoader.
  2. Code duplication
    • This piece of code here is essentially duplicated (it already is here).
  3. Managing PPTC caches
    • Because PPTC stores the caches and info files at specific locations, we have to work around that - or rework the code.
  4. Managing PPTC rebuilds
    • Because PPTC will rebuild on execution starts, it becomes awkward to know when it stops or starts. Could probably use Ptc.PtcStateChanged to figure that part out.

After further thought, all the big issues above can be fixed by storing the guest code in the PPTC cache. This can be used to avoid hash collision issues as well.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Windchill Cache Recovery Tool
It is a Windows application that will open cache files, attempt to determine the original Pro/ENGINEER file name and, if found, rename the...
Read more >
Feature request: Inspect tool - Share an idea
An “inspect” tool as a sub-tool of the arrow tool that simply allows selecting an object and seeing it's properties without moving/changing ...
Read more >
FeatureLockDown (Lockable Settings)
Provides a method for admins to whitelist user libraries as trusted locations when Protected View is enabled. Details, Protected View restricts features for...
Read more >
Default Cache Behavior
To investigate cache responses returned by the CF-Cache-Status header, use services like Redbot Open external link , webpagetest.org Open ...
Read more >
Profiling tools
Monitor selected counters in performance objects. Correlate performance counter data with data collected by other features in the VTune analyzer, such as ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found