Skip to content
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

NVIDIA/Intel GPU VRAM is not detected #46

Open
jeevithakannan2 opened this issue Feb 3, 2025 · 9 comments
Open

NVIDIA/Intel GPU VRAM is not detected #46

jeevithakannan2 opened this issue Feb 3, 2025 · 9 comments
Labels
detection Module detection issue. help wanted Help from other contributors is wanted.

Comments

@jeevithakannan2
Copy link

jeevithakannan2 commented Feb 3, 2025

What module does this affect?
GPU

What hardware/software isn't being detected right?
GPU's VRAM is not detected and displayed as 0KB. I have a hybrid laptop Intel iGPU (Alder Lake-P GT2 (Iris Xe Graphics)) and NVIDIA dGPU (NVIDIA GeForce RTX 3050 Ti Laptop GPU)

Does detection work a little, or is it completely broken?
GPU is detected and other GPU module format placeholders are working. Only the VRAM is not detected. Didn't also work with default config generated by crabfetch -g

@jeevithakannan2 jeevithakannan2 added the detection Module detection issue. label Feb 3, 2025
@LivacoNew
Copy link
Owner

This is an issue I've been aware of for quite a while, however still don't have an NVIDIA GPU to play about with this. If anyone's willing to make a PR or give some guidance as to where to find this info it would be appreciated

@LivacoNew LivacoNew added the help wanted Help from other contributors is wanted. label Feb 4, 2025
@jeevithakannan2
Copy link
Author

Intel GPU VRAM is also not fetched

@LivacoNew
Copy link
Owner

Also expected, same issue.
What's happening is that the mem_info_vram_total file I use to grab vram in the module is only set on AMD GPU's. I didn't know this at the time, and don't have an Intel nor NVIDIA GPU to find where to replace this information with, so again we're kinda stuck unless someone else wants to take a look around their filesystems/syscalls to find a source.

@jeevithakannan2
Copy link
Author

Also expected, same issue.
What's happening is that the mem_info_vram_total file I use to grab vram in the module is only set on AMD GPU's. I didn't know this at the time, and don't have an Intel nor NVIDIA GPU to find where to replace this information with, so again we're kinda stuck unless someone else wants to take a look around their filesystems/syscalls to find a source.

Ok I will take a look when I have time

@jeevithakannan2
Copy link
Author

Ok I surfed online and found out that NVIDIA proprietary driver does not expose the VRAM in the sysfs files. We can use the nvml-wrapper crate but it will create an overhead. The test results after adding nvm_wrapper:

hyperfine ./crabfetch crabfetch -N -w 50
Benchmark 1: ./crabfetch
  Time (mean ± σ):      25.1 ms ±   6.6 ms    [User: 5.7 ms, System: 13.1 ms]
  Range (min … max):    18.7 ms …  45.4 ms    100 runs
 
Benchmark 2: crabfetch
  Time (mean ± σ):       7.2 ms ±   0.9 ms    [User: 4.7 ms, System: 2.1 ms]
  Range (min … max):     6.0 ms …   9.6 ms    444 runs
 
Summary
  crabfetch ran
    3.49 ± 1.02 times faster than ./crabfetch

If the user have nouveau driver there would be no problem in fetching the VRAM info

@jeevithakannan2
Copy link
Author

As for intel GPU it's a integrated graphics card so I cannot check from my part.

@LivacoNew
Copy link
Owner

If there's no sysfs stuff then I guess only one way. Only other thing I can think of is querying a Graphics API like Vulkan or OpenGL but I'm not sure which ones would be faster if any.

If anyone's willing to make a PR with the NVIDIA wrapper I can merge it, just remember to validate the vendor ID n shit. As for Intel, it'll have to be someone else.

@LivacoNew LivacoNew changed the title VRAM is not detected NVIDIA/Intel GPU VRAM is not detected Feb 7, 2025
@jeevithakannan2
Copy link
Author

I can create a PR with nvidia wrapper but it will slow down crabfetch by a large margin as you can see #46 (comment) let me know your thoughts

@LivacoNew
Copy link
Owner

Again if there's no other way it'll just have to be. It's a shame I don't have an NVIDIA GPU myself to mess about with for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
detection Module detection issue. help wanted Help from other contributors is wanted.
Projects
None yet
Development

No branches or pull requests

2 participants