-
Notifications
You must be signed in to change notification settings - Fork 787
Create new class to handle external validation, and rename existing dll loading class. #7514
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
base: main
Are you sure you want to change the base?
Create new class to handle external validation, and rename existing dll loading class. #7514
Conversation
733ce1e
to
c527502
Compare
✅ With the latest revision this PR passed the C/C++ code formatter. |
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 had a number of comments, but many of these issues would have been noticed when trying to create a unit test that used this new DxcDllExtValidationSupport
class. I think we need a unit test.
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 have a few comments, and things I suspect we'll want to revisit in the future, but I don't think that necessarily should block this PR.
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.
See comments
include/dxc/Support/dxcapi.extval.h
Outdated
#include <string> | ||
|
||
namespace dxc { | ||
class DxcDllExtValidationSupport { |
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 I already debated this at length, but I object to this new approach that doesn't derive from dxc::DxcDllSupport
. I don't think it'll fit nicely with the current users of dxc::DxcDllSupport&
that don't care which DLL you've passed down, as long as it supports creating the interfaces needed. This wrapper forces a decision by a function of whether to take this wrapper or a dxc::DxcDllSupport&
when none of the functions that currently have dxc::DxcDllSupport&
arguments need to know the difference.
The problem isn't visible yet because this is only the first step of creating the new class. You haven't actually used it yet. It will become apparent as you try to hook everything up.
For instance, FileRunTestResult::RunFromFileCommands
takes dxc::DxcDllSupport&
, and you'd need to change this type for this design, but the DLL it manages isn't necessarily DxCompiler.dll
. For DxilConvTest
it points to DxilConv.dll
, and it makes no sense for that test to use this class. Issues cascade from here, as other paths will want to point to DxCompiler.dll instead. Now these aren't interchangeable, so you have to make the code that uses dxc::DxcDllSupport&
more complex to account for different DLL possibilities that it shouldn't need to know about.
Perhaps this PR needs to include the changes to all the places that will need to accept this new object just to see the impact of this design decision.
lib/DxcSupport/dxcapi.extval.cpp
Outdated
return DxCompilerSupport.CreateInstance(clsid, riid, pResult); | ||
} | ||
|
||
HRESULT DxcDllExtValidationSupport::CreateInstance2(IMalloc *pMalloc, |
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.
nit: Can we just drop the 2
here and rely on overloading? The param list is different so I think the compiler would be happy
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 we should keep the 2, since the 2 is in reference to the 2nd creation function, which is stored as a member variable in dxcapi.use.h: m_createFn2
.
This different name helps clarify that it depends on the different function represented by that other member variable.
The interface is a good idea, but there are a couple of things that still need some work here. Notably, Tex's concerns are about the usage of the I would expect the base class (which you currently call A note on naming. As for usage, there are a number of places that pass
|
This PR creates a class that is responsible for loading and unloading dxil.dll, allowing for external validation.
Tests are added to test this class's functionality. Additionally, an interface is defined that joins the existing singular dll loading helper class, and the new class that tracks two dlls. The classes were renamed to be more abstract, as well as all existing uses of the original singular dll loader class.
Fixes #7422