-
Notifications
You must be signed in to change notification settings - Fork 26.3k
Add XPU device architecture property #129675
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -226,6 +226,9 @@ static void registerXpuDeviceProperties(PyObject* module) { | |||||
| } | ||||||
| return stream.str(); | ||||||
| }; | ||||||
| auto get_device_architecture = [](const DeviceProp& prop) { | ||||||
| return static_cast<uint64_t>(prop.architecture); | ||||||
| }; | ||||||
| auto gpu_subslice_count = [](const DeviceProp& prop) { | ||||||
| return (prop.gpu_eu_count / prop.gpu_eu_count_per_subslice); | ||||||
| }; | ||||||
|
|
@@ -247,12 +250,15 @@ static void registerXpuDeviceProperties(PyObject* module) { | |||||
| .def_readonly("has_fp64", &DeviceProp::has_fp64) | ||||||
| .def_readonly("has_atomic64", &DeviceProp::has_atomic64) | ||||||
| .def_property_readonly("type", get_device_type) | ||||||
| .def_property_readonly("device_arch", get_device_architecture) | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure how to cast from I'm getting this error: |
||||||
| .def( | ||||||
| "__repr__", | ||||||
| [&get_device_type, &gpu_subslice_count](const DeviceProp& prop) { | ||||||
| std::ostringstream stream; | ||||||
| stream << "_XpuDeviceProperties(name='" << prop.name | ||||||
| << "', platform_name='" << prop.platform_name << "', type='" | ||||||
| << "', platform_name='" << prop.platform_name | ||||||
| << "', device_arch='" | ||||||
| << static_cast<uint64_t>(prop.architecture) << "', type='" | ||||||
| << get_device_type(prop) << "', driver_version='" | ||||||
| << prop.driver_version << "', total_memory=" | ||||||
| << prop.global_mem_size / (1024ull * 1024) | ||||||
|
|
||||||
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.