Skip to content

Add os_abi for aie4 target architecture#217

Open
donwalkarsoham wants to merge 9 commits intomain-gefrom
os_abi
Open

Add os_abi for aie4 target architecture#217
donwalkarsoham wants to merge 9 commits intomain-gefrom
os_abi

Conversation

@donwalkarsoham
Copy link
Collaborator

@donwalkarsoham donwalkarsoham commented Jan 20, 2026

Problem solved by the commit
Provide a way to detect the target architecture in the ELF.

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

How problem was solved, alternative solutions (if any) and why they were rejected
1> Update ELF spec to add new os abi versions for aie4 specific architectures like aie4, aie4a and aie4z.
2> Bump up the ELF version to maintain backward compatibility.
Below is the mapping table of target architecture to os_abi and ELF version in ELF header.
3> Added a basic aie4 test and manually updated 1col-preempt test.asm file with ".target aie4". Verified if the resultant ELF had os_abi added for aie4 and ELF version bumped up.

Target architecture to EI_VERSION and EI_OSABI mapping Table

image

Risks (if any) associated the changes in the commit
N/A

What has been tested and how, request additional testing if necessary
1> Ran all ctests successfully.
2> Manually updated 1col-preempt test.asm file with ".target aie4". Verified if the resultant ELF had os_abi added for aie4 and ELF version bumped up. Added test to test suite.
3> All the current tests are passing correctly showing if .target is not present then current os_abi and elf version remain the same with no changes to the ELF.

Documentation impact (if any)
Updated Readme.rst and ELF spec.

Signed-off-by: Donwalkar <sdonwalk@amd.com>
…ie4 versions + add new aie4 based arch options in aiebu-asm

Signed-off-by: Donwalkar <sdonwalk@amd.com>
@HimanshuChoudhary-Xilinx
Copy link
Collaborator

hi @donwalkarsoham
Please check my PR #214 which implement .target directive
we should not add new target (-t option). instead add os_abi based on .target directive.

donwalkarsoham and others added 3 commits January 22, 2026 21:35
Signed-off-by: Donwalkar <sdonwalk@amd.com>
Signed-off-by: Donwalkar <sdonwalk@amd.com>
Signed-off-by: Soham Donwalkar <35574795+donwalkarsoham@users.noreply.github.com>
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

clang-tidy made some suggestions

// Legacy ELF - only aie2ps_group
if (os_abi != elf_amd_aie2ps_group)
throw error(error::error_code::invalid_input, "Only aie2ps_group elf supported for legacy ELF version\n");
} else if (abi_version == 0x04 || abi_version == 0x05) {
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: 0x05 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers]

  } else if (abi_version == 0x04 || abi_version == 0x05) {
                                                   ^

throw error(error::error_code::invalid_input,
"update_kernel_name only supports OS ABI 0x46 for legacy ELF version, got: 0x"
+ ELFIO::to_hex_string(os_abi));
} else if (abi_version == 0x04 || abi_version == 0x05) {
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: 0x05 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers]

   } else if (abi_version == 0x04 || abi_version == 0x05) {
                                                    ^

Signed-off-by: Donwalkar <sdonwalk@amd.com>
Signed-off-by: Donwalkar <sdonwalk@amd.com>
@github-actions
Copy link
Contributor

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

Signed-off-by: Donwalkar <sdonwalk@amd.com>
@github-actions
Copy link
Contributor

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

@larry9523
Copy link
Collaborator

Are we changing the EI_VERSION (not EI_OSABI)in ELF header?

… set to 0x20 ELF version

Signed-off-by: Donwalkar <sdonwalk@amd.com>
@github-actions
Copy link
Contributor

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

@donwalkarsoham
Copy link
Collaborator Author

XRT team mentioned that the corresponding XRT changes have been merged and hence this change can be merged too.

@larry9523
Copy link
Collaborator

@HimanshuChoudhary-Xilinx please work with @rbramand-xilinx to get this retested and publish a example xrt host code.

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.

3 participants