mirror of
https://github.com/ROCm/composable_kernel.git
synced 2026-05-21 05:19:20 +00:00
* Add online-compiling facility
* Synchronize from fwd-v4r5 and implement host interfaces to call conv-fwd v4r4/v4r5 using on-line compiling method
* Tiny adjustment to time reporting
* Use object assignment to replace explicit bytes copying in the first kernel of v4r4/v4r5
* Use single thread to assign descriptor object to device memory
* Adjust to the workload assignment of the two kernels of v4r4 (experimental)
* Revert "Adjust to the workload assignment of the two kernels of v4r4 (experimental)"
This reverts commit eb38461456bb0c82b6c0d32cdd616e181907e20c.
* Update to make constexpr for generating descriptor types in kernel 2 of dynamic conv-fwd v4r4
* Update to dynamic conv-fwd v4r4 online-compiling
* Update to dynamic conv-fwd v4r5 online-compiling (result not accurate)
* Tiny update to driver/CMakeLists.txt
* clang-format
* Tiny comments change
* Add env OLC_DUMP_SAVE_TMP_DIR to support saving of temperary dir
* Fwd v4r5 olc perf (#39)
* added hip-clang flags that fix perf issue of online compilation
* fix bug for olc fwd-v4r5-nchw
* Move constexpr and type reference statements out of the function body in conv-fwd v4r4/v4r5 kernel wrapper
* Remove printing in hip_build_utils.cpp
* Update to root CMakeLists.txt
* Revert "Move constexpr and type reference statements out of the function body in conv-fwd v4r4/v4r5 kernel wrapper"
This reverts commit 3d2c5d8ecdd8298b72d127110500ed5b38d9835c.
Co-authored-by: Chao Liu <chao.liu2@amd.com>
Co-authored-by: Chao Liu <lc.roy86@gmail.com>
Co-authored-by: root <root@dc-smc-18.amd.com>
[ROCm/composable_kernel commit: 1685048a67]
177 lines
4.6 KiB
C++
177 lines
4.6 KiB
C++
#ifndef CK_CONFIG_AMD_HPP
|
|
#define CK_CONFIG_AMD_HPP
|
|
|
|
#ifndef MIOPEN_DONT_USE_HIP_RUNTIME_HEADERS
|
|
#include "hip/hip_runtime.h"
|
|
#include "hip/hip_fp16.h"
|
|
#endif
|
|
#include "bfloat16_dev.hpp"
|
|
|
|
// address space for kernel parameter
|
|
#define __CONSTANT__ __attribute__((address_space(4)))
|
|
|
|
// device backend
|
|
#define CK_DEVICE_BACKEND_AMD 1
|
|
|
|
// GPU ID
|
|
#if 0
|
|
#define CK_AMD_GPU_GFX906 1
|
|
#elif 1
|
|
#define CK_AMD_GPU_GFX908 1
|
|
#elif 1
|
|
#define CK_AMD_GPU_GFX1030 1
|
|
#endif
|
|
|
|
// HIP version
|
|
#ifndef CK_HIP_VERSION_FLAT
|
|
#define CK_HIP_VERSION_FLAT 0
|
|
#endif
|
|
|
|
// launch bounds
|
|
#define CK_USE_LAUNCH_BOUNDS 0
|
|
|
|
#ifdef CK_USE_LAUNCH_BOUNDS
|
|
#define CK_MAX_THREAD_PER_BLOCK 256
|
|
#define CK_MIN_BLOCK_PER_CU 1
|
|
#endif
|
|
|
|
// buffer resourse
|
|
#if defined(CK_AMD_GPU_GFX906) || defined(CK_AMD_GPU_GFX908)
|
|
#define CK_BUFFER_RESOURCE_3RD_DWORD 0x00020000
|
|
#elif defined(CK_AMD_GPU_GFX1030)
|
|
#define CK_BUFFER_RESOURCE_3RD_DWORD 0x31014000
|
|
#endif
|
|
|
|
// multi index
|
|
#define CK_USE_DYNAMICALLY_INDEXED_MULTI_INDEX 0
|
|
|
|
// AMD inline asm
|
|
#ifndef CK_USE_AMD_INLINE_ASM
|
|
#define CK_USE_AMD_INLINE_ASM 1
|
|
#endif
|
|
|
|
#ifndef CK_THREADWISE_GEMM_USE_AMD_INLINE_ASM
|
|
#define CK_THREADWISE_GEMM_USE_AMD_INLINE_ASM 1
|
|
#endif
|
|
|
|
#ifndef CK_USE_AMD_V_FMAC_F32
|
|
#define CK_USE_AMD_V_FMAC_F32 1
|
|
#endif
|
|
|
|
// AMD buffer addressing
|
|
#ifndef CK_USE_AMD_BUFFER_ADDRESSING
|
|
#define CK_USE_AMD_BUFFER_ADDRESSING 1
|
|
#endif
|
|
|
|
// only gfx908 support native floating point atomic add
|
|
#ifndef CK_USE_AMD_BUFFER_ATOMIC_FADD
|
|
#define CK_USE_AMD_BUFFER_ATOMIC_FADD 0
|
|
#endif
|
|
|
|
// AMD XDLOPS
|
|
#ifndef CK_USE_AMD_XDLOPS
|
|
#define CK_USE_AMD_XDLOPS 0
|
|
#endif
|
|
|
|
#ifndef CK_USE_AMD_XDLOPS_INLINE_ASM
|
|
#define CK_USE_AMD_XDLOPS_INLINE_ASM 0
|
|
#endif
|
|
|
|
#ifndef CK_USE_AMD_XDLOPS_EMULATE
|
|
#define CK_USE_AMD_XDLOPS_EMULATE 0 // For internal debug purposes
|
|
#endif
|
|
|
|
// block synchronization only s_wait lgkmcnt(0), not vmcnt(0)
|
|
#ifndef CK_BLOCK_SYNC_LDS_WITHOUT_SYNC_VMEM
|
|
#define CK_BLOCK_SYNC_LDS_WITHOUT_SYNC_VMEM 1
|
|
#endif
|
|
|
|
// experimental implementation
|
|
#ifndef CK_EXPERIMENTAL_USE_BUFFER_LOAD_OOB_CHECK_OFFSET_TRICK
|
|
#define CK_EXPERIMENTAL_USE_BUFFER_LOAD_OOB_CHECK_OFFSET_TRICK 0
|
|
#endif
|
|
|
|
#ifndef CK_EXPERIMENTAL_USE_BUFFER_STORE_OOB_CHECK_OFFSET_TRICK
|
|
#define CK_EXPERIMENTAL_USE_BUFFER_STORE_OOB_CHECK_OFFSET_TRICK 1
|
|
#endif
|
|
|
|
#ifndef CK_EXPERIMENTAL_USE_BUFFER_ATOMIC_OOB_CHECK_OFFSET_TRICK
|
|
#define CK_EXPERIMENTAL_USE_BUFFER_ATOMIC_OOB_CHECK_OFFSET_TRICK 1
|
|
#endif
|
|
|
|
#ifndef CK_EXPERIMENTAL_BLOCKWISE_GEMM_USE_PIPELINE
|
|
#define CK_EXPERIMENTAL_BLOCKWISE_GEMM_USE_PIPELINE 1
|
|
#endif
|
|
|
|
#ifndef CK_EXPERIMENTAL_IMPLICIT_GEMM_BACKWARD_DATA_V4R1_OUTPUT_SKIP_OUT_OF_BOUND_CHECK
|
|
#define CK_EXPERIMENTAL_IMPLICIT_GEMM_BACKWARD_DATA_V4R1_OUTPUT_SKIP_OUT_OF_BOUND_CHECK 0
|
|
#endif
|
|
|
|
#ifndef CK_EXPERIMENTAL_IMPLICIT_GEMM_BACKWARD_DATA_V4R1_INPUT_SKIP_OUT_OF_BOUND_CHECK
|
|
#define CK_EXPERIMENTAL_IMPLICIT_GEMM_BACKWARD_DATA_V4R1_INPUT_SKIP_OUT_OF_BOUND_CHECK 0
|
|
#endif
|
|
|
|
// pass tensor descriptor by value or void*
|
|
#define CK_EXPERIMENTAL_PASS_TENSOR_DESCRIPTOR_BY_VALUE 0
|
|
#define CK_EXPERIMENTAL_PASS_TENSOR_DESCRIPTOR_BY_VOID_POINTER 1
|
|
|
|
// merge transformation use magic number division
|
|
#define CK_EXPERIMENTAL_MERGE_USE_MAGIC_DIVISION 0
|
|
|
|
// hack: have underlying assumption that need to be satsified, otherwise it's a bug
|
|
// hack for forcing register to keep idx_diff_low_const in SGPR. idx_diff_low_const must be
|
|
// thread-invariant, otherwise it's a bug
|
|
// TODO: separate index calculation into "compile-time", "global", "block", "wave", "thread"
|
|
#ifndef CK_HACK_DYNAMIC_MERGE_CALCULATE_IDX_DIFF_LOW_CONST_USE_AMD_GCN_READ_FIRST_LANE
|
|
#define CK_HACK_DYNAMIC_MERGE_CALCULATE_IDX_DIFF_LOW_CONST_USE_AMD_GCN_READ_FIRST_LANE 0
|
|
#endif
|
|
|
|
// workaround: put all workaround here
|
|
// workaround for unnecessary VGPR <--> AGPR data movement when using mfma LLVM intrinsic
|
|
#ifndef CK_WORKAROUND_SWDEV_229564
|
|
#define CK_WORKAROUND_SWDEV_229564 1
|
|
#endif
|
|
|
|
// workaround for accvgpr over-allocation
|
|
#ifndef CK_WORKAROUND_SWDEV_241664
|
|
#define CK_WORKAROUND_SWDEV_241664 1
|
|
#endif
|
|
|
|
// workaround for compiler crash when compiling recursive lambda
|
|
#ifndef CK_WORKAROUND_SWDEV_275126
|
|
#define CK_WORKAROUND_SWDEV_275126 1
|
|
#endif
|
|
|
|
// workaround for compiler crash when using buffer load/store for i8
|
|
#ifndef CK_WORKAROUND_SWDEV_XXXXXX_INT8_BUFFER_LOAD_STORE_ISSUE
|
|
#define CK_WORKAROUND_SWDEV_XXXXXX_INT8_BUFFER_LOAD_STORE_ISSUE 1
|
|
#endif
|
|
|
|
// workaround for compiler crash when using buffer load/store for i8
|
|
#ifndef CK_WORKAROUND_SWDEV_XXXXXX_INT8_DS_WRITE_ISSUE
|
|
#define CK_WORKAROUND_SWDEV_XXXXXX_INT8_DS_WRITE_ISSUE 1
|
|
#endif
|
|
|
|
namespace ck {
|
|
|
|
enum AddressSpace
|
|
{
|
|
Generic,
|
|
Global,
|
|
Lds,
|
|
Sgpr,
|
|
Vgpr
|
|
};
|
|
|
|
enum InMemoryDataOperation
|
|
{
|
|
Set,
|
|
AtomicAdd
|
|
};
|
|
|
|
// index type
|
|
using index_t = int32_t;
|
|
|
|
} // namespace ck
|
|
#endif
|