Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions src/layer/vulkan/convolution1d_vulkan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,16 @@ int Convolution1D_vulkan::create_pipeline(const Option& _opt)
UNROLL_WG_M = std::min((size + coopmat_M * UNROLL_SG_M - 1) / (coopmat_M * UNROLL_SG_M), 2);
UNROLL_WG_N = std::min((num_output + coopmat_N * UNROLL_SG_N - 1) / (coopmat_N * UNROLL_SG_N), 2);

if (vkdev->info.vendor_id() == 0x5143)
{
// unrolling caused an error due to insufficient shared memory on adreno
UNROLL_SG_M = 1;
UNROLL_SG_N = 1;
UNROLL_SG_K = 1;
UNROLL_WG_M = 1;
UNROLL_WG_N = 1;
}

Mat weight_data_r2;

if (elempack == 4)
Expand Down Expand Up @@ -303,6 +313,16 @@ int Convolution1D_vulkan::create_pipeline(const Option& _opt)
UNROLL_WG_M = std::min((size + coopmat_M * UNROLL_SG_M - 1) / (coopmat_M * UNROLL_SG_M), 2);
UNROLL_WG_N = std::min((num_output + coopmat_N * UNROLL_SG_N - 1) / (coopmat_N * UNROLL_SG_N), 2);

if (vkdev->info.vendor_id() == 0x5143)
{
// unrolling caused an error due to insufficient shared memory on adreno
UNROLL_SG_M = 1;
UNROLL_SG_N = 1;
UNROLL_SG_K = 1;
UNROLL_WG_M = 1;
UNROLL_WG_N = 1;
}

const int blocks_n = (num_output + coopmat_N * UNROLL_SG_N * UNROLL_WG_N - 1) / (coopmat_N * UNROLL_SG_N * UNROLL_WG_N);
const int kk = (num_input + coopmat_K - 1) / coopmat_K;

Expand Down
30 changes: 30 additions & 0 deletions src/layer/vulkan/convolution_vulkan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,16 @@ int Convolution_vulkan::create_pipeline(const Option& opt)

UNROLL_WG_M = std::min((size + coopmat_M * UNROLL_SG_M - 1) / (coopmat_M * UNROLL_SG_M), 2);
UNROLL_WG_N = std::min((num_output + coopmat_N * UNROLL_SG_N - 1) / (coopmat_N * UNROLL_SG_N), 2);

if (vkdev->info.vendor_id() == 0x5143)
{
// unrolling caused an error due to insufficient shared memory on adreno
UNROLL_SG_M = 1;
UNROLL_SG_N = 1;
UNROLL_SG_K = 1;
UNROLL_WG_M = 1;
UNROLL_WG_N = 1;
}
}

// winograd43 transform kernel
Expand Down Expand Up @@ -879,6 +889,16 @@ int Convolution_vulkan::create_pipeline(const Option& opt)
UNROLL_WG_M = std::min((size + coopmat_M * UNROLL_SG_M - 1) / (coopmat_M * UNROLL_SG_M), 2);
UNROLL_WG_N = std::min((num_output + coopmat_N * UNROLL_SG_N - 1) / (coopmat_N * UNROLL_SG_N), 2);

if (vkdev->info.vendor_id() == 0x5143)
{
// unrolling caused an error due to insufficient shared memory on adreno
UNROLL_SG_M = 1;
UNROLL_SG_N = 1;
UNROLL_SG_K = 1;
UNROLL_WG_M = 1;
UNROLL_WG_N = 1;
}

Mat weight_data_r2;

if (elempack == 4)
Expand Down Expand Up @@ -1067,6 +1087,16 @@ int Convolution_vulkan::create_pipeline(const Option& opt)
UNROLL_WG_M = std::min((size + coopmat_M * UNROLL_SG_M - 1) / (coopmat_M * UNROLL_SG_M), 2);
UNROLL_WG_N = std::min((num_output + coopmat_N * UNROLL_SG_N - 1) / (coopmat_N * UNROLL_SG_N), 2);

if (vkdev->info.vendor_id() == 0x5143)
{
// unrolling caused an error due to insufficient shared memory on adreno
UNROLL_SG_M = 1;
UNROLL_SG_N = 1;
UNROLL_SG_K = 1;
UNROLL_WG_M = 1;
UNROLL_WG_N = 1;
}

// +-N-+
// K |
// +SG_UN
Expand Down
10 changes: 10 additions & 0 deletions src/layer/vulkan/deconvolution_vulkan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,16 @@ int Deconvolution_vulkan::create_pipeline(const Option& opt)
UNROLL_WG_M = std::min((size + coopmat_M * UNROLL_SG_M - 1) / (coopmat_M * UNROLL_SG_M), 2);
UNROLL_WG_N = std::min((maxk * num_output + coopmat_N * UNROLL_SG_N - 1) / (coopmat_N * UNROLL_SG_N), 2);

if (vkdev->info.vendor_id() == 0x5143)
{
// unrolling caused an error due to insufficient shared memory on adreno
UNROLL_SG_M = 1;
UNROLL_SG_N = 1;
UNROLL_SG_K = 1;
UNROLL_WG_M = 1;
UNROLL_WG_N = 1;
}

// +-N-+
// K |
// +SG_UN
Expand Down
10 changes: 10 additions & 0 deletions src/layer/vulkan/gemm_vulkan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,16 @@ int Gemm_vulkan::create_pipeline(const Option& opt)
UNROLL_WG_M = std::min((M + coopmat_M * UNROLL_SG_M - 1) / (coopmat_M * UNROLL_SG_M), 2);
UNROLL_WG_N = std::min((N + coopmat_N * UNROLL_SG_N - 1) / (coopmat_N * UNROLL_SG_N), 2);

if (vkdev->info.vendor_id() == 0x5143)
{
// unrolling caused an error due to insufficient shared memory on adreno
UNROLL_SG_M = 1;
UNROLL_SG_N = 1;
UNROLL_SG_K = 1;
UNROLL_WG_M = 1;
UNROLL_WG_N = 1;
}

if (constantA == 1)
{
// +-K-+
Expand Down
17 changes: 17 additions & 0 deletions src/layer/vulkan/sdpa_vulkan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,13 @@ int SDPA_vulkan::create_pipeline(const Option& opt)

FA_UNROLL_WG_M = 2;

if (vkdev->info.vendor_id() == 0x5143)
{
// unrolling caused an error due to insufficient shared memory on adreno
FA_UNROLL_SG_M = 1;
FA_UNROLL_WG_M = 1;
}

std::vector<vk_specialization_type> specializations(1 + 8);
specializations[0].i = attn_mask;

Expand Down Expand Up @@ -184,6 +191,16 @@ int SDPA_vulkan::create_pipeline(const Option& opt)
UNROLL_WG_M = std::min((M + coopmat_M * UNROLL_SG_M - 1) / (coopmat_M * UNROLL_SG_M), 2);
UNROLL_WG_N = std::min((N + coopmat_N * UNROLL_SG_N - 1) / (coopmat_N * UNROLL_SG_N), 2);

if (vkdev->info.vendor_id() == 0x5143)
{
// unrolling caused an error due to insufficient shared memory on adreno
UNROLL_SG_M = 1;
UNROLL_SG_N = 1;
UNROLL_SG_K = 1;
UNROLL_WG_M = 1;
UNROLL_WG_N = 1;
}

// qk cross
{
std::vector<vk_specialization_type> specializations(13 + 9);
Expand Down
Loading