-
Notifications
You must be signed in to change notification settings - Fork 809
Adding array operator long vector tests to HLK #7887
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
Changes from 19 commits
8d371f1
5cc409e
8256850
33a888e
be253dd
ce5ebdf
c657ded
ab7707f
a5918e7
ad76246
d4072c1
c21f0be
4deea4a
4e0fda9
22f0c80
de0cbc4
1a8fb8a
34bb415
da88c6a
3c32ba5
3cc3f31
234a466
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -776,6 +776,48 @@ BITWISE_OP(OpType::FirstBitLow, (FirstBitLow(A))); | |
|
|
||
| DEFAULT_OP_1(OpType::Initialize, (A)); | ||
|
|
||
| template <typename T> | ||
| struct Op<OpType::ArrayOperator_StaticAccess, T, 1> : DefaultValidation<T> {}; | ||
|
|
||
| template <typename T> | ||
| static std::vector<T> buildExpectedArrayAccess(const InputSets<T> &Inputs) { | ||
| const size_t VectorSize = Inputs[0].size(); | ||
| std::vector<T> Expected; | ||
| Expected.resize(VectorSize); | ||
|
|
||
| const size_t IndexCount = 6; | ||
| size_t IndexList[IndexCount] = { | ||
| 0, VectorSize - 1, 1, VectorSize - 2, VectorSize / 2, VectorSize / 2 + 1}; | ||
| size_t End = std::min(VectorSize, IndexCount); | ||
| for (size_t i = 0; i < End; ++i) | ||
|
||
| Expected[IndexList[i]] = Inputs[0][IndexList[i]]; | ||
|
|
||
| return Expected; | ||
| } | ||
|
|
||
| template <typename T> | ||
| struct ExpectedBuilder<OpType::ArrayOperator_StaticAccess, T> { | ||
| static std::vector<T> | ||
| buildExpected(Op<OpType::ArrayOperator_StaticAccess, T, 1>, | ||
| const InputSets<T> &Inputs) { | ||
| DXASSERT_NOMSG(Inputs.size() == 1); | ||
| return buildExpectedArrayAccess(Inputs); | ||
| } | ||
| }; | ||
|
|
||
| template <typename T> | ||
| struct Op<OpType::ArrayOperator_DynamicAccess, T, 2> : DefaultValidation<T> {}; | ||
|
|
||
| template <typename T> | ||
| struct ExpectedBuilder<OpType::ArrayOperator_DynamicAccess, T> { | ||
| static std::vector<T> | ||
| buildExpected(Op<OpType::ArrayOperator_DynamicAccess, T, 2>, | ||
| const InputSets<T> &Inputs) { | ||
| DXASSERT_NOMSG(Inputs.size() == 2); | ||
| return buildExpectedArrayAccess(Inputs); | ||
| } | ||
| }; | ||
|
|
||
| // | ||
| // Cast | ||
| // | ||
|
|
@@ -1775,15 +1817,35 @@ class DxilConf_SM69_Vectorized { | |
| // Unary | ||
|
|
||
| HLK_TEST(Initialize, HLSLBool_t); | ||
| HLK_TEST(ArrayOperator_StaticAccess, HLSLBool_t); | ||
| HLK_TEST(ArrayOperator_DynamicAccess, HLSLBool_t); | ||
| HLK_TEST(Initialize, int16_t); | ||
| HLK_TEST(ArrayOperator_StaticAccess, int16_t); | ||
| HLK_TEST(ArrayOperator_DynamicAccess, int16_t); | ||
| HLK_TEST(Initialize, int32_t); | ||
| HLK_TEST(ArrayOperator_StaticAccess, int32_t); | ||
| HLK_TEST(ArrayOperator_DynamicAccess, int32_t); | ||
| HLK_TEST(Initialize, int64_t); | ||
| HLK_TEST(ArrayOperator_StaticAccess, int64_t); | ||
| HLK_TEST(ArrayOperator_DynamicAccess, int64_t); | ||
| HLK_TEST(Initialize, uint16_t); | ||
| HLK_TEST(ArrayOperator_StaticAccess, uint16_t); | ||
| HLK_TEST(ArrayOperator_DynamicAccess, uint16_t); | ||
| HLK_TEST(Initialize, uint32_t); | ||
| HLK_TEST(ArrayOperator_StaticAccess, uint32_t); | ||
| HLK_TEST(ArrayOperator_DynamicAccess, uint32_t); | ||
| HLK_TEST(Initialize, uint64_t); | ||
| HLK_TEST(ArrayOperator_StaticAccess, uint64_t); | ||
| HLK_TEST(ArrayOperator_DynamicAccess, uint64_t); | ||
| HLK_TEST(Initialize, HLSLHalf_t); | ||
| HLK_TEST(ArrayOperator_StaticAccess, HLSLHalf_t); | ||
| HLK_TEST(ArrayOperator_DynamicAccess, HLSLHalf_t); | ||
| HLK_TEST(Initialize, float); | ||
| HLK_TEST(ArrayOperator_StaticAccess, float); | ||
| HLK_TEST(ArrayOperator_DynamicAccess, float); | ||
| HLK_TEST(Initialize, double); | ||
| HLK_TEST(ArrayOperator_StaticAccess, double); | ||
| HLK_TEST(ArrayOperator_DynamicAccess, double); | ||
|
|
||
| HLK_TEST(ShuffleVector, HLSLBool_t); | ||
| HLK_TEST(ShuffleVector, int16_t); | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -4184,7 +4184,37 @@ void MSMain(uint GID : SV_GroupIndex, | |||||
| const uint32_t OutNum = NUM; | ||||||
| #endif | ||||||
|
|
||||||
| #if IS_UNARY_OP | ||||||
| #if TEST_ARRAY_OPERATOR | ||||||
| // This test case is for testing array operator []. | ||||||
| // It tests static array access with a compile time constant index array. | ||||||
| // And dynamic access, by introducing a runtime dependency that prevents the | ||||||
|
||||||
| // And dynamic access, by introducing a runtime dependency that prevents the | |
| // Or dynamic access, by introducing a runtime dependency that prevents the |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: const
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason you opted to zero an expected vector for the elements we aren't testing vs just setting the expected output size to 6?
You could avoid verifying a bunch of zeros by doing that. And if I recall correctly, all you will need to do is set the size of Expected to 6 here. The framework we built dispatches calls to other functions based on the number of elements in the Expected vector. And you can set OutNum in the shader to 6 with logic similar to how it's changed for the reduction op.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test read and write at different indexes on which vector size. This is done to provide GEP instruction with index to access at the beginning, middle and end of vector. Forcing that to be 6 means we will need to store the that at
Ialways, making the storing of elements to always be static.I could make the IndexVector to be 0 to 5, but that reduces the scope where we test GEP calc for larger vectors
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great point! I wasn't considering the storing portion when I asked that. I wonder if a comment saying that is helpful for a little documentation on that being the intent.