Skip to content

Commit c725bae

Browse files
author
the-slow-one
authored
[SYCLomatic] Support migration of CU_DEVICE_ATTRIBUTE_ASYNC_ENGINE_COUNT enum (#2601)
1 parent 5e10875 commit c725bae

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

clang/lib/DPCT/RuleInfra/MapNames.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1252,6 +1252,9 @@ void MapNames::setExplicitNamespaceMap(
12521252
{"CU_DEVICE_ATTRIBUTE_MAX_PITCH",
12531253
std::make_shared<EnumNameRule>("get_max_pitch",
12541254
HelperFeatureEnum::device_ext)},
1255+
{"CU_DEVICE_ATTRIBUTE_ASYNC_ENGINE_COUNT",
1256+
std::make_shared<EnumNameRule>("get_async_engine_count",
1257+
HelperFeatureEnum::device_ext)},
12551258
{"CU_DEVICE_P2P_ATTRIBUTE_ACCESS_SUPPORTED",
12561259
std::make_shared<EnumNameRule>(
12571260
DpctGlobalInfo::usePeerAccess()

clang/runtime/dpct-rt/include/dpct/device.hpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include <cstring>
1616
#include <functional>
1717
#include <iostream>
18+
#include <limits>
1819
#include <map>
1920
#include <mutex>
2021
#include <set>
@@ -525,7 +526,9 @@ class device_ext : public sycl::device {
525526
return get_device_info().get_local_mem_size();
526527
}
527528
528-
int get_max_pitch() const { return INT_MAX; }
529+
int get_max_pitch() const { return std::numeric_limits<int>::max(); }
530+
531+
int get_async_engine_count() const { return 0; }
529532
530533
/// Get the number of bytes of free and total memory on the SYCL device.
531534
/// \param [out] free_memory The number of bytes of free memory on the SYCL device.

clang/test/dpct/driver_device.cu

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,11 @@ void test() {
5757

5858
// CHECK: result7 = dpct::get_device(device).get_max_pitch();
5959
cuDeviceGetAttribute(&result7,CU_DEVICE_ATTRIBUTE_MAX_PITCH, device);
60-
std::cout << " result7 " << result5 << std::endl;
60+
std::cout << " result7 " << result7 << std::endl;
61+
62+
// CHECK: result8 = dpct::get_device(device).get_async_engine_count();
63+
cuDeviceGetAttribute(&result8,CU_DEVICE_ATTRIBUTE_ASYNC_ENGINE_COUNT, device);
64+
std::cout << " result8 " << result1 << std::endl;
6165

6266
// CHECK: sycl::ext::oneapi::peer_access p2p_attr;
6367
CUdevice_P2PAttribute p2p_attr;

0 commit comments

Comments
 (0)