Skip to content

HIP changes to support full ELF flow #9137

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

rbramand-xilinx
Copy link
Collaborator

Problem solved by the commit

Added changes in hip module APIs to load full ELF

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

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

Hip module load calls are modified to try to load full ELF and when exception is caught fallback to load xclbin + elf
Ideal way is to modify hip module calls to load full ELFs but as our compilers at present doesn't generate full ELFs and we need to support xclbin + elf flow for some time the changes are made this way.

Also hipModuleLoadData API only takes void* pointer as input but to create elfio object we need data pointer and size, so added a function to calculate size of elf from elf header.

Risks (if any) associated the changes in the commit

Low as it impacts only HIP flows

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

Tested existing model test expoi (xclbin + elf) test on strix Linux and it works as expected
Also converted expoi full elf c++ application to HIP based application and tested it on strix Linux, test passes

Documentation impact (if any)

Need to document the usage when HIP documentation is made available

> only added changes for hipModuleLoad call

Signed-off-by: rbramand <[email protected]>
Signed-off-by: Rahul Bramandlapalli <[email protected]>
Signed-off-by: rbramand <[email protected]>
Copy link

@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

Signed-off-by: Rahul Bramandlapalli <[email protected]>
Copy link

@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

Copy link
Collaborator

@stsoe stsoe left a comment

Choose a reason for hiding this comment

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

LGTM.


module_xclbin*
get_xclbin_module() const
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we need this function?


module_full_elf*
get_full_elf_module() const
{
Copy link
Collaborator

Choose a reason for hiding this comment

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

Ditto. Do we need this function?

auto hip_xclbin_mod = std::dynamic_pointer_cast<module_xclbin>(hip_mod);
throw_invalid_resource_if(!hip_xclbin_mod, "getting hip module using dynamic pointer cast failed");
std::shared_ptr<function> hip_func;
if (hip_mod->is_full_elf_module()) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

cant we abstract this logic inside get_function API itself?


auto hip_elf_mod = std::dynamic_pointer_cast<module_elf>(hip_mod);
throw_invalid_resource_if(!hip_elf_mod, "getting hip module using dynamic pointer cast failed");
if (hip_mod->is_full_elf_module()) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

ditto, cant we abstract this inside the class itself?

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