From: Alan L. <ac...@gm...> - 2007-05-21 02:04:13
|
Thanks for the reply, Mike: I left out some details earlier so that I don't bore everyone here. :) So in short what I want to do is create an optimization pass that parallelizes certain methods to be run on a graphics card's GPU. Currently my pass is in SSAinHIR after the load elimination pass. For example given this program: for (int i =3D 0; i < size; i ++) { a[i] =3D a[i] * a[i]; } I want to transform it to someting like this: if (centainConditionsAreMet) { Program p =3D new GPUProgram(); p.begin(); p.appendFloatMult(.....); p.end(); p.execute(a); } else { for (int i =3D 0; i < size; i ++) { a[i] =3D a[i] * a[i]; } } So what I said earlier isn't entirely correct, I don't neccessary remove the exisiting float_mut in most cases. Sometimes, a single HIR instruction might need more than one append____ calls as well. If I use the bcIndex of the orginal instruction in the class file, I'll get the following error in the VM_OptLinker: "Unexpected case in VM_OptLinker.resolveDynamicLink case" I think this is due to the fact that in the BC stream, the original instruction is not a method call. Any idea of what I should do? Thanks! -Alan On 5/20/07, Michael Bond <mik...@cs...> wrote: > > Hi Alan, > > Yeah, it's important to set both a bcIndex and a position (of type > OPT_InlineSequence) for inserted method calls. Perhaps you're not settin= g > the position correctly? Just using the old instruction's position will > likely work. > > Are you sure you want the call to my_float_mul to be an InvokeVirtual? > If my_float_mul is static, which it seems likely to be, then you'll want > to use InvokeStatic. Also, InvokeVirtual and InvokeStatic are specific t= o > the bytecode. Are you trying to insert your call in BC2IR? In my > experience, this isn't the easiest place to insert code. You might try > adding your transformation sometime after the conversion to HIR; for > example, OPT_ExpandRuntimeServies is often a relatively easy place to > insert code. > > Hope that's helpful. If you could provide more information about what > you're trying to do, where in the IR transformation process you're > performing your pass, and the error(s) you're getting, that might help. > > cheers, > Mike > > On Fri, 18 May 2007, Alan Leung wrote: > > > Hi all: > > > > I think my problem is caused by OPT_Linker and MC Maps. When I am > inserting > > my method calls, > > I am not properly setting the bcIndex of the newly created call > instruction. > > > > For example: In an opt compiler pass, i want to replace all float_mul t= o > > InvokeVirtual of "my_float_mul(FF)F". > > The MC Map would not work properly if I simply set the call's bcIndex t= o > > that of the original float_mul's bcIndex. > > > > In this case, what should I set the bcIndex to be? Or should I be addin= g > > extra entries in the bytecode stream instead? > > > > Thanks. > > > > -Alan > > > > > > On 5/14/07, Santiago Gala <sg...@ap...> wrote: > >> > >> El dom, 13-05-2007 a las 14:08 -0700, > >> jik...@li... escribi=F3: > >> > Subject: [Jikesrvm-researchers] Need help inserting method calls > >> > To: jik...@li... > >> > Message-ID: > >> > <c24...@ma...> > >> > Content-Type: text/plain; charset=3D"iso-8859-1" > >> > > >> > Hi all: > >> > > >> > I am currently writing a opt compiler pass that requires inserting > >> > some method calls and some loop transformations. However, after > >> > inserting the calls, all the transformation seems to be undone. I > have > >> > a feeling that it fell back to the baseline compiler every time I > >> > insert my calls. > >> > > >> Any exception thrown in your optimizing pass (or later in the > >> optimization code) will cause the harness to forget the attempt to > >> optimize and use (or revert to) the baseline version. > >> > >> I found that when I was working on the quick compiler on powerPC, a fe= w > >> releases ago, but it guess it is still true. > >> > >> I'd tell you to debug your code, as it looks like it is throwing > >> exceptions, and ensure it is working via a debugger. > >> > >> Regards > >> Santiago > >> > >> > >> > ------------------------------------------------------------------------- > >> This SF.net email is sponsored by DB2 Express > >> Download DB2 Express C - the FREE version of DB2 express and take > >> control of your XML. No limits. Just data. Click to get it now. > >> http://sourceforge.net/powerbar/db2/ > >> _______________________________________________ > >> Jikesrvm-researchers mailing list > >> Jik...@li... > >> https://lists.sourceforge.net/lists/listinfo/jikesrvm-researchers > >> > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Jikesrvm-researchers mailing list > Jik...@li... > https://lists.sourceforge.net/lists/listinfo/jikesrvm-researchers > > |