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

cluster-pod-kernel-args: generates too-small Offsets, but correct output in descriptormap #27

Closed
dneto0 opened this issue Aug 10, 2017 · 0 comments
Assignees

Comments

@dneto0
Copy link
Collaborator

dneto0 commented Aug 10, 2017

Example:

kernel void align(global int* A, int x, float4 c) {
  *A = x + (int)c.x;
}

Compile with:
clspv align.cl -o align.spv -cluster-pod-kernel-args -descriptormap=foot

Then the x and c arguments are collected into a single struct argument, for a storage buffer. The descriptor map is:

kernel,align,arg,A,argOrdinal,0,descriptorSet,0,binding,0,offset,0
kernel,align,arg,x,argOrdinal,1,descriptorSet,0,binding,1,offset,0
kernel,align,arg,c,argOrdinal,2,descriptorSet,0,binding,1,offset,16

That's correct.

However, in SPIR-V we have:
OpMemberDecorate %_struct_8 0 Offset 0
OpMemberDecorate %_struct_8 1 Offset 4 ; this should be offset 16

So two bugs, really: Mismatch between descriptormap and the declared struct offset. Should make the declared struct offset the same as what's reported in the descriptormap.

@dneto0 dneto0 self-assigned this Aug 10, 2017
dneto0 added a commit to dneto0/clspv that referenced this issue Aug 10, 2017
Take alignment into account, by using the DataLayout
for the target.

Also makes it match the descriptormap output, which is already
more correct.

Fixes google#27
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