metal: threadgroup-memory alignment and expert-index width fixes - #27944
metal: threadgroup-memory alignment and expert-index width fixes#27944tarruda wants to merge 2 commits into
Conversation
Assisted-by: Codex
Assisted-by: Codex
| // test_cases.emplace_back(new test_mul_mat(GGML_TYPE_F16, GGML_TYPE_F16, 512, 262144, 9216, {1, 1}, {1, 1})); | ||
|
|
||
| // test large experts*tokens | ||
| test_cases.emplace_back(new test_mul_mat_id(GGML_TYPE_F16, GGML_TYPE_F32, 512, 10, false, 64, 512, 64)); |
There was a problem hiding this comment.
@tarruda Thanks. And are you sure this test fails on master? It passes on my end without the metal changes in the PR.
There was a problem hiding this comment.
Replied here
Seems like it requires some validation to be enabled for it to be detected on master
| void ggml_metal_encoder_set_threadgroup_memory_size(ggml_metal_encoder_t encoder, size_t size, int idx) { | ||
| [encoder->obj setThreadgroupMemoryLength:size atIndex:idx]; | ||
| [encoder->obj setThreadgroupMemoryLength:GGML_PAD(size, 16) atIndex:idx]; | ||
| } |
| threadgroup char * shmem [[threadgroup(0)]], | ||
| uint3 tgpig[[threadgroup_position_in_grid]], | ||
| ushort tiitg[[thread_index_in_threadgroup]], | ||
| uint tiitg[[thread_index_in_threadgroup]], |
There was a problem hiding this comment.
This change does not seem necessary, so for now not merging it. That is unless the AI can demonstrate an issue with it that I am not seeing.
|
@ggerganov in the interest of full disclosure (in case it was not clear from my previous PRs that touch any of the ML things): I have no idea what I'm doing here. I'm merely a GPT prompter when it comes to any ML/Metal related code. I . Entirely possible this is all just hallucination. With that said, these issues were surfaced by GPT 5.6 Sol as metal correctness fixes that were uncovered by my Qwen4exp exploration. I have forwarded your comments to it, and here is what is told me: |
|
Ok, got it. I can see the error with
Yes, no problem at all. I've already accepted that the AI is going to obsolete our job soon. Just trying to understand and learn a few more things while still can. |
Ok closing this one then. LMK if I can do anything else to help.
😢 This is a side discussion, but no matter how good AI gets at programming GPU kernels, it still cannot always make good judgement calls, especially when the whole architecture of a system is involved. When I'm prompting LLMs, I try to make it as combative to my ideas as possible, but I still see a lot of sycophancy, basic mistakes and overall slop, even on SOTA models like GPT 5.6 Sol. Obviously I cannot predict the future, but with the current technology, it is hard to see how a frontier model will be able to obsolete a domain expert like you paired with a small local model for doing grunt work/investigations. So keep up the good work! |
Overview
Extracted 2 metal fixes from #27879 as requested by @ggerganov
Requirements