eholk / harlan

A language for GPU computing.
Other
1.19k stars 83 forks source link

Comparing region variables with gensym-suffix is fragile #59

Closed eholk closed 11 years ago

eholk commented 12 years ago

Especially now with user-provided region annotations, it will be easy to violate the assumptions that compare-fallback relies on. We need a less fragile way to do this.

calvis commented 12 years ago

Like I said yesterday (or the day before), it is not the user-provided region annotations that can screw this up. If we ever redefine how gensym works, or redefine insert-let-regions, then it is possible our region inferencer will break unnecessarily. User-provided annotations will never mess with fallback regions.

eholk commented 12 years ago

I had a program fail to compile today precisely because compare-fallback made invalid assumptions about the format of region variables. I got around it by naming my region variable r_1 instead of r1. compare-fallback assumes the suffix numbers on regions are created in a certain order, so if the user can write their own numbers, compare-fallback can't assume they were created in the right order anymore.

calvis commented 12 years ago

Oh, then this isn't working how I intended already. Should user defined regions be fallback regions?

eholk commented 12 years ago

I don't see why not. To me their just regions that the user has a little more control over.

On Fri, Nov 2, 2012 at 3:31 PM, Claire Alvis notifications@github.comwrote:

Oh, then this isn't working how I intended already. Should user defined regions be fallback regions?

— Reply to this email directly or view it on GitHubhttps://github.com/eholk/harlan/issues/59#issuecomment-10027443.

calvis commented 12 years ago

My idea was that they were regions the compiler created in case it wasn't possible to put them on a "better" region, i.e. a user defined region.

eholk commented 11 years ago

Are fallback regions the ones inserted by insert-let-regions? If so, I think this is what happens, but the inferencer still ends up trying to compare Harlan-generated regions with user-generated regions because it doesn't have a way of distinguishing the two.

On Sat, Nov 3, 2012 at 5:58 PM, Claire Alvis notifications@github.comwrote:

My idea was that they were regions the compiler created in case it wasn't possible to put them on a "better" region, i.e. a user defined region.

— Reply to this email directly or view it on GitHubhttps://github.com/eholk/harlan/issues/59#issuecomment-10044739.

calvis commented 11 years ago

Yes, that is the intention. Perhaps there needs to be a way to distinguish between fallback regions and user-defined regions within a let-region, or something.

eholk commented 11 years ago

Closing, since we've replaced the region inferencer.