GELU Fusion with cuBLASLt (SLOWER because it only merges in FP16 mode, not BF16/FP32...) #338
+20
−21
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.
It turns out that not only is cuBLASLt not able to fuse BF16 GELU (or RELU) into a BF16 matmul, it also ends up with a strange kernel that is slower than our own GELU kernel as it does 2 writes per element (?!) rather than the expected 1.
This happens for FP32 and BF16 in GELU, RELU, GELU_AUX, and RELU_AUX modes as far as I can tell. In theory cuBLASLt also supports GELU backwards, but I assume it will have similar problems so I didn't try it.
Obviously this shouldn't be merged, only posting this here for future reference...