[llvm-dev] RFC: Comprehensive Static Instrumentation
Dean Michael Berris via llvm-dev
llvm-dev at lists.llvm.org
Fri Jun 24 13:03:43 PDT 2016
Hi TB,
On Thu, Jun 23, 2016 at 7:31 PM TB Schardl <neboat at mit.edu> wrote:
> Hey Dean and Matthias,
>
> Thanks for pointing out XRay to us.
>
> Implementing XRay on top of CSI is an interesting question. Like XRay,
> CSI can insert instrumentation at function entry and exit points (as well
> as at many other points in the IR). CSI and XRay effectively instrument
> programs in different ways, however. Using CSI, the IR of a CSI tool is
> integrated with the IR of the program-under-test such that the code of the
> tool is always executed when the instrumented program is run. (The
> tool-writer might implement their tool to execute instrumentation code
> conditionally based on a flag that is toggled during program execution, but
> implementing such functionality is up to the tool-writer.) XRay sleds,
> however, are regions of assembly added to the program-under-test that can
> be overwritten at runtime into calls to an XRay tool. It would be
> interesting to explore down the road what the tradeoffs are of these
> different approaches, as well as how these strategies might be unified into
> the same framework.
>
We have published a white-paper (
http://research.google.com/pubs/pub45287.html) which details more about
what XRay does and how it does it, in case you wanted more details. :)
>
> Regarding runtime components in CSI-tools: I don't think there should be
> any issue with a CSI tool using a runtime component. In fact, if you have
> an example XRay tool available, we'd be interested in trying to port it to
> CSI. I think the CSI port should be able to replicate the functionality of
> the tool, though I don't know how its performance will compare to the XRay
> approach. Is there some place where we can grab an XRay tool to try out?
>
>
I've just recently (in the past couple of days) published the third piece
of the patches that will allow you to try out a very prototype, still work
in progress, XRay implementation in LLVM. These are:
http://reviews.llvm.org/D19904 -- patch to the LLVM core
http://reviews.llvm.org/D21612 -- patch to the compiler-rt project
http://reviews.llvm.org/D20352 -- patch to Clang to support flags and
attributes
If the patches apply cleanly (I haven't synced for a few days now) to the
tip of all three projects, you can then build a single-object-file-binary
(I'm still working on getting multiple object-file support to work) that
will have XRay's demo runtime in clang with the -fxray-instrument and
-fxray-instruction-threshold=1 flags added to your clang invocation.
This is clearly still work in progress, but it should give you an idea of
how it will probably end up working in some form.
Cheears
> Cheers,
> TB
>
> On Fri, Jun 17, 2016 at 1:36 AM, Dean Michael Berris via llvm-dev <
> llvm-dev at lists.llvm.org> wrote:
>
>> On Fri, Jun 17, 2016 at 5:42 AM Matthias Braun via llvm-dev <
>> llvm-dev at lists.llvm.org> wrote:
>>
>>> Some of this overlaps with the features in XRay (
>>> http://lists.llvm.org/pipermail/llvm-dev/2016-April/098901.html).
>>>
>>>
>> Matthias beat me to it!
>>
>> From reading the RFC, it seems that some of what XRay is doing on the
>> instrumentation side is very similar to what CSI enables. The current
>> implementation I'm working with (in http://reviews.llvm.org/D19904)
>> requires some very deep integration with the LLVM compiler infrastructure
>> (essentially a machine function pass, and instruction lowering on a
>> per-platform basis).
>>
>> The development of XRay has a few trade-offs for code-size effect and
>> runtime overhead, which I suspect are unique to XRay's target use-case
>> which is for efficient function call accounting/tracing.
>>
>> So I have two high-level questions:
>>
>> - Will something like XRay be implementable on-top of CSI?
>> - How will the runtime components cooperate or be handled by tools built
>> on top of CSI?
>>
>> Cheers
>>
>> _______________________________________________
>> LLVM Developers mailing list
>> llvm-dev at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160624/60335712/attachment.html>
More information about the llvm-dev
mailing list