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

Add the pciAddress of the devices to the GetPlatformAndDeviceName function. #992

Closed
wants to merge 1 commit into from

Conversation

szadam
Copy link
Contributor

@szadam szadam commented Oct 24, 2023

This solves a problem with duplicate parameters in gtest when running the test on multiple devices

Copy link
Contributor

@lukaszstolarczuk lukaszstolarczuk left a comment

Choose a reason for hiding this comment

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

Please fix:

  1. the commit message (it's too long for the commit title), just break after ~72chars and move the rest to the body of the message
  2. formatting (see CI failure) using clang-format 😉

the GetPlatformAndDeviceName function. This solves a problem with duplicate parameters in gtest when running the test on multiple devices
constexpr int max_address_length = 256;
char pci_address[max_address_length];
char id[max_address_length];
urDeviceGetInfo(device, UR_DEVICE_INFO_PCI_ADDRESS, sizeof(pci_address),
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure this query can be relied upon to be supported by every adapter. This is also ignoring the returned ur_result_t. I think this should be changed to fallback to setting id to an emprty string when the query fails.

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, what would happen on OpenCL with CPU runtime when there's multiple numa nodes? I'm guessing that's a situation where we won't get a pcie address and the device name would be identical. So we'd need a cascading set of fallbacks ;)

We just need a stable device identifier just for the gtest process. My first thought was to use the value of the device handle pointer, but, having looked at the implementation, that might change from test to test within the same process.

We could just add an id field next to device handles in all the tests, but that's potentially a lot of changes. But I think I'd prefer that over the alternatives.

Stepping back a little - would it make sense to have a process-unique id for a device in the API? something like "adapter:platform:zyx"?

Copy link
Contributor

Choose a reason for hiding this comment

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

Do the ID's need to be externally consistent?

Could we not just use the index of the device in the list returned from urDeviceGet?

Copy link
Contributor

@pbalcer pbalcer Oct 26, 2023

Choose a reason for hiding this comment

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

Do the ID's need to be externally consistent?

No, but that would be best so that it's possible to identify e.g., a misbehaving device. All we really need is to make sure that the test name is unique. My first thought was to add a monotonically increasing static number to each device name.

Could we not just use the index of the device in the list returned from urDeviceGet?

That's what I suggested with my third paragraph. This patch is an attempt at avoiding that (while making it marginally easier to identify the device based on the test name).

Copy link
Contributor

@kbenzie kbenzie Oct 26, 2023

Choose a reason for hiding this comment

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

That's what I suggested with my third paragraph. This patch is an attempt at avoiding that (while making it marginally easier to identify the device based on the test name).

Ah sorry, my speedreading is suboptimal 😬
I think this would be the simplest way anyway.
Perhaps to make it easier to link a device index a physical device we could print more identifying information during the Environment::SetUp() step?

@szadam szadam marked this pull request as draft November 22, 2023 10:06
@szadam szadam marked this pull request as ready for review December 5, 2023 10:47
@fabiomestre fabiomestre changed the base branch from adapters to main December 5, 2023 16:52
@fabiomestre
Copy link
Contributor

I have updated the target branch of this PR from the adapters branch to the main branch.
Development in UR is moving back to main. The adapters branch will soon be deleted.

@kbenzie kbenzie added the conformance Conformance test suite issues. label Apr 10, 2024
@pbalcer pbalcer closed this Sep 17, 2024
@pbalcer
Copy link
Contributor

pbalcer commented Sep 17, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
conformance Conformance test suite issues.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants