[SM6.10][Exec] Implement Remaining Smoke Tests#8366
Draft
V-FEXrt wants to merge 11 commits intomicrosoft:mainfrom
Draft
[SM6.10][Exec] Implement Remaining Smoke Tests#8366V-FEXrt wants to merge 11 commits intomicrosoft:mainfrom
V-FEXrt wants to merge 11 commits intomicrosoft:mainfrom
Conversation
Contributor
You can test this locally with the following command:git-clang-format --diff 5f8d05f9b760ae2be0242cad8ed719d10058b98c 7ce1fe28360f009e1bbbef6aebf5ec7aef6750ee -- tools/clang/unittests/HLSLExec/HlslExecTestUtils.cpp tools/clang/unittests/HLSLExec/LinAlgTests.cppView the diff from clang-format here.diff --git a/tools/clang/unittests/HLSLExec/LinAlgTests.cpp b/tools/clang/unittests/HLSLExec/LinAlgTests.cpp
index b276d823..159d94d5 100644
--- a/tools/clang/unittests/HLSLExec/LinAlgTests.cpp
+++ b/tools/clang/unittests/HLSLExec/LinAlgTests.cpp
@@ -238,9 +238,9 @@ static bool fillInputBuffer(LPCSTR Name, std::vector<BYTE> &Data,
}
static VariantCompType makeExpectedMat(ComponentType CompType, MatrixDim M,
- MatrixDim N, float StartingVal,
- bool Increment = true,
- bool Transpose = false) {
+ MatrixDim N, float StartingVal,
+ bool Increment = true,
+ bool Transpose = false) {
const size_t NumElements = M * N;
std::vector<float> Floats(NumElements);
std::vector<int32_t> Ints(NumElements);
@@ -291,10 +291,11 @@ static VariantCompType makeExpectedMat(ComponentType CompType, MatrixDim M,
}
}
-static VariantCompType makeExpectedVec(ComponentType CompType, MatrixDim NumElements,
- float StartingVal,
- bool Increment = true) {
- return makeExpectedMat(CompType, 1, NumElements, StartingVal, Increment, false);
+static VariantCompType makeExpectedVec(ComponentType CompType,
+ MatrixDim NumElements, float StartingVal,
+ bool Increment = true) {
+ return makeExpectedMat(CompType, 1, NumElements, StartingVal, Increment,
+ false);
}
class DxilConf_SM610_LinAlg {
@@ -548,9 +549,9 @@ static const char AccumulateDescriptorShader[] = R"(
)";
static void runAccumulateDescriptor(ID3D12Device *Device,
- dxc::SpecificDllLoader &DxcSupport,
- const MatrixParams &Params, float FillValue,
- bool Verbose) {
+ dxc::SpecificDllLoader &DxcSupport,
+ const MatrixParams &Params, float FillValue,
+ bool Verbose) {
const size_t NumElements = Params.totalElements();
const size_t BufferSize = Params.totalBytes();
@@ -559,13 +560,14 @@ static void runAccumulateDescriptor(ID3D12Device *Device,
std::string Args = buildCompilerArgs(Params, ExtraDefs.str().c_str());
- compileShader(DxcSupport, AccumulateDescriptorShader, "cs_6_10", Args, Verbose);
+ compileShader(DxcSupport, AccumulateDescriptorShader, "cs_6_10", Args,
+ Verbose);
auto Expected =
makeExpectedMat(Params.CompType, Params.M, Params.N, FillValue, false);
- auto Op =
- createComputeOp(AccumulateDescriptorShader, "cs_6_10", "UAV(u0)", Args.c_str());
+ auto Op = createComputeOp(AccumulateDescriptorShader, "cs_6_10", "UAV(u0)",
+ Args.c_str());
addUAVBuffer(Op.get(), "Output", BufferSize, true);
addRootUAV(Op.get(), 0, "Output");
@@ -827,7 +829,7 @@ static void runCopyConvert(ID3D12Device *Device,
compileShader(DxcSupport, CopyConvertShader, "cs_6_10", Args, Verbose);
auto Expected = makeExpectedMat(Params.CompType, Params.M, Params.N, 1,
- /*Increment=*/true, Transpose);
+ /*Increment=*/true, Transpose);
// Construct the ShaderOp: two UAV buffers, load from one, store to other.
auto Op = createComputeOp(CopyConvertShader, "cs_6_10", "UAV(u0), UAV(u1)",
@@ -931,7 +933,7 @@ static void runMatMatMul(ID3D12Device *Device,
compileShader(DxcSupport, MatMatMulShader, "cs_6_10", Args, Verbose);
auto Expected = makeExpectedMat(Params.CompType, Params.M, Params.N,
- AFill * BFill * K, /*Increment=*/false);
+ AFill * BFill * K, /*Increment=*/false);
auto Op =
createComputeOp(MatMatMulShader, "cs_6_10", "UAV(u0)", Args.c_str());
@@ -1013,8 +1015,9 @@ static void runMatMatMulAccum(ID3D12Device *Device,
compileShader(DxcSupport, MatMatMulAccumShader, "cs_6_10", Args, Verbose);
- auto Expected = makeExpectedMat(Params.CompType, Params.M, Params.N,
- AFill * BFill * K + CFill, /*Increment=*/false);
+ auto Expected =
+ makeExpectedMat(Params.CompType, Params.M, Params.N,
+ AFill * BFill * K + CFill, /*Increment=*/false);
auto Op =
createComputeOp(MatMatMulAccumShader, "cs_6_10", "UAV(u0)", Args.c_str());
@@ -1088,7 +1091,7 @@ static void runMatAccum(ID3D12Device *Device,
compileShader(DxcSupport, MatAccumShader, "cs_6_10", Args, Verbose);
auto Expected = makeExpectedMat(Params.CompType, Params.M, Params.N,
- LHSFill + RHSFill, /*Increment=*/false);
+ LHSFill + RHSFill, /*Increment=*/false);
auto Op = createComputeOp(MatAccumShader, "cs_6_10", "UAV(u0)", Args.c_str());
addUAVBuffer(Op.get(), "Output", BufferSize, true);
@@ -1163,7 +1166,7 @@ static void runMatVecMul(ID3D12Device *Device,
compileShader(DxcSupport, MatVecMulShader, "cs_6_10", Args, Verbose);
auto Expected = makeExpectedVec(Params.CompType, Params.M, MatFill * Params.N,
- /*Increment=*/false);
+ /*Increment=*/false);
auto Op = createComputeOp(MatVecMulShader, "cs_6_10", "UAV(u0), UAV(u1)",
Args.c_str());
@@ -1256,7 +1259,7 @@ static void runMatVecMulAdd(ID3D12Device *Device,
compileShader(DxcSupport, MatVecMulAddShader, "cs_6_10", Args, Verbose);
auto Expected = makeExpectedVec(Params.CompType, Params.M,
- MatFill * Params.N + 1, /*Increment=*/false);
+ MatFill * Params.N + 1, /*Increment=*/false);
auto Op = createComputeOp(MatVecMulAddShader, "cs_6_10", "UAV(u0), UAV(u1)",
Args.c_str());
@@ -1338,8 +1341,8 @@ static void runOuterProduct(ID3D12Device *Device,
compileShader(DxcSupport, OuterProductShader, "cs_6_10", Args, Verbose);
- auto Expected = makeExpectedMat(Params.CompType, Params.M, Params.N,
- 4, /*Increment=*/false);
+ auto Expected = makeExpectedMat(Params.CompType, Params.M, Params.N, 4,
+ /*Increment=*/false);
auto Op = createComputeOp(OuterProductShader, "cs_6_10", "UAV(u0), UAV(u1)",
Args.c_str());
@@ -1351,8 +1354,9 @@ static void runOuterProduct(ID3D12Device *Device,
auto Result = runShaderOp(
Device, DxcSupport, std::move(Op),
[NumVecElements, Params](LPCSTR Name, std::vector<BYTE> &Data,
- st::ShaderOp *) {
- VERIFY_IS_TRUE(fillInputBuffer(Name, Data, Params.CompType, NumVecElements,
+ st::ShaderOp *) {
+ VERIFY_IS_TRUE(fillInputBuffer(Name, Data, Params.CompType,
+ NumVecElements,
/*StartingVal=*/2, /*Increment=*/false),
"Saw unsupported component type");
});
@@ -1387,15 +1391,15 @@ static const char QueryAccumLayoutShader[] = R"(
)";
static void runQueryAccumLayout(ID3D12Device *Device,
- dxc::SpecificDllLoader &DxcSupport,
- bool Verbose) {
+ dxc::SpecificDllLoader &DxcSupport,
+ bool Verbose) {
std::string Args = "-HV 202x";
size_t BufferSize = elementSize(ComponentType::I32);
compileShader(DxcSupport, QueryAccumLayoutShader, "cs_6_10", Args, Verbose);
- auto Op =
- createComputeOp(QueryAccumLayoutShader, "cs_6_10", "UAV(u0)", Args.c_str());
+ auto Op = createComputeOp(QueryAccumLayoutShader, "cs_6_10", "UAV(u0)",
+ Args.c_str());
addUAVBuffer(Op.get(), "Output", BufferSize, true);
addRootUAV(Op.get(), 0, "Output");
@@ -1406,7 +1410,8 @@ static void runQueryAccumLayout(ID3D12Device *Device,
const uint32_t *Out = static_cast<const uint32_t *>(OutData.data());
// Accum Layout must be A or B
- VERIFY_IS_TRUE(Out[0] == static_cast<uint32_t>(MatrixUse::A) || Out[0] == static_cast<uint32_t>(MatrixUse::B));
+ VERIFY_IS_TRUE(Out[0] == static_cast<uint32_t>(MatrixUse::A) ||
+ Out[0] == static_cast<uint32_t>(MatrixUse::B));
if (Verbose)
hlsl_test::LogCommentFmt(L"AccumulatorLayout = %u", Out[0]);
}
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
WIP
Implements smoke tests for the remaining operations