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

Add a new omp GPU layer that uses libomptarget #20186

Closed
wants to merge 34 commits into from

Conversation

e-kayrakli
Copy link
Contributor

This is a WIP PR that creates a new GPU runtime layer that uses libomptarget.

Currently, for this to work, you'll need the openmp project in llvm-src/projects. The main reason this PR is WIP is that I currently don't have a good strategy for packaging that or finding system's version if it exists.

Approach

With this PR, the user can set CHPL_GPU to omp. In that case, we'll use libomptarget's __tgt_rtl_* interface which wraps around different plugins (ie, cuda, amdgpu etc). This interface normally compiles into a shared library, which we dynamically load at runtime.

This interface does not expose everything that we were using from the CUDA Driver API. To cover for the missing parts, this PR adds supporting cuda headers which has a couple of static inline functions. These headers are included from both cuda and omp layers as appropriate.

Runtime structure with two GPU layers

The main GPU interface of the runtime is still in runtime/includes/chpl-gpu.h which is implemented in runtime/src/chpl-gpu.c. However, with this PR, the functions there will call new functions that are in chpl_gpu_impl_* "namespace". These functions implement core functionality and implemented by different layers whereas Chapel functions like debugging output and diagnostics are still maintained in chpl-gpu.c, and not duplicated in different layers.

Signed-off-by: Engin Kayraklioglu <e-kayrakli@users.noreply.github.com>
Signed-off-by: Engin Kayraklioglu <e-kayrakli@users.noreply.github.com>
Signed-off-by: Engin Kayraklioglu <e-kayrakli@users.noreply.github.com>
Signed-off-by: Engin Kayraklioglu <e-kayrakli@users.noreply.github.com>
Signed-off-by: Engin Kayraklioglu <e-kayrakli@users.noreply.github.com>
Signed-off-by: Engin Kayraklioglu <e-kayrakli@users.noreply.github.com>
Signed-off-by: Engin Kayraklioglu <e-kayrakli@users.noreply.github.com>
…e compiler

Signed-off-by: Engin Kayraklioglu <e-kayrakli@users.noreply.github.com>
Signed-off-by: Engin Kayraklioglu <e-kayrakli@users.noreply.github.com>
Signed-off-by: Engin Kayraklioglu <e-kayrakli@users.noreply.github.com>
Signed-off-by: Engin Kayraklioglu <e-kayrakli@users.noreply.github.com>
Signed-off-by: Engin Kayraklioglu <e-kayrakli@users.noreply.github.com>
Signed-off-by: Engin Kayraklioglu <e-kayrakli@users.noreply.github.com>
Signed-off-by: Engin Kayraklioglu <e-kayrakli@users.noreply.github.com>
Signed-off-by: Engin Kayraklioglu <e-kayrakli@users.noreply.github.com>
Signed-off-by: Engin Kayraklioglu <e-kayrakli@users.noreply.github.com>
Signed-off-by: Engin Kayraklioglu <e-kayrakli@users.noreply.github.com>
Signed-off-by: Engin Kayraklioglu <e-kayrakli@users.noreply.github.com>
Signed-off-by: Engin Kayraklioglu <e-kayrakli@users.noreply.github.com>
Signed-off-by: Engin Kayraklioglu <e-kayrakli@users.noreply.github.com>
Signed-off-by: Engin Kayraklioglu <e-kayrakli@users.noreply.github.com>
Signed-off-by: Engin Kayraklioglu <e-kayrakli@users.noreply.github.com>
Signed-off-by: Engin Kayraklioglu <e-kayrakli@users.noreply.github.com>
Signed-off-by: Engin Kayraklioglu <e-kayrakli@users.noreply.github.com>
Signed-off-by: Engin Kayraklioglu <e-kayrakli@users.noreply.github.com>
Signed-off-by: Engin Kayraklioglu <e-kayrakli@users.noreply.github.com>
Signed-off-by: Engin Kayraklioglu <e-kayrakli@users.noreply.github.com>
Signed-off-by: Engin Kayraklioglu <e-kayrakli@users.noreply.github.com>
Signed-off-by: Engin Kayraklioglu <e-kayrakli@users.noreply.github.com>
Signed-off-by: Engin Kayraklioglu <e-kayrakli@users.noreply.github.com>
@e-kayrakli e-kayrakli marked this pull request as draft July 9, 2022 00:07
Signed-off-by: Engin Kayraklioglu <e-kayrakli@users.noreply.github.com>
Signed-off-by: Engin Kayraklioglu <e-kayrakli@users.noreply.github.com>
@e-kayrakli
Copy link
Contributor Author

For now, we want to first modularize the GPU runtime, so we can add new layers such as one that uses libomptarget as the middleware.

We will also be looking at writing our own layer for targeting AMD devices in the short term.

PR that will refactor the runtime for easy layer addition: #20358
Internal notes on how to add a libomptarget layer: https://github.com/Cray/chapel-private/issues/3305#issuecomment-1203572406

@e-kayrakli e-kayrakli closed this Aug 3, 2022
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.

None yet

1 participant