Uh oh!
There was an error while loading. Please reload this page.
Implement Kernel.num_arguments, and Kernel.arguments_info - #612
Conversation
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
leofang
left a comment
There was a problem hiding this comment.
Thanks, Sasha! Looks great except for the docstrings, see my comment below.
We also need to add a feature entry to cuda_core/docs/source/release/0.3.0-notes.rst.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
…erties Also parametrize test to check arguments_info to check with all int, and all short arguments.
Auto-sync is disabled for ready for review pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
oleksandr-pavlyk
commented
May 8, 2025
/ok to test |
This comment has been minimized.
This comment has been minimized.
rwgk
left a comment
There was a problem hiding this comment.
LGTM although I'd use a dataclass for better ergonomics.
Uh oh!
There was an error while loading. Please reload this page.
oleksandr-pavlyk
commented
May 8, 2025
I fixed pre-commit, and added a line to |
rwgk
left a comment
There was a problem hiding this comment.
Two minor suggestions, please see here for background:
https://chatgpt.com/share/681d1a68-97d0-8008-bad5-40ae287f7d55
(When I wrote the first prompt I had "module scope" in mind, but I think class scope is better.)
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Used modern namedtuple instance constructor.
oleksandr-pavlyk
commented
May 8, 2025
This perplexes me: |
rwgk
left a comment
There was a problem hiding this comment.
This looks perfect to me. Caveat: I cannot explain the ipython observation.
leofang
commented
May 9, 2025
Let me look into it tmr |
leofang
commented
May 13, 2025
nit: as much as I love credit attribution (thanks), let's not do |
leofang
commented
May 13, 2025
/ok to test 2ca9704 |
Uh oh!
There was an error while loading. Please reload this page.
This required moving ParamInfo definition from class scope to module scope, since referencing Kernel.ParamInfo from annotations of methods of the Kernel class results in error that Kernel class does not yet exist.
Uh oh!
There was an error while loading. Please reload this page.
leofang
commented
May 14, 2025
/ok to test 55f6d31 |
oleksandr-pavlyk
commented
May 14, 2025
Test that Did I misunderstand the intent of |
leofang
commented
May 14, 2025
I feel |
I meant it to ensure that cuda is not initialized at the start of this test. Kind of like opposite of |
Yes feel free to implement any fixture you need. No need to refactor the existing fixtures if you don't want to sweat in this PR -- but then we should create an issue to track it (to the very least, we should rename To make sure we understand "initialized" in the same way -- You don't mean |
Use in test_module.py::test_num_args_error_handling Add comments
oleksandr-pavlyk
commented
May 14, 2025
/ok to test |
oleksandr-pavlyk
commented
May 14, 2025
/ok to test |
Uh oh!
There was an error while loading. Please reload this page.
1. Changed fixture to provide a function that empties the stack of contexts. The function has hidden max_iters bound. If exceeded, a RuntimeError is raised 2. Modified _device_unset_current utility function to return a boolean. True is returned is a context was popped, False if the stack was already empty.
oleksandr-pavlyk
commented
May 14, 2025
/ok to test |
rwgk
left a comment
There was a problem hiding this comment.
Just a couple cosmetic suggestions. Optional.
| raise NotImplementedError("New backend is required") | ||
| arg_pos = 0 | ||
| param_info_data = [] | ||
| while True: |
There was a problem hiding this comment.
Maybe (sorry I overlooked this before):
forarg_posinitertools.count():Then you don't need arg_pos = 0 above and arg_pos = arg_pos + 1 below.
| if _device_unset_current(): | ||
| # context was popped, continue until stack is empty | ||
| continue | ||
| # no active context, we are ready | ||
| break |
There was a problem hiding this comment.
Maybe shorter (replace 5 lines with 2):
ifnot_device_unset_current():
break
|
Description
closes#568
This PR implements
Kernel.num_argumentsandKernel.argument_infoproperties:Kernel.num_argumentsreturns the number of arguments in the kernel instanceKernel.argument_inforeturns a list of tuples(offset, size)which describes layout of the struct containing all kernel arguments,Checklist