#pragma once #include "data_type.hip.hpp" #include "constant_integral.hip.hpp" #include "Sequence.hip.hpp" #include "Array.hip.hpp" #include "functional.hip.hpp" __device__ index_t get_thread_local_1d_id() { return threadIdx.x; } __device__ index_t get_block_1d_id() { return blockIdx.x; } template struct is_same { static const bool value = false; }; template struct is_same { static const bool value = true; }; __host__ __device__ constexpr index_t integer_divide_ceil(index_t a, index_t b) { return (a + b - 1) / b; } namespace mod_conv { // namespace mod_conv template __host__ __device__ constexpr T max(T x, T y) { return x > y ? x : y; } template __host__ __device__ constexpr T max(T x, Ts... xs) { static_assert(sizeof...(xs) > 0, "not enough argument"); auto y = max(xs...); static_assert(is_same::value, "not the same type"); return x > y ? x : y; } template __host__ __device__ constexpr T min(T x, T y) { return x < y ? x : y; } template __host__ __device__ constexpr T min(T x, Ts... xs) { static_assert(sizeof...(xs) > 0, "not enough argument"); auto y = min(xs...); static_assert(is_same::value, "not the same type"); return x < y ? x : y; } } // namespace mod_conv #if DEVICE_BACKEND_HIP // cast a pointer of LDS to its address extern "C" __attribute__((address_space(3))) void* __to_local(void* p)[[hc]]; #endif