-
Notifications
You must be signed in to change notification settings - Fork 23
Use SVM memory pool #706
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
Use SVM memory pool #706
Conversation
|
cc @inducer Edit: inducer/arraycontext#186 seems to have fixed this. |
|
What do you think of the get_reasonable_memory_pool interface @inducer? |
|
From my perspective, this is ready for review. This should work whether the other PRs (e.g. inducer/pyopencl#452) are merged or not. |
| def get_reasonable_memory_pool(ctx, queue): | ||
| """Return an SVM or buffer memory pool based on what the device supports.""" | ||
| from pyopencl.characterize import has_coarse_grain_buffer_svm | ||
| import pyopencl.tools as cl_tools | ||
|
|
||
| if has_coarse_grain_buffer_svm(queue.device) and hasattr(cl_tools, "SVMPool"): | ||
| logger.info("Using SVM-based memory pool") | ||
| return cl_tools.SVMPool(cl_tools.SVMAllocator( # pylint: disable=no-member | ||
| ctx, alignment=0, queue=queue)) | ||
| else: | ||
| from warnings import warn | ||
| warn("No SVM support, returning a CL buffer-based memory pool") | ||
| return cl_tools.MemoryPool(cl_tools.ImmediateAllocator(queue)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why simutils and not pyopencl ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My thought was that this function is very specific to our use case - other applications using pyopencl probably won't care much for this function since it is unlikely they would prefer an SVM pool over a buffer pool. I thought about putting this in grudge, but it also doesn't feel relevant there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I defer to your judgement on this, i was mostly curious
MTCam
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm! we just gotta get the downstream examples updated.
mirgecom/simutil.py
Outdated
| ctx, alignment=0, queue=queue)) | ||
| else: | ||
| from warnings import warn | ||
| warn("No SVM support, returning a CL buffer-based memory pool") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tell the user what aspect is missing (SVM for the device, vs missing newfangled SVM in pyopencl).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in 9bc4e69
inducer
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with more detailed diagnostics.
related PRs:
clEnqueueSVMMemFree: copy pointers pocl/pocl#1069pocl conda files: