Uh oh!
There was an error while loading. Please reload this page.
[Object] Add String container - #4628
Conversation
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
wweic
commented
Jan 12, 2020
@tqchen@FrozenGene Thanks for the comments. Please take a look again. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
tqchen
commented
Jan 12, 2020
we can do it in a followup PR but as a reminder, we need python side wrapper for String and perhaps we need to make some special treatment to make sure python could treat it as customized string types (e.g. by subclass string or related). |
Uh oh!
There was an error while loading. Please reload this page.
tqchen
commented
Jan 31, 2020
gentle ping |
wweic
commented
Feb 1, 2020
@tqchen I'll send new revision soon. |
880f432 to
28beaadCompareUh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
@wweic here is a code snippet that we can reuse for hash. We should consider migrate to require c++14, which will give us string view support #defineTVM_USE_CXX14_STRING_VIEW \
defined(__cpp_lib_experimental_string_view) && __cpp_lib_experimental_string_view >= 201411
#defineTVM_USE_CXX17_STRING_VIEW \
defined(__cpp_lib_string_view) && __cpp_lib_string_view >= 201606
#include<string>
#include<dmlc/logging.h>
#if TVM_USE_CXX17_STRING_VIEW
#include<string_view>
#elif TVM_USE_CXX14_STRING_VIEW
#include<experimental/string_view>
#endifintmain(int argc, char* argv[]) {
std::string xyz = "xyz";
#if TVM_USE_CXX17_STRING_VIEW
LOG(INFO) << "C++17=" << std::hash<std::string_view>()(xyz);
#elif TVM_USE_CXX14_STRING_VIEW
LOG(INFO) << "C++14=" << std::hash<std::experimental::string_view>()(xyz);
#elseLOG(INFO) << "C++11=" << std::hash<std::string>()(xyz);
#endifreturn0;
}
|
wweic
commented
Feb 9, 2020
Thanks @tqchen! I have incorporated the snippet, please let me if I should put the macro in other places. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
FrozenGene
commented
Feb 9, 2020
IMO, it is bad idea to introduce std::experimental to this core part. As C++ standard says: The behavior of a C++ program is undefined if it adds declarations or definitions to namespace std or to a namespace within namespace std unless otherwise specified. That is to say std::experimental’s behavior is not guaranteed. Different version of compilers / compared with C++17 std, std::experimental maybe have different result too. I strongly suggest we remove std::experimental from this pr. Or we could consider implementing our string::view if we think it is very important. |
@FrozenGene In general I agree that we should avoid std::experimental. In this particular case, i think the usage is fair, because it is guarded by marco tests and is only under a very limited case we a std::hash function that can hash a string without copying it(instead of using the string_view data structure).
Given the above consideration, I think it is fine to permit the limited usecase. However, I agree that we should have a more careful documentation about the std::experimental use case here and only limit it to the specific usecase. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
tqchen
commented
Mar 2, 2020
@FrozenGene @icemelon9 please help to take another look. The standard lib is the core part of the system so we need extra caution in terms of reviewing. Thanks @wweic for pushing it through. @zhiics@Hzfengsy@jroesch@ZihengJiang@yzhliu please also help to take a look if you have time. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
yzhliu
commented
Mar 3, 2020
good to me. |
Uh oh!
There was an error while loading. Please reload this page.
wweic
commented
Mar 4, 2020
CI has passed after retry 2 times. |
tqchen
left a comment
There was a problem hiding this comment.
Spot another potential problem, added comments about more test coverage
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
tqchen
commented
Mar 10, 2020
ping @wweic :) |
wweic
commented
Mar 11, 2020
@tqchen sorry for the delay. Was adjusting working from china schedules. I have addressed your comments. |
tqchen
commented
Mar 11, 2020
Thanks @wweic for all the patience to polish this core data structure. This PR is now merged. Perhaps we can move on to add python side wrappers to the String container. And followup with the final container -- Array. |
wweic
commented
Mar 11, 2020
@tqchen Yes. I'll explore Python interface for String. |
Discussion: https://discuss.tvm.ai/t/discuss-runtime-array-containers-array-adt-string/4582/38
cc @tqchen @icemelon9 @FrozenGene