Skip to content
3 changes: 3 additions & 0 deletions clang/lib/DPCT/RuleInfra/MapNames.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1251,6 +1251,9 @@ void MapNames::setExplicitNamespaceMap(
{"CU_DEVICE_ATTRIBUTE_MAX_PITCH",
std::make_shared<EnumNameRule>("get_max_pitch",
HelperFeatureEnum::device_ext)},
{"CU_DEVICE_ATTRIBUTE_ASYNC_ENGINE_COUNT",
std::make_shared<EnumNameRule>("get_async_engine_count",
HelperFeatureEnum::device_ext)},
{"CU_DEVICE_P2P_ATTRIBUTE_ACCESS_SUPPORTED",
std::make_shared<EnumNameRule>(
DpctGlobalInfo::usePeerAccess()
Expand Down
5 changes: 4 additions & 1 deletion clang/runtime/dpct-rt/include/dpct/device.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <cstring>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <mutex>
#include <set>
Expand Down Expand Up @@ -525,7 +526,9 @@ class device_ext : public sycl::device {
return get_device_info().get_local_mem_size();
}

int get_max_pitch() const { return INT_MAX; }
int get_max_pitch() const { return std::numeric_limits<int>::max(); }

int get_async_engine_count() const { return 0; }

/// Get the number of bytes of free and total memory on the SYCL device.
/// \param [out] free_memory The number of bytes of free memory on the SYCL device.
Expand Down
6 changes: 5 additions & 1 deletion clang/test/dpct/driver_device.cu
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,11 @@ void test() {

// CHECK: result7 = dpct::get_device(device).get_max_pitch();
cuDeviceGetAttribute(&result7,CU_DEVICE_ATTRIBUTE_MAX_PITCH, device);
std::cout << " result7 " << result5 << std::endl;
std::cout << " result7 " << result7 << std::endl;

// CHECK: result8 = dpct::get_device(device).get_async_engine_count();
cuDeviceGetAttribute(&result8,CU_DEVICE_ATTRIBUTE_ASYNC_ENGINE_COUNT, device);
std::cout << " result8 " << result1 << std::endl;

// CHECK: sycl::ext::oneapi::peer_access p2p_attr;
CUdevice_P2PAttribute p2p_attr;
Expand Down