mirror of
https://github.com/huggingface/candle.git
synced 2025-06-16 10:38:54 +00:00
fix: place ug
dep behind not wasm32
flag (#2760)
* place `ug` behind not wasm32 attr so that wasm32 can compile * mv `ug` to conditional target dep assuming every non-wasm32 user wants this
This commit is contained in:
@ -14,7 +14,7 @@ accelerate-src = { workspace = true, optional = true }
|
|||||||
byteorder = { workspace = true }
|
byteorder = { workspace = true }
|
||||||
candle-kernels = { workspace = true, optional = true }
|
candle-kernels = { workspace = true, optional = true }
|
||||||
candle-metal-kernels = { workspace = true, optional = true }
|
candle-metal-kernels = { workspace = true, optional = true }
|
||||||
metal = { workspace = true, optional = true}
|
metal = { workspace = true, optional = true }
|
||||||
cudarc = { workspace = true, optional = true }
|
cudarc = { workspace = true, optional = true }
|
||||||
gemm = { workspace = true }
|
gemm = { workspace = true }
|
||||||
half = { workspace = true }
|
half = { workspace = true }
|
||||||
@ -28,18 +28,19 @@ rand_distr = { workspace = true }
|
|||||||
rayon = { workspace = true }
|
rayon = { workspace = true }
|
||||||
safetensors = { workspace = true }
|
safetensors = { workspace = true }
|
||||||
thiserror = { workspace = true }
|
thiserror = { workspace = true }
|
||||||
ug = { workspace = true }
|
|
||||||
ug-cuda = { workspace = true, optional = true }
|
ug-cuda = { workspace = true, optional = true }
|
||||||
ug-metal = { workspace = true, optional = true }
|
ug-metal = { workspace = true, optional = true }
|
||||||
yoke = { workspace = true }
|
yoke = { workspace = true }
|
||||||
zip = { workspace = true }
|
zip = { workspace = true }
|
||||||
|
|
||||||
|
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
||||||
|
ug = { workspace = true }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
anyhow = { workspace = true }
|
anyhow = { workspace = true }
|
||||||
clap = { workspace = true }
|
clap = { workspace = true }
|
||||||
criterion = { workspace = true }
|
criterion = { workspace = true }
|
||||||
|
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = []
|
default = []
|
||||||
cuda = ["cudarc", "dep:candle-kernels", "dep:ug-cuda"]
|
cuda = ["cudarc", "dep:candle-kernels", "dep:ug-cuda"]
|
||||||
|
@ -51,6 +51,7 @@ impl CudaDevice {
|
|||||||
self.device.clone()
|
self.device.clone()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(not(target_arch = "wasm32"))]
|
||||||
pub fn compile(
|
pub fn compile(
|
||||||
&self,
|
&self,
|
||||||
func_name: &'static str,
|
func_name: &'static str,
|
||||||
|
@ -386,6 +386,7 @@ pub struct UgIOp1 {
|
|||||||
|
|
||||||
impl UgIOp1 {
|
impl UgIOp1 {
|
||||||
#[allow(unused)]
|
#[allow(unused)]
|
||||||
|
#[cfg(not(target_arch = "wasm32"))]
|
||||||
pub fn new(
|
pub fn new(
|
||||||
name: &'static str,
|
name: &'static str,
|
||||||
kernel: ug::lang::ssa::Kernel,
|
kernel: ug::lang::ssa::Kernel,
|
||||||
|
@ -172,6 +172,7 @@ pub enum Error {
|
|||||||
#[error("Metal error {0}")]
|
#[error("Metal error {0}")]
|
||||||
Metal(#[from] MetalError),
|
Metal(#[from] MetalError),
|
||||||
|
|
||||||
|
#[cfg(not(target_arch = "wasm32"))]
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
Ug(#[from] ug::Error),
|
Ug(#[from] ug::Error),
|
||||||
|
|
||||||
|
@ -138,6 +138,7 @@ impl std::ops::Deref for MetalDevice {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl MetalDevice {
|
impl MetalDevice {
|
||||||
|
#[cfg(not(target_arch = "wasm32"))]
|
||||||
pub fn compile(
|
pub fn compile(
|
||||||
&self,
|
&self,
|
||||||
func_name: &'static str,
|
func_name: &'static str,
|
||||||
|
Reference in New Issue
Block a user