-
Notifications
You must be signed in to change notification settings - Fork 209
Port TorchCraft communication frames from txt to binary #213
Comments
The test we usually do for anything related to the replay format is here: https://github.com/TorchCraft/TorchCraft/blob/master/examples/dump_replay.lua |
Seconding @jgehring 's suggestion of FlatBuffers. It has the third-fastest round-trip serialization among these benchmarked libraries: https://github.com/thekvs/cpp-serializers (accepting the usual disclaimers about the utility of benchmarks).
For FlatBuffers, that'd entail:
|
We already use flatbuffers for some stuff https://github.com/TorchCraft/TorchCraft/tree/master/BWEnv/fbs I think that's the point of the remark of @jgehring . My point of view: "Yay go FBs!" |
Yup, the current wire protocol is using fbs for message serialization, so it's a natural choice. One particular advantage (in general) is its zero-overhead deserialization which makes it a great option for e.g. ML datasets. At the path that @syhw is pointing to, there's already a small script which prepares the fbs header file. We keep that one in git directly (and also include the fbs header) so that we don't introduce another build-time dependency. The frame-related serialization methods are located in replayer/frame.cpp. We can use fbs for the replayer as well, but as a first step it might be easier to use fbs-serialized frames for client-server communication only (basically, having meaningful structs for Frame.data in messages.fbs and doing serialization in BWEnv and deserialization in TC client). As you said, we can then also port all of replayer, including frame diffs, to fbs. Note that the current struct-based setup of One caveat (if you're on macOS) is that IIRC @syhw mentioned that the recent fbs version from Homebrew is somehow borked; I can't remember the details though. |
What are we hoping to maintain compatibility with? StarData? |
StarData already doesn't work on develop. I think it's fine to just replace everything, but I might be missing something obvious. |
I wanted to point out that changing the actual data-structures as opposed to just the serialization format is a bigger effort and affects library users, scripting frontends, etc. |
Run all TC tests + test with the bot.
The text was updated successfully, but these errors were encountered: