mirror of
https://github.com/ROCm/composable_kernel.git
synced 2026-05-20 04:49:54 +00:00
Conv3d new (#94)
* conv3d compiles but has memory error
* conv3d works
* fix performance issue by using __builtin_amdgc_readfirstlane
* change MakeBlock2CTileMap to MakeDefaultBlock2CTileMap; change c_blockid_to* to cblockid_to*
* clang-format
* remove CK_EXPERIMENTAL_PASS_TENSOR_DECRIPTOR_BY_*; moved wrapper into DeviceConv3d
* format
* remove useless marc
* add comment
Co-authored-by: Chao Liu <chao.liu2@amd.com>
[ROCm/composable_kernel commit: 6dfb92bbef]
This commit is contained in:
@@ -41,6 +41,19 @@ gpu_naive_division(int32_t divisor, const int32_t* p_dividend, int32_t* p_result
|
||||
}
|
||||
}
|
||||
|
||||
__host__ void cpu_magic_number_division(uint32_t magic_multiplier,
|
||||
uint32_t magic_shift,
|
||||
const int32_t* p_dividend,
|
||||
int32_t* p_result,
|
||||
uint64_t num)
|
||||
{
|
||||
for(uint64_t data_id = 0; data_id < num; ++data_id)
|
||||
{
|
||||
p_result[data_id] =
|
||||
ck::MagicDivision::DoMagicDivision(p_dividend[data_id], magic_multiplier, magic_shift);
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
T check_error(const std::vector<T>& ref, const std::vector<T>& result)
|
||||
{
|
||||
@@ -90,6 +103,7 @@ int main(int, char*[])
|
||||
|
||||
std::vector<int32_t> naive_result_host(num_dividend);
|
||||
std::vector<int32_t> magic_result_host(num_dividend);
|
||||
std::vector<int32_t> magic_result_host2(num_dividend);
|
||||
|
||||
dividends_dev_buf.ToDevice(dividends_host.data());
|
||||
|
||||
@@ -128,6 +142,20 @@ int main(int, char*[])
|
||||
pass = false;
|
||||
continue;
|
||||
}
|
||||
|
||||
cpu_magic_number_division(magic_multiplier,
|
||||
magic_shift,
|
||||
dividends_host.data(),
|
||||
magic_result_host2.data(),
|
||||
num_dividend);
|
||||
|
||||
max_diff = check_error(naive_result_host, magic_result_host2);
|
||||
|
||||
if(max_diff != 0)
|
||||
{
|
||||
pass = false;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if(pass)
|
||||
|
||||
Reference in New Issue
Block a user