Skip to content

Make Kernel Source Code Discoverable - #514

Open
ZwFink wants to merge 2 commits into
mainfrom
canonical-source-filename
Open

Make Kernel Source Code Discoverable#514
ZwFink wants to merge 2 commits into
mainfrom
canonical-source-filename

Conversation

@ZwFink

@ZwFink ZwFink commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

Embed the source filename into the resulting module. This can be helpful for downstream users such as Mneme to find the original kernel source code.

The pass now resolves the source path of the non-LTO translation-unit
module to an absolute real path before embedding it. Consumers of the
embedded bitcode, such as Mneme's recorder, can then locate the kernel's
translation unit without knowing the compile working directory.

Only the emitted clone is modified; the original module keeps its name
so getUniqueFileID and host/device matching are unchanged. The path is
already part of the module hash, so hashes only change when the compile
was invoked with a relative path or a path through a symlink.
@ZwFink
ZwFink requested a review from johnbowen42 September 2, 2026 21:20
The cleanup pipelines stripped all debug info from device modules, so the
bitcode that Mneme embeds and records carried no source information and a
recorded kernel could not be traced back to the code that defined it.

Downgrade to line tables instead of stripping, in the pass cleanup pipeline,
in the HIP RDC/LTO pruned module, and in the runtime cleanup pipeline. That
keeps each kernel's DISubprogram and DIFile, including the compile-time MD5
checksum, while dropping the type and variable debug info that made modules
large.
@ZwFink ZwFink changed the title Canonicalize source_filename of embedded TU device modules Make Kernel Source Code Discoverable Sep 2, 2026
@ZwFink
ZwFink force-pushed the canonical-source-filename branch from 5fbcc4b to 7410e0b Compare September 2, 2026 23:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants