summaryrefslogtreecommitdiff
path: root/candle-core/src
diff options
context:
space:
mode:
authorLaurent Mazare <laurent.mazare@gmail.com>2024-07-09 12:38:11 +0200
committerGitHub <noreply@github.com>2024-07-09 12:38:11 +0200
commit25960676caefcb10060fb36a8d66efa9fa731dec (patch)
tree6f2f10be8bb7389cb2dda3e9e5c0cd7bff35c64f /candle-core/src
parent9cd54aa5d4fb6cf30e0df2d198c8a387db2d9144 (diff)
downloadcandle-25960676caefcb10060fb36a8d66efa9fa731dec.tar.gz
candle-25960676caefcb10060fb36a8d66efa9fa731dec.tar.bz2
candle-25960676caefcb10060fb36a8d66efa9fa731dec.zip
Add a basic metal example with capture (#2324)
* Add some tracing. * Get the trace to work.
Diffstat (limited to 'candle-core/src')
-rw-r--r--candle-core/src/metal_backend/device.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/candle-core/src/metal_backend/device.rs b/candle-core/src/metal_backend/device.rs
index 785fe621..07210c68 100644
--- a/candle-core/src/metal_backend/device.rs
+++ b/candle-core/src/metal_backend/device.rs
@@ -273,7 +273,13 @@ impl MetalDevice {
let descriptor = metal::CaptureDescriptor::new();
descriptor.set_destination(metal::MTLCaptureDestination::GpuTraceDocument);
descriptor.set_capture_device(self);
- descriptor.set_output_url(path);
+ // The [set_output_url] call requires an absolute path so we convert it if needed.
+ if path.as_ref().is_absolute() {
+ descriptor.set_output_url(path);
+ } else {
+ let path = std::env::current_dir()?.join(path);
+ descriptor.set_output_url(path);
+ }
capture
.start_capture(&descriptor)