Skip to content
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

Add CUDA compute capability compile guard #636

Merged
merged 2 commits into from
Aug 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions torchao/csrc/cuda/fp6_llm/fp6_linear.cu
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
//
// This file is adapted from https://github.com/usyd-fsalab/fp6_llm/blob/5df6737cca32f604e957e3f63f03ccc2e4d1df0d/fp6_llm/csrc/fp6_linear.cu

#if !defined(__CUDA_ARCH__) || __CUDA_ARCH__ >= 800 // at least Ampere
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For anyone wondering why this instead of defined(__CUDA_ARCH__) && __CUDA_ARCH__ >= 800, I'm following this.

One reason I can think of is for vscode intellisense to work. If I use #if defined(__CUDA_ARCH__), vscode will not do syntax highlighting. There are workarounds, like this, but it is more cumbersome.


#include "kernel_matmul.cuh"
#include "kernel_reduction.cuh"

Expand Down Expand Up @@ -200,3 +202,5 @@ TORCH_LIBRARY_IMPL(torchao, CUDA, m) {
}

} // namespace torchao

#endif
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#if !defined(__CUDA_ARCH__) || __CUDA_ARCH__ >= 800 // at least Ampere

#include <ATen/ATen.h>
#include <ATen/core/Tensor.h>
#include <ATen/cuda/CUDAContext.h>
Expand Down Expand Up @@ -310,3 +312,5 @@ TORCH_LIBRARY_IMPL(torchao, CUDA, m) {
m.impl("torchao::dequantize_tensor_core_tiled_layout", &_dequantize_tensor_core_tiled_layout);

}

#endif
Loading