Skip to content

Commit

Permalink
Fix 20x slowdown of FP6 kernel due to device properties query (#1128)
Browse files Browse the repository at this point in the history
Fix 20x slowdown of FP6 kernel due to device properties query (#1092)

Replace `cudaGetDeviceProperties` with `cudaDeviceGetAttribute`

Co-authored-by: Tobias van der Werff <[email protected]>
  • Loading branch information
atalman and tobiasvanderwerff authored Oct 21, 2024
1 parent 01cbc09 commit 99c8d52
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions torchao/csrc/cuda/fp6_llm/fp6_linear.cu
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,16 @@
inline bool isSM75GPU() {
int device;
cudaError_t err = cudaGetDevice(&device);
if (err != cudaSuccess) {
return false;
}
if (err != cudaSuccess) return false;

cudaDeviceProp props;
err = cudaGetDeviceProperties(&props, device);
if (err != cudaSuccess) {
return false;
}
int major, minor;
err = cudaDeviceGetAttribute(&major, cudaDevAttrComputeCapabilityMajor, device);
if (err != cudaSuccess) return false;

err = cudaDeviceGetAttribute(&minor, cudaDevAttrComputeCapabilityMinor, device);
if (err != cudaSuccess) return false;

return (props.major == 7) && (props.minor == 5);
return (major == 7) && (minor == 5);
}

template<typename TilingConfig, typename OutputDataType, int EXPONENT, int MANTISSA>
Expand Down

0 comments on commit 99c8d52

Please sign in to comment.