Conversation
giordano
commented
Jan 13, 2024
| # * <https://developer.nvidia.com/blog/nvidia-hopper-architecture-in-depth/> (figures 5-8) | ||
| if Symbol(dtype) == :Float16 | ||
| # matrix dimensions 8x8x4, factor 2 for nflops in A*B+C | ||
| # see e.g. https://peerj.com/articles/cs-330.pdf |
Author
There was a problem hiding this comment.
Note: I replaced this link with the DOI because the link is now broken.
266b15a to
d567774
Compare
Author
|
Trying to measure peakflops, I get These results are quite far from the theoretical peaks, about 50% less, is there anything to tweak in the kernels for a new architecture? |
giordano
commented
Jan 15, 2024
Author
giordano
left a comment
There was a problem hiding this comment.
Interestingly enough, all theoretical tensorcores peakflops for Float32, Float16, and Int8 are wrong by about 8%
julia> 535.3 / 494.7
1.0820699413786132
julia> 1070.5 / 989.4
1.0819688700222356
julia> (4282.1 / 2) / 1978.9
1.0819394613168933but I have no clue of where this factor comes from.
| elseif Symbol(dtype) == :Float64 | ||
| max_peakflops *= 2 * 4 * 4 * 2 | ||
| elseif Symbol(dtype) == :Int8 | ||
| max_peakflops *= 2 * 2 * 32 * 8 * 4 # XXX: Wrong result! |
Author
There was a problem hiding this comment.
Maybe there's an extra factor of 2 in this formula, but I based this on the Int8 calculation below
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This is an initial attempt to support Nvidia Hopper GPUs, opening as draft because lots of thing still don't work. For example, theoretical peakflops for tensor cores is wrong, it looks like the formula used for A100 doesn't apply to Hopper. I tried to adapt based on figures 10-11 of https://resources.nvidia.com/en-us-tensor-core/gtc22-whitepaper-hopper but with GH200 I get:
Values for
Float64(with and without tensorcores) andFloat32(without tensorcores) are good, but all other tensorcores peakflops are wrong according to column "H100 SXM5" table 2 of the document above, it should be 494.7 TFLOP/s forFloat32, 989.4 forFloat16, and 1978.9 forInt8(also https://resources.nvidia.com/en-us-grace-cpu/grace-hopper-superchip which is specific to GH200 agrees with those numbers, but it has fewer significant digits, they rounded to integers).