[Feature Request] A tool to inspect PPTC caches
See original GitHub issueFeature 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:
- Created 2 years ago
- Comments:5 (5 by maintainers)

Top Related StackOverflow Question
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.
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):
ApplicationLoader.Because PPTC will rebuild on execution starts, it becomes awkward to know when it stops or starts.Could probably usePtc.PtcStateChangedto 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.