Skip to content

Commit c41619d

Browse files
committed
vulkan: commonize RDNA subgroup tuning
1 parent 43c3e6f commit c41619d

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

ggml/src/ggml-vulkan/ggml-vulkan.cpp

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1520,25 +1520,36 @@ struct GpuPipelineConfig {
15201520
uint32_t default_subgroup_size = 0;
15211521
};
15221522

1523+
// Common pipeline configuration for RDNA GPUs.
1524+
static const std::unordered_map<std::string, uint32_t> rdna_pipelines = {
1525+
{"soft_max_f32", 64}, {"soft_max_f32_wg512", 64},
1526+
{"soft_max_f32_f16", 64}, {"soft_max_f32_f16_wg512", 64},
1527+
{"im2col_f32", 64}, {"im2col_f32_f16", 64},
1528+
};
1529+
static constexpr uint32_t RDNA_DEFAULT_SUBGROUP_SIZE = 32;
1530+
15231531
// Define configurations for different GPUs.
15241532
static std::vector<GpuPipelineConfig> gpu_pipeline_configs = {
15251533
{
15261534
vk_device_architecture::AMD_RDNA1,
15271535
{
1528-
{"soft_max_f32", 64}, {"soft_max_f32_wg512", 64},
1529-
{"soft_max_f32_f16", 64}, {"soft_max_f32_f16_wg512", 64},
1530-
{"im2col_f32", 64}, {"im2col_f32_f16", 64},
1536+
rdna_pipelines,
1537+
},
1538+
RDNA_DEFAULT_SUBGROUP_SIZE
1539+
},
1540+
{
1541+
vk_device_architecture::AMD_RDNA2,
1542+
{
1543+
rdna_pipelines,
15311544
},
1532-
32
1545+
RDNA_DEFAULT_SUBGROUP_SIZE
15331546
},
15341547
{
15351548
vk_device_architecture::AMD_RDNA3,
15361549
{
1537-
{"soft_max_f32", 64}, {"soft_max_f32_wg512", 64},
1538-
{"soft_max_f32_f16", 64}, {"soft_max_f32_f16_wg512", 64},
1539-
{"im2col_f32", 64}, {"im2col_f32_f16", 64},
1550+
rdna_pipelines,
15401551
},
1541-
32
1552+
RDNA_DEFAULT_SUBGROUP_SIZE
15421553
},
15431554
};
15441555

0 commit comments

Comments
 (0)