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

feat: replace Brand with Vendor #38

Merged
merged 1 commit into from
Jul 7, 2021
Merged

feat: replace Brand with Vendor #38

merged 1 commit into from
Jul 7, 2021

Conversation

vmx
Copy link
Collaborator

@vmx vmx commented Jul 5, 2021

The Brand was related to the platform. On Macs with an AMD graphics
card, it would return Apple. This is not really helpful, therefore
change it to Vendor, which will always contain the Vendor of the
graphics card.

BREAKING CHANGE: Brand is removed, use Vendor instead.

@vmx vmx requested a review from dignifiedquire July 5, 2021 15:30
#[error("Cannot get bus ID for device with vendor {0}")]
DeviceBusId(String),
#[error("Vendor {0} is not supported.")]
Vendor(String),
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe UnsupportedVendor would be a better name?

src/opencl/utils.rs Show resolved Hide resolved
}
false
})
.map(|d| -> GPUResult<_> {
Copy link
Contributor

Choose a reason for hiding this comment

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

could use filter_map instead

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I've opened #42 for that.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

filter_map is implemented in https://github.com/filecoin-project/rust-gpu-tools/pull/39/files#diff-799aad7ae6bfd4ae76ce98c354a508494667af58cb53f46cd870be729603c9e6R84 as i needed it for other reasons anyway (it's not as pretty as expected, though).

all_devices.append(&mut devices);
}
Err(err) => {
let platform_name = platform.name().expect("Unable to get platform name");
Copy link
Contributor

Choose a reason for hiding this comment

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

this shouldn't panic

"AMD Accelerated Parallel Processing" => Some(Self::Amd),
"Apple" => Some(Self::Apple),
_ => None,
impl TryFrom<&str> for Vendor {
Copy link
Contributor

Choose a reason for hiding this comment

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

missing tests for this

@vmx vmx force-pushed the brand-to-vendor branch from 9afd1c4 to 99f9245 Compare July 6, 2021 12:48
Base automatically changed from opencl3 to master July 6, 2021 12:49
The `Brand` was related to the platform. On Macs with an AMD graphics
card, it would return `Apple`. This is not really helpful, therefore
change it to `Vendor`, which will always contain the Vendor of the
graphics card.

BREAKING CHANGE: `Brand` is removed, use `Vendor` instead.
@vmx vmx force-pushed the brand-to-vendor branch from 99f9245 to e96c2f6 Compare July 6, 2021 12:50
Copy link
Collaborator Author

@vmx vmx left a comment

Choose a reason for hiding this comment

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

All comments should be addressed.

src/opencl/utils.rs Show resolved Hide resolved
}
false
})
.map(|d| -> GPUResult<_> {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I've opened #42 for that.

@vmx vmx merged commit 3f93dae into master Jul 7, 2021
@vmx vmx deleted the brand-to-vendor branch July 7, 2021 12:56
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.

2 participants