Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8361843
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T11:47:44+00:00 2026-06-09T11:47:44+00:00

OpenCL 1.1, using Cloo 0.9.1.0. For a certain CL module I get a crash

  • 0

OpenCL 1.1, using Cloo 0.9.1.0.

For a certain CL module I get a crash at the following line:

program.Build(null, null, null, IntPtr.Zero);

Visual Studio 2010 tells me this:

An unhandled exception of type ‘System.AccessViolationException’
occurred in Cloo.dll

Additional information: Attempted to read or write protected memory.
This is often an indication that other memory is corrupt.

I have trace the error to a certain line of code.

int offset = 1000000 * (input == 0); // This is the culprit!
const sampler_t smp = CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRESS_CLAMP | CLK_FILTER_NEAREST;
int4 pixel = read_imagei(image, smp, (int2)(offset + x, y));

I’m using the trick above to avoid branching. It works perfectly in all but one situation where the above yields an access violation at compile-time. If I remove the conditional multiplication it works. E.g.

int offset = 1000000;
// -or-
int offset = (input != 0 ? 0 : 1000000);

Am I facing a compiler bug here? How do I work around this error?

Some details about my Graphics card/driver:

Driver Packaging Version: 8.85.7.2-110901a1-125827C-Fujitsu Technology

Solutions Provider: ATI Technologies Inc. 2D Driver Version: 8.01.01.1152

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T11:47:46+00:00Added an answer on June 9, 2026 at 11:47 am

    It’s a compiler bug. Hopefully it will get fixed some day. For now, I will just avoid that specific optimization trick.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I built the opencl program using the commands: gcc -c -I ~/AMDAPP/include main.c -o
To create a opencl application the fist step is to get platforms by using
I trying to use OpenCL using HASKELL. I write a simple program converting a
I'm writing a program using JOGL/openCL to utilize the GPU. I have code that
I'm a newbie to using OpenCL (with the OpenCL.NET library) with Visual Studio C#,
I'm calculating the Euclidean distance between n-dimensional points using OpenCL. I get two lists
I'm using the Nvidia implementation of openCL. cl_uint devicecount=NULL; cl_uint NumPlatforms; clGetPlatformIDs (0, NULL,
I'm coping data in python using OpenCL onto my graphic card. There I've a
I wrote a program in C++/OpenGL (using Dev-C++ compiler) for my calculus 2 class.
I am trying to accelerate some computations using OpenCL and part of the algorithm

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.