[llvm-branch-commits] [llvm] [HLSLSemanticSignatures] Implement the prefix packing of elements (PR #218062)

Helena Kotas via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Aug 28 17:49:59 PDT 2026


================
@@ -200,3 +200,54 @@ reg1: unused.xyzw
 reg2: Color2.xy | unused.zw
 reg3: Color3.xyzw
 ```
+
+### Prefix-Stable Packing
+
+Prefix-stable packing is used for signatures that connect programmable shader
+stages or carry patch constant data. Elements are visited in declaration order
+and placed at the first compatible location in the 32-row by 4-column register
+space. Once an element is placed it is never moved, so appending elements to a
+signature does not change the locations assigned to its existing prefix.
+
+Elements can share unused components in a row when all applicable packing
+constraints are satisfied:
+
+- Every element in a row must have a compatible interpolation mode.
+- When native 16-bit types are enabled, every element in a row must have the
+  same component width. Without native 16-bit types, min-precision values
+  occupy 32-bit components.
+- Components are ordered from arbitrary values, to system values, to system
+  generated values.
----------------
hekota wrote:

```suggestion
- Elements are ordered by category: arbitrary values first, followed by system values, and then system-generated values. For example, a system value can never be packed to the left of an arbitrary value.
```
This might be worth rephrasing - it took me a while to understand what this means :).

https://github.com/llvm/llvm-project/pull/218062


More information about the llvm-branch-commits mailing list