Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Char* has wrong stride #1396

Closed
Rekt3421 opened this issue Sep 11, 2024 · 1 comment
Closed

Char* has wrong stride #1396

Rekt3421 opened this issue Sep 11, 2024 · 1 comment
Assignees

Comments

@Rekt3421
Copy link
Collaborator

Rekt3421 commented Sep 11, 2024

/**
 * This kernel function only fills a buffer with the sentence 'Hello World!'.
 **/

__kernel void helloWorld(__global char* data){
    data[0] = 'H';
    data[1] = 'e';
    data[2] = 'l';
    data[3] = 'l';
    data[4] = 'o';
    data[5] = ' ';
    data[6] = 'W';
    data[7] = 'o';
    data[8] = 'r';
    data[9] = 'l';
    data[10] = 'd';
    data[11] = '!';
    data[12] = '\n';
    data[13] = 0;
}

it generates the following error

error: 28: Structure id 10 decorated as Block for variable in StorageBuffer storage class must follow relaxed storage buffer layout rules: member 0 contains an array with stride 1 not satisfying alignment to 4
  %_struct_10 = OpTypeStruct %_runtimearr_uint

Build Status: -2Build Log:	 clvk-RoBPoh/source.cl:22:1: warning: null character ignored
   22 | <U+0000>
      | ^
clvk-RoBPoh/source.cl:22:2: warning: no newline at end of file
   22 | <U+0000>
      |         ^
changing __global char* type to __global int* resolves the issue.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants