|
1 | 1 | use crate::{DType, Result}; |
| 2 | + |
| 3 | +#[cfg(feature = "ug")] |
| 4 | +use candle_metal_kernels::metal::ComputePipeline; |
2 | 5 | use candle_metal_kernels::{ |
3 | 6 | metal::{ |
4 | | - BlitCommandEncoder, Buffer, BufferMap, Commands, ComputeCommandEncoder, ComputePipeline, |
5 | | - Device, MTLResourceOptions, |
| 7 | + BlitCommandEncoder, Buffer, BufferMap, Commands, ComputeCommandEncoder, Device, |
| 8 | + MTLResourceOptions, |
6 | 9 | }, |
7 | 10 | Kernels, |
8 | 11 | }; |
9 | 12 | use objc2_foundation::NSURL; |
10 | 13 | use objc2_metal::{MTLCaptureDescriptor, MTLCaptureDestination, MTLCaptureManager}; |
| 14 | + |
11 | 15 | use std::path::Path; |
12 | 16 | use std::sync::{Arc, Mutex, RwLock}; |
13 | 17 |
|
@@ -88,14 +92,14 @@ impl std::ops::Deref for MetalDevice { |
88 | 92 | } |
89 | 93 |
|
90 | 94 | impl MetalDevice { |
91 | | - #[cfg(all(not(target_arch = "wasm32"), not(target_os = "ios")))] |
| 95 | + #[cfg(all(feature = "ug", not(target_arch = "wasm32"), not(target_os = "ios")))] |
92 | 96 | pub fn compile( |
93 | 97 | &self, |
94 | 98 | func_name: &'static str, |
95 | | - kernel: ug::lang::ssa::Kernel, |
| 99 | + kernel: candle_ug::lang::ssa::Kernel, |
96 | 100 | ) -> Result<ComputePipeline> { |
97 | 101 | let mut buf = vec![]; |
98 | | - ug_metal::code_gen::gen(&mut buf, func_name, &kernel)?; |
| 102 | + candle_ug::metal::code_gen::gen(&mut buf, func_name, &kernel)?; |
99 | 103 | let metal_code = String::from_utf8(buf)?; |
100 | 104 | let lib = self |
101 | 105 | .device |
|
0 commit comments