upload fp16 weight, enable fp16 storage and arithmetic

This commit is contained in:
nihui
2019-03-23 10:34:55 +08:00
parent c6a2d0417a
commit d753fe2589
5 changed files with 125 additions and 26 deletions
+10
View File
@@ -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