Skip to content

[SYCLomatic] Support migration of CU_DEVICE_ATTRIBUTE_ASYNC_ENGINE_COUNT enum #2601

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

Open
wants to merge 11 commits into
base: SYCLomatic
Choose a base branch
from
3 changes: 3 additions & 0 deletions clang/lib/DPCT/RuleInfra/MapNames.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1157,6 +1157,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_CTX_MAP_HOST", std::make_shared<EnumNameRule>("0")},
{"CU_CTX_SCHED_BLOCKING_SYNC", std::make_shared<EnumNameRule>("0")},
{"CU_CTX_SCHED_SPIN", std::make_shared<EnumNameRule>("0")},
Expand Down
3 changes: 3 additions & 0 deletions clang/runtime/dpct-rt/include/dpct/device.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,9 @@ class device_ext : public sycl::device {

int get_max_pitch() const { return INT_MAX; }

// CU_DEVICE_ATTRIBUTE_ASYNC_ENGINE_COUNT is irrelevant in SYCL
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.
/// \param [out] total_memory The number of bytes of total 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: result1 = dpct::get_device(device).get_async_engine_count();
cuDeviceGetAttribute(&result1,CU_DEVICE_ATTRIBUTE_ASYNC_ENGINE_COUNT, device);
std::cout << " result1 " << result1 << std::endl;
}

int main(){
Expand Down