Skip to content

Commit 58e6fbc

Browse files
netrunnereve0cc4m
authored andcommitted
vulkan: matmul gcn tuning (ggml-org#13016)
* tune matmul for gcn * this one is more power efficient * Update ggml/src/ggml-vulkan/ggml-vulkan.cpp Co-authored-by: 0cc4m <[email protected]> * disable this tune for the proprietary driver --------- Co-authored-by: 0cc4m <[email protected]>
1 parent 777310b commit 58e6fbc

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,7 @@ struct vk_device_struct {
246246
bool pipeline_robustness;
247247
vk::Device device;
248248
uint32_t vendor_id;
249+
vk::DriverId driver_id;
249250
vk_device_architecture architecture;
250251
vk_queue compute_queue;
251252
vk_queue transfer_queue;
@@ -1740,6 +1741,11 @@ static void ggml_vk_load_shaders(vk_device& device) {
17401741
m_warptile_mmq_int = { 128, 64, 64, 32, subgroup_size_8, 32, 2, 2, 2, 1, subgroup_size_8 };
17411742
s_warptile_mmq_int = { subgroup_size_32, 32, 32, 32, 32, 32, 2, 2, 1, 1, subgroup_size_8 };
17421743

1744+
// chip specific tuning
1745+
if ((device->architecture == AMD_GCN) && (device->driver_id != vk::DriverId::eAmdProprietary)) {
1746+
m_warptile_mmq = m_warptile_mmq_int = { 256, 64, 64, 32, 16, 16, 2, 2, 2, 1, 16 };
1747+
}
1748+
17431749
l_mmq_wg_denoms = l_wg_denoms = {128, 128, 1 };
17441750
m_mmq_wg_denoms = m_wg_denoms = { 64, 64, 1 };
17451751
s_mmq_wg_denoms = s_wg_denoms = { 32, 32, 1 };
@@ -2658,6 +2664,7 @@ static vk_device ggml_vk_get_device(size_t idx) {
26582664
device->physical_device.getProperties2(&props2);
26592665
device->properties = props2.properties;
26602666
device->vendor_id = device->properties.vendorID;
2667+
device->driver_id = driver_props.driverID;
26612668

26622669
const char* GGML_VK_FORCE_MAX_ALLOCATION_SIZE = getenv("GGML_VK_FORCE_MAX_ALLOCATION_SIZE");
26632670

0 commit comments

Comments
 (0)