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

[Runtime] Python String container interface #5047

Closed
wweic opened this issue Mar 12, 2020 · 5 comments
Closed

[Runtime] Python String container interface #5047

wweic opened this issue Mar 12, 2020 · 5 comments
Assignees

Comments

@wweic
Copy link
Contributor

wweic commented Mar 12, 2020

  • Provide python interface to use runtime String container.
  • Migrate existing string use cases to the python interface.
@wweic wweic self-assigned this Mar 12, 2020
@tqchen
Copy link
Member

tqchen commented Mar 18, 2020

cc @zhiics @mbaret @comaniac @jroesch we probably needs to migrate the use of StringImm to String once the string container is introduced

@wweic
Copy link
Contributor Author

wweic commented Mar 19, 2020

@tqchen Could you give me pointers to codes where we can use the python string api to pass strings around? I'll use them as example to drive my implementation.

@zhiics
Copy link
Member

zhiics commented Mar 19, 2020

@wweic, probably all places we used stringimm?

@tqchen
Copy link
Member

tqchen commented Mar 19, 2020

I can see the following steps:

  • Introduce the string container
    • We need to think about how to make the String object works like a normal python string(possibly subclass str?, I haven't dig deep)
    • At this stage users can pass and return String but need to explicitly do so
  • Add automatic conversion from TVMArgValue to String, when the argument is c string pointer and bytes, automatically convert to a String container(via copy).
  • Change the original usage of StringImm to use String instead
  • Change automatic object conversion(tvm.convert) https://github.com/apache/incubator-tvm/blob/master/python/tvm/runtime/object_generic.py#L59 to convert python str to String object
  • Remove constructor of Expr from std::string(as it will no longer be needed), we will use Array for most cases
  • Add reflection support to serialize a String (so we can dump a String object to json).

@tqchen
Copy link
Member

tqchen commented Apr 24, 2020

#5426

@tqchen tqchen closed this as completed Apr 30, 2020
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

3 participants