<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/124696>124696</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[HLSL] Invalid error reported for `int3` vector with packoffset
</td>
</tr>
<tr>
<th>Labels</th>
<td>
HLSL
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
hekota
</td>
</tr>
</table>
<pre>
The following code reports `error: packoffset cannot cross register boundary` in Clang while DXC compiles it fine.
```
cbuffer CB {
int2 c : packoffset(c1.y);
};
[numthreads(4,1,1)]
void main() {}
```
https://godbolt.org/z/4as9ebned
The problem is that in Clang the width and alignment of the `int3` type is 128 bits because it must be a power of 2. HLSL seems to align vectors based on the width of a single element.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJxcksuOozoQhp-m2JQaGXNfsMhF0TlS72YWszW4AE8bG9lFoszTj0gidU9LhbDkuvz1-VcxmskRdVAeoTwnauPZh26mD88q6b2-dz9nwtFb62_GTTh4TRho9YEjQiUoBB8gP-Cqhg8_jpEYB-WcZxyCjxEDTSYyBez95rQKd6gEGocnq9yEt9lYwvOvEw5-WY2liIZxNI5SBHHYoxKvEIeh38aRAp6OiFAfQRwQjWOJA_4rAWQzZOkdZAv5ngb1-XUQByiPblt4DqR0BNkUIE_Z82uhPIM4XL3RuCjjQDYg28eo-vxNy8y8RsgPIC8gL5PXvbec-jCBvPwBeSlUbKl3pJ9Td4pr8L2lBU1EnhV_UuCZ8GY0z6icRmXN5BZyjH58XEEljON8B8f3lfb6TDbYG47Y06C2SDu1ZYuMPaHC1d8o7NUyxf_ef7xjJFoisn_2xisN7EPEXkXS6N0XAX5EhdG4yRKSpV1Gmugu123eqoS6rM4bUYhG1snc9W3bFKTKoqJqqOqxFW0hdC1aVedZVueJ6aSQpchkI0pRizrNxrrJh3Gsez2KLNNQCFqUsam112Wnl5gYN-oyWVRtlVjVk40Pc0q5bwJS7jYN3Z7_1m9ThEJYEzl-dmDD9mHoR0F5xv_dVVmj8eHVl3lJ4-jDV7RPKHgzPH9xUrIF2317a8Pz1qeDX0Be9qmv39sa_G8aGOTlsUQEeXntce3k3wAAAP__peATvQ">