-
Notifications
You must be signed in to change notification settings - Fork 32
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
Add support for NVIDIA Management Library #15
Conversation
If you need some more tests for nvapi, i would recommend GPU Caps Viewer : https://www.geeks3d.com/20210518/gpu-caps-viewer-1-51-0-released/ Atleast easier to do testing stuff than firing up games every time you do tweaks :) |
It is indeed interesting with wine-nvml - but i think its a slight pitfall needing to load nvml.dll.so, as this seems a wee bit troublesome for proton at times. I have not really had much success using a dll-override when using proton and a renamed dll.so.
I can see slowdowns being caused by repeated calls in games/apps that uses this. My limited testing from the Unigine benchmarks have not really shown issues when you get a "unimplemented" function, but what would happen if you get repeatedly calls to a not-found library i cant tell :) Depending on implementation of the app's nvapi call, it CAN be significant, and that is something dxvk-nvapi really cannot control. Maybe some sort of "early check", so that if the lib is not found, all "nvml related functions" is being dropped for that session? I don't know.. needs more testing i guess. |
I haven't really tested it with Proton, but have you tried without any dll override in place? Because Wine can see the
Fwiw, you could also try dropping all the files into Proton's Wine libdirs, like so:
My hope is that it won't be any slower than the actual query performed by NvAPI on Windows, but doing just two
Yeah, I've considered that, but decided against it unless we find a real case where it would be useful to do. No point doing such aggressive premature optimization and risk an overengineered solution if it turns out to be unnecessary 😛 |
Hi @Saancreed, thanks a lot for this PR. Would be cool indeed to have those two GPU related methods implemented. Some initial thoughts:
Let me know what you think! PS: Performance is surely not an issue here. Consumers might be retarded, but I don’t think those methods ever end up in a performance critical path :) |
I understand your concerns; keeping support for an additional external library, even if completely optional, still requires extra maintenance effort. To be honest, back when I started this project of mine it was my intention to try upstreaming it to Wine when majority of functions is implemented, but sometime after that I've realized that implementing NVML's interface (which consists of about 240 functions) is quite a big project and supporting even half of them will require a lot of work (which is probably just as hard to automate correctly). So now I'm left with a not-so-small library that is slowly being implemented in my free time and, while already able to offer a few very useful functions, might not be upsteamable in its current state (especially since there is ongoing effort to convert libraries to PE modules and But maybe Valve will be interested in including it in Proton until then 🙂
Did you mean "to the adapter registry"? If so then yeah, I suppose that could work. In that case, how should we store our instance? I imagine a private
Sure, will do.
The safest way would be to log both cases I think, but yeah, I can do that. I imagine that in case it could not be loaded, the
I'll just drop that commit and handle it on my own.
Will do, once I confirm that's indeed supposed to work on Windows. |
Not that i am an authority on what gets into wine or not (or staging), but getting a project implemented upstream is.. probably not a "next week" kind of thing, since they have kinda shown before that its rather strict when it comes to code compliance in that regard. I tried to copy the dll.so's into lib64/wine , and the .dll's into lib64/wine/fakedlls , but it did not seem to work. Does work with other winelib's tho, and it works with "regular" wine. EDIT: Does wine-nvml compile just fine on a build-bot without any nvidia libraries installed? |
😞 EDIT: Actually, I just tried that and it worked for me:
And I think I know why: I use Proton without Soldier runtime, which allows Wine to find my system libraries (and
It should, it only needs |
The wine staging implementations of other nvidia related library are far from complete afaik, I think what you already have might fit. Though I just speak for myself since I'm not related to wine or wine-staging. Also dunno about the effort to convert to PE.
Yeah, that's what I meant. Using a
I'm happy to add that ignore with a separate PR if it improves your work flow.
Cool, thanks! |
PS: I'm sorry for causing some conflicts by adding some commits myself on master. |
PPS: I've played a bit with |
PE conversion and usage of Nvidia's header (in a bit hackish way because of abuse of known macros) are two things I'm most worried about, other stuff should be easy enough to resolve.
Well, my C++ skills were dulled by years of writing mostly in C# with only a bit of good old C 😅
Up to you, I've already handled it on my side.
No worries, I'll handle it while applying your suggestions. Until then, I'll mark this PR as WIP.
|
This sounds very familiar to me, my background the past years (actually lots of years) has also been mostly C# and the surrounding ecosystem ;)
Alright, thanks. I'll keep the current ignores until somebody else suggests to modify them.
Thanks for the feedback. Yeah, I'm also a bit torn about keeping a reference in the adapter. I did this with |
Makes sense, but I still believe we could get away with (By the way, shouldn't we call Anyway, I've rebased my PR on top of your current |
I was able to implement @Saancreed I think stuff getting into staging needs to be submitted to the main wine tree, and if it gets rejected but deemed a good enough idea, it might be put in staging for testing and further development. Atleast how i think stuff works when talking about getting stuff upstreamed. I dunno if you have considered that? |
Thanks, yes. Done on master. |
@SveSop That's the long term plan, yes, but first I'd have to replace the build system with Wine's and make some changes w.r.t. code style at the very least. |
They (WineHQ dev's) tend to be very picky, and you would also need to write some tests for this i guess. Not sure how detailed that needs to be. |
Well, fwiw there are some Nvidia library wrappers in
Can't speak for NvAPI, but in case of NVML:
Anyway, I think that this PR is not the best place for such a discussion. If you have any further questions, feel free to open an issue in my |
Will keep nvml discussions to the correct repo. |
Rebased and updated, should be good to go now. I'm not convinced that duplicating NVML methods in Although now that I think about it, maybe I should reduce the log spam somehow, because just a few minutes of AC Valhalla can produce thousands of log lines like this:
(The second GPU is AMD integrated). |
Closing this PR in favor of #20 which is based on the work done here. |
Try to load
nvml.dll
and if successful, use it to implement two device queries (utilization rates and temperature) in a manner that's roughly equivalent to observed behavior on Windows (but I admit that error handling was mostly a guesswork 🙈). This will require something like my wine-nvml to be available within the Wine prefix, otherwise newly implemented functions will return aNO_IMPLEMENTATION
error to calling applications.Some things to consider:
NvapiAdapterRegistry
? Using a sharedextern
instance doesn't seem elegant to me, and I'm not even sure if it's a technically correct approach.nvapi_interface.cpp
if we can't load NVML at that point?NvAPI_GPU_GetArchInfo
in case NVML was successfully loaded? Would it require me to add more functions towine-nvml
?Some things I've noticed:
nvml.dll
. However, on Linux, there is also a 32–bit version oflibnvidia-ml.so
. This means I can actually provide something in Wine that's not available on Windows 🙃Initialize
,Initialize
,Unload
,SYS_GetDriverAndBranchVersion
should succeed, but right now theUnload
call with deleteNvapiAdapterRegistry
no matter how many timesInitialize
was called before that. I've tried not to introduce too many changes there that could be deemed out of scope of this PR, but it's still something that should probably be taken care of.