Skip to content
Closed
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
13 changes: 2 additions & 11 deletions zig/src/server/cli.zig
Original file line number Diff line number Diff line change
Expand Up @@ -571,17 +571,8 @@ pub fn request(a: Allocator, dir: []const u8, model_type: []const u8, args: Args
});
}

/// What ``capabilities --json`` reports about the engine side: its version, chip, backends and families.
pub const Engines = struct {
version: []const u8,
chip: ?[]const u8 = null,
optional_libraries: []const @import("sys").optional_libraries.Status = &.{},
backends: []const []const u8 = &.{},
/// model_type to the weight formats it reads, as gate entries name them.
families: []const api.Family = &.{},
};

/// The native capabilities document: the table's native flags and the honoured variables.
/// ``capabilities --json`` (cli_capabilities.zig): the engine side, then the table's native flags and variables.
pub const Engines = @import("cli_capabilities.zig").Engines;
pub const capabilities = @import("cli_capabilities.zig").capabilities;

const cli = @This();
Expand Down
16 changes: 14 additions & 2 deletions zig/src/server/cli_capabilities.zig
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
//! The native capabilities document: the table's native flags and the honoured variables.
//! ``capabilities --json``: the engine's version, chip, backends and families, then the native flags and variables.
const std = @import("std");
const api = @import("engine_api");
const cli = @import("cli.zig");

pub fn capabilities(w: *std.Io.Writer, e: cli.Engines) !void {
/// What ``capabilities --json`` reports about the engine side: its version, chip, backends and families.
pub const Engines = struct {
version: []const u8,
chip: ?[]const u8 = null,
optional_libraries: []const @import("sys").optional_libraries.Status = &.{},
backends: []const []const u8 = &.{},
/// model_type to the weight formats it reads, as gate entries name them.
families: []const api.Family = &.{},
};

/// The native capabilities document: the table's native flags and the honoured variables.
pub fn capabilities(w: *std.Io.Writer, e: Engines) !void {
try w.print("{{\"schema\": 1, \"engine\": \"zig\", \"version\": \"{s}\", \"chip\": ", .{e.version});
if (e.chip) |c| try w.print("\"{s}\"", .{c}) else try w.writeAll("null");
try w.writeAll(", \"backends\": [");
Expand Down
Loading