Skip to content

Commit

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

Replace `cudaGetDeviceProperties` with `cudaDeviceGetAttribute`
  • Loading branch information
tobiasvanderwerff authored and atalman committed Oct 21, 2024
1 parent 01cbc09 commit 38d8881
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 38d8881

Please sign in to comment.