[cfe-dev] OpenCL & SPIR specific types - proposal and patch

Tanya Lattner lattner at apple.com
Fri Oct 19 22:44:52 PDT 2012


Guy,


+    case BuiltinType::OCLSampler:
+    case BuiltinType::OCLEvent:
+    case BuiltinType::OCLImage1d:
+    case BuiltinType::OCLImage1dArray:
+    case BuiltinType::OCLImage1dBuffer:
+    case BuiltinType::OCLImage2d:
+    case BuiltinType::OCLImage2dArray:
+    case BuiltinType::OCLImage3d:
+      // Currently these types are pointers to opaque types.
+      Width = Target->getPointerWidth(0);
+      Align = Target->getPointerAlign(0);
+      break;
     }

Is wrong if sampler is i32 I think.

Also, probably wrong:
+  case BuiltinType::OCLSampler:
+    return getOrCreateStructPtrType("opencl_sampler_t", OCLSamplerDITy);

Why do this?
+  } else if (type->isSamplerT()) {
+    CGM.getOpenCLRuntime().initializeOpenCLSampler(this, lvalue.getAddress(), EmitScalarExpr(init));
   } 

I also don't understand  why you need to go through the OpenCLRuntime for this.
+  if (D->getType()->isSamplerT()) {
+    getOpenCLRuntime().initializeOpenCLSampler(NULL, GV, Init);
+  } else {
+    GV->setInitializer(Init);
+  }

I would rather just see sampler ripped out for now. I have no issues with the images/event code.

-Tanya


On Oct 16, 2012, at 1:40 PM, Benyei, Guy wrote:

> Attached a patch that makes sampler_t an i32 – I still think opaque types would be more in the OpenCL spec’s spirit, however it’s more important to get this patch committed. Changing the sampler_t representation won’t be a big issue on top of this.
>  
> I’ve also added sampler_t initialization including restrictions, and fixed Anton Lokhmotov’s latest remarks.
>  
> Please review.
>  
> Thanks
>  
>  
> <image001.png>
>  
> From: Tanya Lattner [mailto:lattner at apple.com] 
> Sent: Monday, October 15, 2012 20:47
> To: Benyei, Guy
> Cc: Richard Smith; cfe-dev at cs.uiuc.edu; Villmow, Micah; Anton.Lokhmotov at arm.com
> Subject: Re: [cfe-dev] OpenCL & SPIR specific types - proposal and patch
>  
> Given there is some discussion on sampler still, I suggest you remove it from your patch so the rest can get a final review and hopefully get into the tree.
>  
> -Tanya
>  
> On Oct 9, 2012, at 1:49 PM, "Benyei, Guy" <guy.benyei at intel.com> wrote:
> 
> 
> I’ve refactored the code to remove the repeated parts, and also fixed Anton Lokhmotov’s comments.
>  
> Please review.
>  
> Thanks
> <image001.png>
>  
> <opencl_types5.patch>
> ---------------------------------------------------------------------
> Intel Israel (74) Limited
> 
> This e-mail and any attachments may contain confidential material for
> the sole use of the intended recipient(s). Any review or distribution
> by others is strictly prohibited. If you are not the intended
> recipient, please contact the sender and delete all copies.
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20121019/b3352b1e/attachment.html>


More information about the cfe-dev mailing list