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

  • Home
  • SEARCH
  • 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 8931235
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T09:04:21+00:00 2026-06-15T09:04:21+00:00

The problem is solved (If you’re interested ; you can see the second paragraph

  • 0

The problem is solved (If you’re interested ; you can see the second paragraph ; below the line) . Now I have a new question ; why #define BLOCK_DIM 16; cause an error in the function below ? Just use 16 is fine .

Here are the errors

     expected a "]"
      __local float2 block[BLOCK_DIM * (BLOCK_DIM + 1)] ;
                           ^

     line 110: error:
              expected a ")"
      __local float2 block[BLOCK_DIM * (BLOCK_DIM + 1)] ;
                                        ^

     line 110: error: operand
              of "*" must be a pointer
      __local float2 block[BLOCK_DIM * (BLOCK_DIM + 1)] ;

error:
          expected a ";"
          int Idout = get_local_id(0)*(BLOCK_DIM+1)+get_local_id(1);
                                                  ^

and the function

    __kernel void   transpose(
             __global float2* dataout, 
             __global float2* datain, 
             int width, int height)

// width = N (signal length) 
// height = batch_size (number of signals in a batch)

{
// read the matrix tile into shared memory

__local float2 block[32 * (32 + 1)] ;
   unsigned int xIndex = get_global_id(0);
   unsigned int yIndex = get_global_id(1);

    if((xIndex < width) && (yIndex < height))
    {
            unsigned int index_in = yIndex * width + xIndex;
                       int Idin = get_local_id(1)*(32+1)+get_local_id(0);
                       block[Idin]=  datain[index_in];
    }

barrier(CLK_LOCAL_MEM_FENCE);

// write the transposed matrix tile to global memory

             xIndex = get_group_id(1) * 32 + get_local_id(0);
             yIndex = get_group_id(0) * 32 + get_local_id(1);

    if((xIndex < height) && (yIndex < width))
    {
        unsigned int index_out = yIndex * height + xIndex;
        int Idout = get_local_id(0)*(32+1)+get_local_id(1);
                dataout[index_out] = block[Idout];
    }

}

===============================

I’m working to improve the perfomance of a 2D FFT on images . After a benchmark ; I regconize the transpose function is the reason make the program slow , so I replace it with a more optimized one .

But after that ; I received a return code of all the functions which work fine before CL_INVALID_KERNEL_NAME. Except the transpose function and clSetKernelArg in the host code ; I don’t change anything else . So I’m out of idea. Hope you guys help me out 🙂

UPDATE : Here are the errors . Don’t mind the line number 🙂 Those lines seems normal with me . Is anything wrong ?

error:

     expected a "]"
      __local float2 block[BLOCK_DIM * (BLOCK_DIM + 1)] ;
                           ^

     line 110: error:
              expected a ")"
      __local float2 block[BLOCK_DIM * (BLOCK_DIM + 1)] ;
                                        ^

     line 110: error: operand
              of "*" must be a pointer
      __local float2 block[BLOCK_DIM * (BLOCK_DIM + 1)] ;

error:
          expected a ";"
          int Idout = get_local_id(0)*(BLOCK_DIM+1)+get_local_id(1);
                                                  ^

Here is the kernel file

The new one :

#define BLOCK_DIM 16

__kernel void   transpose(
             __global float2* dataout, 
             __global float2* datain, 
             int width, int height)

// width = N (signal length) 
// height = batch_size (number of signals in a batch)

{
// read the matrix tile into shared memory

__local float2 block[BLOCK_DIM * (BLOCK_DIM + 1)] ;
   unsigned int xIndex = get_global_id(0);
   unsigned int yIndex = get_global_id(1);

    if((xIndex < width) && (yIndex < height))
    {
            unsigned int index_in = yIndex * width + xIndex;
                       int Idin = get_local_id(1)*(BLOCK_DIM+1)+get_local_id(0);
                       block[Idin]=  datain[index_in];
    }

barrier(CLK_LOCAL_MEM_FENCE);

// write the transposed matrix tile to global memory

             xIndex = get_group_id(1) * BLOCK_DIM + get_local_id(0);
             yIndex = get_group_id(0) * BLOCK_DIM + get_local_id(1);

    if((xIndex < height) && (yIndex < width))
    {
        unsigned int index_out = yIndex * height + xIndex;
        int Idout = get_local_id(0)*(BLOCK_DIM+1)+get_local_id(1);
                dataout[index_out] = block[Idout];
    }

}
  • 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-15T09:04:22+00:00Added an answer on June 15, 2026 at 9:04 am

    Your #define question.. they don’t require semicolons. Basically, #define X Y will replace all occurrences of “X” with “Y” in the code before being compiled, if you add a semicolon in the end that’ll become part of “Y” and create lots of syntax errors. A #define is not a statement.

    Actually, that’s a simplistic explanation, but it suffices for the scope of this question (if you want to learn more, I recommend you look at preprocessor tutorials and documentation).

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

Sidebar

Related Questions

Problem solved, see below Question I'm working in Flex Builder 3 and I have
(Problem solved now, see answers below) Hello, in my app I am trying to
Problem solved: Thanks guys, see my answer below. I have a website running in
[EDIT: Problem solved. Please see my answer below.] In my app I call the
I have been on SO for awhile now trying to get this problem solved
(Problem solved, please see the updates) I have some files that have incorrect filenames
My specific problem is solved before completing the question. But I still have a
Problem solved now i want to define one edit text to left and other
Problem Solved - See bottom for solution notes I'm trying to build a simple
Updated Problem solved, I have some design problem here. The directory looks like that:

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.