-
Notifications
You must be signed in to change notification settings - Fork 38
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
Conversation
src/opencl/error.rs
Outdated
#[error("Cannot get bus ID for device with vendor {0}")] | ||
DeviceBusId(String), | ||
#[error("Vendor {0} is not supported.")] | ||
Vendor(String), |
There was a problem hiding this comment.
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?
} | ||
false | ||
}) | ||
.map(|d| -> GPUResult<_> { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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).
src/opencl/utils.rs
Outdated
all_devices.append(&mut devices); | ||
} | ||
Err(err) => { | ||
let platform_name = platform.name().expect("Unable to get platform name"); |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing tests for this
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.
There was a problem hiding this 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.
} | ||
false | ||
}) | ||
.map(|d| -> GPUResult<_> { |
There was a problem hiding this comment.
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.
The
Brand
was related to the platform. On Macs with an AMD graphicscard, it would return
Apple
. This is not really helpful, thereforechange it to
Vendor
, which will always contain the Vendor of thegraphics card.
BREAKING CHANGE:
Brand
is removed, useVendor
instead.