mirror of
https://github.com/ROCm/composable_kernel.git
synced 2026-05-20 04:49:54 +00:00
CK-Tile Grouped GEMM refactor and post PR fixes (#1756)
* Grouped gemm simple code refactor
* Offset invoker
* Invoke generic Run, and replace name of parrtitioner variable
* Tests fix type
* Removed namespaces
* Add template param to avoid implicit cast
* Remove generic function
* Constant value
* underline enum to int16_t
* Generalize partitioner function
* Remove whitespaces
* Rename function
* Using support
* Clang-format
* Clang-format
* Fn-partitioner description fn
* Typo
* Typo 2
* Better description
* Better description
* Refactor after review
* Use ctr instead of set fn
* Inovke ctr and typo
* Comments
* Remove unnecessary comment
* Review, remove modulo
[ROCm/composable_kernel commit: 3c93d3c444]
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
// Copyright (c) 2018-2023, Advanced Micro Devices, Inc. All rights reserved.
|
||||
// Copyright (c) 2018-2025, Advanced Micro Devices, Inc. All rights reserved.
|
||||
|
||||
#pragma once
|
||||
|
||||
@@ -12,18 +12,37 @@
|
||||
|
||||
namespace ck_tile {
|
||||
|
||||
enum struct address_space_enum
|
||||
template <typename, bool>
|
||||
struct safe_underlying_type;
|
||||
|
||||
template <typename T>
|
||||
struct safe_underlying_type<T, true>
|
||||
{
|
||||
generic,
|
||||
using type = std::underlying_type_t<T>;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct safe_underlying_type<T, false>
|
||||
{
|
||||
using type = void;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
using safe_underlying_type_t = typename safe_underlying_type<T, std::is_enum<T>::value>::type;
|
||||
|
||||
enum struct address_space_enum : std::uint16_t
|
||||
{
|
||||
generic = 0,
|
||||
global,
|
||||
lds,
|
||||
sgpr,
|
||||
vgpr,
|
||||
constant,
|
||||
vgpr
|
||||
};
|
||||
|
||||
enum struct memory_operation_enum
|
||||
enum struct memory_operation_enum : std::uint16_t
|
||||
{
|
||||
set,
|
||||
set = 0,
|
||||
atomic_add,
|
||||
atomic_max,
|
||||
add
|
||||
@@ -109,4 +128,30 @@ CK_TILE_DEVICE void s_nop(index_t cnt = 0)
|
||||
#endif
|
||||
}
|
||||
|
||||
#define CK_CONSTANT_ADDRESS_SPACE \
|
||||
__attribute__((address_space( \
|
||||
static_cast<safe_underlying_type_t<address_space_enum>>(address_space_enum::constant))))
|
||||
|
||||
template <typename T>
|
||||
__device__ T* cast_pointer_to_generic_address_space(T CK_CONSTANT_ADDRESS_SPACE* p)
|
||||
{
|
||||
// cast a pointer in "Constant" address space (4) to "Generic" address space (0)
|
||||
// only c-style pointer cast seems be able to be compiled
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wold-style-cast"
|
||||
return (T*)(p); // NOLINT(old-style-cast)
|
||||
#pragma clang diagnostic pop
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
__host__ __device__ T CK_CONSTANT_ADDRESS_SPACE* cast_pointer_to_constant_address_space(T* p)
|
||||
{
|
||||
// cast a pointer in "Generic" address space (0) to "Constant" address space (4)
|
||||
// only c-style pointer cast seems be able to be compiled;
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wold-style-cast"
|
||||
return (T CK_CONSTANT_ADDRESS_SPACE*)p; // NOLINT(old-style-cast)
|
||||
#pragma clang diagnostic pop
|
||||
}
|
||||
|
||||
} // namespace ck_tile
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
// Copyright (c) 2024, Advanced Micro Devices, Inc. All rights reserved.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "ck_tile/core/config.hpp"
|
||||
|
||||
// Address Space for AMDGCN
|
||||
// https://llvm.org/docs/AMDGPUUsage.html#address-space
|
||||
|
||||
namespace ck_tile {
|
||||
|
||||
#define CK_CONSTANT_ADDRESS_SPACE __attribute__((address_space(4)))
|
||||
|
||||
template <typename T>
|
||||
__device__ T* cast_pointer_to_generic_address_space(T CK_CONSTANT_ADDRESS_SPACE* p)
|
||||
{
|
||||
// cast a pointer in "Constant" address space (4) to "Generic" address space (0)
|
||||
// only c-style pointer cast seems be able to be compiled
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wold-style-cast"
|
||||
return (T*)p; // NOLINT(old-style-cast)
|
||||
#pragma clang diagnostic pop
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
__host__ __device__ T CK_CONSTANT_ADDRESS_SPACE* cast_pointer_to_constant_address_space(T* p)
|
||||
{
|
||||
// cast a pointer in "Generic" address space (0) to "Constant" address space (4)
|
||||
// only c-style pointer cast seems be able to be compiled
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wold-style-cast"
|
||||
return (T CK_CONSTANT_ADDRESS_SPACE*)p; // NOLINT(old-style-cast)
|
||||
#pragma clang diagnostic pop
|
||||
}
|
||||
|
||||
} // namespace ck_tile
|
||||
Reference in New Issue
Block a user