Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Edit
After looking at the solution in #3060 I now understand where is my mistake. There is a missing barrier after computing
mean
.Ignore everything below
The
norm
kernel used by Falcon was broken in #2959After fixing it, there still remains a very strange behaviour with it, that I have explained in the comments in the kernel. Basically, when the 2 loops for computing the mean and the variance are combined into one, the inference breaks for threadgroup size of 256 for that kernel. If I tune down the threadgroup size to 128 or 32 threads, it works again.
I spent about an hour looking into this and I have no idea what is going on.
The only possible hint is maybe we are somehow exceeding some threadgroup memory limit and Metal fails silently?
Seems unlikely, but I have no other guess. If someone else can also look into this would be great and please let me know if you can confirm these observations:
First run the following command and note down the first few ppl numbers:
Now apply this patch and repeat:
The numbers are not the same and are different each run.
Try to change the thraedgroup size to 32 and observe that the numbers are back to normal (within numerical variation of course):