Add pack_, pack_clamp_ and unpack_ tests - #1432
Conversation
Adds tests covering a matrix of signed, unsigned, 16, and 32 bit pack, pack_clamp, and unpack intrinsics.
| int16_t4 unpackedVals; | ||
| unpackedVals.x = In[0]; | ||
| unpackedVals.y = In[1]; | ||
| unpackedVals.z = In[2]; | ||
| unpackedVals.w = In[3]; | ||
| int8_t4_packed packedVals = pack_clamp_s8(unpackedVals); |
There was a problem hiding this comment.
(For all files)
Instead of doing this, it would be easier to declare the In buffer as int16_t4 and pass it straight into the intrinsic:
Out[0] = pack_clamp_s8(In[0]);
| ... | ||
| #--- end | ||
|
|
||
| # Unimplemented: https://github.com/llvm/llvm-project/issues/99229 |
There was a problem hiding this comment.
(For all files)
nit
| # Unimplemented: https://github.com/llvm/llvm-project/issues/99229 | |
| # Unimplemented https://github.com/llvm/llvm-project/issues/99229 |
|
|
||
| # Unimplemented: https://github.com/llvm/llvm-project/issues/99229 | ||
| # XFAIL: Clang | ||
|
|
There was a problem hiding this comment.
(For all 16-bit files)
Add REQUIRES: Int16
|
|
||
| [numthreads(1, 1, 1)] | ||
| void main() { | ||
| int16_t4 unpackedVals; |
There was a problem hiding this comment.
(For all files)
nit: capitalize variable names
| @@ -0,0 +1,65 @@ | |||
| #--- source.hlsl | |||
|
|
|||
| StructuredBuffer<uint16_t> In : register(t0); | |||
There was a problem hiding this comment.
(For both the pack_clamp_s8 tests)
The input/output buffers are declared unsigned but they're used as signed.
| int8_t4_packed packedVals = pack_clamp_s8(unpackedVals); | ||
| Out[0] = packedVals; | ||
| } | ||
|
|
| Out[2] = unpackedVals.z; | ||
| Out[3] = unpackedVals.w; | ||
| } | ||
|
|
| unpackedVals.w = In[3]; | ||
| int8_t4_packed packedVals = pack_clamp_s8(unpackedVals); | ||
| Out[0] = packedVals; | ||
| } |
There was a problem hiding this comment.
(For all files)
There should be a constant folding test.
| - Name: In | ||
| Format: Int16 | ||
| Stride: 2 | ||
| Data: [ -129, -128, 127, 128 ] |
There was a problem hiding this comment.
(For all files)
Could we test some more values? We're only packing 1 group of values, and they all seem to be boundary values. Would be good to also test some regular mid-range ones.
Adds tests covering a matrix of signed, unsigned, 16, and 32 bit pack, pack_clamp, and unpack intrinsics.
As the intrinsics/tests are all simple in nature and related in function, I've packaged together all of the pack and unpack variants.
Closes #863, #864, #865, #866, #891, #892, #893, #894,