Remove compute capability lazy cell (#2580)

Remove compute capability lock

We are only calling the `get_cuda_capability` function once, so avoiding
the cost of multiple calls is not really necessary yet.
This commit is contained in:
Daniël de Kok 2024-09-30 08:48:47 +02:00 committed by GitHub
parent 1028996fb3
commit afc7ded84f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 7 deletions

View File

@ -1,9 +1,4 @@
use std::sync::LazyLock; pub fn get_cuda_capability() -> Option<(usize, usize)> {
pub static COMPUTE_CAPABILITY: LazyLock<Option<(usize, usize)>> =
LazyLock::new(get_cuda_capability);
fn get_cuda_capability() -> Option<(usize, usize)> {
use pyo3::prelude::*; use pyo3::prelude::*;
let py_get_capability = |py: Python| -> PyResult<(isize, isize)> { let py_get_capability = |py: Python| -> PyResult<(isize, isize)> {

View File

@ -66,7 +66,7 @@ fn get_config(
} }
fn resolve_attention(config: &Option<Config>, lora_adapters: &Option<String>) -> (String, String) { fn resolve_attention(config: &Option<Config>, lora_adapters: &Option<String>) -> (String, String) {
let compute_capability = *gpu::COMPUTE_CAPABILITY; let compute_capability = gpu::get_cuda_capability();
let mut prefix_caching: Option<String> = std::env::var("USE_PREFIX_CACHING").ok(); let mut prefix_caching: Option<String> = std::env::var("USE_PREFIX_CACHING").ok();
let mut attention: Option<String> = std::env::var("ATTENTION").ok(); let mut attention: Option<String> = std::env::var("ATTENTION").ok();
if let Some(config) = config { if let Some(config) = config {