DeepInfer/csrc/graph_timer/graph_timer_neuron.cpp
whn09 ed49792a0c Add AWS Trainium (Neuron) platform, basic mode — part 1
Run DeepInfer on the native torch-neuronx device (PrivateUse1 `neuron`,
torch-neuronx 2.14, no torch-xla), following the Ascend port's structure.

- deep_cluster: Neuron discovery (one DeepInfer device = one logical
  NeuronCore, NEURON_RT_VISIBLE_CORES, NUMA from neuron-ls).
- PlatformNeuron: takes the Ascend (is_npu) kernel layouts, adds is_neuron;
  DEEPINFER_NEURON_DEVICE=cpu runs the same code on the host for
  correctness work.
- neuron_ops/transfer_to_neuron: map "cuda" devices, torch.device and
  torch.cuda.* onto neuron:0 (counterpart of torch_npu transfer_to_npu).
- C++ extension: -DWITH_NEURON host-only build; torch-allocated buffers and
  tensor-view slot copies instead of raw device-pointer copies.
- Pure-torch drop-in vendor packages (Ascend API semantics): deep_gemm,
  flash_mla, deep_select, tile_kernels, tilelang (constants only).
- tilelang_ops/neuron backend: KV cache / metadata / norm / compress kernels;
  CP, ZOS and VL entry points raise NotImplementedError.
- Basic mode defaults on Neuron: eager, no DSpark/MTP drafting, no
  zero-overhead scheduling; MoE avoids the GPU-only mega kernel; mHC
  prenorm GEMM uses the Ascend single-split reduction.

Not yet included: deep_ep, the sampling kernels, end-to-end harness.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 18:34:51 +08:00

46 lines
1.8 KiB
C++

#include "graph_timer.hpp"
#include <stdexcept>
namespace deepinfer::graph_timer {
EventHandle::EventHandle() { throw std::runtime_error("Neuron graph timer primitives are not implemented"); }
void EventHandle::record(int64_t stream, bool capture_external) const {
throw std::runtime_error("Neuron graph timer primitives are not implemented");
}
void EventHandle::synchronize() const { throw std::runtime_error("Neuron graph timer primitives are not implemented"); }
bool EventHandle::query() const { throw std::runtime_error("Neuron graph timer primitives are not implemented"); }
float EventHandle::elapsed_time(const EventHandle &end_event) const {
throw std::runtime_error("Neuron graph timer primitives are not implemented");
}
bool EventHandle::operator==(const EventHandle &other) const {
throw std::runtime_error("Neuron graph timer primitives are not implemented");
}
std::size_t EventHandle::hash() const { throw std::runtime_error("Neuron graph timer primitives are not implemented"); }
EventHandle EventRecordNodeHandle::get_event() const { throw std::runtime_error("Neuron graph timer primitives are not implemented"); }
void EventRecordNodeHandle::set_event(const EventHandle &event) {
throw std::runtime_error("Neuron graph timer primitives are not implemented");
}
GraphHandle::GraphHandle(py::object graph) : graph_(std::move(graph)) {}
std::vector<EventRecordNodeHandle> GraphHandle::get_event_record_nodes() const {
throw std::runtime_error("Neuron graph timer primitives are not implemented");
}
bool GraphHandle::operator==(const GraphHandle &other) const {
throw std::runtime_error("Neuron graph timer primitives are not implemented");
}
std::size_t GraphHandle::hash() const { throw std::runtime_error("Neuron graph timer primitives are not implemented"); }
} // namespace deepinfer::graph_timer