-
Notifications
You must be signed in to change notification settings - Fork 44
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
Call Py_DECREF
after using PyObject_GetAttrString
in intel driver
#3077
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -420,10 +420,18 @@ def format_of(ty): | |
}} | ||
|
||
// extract kernel metadata | ||
int num_warps = PyLong_AsLong(PyObject_GetAttrString(kernel_metadata, "num_warps")); | ||
int num_ctas = PyLong_AsLong(PyObject_GetAttrString(kernel_metadata, "num_ctas")); | ||
int shared_memory = PyLong_AsLong(PyObject_GetAttrString(kernel_metadata, "shared")); | ||
int threads_per_warp = PyLong_AsLong(PyObject_GetAttrString(kernel_metadata, "threads_per_warp")); | ||
PyObject *num_warps_attr = PyObject_GetAttrString(kernel_metadata, "num_warps"); | ||
int num_warps = PyLong_AsLong(num_warps_attr); | ||
Py_DECREF(num_warps_attr); | ||
PyObject *num_ctas_attr = PyObject_GetAttrString(kernel_metadata, "num_ctas"); | ||
int num_ctas = PyLong_AsLong(num_ctas_attr); | ||
Py_DECREF(num_ctas_attr); | ||
PyObject *shared_attr = PyObject_GetAttrString(kernel_metadata, "shared"); | ||
int shared_memory = PyLong_AsLong(shared_attr); | ||
Py_DECREF(shared_attr); | ||
PyObject *threads_per_warp_attr = PyObject_GetAttrString(kernel_metadata, "threads_per_warp"); | ||
int threads_per_warp = PyLong_AsLong(threads_per_warp_attr); | ||
Py_DECREF(threads_per_warp_attr); | ||
|
||
// extract cluster dims | ||
PyObject *clusterDim = PyObject_GetAttrString(kernel_metadata, "cluster_dims"); | ||
|
@@ -434,6 +442,7 @@ def format_of(ty): | |
int clusterDimX = PyLong_AsLong(PyTuple_GetItem(clusterDim, 0)); | ||
int clusterDimY = PyLong_AsLong(PyTuple_GetItem(clusterDim, 1)); | ||
int clusterDimZ = PyLong_AsLong(PyTuple_GetItem(clusterDim, 2)); | ||
Py_DECREF(clusterDim); | ||
// extract launch metadata | ||
if (launch_enter_hook != Py_None){{ | ||
PyObject* args = Py_BuildValue("(O)", launch_metadata); | ||
|
@@ -466,9 +475,7 @@ def format_of(ty): | |
return NULL; | ||
}} | ||
|
||
// return None | ||
Py_INCREF(Py_None); | ||
return Py_None; | ||
Py_RETURN_NONE; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. to align with nvidia |
||
}} | ||
|
||
static PyMethodDef ModuleMethods[] = {{ | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
https://docs.python.org/3/c-api/object.html#c.PyObject_GetAttrString