1#include <system_error> 2#include <type_traits> 3#include <hip/hip_runtime_api.h> 4 5static __global__ void fake_hip_kernel() 6{ 7} 8 9 10int __host__ interface_hip_func(int x) 11{ 12 13 fake_hip_kernel<<<1, 1>>>(); 14 bool valid = (hipSuccess == hipGetLastError()); 15 if (!valid) { 16 throw std::system_error(ENODEV, std::generic_category(), "no hip device"); 17 } 18 return x * x + std::integral_constant<int, 17>::value; 19} 20