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

Change MAX_MEMORY_BANDWIDTH device query to uint64 #2653

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/ur_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -2121,7 +2121,7 @@ typedef enum ur_device_info_t {
UR_DEVICE_INFO_GPU_SUBSLICES_PER_SLICE = 94,
/// [uint32_t][optional-query] return Intel GPU number of threads per EU
UR_DEVICE_INFO_GPU_HW_THREADS_PER_EU = 95,
/// [uint32_t][optional-query] return max memory bandwidth in Mb/s
/// [uint64_t][optional-query] return max memory bandwidth in Mb/s
UR_DEVICE_INFO_MAX_MEMORY_BANDWIDTH = 96,
/// [::ur_bool_t] device supports sRGB images
UR_DEVICE_INFO_IMAGE_SRGB = 97,
Expand Down
6 changes: 3 additions & 3 deletions include/ur_print.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4186,9 +4186,9 @@ inline ur_result_t printTagged(std::ostream &os, const void *ptr,
os << ")";
} break;
case UR_DEVICE_INFO_MAX_MEMORY_BANDWIDTH: {
const uint32_t *tptr = (const uint32_t *)ptr;
if (sizeof(uint32_t) > size) {
os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint32_t)
const uint64_t *tptr = (const uint64_t *)ptr;
if (sizeof(uint64_t) > size) {
os << "invalid size (is: " << size << ", expected: >=" << sizeof(uint64_t)
<< ")";
return UR_RESULT_ERROR_INVALID_SIZE;
}
Expand Down
2 changes: 1 addition & 1 deletion scripts/core/device.yml
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ etors:
- name: GPU_HW_THREADS_PER_EU
desc: "[uint32_t][optional-query] return Intel GPU number of threads per EU"
- name: MAX_MEMORY_BANDWIDTH
desc: "[uint32_t][optional-query] return max memory bandwidth in Mb/s"
desc: "[uint64_t][optional-query] return max memory bandwidth in Mb/s"
Copy link
Contributor

Choose a reason for hiding this comment

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

The spec for this says it should be in Mb/s, which I'd be surprised if we're overflowing (uint32 max mb would be around 4000 terabytes/second). Is the sycl RT expecting mb/s? Should we update it to b/s?

- name: IMAGE_SRGB
desc: "[$x_bool_t] device supports sRGB images"
- name: BUILD_ON_SUBDEVICE
Expand Down
4 changes: 3 additions & 1 deletion source/adapters/cuda/device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1008,8 +1008,10 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetInfo(ur_device_handle_t hDevice,
&MemoryBusWidth, CU_DEVICE_ATTRIBUTE_GLOBAL_MEMORY_BUS_WIDTH,
hDevice->get()));
}
uint64_t MemoryBandwidthConstant = 250;

uint32_t MemoryBandwidth = MemoryClockKHz * MemoryBusWidth * 250;
uint64_t MemoryBandwidth =
MemoryBandwidthConstant * MemoryClockKHz * MemoryBusWidth;

return ReturnValue(MemoryBandwidth);
}
Expand Down
2 changes: 1 addition & 1 deletion test/conformance/device/urDeviceGetInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ static std::unordered_map<ur_device_info_t, size_t> device_info_size_map = {
{UR_DEVICE_INFO_GPU_EU_COUNT_PER_SUBSLICE, sizeof(uint32_t)},
{UR_DEVICE_INFO_GPU_SUBSLICES_PER_SLICE, sizeof(uint32_t)},
{UR_DEVICE_INFO_GPU_HW_THREADS_PER_EU, sizeof(uint32_t)},
{UR_DEVICE_INFO_MAX_MEMORY_BANDWIDTH, sizeof(uint32_t)},
{UR_DEVICE_INFO_MAX_MEMORY_BANDWIDTH, sizeof(uint64_t)},
{UR_DEVICE_INFO_IMAGE_SRGB, sizeof(ur_bool_t)},
{UR_DEVICE_INFO_BUILD_ON_SUBDEVICE, sizeof(ur_bool_t)},
{UR_DEVICE_INFO_ATOMIC_64, sizeof(ur_bool_t)},
Expand Down
2 changes: 1 addition & 1 deletion tools/urinfo/urinfo.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ inline void printDeviceInfos(ur_device_handle_t hDevice,
std::cout << prefix;
printDeviceInfo<uint32_t>(hDevice, UR_DEVICE_INFO_GPU_HW_THREADS_PER_EU);
std::cout << prefix;
printDeviceInfo<uint32_t>(hDevice, UR_DEVICE_INFO_MAX_MEMORY_BANDWIDTH);
printDeviceInfo<uint64_t>(hDevice, UR_DEVICE_INFO_MAX_MEMORY_BANDWIDTH);
std::cout << prefix;
printDeviceInfo<ur_bool_t>(hDevice, UR_DEVICE_INFO_IMAGE_SRGB);
std::cout << prefix;
Expand Down