Skip to content

Commit

Permalink
Fixed the rest of the build issues
Browse files Browse the repository at this point in the history
  • Loading branch information
cromefire committed Dec 10, 2023
1 parent b993d5d commit 1bc6f48
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 7 deletions.
6 changes: 4 additions & 2 deletions crates/llama-cpp-bindings/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ fn main() {
println!("cargo:rustc-link-lib=cublasLt");
}
if cfg!(feature = "rocm") {
let amd_gpu_targets: Vec<&str> = vec![
let amd_gpu_default_targets: Vec<&str> = vec![
"gfx803",
"gfx900",
"gfx906:xnack-",
Expand All @@ -51,6 +51,8 @@ fn main() {
"gfx1102",
"gfx1103",
];
let amd_gpu_targets =
env::var("AMDGPU_TARGETS").unwrap_or(amd_gpu_default_targets.join(";"));

let rocm_root = env::var("ROCM_ROOT").unwrap_or("/opt/rocm".to_string());
config.define("LLAMA_HIPBLAS", "ON");
Expand All @@ -59,7 +61,7 @@ fn main() {
"CMAKE_CXX_COMPILER",
format!("{}/llvm/bin/clang++", rocm_root),
);
config.define("AMDGPU_TARGETS", amd_gpu_targets.join(";"));
config.define("AMDGPU_TARGETS", amd_gpu_targets);
println!("cargo:rustc-link-arg=-Wl,--copy-dt-needed-entries");
println!("cargo:rustc-link-search=native={}/hip/lib", rocm_root);
println!("cargo:rustc-link-search=native={}/rocblas/lib", rocm_root);
Expand Down
2 changes: 1 addition & 1 deletion crates/llama-cpp-bindings/src/llama.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ impl LlamaServiceImpl {
};

for ffi::StepOutput { request_id, text } in result {
let mut stopped = false;
let mut stopped;
let LlamaRunningRequest { tx, stop_condition } =
self.requests.get_mut(&request_id).unwrap();

Expand Down
4 changes: 2 additions & 2 deletions crates/tabby/src/services/health.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pub struct HealthState {
cpu_info: String,
cpu_count: usize,
accelerators: Vec<Accelerator>,
#[deprecated(note = "Use the more generic gpu_devices instead")]
#[deprecated(note = "Please use the more generic accelerators instead")]
cuda_devices: Vec<String>,
version: Version,
}
Expand Down Expand Up @@ -103,7 +103,7 @@ pub fn read_rocm_devices() -> Result<Vec<Accelerator>> {
Regex::new(r"(?m)^ Device Type: +([a-zA-Z0-9-]+) *$").unwrap();
}

let cmd_res = Command::new("rocminfon").output()?;
let cmd_res = Command::new("rocminfo").output()?;
let output = from_utf8(cmd_res.stdout.as_slice())?;
let agent_outputs = output.split("Agent ").skip(1);
let mut rocm_devices = vec![];
Expand Down
2 changes: 1 addition & 1 deletion ee/tabby-webserver/src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use tabby_common::api::{
};
use tokio_tungstenite::connect_async;

use crate::{
pub use crate::{
schema::worker::{RegisterWorkerError, Worker, WorkerKind},
websocket::WebSocketTransport,
};
Expand Down
12 changes: 11 additions & 1 deletion ee/tabby-webserver/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use schema::{
};
use service::create_service_locator;
use tabby_common::api::{
accelerator::Accelerator,
accelerator::{Accelerator, DeviceType},
code::{CodeSearch, SearchResponse},
event::RawEventLogger,
};
Expand Down Expand Up @@ -159,6 +159,15 @@ impl Hub for Arc<HubImpl> {
let addr = format!("http://{}:{}", self.conn.ip(), port);
*worker_addr = addr.clone();

let mut cuda_devices = vec![];

for accelerator in &accelerators {
if accelerator.device_type == DeviceType::Cuda {
cuda_devices.push(accelerator.display_name.clone())
}
}

#[allow(deprecated)]
let worker = Worker {
name,
kind,
Expand All @@ -168,6 +177,7 @@ impl Hub for Arc<HubImpl> {
cpu_info,
cpu_count,
accelerators,
cuda_devices,
};
self.ctx.worker().register_worker(worker).await
}
Expand Down
2 changes: 2 additions & 0 deletions ee/tabby-webserver/src/schema/worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ pub struct Worker {
pub cpu_info: String,
pub cpu_count: i32,
pub accelerators: Vec<Accelerator>,
#[deprecated(note = "Please use the more generic accelerators instead")]
pub cuda_devices: Vec<String>,
}

#[derive(Serialize, Deserialize, Error, Debug)]
Expand Down
2 changes: 2 additions & 0 deletions ee/tabby-webserver/src/service/worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ mod tests {
}

fn make_worker(addr: &str) -> Worker {
#[allow(deprecated)]
Worker {
name: "Fake worker".to_owned(),
kind: WorkerKind::Chat,
Expand All @@ -91,6 +92,7 @@ mod tests {
cpu_info: "Fake CPU".to_owned(),
cpu_count: 32,
accelerators: vec![],
cuda_devices: vec![],
}
}
}

0 comments on commit 1bc6f48

Please sign in to comment.