Skip to content
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

[SYCLomatic] Support migration of CU_DEVICE_ATTRIBUTE_ASYNC_ENGINE_COUNT enum #2601

Open
wants to merge 10 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 @@ -1163,6 +1163,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_LMEM_RESIZE_TO_MAX", std::make_shared<EnumNameRule>("0")},
{"CU_CTX_MAP_HOST", std::make_shared<EnumNameRule>("0")},
{"CU_CTX_SCHED_BLOCKING_SYNC", std::make_shared<EnumNameRule>("0")},
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 @@ -520,7 +521,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: 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