[LLVMdev] Is metadata the right thing to associate one instruction to another?

Hal Finkel hfinkel at anl.gov
Tue Jul 21 20:08:58 PDT 2015


----- Original Message -----
> From: "Frank Winter" <fwinter at jlab.org>
> To: "Michael Zolotukhin" <mzolotukhin at apple.com>
> Cc: llvmdev at cs.uiuc.edu
> Sent: Monday, July 13, 2015 2:37:00 PM
> Subject: Re: [LLVMdev] Is metadata the right thing to associate one instruction to another?
> 
> Hi Michael!
> 
> Thanks for your reply, I appreciate the info how others do this. I
> was
> thinking of a hash function but was still hoping for a constant time
> solution :-)

Hash tables give you average O(1) lookups, and I think that's as good as you're going to get. We have to guard the size of Instruction objects pretty carefully.

> Would be great to attach/store a (user) pointer to/along with an
> instruction..

The metadata entries are not stored in the Instruction object either (except for debug metadata, but that's a hard-coded special case). For everything else, you're going through a hash table.

 -Hal

> 
> Thanks,
> Frank
> 
> 
> On 07/13/2015 03:04 PM, Michael Zolotukhin wrote:
> > Hi Frank,
> >
> > Can you just create a hash ScalarInstruction -> WidenedInstruction?
> > This is the way other vectorizers usually save such data.
> >
> > I don’t know much about metadata, so I’ll leave this part of the
> > question for someone else:)
> >
> > Michael
> >> On Jul 13, 2015, at 10:39 AM, Frank Winter <fwinter at jlab.org>
> >> wrote:
> >>
> >> Background: I am still working on vectorizing (widening) a whole
> >> instruction tree (from the loads to the stores). I have all
> >> scalar loads in a SetVector and have created widened version of
> >> them (new instructions).
> >>
> >> What would be very useful to have is the possibility to get to the
> >> vector load instruction from the scalar load in constant time. I
> >> was thinking to somehow add the vector load instruction (pointer)
> >> to the scalar version as metadata. With that, the traversal of
> >> the scalar tree can quickly get the vector version of the loads.
> >> But metadata seems to work with strings of MDNodes. That makes me
> >> worry if metadata is what I want..
> >>
> >> My question: Is metadata the only possibility to 'associate' (in
> >> the sense of making it quickly accessible) an instruction to
> >> another? What type of metadata would be recommended ?
> >>
> >> Thanks,
> >> Frank
> >>
> >> _______________________________________________
> >> LLVM Developers mailing list
> >> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> >> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
> 
> 
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
> 

-- 
Hal Finkel
Assistant Computational Scientist
Leadership Computing Facility
Argonne National Laboratory




More information about the llvm-dev mailing list