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

Some drivers don't like constants constructed with OpUndef scalar components #95

Closed
dneto0 opened this issue Oct 18, 2017 · 2 comments
Closed

Comments

@dneto0
Copy link
Collaborator

dneto0 commented Oct 18, 2017

Example input:

void kernel foo(global float4* A)
{
  float4 value;
  value.w = 1111.0f;
  *A = value;
}

Produces assembly including this:

         %13 = OpUndef %float
 %float_1111 = OpConstant %float 1111
         %15 = OpConstantComposite %v4float %13 %13 %13 %float_1111
         %16 = OpSpecConstant %uint 1
         %17 = OpSpecConstant %uint 1
         %18 = OpSpecConstant %uint 1
%gl_WorkGroupSize = OpSpecConstantComposite %v3uint %16 %17 %18
         %20 = OpVariable %_ptr_Private_v3uint Private %gl_WorkGroupSize
         %21 = OpVariable %_ptr_StorageBuffer__struct_5 StorageBuffer
         %22 = OpFunction %void None %9
         %23 = OpLabel
         %24 = OpAccessChain %_ptr_StorageBuffer_v4float %21 %uint_0 %uint_0
               OpStore %24 %15
               OpReturn
               OpFunctionEnd

Some drivers have trouble with the OpConstantComposite. They happen to work if we use
%13 = OpConstantNull %float
instead.

dneto0 added a commit to dneto0/clspv that referenced this issue Oct 18, 2017
dneto0 added a commit to dneto0/clspv that referenced this issue Oct 18, 2017
@dneto0
Copy link
Collaborator Author

dneto0 commented Oct 19, 2017

Use -hack-undef to work around this problem.

@dneto0
Copy link
Collaborator Author

dneto0 commented Nov 20, 2017

This is solved well enough now.

@dneto0 dneto0 closed this as completed Nov 20, 2017
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

1 participant