huggingface / huggingface/gpu-fryer

FP8 capability rejects Ada GPUs and Ctrl+C/SIGTERM waits for full duration

Open
#28 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
407
Forks
26
Avg merge
1m
Merged PRs (30d)
1

Description

## Summary

`gpu-fryer` v1.2.0 has two runtime issues:

1. FP8 capability detection incorrectly rejects GPUs with compute capability `8.9`, such as Ada/Lovelace GPUs ( RTX 40 Series ).
2. Interrupting a run with Ctrl+C or SIGTERM can still wait until the original `duration_secs` timer completes before the process exits.

## Affected Version

`v1.2.0` (`c5bf3ba`)

## Issue 1: FP8 architecture detection is too strict

File: `src/main.rs`

Problematic code in `v1.2.0`:

```rust
fn supports_fp8(gpu: &Arc) -> anyhow::Result {
Ok(
gpu.attribute(sys::CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR)?
>= 9
&& gpu.attribute(
sys::CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR,
)? >= 0,
)
}
```

Problems:

- FP8 is available on compute capability `8.9+`, but this code requires `major >= 9`.
- The second attribute read is also `COMPUTE_CAPABILITY_MAJOR`; it should read `COMPUTE_CAPABILITY_MINOR`.
- As a result, Ada/Lovelace GPUs with compute capability `8.9` are incorrectly rejected when `--use-fp8` is passed.

Expected logic:

```rust
fn supports_fp8(gpu: &Arc) -> anyhow::Result {
let major = gpu.attribute(sys::CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR)?;
let minor = gpu.attribute(sys::CUdevice_attribute_enum::CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MINOR)?;
Ok((major, minor) >= (8, 9))
}
```

## Issue 2: Ctrl+C/SIGTERM does not stop the duration wait promptly

File: `src/main.rs`

Problematic code in `v1.2.0`:

```rust
let wait = tokio::spawn(async move {
let mut interval = tokio::time::interval(std::time::Duration::from_secs(1));
let mut tick = 0;
while !stop_cloned.load(std::sync::atomic::Ordering::Relaxed) && tick < config.duration_secs
{
interval.tick().await;
tick += 1;
}
stop_cloned.store(true, std::sync::atomic::Ordering::Relaxed);
});
handles.push(wait);

let _ = futures::future::join_all(handles).await;
```

Signal handler:

```rust
async fn shutdown_signal(stop: Arc) {
// waits for Ctrl+C or SIGTERM...
stop.store(true, std::sync::atomic::Ordering::Relaxed);
}
```

Problem:

- Ctrl+C/SIGTERM sets `stop = true`, but the duration task only checks `stop` after `interval.tick().await`.
- `join_all(handles).await` waits for all spawned tasks, including the duration task.
- This can delay shutdown instead of exiting promptly after interruption.

Expected behavior:

- Ctrl+C/SIGTERM should wake the duration wait immediately.
- The duration wait should race the deadline against a stop notification/check.
- Interrupted runs should not wait for the original requested duration.

Example fix direction:

```rust
async fn wait_for_duration_or_stop(
duration_secs: u64,
stop: Arc,
) {
let deadline = tokio::time::Instant::now()
+ std::time::Duration::from_secs(duration_secs);

let mut interval = tokio::time::interval(std::time::Duration::from_millis(100));

loop {
if stop.load(std::sync::atomic::Ordering::Relaxed) {
return;
}

tokio::select! {
_ = tokio::time::sleep_until(deadline) => {
stop.store(true, std::sync::atomic::Ordering::Relaxed);
return;
}
_ = interval.tick() => {}
}
}
}
```

## Expected Result

- `--use-fp8` should work on compute capability `8.9+`.
- Ctrl+C/SIGTERM should stop the run promptly without waiting for the original duration timer.

## Actual Result

- FP8 is rejected on valid `8.9` GPUs.
- Interrupted runs can remain alive until the duration wait task finishes.

I have fixed these issues in my local version, but I have not submitted a pull request because I haven’t reviewed the AI generated code.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in src/main.rs at supports_fp8, the duration task, and shutdown_signal. Verify the compute-capability checks accept 8.9 and that interruption wakes the duration wait instead of waiting for the deadline. Done means --use-fp8 works for 8.9+ GPUs and Ctrl+C or SIGTERM exits promptly.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.