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 various GPU device query functions #25945

Merged
merged 9 commits into from
Oct 21, 2024

Conversation

stonea
Copy link
Contributor

@stonea stonea commented Sep 13, 2024

This PR adds a DeviceAttributes type that includes a number of parenless proc functions to query various attributes about the GPU. (for example: max threads per block, device name, etc.)

This aims to resolve #23638

---
Signed-off-by: Andy Stone <[email protected]>
@stonea stonea changed the title add device query functions add various GPU device query functions Sep 13, 2024
@stonea stonea self-assigned this Sep 13, 2024
@stonea stonea marked this pull request as ready for review September 20, 2024 22:19
---
Signed-off-by: Andy Stone <[email protected]>
Copy link
Contributor

@e-kayrakli e-kayrakli left a comment

Choose a reason for hiding this comment

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

It'd be great if you can move memory allocation for the name query into the top-level code in the runtime. Otherwise, looks good! Thanks!

@@ -512,5 +512,60 @@ void chpl_gpu_impl_host_unregister(void* var) {
ROCM_CALL(hipHostUnregister(var));
}

void chpl_gpu_impl_name(int dev, char **result) {
char* name = (char *)chpl_mem_alloc(0xFF, CHPL_RT_MD_IO_BUFFER, __LINE__, 0);
Copy link
Contributor

Choose a reason for hiding this comment

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

Why 0xFF for size?

Copy link
Contributor

Choose a reason for hiding this comment

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

I have a preference towards doing this allocation in chpl-gpu.c as I don't see this as a vendor-specific operation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why 0xFF for size?

I need to have some cap on the size and that seems like a nice, round, number that won't waste too much memory but will be large enough to store any reasonable device name.

I've factored out the (non GPU-vendor specific) allocation into chpl-gpu.c.

runtime/src/gpu/cpu/gpu-cpu.c Outdated Show resolved Hide resolved
@e-kayrakli
Copy link
Contributor

Also, don't forget to remove "draft" from the PR message. :)

---
Signed-off-by: Andy Stone <[email protected]>
---
Signed-off-by: Andy Stone <[email protected]>
@stonea stonea merged commit 0dfd163 into chapel-lang:main Oct 21, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Which device properties should we expose to the user?
2 participants