Skip to documentation
SLOP

tiny.gpu.KernelArtifact

Reference tiny.gpu KernelArtifact

Defined in contract.

API (20)

Actions

Public operations.

Fields and members

Public fields and members.

No direct callersNo direct callscontractKernelArtifact
Static calls · unresolved targets: unknown · external targets: unknown.

Source

Source: lib/gpu/src/contract.zig:1337

zig
pub const KernelArtifact = struct {    allocator: Allocator,    backend: BackendKind,    format: ArtifactFormat,    entry_name: []const u8,    argument_count: u32,    scalar_argument_count: u32 = 0,    diagnostic_id: ?[]const u8 = null,    /// Requirements and push-constant layout the compiler recorded for this    /// entry. Load checks the requirements; launch packs through the layout.    interface: choir_abi.Interface = .{},    payload: ArtifactPayload = .none,    payload_ownership: PayloadOwnership = .borrowed,    pub fn init(allocator: Allocator, desc: KernelArtifactDesc) Allocator.Error!KernelArtifact {        const entry_name = try dupeString(allocator, desc.entry_name);        errdefer freeString(allocator, entry_name);        return .{            .allocator = allocator,            .backend = desc.backend,            .format = desc.format,            .entry_name = entry_name,            .argument_count = desc.argument_count,            .scalar_argument_count = desc.scalar_argument_count,            .diagnostic_id = try dupeOpt(allocator, desc.diagnostic_id),            .interface = desc.interface,        };    }    pub fn bufferArgumentCount(self: *const KernelArtifact) BackendError!u32 {        if (self.scalar_argument_count > self.argument_count) return error.InvalidArtifact;        return self.argument_count - self.scalar_argument_count;    }    pub fn deinit(self: *KernelArtifact) void {        self.clearPayload();        freeString(self.allocator, self.entry_name);        freeOpt(self.allocator, self.diagnostic_id);        self.* = undefined;    }    pub fn setBorrowedBytes(self: *KernelArtifact, bytes: []const u8) void {        self.clearPayload();        self.payload = .{ .bytes = bytes };        self.payload_ownership = .borrowed;    }    pub fn setOwnedBytes(self: *KernelArtifact, bytes: []const u8) BackendError!void {        const owned = self.allocator.dupe(u8, bytes) catch return error.OutOfMemory;        self.clearPayload();        self.payload = .{ .bytes = owned };        self.payload_ownership = .owned;    }    pub fn setBorrowedWords(self: *KernelArtifact, words: []const u32) void {        self.clearPayload();        self.payload = .{ .words_u32 = words };        self.payload_ownership = .borrowed;    }    pub fn setOwnedWords(self: *KernelArtifact, words: []const u32) BackendError!void {        const owned = self.allocator.dupe(u32, words) catch return error.OutOfMemory;        self.clearPayload();        self.payload = .{ .words_u32 = owned };        self.payload_ownership = .owned;    }    pub fn setBorrowedText(self: *KernelArtifact, text: []const u8) void {        self.clearPayload();        self.payload = .{ .text = text };        self.payload_ownership = .borrowed;    }    pub fn setOwnedText(self: *KernelArtifact, text: []const u8) BackendError!void {        const owned = self.allocator.dupe(u8, text) catch return error.OutOfMemory;        self.clearPayload();        self.payload = .{ .text = owned };        self.payload_ownership = .owned;    }    pub fn setExternalPayload(self: *KernelArtifact, payload: ExternalPayload, ownership: PayloadOwnership) BackendError!void {        if (ownership == .owned and payload.deinit_fn == null) return error.MissingPayloadDeinit;        self.clearPayload();        self.payload = .{ .external = payload };        self.payload_ownership = ownership;    }    fn clearPayload(self: *KernelArtifact) void {        if (self.payload_ownership == .owned) {            switch (self.payload) {                .bytes => |bytes| freeString(self.allocator, bytes),                .words_u32 => |words| self.allocator.free(@constCast(words)),                .text => |text| freeString(self.allocator, text),                .external => |payload| if (payload.deinit_fn) |deinit_fn| deinit_fn(self.allocator, payload.ptr),                .none => {},            }        }        self.payload = .none;        self.payload_ownership = .borrowed;    }};

Source: lib/gpu/src/root.zig:104

zig
pub const KernelArtifact = contract.KernelArtifact;
Called byCallsNo direct callstest sourcelib.gpu.src.contracttest: bufferArgumentCount subtracts s...KernelArtifactbufferArgumentCount
Static calls · unresolved targets: 0 · external targets: 0.
Called byCallstest sourcelib.gpu.src.contracttest: backend handle rejects cross-ba...test sourcelib.gpu.src.contracttest: bufferArgumentCount subtracts s...test sourcelib.gpu.src.contracttest: kernel artifacts represent cuda...test sourcelib.gpu.src.contracttest: launch request makes buffer own...test sourcelib.gpu.src.contracttest: launch validates geometry befor...+3 moreprivate sourcelib.gpu.src.contract.KernelArtifactclearPayloadprivate sourcelib.gpu.src.contractfreeOptprivate sourcelib.gpu.src.contractfreeStringKernelArtifactdeinit
Static calls · unresolved targets: 0 · external targets: 0.
Called byCallstest sourcelib.gpu.src.contracttest: backend handle rejects cross-ba...test sourcelib.gpu.src.contracttest: bufferArgumentCount subtracts s...test sourcelib.gpu.src.contracttest: kernel artifacts represent cuda...test sourcelib.gpu.src.contracttest: launch request makes buffer own...test sourcelib.gpu.src.contracttest: launch validates geometry befor...+3 moreprivate sourcelib.gpu.src.contractdupeOptprivate sourcelib.gpu.src.contractdupeStringprivate sourcelib.gpu.src.contractfreeStringKernelArtifactinit
Static calls · unresolved targets: 0 · external targets: 0.
Called byCallsNo direct callersprivate sourcelib.gpu.src.contract.KernelArtifactclearPayloadKernelArtifactsetBorrowedBytes
Static calls · unresolved targets: 0 · external targets: 0.
Called byCallstest sourcelib.gpu.src.contracttest: backend handle rejects cross-ba...test sourcelib.gpu.src.contracttest: launch request makes buffer own...test sourcelib.gpu.src.contracttest: launch validates geometry befor...test sourcelib.gpu.src.contracttest: runtime capabilities gate strea...private sourcelib.gpu.src.contract.KernelArtifactclearPayloadKernelArtifactsetBorrowedText
Static calls · unresolved targets: 0 · external targets: 0.
Called byCallstest sourcelib.gpu.src.contracttest: backend handle rejects cross-ba...test sourcelib.gpu.src.contracttest: kernel artifacts represent cuda...private sourcelib.gpu.src.contract.KernelArtifactclearPayloadKernelArtifactsetBorrowedWords
Static calls · unresolved targets: 0 · external targets: 0.
Called byCallstest sourcelib.gpu.src.contracttest: owned external payload requires...private sourcelib.gpu.src.contract.KernelArtifactclearPayloadKernelArtifactsetExternalPayload
Static calls · unresolved targets: 0 · external targets: 0.
Called byCallstest sourcelib.gpu.src.contracttest: kernel artifacts represent cuda...private sourcelib.gpu.src.contract.KernelArtifactclearPayloadKernelArtifactsetOwnedBytes
Static calls · unresolved targets: 1 · external targets: 0.
Called byCallstest sourcelib.gpu.src.contracttest: kernel artifacts represent cuda...private sourcelib.gpu.src.contract.KernelArtifactclearPayloadKernelArtifactsetOwnedText
Static calls · unresolved targets: 1 · external targets: 0.
Called byCallsNo direct callersprivate sourcelib.gpu.src.contract.KernelArtifactclearPayloadKernelArtifactsetOwnedWords
Static calls · unresolved targets: 1 · external targets: 0.

Complete caller list for KernelArtifact.deinit

8 direct callers.

Complete caller list for KernelArtifact.init

8 direct callers.

Audit

Definitions11
Public names22
Members10
Version26.7.0
Revisiondaab053ee433