Skip to content

Conversation

@areusch
Copy link
Contributor

@areusch areusch commented May 18, 2022

This a re-submit of #10014 with a CI fix.

cc @A1245967 @driazati

A1245967 and others added 2 commits May 18, 2022 16:02
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.
@github-actions github-actions bot requested a review from driazati May 18, 2022 23:04

static const TVMFuncRegistry aot_executor_registry = {
"\x0aget_input\0"
"\x0a\0get_input\0"
Copy link
Contributor

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?

Copy link
Contributor

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@A1245967 @areusch There's also python/tvm/micro/func_registry.py which seems to need updating too, although it is unclear if this function graph_json_to_c_func_registry() is used anywhere.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch, done

Copy link
Contributor

@A1245967 A1245967 May 19, 2022

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)

Copy link
Contributor Author

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.

areusch added 2 commits May 18, 2022 16:48
 * No longer needed and not called anywhere.
 * Superseded by emitting the FuncRegistry directly in codegen.
@masahi masahi merged commit 07d91fa into apache:main May 20, 2022
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

Successfully merging this pull request may close these issues.

5 participants