[PATCH] D142642: [mlgo] Introduce an "InteractiveModelRunner"

Mircea Trofin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 27 15:08:46 PST 2023


mtrofin added inline comments.


================
Comment at: llvm/lib/Analysis/InteractiveModelRunner.cpp:50
+  const size_t Limit = OutputBuffer.size();
+  while (InsPoint < Limit) {
+    auto Read = Inbound.read(Buff + InsPoint, OutputBuffer.size() - InsPoint);
----------------
mtrofin wrote:
> jacobhegna wrote:
> > When waiting for advice, the compiler blocks until it reads the number of bytes specified by the output tensor spec size. Do we want to make any assurances of what will happen if the host sends bad data back over the wire, writes too much data, etc? Or we just say "that's the host's problem." If so, I think we should document that in the description of the class.
> > 
> Good point, I added a doc header to the new class. To your q, we don't want to make any assurances. Bugs would be quite quickly detectable; and assurances would be kind of difficult to offer - in the fifo case, it's possible that it might appear insufficient data were sent, for example.
Thought about it more and added a way for the user to get a dump of the values the compiler thinks it gets from the host, because otherwise debugging that side of things would have been harder - especially since one of the values of this feature is that ML researchers could just use a released clang "out of the box"

@ChrisCummins this means one can pass to clang `-mllvm -interactive-model-runner-echo-type=<value>` where the value is the scalar value of the advice tensor, and clang will output to `stderr` the vector of values it received. So then the researcher can debug that side of things without needing to debug clang.

This is how the help of the option looks like:

```
--interactive-model-runner-echo-type=<value>                      - The InteractiveModelRunner will echo back to stderr the data received from the host as the specified type (for debugging purposes).
    =float                                                          -   float
    =double                                                         -   double
    =int8_t                                                         -   int8_t
    =uint8_t                                                        -   uint8_t
    =int16_t                                                        -   int16_t
    =uint16_t                                                       -   uint16_t
    =int32_t                                                        -   int32_t
    =uint32_t                                                       -   uint32_t
    =int64_t                                                        -   int64_t
    =uint64_t                                                       -   uint64_t 
    =disable                                                        -   Don't echo
```


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D142642/new/

https://reviews.llvm.org/D142642



More information about the llvm-commits mailing list