diff --git a/clang/lib/DPCT/RuleInfra/MapNames.cpp b/clang/lib/DPCT/RuleInfra/MapNames.cpp index 3e30a0eff3ff..355e08a9ae67 100644 --- a/clang/lib/DPCT/RuleInfra/MapNames.cpp +++ b/clang/lib/DPCT/RuleInfra/MapNames.cpp @@ -1251,6 +1251,9 @@ void MapNames::setExplicitNamespaceMap( {"CU_DEVICE_ATTRIBUTE_MAX_PITCH", std::make_shared("get_max_pitch", HelperFeatureEnum::device_ext)}, + {"CU_DEVICE_ATTRIBUTE_ASYNC_ENGINE_COUNT", + std::make_shared("get_async_engine_count", + HelperFeatureEnum::device_ext)}, {"CU_DEVICE_P2P_ATTRIBUTE_ACCESS_SUPPORTED", std::make_shared( DpctGlobalInfo::usePeerAccess() diff --git a/clang/runtime/dpct-rt/include/dpct/device.hpp b/clang/runtime/dpct-rt/include/dpct/device.hpp index 03e6b06d77bf..e35fb63d1a9d 100644 --- a/clang/runtime/dpct-rt/include/dpct/device.hpp +++ b/clang/runtime/dpct-rt/include/dpct/device.hpp @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -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::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. diff --git a/clang/test/dpct/driver_device.cu b/clang/test/dpct/driver_device.cu index 2a81d7b39b3d..8be28cd2e539 100644 --- a/clang/test/dpct/driver_device.cu +++ b/clang/test/dpct/driver_device.cu @@ -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;