-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
[REFACTOR][IR] Move to runtime::String #5276
Conversation
@tqchen One problem of replacing the default container StringImm with runtime String is that some of the IR nodes are using PrimExpr which could be both StringImm or IntImm (they are implicitly converted from std::string, integers, or floats). For example, and https://github.com/apache/incubator-tvm/blob/89da63e228eae2b0b4fe39770031a042858c52a7/include/tvm/tir/stmt.h#L147-L149 Should we explicitly convert it from runtime String to StringImm in this case either before the constructor in Python or in the PackedFunc in the C++? This looks pretty ugly. Could you suggest some better solutions? |
In the case of IRnodes that need StringImm, I think we can do explicit conversation for now |
*/ | ||
TVM_DLL PrimExpr(std::string str); // NOLINT(*) | ||
TVM_DLL PrimExpr(runtime::String value); // NOLINT(*) |
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.
Can we simply remove this constructor and explicily construct StringImm in the places that we need them
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.
Yeah, I consider that as well, but it seems there are too many places using PrimExpr. Need sometime to see which one may take string.
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.
Considering the number of files changed so far, I'd like to keep this for now. It seems a bit more work. I can send a separate PR to handle it.
6c0ba1a
to
18de508
Compare
Thanks @zhiics ! |
* Use runtime::String * move string to tvm namespace * add const char* constructor * implicit cast from std::string
* Use runtime::String * move string to tvm namespace * add const char* constructor * implicit cast from std::string
* Use runtime::String * move string to tvm namespace * add const char* constructor * implicit cast from std::string
…m_data:master to master * commit 'cd0d52daa6942bdafa9363ff6cfa3d25fcd5b8d6': (824 commits) [Intrinsic] Add log1p, ldexp, atan2, hypot, nextafter, copysign (apache#5312) [Rust][CI] Restore Rust CI (apache#5137) Remove PrimExpr from String (apache#5311) [Requantize] Cleanup and Optimize Lowering (apache#5286) [IR][TRANSFORM] Enable CopyOnWrite for passes. (apache#5309) [PYTORCH]Abs, Arange, Softplus ops (apache#5295) [LLVM] Fix generation of LLVM intrinsics (apache#5282) [BYOC] Add example of Composite + Annotate for DNNL fused op (apache#5272) [Frontend][TensorFlow]Improve TensorFlow Static Shape Tensor Array (apache#5243) [RUNTIME] Introduce RValue reference(move) support to TypedPackedFunc (apache#5271) [RELAY][FRONTEND][CAFFE2] add Mul and ConvTranspose operator (apache#5302) [BYOC] Refine AnnotateTarget and MergeCompilerRegion Passes (apache#5277) [CI] Fix the hexagon string (apache#5304) [Arith] linear system and equation solver (apache#5171) [PYTORCH]Repeat, Reciprocal & Reshape Op support (apache#5280) [FRONTEND][TENSORFLOW] Fix gather_nd indices (apache#5279) Update device_annotation.cc (apache#5291) [REFACTOR][IR] Move to runtime::String (apache#5276) [NDArray] Set shape_ in NDArray::FromDLPack (apache#5301) [RUNTIME] Initial implementation of Hexagon runtime support (apache#5252) ...
#5250