Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add cuda fallback bf16 for compute_cap < 8.0 #2704

Draft
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

haricot
Copy link

@haricot haricot commented Jan 7, 2025

tested and works with:

nvidia-smi   --query-gpu="compute_cap"  --format=csv
compute_cap
6.1
cargo run -F "cuda,cudnn" --example llama  --release -- --model-id meta-llama/Llama-3.2-1B-Instruct --temperature 0.1 --which v32-1b-instruct --seed 42 --dtype bf16 --prompt

related EricLBuehler#57

@LaurentMazare
Copy link
Collaborator

Shouldn't the new code be in some else blocks for the #if __CUDA_ARCH__ >= 800 blocks that contain the proper bf16 implementation?

@haricot
Copy link
Author

haricot commented Jan 7, 2025

You are certainly right because I do not encounter the condition CUDA_ARCH >= 800 in this control flow in my case but this must possibly cause a function cuda error already present, I will review this.

@LaurentMazare
Copy link
Collaborator

I think the current code is likely to result in lots of compile failures with cuda compute cap >= 8.0.
Would it work to just replace the checks for compute cap 800 with 530? If you can make the changes on an old cuda toolkit, I can also test them on hardware that is past 800.

@haricot

This comment was marked as outdated.

@haricot
Copy link
Author

haricot commented Jan 16, 2025

I hope that the latest additions will allow to work on __CUDA_ARCH__ >=800.
Then I think it logical to propose more tests by considering if possible a full support of the BF16 type for __CUDA_ARCH__ >=530 .

@haricot haricot marked this pull request as draft January 18, 2025 09:31
@haricot haricot force-pushed the bf16_candle branch 3 times, most recently from c3b86ee to 4316a45 Compare January 21, 2025 21:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants