Skip to content

Commit

Permalink
Change MAX_MEMORY_BANDWIDTH device query to uint64
Browse files Browse the repository at this point in the history
  • Loading branch information
omarahmed1111 committed Feb 6, 2025
1 parent af4f331 commit 35c8baa
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 8 deletions.
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 b/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 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

0 comments on commit 35c8baa

Please sign in to comment.