Skip to content

Commit

Permalink
Fix 20x slowdown of FP6 kernel due to device properties query (#1092)
Browse files Browse the repository at this point in the history
Replace `cudaGetDeviceProperties` with `cudaDeviceGetAttribute`
  • Loading branch information
tobiasvanderwerff authored and drisspg committed Oct 17, 2024
1 parent 900f9ac commit ba27ff8
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 ba27ff8

Please sign in to comment.