mirror of
https://github.com/ROCm/composable_kernel.git
synced 2026-04-20 14:59:17 +00:00
Clean up conv example, Instances, profiler and test (#324)
* convnd_fwd fp16 example * update example * update example * update instance * updating refernce conv * update reference conv * update conv fwd profiler * update conv 1d and 3d instance * update include path * clean * update profiler for conv bwd data and weight * update conv bwd weight * clean * update conv example * update profiler for conv bwd weight * update ckprofiler for conv bwd data * fix reference conv bwd data bug; update conv bwd data test * update examples * fix initialization issue * update test for conv fwd * clean * clean * remove test case too sensitive to error threshhold * fix test * clean * fix build * adding conv multiple d * adding conv multiple D * add matrix padder * add gemm padding to convnd * adding group conv * update gemm multi-d * refactor * refactor * refactor * clean * clean * refactor * refactor * reorg * add ds * add bias * clean * add G * adding group * adding group * adding group * update Tensor * clean * update example * update DeviceGemmMultipleD_Xdl_CShuffle * update conv bwd-data and bwd-weight * upate contraction example * update gemm and batch gemm with e permute * fix example build * instance for grouped conv1d * update example * adding group conv instance * update gemm bilinear instance * update gemm+add+add+fastgelu instance * update profiler * update profiler * update test * update test and client example * clean * add grouped conv into profiler * update profiler * clean * add test grouped conv, update all conv test to gtest * update test
This commit is contained in:
@@ -21,6 +21,8 @@ struct TupleElementKey
|
||||
template <typename Key, typename Data>
|
||||
struct TupleElementKeyData
|
||||
{
|
||||
using DataType = Data;
|
||||
|
||||
#if 0 // workaround compiler complaint about implicitly-deleted default constructor
|
||||
__host__ __device__ constexpr TupleElementKeyData() = default;
|
||||
#else
|
||||
@@ -34,29 +36,40 @@ struct TupleElementKeyData
|
||||
{
|
||||
}
|
||||
|
||||
Data mData;
|
||||
DataType mData;
|
||||
};
|
||||
|
||||
// for read access of tuple element
|
||||
template <typename Key, typename Data>
|
||||
__host__ __device__ constexpr const Data&
|
||||
get_tuple_element_data(const TupleElementKeyData<Key, Data>& x)
|
||||
get_tuple_element_data_reference(const TupleElementKeyData<Key, Data>& x)
|
||||
{
|
||||
return static_cast<const Data&>(x.mData);
|
||||
}
|
||||
|
||||
// for write access of tuple element
|
||||
template <typename Key, typename Data>
|
||||
__host__ __device__ constexpr Data& get_tuple_element_data(TupleElementKeyData<Key, Data>& x)
|
||||
__host__ __device__ constexpr Data&
|
||||
get_tuple_element_data_reference(TupleElementKeyData<Key, Data>& x)
|
||||
{
|
||||
return x.mData;
|
||||
}
|
||||
|
||||
// TODO: not sure the use of reference is correct
|
||||
template <typename Key, typename Data>
|
||||
__host__ __device__ constexpr Data&& get_tuple_element_data(TupleElementKeyData<Key, Data>&& x)
|
||||
__host__ __device__ constexpr Data&&
|
||||
get_tuple_element_data_reference(TupleElementKeyData<Key, Data>&& x)
|
||||
{
|
||||
return static_cast<Data&&>(x.mData);
|
||||
}
|
||||
|
||||
// for infering type of tuple element
|
||||
template <typename Key, typename Data>
|
||||
__host__ __device__ constexpr Data get_tuple_element_data(const TupleElementKeyData<Key, Data>& x)
|
||||
{
|
||||
return std::forward(x.mData);
|
||||
}
|
||||
|
||||
template <typename Indices, typename... Xs>
|
||||
struct TupleImpl;
|
||||
|
||||
@@ -87,13 +100,13 @@ struct TupleImpl<Sequence<Is...>, Xs...> : TupleElementKeyData<TupleElementKey<I
|
||||
template <index_t I>
|
||||
__host__ __device__ constexpr const auto& GetElementDataByKey(TupleElementKey<I>) const
|
||||
{
|
||||
return get_tuple_element_data<TupleElementKey<I>>(*this);
|
||||
return get_tuple_element_data_reference<TupleElementKey<I>>(*this);
|
||||
}
|
||||
|
||||
template <index_t I>
|
||||
__host__ __device__ constexpr auto& GetElementDataByKey(TupleElementKey<I>)
|
||||
{
|
||||
return get_tuple_element_data<TupleElementKey<I>>(*this);
|
||||
return get_tuple_element_data_reference<TupleElementKey<I>>(*this);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -185,7 +198,8 @@ struct Tuple<>
|
||||
template <index_t I, typename TTuple>
|
||||
struct tuple_element
|
||||
{
|
||||
using type = decltype(TTuple{}.At(Number<I>{}));
|
||||
// type should keep the cv/ref qualifier of original tuple element
|
||||
using type = decltype(detail::get_tuple_element_data<detail::TupleElementKey<I>>(TTuple{}));
|
||||
};
|
||||
|
||||
template <index_t I, typename TTuple>
|
||||
|
||||
Reference in New Issue
Block a user