Skip to content
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

[Libomptarget][NFC] Remove concept of optional plugin functions #82681

Merged
merged 1 commit into from
Feb 22, 2024

Conversation

jhuber6
Copy link
Contributor

@jhuber6 jhuber6 commented Feb 22, 2024

Summary:
Ever since the introduction of the new plugins we haven't exercised the
concept of "optional" plugin functions. This is done in perparation for
making the plugins use a static interface as it will greatly simplify
the implementation if we assert that every function has the entrypoints.
Currently some unsupported functions will just return failure or some
other default value, so this shouldn't change anything.

Summary:
Ever since the introduction of the new plugins we haven't exercised the
concept of "optional" plugin functions. This is done in perparation for
making the plugins use a static interface as it will greatly simplify
the implementation if we assert that every function has the entrypoints.
Currently some unsupported functions will just return failure or some
other default value, so this shouldn't change anything.
PLUGIN_API_HANDLE(data_notify_unmapped);
PLUGIN_API_HANDLE(set_device_offset);
PLUGIN_API_HANDLE(initialize_record_replay);
PLUGIN_API_HANDLE(use_auto_zero_copy);
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, what will happen on NVIDIA GPUs for use_auto_zero_copy?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This patch doesn't change what happens if it's called, but the fallback is to just return false.

Copy link
Contributor

Choose a reason for hiding this comment

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

I mean, for those APIs don't exist on a target, we will error out immediately with this change right? However, since they are optional, the program can and should still work even w/o them.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, we were never actually exercising this functionality. Every function is defined on every "plugin" with some returning default results, this change is NFC.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah now it's all virtual function and then have a unified implementation in PluginInterface.cpp. TBH I'm not sure if that's a good idea but that is out of the scope. For now it looks fine.

PLUGIN_API_HANDLE(data_notify_unmapped);
PLUGIN_API_HANDLE(set_device_offset);
PLUGIN_API_HANDLE(initialize_record_replay);
PLUGIN_API_HANDLE(use_auto_zero_copy);
Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah now it's all virtual function and then have a unified implementation in PluginInterface.cpp. TBH I'm not sure if that's a good idea but that is out of the scope. For now it looks fine.

@jhuber6
Copy link
Contributor Author

jhuber6 commented Feb 22, 2024

In the future I want to move to a statically linked interface. Having the concept of "optional" functions is really difficult with a static interface, so we should just formalize it so some functions can just return "UNIMPLEMENTED" or something.

@jhuber6
Copy link
Contributor Author

jhuber6 commented Feb 22, 2024

@jhuber6 jhuber6 merged commit 87b4108 into llvm:main Feb 22, 2024
6 checks passed
@ronlieb
Copy link
Contributor

ronlieb commented Feb 22, 2024 via email

searlmc1 pushed a commit to ROCm/llvm-project that referenced this pull request Feb 23, 2024
merges up to commit before
87b4108 [Libomptarget][NFC] Remove concept of optional plugin functions (llvm#82681)

Change-Id: I1fc8cf975c675a254b29eb1beaf8e61bf3bef450
searlmc1 pushed a commit to ROCm/llvm-project that referenced this pull request Feb 26, 2024
…#82681)

Summary:
Ever since the introduction of the new plugins we haven't exercised the
concept of "optional" plugin functions. This is done in perparation for
making the plugins use a static interface as it will greatly simplify
the implementation if we assert that every function has the entrypoints.
Currently some unsupported functions will just return failure or some
other default value, so this shouldn't change anything.

Change-Id: I6d635e18b80b849f031a6d7c81e8d93919e1645e
@jdoerfert
Copy link
Member

Are you planning to remove all the if(fptr) checks as well? Can be NFC now.

@jhuber6
Copy link
Contributor Author

jhuber6 commented Mar 19, 2024

Are you planning to remove all the if(fptr) checks as well? Can be NFC now.

Figured I'd just bundle that part in with switching over to static libraries. Looking at that currently.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
openmp:libomptarget OpenMP offload runtime
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants