# CUDA error: unsupported exec affinity (cudaErrorUnsupportedExecAffinity)

- **ID:** `cuda/cuda-error-unsupported-exec-affinity`
- **Domain:** cuda
- **Category:** runtime_error
- **Error Code:** `cudaErrorUnsupportedExecAffinity (802)`
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

The application requested a kernel execution affinity (e.g., via cudaLaunchAttributeCooperative or cudaFuncAttributeMaxDynamicSharedMemorySize) that is not supported by the current GPU architecture or driver version.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| CUDA 12.3 | active | — | — |
| CUDA 12.5 | active | — | — |
| NVIDIA Driver 545.23.06 | active | — | — |
| NVIDIA Driver 550.54.10 | active | — | — |
| PyTorch 2.4.0 | active | — | — |

## Workarounds

1. **Check GPU compute capability and remove unsupported launch attributes. For example, cooperative launch requires sm >= 70: `deviceProp.major * 10 + deviceProp.minor >= 70`.** (85% success)
   ```
   Check GPU compute capability and remove unsupported launch attributes. For example, cooperative launch requires sm >= 70: `deviceProp.major * 10 + deviceProp.minor >= 70`.
   ```
2. **Upgrade to a driver that supports the required execution affinity (e.g., driver 550.54.10 or newer for CUDA 12.5 features).** (80% success)
   ```
   Upgrade to a driver that supports the required execution affinity (e.g., driver 550.54.10 or newer for CUDA 12.5 features).
   ```
3. **Fall back to a non-cooperative launch by setting `cudaLaunchAttributeCooperative` to 0: `cudaLaunchConfig config; config.attrs[cudaLaunchAttributeCooperative] = 0;`** (90% success)
   ```
   Fall back to a non-cooperative launch by setting `cudaLaunchAttributeCooperative` to 0: `cudaLaunchConfig config; config.attrs[cudaLaunchAttributeCooperative] = 0;`
   ```

## Dead Ends

- **** — The error is about execution affinity attributes, not shared memory limits; increasing shared memory may cause other issues but does not resolve the affinity problem. (85% fail)
- **** — Synchronous execution does not affect launch attributes; the affinity check happens before the kernel is queued, regardless of blocking mode. (90% fail)
