-
Notifications
You must be signed in to change notification settings - Fork 689
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
ConvertFloat32ToFloat16: Use DirectXMath conversion functions #4855
Conversation
✅ Build DirectXShaderCompiler 1.0.2385 completed (commit ba9d7d5394 by @tex3d) |
Updated to OR in the float32 fractional bits, since truncation is the implied rounding mode for this function. Updated the name to better reflect the meaning.
✅ Build DirectXShaderCompiler 1.0.2402 completed (commit 85c972be0f by @tex3d) |
✅ Build DirectXShaderCompiler 1.0.2403 completed (commit 721e5e8f5f by @tex3d) |
Implementation of conversion stubs that pass through to DirectXMath functions is in ExecutionTest.cpp, since all uses of these conversions are within this cpp or ShaderOpTest.cpp which is in the same lib. This location only depends on DirectXMath where we expect win32-only build.
❌ Build DirectXShaderCompiler 1.0.2430 failed (commit d40e89a7fe by @tex3d) |
ShaderOpTest.cpp is dependency of ExecutionTest.cpp, and this is a better place for the stubs.
✅ Build DirectXShaderCompiler 1.0.2466 completed (commit 333b8f9d32 by @tex3d) |
✅ Build DirectXShaderCompiler 1.0.2467 completed (commit e8ea507b97 by @tex3d) |
✅ Build DirectXShaderCompiler 1.0.2468 completed (commit e3644b59a0 by @tex3d) |
✅ Build DirectXShaderCompiler 1.0.2469 completed (commit 3494e32af3 by @tex3d) |
float ConvertFloat16ToFloat32(uint16_t Value) throw() { | ||
return DirectX::PackedVector::XMConvertHalfToFloat(Value); | ||
} | ||
|
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.
I know you want Helena to comment here and she should, but we talked about this earlier and she plans to move a lot of the ShaderOp code into its own directory. That might resolve any concerns about dependencies involving execution tests.
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.
Fortunately, this cpp file is already dependent on DirectXMath. So, I don't think there will be any trouble with this change. I still wanted to double check that it doesn't break tests in some unexpected way though.
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.
I believe this should be fine, as Tex said the dependency is already there, and these headers should be available in the Windows build. It is the LLVM dependencies and additional DXC headers that are problematic.
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.
LGTM!
float ConvertFloat16ToFloat32(uint16_t Value) throw() { | ||
return DirectX::PackedVector::XMConvertHalfToFloat(Value); | ||
} | ||
|
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.
I believe this should be fine, as Tex said the dependency is already there, and these headers should be available in the Windows build. It is the LLVM dependencies and additional DXC headers that are problematic.
Cherry-pick of PIX and HLK changes for the 2212 release Changes for PIX: 20bb3d0 PIX: Modify root sigs in place (plus fix root sig memory leak) (PIX: Modify root sigs in place (plus fix root sig memory leak) #4876) 2c3d965 dxcopt: Support full container and restore extra data to module (dxcopt: Support full container and restore extra data to module #4845) 21cf36a Fix hitgroup metadata argument order HLK Test Updates: ee0994e add barycentrics ordering check onto existing barycentrics test (add barycentrics ordering check onto existing barycentrics test #4635) 6acd11b ConvertFloat32ToFloat16: Use DirectXMath conversion functions (ConvertFloat32ToFloat16: Use DirectXMath conversion functions #4855) e7aac8e Include TestConfig.h only if DEFAULT_TEST_DIR is not defined (Include TestConfig.h only if DEFAULT_TEST_DIR is not already defined #4884) 5decc4a Do not include TestConfig.h for all HLK build (Do not include TestConfig.h for all HLK build #4887)
Custom half <-> float conversion functions had problems in multiple scenarios. This PR changes them into a wrapper, using the DirectXMath conversion functions instead.