Skip to content

Conversation

@damyanp
Copy link
Member

@damyanp damyanp commented Nov 26, 2025

Previously, if a device is removed then the code that recreates it wouldn't release the old device pointer, resulting in the device leaking. This actually prevents removed device recovery entirely, since all references to a removed device need to be released before a new one can be created. This change fixes that.

Also:

  • improve logging in situations where requirements aren't met (eg trying to create a SM 6.9 device on a system that doesn't support SM 6.9)
  • return false from class setup if we couldn't create a device - this will cause all the tests in the class to be skipped or failed (depending on the FailIfRequirementsNotMet setting) - reducing log noise, and saving the time that would be taken to run tests that we know are going to fail
  • improve logging when recreating a device so we can tell the difference between "device was removed" and "there wasn't a device set"
  • add a warning log if createDevice is called with something that looks like it already has a value set

Fixes #7949

Previously, if a device is removed then the code that recreates it wouldn't release the old device pointer, resulting in the device leaking. This actually prevents removed device recovery entirely, since all references to a removed device need to be released before a new one can be created.  This change fixes that.

Also:

* improve logging in situations where requirements aren't met (eg trying to create a SM 6.9 device on a system that doesn't support SM 6.9)
* improve logging when recreating a device so we can tell the difference between "device was removed" and "there wasn't a device set"
* add a warning log if createDevice is called with something that looks like it already has a value set

Fixes microsoft#7949
bool SkipUnsupported) {

if (*D3DDevice)
hlsl_test::LogWarningFmt(L"createDevice called with non-null *D3DDevice - "
Copy link
Contributor

Choose a reason for hiding this comment

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

Could this be a failure instead of a warning? It seems bad to allow this with just a warning.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm maybe being overly cautious here, and partly this is because of the distance between this code and it running in its final location, I wanted to find out places where this might be happening without taking everything down with it - hence the warning.

Copy link
Contributor

Choose a reason for hiding this comment

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

If it caused failures in current runs, I think we'd want to know and fix those anyway. Is now just a particularly bad time to potentially disrupt the tests? Maybe we can follow up with a change to turn this into a failure instead of doing it here.

Copy link
Member Author

Choose a reason for hiding this comment

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

Agreed, yes, and agreed :)

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.

Looks good, but it feels like we should fail if we would overwrite a device pointer (creating a leak) rather than just issue a warning.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: New

Development

Successfully merging this pull request may close these issues.

Long Vectors tests: add better logging around FailIfRequirementsNotMet

2 participants