kernel_tuner
kernel_tuner copied to clipboard
Instance won't be None
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.
https://github.com/KernelTuner/kernel_tuner/blob/5d8e636957a044649f8eacecd52217c5c7eb6f0a/kernel_tuner/interface.py#L763-L768
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?
Hey Ben! It's not something urgent. I just came across this potential bug when I read and debugged the code.