mirror of
https://github.com/Tencent/ncnn.git
synced 2026-10-29 04:17:40 +08:00
upload fp16 weight, enable fp16 storage and arithmetic
This commit is contained in:
@@ -737,6 +737,16 @@ VkTransfer::~VkTransfer()
|
||||
|
||||
void VkTransfer::record_upload(const Mat& src, VkMat& dst)
|
||||
{
|
||||
if (vkdev->info.support_fp16_storage && src.elemsize / src.packing == 4)
|
||||
{
|
||||
Mat src_fp16;
|
||||
cast_float32_to_float16(src, src_fp16);
|
||||
|
||||
record_upload(src_fp16, dst);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
dst.create_like(src, weight_vkallocator, staging_vkallocator);
|
||||
|
||||
// set weight blob as readonly
|
||||
|
||||
Reference in New Issue
Block a user