Skip to content

[Comgr] Serve repeat metadata queries from a per-DataObject cache - #3840

Open
chinmaydd wants to merge 1 commit into
amd-stagingfrom
amd/dev/chdeshpa/comgr-metadata-cache
Open

[Comgr] Serve repeat metadata queries from a per-DataObject cache#3840
chinmaydd wants to merge 1 commit into
amd-stagingfrom
amd/dev/chdeshpa/comgr-metadata-cache

Conversation

@chinmaydd

@chinmaydd chinmaydd commented Aug 10, 2026

Copy link
Copy Markdown

This is first in a series of PRs that aim to improve Comgr.

amd_comgr_get_data_metadata re-parsed the ELF and every AMDGPU note on every call. Reuse the parsed MetaDocument via the shared_ptr that DataMeta already holds, so N queries on one code object cost one parse. Cache population is serialized because these query entry points used to be read-only with respect to the DataObject.

setData(unique_ptr<MemoryBuffer>) now routes through clearData(), which also fixes it never freeing a previously setCStr-allocated Data.

500000 repeat queries on shared-v3.so: 4809 ms -> 17 ms.

[1/3] <- you are here
[2/3] <- #3841
[3/3] <- #3842

amd_comgr_get_data_metadata re-parsed the ELF and every AMDGPU note on
every call. Reuse the parsed MetaDocument via the shared_ptr that DataMeta
already holds, so N queries on one code object cost one parse. Cache
population is serialized because these query entry points used to be
read-only with respect to the DataObject.

setData(unique_ptr<MemoryBuffer>) now routes through clearData(), which
also fixes it never freeing a previously setCStr-allocated Data.

500000 repeat queries on shared-v3.so: 4809 ms -> 17 ms.

Co-authored-by: Cursor <cursoragent@cursor.com>
@chinmaydd
chinmaydd force-pushed the amd/dev/chdeshpa/comgr-metadata-cache branch from 1c1483a to ad67e0f Compare August 10, 2026 17:50
@chinmaydd
chinmaydd marked this pull request as ready for review August 10, 2026 18:22
@chinmaydd
chinmaydd requested a review from lamb-j as a code owner August 10, 2026 18:22
@chinmaydd

Copy link
Copy Markdown
Author

!PSDB

@jmmartinez jmmartinez left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, but I'm not super familiar with this part of the API.

@chinmaydd
chinmaydd requested a review from slinder1 August 11, 2026 19:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comgr Related to Code Object Manager

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants