-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support Nvidia Hopper GPUs #27
Draft
giordano
wants to merge
1
commit into
pc2:main
Choose a base branch
from
giordano:mg/hopper
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,7 +51,7 @@ function _theoretical_peakflops_gpu_cudacores(; device, dtype) | |
elseif dtype == Float64 | ||
max_peakflops *= 1 | ||
else | ||
throw(ArgumentError("Unsupported dtype.")) | ||
throw(ArgumentError("Unsupported dtype $(dtype).")) | ||
end | ||
return max_peakflops | ||
end | ||
|
@@ -60,7 +60,9 @@ function _theoretical_peakflops_gpu_tensorcores(; | |
device=CUDA.device(), dtype=Float16, verbose=true | ||
) | ||
cap = CUDA.capability(device) | ||
if cap == v"8.0.0" | ||
if cap == v"9.0.0" | ||
devtype = :Hopper | ||
elseif cap == v"8.0.0" | ||
devtype = :A100 | ||
elseif cap == v"7.0.0" | ||
devtype = :V100 | ||
|
@@ -70,10 +72,26 @@ function _theoretical_peakflops_gpu_tensorcores(; | |
max_clock_rate = CUDA.attribute(device, CUDA.CU_DEVICE_ATTRIBUTE_CLOCK_RATE) # in kHz | ||
num_tensor_cores = ntensorcores(device) | ||
max_peakflops = max_clock_rate * num_tensor_cores * 1e-9 # in TFLOP/s | ||
if devtype == :A100 | ||
if devtype == :Hopper | ||
# matrix dimensions 8x8x4, factor 2 for nflops in A*B+C see | ||
# * <https://resources.nvidia.com/en-us-tensor-core/gtc22-whitepaper-hopper> (figures 10-11) | ||
# * <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 | ||
max_peakflops *= 2 * 16 * 8 * 4 # XXX: Wrong result! | ||
elseif Symbol(dtype) in (:Float32, :TensorFloat32, :TF32) | ||
max_peakflops *= 2 * 8 * 8 * 4 # XXX: Wrong result! | ||
elseif Symbol(dtype) == :Float64 | ||
max_peakflops *= 2 * 4 * 4 * 2 | ||
elseif Symbol(dtype) == :Int8 | ||
max_peakflops *= 2 * 2 * 32 * 8 * 4 # XXX: Wrong result! | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe there's an extra factor of 2 in this formula, but I based this on the |
||
else | ||
throw(ArgumentError("Unsupported dtype $(dtype).")) | ||
end | ||
elseif devtype == :A100 | ||
if Symbol(dtype) == :Float16 | ||
# matrix dimensions 8x8x4, factor 2 for nflops in A*B+C see | ||
# e.g. <https://doi.org/10.7717/peerj-cs.330> or | ||
# <https://www.nvidia.com/content/dam/en-zz/Solutions/Data-Center/nvidia-ampere-architecture-whitepaper.pdf> | ||
max_peakflops *= 2 * 8 * 8 * 4 | ||
elseif Symbol(dtype) in (:Float32, :TensorFloat32, :TF32) | ||
max_peakflops *= 2 * 4 * 8 * 4 | ||
|
@@ -82,13 +100,13 @@ function _theoretical_peakflops_gpu_tensorcores(; | |
elseif Symbol(dtype) == :Int8 | ||
max_peakflops *= 2 * 2 * 8 * 8 * 4 | ||
else | ||
throw(ArgumentError("Unsupported dtype.")) | ||
throw(ArgumentError("Unsupported dtype $(dtype).")) | ||
end | ||
elseif devtype == :V100 | ||
if Symbol(dtype) == :Float16 | ||
max_peakflops *= 2 * 4 * 4 * 4 | ||
else | ||
throw(ArgumentError("Unsupported dtype.")) | ||
throw(ArgumentError("Unsupported dtype $(dtype).")) | ||
end | ||
end | ||
return max_peakflops | ||
|
This file contains 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: I replaced this link with the DOI because the link is now broken.