Skip to content

Add changes to support scratchpad buffer patching for new ELFs#9741

Merged
stsoe merged 3 commits intoXilinx:masterfrom
rbramand-xilinx:scratchpad
Apr 20, 2026
Merged

Add changes to support scratchpad buffer patching for new ELFs#9741
stsoe merged 3 commits intoXilinx:masterfrom
rbramand-xilinx:scratchpad

Conversation

@rbramand-xilinx
Copy link
Copy Markdown
Collaborator

@rbramand-xilinx rbramand-xilinx commented Apr 16, 2026

Problem solved by the commit

Added changes to create separate buffer for scratchpad and patch it accordingly in instruction buffer and ctrlpkt

Bug / issue (if any) fixed, which PR introduced the bug, how it was discovered

This is Enhancement feature where aie4 ELFs will now have new scratchpad symbols for patching instead of having them in .pad section.

How problem was solved, alternative solutions (if any) and why they were rejected

scratchpad buffer is needed per hw context and size is platform dependent. We are getting platform info (OS_ABI) from ELF and then creating scratch pad buffer lazily.

Risks (if any) associated the changes in the commit

Low

What has been tested and how, request additional testing if necessary

Tested using existing preemption test case on AIE4 windows and the test passes
Also tested all hw tests from telluride repo on ve2 and all tests passed

Documentation impact (if any)

NA

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds runtime/ELF support for patching a dedicated scratchpad memory buffer (via a new scratch-pad-mem symbol) into AIE4 “new ELF” control/instruction buffers instead of relying on .pad.

Changes:

  • Introduces scratch_pad_mem_size in module_config_aie_gen2_plus and populates it for AIE4-family platforms.
  • Creates a scratchpad BO (via hw_context_int::get_scratchpad_mem_buf) and patches its address into ctrlpkt BOs and the instruction BO when the symbol is present.
  • Adds an _mb user-defined literal to express scratchpad sizing.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
src/runtime_src/core/common/api/xrt_module.cpp Creates scratchpad BO and patches scratch-pad-mem into ctrlpkt/instruction buffers during instruction buffer filling.
src/runtime_src/core/common/api/xrt_elf.cpp Sets scratch_pad_mem_size for AIE4 variants and adds _mb literal for sizing.
src/runtime_src/core/common/api/elf_int.h Extends module_config_aie_gen2_plus with scratch_pad_mem_size.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/runtime_src/core/common/api/xrt_module.cpp Outdated
Comment thread src/runtime_src/core/common/api/xrt_module.cpp Outdated
Comment thread src/runtime_src/core/common/api/xrt_module.cpp Outdated
@github-actions
Copy link
Copy Markdown
Contributor

clang-tidy review says "All clean, LGTM! 👍"

Comment thread src/runtime_src/core/common/api/elf_int.h
Copy link
Copy Markdown
Collaborator

@larry9523 larry9523 left a comment

Choose a reason for hiding this comment

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

Looks good. Just a couple of nits.

@github-actions
Copy link
Copy Markdown
Contributor

clang-tidy review says "All clean, LGTM! 👍"

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/runtime_src/core/common/api/xrt_module.cpp Outdated
Comment thread src/runtime_src/core/common/api/xrt_module.cpp
Comment thread src/runtime_src/core/common/api/xrt_module.cpp Outdated
Signed-off-by: Rahul Bramandlapalli <rbramand@amd.com>
Signed-off-by: rahul <rbramand@amd.com>
Signed-off-by: Rahul Bramandlapalli <rbramand@amd.com>
@github-actions
Copy link
Copy Markdown
Contributor

clang-tidy review says "All clean, LGTM! 👍"

Signed-off-by: rahul <rbramand@amd.com>
@github-actions
Copy link
Copy Markdown
Contributor

clang-tidy review says "All clean, LGTM! 👍"

@stsoe stsoe merged commit ba5c011 into Xilinx:master Apr 20, 2026
21 checks passed
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.

5 participants