config_amd.hpp.in 1.29 KB
Newer Older
Chao Liu's avatar
Chao Liu committed
1
2
#ifndef CK_CONFIG_AMD_HPP
#define CK_CONFIG_AMD_HPP
Chao Liu's avatar
Chao Liu committed
3
4
5
6

#include "hip/hip_runtime.h"
#include "hip/hip_fp16.h"

Chao Liu's avatar
Chao Liu committed
7
#define CK_UNSIGNED_INDEX_TYPE 0
Chao Liu's avatar
Chao Liu committed
8
#define CK_DEVICE_BACKEND_AMD 1
Chao Liu's avatar
Chao Liu committed
9
#define CK_USE_AMD_INTRINSIC 0
Chao Liu's avatar
Chao Liu committed
10
#define CK_USE_AMD_INLINE_ASM 1
11
#define CK_USE_AMD_INTRINSIC_BUFFER_LOAD_STORE 1
Chao Liu's avatar
Chao Liu committed
12
#define CK_EXPERIMENTAL_USE_MORE_COMPILE_STATIC_BLOCKWISE_GENERIC_SLICE_COPY_V1 1
13
#define CK_EXPERIMENTAL_USE_MORE_COMPILE_STATIC_THREADWISE_GENERIC_TENSOR_SLICE_COPY_V1R1 0
14
#define CK_EXPERIMENTAL_USE_MORE_COMPILE_STATIC_THREADWISE_GENERIC_TENSOR_SLICE_COPY_V1R2 0
15
#define CK_EXPERIMENTAL_USE_MORE_COMPILE_STATIC_THREADWISE_GENERIC_TENSOR_SLICE_COPY_V2R1 0
Chao Liu's avatar
Chao Liu committed
16

Chao Liu's avatar
Chao Liu committed
17
18
namespace ck {

19
20
21
22
23
24
enum address_space_t
{
    generic = 0,
    global  = 3
};

Chao Liu's avatar
Chao Liu committed
25
#if CK_UNSIGNED_INDEX_TYPE
26
using index_t = uint32_t;
Chao Liu's avatar
Chao Liu committed
27
#else
28
using index_t = int32_t;
Chao Liu's avatar
Chao Liu committed
29
30
#endif

Chao Liu's avatar
Chao Liu committed
31
32
33
34
35
// For some reason, HIP compiler need this definition to generate optimal load and store
// instruction
typedef float float2_t __attribute__((ext_vector_type(2)));
typedef float float4_t __attribute__((ext_vector_type(4)));

36
37
typedef int32_t int32x4_t __attribute__((ext_vector_type(4)));

38
// data type conversion
39
template <typename T>
40
struct type_convert
Chao Liu's avatar
Chao Liu committed
41
{
42
43
    template <typename X>
    __device__ T operator()(const X& x) const
44
45
46
47
    {
        return static_cast<T>(x);
    }
};
Chao Liu's avatar
Chao Liu committed
48
49
50
51

} // namespace ck

#endif