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

Instance won't be None #191

Open
LiuLiujie opened this issue Mar 24, 2023 · 2 comments
Open

Instance won't be None #191

LiuLiujie opened this issue Mar 24, 2023 · 2 comments

Comments

@LiuLiujie
Copy link
Contributor

In the code fragment below, the instance won't be None in line 764 because the function dev.create_kernel_instance(_) returns either InvalidConfig or KernelInstance.

When I make a problem in the thread block settings, the return value in line 763 is an instance of InvalidConfig, which has no attribute name, bypasses the if statement, and will cause error AttributeError: 'InvalidConfig' object has no attribute 'name' in line 768. This error message is not that clear for me to figure out what the real problem is.

instance = dev.create_kernel_instance(kernelsource, kernel_options, params, False)
if instance is None:
raise RuntimeError("cannot create kernel instance, too many threads per block")
# see if the kernel arguments have correct type
util.check_argument_list(instance.name, instance.kernel_string, arguments)

@benvanwerkhoven
Copy link
Collaborator

Thanks @LiuLiujie for reporting! Indeed the check for None has become obsolete when InvalidConfig's were introduced. This should be fixed. Is this something you need urgently or is it only that the error message that could be improved?

@LiuLiujie
Copy link
Contributor Author

Hey Ben! It's not something urgent. I just came across this potential bug when I read and debugged the code.

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

No branches or pull requests

2 participants