-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Fix function number datatype from char to uint16_t #11365
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
Conversation
rewrite the modified part to pass lint check Use 2 bytes for func num in fun_registry Fix errors in linter Add the declaration of the helper functions set 2 bytes for func num in func_registry test units pass num_func by value This commit change the datatype of the number of the function from 1 Byte to 2 Bytes. Besides, I use some helper functions to access the number of function and the first function name.
|
|
||
| static const TVMFuncRegistry aot_executor_registry = { | ||
| "\x0aget_input\0" | ||
| "\x0a\0get_input\0" |
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.
Do you need to update src/runtime/crt/graph_executor_module/graph_executor_module.c too?
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.
Sorry, I think that I forget to update src/runtime/crt/graph_executor_module/graph_executor_module.c in #10014.
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.
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.
good catch, done
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 think this line in python/tvm/micro/func_registry.py can be replaced with the following lines.
import struct
encoded_NumFuncs = [f"\\{v:03o}" for v in struct.pack("H", len(funcs))]
encoded_funcs = "".join(encoded_NumFuncs) + "\\0".join(funcs)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.
@A1245967 that's a good point. I actually looked at this further and I don't see this function called. I think this approach was from before we emitted the FuncRegistry in codegen. I just went ahead and deleted that file.
* No longer needed and not called anywhere. * Superseded by emitting the FuncRegistry directly in codegen.
This a re-submit of #10014 with a CI fix.
cc @A1245967 @driazati