Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions src/native/cuda/hygon/runtime_.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,17 @@ struct Runtime<Device::Type::kHygon>

static constexpr auto SetDevice = cudaSetDevice;

static constexpr auto GetDevice = cudaGetDevice;
static constexpr auto GetDevice = [](auto&&... args) {
return cudaGetDevice(std::forward<decltype(args)>(args)...);
};

static constexpr auto GetDeviceCount = cudaGetDeviceCount;
static constexpr auto GetDeviceCount = [](auto&&... args) {
return cudaGetDeviceCount(std::forward<decltype(args)>(args)...);
};

static constexpr auto DeviceSynchronize = cudaDeviceSynchronize;
static constexpr auto DeviceSynchronize = [](auto&&... args) {
return cudaDeviceSynchronize(std::forward<decltype(args)>(args)...);
};

static constexpr auto Malloc = [](auto&&... args) {
return cudaMalloc(std::forward<decltype(args)>(args)...);
Expand Down Expand Up @@ -72,7 +78,9 @@ struct Runtime<Device::Type::kHygon>

static constexpr auto Memcpy = cudaMemcpy;

static constexpr auto MemcpyAsync = cudaMemcpyAsync;
static constexpr auto MemcpyAsync = [](auto&&... args) {
return cudaMemcpyAsync(std::forward<decltype(args)>(args)...);
};

static constexpr auto kMemcpyHostToHost = cudaMemcpyHostToHost;

Expand Down
5 changes: 5 additions & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@ if(WITH_HYGON)
HYGON infini::rt::Device::Type::kHygon
infini/rt/hygon/runtime_.h
1 1 1 1 1 1 1 1)
add_infini_rt_test(test_hygon_cuda_runtime test_hygon_cuda_runtime.cu)
get_target_property(_hygon_runtime_definitions test_hygon_runtime
COMPILE_DEFINITIONS)
target_compile_definitions(test_hygon_cuda_runtime
PRIVATE ${_hygon_runtime_definitions})
add_infini_rt_backend_graph_test(
HYGON infini::rt::Device::Type::kHygon 1)
endif()
Expand Down
2 changes: 2 additions & 0 deletions tests/test_hygon_cuda_runtime.cu
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// Exercise the runtime headers with DTK's device compiler as well as C++.
#include "test_native_runtime.cc"
Loading