[SM6.10][Exec][Bugfix] Add matrix layout conversion helpers, add post-dispatch callback, and re-enable OuterProduct test#8606
Conversation
|
✅ With the latest revision this PR passed the C/C++ code formatter. |
| Args.c_str()); | ||
| addUAVBuffer(Op.get(), "Input", InBuffSize, false, "byname"); | ||
| addUAVBuffer(Op.get(), "Output", OutBufferSize, true); | ||
| addUAVBuffer(Op.get(), "Output", OutBufferSize, /*ReadBack=*/false); |
There was a problem hiding this comment.
Maybe I'm wrong, but I see you using GetResource on the "Output" buffer, in the code below. Doesn't that mean that this ReadBack bool should remain true?
There was a problem hiding this comment.
The "Output" buffer is not being read by the CPU, so the ReadBack bool is false. The "Output" buffer is also in the opaque outer-product-optimal layout, so we shouldn't even try to interpret it without first converting it to a layout we do know how to read.
The GetResource just obtains a handle to be able to refer to the "Output" buffer so that we can record a ConvertLinearAlgebraMatrix command into the command list to tell the GPU to convert it into row-major order and store it into "OutputRowMajor", which the CPU does read back.
|
Discussed offline with @damyanp. I removed the dedicated post-execute command list+queue and replaced it with a post-dispatch callback for recording commands immediately after the dispatch command in compute command lists. I will need to clarify with @jenatali if it is intentional for So as of this PR's current state, the test will fail with: A workaround is changing the compute list and queue into a direct list and queue, but I will leave it as compute for now. |
|
Definitely not intentional, that traces back to the cooperative vector prototype 1.5 years ago. I'll get that fixed. |
Thanks! |
| Params.Enable16Bit = true; | ||
| runOuterProduct(D3DDevice, DxcSupport, Params, VerboseLogging); | ||
| #else | ||
| WEX::Logging::Log::Comment( |
There was a problem hiding this comment.
Why is it sometimes required to compile out this test?
There was a problem hiding this comment.
The test requires compiling against the preview Agility SDK whose headers provide the linear algebra matrix conversion APIs. Without it, the matrix can not be converted and therefore the output can not be validated.
| L"without the linear-algebra matrix-conversion API " | ||
| L"(DIRECT3D_LINEAR_ALGEBRA undefined); the host-side conversion helpers " | ||
| L"are compiled out."); | ||
| WEX::Logging::Log::Result(WEX::Logging::TestResults::Skipped); |
There was a problem hiding this comment.
We can't skip HLK tests. Only exec tests.
You can compile this skip out for HLK builds. See: https://github.com/Icohedron/DirectXShaderCompiler/blob/6ea2dbb1776de31d2dde70773bd9f81cc96b12ea/tools/clang/unittests/HLSLExec/LinAlgTests.cpp#L384
| void ShaderOpTest::GetResource(LPCSTR pResourceName, | ||
| ID3D12Resource **ppResource) { | ||
| pResourceName = m_pShaderOp->Strings.insert(pResourceName); // Unique | ||
| auto It = m_ResourceData.find(pResourceName); |
There was a problem hiding this comment.
We should swap to use .at like GetReadBack data so the test throws instead of crashing for a name that doesn't exist (programmer error).
Addresses the matrix layout conversion requirement of issue #8386
This PR re-enables the OuterProduct smoke test and adds support for matrix layout conversions via new dedicated helper functions in
HLSLExecTestUtils.h/.cppand a new post-dispatch command list callback inShaderOpTest.h/.cpp.getLinAlgMatrixByteSize,recordLinAlgMatrixConversion, andtoLinAlgDataTypefor querying matrix byte sizes, recording a matrix layout conversion operation to a command list, and converting DXIL component type enums into D3D12 LinAlg datatype enumsConvertLinearAlgebraMatrixto the command list immediately after the dispatchAssisted by: Claude Opus 4.8