Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions src/vt/tenstorrent/tenstorrent_backend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@
// CommitDevice) so the matmul/norm/silu chain can skip host
// download+reupload between ops. UnifiedMemory() remains false — the real
// hardware property.
// * `SupportsGraphCapture()` stays FALSE. tt_metal trace capture
// (begin_trace_capture/end_trace_capture/replay_trace) is the eventual
// mapping the spec already names; not implemented here.
// * `SupportsGraphCapture()` is TRUE: maps onto ttnn mesh-trace capture
// (begin_trace_capture / end_trace_capture / execute_trace) via free
// functions in tenstorrent_ops.cpp. Capture still requires fixed device
// buffers and a warmed program cache — same class of contract as CUDA
// graphs (see BeginCapture notes on the CUDA backend).
// * `UnifiedMemory()` is `false`: this is the real hardware property (a
// discrete card over PCIe), independent of this W0's host-staging
// implementation detail above. It also means op_provider.h's portable CPU
Expand Down Expand Up @@ -63,6 +65,15 @@ class TenstorrentBackend final : public Backend {
// optional device shadow (ops TU) is the residency model; the CPU reference
// tier stays gated off.
bool UnifiedMemory() const override { return false; }

// ttnn mesh-trace capture — see Trace* in tenstorrent_device.h / ops.cpp.
bool SupportsGraphCapture() const override { return true; }
void BeginCapture(Queue&) override { TraceBeginCapture(); }
void EndCapture(Queue&) override { TraceEndCapture(); }
void Replay(Queue&) override { TraceReplay(); }
void* EndCaptureGraph(Queue&) override { return TraceEndCaptureGraph(); }
void ReplayGraph(Queue&, void* graph) override { TraceReplayGraph(graph); }
void DestroyGraph(void* graph) override { TraceDestroyGraph(graph); }
};

struct Registrar {
Expand Down
16 changes: 16 additions & 0 deletions src/vt/tenstorrent/tenstorrent_device.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,20 @@ void MarkHostWritten(void* host);
// device-resident results without every op writing host eagerly.
void EnsureHostBytes(void* host);

// ---- ttnn mesh-trace capture (Backend graph-capture mapping) --------------
// Maps vt::Backend::{BeginCapture,EndCapture,Replay} onto
// ttnn::operations::trace::{begin,end,execute}_trace_capture. Implemented in
// tenstorrent_ops.cpp so the backend TU stays free of ttnn headers.
//
// Contract (same class as CUDA graphs): every op between Begin and End must
// stay async on the mesh CQ with fixed device buffers; host Ensure/Download
// and fresh program compiles during capture are illegal and will throw.
// Warm the program cache with an identical shape before BeginCapture.
void TraceBeginCapture();
void TraceEndCapture(); // stores the default single-slot replay id
void TraceReplay(); // replay the single-slot id
void* TraceEndCaptureGraph(); // returns an opaque MeshTraceId* (caller owns)
void TraceReplayGraph(void* graph);
void TraceDestroyGraph(void* graph);

} // namespace vt::tenstorrent
Loading
Loading