Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
xtheadvector packing
Browse files Browse the repository at this point in the history
nihui committed Dec 3, 2024
1 parent ac53182 commit 4aa6e7e
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/net.cpp
Original file line number Diff line number Diff line change
@@ -695,7 +695,7 @@ int NetPrivate::convert_layout(Mat& bottom_blob, const Layer* layer, const Optio
dst_elempack = 8;
else if (elemcount % 4 == 0)
dst_elempack = 4;
#elif NCNN_RVV
#elif NCNN_RVV || NCNN_XTHEADVECTOR
const int packn = ncnn::cpu_riscv_vlenb() / 4;
if (elemcount % packn == 0)
dst_elempack = packn;
@@ -711,7 +711,7 @@ int NetPrivate::convert_layout(Mat& bottom_blob, const Layer* layer, const Optio
dst_elempack = 8;
else if (elemcount % 4 == 0)
dst_elempack = 4;
#elif NCNN_RVV
#elif NCNN_RVV || NCNN_XTHEADVECTOR
const int packn = ncnn::cpu_riscv_vlenb() / 2;
if (elemcount % packn == 0)
dst_elempack = packn;
@@ -722,7 +722,7 @@ int NetPrivate::convert_layout(Mat& bottom_blob, const Layer* layer, const Optio
}
if (elembits == 8)
{
#if NCNN_RVV
#if NCNN_RVV || NCNN_XTHEADVECTOR
const int packn = ncnn::cpu_riscv_vlenb() / 1;
if (elemcount % packn == 0)
dst_elempack = packn;
8 changes: 4 additions & 4 deletions tests/testutil.cpp
Original file line number Diff line number Diff line change
@@ -394,8 +394,8 @@ static int convert_to_optimal_layout(const ncnn::Mat& a, ncnn::Mat& a4, const nc
dst_elempack = 8;
else if (elemcount % 4 == 0)
dst_elempack = 4;
#elif NCNN_RVV
const int packn = ncnn::cpu_riscv_vlenb() / (elembits / 8);
#elif NCNN_RVV || NCNN_XTHEADVECTOR
const int packn = ncnn::cpu_riscv_vlenb() / 4;
if (elemcount % packn == 0)
dst_elempack = packn;
#else
@@ -410,7 +410,7 @@ static int convert_to_optimal_layout(const ncnn::Mat& a, ncnn::Mat& a4, const nc
dst_elempack = 8;
else if (elemcount % 4 == 0)
dst_elempack = 4;
#elif NCNN_RVV
#elif NCNN_RVV || NCNN_XTHEADVECTOR
const int packn = ncnn::cpu_riscv_vlenb() / 2;
if (elemcount % packn == 0)
dst_elempack = packn;
@@ -421,7 +421,7 @@ static int convert_to_optimal_layout(const ncnn::Mat& a, ncnn::Mat& a4, const nc
}
if (elembits == 8)
{
#if NCNN_RVV
#if NCNN_RVV || NCNN_XTHEADVECTOR
const int packn = ncnn::cpu_riscv_vlenb() / 1;
if (elemcount % packn == 0)
dst_elempack = packn;

0 comments on commit 4aa6e7e

Please sign in to comment.