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 6981271
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T18:08:05+00:00 2026-05-27T18:08:05+00:00

Windows 7 AMD App SDK 2.6 Asic: Redwood I am trying to write a

  • 0

Windows 7
AMD App SDK 2.6
Asic: Redwood

I am trying to write a simple pass-thru kernel to see what the issue is and I can’t seem to find what the error might be.

void kernel_test(CLManager* clMgr, int W, int H)
{
    cl::ImageFormat format;
    format.image_channel_order = CL_RGBA;
    format.image_channel_data_type = CL_FLOAT;

    cl_float4* inp = new cl_float4[W * H];

    for (int i = 0; i < W * H; ++i)
    {
        inp[i].s[0] = 1.0f;
        inp[i].s[1] = 0.0f;
        inp[i].s[2] = 0.0f;
        inp[i].s[3] = 1.0f;
    }

    cl_float4* oup = new cl_float4[W * H];

    cl::Image2D clInputImage  = clMgr->createImage<cl::Image2D>(CL_MEM_READ_ONLY, format, W, H, 0, NULL);
    cl::Image2D clOutputImage = clMgr->createImage<cl::Image2D>(CL_MEM_WRITE_ONLY, format, W, H, 0, NULL);
    cl::Sampler sampler = clMgr->createSampler(CL_FALSE, CL_ADDRESS_CLAMP_TO_EDGE, CL_FILTER_NEAREST);

    cl::size_t<3> origin;
    origin[0] = 0; origin[1] = 0, origin[2] = 0;
    cl::size_t<3> region;
    region[0] = W; region[1] = H; region[2] = 1;

    unsigned int pgmID = clMgr->buildSource("CL/convolution.cl");

    cl::Kernel* kernel = clMgr->makeKernel(pgmID, "passthru");

    cl::CommandQueue* queue = clMgr->getCmdQueue();

    queue->enqueueWriteImage(clInputImage, CL_TRUE, origin, region, 0, 0, inp, 0, NULL);

    int status;

    status = kernel->setArg(0, clInputImage);
    status = kernel->setArg(1, clOutputImage);
    status = kernel->setArg(2, sampler);

    cl::NDRange globalSize(W, H);

    std::cout << "Starting Kernel: passthru" << std::endl;

    status = queue->enqueueNDRangeKernel(*kernel, 2, globalSize, cl::NullRange);

    std::cout << "Ending Kernel: passthru" << std::endl;

    status = queue->enqueueReadImage(clOutputImage, CL_TRUE, origin, region, 0, 0, oup);
}

The kernel looks like this

__kernel
void passthru(__read_only image2d_t sourceImage,
                 __write_only image2d_t outputImage,
                 sampler_t sampler)
{
    // Store each work-items unique row and column
    int2 coords = (int2){get_global_id(0), get_global_id(1)};
    float4 pixel = read_imagef(sourceImage, sampler, coords);
    write_imagef(outputImage, coords, pixel);
}

So I am clearing the input image to RED and then the kernel should just write back the RED color to the output. However, it just writes out 0.0f for everything in output. Any particular reason why I am not seeing the values in the clOutputImage?

  • 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-05-27T18:08:06+00:00Added an answer on May 27, 2026 at 6:08 pm

    The problem was this line.
    status = queue->enqueueNDRangeKernel(*kernel, 2, globalSize, cl::NullRange);

    I was mistakenly assumed the C argument list and added 2 as dimensions. Removing the 2 solved the problem.

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

Sidebar

Related Questions

Let's think about a simple C program compiled in Windows. I can compile the
Windows Forms allows you to develop Components, non-visual elements that can have a designer.
Windows 6 (Vista and Server 2008) support proper symbolic links, which can be created
Windows Server 2008 / IIS 7... I am trying to setup and CI environment
I am trying to configure maven 3.0.3 for windows 7. I have it on
I try to uninstall Java ME SDK from Windows 7 x64, but it doesn't
My workstation has an AMD Phenom II x6, 4GB DDR3 ram, and Windows XP
Windows has a feature that allows an administrator to perform auto-logon whenever it is
Windows XP Disk Defragmenter report shows a constant gap in disk usage on a
Windows Forms: For System.Drawing there is a way to get the font height. Font

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.