Skip to content

Conversation

mlorenzofr
Copy link
Contributor

This PR adds support for detection of processing accelerators to the library. Please take a look.
This fixes #383

Copy link
Owner

@jaypipes jaypipes left a comment

Choose a reason for hiding this comment

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

@mlorenzofr I absolutely love your ambition :) And overall, the quality of your PR is outstanding, thank you!

That said, I'm going to request that you remove the filtering functionality from this PR and add the filtering functionality in a separate follow-up PR? That way I can evaluate that separately. The reason is because none of the other ghw functions have a filter parameter so adding one just for the accelerator package would be mis-aligned.

@mlorenzofr
Copy link
Contributor Author

Of course I can, I'll start making the changes and submit them in 2 different PRs. 😉
Thanks for the review and comments. 👍

@mlorenzofr mlorenzofr force-pushed the accelerators branch 2 times, most recently from 50b8a40 to 55dc8f3 Compare October 14, 2024 08:42
@mlorenzofr
Copy link
Contributor Author

I was thinking... this PR will detect processing accelerators hardware, but there are hardware from some vendors that are not categorized as processing accelerators, but as 3D controllers. Should we add that hardware in the default detection until the custom filters feature is added?

@jaypipes
Copy link
Owner

I was thinking... this PR will detect processing accelerators hardware, but there are hardware from some vendors that are not categorized as processing accelerators, but as 3D controllers. Should we add that hardware in the default detection until the custom filters feature is added?

@mlorenzofr Yes, absolutely. :)

Copy link
Owner

@jaypipes jaypipes left a comment

Choose a reason for hiding this comment

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

@mlorenzofr thank you sir! a few suggested changes inline :)

@mlorenzofr
Copy link
Contributor Author

I've added all the suggestions, I loved them ❤️ . Thanks a lot for the contributions. 🙏

Additionally, since we've added discovery for more hardware, I've added an additional test for Nvidia cards.


type Info struct {
ctx *context.Context
AcceleratorDevices []*AcceleratorDevice `json:"devices"`
Copy link
Owner

Choose a reason for hiding this comment

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

One tiny request... let's call the field Devices instead of AcceleratorDevices since the "Accelerator" part is assumed.

@mlorenzofr mlorenzofr force-pushed the accelerators branch 2 times, most recently from c036151 to 58df8e5 Compare October 14, 2024 15:47
@mlorenzofr
Copy link
Contributor Author

I forgot to update the documentation, I fixed it the commit 58df8e5

Copy link
Owner

@jaypipes jaypipes left a comment

Choose a reason for hiding this comment

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

Fantastic! :) Thank you so much @mlorenzofr!

Signed-off-by: Manuel Lorenzo <mlorenzofr@redhat.com>
Copy link
Owner

@jaypipes jaypipes left a comment

Choose a reason for hiding this comment

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

Eccezionale :)

@jaypipes jaypipes merged commit e050c5a into jaypipes:main Oct 15, 2024
12 checks passed
@jaypipes
Copy link
Owner

@mlorenzofr welcome to the ghw Contributor roll! :) thank you so much for this contribution!

@ffromani
Copy link
Collaborator

Nice work indeed!
(why I'm getting notifications so late?)

@jaypipes
Copy link
Owner

Nice work indeed! (why I'm getting notifications so late?)

LOL, probably because I made a comment in Italian earlier and that triggered your notifications :P

)

func main() {
accel, err := ghw.Accelerator()
Copy link
Collaborator

Choose a reason for hiding this comment

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

do we want to extend (maybe later?) this API to accept additive user-provided filters?
I'm referring to the wide variety of devices out there and how they present themselves on PCI bus.
By "additive" filter I mean

  • users cannot rule out a device ghw is really sure it's an accelerator (this means ghw must be conservative in the core logic, which I think it's good anyway)
  • users can opt-in devices if they know better than ghw for whatever reasons (maybe old ghw version, maybe rare/custom devices)

Copy link
Owner

Choose a reason for hiding this comment

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

Yep. @mlorenzofr was going to submit a PR adding that filtering functionality. He originally added it in this PR but I asked him to separate it out into a new one.

Copy link
Collaborator

Choose a reason for hiding this comment

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

perfect! I'll be on the lookout this time!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, we'll extend it, but in a different PR. @jaypipes asked to separate it from the original development so he could analyze it step by step.

Welcome back, btw 😉

@mlorenzofr mlorenzofr deleted the accelerators branch October 15, 2024 10:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

GPUs without DRM are not detected in Linux
3 participants