Skip to content

Long Vector Execution Tests: Merge unary and binary op tests to main #7549

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

Conversation

alsepkow
Copy link
Contributor

Summary
Adds infrastructure for long vector execution tests. This code and additional test cases were already added to the staging-sm6.9 branch. This is the second of several PRs to bring these changes into main. That being said, reviews of this code should treat it as brand new. Resolves #7545

Includes:

  • A new test class LongVector::OpTest in LongVectors.h/cpp, still part of the ExecHLSLTests.dll binary.
  • HLSL source added to ShaderOpArith.xml to leverage the existing exec test framework for shader compilation and execution.
  • A new TAEF metadata file LongVectorOpTable.xml defining long vector test cases.
  • LongVectorTestData.h for statically defined input values, including HLSLHalf_t and HLSLBool_t. This avoids duplicating values across test cases.

Template Handling
To support template instantiation across translation units, LongVectors.tpp contains full template definitions included by LongVectors.h. These were originally required when tests lived in ExecutionTests.cpp. Now that the tests are isolated, the plan is to move the definitions back into LongVectors.cpp after merging the long vector tests from staging-sm6.9 to simplify the manual merge.

Utilities
HlslTestUtils.h includes minor updates to support the new test scenarios.

Copy link
Contributor

@tex3d tex3d left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one minor comment regarding double denorms that could probably be addressed in a follow up.

return std::isnan(Ref);
}

if (Mode == hlsl::DXIL::Float32DenormMode::Any) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just FYI: denorms are required to be preserved for double-precision DXIL operations. So either this should default to Float32DenormMode::Preserve, or we should just remove this branch.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can address in this PR. Conflicts is this file will be trivial in the diff for merging the rest.

Copy link
Collaborator

@bob80905 bob80905 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are a couple files that don't have a new line at EOF you might consider adding.

if (!Initialized) {
Initialized = true;

HMODULE Runtime = LoadLibraryW(L"d3d12.dll");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is this library freed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question, I wondered the same. This setup code is copied from
ExecutionTest.cpp and has the note below to not call FreeLibrary on the handle.
Which I now realize has a typo from the naming update. I'll do a little digging
and report back - this is worth understanding to make sure we aren't leaking the
library handle.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no explicit FreeLibrary anywhere in this code. The library is
implicilty freed on process exit. This isn't inherently bad....but this is
generally considered bad practice. I think the original author was probably just
lazy. I dont see a good reason for why we shouldn't store this handle as a
member variable and call FreeLibrary on it in cleanup. I'll create an issue to
address that in a subsequent PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, I was trying the 'github pull requests' plugin for vscode out. Looks like its reply to comments just submits new comments. Pasting them here.

Good question, I wondered the same. This setup code is copied from
ExecutionTest.cpp and has the note below to not call FreeLibrary on the handle.
Which I now realize has a typo from the naming update. I'll do a little digging
and report back - this is worth understanding to make sure we aren't leaking the
library handle.

#7583

@alsepkow alsepkow requested a review from bob80905 June 25, 2025 01:22
@alsepkow alsepkow merged commit 2da0a54 into microsoft:main Jul 2, 2025
12 checks passed
@github-project-automation github-project-automation bot moved this from New to Done in HLSL Roadmap Jul 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Long Vector Execution Tests: Merge unary and binary op tests to main
3 participants