pub const TT_HOST_TEMPLATE: &str = r#"// Auto-generated by LOGOS codegen_tt — do not edit.
// Host orchestrator for a single-Tensix-core LOGOS program.
#include <tt-metalium/host_api.hpp>
#include <tt-metalium/device.hpp>
#include <tt-metalium/mesh_device.hpp>
using namespace tt;
using namespace tt::tt_metal;
int main() {
// 1x1 unit mesh on device 0; DPRINT (TT_METAL_DPRINT_CORES) streams `Show` output.
auto mesh = distributed::MeshDevice::create_unit_mesh(0);
distributed::MeshCommandQueue& cq = mesh->mesh_command_queue();
Program program = CreateProgram();
constexpr CoreCoord core = {0, 0};
// The whole LOGOS program runs on ONE baby RISC-V core (data-movement 0).
KernelHandle compute = CreateKernel(
program,
"{KERNEL_FILE}",
core,
DataMovementConfig{.processor = DataMovementProcessor::RISCV_0,
.noc = NOC::RISCV_0_default});
SetRuntimeArgs(program, compute, core, {});
distributed::MeshWorkload workload;
workload.add_program(distributed::MeshCoordinateRange(mesh->shape()), std::move(program));
distributed::EnqueueMeshWorkload(cq, workload, /*blocking=*/true);
Finish(cq);
mesh->close();
return 0;
}
"#;Expand description
The host orchestrator. Opens a 1x1 unit mesh on device 0, creates a program
with a single data-movement kernel on RISCV_0, launches it, waits, and
closes. Targets the current TT-Metalium MeshDevice API (as in the
add_2_integers_in_riscv example). {KERNEL_FILE} is the kernel source path.