From b3727d9bd1abc193bed55d31754737980b9087e1 Mon Sep 17 00:00:00 2001 From: Ali Cheraghi Date: Sun, 13 Sep 2026 16:39:59 +0330 Subject: [PATCH 1/5] spirv: rewrite linker Previously, the SPIR-V linker would merge every function's MIR into one module, then parsed it in `BinaryModule`, and run three passes over it: - `prune_unused` walked the module from its entry points to drop dead declarations - `dedup_types` deduplicated types and constants - `lower_invocation_globals` rewrote function signatures to pass a pointer to global variables as function parameter Now codegen emits instructions in the order it resolves them (not the spec specified order) into one section per function. then the linker sorts them into the correct order while also interning types, constants, strings, etc in the flush step. Navs the frontend no longer references are now skipped using `Zcu.resolveReferences` instead of a pass like `prune_unused`. Extern variables are also only loaded when an MIR references them. `lower_invocation_globals` is gone too. non-`threadlocal` globals on SPIR-V targets are disallowed now. Currently only vulkan supports them via the newly added `private` address space. See #36715 The new linker also supports incremental compilation now! --- lib/std/Target.zig | 1 + lib/std/lang.zig | 1 + src/Sema.zig | 66 +- src/codegen/spirv/Assembler.zig | 226 +- src/codegen/spirv/CodeGen.zig | 1809 +++++++---------- src/codegen/spirv/Mir.zig | 54 +- src/codegen/spirv/Section.zig | 416 ++-- src/link.zig | 4 +- src/link/SpirV.zig | 1216 ----------- src/link/SpirV/BinaryModule.zig | 347 ---- src/link/SpirV/dedup_types.zig | 244 --- src/link/SpirV/lower_invocation_globals.zig | 803 -------- src/link/SpirV/prune_unused.zig | 257 --- src/link/Spirv.zig | 252 +++ src/link/Spirv/Flush.zig | 664 ++++++ src/target.zig | 2 + .../SpirvType_vulkan_target.zig | 6 +- .../extern_spirv_decoration_validation.zig | 25 +- .../spirv_global_var_must_be_threadlocal.zig | 12 + .../spirv_vulkan_threadlocal_addrspace.zig | 11 + 20 files changed, 2120 insertions(+), 4296 deletions(-) delete mode 100644 src/link/SpirV.zig delete mode 100644 src/link/SpirV/BinaryModule.zig delete mode 100644 src/link/SpirV/dedup_types.zig delete mode 100644 src/link/SpirV/lower_invocation_globals.zig delete mode 100644 src/link/SpirV/prune_unused.zig create mode 100644 src/link/Spirv.zig create mode 100644 src/link/Spirv/Flush.zig create mode 100644 test/cases/compile_errors/spirv_global_var_must_be_threadlocal.zig create mode 100644 test/cases/compile_errors/spirv_vulkan_threadlocal_addrspace.zig diff --git a/lib/std/Target.zig b/lib/std/Target.zig index f4c7e29f5f63d13464e48be7c66130d4d058a574..76d8122a561ad747d8c7c05badd529388d22ec77 100644 --- a/lib/std/Target.zig +++ b/lib/std/Target.zig @@ -2392,6 +2392,7 @@ pub fn supportsAddressSpace( .lut => arch == .propeller and std.Target.propeller.featureSetHas(target.cpu.features, .p2), .global, .local, .shared => is_gpu, + .private => is_spirv, .constant => (is_gpu and (context == null or context == .constant)) or (is_spirv and (context == null or context == .constant or context == .pointer)), .param => is_nvptx, diff --git a/lib/std/lang.zig b/lib/std/lang.zig index b96acc3c5efa47b6092f7cc82c8592200ad4e662..d0fd96a912a1b8dde4a6be70aea5983d225f1204 100644 --- a/lib/std/lang.zig +++ b/lib/std/lang.zig @@ -591,6 +591,7 @@ pub const AddressSpace = enum(u5) { param, shared, local, + private, input, output, uniform, diff --git a/src/Sema.zig b/src/Sema.zig index a3533e99233d4e8f8e0d61184d65733906d1ad86..3485075948e23534b447c15588bad8b32a9ca116 100644 --- a/src/Sema.zig +++ b/src/Sema.zig @@ -20914,13 +20914,8 @@ fn zirReifySpirvType( const depth = try sema.interpretStdLangType(block, operand_src, depth_val, std.lang.Type.Spirv.Image.Depth); const access = try sema.interpretStdLangType(block, operand_src, access_val, std.lang.Type.Spirv.Image.Access); - switch (target.os.tag) { - .opencl => if (access == .unknown) { - return sema.fail(block, operand_src, "'access' field must be specified under the 'opencl' os", .{}); - }, - else => if (access != .unknown) { - return sema.fail(block, operand_src, "access qualifier '.{t}' is only valid under the 'opencl' os", .{access}); - }, + if (target.os.tag == .opencl and access == .unknown) { + return sema.fail(block, operand_src, "'access' field must be specified under the 'opencl' OS", .{}); } const arrayed = try sema.interpretStdLangType(block, operand_src, arrayed_val, bool); @@ -20930,31 +20925,24 @@ fn zirReifySpirvType( const usage_tag = try sema.interpretStdLangType(block, operand_src, usage_tag_val, @typeInfo(std.lang.Type.Spirv.Image.Usage).@"union".tag_type.?); switch (target.os.tag) { - .vulkan => { - if (usage_tag == .unknown) { - return sema.fail( - block, - operand_src, - "'usage' must be '.sampled' or '.storage' under the 'vulkan' os (Sampled == 0 is forbidden)", - .{}, - ); - } + .vulkan => if (usage_tag == .unknown) { + return sema.fail(block, operand_src, "'usage' must be '.sampled' or '.storage' under the 'vulkan' OS", .{}); }, .opencl => { if (usage_tag != .unknown) { - return sema.fail(block, operand_src, "'usage' must be '.unknown' under the 'opencl' os", .{}); + return sema.fail(block, operand_src, "'usage' must be '.unknown' under the 'opencl' OS", .{}); } if (multisampled) { - return sema.fail(block, operand_src, "'multisampled' must be 'false' under the 'opencl' os", .{}); + return sema.fail(block, operand_src, "'multisampled' must be 'false' under the 'opencl' OS", .{}); } if (format != .unknown) { - return sema.fail(block, operand_src, "'format' must be '.unknown' under the 'opencl' os", .{}); + return sema.fail(block, operand_src, "'format' must be '.unknown' under the 'opencl' OS", .{}); } if (dim == .cube) { - return sema.fail(block, operand_src, "'dim' '.cube' is not allowed under the 'opencl' os", .{}); + return sema.fail(block, operand_src, "'dim' '.cube' is not allowed under the 'opencl' OS", .{}); } if (arrayed and dim != .@"1d" and dim != .@"2d") { - return sema.fail(block, operand_src, "'arrayed' may only be 'true' when 'dim' is '.1d' or '.2d' under the 'opencl' os", .{}); + return sema.fail(block, operand_src, "'arrayed' may only be 'true' when 'dim' is '.1d' or '.2d' under the 'opencl' OS", .{}); } }, else => {}, @@ -20965,10 +20953,10 @@ fn zirReifySpirvType( const sampled_type = usage_val.unionPayload(zcu).toType(); if (target.os.tag != .opencl and sampled_type.toIntern() == .void_type) { - return sema.fail(block, operand_src, "'void' type for '{t}' field is only valid under the 'opencl' os", .{usage_tag}); + return sema.fail(block, operand_src, "'void' type for '{t}' field is only valid under the 'opencl' OS", .{usage_tag}); } if (target.os.tag == .opencl and sampled_type.toIntern() != .void_type) { - return sema.fail(block, operand_src, "'{t}' field type must be 'void' under the 'opencl' os", .{usage_tag}); + return sema.fail(block, operand_src, "'{t}' field type must be 'void' under the 'opencl' OS", .{usage_tag}); } if (sampled_type.toIntern() != .void_type and @@ -20984,7 +20972,7 @@ fn zirReifySpirvType( return sema.fail( block, operand_src, - "'{t}' field value must be a 32-bit int, 64-bit int or 32-bit float under the 'vulkan' os", + "'{t}' field value must be a 32-bit int, 64-bit int or 32-bit float under the 'vulkan' OS", .{usage_tag}, ); } @@ -21005,7 +20993,7 @@ fn zirReifySpirvType( return sema.fail( block, operand_src, - "image 'format' '.{t}' does not match '{t}' type '{f}' under the 'vulkan' os", + "image 'format' '.{t}' does not match '{t}' type '{f}' under the 'vulkan' OS", .{ format, usage_tag, sampled_type.fmt(pt) }, ); } @@ -21058,7 +21046,7 @@ fn zirReifySpirvType( elem_ty.zigTypeTag(zcu) == .spirv and ip.loadSpirvType(elem_ty.toIntern()).flags.tag == .runtime_array) { - return sema.fail(block, operand_src, "'runtime_array' of 'runtime_array' is not allowed under the 'vulkan' os", .{}); + return sema.fail(block, operand_src, "'runtime_array' of 'runtime_array' is not allowed under the 'vulkan' OS", .{}); } break :blk .{ .ty = union_val.val, @@ -25315,11 +25303,14 @@ fn zirBuiltinExtern( } if (options.decoration) |decoration| switch (decoration) { - .flat => switch (ptr_info.flags.address_space) { + .location, .flat => switch (ptr_info.flags.address_space) { .input, .output => {}, - else => return sema.fail(block, options_src, "\"flat\" decoration requires \"input\" or \"output\" address space", .{}), + else => return sema.fail(block, options_src, "'{t}' decoration requires 'input' or 'output' address space", .{decoration}), + }, + .descriptor => switch (ptr_info.flags.address_space) { + .global, .storage_buffer, .uniform, .constant => {}, + else => return sema.fail(block, options_src, "'descriptor' decoration requires 'storage_buffer', 'uniform', 'constant' or 'global' address space", .{}), }, - .location, .descriptor => {}, }; const target = zcu.getTarget(); @@ -34913,6 +34904,7 @@ pub fn resolveNavPtrModifiers( const gpa = comp.gpa; const io = comp.io; const ip = &zcu.intern_pool; + const target = zcu.getTarget(); const align_src = block.src(.{ .node_offset_var_decl_align = .zero }); const section_src = block.src(.{ .node_offset_var_decl_section = .zero }); @@ -34944,7 +34936,6 @@ pub fn resolveNavPtrModifiers( else => .constant, }, }; - const target = zcu.getTarget(); const addrspace_body = zir_decl.addrspace_body orelse { if (zir_decl.linkage == .@"extern" and target.cpu.arch.isSpirV() and @@ -34968,6 +34959,21 @@ pub fn resolveNavPtrModifiers( break :as try sema.analyzeAsAddressSpace(block, addrspace_src, addrspace_ref, addrspace_ctx); }; + if (target.cpu.arch.isSpirV()) { + if (zir_decl.kind == .@"var" and zir_decl.linkage != .@"extern" and !zir_decl.is_threadlocal) { + return sema.failWithOwnedErrorMsg(block, msg: { + const decl_src = block.nodeOffset(.zero); + const msg = try sema.errMsg(decl_src, "SPIR-V target does not support global variables", .{}); + errdefer msg.destroy(gpa); + try sema.errNote(decl_src, msg, "consider using 'threadlocal'", .{}); + break :msg msg; + }); + } + if (zir_decl.is_threadlocal and @"addrspace" != .private and target.os.tag == .vulkan) { + return sema.fail(block, addrspace_src, "threadlocal variables with address space '{t}' are not supported on {t}", .{ @"addrspace", target.os.tag }); + } + } + return .{ .@"align" = @"align", .@"linksection" = @"linksection", diff --git a/src/codegen/spirv/Assembler.zig b/src/codegen/spirv/Assembler.zig index 6a96b5e3a00445176a67e085a0ca27cbd2f88dd3..ec9f608e38675d47a258bb16dada49c6262c70d5 100644 --- a/src/codegen/spirv/Assembler.zig +++ b/src/codegen/spirv/Assembler.zig @@ -1,16 +1,11 @@ const std = @import("std"); -const Allocator = std.mem.Allocator; const assert = std.debug.assert; - const CodeGen = @import("CodeGen.zig"); -const Decl = @import("CodeGen.zig").Decl; - const spec = @import("spec.zig"); const Opcode = spec.Opcode; const Word = spec.Word; const Id = spec.Id; const StorageClass = spec.StorageClass; - const Assembler = @This(); cg: *CodeGen, @@ -20,7 +15,10 @@ src: []const u8 = undefined, tokens: std.ArrayList(Token) = .empty, current_token: u32 = 0, /// The instruction that is currently being parsed or has just been parsed. -inst: struct { +inst: Instruction = .{}, +value_map: std.array_hash_map.String(AsmValue) = .empty, + +const Instruction = struct { opcode: Opcode = undefined, operands: std.ArrayList(Operand) = .empty, string_bytes: std.ArrayList(u8) = .empty, @@ -35,9 +33,7 @@ inst: struct { } return null; } -} = .{}, -value_map: std.array_hash_map.String(AsmValue) = .empty, -inst_map: std.array_hash_map.String(void) = .empty, +}; const Operand = union(enum) { /// Any 'simple' 32-bit value. This could be a mask or @@ -68,27 +64,14 @@ pub fn deinit(ass: *Assembler) void { ass.inst.operands.deinit(gpa); ass.inst.string_bytes.deinit(gpa); ass.value_map.deinit(gpa); - ass.inst_map.deinit(gpa); } const Error = error{ AssembleFail, OutOfMemory }; pub fn assemble(ass: *Assembler, src: []const u8) Error!void { - const gpa = ass.cg.gpa; - ass.src = src; ass.errors.clearRetainingCapacity(); - // Populate the opcode map if it isn't already - if (ass.inst_map.count() == 0) { - const instructions = spec.InstructionSet.core.instructions(); - try ass.inst_map.ensureUnusedCapacity(gpa, @intCast(instructions.len)); - for (instructions, 0..) |inst, i| { - const entry = try ass.inst_map.getOrPut(gpa, inst.name); - assert(entry.index == i); - } - } - try ass.tokenize(); while (!ass.testToken(.eof)) { try ass.parseInstruction(); @@ -144,18 +127,20 @@ const AsmValue = union(enum) { /// zero-extended from the float's width to 64 bits. constant: u64, /// A vector "c" input expanded by `processSpecConstVector`. - constant_composite: struct { + constant_composite: ConstantComposite, + string: []const u8, + + const ConstantComposite = struct { child: Id, child_kind: std.lang.TypeId, child_bit_width: u16, values: []u64, - }, - string: []const u8, + }; /// Retrieve the result-id of this AsmValue. Asserts that this AsmValue /// is of a variant that allows the result to be obtained (not an unresolved /// forward declaration, not in the process of being declared, etc). - pub fn resultId(value: AsmValue) Id { + fn resultId(value: AsmValue) Id { return switch (value) { .just_declared, .unresolved_forward_reference, @@ -221,7 +206,7 @@ fn processTypeInstruction(ass: *Assembler) !AsmValue { const cg = ass.cg; const gpa = cg.gpa; const operands = ass.inst.operands.items; - const section = &cg.sections.globals; + const section = &cg.module; const id = switch (ass.inst.opcode) { .OpTypeVoid => try cg.voidType(), .OpTypeBool => try cg.boolType(), @@ -339,26 +324,16 @@ fn processTypeInstruction(ass: *Assembler) !AsmValue { /// - Target section is determined from instruction type. fn processGenericInstruction(ass: *Assembler) !?AsmValue { const cg = ass.cg; - const target = cg.zcu.getTarget(); const operands = ass.inst.operands.items; - var maybe_spv_decl_index: ?Decl.Index = null; const section = switch (ass.inst.opcode.class()) { - .constant_creation => &cg.sections.globals, - .annotation => &cg.sections.annotations, + .constant_creation => &cg.module, + .annotation => &cg.module, .type_declaration => unreachable, // Handled elsewhere. else => switch (ass.inst.opcode) { - .OpEntryPoint => unreachable, - .OpExecutionMode, .OpExecutionModeId => &cg.sections.execution_modes, .OpVariable => section: { const storage_class: spec.StorageClass = @fromBackingInt(@intCast(operands[2].value)); if (storage_class == .function) break :section &ass.cg.prologue; - maybe_spv_decl_index = try cg.allocDecl(.global); - if (!target.cpu.has(.spirv, .v1_4) and storage_class != .input and storage_class != .output) { - // Before version 1.4, the interface’s storage classes are limited to the Input and Output - break :section &cg.sections.globals; - } - try ass.cg.decl_deps.append(cg.gpa, maybe_spv_decl_index.?); - break :section &cg.sections.globals; + break :section &cg.module; }, else => &ass.cg.body, }, @@ -388,10 +363,7 @@ fn processGenericInstruction(ass: *Assembler) !?AsmValue { .value, .literal32 => |word| section.writeWord(word), .literal64 => |dword| section.writeDoubleWord(dword), .result_id => { - maybe_result_id = if (maybe_spv_decl_index) |spv_decl_index| - cg.declPtr(spv_decl_index).result_id - else - cg.allocId(); + maybe_result_id = cg.allocId(); section.writeOperand(Id, maybe_result_id.?); }, .ref_id => |index| { @@ -406,7 +378,8 @@ fn processGenericInstruction(ass: *Assembler) !?AsmValue { } const actual_word_count = section.instructions.items.len - first_word; - section.instructions.items[first_word] |= @as(u32, @as(u16, @intCast(actual_word_count))) << 16 | @backingInt(ass.inst.opcode); + const header: spec.InstructionHeader = .{ .opcode = ass.inst.opcode, .word_count = @intCast(actual_word_count) }; + section.instructions.items[first_word] = @bitCast(header); switch (ass.inst.opcode) { .OpKill, @@ -454,8 +427,8 @@ fn processSpecConstVector(ass: *Assembler) !?AsmValue { else => return ass.fail(ass.inst.inst_offset, "%ty must be a type", .{}), }; - const globals = &cg.sections.globals; - const annotations = &cg.sections.annotations; + const globals = &cg.module; + const annotations = &cg.module; const literal_words: usize = if (cc.child_bit_width <= @bitSizeOf(Word)) 1 else 2; const elem_ids = try gpa.alloc(Id, cc.values.len); @@ -465,11 +438,10 @@ fn processSpecConstVector(ass: *Assembler) !?AsmValue { elem_id_out.* = elem_id; switch (cc.child_kind) { - .bool => { - const opcode: Opcode = if (value & 1 != 0) .OpSpecConstantTrue else .OpSpecConstantFalse; - try globals.emitRaw(gpa, opcode, 2); - globals.writeOperand(Id, cc.child); - globals.writeOperand(Id, elem_id); + .bool => if (value & 1 != 0) { + try globals.emit(gpa, .OpSpecConstantTrue, .{ .id_result_type = cc.child, .id_result = elem_id }); + } else { + try globals.emit(gpa, .OpSpecConstantFalse, .{ .id_result_type = cc.child, .id_result = elem_id }); }, .int, .float => { try globals.emitRaw(gpa, .OpSpecConstant, 2 + literal_words); @@ -487,10 +459,10 @@ fn processSpecConstVector(ass: *Assembler) !?AsmValue { const spec_id_word = std.math.cast(u32, spec_id_base + i) orelse { return ass.fail(ass.inst.inst_offset, "SpecId {} does not fit in 32 bits", .{spec_id_base + i}); }; - try annotations.emitRaw(gpa, .OpDecorate, 3); - annotations.writeOperand(Id, elem_id); - annotations.writeWord(@backingInt(spec.Decoration.spec_id)); - annotations.writeWord(spec_id_word); + try annotations.emit(gpa, .OpDecorate, .{ + .target = elem_id, + .decoration = .{ .spec_id = .{ .specialization_constant_id = spec_id_word } }, + }); } const result_id = cg.allocId(); @@ -557,14 +529,13 @@ fn parseInstruction(ass: *Assembler) !void { } const opcode_text = ass.tokenText(opcode_tok); - const index = ass.inst_map.getIndex(opcode_text) orelse { + const opcode = std.meta.stringToEnum(spec.Opcode, opcode_text) orelse { return ass.fail(opcode_tok.start, "invalid opcode '{s}'", .{opcode_text}); }; - const inst = spec.InstructionSet.core.instructions()[index]; - ass.inst.opcode = @fromBackingInt(@intCast(inst.opcode)); + ass.inst.opcode = opcode; - const expected_operands = inst.operands; + const expected_operands = opcode.operands(); // This is a loop because the result-id is not always the first operand. const requires_lhs_result = for (expected_operands) |op| { if (op.kind == .id_result) break true; @@ -614,8 +585,8 @@ fn parseOperand(ass: *Assembler, kind: spec.OperandKind) Error!void { else => switch (kind) { .literal_integer => try ass.parseLiteralInteger(), .literal_string => try ass.parseString(), - .literal_context_dependent_number => try ass.parseContextDependentNumber(), - .literal_ext_inst_integer => try ass.parseLiteralExtInstInteger(), + .literal_context_dependent_number => try ass.parseNumber(), + .literal_ext_inst_integer => try ass.parseLiteralInteger(), .pair_id_ref_id_ref => try ass.parsePhiSource(), else => return ass.todo("parse operand of type {s}", .{@tagName(kind)}), }, @@ -661,12 +632,12 @@ fn parseBitEnum(ass: *Assembler, kind: spec.OperandKind) !void { if ((mask & enumerant.value) == 0) continue; - for (enumerant.parameters) |param_kind| { + for (enumerant.parameters) |param| { if (ass.isAtInstructionBoundary()) { return ass.fail(ass.currentToken().start, "missing required parameter for bit flag '{s}'", .{enumerant.name}); } - try ass.parseOperand(param_kind); + try ass.parseOperand(param.kind); } } } @@ -721,12 +692,12 @@ fn parseValueEnum(ass: *Assembler, kind: spec.OperandKind) !void { try ass.inst.operands.append(gpa, .{ .value = enumerant.value }); - for (enumerant.parameters) |param_kind| { + for (enumerant.parameters) |param| { if (ass.isAtInstructionBoundary()) { return ass.fail(ass.currentToken().start, "missing required parameter for enum variant '{s}'", .{enumerant.name}); } - try ass.parseOperand(param_kind); + try ass.parseOperand(param.kind); } } @@ -746,30 +717,26 @@ fn parseRefId(ass: *Assembler) !void { try ass.inst.operands.append(gpa, .{ .ref_id = index }); } +fn eatPlaceholderConstant(ass: *Assembler) !?u64 { + const tok = ass.currentToken(); + if (!ass.eatToken(.placeholder)) return null; + const name = ass.tokenText(tok)[1..]; + const value = ass.value_map.get(name) orelse + return ass.fail(tok.start, "invalid placeholder '${s}'", .{name}); + return switch (value) { + .constant => |literal| literal, + else => ass.fail(tok.start, "value '{s}' cannot be used as placeholder", .{name}), + }; +} + fn parseLiteralInteger(ass: *Assembler) !void { const gpa = ass.cg.gpa; const tok = ass.currentToken(); - if (ass.eatToken(.placeholder)) { - const name = ass.tokenText(tok)[1..]; - const value = ass.value_map.get(name) orelse { - return ass.fail(tok.start, "invalid placeholder '${s}'", .{name}); - }; - switch (value) { - .constant => |literal| { - const literal32 = std.math.cast(u32, literal) orelse { - return ass.fail( - tok.start, - "placeholder value {} does not fit in 32 bits", - .{literal}, - ); - }; - try ass.inst.operands.append(gpa, .{ .literal32 = literal32 }); - }, - else => { - return ass.fail(tok.start, "value '{s}' cannot be used as placeholder", .{name}); - }, - } + if (try ass.eatPlaceholderConstant()) |literal| { + const literal32 = std.math.cast(u32, literal) orelse + return ass.fail(tok.start, "placeholder value {} does not fit in 32 bits", .{literal}); + try ass.inst.operands.append(gpa, .{ .literal32 = literal32 }); return; } @@ -786,41 +753,6 @@ fn parseLiteralInteger(ass: *Assembler) !void { try ass.inst.operands.append(gpa, .{ .literal32 = value }); } -fn parseLiteralExtInstInteger(ass: *Assembler) !void { - const gpa = ass.cg.gpa; - - const tok = ass.currentToken(); - if (ass.eatToken(.placeholder)) { - const name = ass.tokenText(tok)[1..]; - const value = ass.value_map.get(name) orelse { - return ass.fail(tok.start, "invalid placeholder '${s}'", .{name}); - }; - switch (value) { - .constant => |literal| { - const literal32 = std.math.cast(u32, literal) orelse { - return ass.fail( - tok.start, - "placeholder value {} does not fit in 32 bits", - .{literal}, - ); - }; - try ass.inst.operands.append(gpa, .{ .literal32 = literal32 }); - }, - else => { - return ass.fail(tok.start, "value '{s}' cannot be used as placeholder", .{name}); - }, - } - return; - } - - try ass.expectToken(.value); - const text = ass.tokenText(tok); - const value = std.fmt.parseInt(u32, text, 0) catch { - return ass.fail(tok.start, "'{s}' is not a valid 32-bit integer literal", .{text}); - }; - try ass.inst.operands.append(gpa, .{ .literal32 = value }); -} - fn parseString(ass: *Assembler) !void { const gpa = ass.cg.gpa; @@ -844,7 +776,7 @@ fn parseString(ass: *Assembler) !void { try ass.inst.operands.append(gpa, .{ .string = string_offset }); } -fn parseContextDependentNumber(ass: *Assembler) !void { +fn parseNumber(ass: *Assembler) !void { const cg = ass.cg; assert(ass.inst.opcode == .OpConstant or ass.inst.opcode == .OpSpecConstant); @@ -852,14 +784,14 @@ fn parseContextDependentNumber(ass: *Assembler) !void { const result = try ass.resolveRef(ass.inst.operands.items[0].ref_id); const result_id = result.resultId(); - const words = cg.sections.globals.instructions.items; + const words = cg.module.instructions.items; var offset: usize = 0; while (offset < words.len) { - const word_count = words[offset] >> 16; - const opcode: Opcode = @fromBackingInt(@intCast(words[offset] & 0xFFFF)); + const header: spec.InstructionHeader = @bitCast(words[offset]); + const word_count = header.word_count; defer offset += word_count; if (word_count == 0) break; - switch (opcode) { + switch (header.opcode) { .OpTypeInt => if (word_count >= 4 and @as(Id, @fromBackingInt(@intCast(words[offset + 1]))) == result_id) { const width: u16 = @intCast(words[offset + 2]); const signedness: std.lang.Signedness = if (words[offset + 3] == 0) .unsigned else .signed; @@ -885,22 +817,11 @@ fn parseContextDependentInt(ass: *Assembler, signedness: std.lang.Signedness, wi const gpa = ass.cg.gpa; const tok = ass.currentToken(); - if (ass.eatToken(.placeholder)) { - const name = ass.tokenText(tok)[1..]; - const value = ass.value_map.get(name) orelse { - return ass.fail(tok.start, "invalid placeholder '${s}'", .{name}); - }; - switch (value) { - .constant => |literal| { - if (width <= @bitSizeOf(spec.Word)) { - try ass.inst.operands.append(gpa, .{ .literal32 = @truncate(literal) }); - } else { - try ass.inst.operands.append(gpa, .{ .literal64 = literal }); - } - }, - else => { - return ass.fail(tok.start, "value '{s}' cannot be used as placeholder", .{name}); - }, + if (try ass.eatPlaceholderConstant()) |literal| { + if (width <= @bitSizeOf(spec.Word)) { + try ass.inst.operands.append(gpa, .{ .literal32 = @truncate(literal) }); + } else { + try ass.inst.operands.append(gpa, .{ .literal64 = literal }); } return; } @@ -943,22 +864,11 @@ fn parseContextDependentFloat(ass: *Assembler, comptime width: u16) !void { const Int = @Int(.unsigned, width); const tok = ass.currentToken(); - if (ass.eatToken(.placeholder)) { - const name = ass.tokenText(tok)[1..]; - const value = ass.value_map.get(name) orelse { - return ass.fail(tok.start, "invalid placeholder '${s}'", .{name}); - }; - switch (value) { - .constant => |literal| { - if (width <= @bitSizeOf(spec.Word)) { - try ass.inst.operands.append(gpa, .{ .literal32 = @truncate(literal) }); - } else { - try ass.inst.operands.append(gpa, .{ .literal64 = literal }); - } - }, - else => { - return ass.fail(tok.start, "value '{s}' cannot be used as placeholder", .{name}); - }, + if (try ass.eatPlaceholderConstant()) |literal| { + if (width <= @bitSizeOf(spec.Word)) { + try ass.inst.operands.append(gpa, .{ .literal32 = @truncate(literal) }); + } else { + try ass.inst.operands.append(gpa, .{ .literal64 = literal }); } return; } diff --git a/src/codegen/spirv/CodeGen.zig b/src/codegen/spirv/CodeGen.zig index 57683c89553d73c83bc93a7145136f0730fd8f13..df127e949b55dcc7401d3dbb7ad53179c7f7d3ef 100644 --- a/src/codegen/spirv/CodeGen.zig +++ b/src/codegen/spirv/CodeGen.zig @@ -10,32 +10,20 @@ base_line: u32, // Module-level output (accumulated across the nav's codegen) next_result_id: Word = 1, -decls: std.ArrayList(Decl) = .empty, -decl_deps: std.ArrayList(Decl.Index) = .empty, -nav_link: std.AutoHashMapUnmanaged(InternPool.Nav.Index, Decl.Index) = .empty, -uav_link: std.AutoHashMapUnmanaged(struct { InternPool.Index, spec.StorageClass }, Decl.Index) = .empty, -entry_points: std.array_hash_map.Auto(Id, EntryPoint) = .empty, -error_buffer: ?Decl.Index = null, +navs: std.array_hash_map.Auto(InternPool.Nav.Index, Id) = .empty, +externs: std.array_hash_map.Auto(InternPool.Nav.Index, Mir.Extern) = .empty, +entry_points: std.ArrayList(Mir.EntryPoint) = .empty, +error_buffer: ?Id = null, struct_types: std.array_hash_map.Custom(StructType, Id, StructType.HashContext, true) = .empty, /// SPIR-V ids of OpVariables whose pointee is a Block struct block_var_ids: std.AutoHashMapUnmanaged(Id, void) = .empty, -builtins: std.AutoHashMapUnmanaged(struct { spec.BuiltIn, spec.StorageClass }, Decl.Index) = .empty, -sections: struct { - // Module layout, according to SPIR-V Spec section 2.4, "Logical Layout of a Module". - extended_instruction_set: Section = .{}, - memory_model: Section = .{}, - execution_modes: Section = .{}, - debug_strings: Section = .{}, - debug_names: Section = .{}, - annotations: Section = .{}, - globals: Section = .{}, - functions: Section = .{}, -} = .{}, +builtins: std.AutoHashMapUnmanaged(struct { spec.BuiltIn, spec.StorageClass }, Id) = .empty, +module: Section = .empty, -// Per-function state (reset between top-level genNav calls) -prologue: Section = .{}, -body: Section = .{}, -args: std.ArrayList(Id) = .empty, +// Per-function state +prologue: Section = .empty, +body: Section = .empty, +args: std.MultiArrayList(struct { id: Id, ty: Id }) = .empty, next_arg_index: u32 = 0, /// Caches the limb extractions for composite integer values so repeated /// arithmetic on the same operand doesn't re-emit `OpCompositeExtract` per @@ -79,28 +67,6 @@ pub const Repr = enum { indirect, }; -/// A function or global, tracked here so the linker can order globals and build -/// per-entry-point interface lists. -pub const Decl = struct { - pub const Index = enum(u32) { _ }; - pub const Kind = enum { func, global, invocation_global }; - - kind: Kind, - /// Result-id of the associated OpFunction / OpVariable / InvocationGlobal. - result_id: Id, - /// Range into `decl_deps` for this decl's dependencies. - begin_dep: usize = 0, - end_dep: usize = 0, - /// Whether an extern-function stub has been emitted. - has_extern_stub: bool = false, -}; - -pub const EntryPoint = struct { - decl_index: Decl.Index, - name: []const u8, - cc: std.builtin.CallingConvention, -}; - const StructType = struct { fields: []const Id, ip_index: InternPool.Index, @@ -193,24 +159,16 @@ pub fn deinit(cg: *CodeGen) void { cg.prologue.deinit(gpa); cg.body.deinit(gpa); - cg.nav_link.deinit(gpa); - cg.uav_link.deinit(gpa); + cg.navs.deinit(gpa); + cg.externs.deinit(gpa); - cg.sections.extended_instruction_set.deinit(gpa); - cg.sections.memory_model.deinit(gpa); - cg.sections.execution_modes.deinit(gpa); - cg.sections.debug_strings.deinit(gpa); - cg.sections.debug_names.deinit(gpa); - cg.sections.annotations.deinit(gpa); - cg.sections.globals.deinit(gpa); - cg.sections.functions.deinit(gpa); + cg.module.deinit(gpa); cg.struct_types.deinit(gpa); cg.block_var_ids.deinit(gpa); cg.builtins.deinit(gpa); - cg.decls.deinit(gpa); - cg.decl_deps.deinit(gpa); + for (cg.entry_points.items) |ep| gpa.free(ep.name); cg.entry_points.deinit(gpa); } @@ -223,7 +181,10 @@ pub fn generate( ) codegen.Error!Mir { const zcu = pt.zcu; const gpa = zcu.gpa; - const nav = zcu.funcInfo(func_index).owner_nav; + const ip = &zcu.intern_pool; + const nav_index = zcu.funcInfo(func_index).owner_nav; + const nav = ip.getNav(nav_index); + const fn_info = zcu.typeToFunc(.fromInterned(nav.resolved.?.type)).?; var arena = std.heap.ArenaAllocator.init(gpa); defer arena.deinit(); @@ -235,22 +196,60 @@ pub fn generate( .zcu = zcu, .air = air.*, .liveness = liveness.*.?, - .owner_nav = nav, - .base_line = zcu.navSrcLine(nav), + .owner_nav = nav_index, + .base_line = zcu.navSrcLine(nav_index), }; defer cg.deinit(); - try cg.genNav(true); + const return_ty_id = try cg.resolveFnReturnType(.fromInterned(fn_info.return_type)); + const is_test = zcu.test_functions.contains(nav_index); + const nav_id = try cg.resolveNav(nav_index); + const function_id = if (is_test) cg.allocId() else nav_id; - return cg.serializeToMir(gpa); + try cg.args.ensureUnusedCapacity(gpa, fn_info.param_types.len); + for (fn_info.param_types.get(ip)) |param_ty_index| { + const param_ty: Type = .fromInterned(param_ty_index); + if (!param_ty.hasRuntimeBits(zcu)) continue; + const param_ty_id = try cg.resolveType(param_ty, .direct); + cg.args.appendAssumeCapacity(.{ .id = cg.allocId(), .ty = param_ty_id }); + } + + const root_block_id = cg.allocId(); + try cg.prologue.emit(gpa, .OpLabel, .{ .id_result = root_block_id }); + cg.block_label = root_block_id; + _ = try cg.genStructuredBody(.selection, cg.air.getMainBody()); + try cg.body.emit(gpa, .OpUnreachable, {}); + try cg.body.emit(gpa, .OpFunctionEnd, {}); + + const fn_ty_id = try cg.functionType(return_ty_id, cg.args.items(.ty)); + try cg.module.emit(gpa, .OpFunction, .{ + .id_result_type = return_ty_id, + .id_result = function_id, + .function_control = .{}, + .function_type = fn_ty_id, + }); + for (cg.args.items(.id), cg.args.items(.ty)) |arg_id, arg_ty_id| { + try cg.module.emit(gpa, .OpFunctionParameter, .{ + .id_result_type = arg_ty_id, + .id_result = arg_id, + }); + } + try cg.module.append(gpa, cg.prologue); + try cg.module.append(gpa, cg.body); + if (is_test) try cg.generateTestEntryPoint(nav.fqn.toSlice(ip), nav_id, function_id); + try cg.debugName(function_id, nav.fqn.toSlice(ip)); + + return cg.toOwnedMir(); } -pub fn generateNav( - pt: Zcu.PerThread, - nav_index: InternPool.Nav.Index, -) codegen.Error!Mir { +pub fn generateNav(pt: Zcu.PerThread, nav_index: InternPool.Nav.Index) codegen.Error!Mir { const zcu = pt.zcu; const gpa = zcu.gpa; + const ip = &zcu.intern_pool; + const target = zcu.getTarget(); + const nav = ip.getNav(nav_index); + const val = zcu.navValue(nav_index); + const ty = val.typeOf(zcu); var arena = std.heap.ArenaAllocator.init(gpa); defer arena.deinit(); @@ -267,116 +266,118 @@ pub fn generateNav( }; defer cg.deinit(); - try cg.genNav(false); + const resolved = nav.resolved.?; + if (nav.getExtern(ip)) |ext| { + if (!ty.hasRuntimeBits(zcu)) { + const child_ty = if (ty.zigTypeTag(zcu) == .pointer) ty.childType(zcu) else ty; + if (child_ty.zigTypeTag(zcu) != .spirv) return cg.toOwnedMir(); + } - return cg.serializeToMir(gpa); + const as = resolved.@"addrspace"; + const storage_class = cg.storageClass(as); + const result_id = try cg.resolveNav(nav_index); + const ty_id = try cg.pointeeType(as, ty, true); + const ptr_ty_id = try cg.ptrType(ty_id, storage_class); + + try cg.module.emit(gpa, .OpVariable, .{ + .id_result_type = ptr_ty_id, + .id_result = result_id, + .storage_class = storage_class, + }); + + switch (target.os.tag) { + .vulkan, .opengl => { + switch (storage_class) { + .uniform, + .push_constant, + .storage_buffer, + .physical_storage_buffer, + => { + if (ty.hasRuntimeBits(zcu)) { + if (!ty.isSpirvRuntimeArray(zcu)) { + try cg.decorate(ptr_ty_id, .{ .array_stride = .{ + .array_stride = @intCast(ty.abiSize(zcu)), + } }); + } + if (!cg.needsLayout(as, ty)) try cg.decorateLayout(ty, ty_id); + } + if (ext.is_const and storage_class == .storage_buffer) { + try cg.decorate(result_id, .non_writable); + } + }, + else => {}, + } + + if (ext.decoration) |decoration| switch (decoration) { + .location => |location| { + try cg.decorate(result_id, .{ + .location = .{ .location = location }, + }); + }, + .flat => |location| { + try cg.decorate(result_id, .{ .location = .{ .location = location } }); + try cg.decorate(result_id, .flat); + }, + .descriptor => |descriptor| { + try cg.decorate(result_id, .{ .binding = .{ + .binding_point = descriptor.binding, + } }); + try cg.decorate(result_id, .{ .descriptor_set = .{ + .descriptor_set = descriptor.set, + } }); + }, + }; + }, + else => {}, + } + + if (std.meta.stringToEnum(spec.BuiltIn, nav.fqn.toSlice(ip))) |built_in| { + try cg.decorate(result_id, .{ .built_in = .{ .built_in = built_in } }); + } + + try cg.debugName(result_id, nav.fqn.toSlice(ip)); + } else if (resolved.@"threadlocal" and ty.hasRuntimeBits(zcu)) { + if (target.os.tag == .opencl) return cg.todo("threadlocal variables on OpenCL", .{}); + + const ty_id = try cg.resolveType(ty, .indirect); + const ptr_ty_id = try cg.ptrType(ty_id, .private); + const init_id = try cg.constant(ty, val, .indirect); + + const result_id = try cg.resolveNav(nav_index); + try cg.module.emit(gpa, .OpVariable, .{ + .id_result_type = ptr_ty_id, + .id_result = result_id, + .storage_class = .private, + .initializer = init_id, + }); + try cg.debugName(result_id, nav.fqn.toSlice(ip)); + } + return cg.toOwnedMir(); } -fn serializeToMir(cg: *CodeGen, gpa: Allocator) codegen.Error!Mir { - const owner_entry = cg.nav_link.get(cg.owner_nav); - const owner_decl_index = owner_entry orelse return .{ - .id_bound = cg.next_result_id, - .owner_nav = cg.owner_nav, - .kind = .func, - .decl_result_id = .none, - .extended_instruction_set = &.{}, - .globals = &.{}, - .functions = &.{}, - .annotations = &.{}, - .debug_names = &.{}, - .debug_strings = &.{}, - .execution_modes = &.{}, - .nav_refs = &.{}, - .uav_refs = &.{}, - .decl_deps = &.{}, - .internal_globals = &.{}, - .entry_points = &.{}, - }; - - const owner_decl = cg.declPtr(owner_decl_index); - - var nav_refs: std.ArrayList(Mir.NavRef) = .empty; - defer nav_refs.deinit(gpa); - var nav_it = cg.nav_link.iterator(); - while (nav_it.next()) |entry| { - if (entry.key_ptr.* == cg.owner_nav) continue; - const decl = cg.declPtr(entry.value_ptr.*); - try nav_refs.append(gpa, .{ - .local_id = decl.result_id, - .nav = entry.key_ptr.*, - .kind = decl.kind, - }); - } +fn toOwnedMir(cg: *CodeGen) Allocator.Error!Mir { + const gpa = cg.gpa; - var uav_refs: std.ArrayList(Mir.UavRef) = .empty; - defer uav_refs.deinit(gpa); - var uav_it = cg.uav_link.iterator(); - while (uav_it.next()) |entry| { - const decl = cg.declPtr(entry.value_ptr.*); - try uav_refs.append(gpa, .{ - .local_id = decl.result_id, - .val = entry.key_ptr.*[0], - .storage_class = entry.key_ptr.*[1], - .kind = decl.kind, - }); + const nav_refs = try gpa.alloc(Mir.NavRef, cg.navs.count()); + errdefer gpa.free(nav_refs); + for (nav_refs, cg.navs.keys(), cg.navs.values()) |*ref, ref_nav, id| { + ref.* = .{ .id = id, .nav = ref_nav }; } - var decl_deps: std.ArrayList(Mir.DeclDep) = .empty; - defer decl_deps.deinit(gpa); - var internal_globals: std.ArrayList(Id) = .empty; - defer internal_globals.deinit(gpa); + const externs = try gpa.dupe(Mir.Extern, cg.externs.values()); + errdefer gpa.free(externs); - const deps = cg.decl_deps.items[owner_decl.begin_dep..owner_decl.end_dep]; - for (deps) |dep_index| { - const dep_decl = cg.declPtr(dep_index); - var found = false; - nav_it.index = 0; - while (nav_it.next()) |entry| { - if (entry.value_ptr.* == dep_index) { - try decl_deps.append(gpa, .{ - .kind = dep_decl.kind, - .nav = entry.key_ptr.*, - }); - found = true; - break; - } - } - if (!found and dep_decl.kind == .global) { - try internal_globals.append(gpa, dep_decl.result_id); - } - } - - var ep_list: std.ArrayList(Mir.EntryPoint) = .empty; - defer ep_list.deinit(gpa); - var ep_it = cg.entry_points.iterator(); - while (ep_it.next()) |entry| { - const ep = entry.value_ptr; - const ep_decl = cg.declPtr(ep.decl_index); - try ep_list.append(gpa, .{ - .local_id = ep_decl.result_id, - .name = try gpa.dupe(u8, ep.name), - .cc = ep.cc, - }); - } - - return .{ + const entry_points = try cg.entry_points.toOwnedSlice(gpa); + const mir: Mir = .{ .id_bound = cg.next_result_id, - .owner_nav = cg.owner_nav, - .kind = owner_decl.kind, - .decl_result_id = owner_decl.result_id, - .extended_instruction_set = try cg.sections.extended_instruction_set.instructions.toOwnedSlice(gpa), - .globals = try cg.sections.globals.instructions.toOwnedSlice(gpa), - .functions = try cg.sections.functions.instructions.toOwnedSlice(gpa), - .annotations = try cg.sections.annotations.instructions.toOwnedSlice(gpa), - .debug_names = try cg.sections.debug_names.instructions.toOwnedSlice(gpa), - .debug_strings = try cg.sections.debug_strings.instructions.toOwnedSlice(gpa), - .execution_modes = try cg.sections.execution_modes.instructions.toOwnedSlice(gpa), - .nav_refs = try nav_refs.toOwnedSlice(gpa), - .uav_refs = try uav_refs.toOwnedSlice(gpa), - .decl_deps = try decl_deps.toOwnedSlice(gpa), - .internal_globals = try internal_globals.toOwnedSlice(gpa), - .entry_points = try ep_list.toOwnedSlice(gpa), + .module = cg.module, + .nav_refs = nav_refs, + .externs = externs, + .entry_points = entry_points, }; + cg.module = .empty; + + return mir; } fn typeOf(cg: *CodeGen, inst: Air.Inst.Ref) Type { @@ -389,22 +390,50 @@ fn typeOfIndex(cg: *CodeGen, inst: Air.Inst.Index) Type { return cg.air.typeOfIndex(inst, &zcu.intern_pool); } -/// Does not generate the nav. -pub fn resolveNav(cg: *CodeGen, ip: *InternPool, nav_index: InternPool.Nav.Index) !Decl.Index { - const entry = try cg.nav_link.getOrPut(cg.gpa, nav_index); - if (!entry.found_existing) { - const nav = ip.getNav(nav_index); - // TODO: Extern fn? - const kind: Decl.Kind = if (ip.isFunctionType(nav.resolved.?.type)) - .func - else switch (nav.resolved.?.@"addrspace") { - .generic => .invocation_global, - else => .global, - }; - entry.value_ptr.* = try cg.allocDecl(kind); +pub fn resolveNav(cg: *CodeGen, nav_index: InternPool.Nav.Index) !Id { + const gop = try cg.navs.getOrPut(cg.gpa, nav_index); + if (!gop.found_existing) gop.value_ptr.* = cg.allocId(); + return gop.value_ptr.*; +} + +fn resolveExternFn(cg: *CodeGen, nav_index: InternPool.Nav.Index) !Id { + const gpa = cg.gpa; + const zcu = cg.zcu; + const ip = &zcu.intern_pool; + if (cg.externs.get(nav_index)) |ext| return ext.id; + + const nav = ip.getNav(nav_index); + const fn_ty: Type = .fromInterned(nav.resolved.?.type); + const fn_info = zcu.typeToFunc(fn_ty).?; + const return_ty_id = try cg.resolveFnReturnType(.fromInterned(fn_info.return_type)); + const fn_ty_id = try cg.resolveType(fn_ty, .direct); + const scratch_top = cg.id_scratch.items.len; + defer cg.id_scratch.shrinkRetainingCapacity(scratch_top); + for (fn_info.param_types.get(ip)) |param_ty_index| { + const param_ty: Type = .fromInterned(param_ty_index); + if (!param_ty.hasRuntimeBits(zcu)) continue; + try cg.id_scratch.append(gpa, try cg.resolveType(param_ty, .direct)); } - return entry.value_ptr.*; + const id = cg.allocId(); + try cg.externs.putNoClobber(gpa, nav_index, .{ + .id = id, + .name = nav.getExtern(ip).?.name.toSlice(ip), + }); + try cg.module.emit(gpa, .OpFunction, .{ + .id_result_type = return_ty_id, + .id_result = id, + .function_control = .{}, + .function_type = fn_ty_id, + }); + for (cg.id_scratch.items[scratch_top..]) |param_ty_id| { + try cg.module.emit(gpa, .OpFunctionParameter, .{ + .id_result_type = param_ty_id, + .id_result = cg.allocId(), + }); + } + try cg.module.emit(gpa, .OpFunctionEnd, {}); + return id; } pub fn allocIds(cg: *CodeGen, n: u32) spec.IdRange { @@ -420,34 +449,10 @@ pub fn idBound(cg: *const CodeGen) Word { return cg.next_result_id; } -pub fn addEntryPointDeps( - cg: *CodeGen, - decl_index: Decl.Index, - seen: *std.bit_set.Dynamic, - interface: *std.ArrayList(Id), -) !void { - const decl = cg.declPtr(decl_index); - const deps = cg.decl_deps.items[decl.begin_dep..decl.end_dep]; - - if (seen.isSet(@backingInt(decl_index))) { - return; - } - - seen.set(@backingInt(decl_index)); - - if (decl.kind == .global) { - try interface.append(cg.gpa, decl.result_id); - } - - for (deps) |dep| { - try cg.addEntryPointDeps(dep, seen, interface); - } -} - pub fn importInstructionSet(cg: *CodeGen, set: spec.InstructionSet) !Id { assert(set != .core); const result_id = cg.allocId(); - try cg.sections.extended_instruction_set.emit(cg.gpa, .OpExtInstImport, .{ + try cg.module.emit(cg.gpa, .OpExtInstImport, .{ .id_result = result_id, .name = @tagName(set), }); @@ -456,7 +461,7 @@ pub fn importInstructionSet(cg: *CodeGen, set: spec.InstructionSet) !Id { pub fn boolType(cg: *CodeGen) !Id { const result_id = cg.allocId(); - try cg.sections.globals.emit(cg.gpa, .OpTypeBool, .{ + try cg.module.emit(cg.gpa, .OpTypeBool, .{ .id_result = result_id, }); return result_id; @@ -464,20 +469,17 @@ pub fn boolType(cg: *CodeGen) !Id { pub fn voidType(cg: *CodeGen) !Id { const result_id = cg.allocId(); - try cg.sections.globals.emit(cg.gpa, .OpTypeVoid, .{ + try cg.module.emit(cg.gpa, .OpTypeVoid, .{ .id_result = result_id, }); try cg.debugName(result_id, "void"); return result_id; } -pub fn opaqueType(cg: *CodeGen, name: []const u8) !Id { +pub fn opaqueType(cg: *CodeGen, comptime fmt: []const u8, args: anytype) !Id { const result_id = cg.allocId(); - try cg.sections.globals.emit(cg.gpa, .OpTypeOpaque, .{ - .id_result = result_id, - .literal_string = name, - }); - try cg.debugName(result_id, name); + try cg.module.emitFormatted(cg.gpa, .OpTypeOpaque, &.{result_id}, fmt, args); + try cg.debugNameFmt(result_id, fmt, args); return result_id; } @@ -513,7 +515,7 @@ pub fn intType(cg: *CodeGen, signedness: std.lang.Signedness, bits: u16) !Id { const limb_ty = try cg.intType(.unsigned, limb_bits); const len_ty = try cg.intType(.unsigned, 32); const len_id = cg.allocId(); - try cg.sections.globals.emit(cg.gpa, .OpConstant, .{ + try cg.module.emit(cg.gpa, .OpConstant, .{ .id_result_type = len_ty, .id_result = len_id, .value = .{ .uint32 = backing_bits / limb_bits }, @@ -522,7 +524,7 @@ pub fn intType(cg: *CodeGen, signedness: std.lang.Signedness, bits: u16) !Id { } const result_id = cg.allocId(); - try cg.sections.globals.emit(cg.gpa, .OpTypeInt, .{ + try cg.module.emit(cg.gpa, .OpTypeInt, .{ .id_result = result_id, .width = backing_bits, .signedness = switch (actual_signedness) { @@ -540,7 +542,7 @@ pub fn intType(cg: *CodeGen, signedness: std.lang.Signedness, bits: u16) !Id { pub fn floatType(cg: *CodeGen, bits: u16) !Id { assert(bits > 0); const result_id = cg.allocId(); - try cg.sections.globals.emit(cg.gpa, .OpTypeFloat, .{ + try cg.module.emit(cg.gpa, .OpTypeFloat, .{ .id_result = result_id, .width = bits, }); @@ -550,7 +552,7 @@ pub fn floatType(cg: *CodeGen, bits: u16) !Id { pub fn vectorType(cg: *CodeGen, len: u32, child_ty_id: Id) !Id { const result_id = cg.allocId(); - try cg.sections.globals.emit(cg.gpa, .OpTypeVector, .{ + try cg.module.emit(cg.gpa, .OpTypeVector, .{ .id_result = result_id, .component_type = child_ty_id, .component_count = len, @@ -560,7 +562,7 @@ pub fn vectorType(cg: *CodeGen, len: u32, child_ty_id: Id) !Id { pub fn arrayType(cg: *CodeGen, len_id: Id, child_ty_id: Id) !Id { const result_id = cg.allocId(); - try cg.sections.globals.emit(cg.gpa, .OpTypeArray, .{ + try cg.module.emit(cg.gpa, .OpTypeArray, .{ .id_result = result_id, .element_type = child_ty_id, .length = len_id, @@ -570,7 +572,7 @@ pub fn arrayType(cg: *CodeGen, len_id: Id, child_ty_id: Id) !Id { pub fn ptrType(cg: *CodeGen, child_ty_id: Id, storage_class: spec.StorageClass) !Id { const result_id = cg.allocId(); - try cg.sections.globals.emit(cg.gpa, .OpTypePointer, .{ + try cg.module.emit(cg.gpa, .OpTypePointer, .{ .id_result = result_id, .storage_class = storage_class, .type = child_ty_id, @@ -589,7 +591,7 @@ pub fn structType( if (cg.struct_types.get(.{ .fields = types, .ip_index = actual_ip_index })) |id| return id; const result_id = cg.allocId(); const types_dup = try cg.arena.dupe(Id, types); - try cg.sections.globals.emit(cg.gpa, .OpTypeStruct, .{ + try cg.module.emit(cg.gpa, .OpTypeStruct, .{ .id_result = result_id, .id_ref = types_dup, }); @@ -639,7 +641,7 @@ pub fn layoutType(cg: *CodeGen, ty: Type, is_block_root: bool) Error!Id { } }); try member_types.append(gpa, try cg.layoutType(field_ty, false)); } - try cg.sections.globals.emit(gpa, .OpTypeStruct, .{ + try cg.module.emit(gpa, .OpTypeStruct, .{ .id_result = id, .id_ref = member_types.items, }); @@ -682,7 +684,7 @@ pub fn layoutType(cg: *CodeGen, ty: Type, is_block_root: bool) Error!Id { try cg.decorate(arr_id, .{ .array_stride = .{ .array_stride = 1 } }); member_types[layout.padding_index] = arr_id; } - try cg.sections.globals.emit(gpa, .OpTypeStruct, .{ + try cg.module.emit(gpa, .OpTypeStruct, .{ .id_result = id, .id_ref = member_types[0..layout.total_fields], }); @@ -705,7 +707,7 @@ pub fn layoutType(cg: *CodeGen, ty: Type, is_block_root: bool) Error!Id { const elem_ty = ty.childType(zcu); const elem_ty_id = try cg.layoutType(elem_ty, is_block_root); const id = cg.allocId(); - try cg.sections.globals.emit(gpa, .OpTypeRuntimeArray, .{ + try cg.module.emit(gpa, .OpTypeRuntimeArray, .{ .id_result = id, .element_type = elem_ty_id, }); @@ -724,7 +726,7 @@ pub fn layoutType(cg: *CodeGen, ty: Type, is_block_root: bool) Error!Id { pub fn functionType(cg: *CodeGen, return_ty_id: Id, param_type_ids: []const Id) !Id { const result_id = cg.allocId(); - try cg.sections.globals.emit(cg.gpa, .OpTypeFunction, .{ + try cg.module.emit(cg.gpa, .OpTypeFunction, .{ .id_result = result_id, .return_type = return_ty_id, .id_ref_2 = param_type_ids, @@ -734,7 +736,7 @@ pub fn functionType(cg: *CodeGen, return_ty_id: Id, param_type_ids: []const Id) pub fn constUndef(cg: *CodeGen, ty_id: Id) !Id { const result_id = cg.allocId(); - try cg.sections.globals.emit(cg.gpa, .OpUndef, .{ + try cg.module.emit(cg.gpa, .OpUndef, .{ .id_result_type = ty_id, .id_result = result_id, }); @@ -743,7 +745,7 @@ pub fn constUndef(cg: *CodeGen, ty_id: Id) !Id { pub fn constNull(cg: *CodeGen, ty_id: Id) !Id { const result_id = cg.allocId(); - try cg.sections.globals.emit(cg.gpa, .OpConstantNull, .{ + try cg.module.emit(cg.gpa, .OpConstantNull, .{ .id_result_type = ty_id, .id_result = result_id, }); @@ -755,7 +757,7 @@ pub fn decorate( target: Id, decoration: spec.Decoration.Extended, ) !void { - try cg.sections.annotations.emit(cg.gpa, .OpDecorate, .{ + try cg.module.emit(cg.gpa, .OpDecorate, .{ .target = target, .decoration = decoration, }); @@ -767,29 +769,16 @@ pub fn decorateMember( member: u32, decoration: spec.Decoration.Extended, ) !void { - try cg.sections.annotations.emit(cg.gpa, .OpMemberDecorate, .{ + try cg.module.emit(cg.gpa, .OpMemberDecorate, .{ .structure_type = structure_type, .member = member, .decoration = decoration, }); } -pub fn allocDecl(cg: *CodeGen, kind: Decl.Kind) !Decl.Index { - try cg.decls.append(cg.gpa, .{ - .kind = kind, - .result_id = cg.allocId(), - }); - - return @as(Decl.Index, @fromBackingInt(@intCast(@as(u32, @intCast(cg.decls.items.len - 1))))); -} - -pub fn declPtr(cg: *CodeGen, index: Decl.Index) *Decl { - return &cg.decls.items[@backingInt(index)]; -} - pub fn debugName(cg: *CodeGen, target: Id, name: []const u8) !void { if (cg.zcu.comp.config.root_strip) return; - try cg.sections.debug_names.emit(cg.gpa, .OpName, .{ + try cg.module.emit(cg.gpa, .OpName, .{ .target = target, .name = name, }); @@ -797,14 +786,12 @@ pub fn debugName(cg: *CodeGen, target: Id, name: []const u8) !void { pub fn debugNameFmt(cg: *CodeGen, target: Id, comptime fmt: []const u8, args: anytype) !void { if (cg.zcu.comp.config.root_strip) return; - const name = try std.fmt.allocPrint(cg.gpa, fmt, args); - defer cg.gpa.free(name); - try cg.debugName(target, name); + try cg.module.emitFormatted(cg.gpa, .OpName, &.{target}, fmt, args); } pub fn memberDebugName(cg: *CodeGen, target: Id, member: u32, name: []const u8) !void { if (cg.zcu.comp.config.root_strip) return; - try cg.sections.debug_names.emit(cg.gpa, .OpMemberName, .{ + try cg.module.emit(cg.gpa, .OpMemberName, .{ .type = target, .member = member, .name = name, @@ -827,6 +814,7 @@ pub fn storageClass(cg: *const CodeGen, as: std.lang.AddressSpace) spec.StorageC .constant => .uniform_constant, .shared => .workgroup, .local => .function, + .private => .private, .input => .input, .gs, .fs, @@ -850,228 +838,6 @@ pub fn storageClass(cg: *const CodeGen, as: std.lang.AddressSpace) spec.StorageC const Error = codegen.Error; -pub fn genNav(cg: *CodeGen, do_codegen: bool) Error!void { - const gpa = cg.gpa; - const zcu = cg.zcu; - const ip = &zcu.intern_pool; - const target = zcu.getTarget(); - - const nav = ip.getNav(cg.owner_nav); - const val = zcu.navValue(cg.owner_nav); - const ty = val.typeOf(zcu); - - if (!do_codegen and !ty.hasRuntimeBits(zcu)) { - const child_ty = if (ty.zigTypeTag(zcu) == .pointer) ty.childType(zcu) else ty; - if (child_ty.zigTypeTag(zcu) != .spirv) return; - } - - const spv_decl_index = try cg.resolveNav(ip, cg.owner_nav); - const decl = cg.declPtr(spv_decl_index); - const result_id = decl.result_id; - decl.begin_dep = cg.decl_deps.items.len; - - switch (decl.kind) { - .func => { - if (nav.resolved.?.is_extern_decl) { - _ = try cg.resolveType(ty, .direct); - try emitExternFnStub(cg, nav, decl, ty); - decl.end_dep = cg.decl_deps.items.len; - return; - } - - const fn_info = zcu.typeToFunc(ty).?; - const return_ty_id = try cg.resolveFnReturnType(.fromInterned(fn_info.return_type)); - const is_test = zcu.test_functions.contains(cg.owner_nav); - - const func_result_id = if (is_test) cg.allocId() else result_id; - const prototype_ty_id = try cg.resolveType(ty, .direct); - try cg.prologue.emit(gpa, .OpFunction, .{ - .id_result_type = return_ty_id, - .id_result = func_result_id, - .function_type = prototype_ty_id, - // Note: the backend will never be asked to generate an inline function - // (this is handled in sema), so we don't need to set function_control here. - .function_control = .{}, - }); - - try cg.args.ensureUnusedCapacity(gpa, fn_info.param_types.len); - for (fn_info.param_types.get(ip)) |param_ty_index| { - const param_ty: Type = .fromInterned(param_ty_index); - if (!param_ty.hasRuntimeBits(zcu)) continue; - - const param_type_id = try cg.resolveType(param_ty, .direct); - const arg_result_id = cg.allocId(); - try cg.prologue.emit(gpa, .OpFunctionParameter, .{ - .id_result_type = param_type_id, - .id_result = arg_result_id, - }); - cg.args.appendAssumeCapacity(arg_result_id); - } - - // TODO: This could probably be done in a better way... - const root_block_id = cg.allocId(); - - // The root block of a function declaration should appear before OpVariable instructions, - // so it is generated into the function's prologue. - try cg.prologue.emit(gpa, .OpLabel, .{ - .id_result = root_block_id, - }); - cg.block_label = root_block_id; - - const main_body = cg.air.getMainBody(); - _ = try cg.genStructuredBody(.selection, main_body); - // We always expect paths to here to end, but we still need the block - // to act as a dummy merge block. - try cg.body.emit(gpa, .OpUnreachable, {}); - try cg.body.emit(gpa, .OpFunctionEnd, {}); - // Append the actual code into the functions section. - try cg.sections.functions.append(gpa, cg.prologue); - try cg.sections.functions.append(gpa, cg.body); - - // Temporarily generate a test kernel declaration if this is a test function. - if (is_test) { - try cg.generateTestEntryPoint(nav.fqn.toSlice(ip), spv_decl_index, func_result_id); - } - - try cg.debugName(func_result_id, nav.fqn.toSlice(ip)); - }, - .global => { - const key = ip.indexToKey(val.toIntern()).@"extern"; - - const storage_class = cg.storageClass(nav.resolved.?.@"addrspace"); - assert(storage_class != .generic); // These should be instance globals - - const as = nav.resolved.?.@"addrspace"; - const ty_id = try cg.pointeeType(as, ty, true); - const ptr_ty_id = try cg.ptrType(ty_id, storage_class); - - try cg.sections.globals.emit(gpa, .OpVariable, .{ - .id_result_type = ptr_ty_id, - .id_result = result_id, - .storage_class = storage_class, - }); - - switch (target.os.tag) { - .vulkan, .opengl => { - switch (storage_class) { - .uniform, - .push_constant, - .storage_buffer, - .physical_storage_buffer, - => { - if (ty.hasRuntimeBits(zcu)) { - if (!ty.isSpirvRuntimeArray(zcu)) { - try cg.decorate( - ptr_ty_id, - .{ .array_stride = .{ .array_stride = @intCast(ty.abiSize(zcu)) } }, - ); - } - if (!cg.needsLayout(as, ty)) try cg.decorateLayout(ty, ty_id); - } - if (key.is_const and storage_class == .storage_buffer) { - try cg.decorate(result_id, .non_writable); - } - }, - else => {}, - } - - if (key.decoration) |decoration| switch (decoration) { - .location => |location| { - if (storage_class != .output and storage_class != .input and storage_class != .uniform_constant) { - return cg.fail("storage class must be one of (output, input, uniform_constant) but is {s}", .{@tagName(storage_class)}); - } - try cg.decorate(result_id, .{ - .location = .{ .location = location }, - }); - }, - .flat => |location| { - try cg.decorate(result_id, .{ .location = .{ .location = location } }); - try cg.decorate(result_id, .flat); - }, - .descriptor => |descriptor| { - if (storage_class != .storage_buffer and storage_class != .uniform and storage_class != .uniform_constant) { - return cg.fail("storage class must be one of (storage_buffer, uniform, uniform_constant) but is {s}", .{@tagName(storage_class)}); - } - try cg.decorate(result_id, .{ - .binding = .{ .binding_point = descriptor.binding }, - }); - - try cg.decorate(result_id, .{ - .descriptor_set = .{ .descriptor_set = descriptor.set }, - }); - }, - }; - }, - else => {}, - } - - if (std.meta.stringToEnum(spec.BuiltIn, nav.fqn.toSlice(ip))) |built_in| { - try cg.decorate(result_id, .{ .built_in = .{ .built_in = built_in } }); - } - - try cg.debugName(result_id, nav.fqn.toSlice(ip)); - }, - .invocation_global => { - // `@extern()` produces an invocation_global whose value is a - // comptime-known pointer to an underlying extern symbol's Nav. - // The pointer is inlined at use sites so we don't need a Function-scope wrapper here. - if (ip.indexToKey(val.toIntern()) == .ptr) alias: { - const ptr_key = ip.indexToKey(val.toIntern()).ptr; - if (ptr_key.base_addr != .nav or ptr_key.byte_offset != 0) break :alias; - const underlying_nav = ip.getNav(ptr_key.base_addr.nav); - if (!underlying_nav.resolved.?.is_extern_decl) break :alias; - cg.declPtr(spv_decl_index).end_dep = cg.decl_deps.items.len; - return; - } - - const ty_id = try cg.resolveType(ty, .indirect); - const ptr_ty_id = try cg.ptrType(ty_id, .function); - - // TODO: Combine with resolveAnonDecl? - const void_ty_id = try cg.resolveType(.void, .direct); - const initializer_proto_ty_id = try cg.functionType(void_ty_id, &.{}); - - const initializer_id = cg.allocId(); - try cg.prologue.emit(gpa, .OpFunction, .{ - .id_result_type = try cg.resolveType(.void, .direct), - .id_result = initializer_id, - .function_control = .{}, - .function_type = initializer_proto_ty_id, - }); - - const root_block_id = cg.allocId(); - try cg.prologue.emit(gpa, .OpLabel, .{ - .id_result = root_block_id, - }); - cg.block_label = root_block_id; - - const val_id = try cg.constant(ty, val, .indirect); - try cg.body.emit(gpa, .OpStore, .{ - .pointer = result_id, - .object = val_id, - }); - - try cg.body.emit(gpa, .OpReturn, {}); - try cg.body.emit(gpa, .OpFunctionEnd, {}); - try cg.sections.functions.append(gpa, cg.prologue); - try cg.sections.functions.append(gpa, cg.body); - - try cg.debugNameFmt(initializer_id, "initializer of {f}", .{nav.fqn.fmt(ip)}); - try cg.debugName(result_id, nav.fqn.toSlice(ip)); - - try cg.sections.globals.emit(gpa, .OpExtInst, .{ - .id_result_type = ptr_ty_id, - .id_result = result_id, - .set = try cg.importInstructionSet(.zig), - .instruction = .{ .inst = @backingInt(spec.Zig.InvocationGlobal) }, - .id_ref_4 = &.{initializer_id}, - }); - }, - } - - cg.declPtr(spv_decl_index).end_dep = cg.decl_deps.items.len; -} - fn decorateLayout(cg: *CodeGen, ty: Type, ty_id: spec.Id) Error!void { const zcu = cg.zcu; const ip = &zcu.intern_pool; @@ -1174,144 +940,57 @@ fn importExtendedSet(cg: *CodeGen) !Id { /// Fetch the result-id for a previously generated instruction or constant. fn resolve(cg: *CodeGen, inst: Air.Inst.Ref) !Id { const zcu = cg.zcu; - const ip = &zcu.intern_pool; if (inst.toInterned()) |val_ip_index| { const ty = cg.typeOf(inst); if (ty.zigTypeTag(zcu) == .@"fn") { const val_key = zcu.intern_pool.indexToKey(val_ip_index); - const fn_nav = switch (val_key) { - .@"extern" => |@"extern"| @"extern".owner_nav, - .func => |func| func.owner_nav, + return switch (val_key) { + .@"extern" => |@"extern"| try cg.resolveExternFn(@"extern".owner_nav), + .func => |func| try cg.resolveNav(func.owner_nav), else => unreachable, }; - const spv_decl_index = try cg.resolveNav(ip, fn_nav); - try cg.decl_deps.append(cg.gpa, spv_decl_index); - const decl = cg.declPtr(spv_decl_index); - if (val_key == .@"extern") { - const nav = ip.getNav(fn_nav); - const nav_ty: Type = .fromInterned(nav.resolved.?.type); - try emitExternFnStub(cg, nav, decl, nav_ty); - } - return decl.result_id; } - return try cg.constant(ty, .fromInterned(val_ip_index), .direct); + const val: Value = .fromInterned(val_ip_index); + if (ty.isPtrAtRuntime(zcu)) { + if (val.isUndef(zcu)) return try cg.constUndef(try cg.resolveType(ty, .direct)); + if (ty.zigTypeTag(zcu) == .optional) { + const payload = val.optionalValue(zcu) orelse return try cg.constNull(try cg.resolveType(ty, .direct)); + return try cg.constantPtr(payload); + } + return try cg.constantPtr(val); + } + switch (zcu.intern_pool.indexToKey(val_ip_index)) { + .ptr => unreachable, + .slice => |slice| { + const ptr_id = try cg.constantPtr(.fromInterned(slice.ptr)); + const len_id = try cg.constant(.usize, .fromInterned(slice.len), .indirect); + return try cg.constructComposite(try cg.resolveType(ty, .direct), &.{ ptr_id, len_id }); + }, + .opt => { + const payload_ty = ty.optionalChild(zcu); + if (!payload_ty.isPtrAtRuntime(zcu)) return try cg.constant(ty, val, .direct); + const payload_val = val.optionalValue(zcu); + const ptr_id = if (payload_val) |payload| + try cg.constantPtr(payload) + else + try cg.constUndef(try cg.resolveType(payload_ty, .direct)); + const valid_id = try cg.constBool(payload_val != null, .indirect); + return try cg.constructComposite(try cg.resolveType(ty, .direct), &.{ ptr_id, valid_id }); + }, + else => return try cg.constant(ty, val, .direct), + } } const index = inst.toIndex().?; return cg.inst_results.get(index).?; // Assertion means instruction does not dominate usage. } -fn resolveUav(cg: *CodeGen, val: InternPool.Index) !Id { - const gpa = cg.gpa; - - // TODO: This cannot be a function at this point, but it should probably be handled anyway. - - const zcu = cg.zcu; - const ty: Type = .fromInterned(zcu.intern_pool.typeOf(val)); - const ty_id = try cg.resolveType(ty, .indirect); - - const spv_decl_index = blk: { - const entry = try cg.uav_link.getOrPut(gpa, .{ val, .function }); - if (entry.found_existing) { - try cg.addFunctionDep(entry.value_ptr.*, .function); - return cg.declPtr(entry.value_ptr.*).result_id; - } - - const spv_decl_index = try cg.allocDecl(.invocation_global); - try cg.addFunctionDep(spv_decl_index, .function); - entry.value_ptr.* = spv_decl_index; - break :blk spv_decl_index; - }; - - // TODO: At some point we will be able to generate this all constant here, but then all of - // constant() will need to be implemented such that it doesn't generate any at-runtime code. - // NOTE: Because this is a global, we really only want to initialize it once. Therefore the - // constant lowering of this value will need to be deferred to an initializer similar to - // other globals. - - const result_id = cg.declPtr(spv_decl_index).result_id; - - { - // Save the current state so that we can temporarily generate into a different function. - // TODO: This should probably be made a little more robust. - const func_prologue = cg.prologue; - const func_body = cg.body; - const block_label = cg.block_label; - defer { - cg.prologue = func_prologue; - cg.body = func_body; - cg.block_label = block_label; - } - - cg.prologue = .{}; - cg.body = .{}; - defer { - cg.prologue.deinit(gpa); - cg.body.deinit(gpa); - } - - const void_ty_id = try cg.resolveType(.void, .direct); - const initializer_proto_ty_id = try cg.functionType(void_ty_id, &.{}); - - const initializer_id = cg.allocId(); - try cg.prologue.emit(gpa, .OpFunction, .{ - .id_result_type = try cg.resolveType(.void, .direct), - .id_result = initializer_id, - .function_control = .{}, - .function_type = initializer_proto_ty_id, - }); - const root_block_id = cg.allocId(); - try cg.prologue.emit(gpa, .OpLabel, .{ - .id_result = root_block_id, - }); - cg.block_label = root_block_id; - - const val_id = try cg.constant(ty, .fromInterned(val), .indirect); - try cg.body.emit(gpa, .OpStore, .{ - .pointer = result_id, - .object = val_id, - }); - - try cg.body.emit(gpa, .OpReturn, {}); - try cg.body.emit(gpa, .OpFunctionEnd, {}); - - try cg.sections.functions.append(gpa, cg.prologue); - try cg.sections.functions.append(gpa, cg.body); - - try cg.debugNameFmt(initializer_id, "initializer of __anon_{d}", .{@backingInt(val)}); - - const fn_decl_ptr_ty_id = try cg.ptrType(ty_id, .function); - try cg.sections.globals.emit(gpa, .OpExtInst, .{ - .id_result_type = fn_decl_ptr_ty_id, - .id_result = result_id, - .set = try cg.importInstructionSet(.zig), - .instruction = .{ .inst = @backingInt(spec.Zig.InvocationGlobal) }, - .id_ref_4 = &.{initializer_id}, - }); - } - - return result_id; -} - fn resolvePtr(cg: *CodeGen, ref: Air.Inst.Ref) !Ptr { const id = try cg.resolve(ref); if (cg.tracked_allocas.getPtr(id)) |slot| return .{ .tracked = .{ .id = id, .slot = slot } }; return .{ .id = id }; } -fn addFunctionDep(cg: *CodeGen, decl_index: Decl.Index, storage_class: StorageClass) !void { - const gpa = cg.gpa; - const target = cg.zcu.getTarget(); - if (target.cpu.has(.spirv, .v1_4)) { - try cg.decl_deps.append(gpa, decl_index); - } else { - // Before version 1.4, the interface’s storage classes are limited to the Input and Output - if (storage_class == .input or storage_class == .output) { - try cg.decl_deps.append(gpa, decl_index); - } - } -} - /// Start a new SPIR-V block, Emits the label of the new block, and stores which /// block we are currently generating. /// Note that there is no such thing as nested blocks like in ZIR or AIR, so we don't need to @@ -1439,7 +1118,7 @@ fn constBool(cg: *CodeGen, value: bool, repr: Repr) !Id { const result_ty_id = try cg.boolType(); const result_id = cg.allocId(); switch (value) { - inline else => |value_ct| try cg.sections.globals.emit( + inline else => |value_ct| try cg.module.emit( cg.gpa, if (value_ct) .OpConstantTrue else .OpConstantFalse, .{ .id_result_type = result_ty_id, .id_result = result_id }, @@ -1485,7 +1164,7 @@ fn constInt(cg: *CodeGen, ty: Type, value: anytype) !Id { if (i < 2) @as(u32, @truncate(value64 >> @intCast(i * 32))) else fill, ); } - return cg.constructComposite(result_ty_id, constituents); + return cg.constantComposite(result_ty_id, constituents); } const final_value: spec.LiteralContextDependentNumber = switch (target.os.tag) { @@ -1515,14 +1194,29 @@ fn constInt(cg: *CodeGen, ty: Type, value: anytype) !Id { }; const result_id = cg.allocId(); - try cg.sections.globals.emit(cg.gpa, .OpConstant, .{ + try cg.module.emit(cg.gpa, .OpConstant, .{ .id_result_type = result_ty_id, .id_result = result_id, .value = final_value, }); if (!ty.isVector(zcu)) return result_id; - return cg.constructCompositeSplat(ty, result_id); + + const vector_ty_id = try cg.resolveType(ty, .direct); + const constituents = try gpa.alloc(Id, @intCast(ty.arrayLen(zcu))); + defer gpa.free(constituents); + @memset(constituents, result_id); + return cg.constantComposite(vector_ty_id, constituents); +} + +fn constantComposite(cg: *CodeGen, result_ty_id: Id, constituents: []const Id) !Id { + const result_id = cg.allocId(); + try cg.module.emit(cg.gpa, .OpConstantComposite, .{ + .id_result_type = result_ty_id, + .id_result = result_id, + .constituents = constituents, + }); + return result_id; } /// Construct a composite value from its constituents. @@ -1541,7 +1235,7 @@ pub fn constructComposite(cg: *CodeGen, result_ty_id: Id, constituents: []const for (fields, constituents, 0..) |field_ty_id, constituent, i| { const field_ptr_ty_id = try cg.ptrType(field_ty_id, .function); const index_id = cg.allocId(); - try cg.sections.globals.emit(gpa, .OpConstant, .{ + try cg.module.emit(gpa, .OpConstant, .{ .id_result_type = u32_ty_id, .id_result = index_id, .value = .{ .uint32 = @intCast(i) }, @@ -1572,21 +1266,6 @@ pub fn constructComposite(cg: *CodeGen, result_ty_id: Id, constituents: []const /// Construct a composite at runtime with all lanes set to the same value. /// ty must be an aggregate type. -fn constructCompositeSplat(cg: *CodeGen, ty: Type, constituent: Id) !Id { - const gpa = cg.gpa; - const zcu = cg.zcu; - const n: usize = @intCast(ty.arrayLen(zcu)); - - const scratch_top = cg.id_scratch.items.len; - defer cg.id_scratch.shrinkRetainingCapacity(scratch_top); - - const constituents = try cg.id_scratch.addManyAsSlice(gpa, n); - @memset(constituents, constituent); - - const result_ty_id = try cg.resolveType(ty, .direct); - return cg.constructComposite(result_ty_id, constituents); -} - /// This function generates a load for a constant in direct (ie, non-memory) representation. /// When the constant is simple, it can be generated directly using OpConstant instructions. /// When the constant is more complicated however, it needs to be constructed using multiple values. This @@ -1602,288 +1281,345 @@ fn constant(cg: *CodeGen, ty: Type, val: Value, repr: Repr) Error!Id { const result_ty_id = try cg.resolveType(ty, repr); const ip = &zcu.intern_pool; - log.debug("lowering constant: ty = {f}, val = {f}, key = {s}", .{ ty.fmt(pt), val.fmtValue(pt), @tagName(ip.indexToKey(val.toIntern())) }); + log.debug("lowering constant: ty = {f}, val = {f}, key = {s}", .{ + ty.fmt(pt), + val.fmtValue(pt), + @tagName(ip.indexToKey(val.toIntern())), + }); + assert(!ty.isPtrAtRuntime(zcu)); + if (val.isUndef(zcu)) { return cg.constUndef(result_ty_id); } - const cacheable_id = cache: { - switch (ip.indexToKey(val.toIntern())) { - .int_type, - .ptr_type, - .array_type, - .vector_type, - .opt_type, - .anyframe_type, - .error_union_type, - .simple_type, - .struct_type, - .tuple_type, - .union_type, - .opaque_type, - .spirv_type, - .enum_type, - .func_type, - .error_set_type, - .inferred_error_set_type, - => unreachable, // types, not values + const cacheable_id = cache: switch (ip.indexToKey(val.toIntern())) { + .int_type, + .ptr_type, + .array_type, + .vector_type, + .opt_type, + .anyframe_type, + .error_union_type, + .simple_type, + .struct_type, + .tuple_type, + .union_type, + .opaque_type, + .spirv_type, + .enum_type, + .func_type, + .error_set_type, + .inferred_error_set_type, + => unreachable, // types, not values - .undef => unreachable, // handled above + .undef => unreachable, // handled above - .@"extern", - .func, - .enum_literal, + .@"extern", + .func, + .enum_literal, + => unreachable, // non-runtime values + + .simple_value => |simple_value| switch (simple_value) { + .void, + .null, + .@"unreachable", => unreachable, // non-runtime values - .simple_value => |simple_value| switch (simple_value) { - .void, - .null, - .@"unreachable", - => unreachable, // non-runtime values - - .false, .true => break :cache try cg.constBool(val.toBool(), repr), - }, - .int => { - const int_info = ty.intInfo(zcu); - const backing_bits, const is_big_int = cg.backingIntBits(int_info.bits); - if (is_big_int) { - const limb_bits = cg.bigIntBits(); - const n_limbs = backing_bits / limb_bits; - const big_result_ty_id = try cg.resolveType(ty, .indirect); - var bigint_space: Value.BigIntSpace = undefined; - const bigint = val.toBigInt(&bigint_space, zcu); - const limb_bytes = try gpa.alloc(u8, backing_bits / 8); - defer gpa.free(limb_bytes); - bigint.writeTwosComplement(limb_bytes, .little); - const scratch_top = cg.id_scratch.items.len; - defer cg.id_scratch.shrinkRetainingCapacity(scratch_top); - const constituents = try cg.id_scratch.addManyAsSlice(gpa, n_limbs); - switch (limb_bits) { - 32 => { - const limbs_u32: []u32 = @ptrCast(@alignCast(limb_bytes)); - for (constituents, limbs_u32) |*c, v| { - const host_v = if (builtin.cpu.arch.endian() == .big) @byteSwap(v) else v; - c.* = try cg.constInt(.u32, host_v); - } - }, - 64 => { - const limbs_u64: []u64 = @ptrCast(@alignCast(limb_bytes)); - for (constituents, limbs_u64) |*c, v| { - const host_v = if (builtin.cpu.arch.endian() == .big) @byteSwap(v) else v; - c.* = try cg.constInt(.u64, host_v); - } - }, - else => unreachable, - } - break :cache try cg.constructComposite(big_result_ty_id, constituents); - } - if (ty.isSignedInt(zcu)) { - break :cache try cg.constInt(ty, val.toSignedInt(zcu)); - } else { - break :cache try cg.constInt(ty, val.toUnsignedInt(zcu)); - } - }, - .float => { - const lit: spec.LiteralContextDependentNumber = switch (ty.floatBits(target)) { - 16 => .{ .uint32 = @as(u16, @bitCast(val.toFloat(f16, zcu))) }, - 32 => .{ .float32 = val.toFloat(f32, zcu) }, - 64 => .{ .float64 = val.toFloat(f64, zcu) }, - 80, 128 => unreachable, // TODO + .false, .true => break :cache try cg.constBool(val.toBool(), repr), + }, + .int => { + const int_info = ty.intInfo(zcu); + const backing_bits, const is_big_int = cg.backingIntBits(int_info.bits); + if (is_big_int) { + const limb_bits = cg.bigIntBits(); + const n_limbs = backing_bits / limb_bits; + const big_result_ty_id = try cg.resolveType(ty, .indirect); + var bigint_space: Value.BigIntSpace = undefined; + const bigint = val.toBigInt(&bigint_space, zcu); + const limb_bytes = try gpa.alloc(u8, backing_bits / 8); + defer gpa.free(limb_bytes); + bigint.writeTwosComplement(limb_bytes, .little); + const scratch_top = cg.id_scratch.items.len; + defer cg.id_scratch.shrinkRetainingCapacity(scratch_top); + const constituents = try cg.id_scratch.addManyAsSlice(gpa, n_limbs); + switch (limb_bits) { + 32 => { + const limbs_u32: []u32 = @ptrCast(@alignCast(limb_bytes)); + for (constituents, limbs_u32) |*c, v| { + const host_v = if (builtin.cpu.arch.endian() == .big) @byteSwap(v) else v; + c.* = try cg.constInt(.u32, host_v); + } + }, + 64 => { + const limbs_u64: []u64 = @ptrCast(@alignCast(limb_bytes)); + for (constituents, limbs_u64) |*c, v| { + const host_v = if (builtin.cpu.arch.endian() == .big) @byteSwap(v) else v; + c.* = try cg.constInt(.u64, host_v); + } + }, else => unreachable, - }; - const lit_id = cg.allocId(); - try cg.sections.globals.emit(gpa, .OpConstant, .{ - .id_result_type = result_ty_id, - .id_result = lit_id, - .value = lit, - }); - break :cache lit_id; - }, - .err => |err| { - const value = try pt.getErrorValue(err.name); - break :cache try cg.constInt(ty, value); - }, - .error_union => |error_union| { - // TODO: Error unions may be constructed with constant instructions if the payload type - // allows it. For now, just generate it here regardless. - const err_ty = ty.errorUnionSet(zcu); - const payload_ty = ty.errorUnionPayload(zcu); - const err_val_id = switch (error_union.val) { - .err_name => |err_name| try cg.constInt( - err_ty, - try pt.getErrorValue(err_name), - ), - .payload => try cg.constInt(err_ty, 0), - }; - const eu_layout = cg.errorUnionLayout(payload_ty); - if (!eu_layout.payload_has_bits) { - // We use the error type directly as the type. - break :cache err_val_id; } - - const payload_val_id = switch (error_union.val) { - .err_name => try cg.constant(payload_ty, .undef, .indirect), - .payload => |p| try cg.constant(payload_ty, .fromInterned(p), .indirect), - }; - - var constituents: [2]Id = undefined; - var types: [2]Type = undefined; - if (eu_layout.error_first) { - constituents[0] = err_val_id; - constituents[1] = payload_val_id; - types = .{ err_ty, payload_ty }; - } else { - constituents[0] = payload_val_id; - constituents[1] = err_val_id; - types = .{ payload_ty, err_ty }; - } - - const comp_ty_id = try cg.resolveType(ty, .direct); - return try cg.constructComposite(comp_ty_id, &constituents); - }, - .enum_tag => { - const int_val = val.backingInt(zcu); - const int_ty = ty.backingIntType(zcu); - break :cache try cg.constant(int_ty, int_val, repr); - }, - .ptr => return cg.constantPtr(val), - .slice => |slice| { - const ptr_id = try cg.constantPtr(.fromInterned(slice.ptr)); - const len_id = try cg.constant(.usize, .fromInterned(slice.len), .indirect); - const comp_ty_id = try cg.resolveType(ty, .direct); - return try cg.constructComposite(comp_ty_id, &.{ ptr_id, len_id }); - }, - .opt => { - const payload_ty = ty.optionalChild(zcu); - const maybe_payload_val = val.optionalValue(zcu); - - if (!payload_ty.hasRuntimeBits(zcu)) { - break :cache try cg.constBool(maybe_payload_val != null, .indirect); - } else if (ty.optionalReprIsPayload(zcu)) { - // Optional representation is a nullable pointer or slice. - if (maybe_payload_val) |payload_val| { - return try cg.constant(payload_ty, payload_val, .indirect); - } else { - break :cache try cg.constNull(result_ty_id); - } - } - - // Optional representation is a structure. - // { Payload, Bool } - - const has_pl_id = try cg.constBool(maybe_payload_val != null, .indirect); - const payload_id = if (maybe_payload_val) |payload_val| - try cg.constant(payload_ty, payload_val, .indirect) - else - try cg.constUndef(try cg.resolveType(payload_ty, .indirect)); - - const comp_ty_id = try cg.resolveType(ty, .direct); - return try cg.constructComposite(comp_ty_id, &.{ payload_id, has_pl_id }); - }, - .aggregate => |aggregate| switch (ip.indexToKey(ty.ip_index)) { - inline .array_type, .vector_type => |array_type, tag| { - const elem_ty: Type = .fromInterned(array_type.child); - - const scratch_top = cg.id_scratch.items.len; - defer cg.id_scratch.shrinkRetainingCapacity(scratch_top); - const constituents = try cg.id_scratch.addManyAsSlice(gpa, @intCast(ty.arrayLenIncludingSentinel(zcu))); - - const child_repr: Repr = switch (tag) { - .array_type => .indirect, - .vector_type => .direct, - else => unreachable, - }; - - switch (aggregate.storage) { - .bytes => |bytes| { - // TODO: This is really space inefficient, perhaps there is a better - // way to do it? - for (constituents, bytes.toSlice(constituents.len, ip)) |*constituent, byte| { - constituent.* = try cg.constInt(elem_ty, byte); - } - }, - .elems => |elems| { - for (constituents, elems) |*constituent, elem| { - constituent.* = try cg.constant(elem_ty, .fromInterned(elem), child_repr); - } - }, - .repeated_elem => |elem| { - @memset(constituents, try cg.constant(elem_ty, .fromInterned(elem), child_repr)); - }, - } - - const comp_ty_id = try cg.resolveType(ty, .direct); - return cg.constructComposite(comp_ty_id, constituents); - }, - .struct_type => { - const struct_type = zcu.typeToStruct(ty).?; - assert(struct_type.layout != .@"packed"); // packed structs use `bitpack` - - var types: std.ArrayList(Type) = .empty; - defer types.deinit(gpa); - - var constituents: std.ArrayList(Id) = .empty; - defer constituents.deinit(gpa); - - var it = struct_type.iterateRuntimeOrder(ip); - while (it.next()) |field_index| { - const field_ty: Type = .fromInterned(struct_type.field_types.get(ip)[field_index]); - if (!field_ty.hasRuntimeBits(zcu)) { - // This is a zero-bit field - we only needed it for the alignment. - continue; - } - - // TODO: Padding? - const field_val = try val.fieldValue(pt, field_index); - const field_id = try cg.constant(field_ty, field_val, .indirect); - - try types.append(gpa, field_ty); - try constituents.append(gpa, field_id); - } - - const comp_ty_id = try cg.resolveType(ty, .direct); - return try cg.constructComposite(comp_ty_id, constituents.items); - }, - .tuple_type => |tuple| { - var constituents: std.ArrayList(Id) = .empty; - defer constituents.deinit(gpa); - - for (tuple.types.get(ip), tuple.values.get(ip), 0..) |field_ty, field_val, i| { - if (field_val != .none) continue; - const ft: Type = .fromInterned(field_ty); - if (!ft.hasRuntimeBits(zcu)) continue; - - const fv = try val.fieldValue(pt, i); - const field_id = try cg.constant(ft, fv, .indirect); - try constituents.append(gpa, field_id); - } - - const comp_ty_id = try cg.resolveType(ty, .direct); - return try cg.constructComposite(comp_ty_id, constituents.items); - }, + break :cache try cg.constantComposite(big_result_ty_id, constituents); + } + if (ty.isSignedInt(zcu)) { + break :cache try cg.constInt(ty, val.toSignedInt(zcu)); + } else { + break :cache try cg.constInt(ty, val.toUnsignedInt(zcu)); + } + }, + .float => { + const lit: spec.LiteralContextDependentNumber = switch (ty.floatBits(target)) { + 16 => .{ .uint32 = @as(u16, @bitCast(val.toFloat(f16, zcu))) }, + 32 => .{ .float32 = val.toFloat(f32, zcu) }, + 64 => .{ .float64 = val.toFloat(f64, zcu) }, + 80, 128 => unreachable, // TODO else => unreachable, + }; + const lit_id = cg.allocId(); + try cg.module.emit(gpa, .OpConstant, .{ + .id_result_type = result_ty_id, + .id_result = lit_id, + .value = lit, + }); + break :cache lit_id; + }, + .err => |err| { + const value = try pt.getErrorValue(err.name); + break :cache try cg.constInt(ty, value); + }, + .error_union => |error_union| { + // TODO: Error unions may be constructed with constant instructions if the payload type + // allows it. For now, just generate it here regardless. + const err_ty = ty.errorUnionSet(zcu); + const payload_ty = ty.errorUnionPayload(zcu); + const err_val_id = switch (error_union.val) { + .err_name => |err_name| try cg.constInt( + err_ty, + try pt.getErrorValue(err_name), + ), + .payload => try cg.constInt(err_ty, 0), + }; + const eu_layout = cg.errorUnionLayout(payload_ty); + if (!eu_layout.payload_has_bits) { + // We use the error type directly as the type. + break :cache err_val_id; + } + + const payload_val_id = switch (error_union.val) { + .err_name => try cg.constant(payload_ty, .undef, .indirect), + .payload => |p| try cg.constant(payload_ty, .fromInterned(p), .indirect), + }; + + var constituents: [2]Id = undefined; + var types: [2]Type = undefined; + if (eu_layout.error_first) { + constituents[0] = err_val_id; + constituents[1] = payload_val_id; + types = .{ err_ty, payload_ty }; + } else { + constituents[0] = payload_val_id; + constituents[1] = err_val_id; + types = .{ payload_ty, err_ty }; + } + + const comp_ty_id = try cg.resolveType(ty, .direct); + return try cg.constantComposite(comp_ty_id, &constituents); + }, + .enum_tag => { + const int_val = val.backingInt(zcu); + const int_ty = ty.backingIntType(zcu); + break :cache try cg.constant(int_ty, int_val, repr); + }, + .ptr, .slice => unreachable, + .opt => { + const payload_ty = ty.optionalChild(zcu); + const maybe_payload_val = val.optionalValue(zcu); + + if (!payload_ty.hasRuntimeBits(zcu)) { + break :cache try cg.constBool(maybe_payload_val != null, .indirect); + } else if (ty.optionalReprIsPayload(zcu)) { + // Optional representation is a nullable pointer or slice. + if (maybe_payload_val) |payload_val| { + return try cg.constant(payload_ty, payload_val, .indirect); + } else { + break :cache try cg.constNull(result_ty_id); + } + } + + // Optional representation is a structure. + // { Payload, Bool } + + const has_pl_id = try cg.constBool(maybe_payload_val != null, .indirect); + const payload_id = if (maybe_payload_val) |payload_val| + try cg.constant(payload_ty, payload_val, .indirect) + else + try cg.constUndef(try cg.resolveType(payload_ty, .indirect)); + + const comp_ty_id = try cg.resolveType(ty, .direct); + return try cg.constantComposite(comp_ty_id, &.{ payload_id, has_pl_id }); + }, + .aggregate => |aggregate| switch (ip.indexToKey(ty.ip_index)) { + inline .array_type, .vector_type => |array_type, tag| { + const elem_ty: Type = .fromInterned(array_type.child); + + const scratch_top = cg.id_scratch.items.len; + defer cg.id_scratch.shrinkRetainingCapacity(scratch_top); + const constituents = try cg.id_scratch.addManyAsSlice(gpa, @intCast(ty.arrayLenIncludingSentinel(zcu))); + + const child_repr: Repr = switch (tag) { + .array_type => .indirect, + .vector_type => .direct, + else => unreachable, + }; + + switch (aggregate.storage) { + .bytes => |bytes| { + // TODO: This is really space inefficient, perhaps there is a better + // way to do it? + for (constituents, bytes.toSlice(constituents.len, ip)) |*constituent, byte| { + constituent.* = try cg.constInt(elem_ty, byte); + } + }, + .elems => |elems| { + for (constituents, elems) |*constituent, elem| { + constituent.* = try cg.constant(elem_ty, .fromInterned(elem), child_repr); + } + }, + .repeated_elem => |elem| { + @memset(constituents, try cg.constant(elem_ty, .fromInterned(elem), child_repr)); + }, + } + + const comp_ty_id = try cg.resolveType(ty, .direct); + return cg.constantComposite(comp_ty_id, constituents); }, - .un => |un| { - assert(ty.containerLayout(zcu) != .@"packed"); // packed unions use `bitpack` - if (un.tag == .none) { - @panic("TODO"); - } - const active_field = ty.unionTagFieldIndex(.fromInterned(un.tag), zcu).?; - const union_obj = zcu.typeToUnion(ty).?; - const field_ty: Type = .fromInterned(union_obj.field_types.get(ip)[active_field]); - const payload = if (field_ty.hasRuntimeBits(zcu)) - try cg.constant(field_ty, .fromInterned(un.val), .direct) - else - null; - return try cg.unionInit(ty, active_field, payload); + .struct_type => { + const struct_type = zcu.typeToStruct(ty).?; + assert(struct_type.layout != .@"packed"); // packed structs use `bitpack` + + var types: std.ArrayList(Type) = .empty; + defer types.deinit(gpa); + + var constituents: std.ArrayList(Id) = .empty; + defer constituents.deinit(gpa); + + var it = struct_type.iterateRuntimeOrder(ip); + while (it.next()) |field_index| { + const field_ty: Type = .fromInterned(struct_type.field_types.get(ip)[field_index]); + if (!field_ty.hasRuntimeBits(zcu)) { + // This is a zero-bit field - we only needed it for the alignment. + continue; + } + + // TODO: Padding? + const field_val = try val.fieldValue(pt, field_index); + const field_id = try cg.constant(field_ty, field_val, .indirect); + + try types.append(gpa, field_ty); + try constituents.append(gpa, field_id); + } + + const comp_ty_id = try cg.resolveType(ty, .direct); + return cg.constantComposite(comp_ty_id, constituents.items); }, - .bitpack => |bitpack| { - const int_val: Value = .fromInterned(bitpack.backing_int_val); - break :cache try cg.constant(int_val.typeOf(zcu), int_val, repr); + .tuple_type => |tuple| { + var constituents: std.ArrayList(Id) = .empty; + defer constituents.deinit(gpa); + + for (tuple.types.get(ip), tuple.values.get(ip), 0..) |field_ty, field_val, i| { + if (field_val != .none) continue; + const ft: Type = .fromInterned(field_ty); + if (!ft.hasRuntimeBits(zcu)) continue; + + const fv = try val.fieldValue(pt, i); + const field_id = try cg.constant(ft, fv, .indirect); + try constituents.append(gpa, field_id); + } + + const comp_ty_id = try cg.resolveType(ty, .direct); + return cg.constantComposite(comp_ty_id, constituents.items); }, + else => unreachable, + }, + .un => |un| { + assert(ty.containerLayout(zcu) != .@"packed"); + if (un.tag == .none) return cg.todo("constant of untagged union", .{}); + + const active_field = ty.unionTagFieldIndex(.fromInterned(un.tag), zcu).?; + const union_obj = zcu.typeToUnion(ty).?; + const field_ty: Type = .fromInterned(union_obj.field_types.get(ip)[active_field]); + if (union_obj.layout == .auto) { + if (ty.unionHasAllZeroBitFieldTypes(zcu)) { + const tag_ty = ty.unionTagTypeRuntime(zcu).?; + break :cache try cg.constant(tag_ty, .fromInterned(un.tag), .indirect); + } + + const constituents = try gpa.alloc(Id, union_obj.field_types.len + 1); + defer gpa.free(constituents); + for ( + constituents[0..union_obj.field_types.len], + union_obj.field_types.get(ip), + 0.., + ) |*constituent, member_ty_index, member| { + const member_ty: Type = .fromInterned(member_ty_index); + assert(!member_ty.isPtrAtRuntime(zcu)); + + const member_ty_id = if (member_ty.hasRuntimeBits(zcu)) + try cg.resolveType(member_ty, .indirect) + else + try cg.structType(&.{}, null, .none); + constituent.* = if (member == active_field and member_ty.hasRuntimeBits(zcu)) + try cg.constant(member_ty, .fromInterned(un.val), .indirect) + else + try cg.constUndef(member_ty_id); + } + + var len = union_obj.field_types.len; + if (ty.unionTagTypeRuntime(zcu)) |tag_ty| { + constituents[len] = try cg.constant(tag_ty, .fromInterned(un.tag), .indirect); + len += 1; + } + + return cg.constantComposite(result_ty_id, constituents[0..len]); + } + + const layout = cg.unionLayout(ty); + if (field_ty.hasRuntimeBits(zcu) and layout.payload_ty.eql(field_ty)) { + const constituents = try gpa.alloc(Id, layout.total_fields); + defer gpa.free(constituents); + constituents[layout.payload_index] = try cg.constant( + field_ty, + .fromInterned(un.val), + .indirect, + ); + + if (layout.payload_padding_size != 0) { + const u8_ty_id = try cg.resolveType(.u8, .indirect); + const len_id = try cg.constInt(.u32, layout.payload_padding_size); + constituents[layout.payload_padding_index] = try cg.constUndef(try cg.arrayType(len_id, u8_ty_id)); + } + + if (layout.padding_size != 0) { + const u8_ty_id = try cg.resolveType(.u8, .indirect); + const len_id = try cg.constInt(.u32, layout.padding_size); + constituents[layout.padding_index] = try cg.constUndef(try cg.arrayType(len_id, u8_ty_id)); + } + + return cg.constantComposite(result_ty_id, constituents); + } + + const payload: ?Id = if (field_ty.hasRuntimeBits(zcu)) + try cg.constant(field_ty, .fromInterned(un.val), .direct) + else + null; + return try cg.unionInit(ty, active_field, payload); + }, + .bitpack => |bitpack| { + const int_val: Value = .fromInterned(bitpack.backing_int_val); + break :cache try cg.constant(int_val.typeOf(zcu), int_val, repr); + }, - .memoized_call => unreachable, - } + .memoized_call => unreachable, }; return cacheable_id; } @@ -1942,46 +1678,42 @@ fn derivePtr(cg: *CodeGen, derivation: Value.PointerDeriveStep) !Id { const nav = ip.getNav(nav_index); const nav_ty: Type = .fromInterned(nav.resolved.?.type); - switch (nav.resolved.?.value) { - .none => {}, - else => |value| switch (ip.indexToKey(value)) { - // TODO: Properly lower function pointers; for now substitute undef. - .func => return try cg.constUndef(ty_id), - .@"extern" => if (ip.isFunctionType(nav_ty.toIntern())) { - const spv_decl_index = try cg.resolveNav(ip, nav_index); - const decl = cg.declPtr(spv_decl_index); - try emitExternFnStub(cg, nav, decl, nav_ty); - return decl.result_id; - }, - else => {}, - }, - } + const is_extern = nav.getExtern(ip) != null; + assert(nav.resolved.?.@"const" or is_extern); + if (ip.isFunctionType(nav_ty.toIntern())) { + if (is_extern) return try cg.resolveExternFn(nav_index); + return try cg.constUndef(ty_id); + } if (!nav_ty.hasRuntimeBits(zcu) and nav_ty.zigTypeTag(zcu) != .spirv) { return cg.constUndef(ty_id); } + if (!is_extern) { + return cg.todo("pointer to constant '{f}'", .{nav.fqn.fmt(ip)}); + } - const spv_decl_index = try cg.resolveNav(ip, nav_index); - const spv_decl = cg.declPtr(spv_decl_index); - assert(spv_decl.kind != .func); - const storage_class = cg.storageClass(nav.resolved.?.@"addrspace"); - try cg.addFunctionDep(spv_decl_index, storage_class); + const as = nav.resolved.?.@"addrspace"; + assert(as != .generic); + const storage_class = cg.storageClass(as); + const var_id = try cg.resolveNav(nav_index); const nav_ty_id = try cg.resolveType(nav_ty, .indirect); const decl_ptr_ty_id = try cg.ptrType(nav_ty_id, storage_class); - if (cg.needsLayout(nav.resolved.?.@"addrspace", nav_ty)) { - try cg.block_var_ids.put(gpa, spv_decl.result_id, {}); + if (cg.needsLayout(as, nav_ty)) { + try cg.block_var_ids.put(gpa, var_id, {}); } - if (decl_ptr_ty_id == ty_id) return spv_decl.result_id; + + if (decl_ptr_ty_id == ty_id) return var_id; switch (target.os.tag) { - .vulkan, .opengl => return spv_decl.result_id, + .vulkan, .opengl => return var_id, else => {}, } + const casted_ptr_id = cg.allocId(); try cg.body.emit(gpa, .OpBitcast, .{ .id_result_type = ty_id, .id_result = casted_ptr_id, - .operand = spv_decl.result_id, + .operand = var_id, }); return casted_ptr_id; }, @@ -2001,24 +1733,15 @@ fn derivePtr(cg: *CodeGen, derivation: Value.PointerDeriveStep) !Id { return cg.constUndef(ty_id); } - // Uav refs are always generic. - assert(result_ptr_ty.ptrAddressSpace(zcu) == .generic); + if (cg.storageClass(result_ptr_ty.ptrAddressSpace(zcu)) != .function) { + return cg.todo("pointer to an anonymous constant of type '{f}'", .{uav_ty.fmt(pt)}); + } + const uav_ty_id = try cg.resolveType(uav_ty, .indirect); - const decl_ptr_ty_id = try cg.ptrType(uav_ty_id, .function); - const ptr_id = try cg.resolveUav(uav.val); - - if (decl_ptr_ty_id == ty_id) return ptr_id; - switch (target.os.tag) { - .vulkan, .opengl => return ptr_id, - else => {}, - } - const casted_ptr_id = cg.allocId(); - try cg.body.emit(gpa, .OpBitcast, .{ - .id_result_type = ty_id, - .id_result = casted_ptr_id, - .operand = ptr_id, - }); - return casted_ptr_id; + const ptr_id = try cg.alloc(uav_ty_id, null); + const val_id = try cg.constant(uav_ty, .fromInterned(uav.val), .indirect); + try cg.body.emit(gpa, .OpStore, .{ .pointer = ptr_id, .object = val_id }); + return ptr_id; }, .eu_payload_ptr => @panic("TODO"), .opt_payload_ptr => @panic("TODO"), @@ -2102,61 +1825,6 @@ fn derivePtr(cg: *CodeGen, derivation: Value.PointerDeriveStep) !Id { } } -/// Emit a stub OpFunction/OpFunctionEnd + Import linkage decoration for an -/// extern function so the module is structurally valid. The stub will be -/// replaced by the real definition at link time. -fn emitExternFnStub(cg: *CodeGen, nav: InternPool.Nav, decl: *Decl, fn_ty: Type) !void { - if (decl.has_extern_stub) return; - decl.has_extern_stub = true; - - const gpa = cg.gpa; - const zcu = cg.zcu; - const ip = &zcu.intern_pool; - const fn_info = zcu.typeToFunc(fn_ty).?; - const return_ty_id = try cg.resolveFnReturnType(.fromInterned(fn_info.return_type)); - const prototype_ty_id = try cg.resolveType(fn_ty, .direct); - - var stub: Section = .{}; - defer stub.deinit(gpa); - try stub.emit(gpa, .OpFunction, .{ - .id_result_type = return_ty_id, - .id_result = decl.result_id, - .function_type = prototype_ty_id, - .function_control = .{}, - }); - for (fn_info.param_types.get(ip)) |param_ty_index| { - const param_ty: Type = .fromInterned(param_ty_index); - if (!param_ty.hasRuntimeBits(zcu)) continue; - const param_type_id = try cg.resolveType(param_ty, .direct); - try stub.emit(gpa, .OpFunctionParameter, .{ - .id_result_type = param_type_id, - .id_result = cg.allocId(), - }); - } - try stub.emit(gpa, .OpFunctionEnd, {}); - try cg.sections.functions.append(gpa, stub); - - const extern_name = nav.getExtern(ip).?.name.toSlice(ip); - try cg.sections.annotations.emit(gpa, .OpDecorate, .{ - .target = decl.result_id, - .decoration = .{ .linkage_attributes = .{ - .name = extern_name, - .linkage_type = .import, - } }, - }); - try cg.debugName(decl.result_id, extern_name); -} - -fn resolveTypeName(cg: *CodeGen, ty: Type) ![]const u8 { - const gpa = cg.gpa; - var aw: std.Io.Writer.Allocating = .init(gpa); - defer aw.deinit(); - ty.print(&aw.writer, cg.pt, null) catch |err| switch (err) { - error.WriteFailed => return error.OutOfMemory, - }; - return try aw.toOwnedSlice(); -} - /// Generate a union type. Union types are always generated with the /// most aligned field active. If the tag alignment is greater /// than that of the payload, a regular union (non-packed, with both tag and @@ -2209,7 +1877,7 @@ fn resolveType(cg: *CodeGen, ty: Type, repr: Repr) Error!Id { .direct => return try cg.voidType(), .indirect => { if (target.os.tag != .opencl) return cg.fail("cannot generate opaque type", .{}); - return try cg.opaqueType("void"); + return try cg.opaqueType("void", .{}); }, }, .bool => switch (repr) { @@ -2220,7 +1888,7 @@ fn resolveType(cg: *CodeGen, ty: Type, repr: Repr) Error!Id { if (ty.toIntern() == .u0_type) { assert(repr == .indirect); if (target.os.tag != .opencl) return cg.fail("cannot generate opaque type", .{}); - return try cg.opaqueType("u0"); + return try cg.opaqueType("u0", .{}); } const int_info = ty.intInfo(zcu); return try cg.intType(int_info.signedness, int_info.bits); @@ -2250,7 +1918,7 @@ fn resolveType(cg: *CodeGen, ty: Type, repr: Repr) Error!Id { if (!elem_ty.hasRuntimeBits(zcu)) { assert(repr == .indirect); if (target.os.tag != .opencl) return cg.fail("cannot generate opaque type", .{}); - return try cg.opaqueType("zero-sized-array"); + return try cg.opaqueType("zero-sized-array", .{}); } else if (total_len == 0) { // The size of the array would be 0, but that is not allowed in SPIR-V. // This path can be reached for example when there is a slicing of a pointer @@ -2364,9 +2032,7 @@ fn resolveType(cg: *CodeGen, ty: Type, repr: Repr) Error!Id { null, .none, ); - const type_name = try cg.resolveTypeName(ty); - defer gpa.free(type_name); - try cg.debugName(result_id, type_name); + try cg.debugNameFmt(result_id, "{f}", .{ty.fmt(cg.pt)}); return result_id; }, .struct_type => ip.loadStructType(ty.toIntern()), @@ -2399,9 +2065,7 @@ fn resolveType(cg: *CodeGen, ty: Type, repr: Repr) Error!Id { ty.toIntern(), ); - const type_name = try cg.resolveTypeName(ty); - defer gpa.free(type_name); - try cg.debugName(result_id, type_name); + try cg.debugNameFmt(result_id, "{f}", .{ty.fmt(cg.pt)}); return result_id; }, @@ -2430,9 +2094,36 @@ fn resolveType(cg: *CodeGen, ty: Type, repr: Repr) Error!Id { }, .@"union" => { const union_obj = zcu.typeToUnion(ty).?; - if (union_obj.layout == .@"packed") { - return try cg.intType(.unsigned, @intCast(ty.bitSize(zcu))); + switch (union_obj.layout) { + .@"extern" => {}, + .@"packed" => return try cg.intType(.unsigned, @intCast(ty.bitSize(zcu))), + .auto => { + if (ty.unionHasAllZeroBitFieldTypes(zcu)) { + return try cg.resolveType(ty.unionTagTypeRuntime(zcu).?, .indirect); + } + + const member_types = try gpa.alloc(Id, union_obj.field_types.len + 1); + defer gpa.free(member_types); + for (member_types[0..union_obj.field_types.len], union_obj.field_types.get(ip)) |*member_ty_id, field_ty_index| { + const field_ty: Type = .fromInterned(field_ty_index); + member_ty_id.* = if (field_ty.hasRuntimeBits(zcu)) + try cg.resolveType(field_ty, .indirect) + else + try cg.structType(&.{}, null, .none); + } + + var len = union_obj.field_types.len; + if (ty.unionTagTypeRuntime(zcu)) |tag_ty| { + member_types[len] = try cg.resolveType(tag_ty, .indirect); + len += 1; + } + + const result_id = try cg.structType(member_types[0..len], null, .none); + try cg.debugNameFmt(result_id, "{f}", .{ty.fmt(cg.pt)}); + return result_id; + }, } + const layout = cg.unionLayout(ty); if (!layout.has_payload) { return try cg.resolveType(.fromInterned(union_obj.enum_tag_type), .indirect); @@ -2463,9 +2154,7 @@ fn resolveType(cg: *CodeGen, ty: Type, repr: Repr) Error!Id { member_names[0..layout.total_fields], .none, ); - const type_name = try cg.resolveTypeName(ty); - defer gpa.free(type_name); - try cg.debugName(result_id, type_name); + try cg.debugNameFmt(result_id, "{f}", .{ty.fmt(cg.pt)}); return result_id; }, .error_set => { @@ -2502,18 +2191,16 @@ fn resolveType(cg: *CodeGen, ty: Type, repr: Repr) Error!Id { }, .@"opaque" => { if (target.os.tag != .opencl) return cg.fail("cannot generate opaque type", .{}); - const type_name = try cg.resolveTypeName(ty); - defer gpa.free(type_name); - return try cg.opaqueType(type_name); + return try cg.opaqueType("{f}", .{ty.fmt(cg.pt)}); }, .spirv => { const spirv_type = ip.loadSpirvType(ty.toIntern()); const result_id = cg.allocId(); switch (spirv_type.flags.tag) { - .sampler => try cg.sections.globals.emit(gpa, .OpTypeSampler, .{ .id_result = result_id }), + .sampler => try cg.module.emit(gpa, .OpTypeSampler, .{ .id_result = result_id }), .image => { const sampled_type_id = try cg.resolveType(.fromInterned(spirv_type.ty), .direct); - try cg.sections.globals.emit(gpa, .OpTypeImage, .{ + try cg.module.emit(gpa, .OpTypeImage, .{ .id_result = result_id, .sampled_type = sampled_type_id, .dim = switch (spirv_type.flags.dim) { @@ -2560,7 +2247,7 @@ fn resolveType(cg: *CodeGen, ty: Type, repr: Repr) Error!Id { }, .sampled_image => { const image_ty_id = try cg.resolveType(.fromInterned(spirv_type.ty), .indirect); - try cg.sections.globals.emit(gpa, .OpTypeSampledImage, .{ + try cg.module.emit(gpa, .OpTypeSampledImage, .{ .id_result = result_id, .image_type = image_ty_id, }); @@ -2568,7 +2255,7 @@ fn resolveType(cg: *CodeGen, ty: Type, repr: Repr) Error!Id { .runtime_array => { const elem_ty: Type = .fromInterned(spirv_type.ty); const elem_ty_id = try cg.resolveType(elem_ty, .indirect); - try cg.sections.globals.emit(gpa, .OpTypeRuntimeArray, .{ + try cg.module.emit(gpa, .OpTypeRuntimeArray, .{ .id_result = result_id, .element_type = elem_ty_id, }); @@ -4061,7 +3748,7 @@ fn buildWideMul( fn generateTestEntryPoint( cg: *CodeGen, name: []const u8, - spv_decl_index: Decl.Index, + kernel_id: Id, test_id: Id, ) !void { const gpa = cg.gpa; @@ -4075,9 +3762,8 @@ fn generateTestEntryPoint( }); const ptr_anyerror_ty_id = try cg.resolveType(ptr_anyerror_ty, .direct); - const kernel_id = cg.declPtr(spv_decl_index).result_id; - - const section = &cg.sections.functions; + var section: Section = .empty; + defer section.deinit(gpa); const p_error_id = cg.allocId(); switch (target.os.tag) { @@ -4103,11 +3789,8 @@ fn generateTestEntryPoint( }, .vulkan, .opengl => { if (cg.error_buffer == null) { - const spv_err_decl_index = try cg.allocDecl(.global); - const err_buf_result_id = cg.declPtr(spv_err_decl_index).result_id; - const buffer_struct_ty_id = cg.allocId(); - try cg.sections.globals.emit(gpa, .OpTypeStruct, .{ + try cg.module.emit(gpa, .OpTypeStruct, .{ .id_result = buffer_struct_ty_id, .id_ref = &.{anyerror_ty_id}, }); @@ -4116,21 +3799,21 @@ fn generateTestEntryPoint( try cg.decorateMember(buffer_struct_ty_id, 0, .{ .offset = .{ .byte_offset = 0 } }); const ptr_buffer_struct_ty_id = cg.allocId(); - try cg.sections.globals.emit(gpa, .OpTypePointer, .{ + try cg.module.emit(gpa, .OpTypePointer, .{ .id_result = ptr_buffer_struct_ty_id, .storage_class = cg.storageClass(.global), .type = buffer_struct_ty_id, }); - try cg.sections.globals.emit(gpa, .OpVariable, .{ + const error_buffer_id = cg.allocId(); + cg.error_buffer = error_buffer_id; + try cg.module.emit(gpa, .OpVariable, .{ .id_result_type = ptr_buffer_struct_ty_id, - .id_result = err_buf_result_id, + .id_result = error_buffer_id, .storage_class = cg.storageClass(.global), }); - try cg.decorate(err_buf_result_id, .{ .descriptor_set = .{ .descriptor_set = 0 } }); - try cg.decorate(err_buf_result_id, .{ .binding = .{ .binding_point = 0 } }); - - cg.error_buffer = spv_err_decl_index; + try cg.decorate(error_buffer_id, .{ .descriptor_set = .{ .descriptor_set = 0 } }); + try cg.decorate(error_buffer_id, .{ .binding = .{ .binding_point = 0 } }); } const void_ty_id = try cg.resolveType(.void, .direct); @@ -4145,10 +3828,7 @@ fn generateTestEntryPoint( .id_result = cg.allocId(), }); - const spv_err_decl_index = cg.error_buffer.?; - const buffer_id = cg.declPtr(spv_err_decl_index).result_id; - try cg.decl_deps.append(gpa, spv_err_decl_index); - + const buffer_id = cg.error_buffer.?; const zero_id = try cg.constInt(.u32, 0); try section.emit(gpa, .OpInBoundsAccessChain, .{ .id_result_type = ptr_anyerror_ty_id, @@ -4176,17 +3856,17 @@ fn generateTestEntryPoint( }); try section.emit(gpa, .OpReturn, {}); try section.emit(gpa, .OpFunctionEnd, {}); + try cg.module.append(gpa, section); // Just generate a quick other name because the intel runtime crashes when the entry- // point name is the same as a different OpName. - const test_name = try std.fmt.allocPrint(cg.arena, "test {s}", .{name}); - - const ep_gop = try cg.entry_points.getOrPut(cg.gpa, cg.declPtr(spv_decl_index).result_id); - ep_gop.value_ptr.* = .{ - .decl_index = spv_decl_index, + const test_name = try std.fmt.allocPrint(gpa, "test {s}", .{name}); + errdefer gpa.free(test_name); + try cg.entry_points.append(gpa, .{ + .id = kernel_id, .name = test_name, .cc = .{ .spirv_kernel = .{ .x = 1, .y = 1, .z = 1 } }, - }; + }); } fn intFromBool(cg: *CodeGen, value: Temporary, result_ty: Type) !Temporary { @@ -4456,6 +4136,7 @@ fn genInst(cg: *CodeGen, inst: Air.Inst.Index) Error!void { .ptr_elem_ptr => try cg.airPtrElemPtr(inst), .ptr_elem_val => try cg.airPtrElemVal(inst), .array_elem_val => try cg.airArrayElemVal(inst), + .runtime_nav_ptr => try cg.airRuntimeNavPtr(inst), .set_union_tag => return cg.airSetUnionTag(inst), .get_union_tag => try cg.airGetUnionTag(inst), @@ -5549,12 +5230,17 @@ fn airSelect(cg: *CodeGen, inst: Air.Inst.Index) !?Id { } fn airSplat(cg: *CodeGen, inst: Air.Inst.Index) !?Id { + const gpa = cg.gpa; + const zcu = cg.zcu; const ty_op = cg.air.instructions.items(.data)[@backingInt(inst)].ty_op; - const operand_id = try cg.resolve(ty_op.operand); const result_ty = cg.typeOfIndex(inst); - return try cg.constructCompositeSplat(result_ty, operand_id); + const scratch_top = cg.id_scratch.items.len; + defer cg.id_scratch.shrinkRetainingCapacity(scratch_top); + const constituents = try cg.id_scratch.addManyAsSlice(gpa, @intCast(result_ty.arrayLen(zcu))); + @memset(constituents, operand_id); + return try cg.constructComposite(try cg.resolveType(result_ty, .direct), constituents); } fn airReduce(cg: *CodeGen, inst: Air.Inst.Index) !?Id { @@ -6767,6 +6453,11 @@ fn ptrElemPtr(cg: *CodeGen, ptr_ty: Type, ptr_id: Id, index_id: Id) !Id { } } +fn airRuntimeNavPtr(cg: *CodeGen, inst: Air.Inst.Index) !?Id { + const ty_nav = cg.air.instructions.items(.data)[@backingInt(inst)].ty_nav; + return try cg.resolveNav(ty_nav.nav); +} + fn airPtrElemPtr(cg: *CodeGen, inst: Air.Inst.Index) !?Id { const zcu = cg.zcu; const ty_pl = cg.air.instructions.items(.data)[@backingInt(inst)].ty_pl; @@ -6849,38 +6540,27 @@ fn airSetUnionTag(cg: *CodeGen, inst: Air.Inst.Index) !void { const bin_op = cg.air.instructions.items(.data)[@backingInt(inst)].bin_op; const un_ptr_ty = cg.typeOf(bin_op.lhs); const un_ty = un_ptr_ty.childType(zcu); - const layout = cg.unionLayout(un_ty); - - if (layout.tag_size == 0) return; - - const tag_ty = un_ty.unionTagTypeRuntime(zcu).?; + const tag_ty = un_ty.unionTagTypeRuntime(zcu) orelse return; const tag_ty_id = try cg.resolveType(tag_ty, .indirect); const tag_ptr_ty_id = try cg.ptrType(tag_ty_id, cg.storageClass(un_ptr_ty.ptrAddressSpace(zcu))); - const union_ptr_id = try cg.resolve(bin_op.lhs); const new_tag_id = try cg.resolve(bin_op.rhs); - - if (!layout.has_payload) { - try cg.store(tag_ty, union_ptr_id, new_tag_id, .{ .is_volatile = un_ptr_ty.isVolatilePtr(zcu) }); - } else { - const ptr_id = try cg.accessChain(tag_ptr_ty_id, union_ptr_id, &.{layout.tag_index}); - try cg.store(tag_ty, ptr_id, new_tag_id, .{ .is_volatile = un_ptr_ty.isVolatilePtr(zcu) }); - } + const ptr_id = if (un_ty.unionHasAllZeroBitFieldTypes(zcu)) + union_ptr_id + else + try cg.accessChain(tag_ptr_ty_id, union_ptr_id, &.{zcu.typeToUnion(un_ty).?.field_types.len}); + try cg.store(tag_ty, ptr_id, new_tag_id, .{ .is_volatile = un_ptr_ty.isVolatilePtr(zcu) }); } fn airGetUnionTag(cg: *CodeGen, inst: Air.Inst.Index) !?Id { + const zcu = cg.zcu; const ty_op = cg.air.instructions.items(.data)[@backingInt(inst)].ty_op; const un_ty = cg.typeOf(ty_op.operand); - - const zcu = cg.zcu; - const layout = cg.unionLayout(un_ty); - if (layout.tag_size == 0) return null; - + const tag_ty = un_ty.unionTagTypeRuntime(zcu) orelse return null; const union_handle = try cg.resolve(ty_op.operand); - if (!layout.has_payload) return union_handle; - - const tag_ty = un_ty.unionTagTypeRuntime(zcu).?; - return try cg.extractField(tag_ty, union_handle, layout.tag_index); + if (un_ty.unionHasAllZeroBitFieldTypes(zcu)) return union_handle; + const tag_member = zcu.typeToUnion(un_ty).?.field_types.len; + return try cg.extractField(tag_ty, union_handle, tag_member); } fn unionInit( @@ -6905,6 +6585,29 @@ fn unionInit( const payload_ty: Type = .fromInterned(union_ty.field_types.get(ip)[active_field]); assert(union_ty.layout != .@"packed"); + if (union_ty.layout == .auto) { + if (ty.unionHasAllZeroBitFieldTypes(zcu)) { + const runtime_tag_ty = ty.unionTagTypeRuntime(zcu).?; + const tag_val = try pt.enumValueFieldIndex(runtime_tag_ty, active_field); + return try cg.constant(runtime_tag_ty, tag_val, .indirect); + } + const ty_id = try cg.resolveType(ty, .indirect); + const tmp_id = try cg.alloc(ty_id, null); + if (payload) |payload_id| { + const payload_ty_id = try cg.resolveType(payload_ty, .indirect); + const ptr_ty_id = try cg.ptrType(payload_ty_id, .function); + const payload_ptr_id = try cg.accessChain(ptr_ty_id, tmp_id, &.{active_field}); + try cg.store(payload_ty, payload_ptr_id, payload_id, .{}); + } + if (ty.unionTagTypeRuntime(zcu)) |runtime_tag_ty| { + const tag_val = try pt.enumValueFieldIndex(runtime_tag_ty, active_field); + const tag_id = try cg.constant(runtime_tag_ty, tag_val, .indirect); + const tag_ptr_ty_id = try cg.ptrType(try cg.resolveType(runtime_tag_ty, .indirect), .function); + const tag_ptr_id = try cg.accessChain(tag_ptr_ty_id, tmp_id, &.{union_ty.field_types.len}); + try cg.store(runtime_tag_ty, tag_ptr_id, tag_id, .{}); + } + return try cg.load(ty, tmp_id, .{}); + } const tag_int = if (layout.tag_size != 0) blk: { const tag_val = try pt.enumValueFieldIndex(tag_ty, active_field); @@ -7033,7 +6736,8 @@ fn airAggFieldVal(cg: *CodeGen, inst: Air.Inst.Index) !?Id { if (field_ty.isInt(zcu)) return result_id; return try cg.bitCast(field_ty, int_ty, result_id); }, - else => { + .auto => return try cg.extractField(field_ty, object_id, field_index), + .@"extern" => { // Store, ptr-elem-ptr, pointer-cast, load const layout = cg.unionLayout(object_ty); assert(layout.has_payload); @@ -7163,7 +6867,11 @@ fn structFieldPtr( }, .@"union" => switch (object_ty.containerLayout(zcu)) { .@"packed" => return cg.todo("implement field access for packed unions", .{}), - .auto, .@"extern" => { + .auto => { + if (!result_ptr_ty.childType(zcu).hasRuntimeBits(zcu)) return try cg.constUndef(result_ty_id); + return try cg.accessChain(result_ty_id, object_ptr, &.{field_index}); + }, + .@"extern" => { const layout = cg.unionLayout(object_ty); if (!layout.has_payload) { // Asked to get a pointer to a zero-sized field. Just lower this @@ -7272,7 +6980,7 @@ fn airAlloc(cg: *CodeGen, inst: Air.Inst.Index) !?Id { fn airArg(cg: *CodeGen) Id { defer cg.next_arg_index += 1; - return cg.args.items[cg.next_arg_index]; + return cg.args.items(.id)[cg.next_arg_index]; } /// Given a slice of incoming block connections, returns the block-id of the next @@ -8669,7 +8377,7 @@ fn airDbgStmt(cg: *CodeGen, inst: Air.Inst.Index) !void { if (zcu.comp.config.root_strip) return; const path_id = cg.allocId(); - try cg.sections.debug_strings.emit(cg.gpa, .OpString, .{ + try cg.module.emit(cg.gpa, .OpString, .{ .id_result = path_id, .string = path, }); @@ -8942,18 +8650,15 @@ fn builtin3D( const ptr_ty_id = try cg.ptrType(vec_ty_id, .input); const builtins_gop = try cg.builtins.getOrPut(gpa, .{ built_in, .input }); if (!builtins_gop.found_existing) { - builtins_gop.value_ptr.* = try cg.allocDecl(.global); - const decl = cg.declPtr(builtins_gop.value_ptr.*); - try cg.sections.globals.emit(gpa, .OpVariable, .{ + builtins_gop.value_ptr.* = cg.allocId(); + try cg.module.emit(gpa, .OpVariable, .{ .id_result_type = ptr_ty_id, - .id_result = decl.result_id, + .id_result = builtins_gop.value_ptr.*, .storage_class = .input, }); - try cg.decorate(decl.result_id, .{ .built_in = .{ .built_in = built_in } }); + try cg.decorate(builtins_gop.value_ptr.*, .{ .built_in = .{ .built_in = built_in } }); } - const spv_decl_index = builtins_gop.value_ptr.*; - try cg.decl_deps.append(gpa, spv_decl_index); - const ptr_id = cg.declPtr(spv_decl_index).result_id; + const ptr_id = builtins_gop.value_ptr.*; const vec_id = cg.allocId(); try cg.body.emit(gpa, .OpLoad, .{ .id_result_type = vec_ty_id, diff --git a/src/codegen/spirv/Mir.zig b/src/codegen/spirv/Mir.zig index c91c362426f83d8b458bce82e2b872e9d24722ff..1cc07c0f9b2e7c20b7b848bc0928d41d28b4a8cc 100644 --- a/src/codegen/spirv/Mir.zig +++ b/src/codegen/spirv/Mir.zig @@ -1,71 +1,39 @@ const std = @import("std"); const Allocator = std.mem.Allocator; - const spec = @import("spec.zig"); const Word = spec.Word; const Id = spec.Id; - +const Section = @import("Section.zig"); const InternPool = @import("../../InternPool.zig"); -const CodeGen = @import("CodeGen.zig"); - const Mir = @This(); id_bound: Word, -owner_nav: InternPool.Nav.Index, -kind: CodeGen.Decl.Kind, -decl_result_id: Id, -extended_instruction_set: []const Word, -globals: []const Word, -functions: []const Word, -annotations: []const Word, -debug_names: []const Word, -debug_strings: []const Word, -execution_modes: []const Word, +module: Section, nav_refs: []const NavRef, -uav_refs: []const UavRef, -decl_deps: []const DeclDep, -internal_globals: []const Id, +externs: []const Extern, entry_points: []const EntryPoint, pub const NavRef = struct { - local_id: Id, + id: Id, nav: InternPool.Nav.Index, - kind: CodeGen.Decl.Kind, }; -pub const UavRef = struct { - local_id: Id, - val: InternPool.Index, - storage_class: spec.StorageClass, - kind: CodeGen.Decl.Kind, -}; - -pub const DeclDep = struct { - kind: CodeGen.Decl.Kind, - nav: InternPool.Nav.Index, +pub const Extern = struct { + id: Id, + name: []const u8, }; pub const EntryPoint = struct { - local_id: Id, + id: Id, name: []const u8, cc: std.builtin.CallingConvention, }; pub fn deinit(mir: *Mir, gpa: Allocator) void { - gpa.free(mir.extended_instruction_set); - gpa.free(mir.globals); - gpa.free(mir.functions); - gpa.free(mir.annotations); - gpa.free(mir.debug_names); - gpa.free(mir.debug_strings); - gpa.free(mir.execution_modes); + mir.module.deinit(gpa); gpa.free(mir.nav_refs); - gpa.free(mir.uav_refs); - gpa.free(mir.decl_deps); - gpa.free(mir.internal_globals); - for (mir.entry_points) |ep| { - gpa.free(ep.name); - } + gpa.free(mir.externs); + for (mir.entry_points) |ep| gpa.free(ep.name); gpa.free(mir.entry_points); mir.* = undefined; } diff --git a/src/codegen/spirv/Section.zig b/src/codegen/spirv/Section.zig index fcd7739c1dd3a6916a258e79ce36dae6fec3ba2c..a594d294906e666145743db33a53c7ffc4a0d0eb 100644 --- a/src/codegen/spirv/Section.zig +++ b/src/codegen/spirv/Section.zig @@ -1,91 +1,273 @@ //! Represents a section or subsection of instructions in a SPIR-V binary. Instructions can be append //! to separate sections, which can then later be merged into the final binary. -const Section = @This(); - const std = @import("std"); const Allocator = std.mem.Allocator; -const testing = std.testing; - const spec = @import("spec.zig"); -const Word = spec.Word; -const DoubleWord = @Int(.unsigned, @bitSizeOf(Word) * 2); -const Log2Word = std.math.Log2Int(Word); - const Opcode = spec.Opcode; +const InstructionHeader = spec.InstructionHeader; +const Word = spec.Word; +const Id = spec.Id; +const Section = @This(); -instructions: std.ArrayList(Word) = .empty, +instructions: std.ArrayList(Word), +ids: std.bit_set.Dynamic, -pub fn deinit(section: *Section, allocator: Allocator) void { - section.instructions.deinit(allocator); +pub const empty: Section = .{ .instructions = .empty, .ids = .{} }; + +pub const Error = error{ + OutOfMemory, + UnknownOpcode, + InvalidInstruction, + InvalidInstructionLength, + NestedFunction, + UnterminatedFunction, + UndefinedId, +}; + +pub fn fromWords(gpa: Allocator, words: []const Word, id_bound: Word) Error!Section { + var section: Section = .empty; + errdefer section.deinit(gpa); + try section.writeWords(gpa, words); + const type_widths = try gpa.alloc(u16, id_bound); + defer gpa.free(type_widths); + @memset(type_widths, 0); + var instruction_sets: std.array_hash_map.Auto(Word, spec.InstructionSet) = .empty; + defer instruction_sets.deinit(gpa); + var results: std.bit_set.Dynamic = try .initEmpty(gpa, id_bound); + defer results.deinit(gpa); + + var in_function = false; + var offset: usize = 0; + while (offset < words.len) { + const header: InstructionHeader = @bitCast(words[offset]); + const len = header.word_count; + if (len == 0 or offset + len > words.len) return error.InvalidInstructionLength; + + const inst = words[offset..][0..len]; + const op = std.enums.fromInt(Opcode, @as(u16, @truncate(inst[0]))) orelse + return error.UnknownOpcode; + const end = offset + len; + var index = offset + 1; + const list: []const spec.Operand = switch (op) { + .OpFunction => list: { + if (in_function) return error.NestedFunction; + in_function = true; + break :list op.operands(); + }, + .OpFunctionEnd => list: { + if (!in_function) return error.InvalidInstruction; + in_function = false; + break :list op.operands(); + }, + .OpSpecConstantOp => list: { + const prefix = op.operands()[0..2]; + index = try section.parseOperands(type_widths, offset, end, prefix, index); + if (index >= end) return error.InvalidInstruction; + const inner = std.enums.fromInt(Opcode, words[index]) orelse + return error.InvalidInstruction; + index += 1; + break :list inner.operands()[2..]; + }, + .OpExtInst => list: { + if (len < 5) return error.InvalidInstruction; + const set = instruction_sets.get(inst[3]) orelse return error.InvalidInstruction; + const prefix = op.operands()[0..4]; + index = try section.parseOperands(type_widths, offset, end, prefix, index); + break :list set.operands(inst[4]) orelse return error.InvalidInstruction; + }, + else => op.operands(), + }; + const operands_end = try section.parseOperands(type_widths, offset, end, list, index); + if (operands_end != end) return error.InvalidInstruction; + if (op.resultIndex()) |result_index| { + if (results.isSet(inst[result_index])) return error.InvalidInstruction; + results.set(inst[result_index]); + } + + switch (op) { + .OpTypeInt, .OpTypeFloat => { + type_widths[inst[1]] = std.math.cast(u16, inst[2]) orelse + return error.InvalidInstruction; + }, + .OpExtInstImport => { + const set_name = std.mem.sliceTo(std.mem.sliceAsBytes(inst[2..]), 0); + if (std.meta.stringToEnum(spec.InstructionSet, set_name)) |set| { + if (set != .core) try instruction_sets.put(gpa, inst[1], set); + } + }, + else => if (op.resultIndex() == 2) { + type_widths[inst[2]] = type_widths[inst[1]]; + }, + } + offset = end; + } + if (in_function) return error.UnterminatedFunction; + var it = section.ids.iterator(.{}); + while (it.next()) |index| { + if (!results.isSet(section.instructions.items[index])) return error.UndefinedId; + } + + return section; +} + +pub fn deinit(section: *Section, gpa: Allocator) void { + section.instructions.deinit(gpa); + section.ids.deinit(gpa); section.* = undefined; } pub fn reset(section: *Section) void { section.instructions.clearRetainingCapacity(); + section.ids.unsetAll(); } -pub fn toWords(section: Section) []Word { - return section.instructions.items; +pub fn append(section: *Section, gpa: Allocator, other: Section) error{OutOfMemory}!void { + const offset = section.instructions.items.len; + try section.writeWords(gpa, other.instructions.items); + var it = other.ids.iterator(.{}); + while (it.next()) |index| section.ids.set(offset + index); } -/// Append the instructions from another section into this section. -pub fn append(section: *Section, allocator: Allocator, other_section: Section) !void { - try section.instructions.appendSlice(allocator, other_section.instructions.items); +pub fn ensureUnusedCapacity(section: *Section, gpa: Allocator, words: usize) !void { + try section.instructions.ensureUnusedCapacity(gpa, words); + try section.ids.resize(gpa, section.instructions.capacity, false); } -pub fn ensureUnusedCapacity( +fn parseOperands( section: *Section, - allocator: Allocator, - words: usize, -) !void { - try section.instructions.ensureUnusedCapacity(allocator, words); + type_widths: []const u16, + inst_start: usize, + inst_end: usize, + operands: []const spec.Operand, + index: usize, +) Error!usize { + const words = section.instructions.items; + var next = index; + var lists: [16][]const spec.Operand = undefined; + lists[0] = operands; + var depth: usize = 1; + while (depth > 0) { + const list = &lists[depth - 1]; + if (list.len == 0) { + depth -= 1; + continue; + } + const entry = list.*[0]; + if (next >= inst_end) { + if (entry.quantifier == .required) return error.InvalidInstruction; + list.* = &.{}; + continue; + } + if (entry.quantifier != .variadic) list.* = list.*[1..]; + const single = [_]spec.OperandKind{entry.kind}; + const kinds: []const spec.OperandKind = switch (entry.kind.category()) { + .composite => entry.kind.bases(), + else => &single, + }; + for (kinds) |base| { + if (next >= inst_end) return error.InvalidInstruction; + const is_pair_literal = entry.kind == .pair_literal_integer_id_ref; + const kind: spec.OperandKind = if (is_pair_literal and base == .literal_integer) + .literal_context_dependent_number + else + base; + switch (kind.category()) { + .id => { + if (words[next] == 0 or words[next] >= type_widths.len) { + return error.InvalidInstruction; + } + section.ids.set(next); + next += 1; + }, + .literal => switch (kind) { + .literal_string => { + next = for (words[next..inst_end], next + 1..) |word, after| { + const bytes: [4]u8 = @bitCast(word); + if (std.mem.findScalar(u8, &bytes, 0) != null) break after; + } else return error.InvalidInstruction; + }, + .literal_context_dependent_number => { + next += switch (type_widths[words[inst_start + 1]]) { + 1...32 => 1, + 33...64 => 2, + else => return error.InvalidInstruction, + }; + if (next > inst_end) return error.InvalidInstruction; + }, + .literal_spec_constant_op_integer => unreachable, + else => next += 1, + }, + .value_enum => { + const enumerant = for (kind.enumerants()) |enumerant| { + if (enumerant.value == words[next]) break enumerant; + } else return error.InvalidInstruction; + next += 1; + if (enumerant.parameters.len != 0) { + if (depth == lists.len) return error.InvalidInstruction; + lists[depth] = enumerant.parameters; + depth += 1; + } + }, + .bit_enum => { + const mask = words[next]; + next += 1; + const enumerants = kind.enumerants(); + var i = enumerants.len; + while (i > 0) { + i -= 1; + const enumerant = enumerants[i]; + if (mask & enumerant.value == 0) continue; + if (enumerant.parameters.len == 0) continue; + if (depth == lists.len) return error.InvalidInstruction; + lists[depth] = enumerant.parameters; + depth += 1; + } + }, + .composite => unreachable, + } + } + } + return next; } -/// Write an instruction and size, operands are to be inserted manually. pub fn emitRaw( section: *Section, - allocator: Allocator, + gpa: Allocator, opcode: Opcode, operand_words: usize, ) !void { const word_count = 1 + operand_words; if (word_count > std.math.maxInt(u16)) return error.OutOfMemory; - try section.instructions.ensureUnusedCapacity(allocator, word_count); - section.writeWord((@as(Word, @intCast(word_count)) << 16) | @backingInt(opcode)); + try section.ensureUnusedCapacity(gpa, word_count); + const header: InstructionHeader = .{ .opcode = opcode, .word_count = @intCast(word_count) }; + section.writeWord(@bitCast(header)); } -/// Write an entire instruction, including all operands -pub fn emitRawInstruction( +pub fn emitFormatted( section: *Section, - allocator: Allocator, - opcode: Opcode, - operands: []const Word, + gpa: Allocator, + comptime opcode: Opcode, + ids: []const Id, + comptime fmt: []const u8, + args: anytype, ) !void { - try section.emitRaw(allocator, opcode, operands.len); - section.writeWords(operands); -} - -pub fn emitAssumeCapacity( - section: *Section, - comptime opcode: spec.Opcode, - operands: opcode.Operands(), -) !void { - const word_count = instructionSize(opcode, operands); - if (word_count > std.math.maxInt(u16)) return error.OutOfMemory; - section.writeWord((@as(Word, @intCast(word_count)) << 16) | @backingInt(opcode)); - section.writeOperands(opcode.Operands(), operands); + const len = std.fmt.count(fmt, args); + const string_words = len / @sizeOf(Word) + 1; + try section.emitRaw(gpa, opcode, ids.len + string_words); + for (ids) |id| section.writeId(id); + const words = section.instructions.addManyAsSliceAssumeCapacity(string_words); + @memset(words, 0); + _ = std.fmt.bufPrint(std.mem.sliceAsBytes(words), fmt, args) catch unreachable; + for (words) |*word| word.* = std.mem.littleToNative(Word, word.*); } pub fn emit( section: *Section, - allocator: Allocator, + gpa: Allocator, comptime opcode: spec.Opcode, operands: opcode.Operands(), ) !void { - const word_count = instructionSize(opcode, operands); - if (word_count > std.math.maxInt(u16)) return error.OutOfMemory; - try section.instructions.ensureUnusedCapacity(allocator, word_count); - section.writeWord((@as(Word, @intCast(word_count)) << 16) | @backingInt(opcode)); + try section.emitRaw(gpa, opcode, opcode.instructionSize(operands) - 1); section.writeOperands(opcode.Operands(), operands); } @@ -93,18 +275,26 @@ pub fn writeWord(section: *Section, word: Word) void { section.instructions.appendAssumeCapacity(word); } -pub fn writeWords(section: *Section, words: []const Word) void { +pub fn writeWords(section: *Section, gpa: Allocator, words: []const Word) error{OutOfMemory}!void { + try section.ensureUnusedCapacity(gpa, words.len); section.instructions.appendSliceAssumeCapacity(words); } +pub const DoubleWord = @Int(.unsigned, @bitSizeOf(Word) * 2); + pub fn writeDoubleWord(section: *Section, dword: DoubleWord) void { - section.writeWords(&.{ + section.instructions.appendSliceAssumeCapacity(&.{ @truncate(dword), @truncate(dword >> @bitSizeOf(Word)), }); } -fn writeOperands(section: *Section, comptime Operands: type, operands: Operands) void { +pub fn writeId(section: *Section, id: Id) void { + section.ids.set(section.instructions.items.len); + section.instructions.appendAssumeCapacity(@backingInt(id)); +} + +pub fn writeOperands(section: *Section, comptime Operands: type, operands: Operands) void { const info = switch (@typeInfo(Operands)) { .@"struct" => |info| info, .void => return, @@ -118,19 +308,28 @@ fn writeOperands(section: *Section, comptime Operands: type, operands: Operands) pub fn writeOperand(section: *Section, comptime Operand: type, operand: Operand) void { switch (Operand) { spec.LiteralSpecConstantOpInteger => unreachable, - spec.Id => section.writeWord(@backingInt(operand)), + spec.Id => section.writeId(operand), spec.LiteralInteger => section.writeWord(operand), spec.LiteralString => section.writeString(operand), - spec.LiteralContextDependentNumber => section.writeContextDependentNumber(operand), + spec.LiteralContextDependentNumber => section.writeNumber(operand), spec.LiteralExtInstInteger => section.writeWord(operand.inst), - spec.PairLiteralIntegerIdRef => section.writeWords(&.{ operand.value, @fromBackingInt(@intCast(operand.label)) }), - spec.PairIdRefLiteralInteger => section.writeWords(&.{ @backingInt(operand.target), operand.member }), - spec.PairIdRefIdRef => section.writeWords(&.{ @backingInt(operand[0]), @backingInt(operand[1]) }), + spec.PairLiteralIntegerIdRef => { + section.writeWord(operand.value); + section.writeId(operand.label); + }, + spec.PairIdRefLiteralInteger => { + section.writeId(operand.target); + section.writeWord(operand.member); + }, + spec.PairIdRefIdRef => { + section.writeId(operand[0]); + section.writeId(operand[1]); + }, else => switch (@typeInfo(Operand)) { .@"enum" => section.writeWord(@backingInt(operand)), .optional => |info| if (operand) |child| section.writeOperand(info.child, child), .pointer => |info| { - std.debug.assert(info.size == .slice); // Should be no other pointer types in the spec. + std.debug.assert(info.size == .slice); for (operand) |item| { section.writeOperand(info.child, item); } @@ -148,20 +347,21 @@ pub fn writeOperand(section: *Section, comptime Operand: type, operand: Operand) } } -fn writeString(section: *Section, str: []const u8) void { +pub fn writeString(section: *Section, str: []const u8) void { const zero_terminated_len = str.len + 1; var i: usize = 0; while (i < zero_terminated_len) : (i += @sizeOf(Word)) { var word: Word = 0; var j: usize = 0; while (j < @sizeOf(Word) and i + j < str.len) : (j += 1) { - word |= @as(Word, str[i + j]) << @as(Log2Word, @intCast(j * @bitSizeOf(u8))); + const shift: std.math.Log2Int(Word) = @intCast(j * @bitSizeOf(u8)); + word |= @as(Word, str[i + j]) << shift; } section.instructions.appendAssumeCapacity(word); } } -fn writeContextDependentNumber(section: *Section, operand: spec.LiteralContextDependentNumber) void { +pub fn writeNumber(section: *Section, operand: spec.LiteralContextDependentNumber) void { switch (operand) { .int32 => |int| section.writeWord(@bitCast(int)), .uint32 => |int| section.writeWord(@bitCast(int)), @@ -172,17 +372,23 @@ fn writeContextDependentNumber(section: *Section, operand: spec.LiteralContextDe } } -fn writeExtendedMask(section: *Section, comptime Operand: type, operand: Operand) void { +pub fn writeExtendedMask(section: *Section, comptime Operand: type, operand: Operand) void { var mask: Word = 0; const info = @typeInfo(Operand).@"struct"; - inline for (info.field_names, info.field_types, 0..) |field_name, field_type, bit| { + comptime var bit: usize = 0; + inline for (info.field_names, info.field_types) |field_name, field_type| { switch (@typeInfo(field_type)) { - .optional => if (@field(operand, field_name) != null) { - mask |= 1 << @as(u5, @intCast(bit)); + .optional => { + if (@field(operand, field_name) != null) { + mask |= @as(Word, 1) << @intCast(bit); + } + bit += 1; }, - .bool => if (@field(operand, field_name)) { - mask |= 1 << @as(u5, @intCast(bit)); + .bool => { + if (@field(operand, field_name)) mask |= @as(Word, 1) << @intCast(bit); + bit += 1; }, + .int => bit += @bitSizeOf(field_type), else => unreachable, } } @@ -191,86 +397,22 @@ fn writeExtendedMask(section: *Section, comptime Operand: type, operand: Operand inline for (info.field_names, info.field_types) |field_name, field_type| { switch (@typeInfo(field_type)) { - .optional => |opt_info| if (@field(operand, field_name)) |child| { - section.writeOperands(opt_info.child, child); + .optional => |opt_info| { + if (@field(operand, field_name)) |child| { + section.writeOperands(opt_info.child, child); + } }, - .bool => {}, + .bool, .int => {}, else => unreachable, } } } -fn writeExtendedUnion(section: *Section, comptime Operand: type, operand: Operand) void { +pub fn writeExtendedUnion(section: *Section, comptime Operand: type, operand: Operand) void { return switch (operand) { inline else => |op, tag| { section.writeWord(@backingInt(tag)); - section.writeOperands( - @FieldType(Operand, @tagName(tag)), - op, - ); - }, - }; -} - -fn instructionSize(comptime opcode: spec.Opcode, operands: opcode.Operands()) usize { - return operandsSize(opcode.Operands(), operands) + 1; -} - -fn operandsSize(comptime Operands: type, operands: Operands) usize { - const info = switch (@typeInfo(Operands)) { - .@"struct" => |info| info, - .void => return 0, - else => unreachable, - }; - - var total: usize = 0; - inline for (info.field_names, info.field_types) |field_name, field_type| { - total += operandSize(field_type, @field(operands, field_name)); - } - - return total; -} - -fn operandSize(comptime Operand: type, operand: Operand) usize { - return switch (Operand) { - spec.LiteralSpecConstantOpInteger => unreachable, - spec.Id, spec.LiteralInteger, spec.LiteralExtInstInteger => 1, - spec.LiteralString => @divCeil(operand.len + 1, @sizeOf(Word)), - spec.LiteralContextDependentNumber => switch (operand) { - .int32, .uint32, .float32 => 1, - .int64, .uint64, .float64 => 2, - }, - spec.PairLiteralIntegerIdRef, spec.PairIdRefLiteralInteger, spec.PairIdRefIdRef => 2, - else => switch (@typeInfo(Operand)) { - .@"enum" => 1, - .optional => |info| if (operand) |child| operandSize(info.child, child) else 0, - .pointer => |info| blk: { - std.debug.assert(info.size == .slice); // Should be no other pointer types in the spec. - var total: usize = 0; - for (operand) |item| { - total += operandSize(info.child, item); - } - break :blk total; - }, - .@"struct" => |struct_info| { - if (struct_info.layout == .@"packed") return 1; - - var total: usize = 0; - inline for (struct_info.field_names, struct_info.field_types) |field_name, field_type| { - switch (@typeInfo(field_type)) { - .optional => |info| if (@field(operand, field_name)) |child| { - total += operandsSize(info.child, child); - }, - .bool => {}, - else => unreachable, - } - } - return total + 1; // Add one for the mask itself. - }, - .@"union" => switch (operand) { - inline else => |op, tag| operandsSize(@FieldType(Operand, @tagName(tag)), op) + 1, - }, - else => unreachable, + section.writeOperands(@FieldType(Operand, @tagName(tag)), op); }, }; } diff --git a/src/link.zig b/src/link.zig index c97c752517928551c1753933a9c512417cb9e434..0096023099d00dcdd59e42a4e3e1cae12e777e47 100644 --- a/src/link.zig +++ b/src/link.zig @@ -1319,7 +1319,7 @@ pub const File = struct { .macho => MachO, .c => C, .wasm => Wasm, - .spirv => SpirV, + .spirv => Spirv, .lld => Lld, .plan9 => comptime unreachable, .spork8 => Spork8, @@ -1423,7 +1423,7 @@ pub const File = struct { pub const Elf = @import("link/Elf.zig"); pub const Elf2 = @import("link/Elf2.zig"); pub const MachO = @import("link/MachO.zig"); - pub const SpirV = @import("link/SpirV.zig"); + pub const Spirv = @import("link/Spirv.zig"); pub const Wasm = @import("link/Wasm.zig"); pub const Dwarf = @import("link/Dwarf.zig"); pub const Dwarf2 = @import("link/Dwarf2.zig"); diff --git a/src/link/SpirV.zig b/src/link/SpirV.zig deleted file mode 100644 index 30b020985091d2b62bcb0358da3ff90d61f2b69d..0000000000000000000000000000000000000000 --- a/src/link/SpirV.zig +++ /dev/null @@ -1,1216 +0,0 @@ -const std = @import("std"); -const Allocator = std.mem.Allocator; -const Path = std.Build.Cache.Path; -const assert = std.debug.assert; -const log = std.log.scoped(.link); -const zig_version = @import("builtin").zig_version; -const Zcu = @import("../Zcu.zig"); -const InternPool = @import("../InternPool.zig"); -const Compilation = @import("../Compilation.zig"); -const link = @import("../link.zig"); -const Air = @import("../Air.zig"); -const Type = @import("../Type.zig"); -const codegen = @import("../codegen.zig"); -const CodeGen = @import("../codegen/spirv/CodeGen.zig"); -const BinaryModule = @import("SpirV/BinaryModule.zig"); -const lower_invocation_globals = @import("SpirV/lower_invocation_globals.zig"); -const dedup_types = @import("SpirV/dedup_types.zig"); -const prune_unused = @import("SpirV/prune_unused.zig"); -const spec = @import("../codegen/spirv/spec.zig"); -const Section = @import("../codegen/spirv/Section.zig"); -const Id = spec.Id; -const Word = spec.Word; -const Mir = @import("../codegen/spirv/Mir.zig"); - -const Linker = @This(); - -base: link.File, -fragments: std.array_hash_map.Auto(InternPool.Nav.Index, Mir) = .empty, -pending_navs: std.ArrayList(InternPool.Nav.Index) = .empty, -entry_points: std.ArrayList(EntryPointDecl) = .empty, -external_objects: std.ArrayList(ExternalObject) = .empty, - -const EntryPointDecl = struct { - nav: InternPool.Nav.Index, - name: []const u8, - cc: std.builtin.CallingConvention, -}; - -const ExternalObject = struct { - instructions: []const Word, - id_bound: u32, -}; - -pub fn createEmpty( - arena: Allocator, - comp: *Compilation, - emit: Path, - options: link.File.OpenOptions, -) !*Linker { - const io = comp.io; - const target = &comp.root_mod.resolved_target.result; - - assert(!comp.config.use_lld); // Caught by Compilation.Config.resolve - assert(!comp.config.use_llvm); // Caught by Compilation.Config.resolve - assert(target.ofmt == .spirv); // Caught by Compilation.Config.resolve - switch (target.cpu.arch) { - .spirv32, .spirv64 => {}, - else => unreachable, // Caught by Compilation.Config.resolve. - } - switch (target.os.tag) { - .opencl, .opengl, .vulkan => {}, - else => unreachable, // Caught by Compilation.Config.resolve. - } - - const linker = try arena.create(Linker); - linker.* = .{ - .base = .{ - .tag = .spirv, - .comp = comp, - .emit = emit, - .gc_sections = options.gc_sections orelse false, - .print_gc_sections = options.print_gc_sections, - .stack_size = options.stack_size orelse 0, - .allow_shlib_undefined = options.allow_shlib_undefined orelse false, - .file = null, - .build_id = options.build_id, - }, - }; - errdefer linker.deinit(); - - linker.base.file = try emit.root_dir.handle.createFile(io, emit.sub_path, .{ - .truncate = true, - .read = true, - }); - - return linker; -} - -pub fn open( - arena: Allocator, - comp: *Compilation, - emit: Path, - options: link.File.OpenOptions, -) !*Linker { - return createEmpty(arena, comp, emit, options); -} - -pub fn deinit(linker: *Linker) void { - const gpa = linker.base.comp.gpa; - for (linker.fragments.values()) |*mir| { - mir.deinit(gpa); - } - linker.fragments.deinit(gpa); - linker.pending_navs.deinit(gpa); - linker.entry_points.deinit(gpa); - for (linker.external_objects.items) |obj| { - gpa.free(obj.instructions); - } - linker.external_objects.deinit(gpa); -} - -pub fn loadInput(linker: *Linker, input: link.Input) !void { - switch (input) { - .object => |obj| { - const comp = linker.base.comp; - const gpa = comp.gpa; - const io = comp.io; - const diags = &comp.link_diags; - - const stat = obj.file.stat(io) catch |err| - return diags.fail("failed to stat SPIR-V object '{f}': {t}", .{ obj.path, err }); - const file_size = std.math.cast(usize, stat.size) orelse - return diags.fail("SPIR-V object '{f}' is too large", .{obj.path}); - if (file_size < 5 * @sizeOf(Word)) - return diags.fail("SPIR-V object '{f}' is too small to contain a valid header", .{obj.path}); - if (file_size % @sizeOf(Word) != 0) - return diags.fail("SPIR-V object '{f}' size is not a multiple of the word size", .{obj.path}); - - const word_count = file_size / @sizeOf(Word); - const all_words = try gpa.alloc(Word, word_count); - defer gpa.free(all_words); - - const bytes = std.mem.sliceAsBytes(all_words); - const n_read = obj.file.readPositionalAll(io, bytes, 0) catch |err| - return diags.fail("failed to read SPIR-V object '{f}': {t}", .{ obj.path, err }); - if (n_read != bytes.len) - return diags.fail("SPIR-V object '{f}': incomplete read", .{obj.path}); - - const needs_swap = all_words[0] == @byteSwap(spec.magic_number); - if (needs_swap) { - for (all_words) |*w| w.* = @byteSwap(w.*); - } - - if (all_words[0] != spec.magic_number) - return diags.fail("SPIR-V object '{f}': invalid magic number", .{obj.path}); - - const id_bound = all_words[3]; - const instructions = try gpa.dupe(Word, all_words[5..]); - errdefer gpa.free(instructions); - - // OpCapability instructions appear at the top of the module - // so we can stop scanning as soon as we hit anything else. - var it: BinaryModule.Instruction.Iterator = .init(instructions, 0); - const has_linkage = while (it.next()) |inst| switch (inst.opcode) { - .OpCapability => { - const cap: spec.Capability = @fromBackingInt(@intCast(inst.operands[0])); - if (cap == .linkage) break true; - }, - else => break false, - } else false; - if (!has_linkage) { - return diags.fail("SPIR-V object '{f}' is missing the Linkage capability and cannot be linked", .{obj.path}); - } - - try linker.external_objects.append(gpa, .{ - .instructions = instructions, - .id_bound = id_bound, - }); - }, - else => { - const diags = &linker.base.comp.link_diags; - return diags.fail("unsupported link input for SPIR-V target", .{}); - }, - } -} - -pub fn updateFunc( - linker: *Linker, - pt: Zcu.PerThread, - func_index: InternPool.Index, - mir: *codegen.AnyMir, -) !void { - const gpa = linker.base.comp.gpa; - const nav = pt.zcu.funcInfo(func_index).owner_nav; - - if (linker.fragments.getPtr(nav)) |existing| { - existing.deinit(gpa); - } - - try linker.fragments.put(gpa, nav, mir.spirv); - mir.spirv = .{ - .extended_instruction_set = &.{}, - .globals = &.{}, - .functions = &.{}, - .annotations = &.{}, - .debug_names = &.{}, - .debug_strings = &.{}, - .execution_modes = &.{}, - .id_bound = 0, - .owner_nav = mir.spirv.owner_nav, - .kind = mir.spirv.kind, - .decl_result_id = .none, - .nav_refs = &.{}, - .uav_refs = &.{}, - .decl_deps = &.{}, - .internal_globals = &.{}, - .entry_points = &.{}, - }; -} - -pub fn updateNav(linker: *Linker, pt: Zcu.PerThread, nav: InternPool.Nav.Index) link.Error!void { - const ip = &pt.zcu.intern_pool; - log.debug("deferring nav {f}({d}) to flush", .{ ip.getNav(nav).fqn.fmt(ip), nav }); - - const gpa = linker.base.comp.gpa; - linker.pending_navs.append(gpa, nav) catch return error.OutOfMemory; -} - -pub fn updateExports( - linker: *Linker, - pt: Zcu.PerThread, - export_indices: []const Zcu.Export.Index, -) link.Error!void { - const zcu = pt.zcu; - const ip = &zcu.intern_pool; - const gpa = linker.base.comp.gpa; - for (export_indices) |exp_index| { - const exp = exp_index.ptr(zcu); - const nav_index = switch (exp.exported) { - .nav => |nav| nav, - .uav => @panic("TODO: implement Linker linker code for exporting a constant value"), - }; - const nav_ty = ip.getNav(nav_index).resolved.?.type; - if (ip.isFunctionType(nav_ty)) { - const cc = Type.fromInterned(nav_ty).fnCallingConvention(zcu); - try linker.entry_points.append(gpa, .{ - .nav = nav_index, - .name = exp.opts.name.toSlice(ip), - .cc = cc, - }); - } - } -} - -pub fn flush( - linker: *Linker, - arena: Allocator, - tid: Zcu.PerThread.Id, - prog_node: std.Progress.Node, -) link.Error!void { - const sub_prog_node = prog_node.start("Flush Module", 0); - defer sub_prog_node.end(); - - const comp = linker.base.comp; - const diags = &comp.link_diags; - const gpa = comp.gpa; - const io = comp.io; - - if (comp.zcu) |zcu| { - const active = zcu.activate(tid); - defer active.deactivate(); - const pt = active.pt; - for (linker.pending_navs.items) |nav| { - if (linker.fragments.contains(nav)) continue; - - const mir = CodeGen.generateNav(pt, nav) catch |err| switch (err) { - error.OutOfMemory => return error.OutOfMemory, - error.AlreadyReported => continue, - error.Canceled => return error.Canceled, - }; - - linker.fragments.put(gpa, nav, mir) catch return error.OutOfMemory; - } - linker.pending_navs.clearRetainingCapacity(); - } - - const merged = mergeFragments(linker, gpa, arena) catch |err| switch (err) { - error.OutOfMemory => return error.OutOfMemory, - }; - - var binary = linkModule(arena, merged.words, merged.id_bound, sub_prog_node) catch |err| switch (err) { - error.OutOfMemory => |e| return e, - else => |other| { - return diags.fail("error while linking: {s}", .{@errorName(other)}); - }, - }; - defer binary.deinit(arena); - - const header = [_]Word{ - spec.magic_number, - merged.version.toWord(), - merged.generator_id, - binary.id_bound, - 0, - }; - - var file_writer = linker.base.file.?.writer(io, &.{}); - file_writer.interface.writeSliceEndian(Word, &header, .little) catch |err| switch (err) { - error.WriteFailed => return diags.fail("failed to write: {t}", .{file_writer.err.?}), - }; - file_writer.interface.writeSliceEndian(Word, binary.instructions, .little) catch |err| switch (err) { - error.WriteFailed => return diags.fail("failed to write: {t}", .{file_writer.err.?}), - }; - file_writer.end() catch |err| switch (err) { - error.WriteFailed => return diags.fail("failed to write: {t}", .{file_writer.err.?}), - else => |e| return diags.fail("failed to write: {t}", .{e}), - }; -} - -fn linkModule(arena: Allocator, words: []const Word, id_bound: u32, progress: std.Progress.Node) !BinaryModule { - var parser = try BinaryModule.Parser.init(arena); - defer parser.deinit(); - var binary = try parser.initFromWords(words, id_bound); - try prune_unused.run(&parser, &binary); - try dedup_types.run(&parser, &binary); - try lower_invocation_globals.run(&parser, &binary, progress); - return binary; -} - -fn mergeFragments(linker: *Linker, gpa: Allocator, arena: Allocator) error{OutOfMemory}!MergedModule { - const comp = linker.base.comp; - const target = &comp.root_mod.resolved_target.result; - const maybe_ip: ?*InternPool = if (comp.zcu) |zcu| &zcu.intern_pool else null; - const is_obj = comp.config.output_mode == .Obj; - - var next_id: Word = 1; - - var nav_final_ids: std.AutoHashMapUnmanaged(InternPool.Nav.Index, Id) = .empty; - defer nav_final_ids.deinit(gpa); - - var uav_final_ids: std.AutoHashMapUnmanaged(struct { InternPool.Index, spec.StorageClass }, Id) = .empty; - defer uav_final_ids.deinit(gpa); - - var frag_infos: std.ArrayList(FragmentInfo) = .empty; - defer frag_infos.deinit(gpa); - try frag_infos.ensureTotalCapacity(gpa, @intCast(linker.fragments.count())); - - for (linker.fragments.keys(), linker.fragments.values()) |nav, *mir| { - const id_offset = next_id - 1; - frag_infos.appendAssumeCapacity(.{ .id_offset = id_offset }); - if (mir.decl_result_id != .none) { - try nav_final_ids.put(gpa, nav, @fromBackingInt(@intCast(@backingInt(mir.decl_result_id) + id_offset))); - } - next_id += mir.id_bound - 1; - } - - for (linker.fragments.values(), frag_infos.items) |*mir, frag_info| { - for (mir.nav_refs) |ref| { - if (!nav_final_ids.contains(ref.nav)) { - try nav_final_ids.put(gpa, ref.nav, @fromBackingInt(@intCast(@backingInt(ref.local_id) + frag_info.id_offset))); - } - } - for (mir.uav_refs) |ref| { - const key = .{ ref.val, ref.storage_class }; - if (!uav_final_ids.contains(key)) { - try uav_final_ids.put(gpa, key, @fromBackingInt(@intCast(@backingInt(ref.local_id) + frag_info.id_offset))); - } - } - } - - // Resolve Zig extern navs against external objects. - var ext_id_offsets: std.ArrayList(Word) = .empty; - defer ext_id_offsets.deinit(gpa); - try ext_id_offsets.ensureTotalCapacity(gpa, linker.external_objects.items.len); - - var unresolved_extern_count: u32 = 0; - var resolved_ids: std.array_hash_map.Auto(Id, void) = .empty; - defer resolved_ids.deinit(gpa); - - if (maybe_ip) |ip| { - var extern_name_map: std.array_hash_map.String(InternPool.Nav.Index) = .empty; - defer extern_name_map.deinit(gpa); - - var nav_it = nav_final_ids.iterator(); - while (nav_it.next()) |entry| { - const nav = ip.getNav(entry.key_ptr.*); - if (!nav.resolved.?.is_extern_decl) continue; - const name = if (nav.getExtern(ip)) |e| e.name.toSlice(ip) else nav.fqn.toSlice(ip); - try extern_name_map.put(gpa, name, entry.key_ptr.*); - } - - for (linker.external_objects.items) |ext_obj| { - const id_offset = next_id - 1; - ext_id_offsets.appendAssumeCapacity(id_offset); - - var it: BinaryModule.Instruction.Iterator = .init(ext_obj.instructions, 0); - while (it.next()) |inst| { - const ld = LinkageDecoration.parse(inst) orelse continue; - if (ld.linkage_type != .@"export") continue; - const remapped_id: Id = @fromBackingInt(@intCast(@backingInt(ld.target_id) + id_offset)); - - if (extern_name_map.get(ld.name)) |nav_index| { - log.debug("extern resolve: '{s}' -> ext_fn_id={d}", .{ ld.name, @backingInt(remapped_id) }); - nav_final_ids.getPtr(nav_index).?.* = remapped_id; - _ = extern_name_map.swapRemove(ld.name); - try resolved_ids.put(gpa, remapped_id, {}); - } - } - next_id += ext_obj.id_bound - 1; - } - - unresolved_extern_count = @intCast(extern_name_map.count()); - } else { - for (linker.external_objects.items) |ext_obj| { - ext_id_offsets.appendAssumeCapacity(next_id - 1); - next_id += ext_obj.id_bound - 1; - } - } - - var parser = BinaryModule.Parser.init(gpa) catch return error.OutOfMemory; - defer parser.deinit(); - var sections: Sections = .{}; - defer sections.deinit(gpa); - - try mergeZigFragments(linker, gpa, &parser, §ions, frag_infos.items, &nav_final_ids, &uav_final_ids, &resolved_ids, maybe_ip); - - var has_linkage = false; - try appendExternalObjects(linker, gpa, &parser, ext_id_offsets.items, §ions, &has_linkage, linker.fragments.count() == 0, is_obj, &resolved_ids); - - if (is_obj) { - for (linker.entry_points.items) |ep| { - if (ep.cc != .spirv_device) continue; - const final_id = nav_final_ids.get(ep.nav) orelse continue; - try sections.annotations.emit(gpa, .OpDecorate, .{ - .target = final_id, - .decoration = .{ .linkage_attributes = .{ .name = ep.name, .linkage_type = .@"export" } }, - }); - has_linkage = true; - } - if (unresolved_extern_count > 0) has_linkage = true; - } - - var capabilities_section = Section{}; - defer capabilities_section.deinit(gpa); - var extensions_section = Section{}; - defer extensions_section.deinit(gpa); - var memory_model_section = Section{}; - defer memory_model_section.deinit(gpa); - - try emitPreamble( - gpa, - target, - has_linkage, - &capabilities_section, - &extensions_section, - &memory_model_section, - ); - try emitEntryPoints( - linker, - gpa, - target, - §ions.entry_points, - §ions.execution_modes, - &nav_final_ids, - &uav_final_ids, - &frag_infos, - ); - - const zig_packed_version = (zig_version.major << 12) | (zig_version.minor << 7) | zig_version.patch; - if (maybe_ip) |ip| { - try emitSourceInfo(gpa, ip, zig_packed_version, §ions.debug_strings); - } - - const version: spec.Version = .{ - .major = 1, - .minor = blk: { - if (target.cpu.has(.spirv, .v1_6)) break :blk 6; - if (target.cpu.has(.spirv, .v1_5)) break :blk 5; - if (target.cpu.has(.spirv, .v1_4)) break :blk 4; - if (target.cpu.has(.spirv, .v1_3)) break :blk 3; - if (target.cpu.has(.spirv, .v1_2)) break :blk 2; - if (target.cpu.has(.spirv, .v1_1)) break :blk 1; - break :blk 0; - }, - }; - - const buffers = &[_][]const Word{ - capabilities_section.toWords(), - extensions_section.toWords(), - sections.ext_inst.toWords(), - memory_model_section.toWords(), - sections.entry_points.toWords(), - sections.execution_modes.toWords(), - sections.debug_strings.toWords(), - sections.debug_names.toWords(), - sections.annotations.toWords(), - sections.globals.toWords(), - sections.functions.toWords(), - }; - - var total_size: usize = 0; - for (buffers) |buffer| total_size += buffer.len; - const result = try arena.alloc(Word, total_size); - - var offset: usize = 0; - for (buffers) |buffer| { - @memcpy(result[offset..][0..buffer.len], buffer); - offset += buffer.len; - } - - return .{ - .words = result, - .id_bound = next_id, - .version = version, - .generator_id = (spec.zig_generator_id << 16) | zig_packed_version, - }; -} - -fn mergeZigFragments( - linker: *Linker, - gpa: Allocator, - parser: *BinaryModule.Parser, - sections: *Sections, - frag_infos: []const FragmentInfo, - nav_final_ids: *const std.AutoHashMapUnmanaged(InternPool.Nav.Index, Id), - uav_final_ids: *const std.AutoHashMapUnmanaged(struct { InternPool.Index, spec.StorageClass }, Id), - resolved_ids: *const std.array_hash_map.Auto(Id, void), - maybe_ip: ?*InternPool, -) error{OutOfMemory}!void { - for (linker.fragments.values(), frag_infos) |*mir, frag_info| { - var id_remap: std.AutoHashMapUnmanaged(Id, Id) = .empty; - defer id_remap.deinit(gpa); - - var resolved_local_ids: std.array_hash_map.Auto(Id, void) = .empty; - defer resolved_local_ids.deinit(gpa); - - for (mir.nav_refs) |ref| { - if (nav_final_ids.get(ref.nav)) |final_id| { - try id_remap.put(gpa, ref.local_id, final_id); - if (maybe_ip) |ip| { - const nav = ip.getNav(ref.nav); - if (nav.resolved.?.is_extern_decl and resolved_ids.contains(final_id)) { - try resolved_local_ids.put(gpa, ref.local_id, {}); - } - } - } - } - for (mir.uav_refs) |ref| { - if (uav_final_ids.get(.{ ref.val, ref.storage_class })) |final_id| { - try id_remap.put(gpa, ref.local_id, final_id); - } - } - - try remapAndAppend(gpa, §ions.ext_inst, mir.extended_instruction_set, frag_info.id_offset, &id_remap, parser); - try remapAndAppend(gpa, §ions.globals, mir.globals, frag_info.id_offset, &id_remap, parser); - - try remapFilteredInsts(gpa, §ions.functions, mir.functions, frag_info.id_offset, &id_remap, parser, &resolved_local_ids, .skip_functions); - try remapFilteredInsts(gpa, §ions.annotations, mir.annotations, frag_info.id_offset, &id_remap, parser, &resolved_local_ids, .skip_linkage); - try remapFilteredInsts(gpa, §ions.debug_names, mir.debug_names, frag_info.id_offset, &id_remap, parser, &resolved_local_ids, .skip_names); - try remapAndAppend(gpa, §ions.debug_strings, mir.debug_strings, frag_info.id_offset, &id_remap, parser); - try remapAndAppend(gpa, §ions.execution_modes, mir.execution_modes, frag_info.id_offset, &id_remap, parser); - - for (mir.entry_points) |ep| { - try linker.entry_points.append(gpa, .{ .nav = mir.owner_nav, .name = ep.name, .cc = ep.cc }); - } - } -} - -const FilterMode = enum { skip_functions, skip_linkage, skip_names }; - -fn remapFilteredInsts( - gpa: Allocator, - dest: *Section, - words: []const Word, - id_offset: Word, - id_remap: *const std.AutoHashMapUnmanaged(Id, Id), - parser: *BinaryModule.Parser, - skip_ids: *const std.array_hash_map.Auto(Id, void), - mode: FilterMode, -) error{OutOfMemory}!void { - if (words.len == 0) return; - var it: BinaryModule.Instruction.Iterator = .init(words, 0); - var skip_function = false; - while (it.next()) |inst| { - switch (mode) { - .skip_functions => { - if (inst.opcode == .OpFunction) { - skip_function = skip_ids.contains(@fromBackingInt(@intCast(inst.operands[1]))); - } - if (skip_function) { - if (inst.opcode == .OpFunctionEnd) skip_function = false; - continue; - } - }, - .skip_linkage => { - if (LinkageDecoration.parse(inst)) |ld| { - if (skip_ids.contains(ld.target_id)) continue; - } - }, - .skip_names => { - if (inst.opcode == .OpName and inst.operands.len >= 1) { - if (skip_ids.contains(@fromBackingInt(@intCast(inst.operands[0])))) continue; - } - }, - } - try remapAndAppendInst(gpa, dest, words, inst, id_offset, id_remap, parser); - } -} - -fn emitPreamble( - gpa: Allocator, - target: *const std.Target, - has_linkage: bool, - capabilities: *Section, - extensions: *Section, - memory_model: *Section, -) !void { - var caps: std.EnumSet(spec.Capability) = .empty; - var exts: std.StringHashMapUnmanaged(void) = .empty; - defer exts.deinit(gpa); - - switch (target.os.tag) { - .opengl, .vulkan => caps.insert(.shader), - .opencl, .amdhsa => { - caps.insert(.kernel); - caps.insert(.addresses); - }, - else => unreachable, - } - if (target.cpu.arch == .spirv64) { - caps.insert(.int64); - if (target.os.tag == .vulkan) { - caps.insert(.physical_storage_buffer_addresses); - try exts.put(gpa, "SPV_KHR_physical_storage_buffer", {}); - } - } - if (has_linkage) caps.insert(.linkage); - - inline for (@typeInfo(spec.Capability).@"enum".field_names) |cap_name| { - if (@hasField(std.Target.spirv.Feature, cap_name)) { - if (target.cpu.has(.spirv, @field(std.Target.spirv.Feature, cap_name))) - caps.insert(@field(spec.Capability, cap_name)); - } - } - inline for (@typeInfo(spec.Extension).@"enum".field_names) |ext_name| { - switch (@field(spec.Extension, ext_name)) { - .v1_0, .v1_1, .v1_2, .v1_3, .v1_4, .v1_5, .v1_6 => {}, - else => if (@hasField(std.Target.spirv.Feature, ext_name)) { - if (target.cpu.has(.spirv, @field(std.Target.spirv.Feature, ext_name))) - try exts.put(gpa, ext_name, {}); - }, - } - } - - var cit = caps.iterator(); - while (cit.next()) |cap| try capabilities.emit(gpa, .OpCapability, .{ .capability = cap }); - var eit = exts.iterator(); - while (eit.next()) |e| try extensions.emit(gpa, .OpExtension, .{ .name = e.key_ptr.* }); - - const addressing_model: spec.AddressingModel = switch (target.os.tag) { - .opengl => .logical, - .vulkan => switch (target.cpu.arch) { - .spirv32 => .logical, - .spirv64 => .physical_storage_buffer64, - else => unreachable, - }, - .opencl => switch (target.cpu.arch) { - .spirv32 => .physical32, - .spirv64 => .physical64, - else => unreachable, - }, - .amdhsa => .physical64, - else => unreachable, - }; - try memory_model.emit(gpa, .OpMemoryModel, .{ - .addressing_model = addressing_model, - .memory_model = switch (target.os.tag) { - .opencl => .open_cl, - .vulkan, .opengl => .glsl450, - .amdhsa => unreachable, // TODO - else => unreachable, - }, - }); -} - -fn emitEntryPoints( - linker: *Linker, - gpa: Allocator, - target: *const std.Target, - entry_points_section: *Section, - execution_modes_section: *Section, - nav_final_ids: *const std.AutoHashMapUnmanaged(InternPool.Nav.Index, Id), - uav_final_ids: *const std.AutoHashMapUnmanaged(struct { InternPool.Index, spec.StorageClass }, Id), - frag_infos: *const std.ArrayList(FragmentInfo), -) error{OutOfMemory}!void { - for (linker.entry_points.items) |ep| { - const final_id = nav_final_ids.get(ep.nav) orelse continue; - - var interface: std.ArrayList(Id) = .empty; - defer interface.deinit(gpa); - var visited: std.AutoHashMapUnmanaged(InternPool.Nav.Index, void) = .empty; - defer visited.deinit(gpa); - try collectEntryPointInterface(linker, ep.nav, &interface, &visited, nav_final_ids, uav_final_ids, frag_infos, gpa); - - const exec_model: spec.ExecutionModel = switch (target.os.tag) { - .vulkan, .opengl => switch (ep.cc) { - .spirv_vertex => .vertex, - .spirv_fragment => .fragment, - .spirv_kernel => .gl_compute, - .spirv_task => .task_ext, - .spirv_mesh => .mesh_ext, - .spirv_device => continue, - else => unreachable, - }, - .opencl => switch (ep.cc) { - .spirv_kernel => .kernel, - .spirv_device => continue, - else => unreachable, - }, - else => unreachable, - }; - - try entry_points_section.emit(gpa, .OpEntryPoint, .{ - .execution_model = exec_model, - .entry_point = final_id, - .name = ep.name, - .interface = interface.items, - }); - - switch (ep.cc) { - .spirv_kernel, .spirv_task => |kernel| { - try execution_modes_section.emit(gpa, .OpExecutionMode, .{ - .entry_point = final_id, - .mode = .{ .local_size = .{ .x_size = kernel.x, .y_size = kernel.y, .z_size = kernel.z } }, - }); - }, - .spirv_fragment => |fragment| { - try execution_modes_section.emit(gpa, .OpExecutionMode, .{ - .entry_point = final_id, - .mode = if (target.os.tag == .vulkan) .origin_upper_left else .origin_lower_left, - }); - if (fragment.pixel_centered_integer) { - try execution_modes_section.emit(gpa, .OpExecutionMode, .{ - .entry_point = final_id, - .mode = .pixel_center_integer, - }); - } - const exec_mode: ?spec.ExecutionMode.Extended = switch (fragment.depth_assumption) { - .none => null, - .greater => .depth_greater, - .less => .depth_less, - .unchanged => .depth_unchanged, - }; - if (exec_mode) |mode| { - try execution_modes_section.emit(gpa, .OpExecutionMode, .{ - .entry_point = final_id, - .mode = mode, - }); - } - }, - .spirv_mesh => |mesh| { - try execution_modes_section.emit(gpa, .OpExecutionMode, .{ - .entry_point = final_id, - .mode = .{ .output_vertices = .{ .vertex_count = mesh.max_vertices } }, - }); - try execution_modes_section.emit(gpa, .OpExecutionMode, .{ - .entry_point = final_id, - .mode = .{ .output_primitives_ext = .{ .primitive_count = mesh.max_primitives } }, - }); - try execution_modes_section.emit(gpa, .OpExecutionMode, .{ - .entry_point = final_id, - .mode = .{ .local_size = .{ .x_size = mesh.x, .y_size = mesh.y, .z_size = mesh.z } }, - }); - try execution_modes_section.emit(gpa, .OpExecutionMode, .{ - .entry_point = final_id, - .mode = switch (mesh.stage_output) { - .output_points => .output_points, - .output_lines => .output_lines_ext, - .output_triangles => .output_triangles_ext, - }, - }); - }, - else => {}, - } - } -} - -fn emitSourceInfo(gpa: Allocator, ip: *InternPool, version: u32, debug_strings: *Section) error{OutOfMemory}!void { - var error_info: std.Io.Writer.Allocating = .init(gpa); - defer error_info.deinit(); - error_info.writer.writeAll("zig_errors:") catch return error.OutOfMemory; - for (ip.global_error_set.getNamesFromMainThread()) |name| { - error_info.writer.writeByte(':') catch return error.OutOfMemory; - std.Uri.Component.percentEncode( - &error_info.writer, - name.toSlice(ip), - struct { - fn isValidChar(c: u8) bool { - return switch (c) { - 0, '%', ':' => false, - else => true, - }; - } - }.isValidChar, - ) catch return error.OutOfMemory; - } - try debug_strings.emit(gpa, .OpSourceExtension, .{ .extension = error_info.written() }); - try debug_strings.emit(gpa, .OpSource, .{ .source_language = .zig, .version = version, .file = null, .source = null }); -} - -const MergedModule = struct { - words: []const Word, - id_bound: Word, - version: spec.Version, - generator_id: u32, -}; - -const FragmentInfo = struct { - id_offset: Word, -}; - -const LinkageDecoration = struct { - target_id: Id, - name: []const u8, - linkage_type: spec.LinkageType, - - fn parse(inst: BinaryModule.Instruction) ?LinkageDecoration { - if (inst.opcode != .OpDecorate) return null; - if (inst.operands.len < 3) return null; - if (inst.operands[1] != @backingInt(spec.Decoration.linkage_attributes)) return null; - return .{ - .target_id = @fromBackingInt(@intCast(inst.operands[0])), - .name = std.mem.sliceTo(std.mem.sliceAsBytes(inst.operands[2 .. inst.operands.len - 1]), 0), - .linkage_type = @fromBackingInt(@intCast(inst.operands[inst.operands.len - 1])), - }; - } -}; - -const Sections = struct { - ext_inst: Section = .{}, - globals: Section = .{}, - functions: Section = .{}, - annotations: Section = .{}, - debug_names: Section = .{}, - debug_strings: Section = .{}, - entry_points: Section = .{}, - execution_modes: Section = .{}, - - fn deinit(self: *Sections, gpa: Allocator) void { - self.ext_inst.deinit(gpa); - self.globals.deinit(gpa); - self.functions.deinit(gpa); - self.annotations.deinit(gpa); - self.debug_names.deinit(gpa); - self.debug_strings.deinit(gpa); - self.entry_points.deinit(gpa); - self.execution_modes.deinit(gpa); - } - - const SectionClass = enum { ext_inst, debug_name, debug_string, annotation, global }; - - fn classifyPreambleInst(opcode: spec.Opcode) SectionClass { - return switch (opcode) { - .OpExtInstImport => .ext_inst, - .OpName, .OpMemberName => .debug_name, - .OpString => .debug_string, - .OpDecorate, - .OpMemberDecorate, - .OpGroupDecorate, - .OpGroupMemberDecorate, - .OpDecorationGroup, - .OpDecorateId, - .OpDecorateString, - .OpMemberDecorateString, - => .annotation, - else => .global, - }; - } - - fn getSection(self: *Sections, class: SectionClass) *Section { - return switch (class) { - .ext_inst => &self.ext_inst, - .debug_name => &self.debug_names, - .debug_string => &self.debug_strings, - .annotation => &self.annotations, - .global => &self.globals, - }; - } -}; - -fn appendExternalObjects( - linker: *Linker, - gpa: Allocator, - parser: *BinaryModule.Parser, - ext_id_offsets: []const Word, - sections: *Sections, - has_linkage: *bool, - keep_entry_points: bool, - is_obj: bool, - resolved_ids: *const std.array_hash_map.Auto(Id, void), -) error{OutOfMemory}!void { - var export_map: std.array_hash_map.String(Id) = .empty; - defer export_map.deinit(gpa); - - for (linker.external_objects.items, ext_id_offsets) |ext_obj, id_offset| { - var it: BinaryModule.Instruction.Iterator = .init(ext_obj.instructions, 0); - while (it.next()) |inst| { - const ld = LinkageDecoration.parse(inst) orelse continue; - if (ld.linkage_type != .@"export") continue; - try export_map.put(gpa, ld.name, @fromBackingInt(@intCast(@backingInt(ld.target_id) + id_offset))); - } - } - - var per_obj_remaps = try gpa.alloc(std.AutoHashMapUnmanaged(Id, Id), linker.external_objects.items.len); - defer { - for (per_obj_remaps) |*m| m.deinit(gpa); - gpa.free(per_obj_remaps); - } - for (per_obj_remaps) |*m| m.* = .empty; - - var resolved_linkage_ids: std.array_hash_map.Auto(Id, void) = .empty; - defer resolved_linkage_ids.deinit(gpa); - - for (resolved_ids.keys()) |id| { - try resolved_linkage_ids.put(gpa, id, {}); - } - - for (linker.external_objects.items, ext_id_offsets, 0..) |ext_obj, id_offset, obj_idx| { - var it: BinaryModule.Instruction.Iterator = .init(ext_obj.instructions, 0); - while (it.next()) |inst| { - const ld = LinkageDecoration.parse(inst) orelse continue; - if (ld.linkage_type != .import) continue; - const remapped_import: Id = @fromBackingInt(@intCast(@backingInt(ld.target_id) + id_offset)); - - if (export_map.get(ld.name)) |export_id| { - try per_obj_remaps[obj_idx].put(gpa, ld.target_id, export_id); - try resolved_linkage_ids.put(gpa, remapped_import, {}); - try resolved_linkage_ids.put(gpa, export_id, {}); - log.debug("cross-object resolve: '{s}' import={d} -> export={d}", .{ - ld.name, @backingInt(remapped_import), @backingInt(export_id), - }); - } else { - has_linkage.* = true; - } - } - } - - for (linker.external_objects.items, ext_id_offsets, 0..) |ext_obj, id_offset, obj_idx| { - var binary = parser.initFromWords(ext_obj.instructions, ext_obj.id_bound) catch - return error.OutOfMemory; - defer binary.deinit(gpa); - - const id_remap = &per_obj_remaps[obj_idx]; - - var preamble_it: BinaryModule.Instruction.Iterator = .init(ext_obj.instructions, 0); - while (preamble_it.next()) |inst| { - if (inst.offset >= binary.functions_start) break; - - switch (inst.opcode) { - .OpCapability, - .OpExtension, - .OpMemoryModel, - .OpSource, - .OpSourceExtension, - .OpSourceContinued, - => continue, - .OpEntryPoint => { - if (keep_entry_points) - try remapAndAppendInst(gpa, §ions.entry_points, ext_obj.instructions, inst, id_offset, id_remap, parser); - continue; - }, - .OpExecutionMode, .OpExecutionModeId => { - if (keep_entry_points) - try remapAndAppendInst(gpa, §ions.execution_modes, ext_obj.instructions, inst, id_offset, id_remap, parser); - continue; - }, - else => {}, - } - - if (LinkageDecoration.parse(inst)) |ld| { - const remapped: Id = @fromBackingInt(@intCast(@backingInt(ld.target_id) + id_offset)); - if (resolved_linkage_ids.contains(remapped)) { - if (ld.linkage_type == .@"export" and is_obj) { - has_linkage.* = true; - } else { - continue; - } - } - } - - if (inst.opcode == .OpName and inst.operands.len >= 1) { - if (id_remap.contains(@fromBackingInt(@intCast(inst.operands[0])))) continue; - } - - const dest = sections.getSection(Sections.classifyPreambleInst(inst.opcode)); - try remapAndAppendInst(gpa, dest, ext_obj.instructions, inst, id_offset, id_remap, parser); - } - - var fn_it: BinaryModule.Instruction.Iterator = .init(ext_obj.instructions, binary.functions_start); - var skip_function = false; - while (fn_it.next()) |inst| { - if (inst.opcode == .OpFunction) { - skip_function = id_remap.contains(@fromBackingInt(@intCast(inst.operands[1]))); - } - if (!skip_function) { - try remapAndAppendInst(gpa, §ions.functions, ext_obj.instructions, inst, id_offset, id_remap, parser); - } - if (inst.opcode == .OpFunctionEnd) { - skip_function = false; - } - } - } -} - -fn collectEntryPointInterface( - linker: *Linker, - nav: InternPool.Nav.Index, - interface: *std.ArrayList(Id), - visited: *std.AutoHashMapUnmanaged(InternPool.Nav.Index, void), - nav_final_ids: *const std.AutoHashMapUnmanaged(InternPool.Nav.Index, Id), - uav_final_ids: *const std.AutoHashMapUnmanaged(struct { InternPool.Index, spec.StorageClass }, Id), - frag_infos: *const std.ArrayList(FragmentInfo), - gpa: Allocator, -) error{OutOfMemory}!void { - const visited_gop = try visited.getOrPut(gpa, nav); - if (visited_gop.found_existing) return; - - const frag_index = linker.fragments.getIndex(nav) orelse return; - const mir = &linker.fragments.values()[frag_index]; - const id_offset = frag_infos.items[frag_index].id_offset; - - if (mir.kind == .global) { - if (nav_final_ids.get(nav)) |final_id| { - try interface.append(gpa, final_id); - } - } - - for (mir.uav_refs) |ref| { - if (ref.kind == .global) { - if (uav_final_ids.get(.{ ref.val, ref.storage_class })) |final_id| { - try interface.append(gpa, final_id); - } - } - } - - for (mir.internal_globals) |local_id| { - const global_id: Id = @fromBackingInt(@intCast(@backingInt(local_id) + id_offset)); - try interface.append(gpa, global_id); - } - - for (mir.decl_deps) |dep| { - try collectEntryPointInterface(linker, dep.nav, interface, visited, nav_final_ids, uav_final_ids, frag_infos, gpa); - } -} - -fn remapAndAppend( - gpa: Allocator, - dest: *Section, - words: []const Word, - id_offset: Word, - id_remap: *const std.AutoHashMapUnmanaged(Id, Id), - parser: *BinaryModule.Parser, -) error{OutOfMemory}!void { - if (words.len == 0) return; - - try dest.instructions.ensureUnusedCapacity(gpa, words.len); - - var it: BinaryModule.Instruction.Iterator = .init(words, 0); - while (it.next()) |inst| { - try remapAndAppendInst(gpa, dest, words, inst, id_offset, id_remap, parser); - } -} - -fn remapAndAppendInst( - gpa: Allocator, - dest: *Section, - words: []const Word, - inst: BinaryModule.Instruction, - id_offset: Word, - id_remap: *const std.AutoHashMapUnmanaged(Id, Id), - parser: *BinaryModule.Parser, -) error{OutOfMemory}!void { - const inst_words = words[inst.offset..][0..((words[inst.offset] >> 16))]; - try dest.instructions.ensureUnusedCapacity(gpa, inst_words.len); - const dest_start = dest.instructions.items.len; - dest.instructions.appendSliceAssumeCapacity(inst_words); - const inst_slice = dest.instructions.items[dest_start..][0..inst_words.len]; - - const inst_spec = parser.getInstSpec(inst.opcode) orelse return; - var offset: usize = 0; - for (inst_spec.operands) |operand| { - const cat = operand.kind.category(); - switch (operand.quantifier) { - .required, .optional => { - if (offset >= inst.operands.len) break; - offset += remapOperand(operand.kind, cat, inst, inst_slice, offset, id_offset, id_remap); - }, - .variadic => { - while (offset < inst.operands.len) { - offset += remapOperand(operand.kind, cat, inst, inst_slice, offset, id_offset, id_remap); - } - }, - } - } -} - -fn remapOperand( - kind: spec.OperandKind, - cat: spec.OperandCategory, - inst: BinaryModule.Instruction, - inst_slice: []Word, - offset: usize, - id_offset: Word, - id_remap: *const std.AutoHashMapUnmanaged(Id, Id), -) usize { - switch (cat) { - .id => { - remapSingleId(&inst_slice[1 + offset], id_offset, id_remap); - return 1; - }, - .literal => return operandLiteralWordCount(kind, inst, offset), - .composite => { - remapCompositeOperand(kind, inst_slice, offset, id_offset, id_remap); - return 2; - }, - .bit_enum => { - const mask = inst_slice[1 + offset]; - var consumed: usize = 1; - for (kind.enumerants()) |e| { - if ((mask & e.value) == 0) continue; - for (e.parameters) |param_kind| { - if (offset + consumed >= inst.operands.len) return consumed; - consumed += remapOperand( - param_kind, - param_kind.category(), - inst, - inst_slice, - offset + consumed, - id_offset, - id_remap, - ); - } - } - return consumed; - }, - .value_enum => { - const value = inst_slice[1 + offset]; - var consumed: usize = 1; - for (kind.enumerants()) |e| { - if (e.value != value) continue; - for (e.parameters) |param_kind| { - if (offset + consumed >= inst.operands.len) return consumed; - consumed += remapOperand( - param_kind, - param_kind.category(), - inst, - inst_slice, - offset + consumed, - id_offset, - id_remap, - ); - } - break; - } - return consumed; - }, - } -} - -fn remapCompositeOperand( - kind: spec.OperandKind, - inst_slice: []Word, - offset: usize, - id_offset: Word, - id_remap: *const std.AutoHashMapUnmanaged(Id, Id), -) void { - switch (kind) { - .pair_literal_integer_id_ref => { - remapSingleId(&inst_slice[1 + offset + 1], id_offset, id_remap); - }, - .pair_id_ref_literal_integer => { - remapSingleId(&inst_slice[1 + offset], id_offset, id_remap); - }, - .pair_id_ref_id_ref => { - remapSingleId(&inst_slice[1 + offset], id_offset, id_remap); - remapSingleId(&inst_slice[1 + offset + 1], id_offset, id_remap); - }, - else => {}, - } -} - -fn operandLiteralWordCount(kind: spec.OperandKind, inst: BinaryModule.Instruction, offset: usize) usize { - return switch (kind) { - .literal_integer, .literal_float => 1, - .literal_string => blk: { - var count: usize = 0; - var off = offset; - while (off < inst.operands.len) { - const word = inst.operands[off]; - count += 1; - off += 1; - if (word & 0xFF000000 == 0 or - word & 0x00FF0000 == 0 or - word & 0x0000FF00 == 0 or - word & 0x000000FF == 0) - { - break; - } - } - break :blk count; - }, - .literal_context_dependent_number => inst.operands.len - offset, - .literal_ext_inst_integer => 1, - else => 1, - }; -} - -fn remapSingleId(word: *Word, id_offset: Word, id_remap: *const std.AutoHashMapUnmanaged(Id, Id)) void { - const id: Id = @fromBackingInt(@intCast(word.*)); - if (id == .none) return; - if (id_remap.get(id)) |final_id| { - word.* = @backingInt(final_id); - } else { - word.* = @backingInt(id) + id_offset; - } -} diff --git a/src/link/SpirV/BinaryModule.zig b/src/link/SpirV/BinaryModule.zig deleted file mode 100644 index b19cf7c4a2b4249940ffdbe025c167aefe57b883..0000000000000000000000000000000000000000 --- a/src/link/SpirV/BinaryModule.zig +++ /dev/null @@ -1,347 +0,0 @@ -const std = @import("std"); -const assert = std.debug.assert; -const Allocator = std.mem.Allocator; -const log = std.log.scoped(.spirv_parse); - -const spec = @import("../../codegen/spirv/spec.zig"); -const Opcode = spec.Opcode; -const Word = spec.Word; -const InstructionSet = spec.InstructionSet; -const ResultId = spec.Id; - -const BinaryModule = @This(); - -/// The result-id bound of this SPIR-V module. -id_bound: u32, - -/// The instructions of this module (no header). -instructions: []const Word, - -/// Maps OpExtInstImport result-ids to their InstructionSet. -ext_inst_map: std.AutoHashMapUnmanaged(ResultId, InstructionSet), - -/// Width of arithmetic types (OpTypeInt/OpTypeFloat). Needed to correctly -/// parse operands of Op(Spec)Constant and OpSwitch. -arith_type_width: std.AutoHashMapUnmanaged(ResultId, u16), - -functions_start: usize, - -pub fn deinit(bm: *BinaryModule, gpa: Allocator) void { - bm.ext_inst_map.deinit(gpa); - bm.arith_type_width.deinit(gpa); - bm.* = undefined; -} - -pub fn iterateInstructions(bm: BinaryModule) Instruction.Iterator { - return Instruction.Iterator.init(bm.instructions, 0); -} - -pub fn iterateInstructionsFrom(bm: BinaryModule, offset: usize) Instruction.Iterator { - return Instruction.Iterator.init(bm.instructions, offset); -} - -pub const Instruction = struct { - pub const Iterator = struct { - words: []const Word, - offset: usize = 0, - - pub fn init(words: []const Word, start_offset: usize) Iterator { - return .{ .words = words, .offset = start_offset }; - } - - pub fn next(it: *Iterator) ?Instruction { - if (it.offset >= it.words.len) return null; - - const instruction_len = it.words[it.offset] >> 16; - defer it.offset += instruction_len; - assert(instruction_len != 0); - assert(it.offset < it.words.len); - - return Instruction{ - .opcode = @fromBackingInt(@intCast(it.words[it.offset] & 0xFFFF)), - .offset = it.offset, - .operands = it.words[it.offset..][1..instruction_len], - }; - } - }; - - opcode: Opcode, - offset: usize, - operands: []const Word, -}; - -pub const Parser = struct { - gpa: Allocator, - opcode_table: std.AutoHashMapUnmanaged(u32, u16) = .empty, - - pub fn init(gpa: Allocator) !Parser { - var parser = Parser{ .gpa = gpa }; - errdefer parser.deinit(); - - inline for (std.meta.tags(InstructionSet)) |set| { - const instructions = set.instructions(); - try parser.opcode_table.ensureUnusedCapacity(gpa, @intCast(instructions.len)); - for (instructions, 0..) |inst, i| { - const entry = parser.opcode_table.getOrPutAssumeCapacity(mapSetAndOpcode(set, @intCast(inst.opcode))); - if (!entry.found_existing) { - entry.value_ptr.* = @intCast(i); - } - } - } - - return parser; - } - - pub fn deinit(parser: *Parser) void { - parser.opcode_table.deinit(parser.gpa); - } - - fn mapSetAndOpcode(set: InstructionSet, opcode: u16) u32 { - return (@as(u32, @backingInt(set)) << 16) | opcode; - } - - pub fn getInstSpec(parser: Parser, opcode: Opcode) ?spec.Instruction { - const index = parser.opcode_table.get(mapSetAndOpcode(.core, @backingInt(opcode))) orelse return null; - return InstructionSet.core.instructions()[index]; - } - - /// Build a BinaryModule from raw instruction words (no header). - /// Scans for ext_inst_map, arith_type_width, and the functions section offset. - pub fn initFromWords(parser: *Parser, words: []const Word, id_bound: u32) !BinaryModule { - var binary = BinaryModule{ - .id_bound = id_bound, - .instructions = words, - .ext_inst_map = .{}, - .arith_type_width = .{}, - .functions_start = undefined, - }; - - var maybe_function_section: ?usize = null; - var it = binary.iterateInstructions(); - while (it.next()) |inst| { - const inst_spec = parser.getInstSpec(inst.opcode) orelse continue; - const operands = inst.operands; - - switch (inst.opcode) { - .OpExtInstImport => { - const set_name = std.mem.sliceTo(std.mem.sliceAsBytes(operands[1..]), 0); - const set = std.meta.stringToEnum(InstructionSet, set_name) orelse continue; - if (set == .core) continue; - try binary.ext_inst_map.put(parser.gpa, @fromBackingInt(@intCast(operands[0])), set); - }, - .OpTypeInt, .OpTypeFloat => { - try binary.arith_type_width.put(parser.gpa, @fromBackingInt(@intCast(operands[0])), @intCast(operands[1])); - }, - .OpFunction => if (maybe_function_section == null) { - maybe_function_section = inst.offset; - }, - else => {}, - } - - // propagate arith type widths through instructions that return int/float - const spec_operands = inst_spec.operands; - if (spec_operands.len >= 2 and - spec_operands[0].kind == .id_result_type and - spec_operands[1].kind == .id_result) - { - if (operands.len >= 2) { - if (binary.arith_type_width.get(@fromBackingInt(@intCast(operands[0])))) |width| { - try binary.arith_type_width.put(parser.gpa, @fromBackingInt(@intCast(operands[1])), width); - } - } - } - } - - binary.functions_start = maybe_function_section orelse binary.instructions.len; - - return binary; - } - - /// Parse offsets in the instruction that contain result-ids. - /// Returned offsets are relative to inst.operands. - pub fn parseInstructionResultIds( - parser: *Parser, - binary: BinaryModule, - inst: Instruction, - offsets: *std.ArrayList(u16), - ) !void { - const index = parser.opcode_table.get(mapSetAndOpcode(.core, @backingInt(inst.opcode))).?; - const operands = InstructionSet.core.instructions()[index].operands; - - var offset: usize = 0; - switch (inst.opcode) { - .OpSpecConstantOp => { - assert(operands[0].kind == .id_result_type); - assert(operands[1].kind == .id_result); - offset = try parser.parseOperandsResultIds(binary, inst, operands[0..2], offset, offsets); - - if (offset >= inst.operands.len) return error.InvalidPhysicalFormat; - const spec_opcode = std.math.cast(u16, inst.operands[offset]) orelse return error.InvalidPhysicalFormat; - const spec_index = parser.opcode_table.get(mapSetAndOpcode(.core, spec_opcode)) orelse - return error.InvalidPhysicalFormat; - const spec_operands = InstructionSet.core.instructions()[spec_index].operands; - assert(spec_operands[0].kind == .id_result_type); - assert(spec_operands[1].kind == .id_result); - offset = try parser.parseOperandsResultIds(binary, inst, spec_operands[2..], offset + 1, offsets); - }, - .OpExtInst => { - assert(operands[0].kind == .id_result_type); - assert(operands[1].kind == .id_result); - offset = try parser.parseOperandsResultIds(binary, inst, operands[0..2], offset, offsets); - - if (offset + 1 >= inst.operands.len) return error.InvalidPhysicalFormat; - const set_id: ResultId = @fromBackingInt(@intCast(inst.operands[offset])); - try offsets.append(parser.gpa, @intCast(offset)); - const set = binary.ext_inst_map.get(set_id) orelse { - log.err("invalid instruction set {}", .{@backingInt(set_id)}); - return error.InvalidId; - }; - const ext_opcode = std.math.cast(u16, inst.operands[offset + 1]) orelse return error.InvalidPhysicalFormat; - const ext_index = parser.opcode_table.get(mapSetAndOpcode(set, ext_opcode)) orelse - return error.InvalidPhysicalFormat; - const ext_operands = set.instructions()[ext_index].operands; - offset = try parser.parseOperandsResultIds(binary, inst, ext_operands, offset + 2, offsets); - }, - else => { - offset = try parser.parseOperandsResultIds(binary, inst, operands, offset, offsets); - }, - } - - if (offset != inst.operands.len) return error.InvalidPhysicalFormat; - } - - fn parseOperandsResultIds( - parser: *Parser, - binary: BinaryModule, - inst: Instruction, - operands: []const spec.Operand, - start_offset: usize, - offsets: *std.ArrayList(u16), - ) !usize { - var offset = start_offset; - for (operands) |operand| { - offset = try parser.parseOperandResultIds(binary, inst, operand, offset, offsets); - } - return offset; - } - - fn parseOperandResultIds( - parser: *Parser, - binary: BinaryModule, - inst: Instruction, - operand: spec.Operand, - start_offset: usize, - offsets: *std.ArrayList(u16), - ) !usize { - var offset = start_offset; - switch (operand.quantifier) { - .variadic => while (offset < inst.operands.len) { - offset = try parser.parseOperandKindResultIds(binary, inst, operand.kind, offset, offsets); - }, - .optional => if (offset < inst.operands.len) { - offset = try parser.parseOperandKindResultIds(binary, inst, operand.kind, offset, offsets); - }, - .required => { - offset = try parser.parseOperandKindResultIds(binary, inst, operand.kind, offset, offsets); - }, - } - return offset; - } - - fn parseOperandKindResultIds( - parser: *Parser, - binary: BinaryModule, - inst: Instruction, - kind: spec.OperandKind, - start_offset: usize, - offsets: *std.ArrayList(u16), - ) !usize { - var offset = start_offset; - if (offset >= inst.operands.len) return error.InvalidPhysicalFormat; - - switch (kind.category()) { - .bit_enum => { - const mask = inst.operands[offset]; - offset += 1; - for (kind.enumerants()) |enumerant| { - if ((mask & enumerant.value) != 0) { - for (enumerant.parameters) |param_kind| { - offset = try parser.parseOperandKindResultIds(binary, inst, param_kind, offset, offsets); - } - } - } - }, - .value_enum => { - const value = inst.operands[offset]; - offset += 1; - for (kind.enumerants()) |enumerant| { - if (value == enumerant.value) { - for (enumerant.parameters) |param_kind| { - offset = try parser.parseOperandKindResultIds(binary, inst, param_kind, offset, offsets); - } - break; - } - } - }, - .id => { - try offsets.append(parser.gpa, @intCast(offset)); - offset += 1; - }, - else => switch (kind) { - .literal_integer, .literal_float => offset += 1, - .literal_string => while (true) { - if (offset >= inst.operands.len) return error.InvalidPhysicalFormat; - const word = inst.operands[offset]; - offset += 1; - - if (word & 0xFF000000 == 0 or - word & 0x00FF0000 == 0 or - word & 0x0000FF00 == 0 or - word & 0x000000FF == 0) - { - break; - } - }, - .literal_context_dependent_number => { - assert(inst.opcode == .OpConstant or inst.opcode == .OpSpecConstant); - const bit_width = binary.arith_type_width.get(@fromBackingInt(@intCast(inst.operands[0]))) orelse { - log.err("invalid LiteralContextDependentNumber type {}", .{inst.operands[0]}); - return error.InvalidId; - }; - offset += switch (bit_width) { - 1...32 => 1, - 33...64 => 2, - else => unreachable, - }; - }, - .literal_ext_inst_integer => unreachable, - .literal_spec_constant_op_integer => unreachable, - .pair_literal_integer_id_ref => { - assert(inst.opcode == .OpSwitch); - const bit_width = binary.arith_type_width.get(@fromBackingInt(@intCast(inst.operands[0]))) orelse { - log.err("invalid OpSwitch type {}", .{inst.operands[0]}); - return error.InvalidId; - }; - offset += switch (bit_width) { - 1...32 => 1, - 33...64 => 2, - else => unreachable, - }; - try offsets.append(parser.gpa, @intCast(offset)); - offset += 1; - }, - .pair_id_ref_literal_integer => { - try offsets.append(parser.gpa, @intCast(offset)); - offset += 2; - }, - .pair_id_ref_id_ref => { - try offsets.append(parser.gpa, @intCast(offset)); - try offsets.append(parser.gpa, @intCast(offset + 1)); - offset += 2; - }, - else => unreachable, - }, - } - return offset; - } -}; diff --git a/src/link/SpirV/dedup_types.zig b/src/link/SpirV/dedup_types.zig deleted file mode 100644 index 8841c4185033c8ace7131236f0e549ef10745118..0000000000000000000000000000000000000000 --- a/src/link/SpirV/dedup_types.zig +++ /dev/null @@ -1,244 +0,0 @@ -const std = @import("std"); -const Allocator = std.mem.Allocator; -const BinaryModule = @import("BinaryModule.zig"); - -const spec = @import("../../codegen/spirv/spec.zig"); -const Word = spec.Word; -const Id = spec.Id; -const Opcode = spec.Opcode; -const Instruction = BinaryModule.Instruction; - -/// Deduplicate types and constants in a SPIR-V binary module. -/// -/// The SPIR-V spec requires that non-aggregate types be unique. -/// When merging fragments from parallel codegen, duplicate type definitions -/// may exist. This pass identifies structurally identical types/constants, -/// keeps one canonical instance, and remaps all references to duplicates. -pub fn run(parser: *BinaryModule.Parser, binary: *BinaryModule) !void { - const gpa = parser.gpa; - - const Decoration = struct { offset: usize, len: usize }; - var decorations_by_id: std.array_hash_map.Auto(Id, std.ArrayList(Decoration)) = .empty; - defer { - for (decorations_by_id.values()) |*list| list.deinit(gpa); - decorations_by_id.deinit(gpa); - } - - var it = binary.iterateInstructions(); - while (it.next()) |inst| { - if (inst.offset >= binary.functions_start) break; - switch (inst.opcode) { - .OpName, .OpMemberName => continue, - else => switch (inst.opcode.class()) { - .annotation => {}, - else => continue, - }, - } - if (inst.operands.len == 0) continue; - const target_id: Id = @fromBackingInt(@intCast(inst.operands[0])); - - const gop = try decorations_by_id.getOrPut(gpa, target_id); - if (!gop.found_existing) gop.value_ptr.* = .empty; - try gop.value_ptr.append(gpa, .{ - .offset = inst.offset, - .len = 1 + inst.operands.len, - }); - } - - var canonical_map: std.array_hash_map.Custom(TypeKey, Id, TypeKey.HashContext, true) = .empty; - defer { - for (canonical_map.keys()) |key| gpa.free(key.words); - canonical_map.deinit(gpa); - } - - var id_remap: std.AutoHashMapUnmanaged(Id, Id) = .empty; - defer id_remap.deinit(gpa); - - var id_offsets: std.ArrayList(u16) = .empty; - defer id_offsets.deinit(gpa); - - var key_words: std.ArrayList(Word) = .empty; - defer key_words.deinit(gpa); - - var dec_hashes: std.ArrayList(u64) = .empty; - defer dec_hashes.deinit(gpa); - - // first pass: build canonical map, identify duplicates - it = binary.iterateInstructions(); - while (it.next()) |inst| { - if (inst.offset >= binary.functions_start) break; - if (!canDeduplicate(inst.opcode)) continue; - - const result_id_index: usize = switch (inst.opcode.class()) { - .type_declaration, .extension => 0, - .constant_creation => 1, - else => continue, - }; - if (result_id_index >= inst.operands.len) continue; - const result_id: Id = @fromBackingInt(@intCast(inst.operands[result_id_index])); - - key_words.items.len = 0; - try key_words.append(gpa, @backingInt(inst.opcode)); - - id_offsets.items.len = 0; - parser.parseInstructionResultIds(binary.*, inst, &id_offsets) catch continue; - - for (inst.operands, 0..) |word, i| { - if (i == result_id_index) continue; - if (std.mem.findScalar(u16, id_offsets.items, @intCast(i)) != null) { - const canonical = id_remap.get(@fromBackingInt(@intCast(word))) orelse @as(Id, @fromBackingInt(@intCast(word))); - try key_words.append(gpa, @backingInt(canonical)); - } else { - try key_words.append(gpa, word); - } - } - - if (decorations_by_id.getPtr(result_id)) |dec_list| { - dec_hashes.items.len = 0; - for (dec_list.items) |dec| { - const dec_words = binary.instructions[dec.offset..][0..dec.len]; - var hasher = std.hash.Wyhash.init(0); - hasher.update(std.mem.asBytes(&dec_words[0])); - for (dec_words[2..]) |w| { - const w_val = if (id_remap.get(@fromBackingInt(@intCast(w)))) |c| @backingInt(c) else w; - hasher.update(std.mem.asBytes(&w_val)); - } - try dec_hashes.append(gpa, hasher.final()); - } - std.mem.sort(u64, dec_hashes.items, {}, std.sort.asc(u64)); - var prev: u64 = 0; - for (dec_hashes.items) |h| { - if (h == prev) continue; - prev = h; - try key_words.append(gpa, @truncate(h)); - try key_words.append(gpa, @truncate(h >> 32)); - } - } - - const key = TypeKey{ .words = try gpa.dupe(Word, key_words.items) }; - const gop = try canonical_map.getOrPut(gpa, key); - if (gop.found_existing) { - try id_remap.put(gpa, result_id, gop.value_ptr.*); - gpa.free(key.words); - } else { - gop.value_ptr.* = result_id; - } - } - - if (id_remap.count() == 0) return; - - // second pass: rewrite id references, remove duplicates and redundant annotations - var new_words: std.ArrayList(Word) = .empty; - defer new_words.deinit(gpa); - try new_words.ensureTotalCapacity(gpa, binary.instructions.len); - - var emitted_annotations: std.AutoHashMapUnmanaged(u64, void) = .empty; - defer emitted_annotations.deinit(gpa); - - var new_functions_offset: ?usize = null; - var max_id: Word = 0; - - it = binary.iterateInstructions(); - while (it.next()) |inst| { - if (new_functions_offset == null and inst.offset >= binary.functions_start) { - new_functions_offset = new_words.items.len; - } - - if (canDeduplicate(inst.opcode)) { - const result_id_index: usize = switch (inst.opcode.class()) { - .type_declaration, .extension => 0, - .constant_creation => 1, - else => unreachable, - }; - if (result_id_index < inst.operands.len) { - const result_id: Id = @fromBackingInt(@intCast(inst.operands[result_id_index])); - if (id_remap.contains(result_id)) continue; - } - } - - switch (inst.opcode.class()) { - .annotation, .debug => { - if (inst.operands.len > 0) { - const target: Id = @fromBackingInt(@intCast(inst.operands[0])); - if (id_remap.contains(target)) continue; - } - }, - else => {}, - } - - const inst_start = new_words.items.len; - new_words.appendAssumeCapacity(binary.instructions[inst.offset]); - new_words.appendSliceAssumeCapacity(inst.operands); - const inst_slice = new_words.items[inst_start + 1 ..]; - - id_offsets.items.len = 0; - parser.parseInstructionResultIds(binary.*, inst, &id_offsets) catch continue; - - const inst_spec = parser.getInstSpec(inst.opcode); - const maybe_result_id_index: ?usize = if (inst_spec) |ispec| blk: { - break :blk for (0..@min(2, ispec.operands.len)) |i| { - if (ispec.operands[i].kind == .id_result) break @intCast(i); - } else null; - } else null; - - for (inst_slice, 0..) |*word, i| { - if (std.mem.findScalar(u16, id_offsets.items, @intCast(i)) == null) continue; - max_id = @max(max_id, word.*); - if (maybe_result_id_index != null and i == maybe_result_id_index.?) continue; - - if (id_remap.get(@fromBackingInt(@intCast(word.*)))) |canonical| { - word.* = @backingInt(canonical); - max_id = @max(max_id, word.*); - } - } - - switch (inst.opcode.class()) { - .annotation, .debug => { - const ann_words = new_words.items[inst_start..]; - const ann_hash = std.hash.Wyhash.hash(0, std.mem.sliceAsBytes(ann_words)); - const gop = try emitted_annotations.getOrPut(gpa, ann_hash); - if (gop.found_existing) { - new_words.items.len = inst_start; - continue; - } - }, - else => {}, - } - } - - var remap_it = id_remap.iterator(); - while (remap_it.next()) |entry| { - _ = binary.ext_inst_map.remove(entry.key_ptr.*); - _ = binary.arith_type_width.remove(entry.key_ptr.*); - } - - binary.instructions = try gpa.dupe(Word, new_words.items); - binary.functions_start = new_functions_offset orelse new_words.items.len; - binary.id_bound = max_id + 1; -} - -fn canDeduplicate(opcode: Opcode) bool { - return switch (opcode) { - .OpTypeForwardPointer => false, - .OpGroupDecorate, .OpGroupMemberDecorate => false, - else => switch (opcode.class()) { - .type_declaration, .constant_creation => true, - .extension => opcode == .OpExtInstImport, - else => false, - }, - }; -} - -const TypeKey = struct { - words: []const Word, - - const HashContext = struct { - pub fn hash(_: @This(), key: TypeKey) u32 { - return @truncate(std.hash.Wyhash.hash(0, std.mem.sliceAsBytes(key.words))); - } - - pub fn eql(_: @This(), a: TypeKey, b: TypeKey, _: usize) bool { - return std.mem.eql(Word, a.words, b.words); - } - }; -}; diff --git a/src/link/SpirV/lower_invocation_globals.zig b/src/link/SpirV/lower_invocation_globals.zig deleted file mode 100644 index 7ea41763d3cc3c0dad0fe244c60fafbc01c58ed0..0000000000000000000000000000000000000000 --- a/src/link/SpirV/lower_invocation_globals.zig +++ /dev/null @@ -1,803 +0,0 @@ -const std = @import("std"); -const Allocator = std.mem.Allocator; -const assert = std.debug.assert; -const log = std.log.scoped(.spirv_link); - -const BinaryModule = @import("BinaryModule.zig"); -const Section = @import("../../codegen/spirv/Section.zig"); -const spec = @import("../../codegen/spirv/spec.zig"); -const ResultId = spec.Id; -const Word = spec.Word; - -/// This structure contains all the stuff that we need to parse from the module in -/// order to run this pass, as well as some functions to ease its use. -const ModuleInfo = struct { - /// Information about a particular function. - const Fn = struct { - /// The index of the first callee in `callee_store`. - first_callee: usize, - /// The return type id of this function - return_type: ResultId, - /// The parameter types of this function - param_types: []const ResultId, - /// The set of (result-id's of) invocation globals that are accessed - /// in this function, or after resolution, that are accessed in this - /// function or any of it's callees. - invocation_globals: std.array_hash_map.Auto(ResultId, void), - }; - - /// Information about a particular invocation global - const InvocationGlobal = struct { - /// The list of invocation globals that this invocation global - /// depends on. - dependencies: std.array_hash_map.Auto(ResultId, void), - /// The invocation global's type - ty: ResultId, - /// Initializer function. May be `none`. - /// Note that if the initializer is `none`, then `dependencies` is empty. - initializer: ResultId, - }; - - /// Maps function result-id -> Fn information structure. - functions: std.array_hash_map.Auto(ResultId, Fn), - /// Set of OpFunction result-ids in this module. - entry_points: std.array_hash_map.Auto(ResultId, void), - /// For each function, a list of function result-ids that it calls. - callee_store: []const ResultId, - /// Maps each invocation global result-id to a type-id. - invocation_globals: std.array_hash_map.Auto(ResultId, InvocationGlobal), - /// Subset of `invocation_globals` reachable from any entry point. - live_invocation_globals: std.array_hash_map.Auto(ResultId, void), - /// Initializer functions of unreachable invocation globals. Their - /// OpFunction...OpFunctionEnd ranges are skipped during rewriteFunctions. - dead_initializers: std.array_hash_map.Auto(ResultId, void), - - /// Fetch the list of callees per function. Guaranteed to contain only unique IDs. - fn callees(self: ModuleInfo, fn_id: ResultId) []const ResultId { - const fn_index = self.functions.getIndex(fn_id).?; - const values = self.functions.values(); - const first_callee = values[fn_index].first_callee; - if (fn_index == values.len - 1) { - return self.callee_store[first_callee..]; - } else { - const next_first_callee = values[fn_index + 1].first_callee; - return self.callee_store[first_callee..next_first_callee]; - } - } - - /// Extract most of the required information from the binary. The remaining info is - /// constructed by `resolve()`. - fn parse( - arena: Allocator, - parser: *BinaryModule.Parser, - binary: BinaryModule, - ) !ModuleInfo { - var entry_points: std.array_hash_map.Auto(ResultId, void) = .empty; - var functions: std.array_hash_map.Auto(ResultId, Fn) = .empty; - var fn_types = std.AutoHashMap(ResultId, struct { - return_type: ResultId, - param_types: []const ResultId, - }).init(arena); - var calls: std.array_hash_map.Auto(ResultId, void) = .empty; - var callee_store: std.ArrayList(ResultId) = .empty; - var function_invocation_globals: std.array_hash_map.Auto(ResultId, void) = .empty; - var result_id_offsets: std.ArrayList(u16) = .empty; - var invocation_globals: std.array_hash_map.Auto(ResultId, InvocationGlobal) = .empty; - - var maybe_current_function: ?ResultId = null; - var fn_ty_id: ResultId = undefined; - - var it = binary.iterateInstructions(); - while (it.next()) |inst| { - result_id_offsets.items.len = 0; - try parser.parseInstructionResultIds(binary, inst, &result_id_offsets); - - switch (inst.opcode) { - .OpEntryPoint => { - const entry_point: ResultId = @fromBackingInt(@intCast(inst.operands[1])); - const entry = try entry_points.getOrPut(arena, entry_point); - if (entry.found_existing) { - log.err("Entry point type {f} has duplicate definition", .{entry_point}); - return error.DuplicateId; - } - }, - .OpTypeFunction => { - const fn_type: ResultId = @fromBackingInt(@intCast(inst.operands[0])); - const return_type: ResultId = @fromBackingInt(@intCast(inst.operands[1])); - const param_types: []const ResultId = @ptrCast(inst.operands[2..]); - - const entry = try fn_types.getOrPut(fn_type); - if (entry.found_existing) { - log.err("Function type {f} has duplicate definition", .{fn_type}); - return error.DuplicateId; - } - - entry.value_ptr.* = .{ - .return_type = return_type, - .param_types = param_types, - }; - }, - .OpExtInst => { - // Note: format and set are already verified by parseInstructionResultIds(). - const global_type: ResultId = @fromBackingInt(@intCast(inst.operands[0])); - const result_id: ResultId = @fromBackingInt(@intCast(inst.operands[1])); - const set_id: ResultId = @fromBackingInt(@intCast(inst.operands[2])); - const set_inst = inst.operands[3]; - - const set = binary.ext_inst_map.get(set_id).?; - if (set == .zig and set_inst == 0) { - const initializer: ResultId = if (inst.operands.len >= 5) - @fromBackingInt(@intCast(inst.operands[4])) - else - .none; - - try invocation_globals.put(arena, result_id, .{ - .dependencies = .{}, - .ty = global_type, - .initializer = initializer, - }); - } - }, - .OpFunction => { - if (maybe_current_function) |current_function| { - log.err("OpFunction {f} does not have an OpFunctionEnd", .{current_function}); - return error.InvalidPhysicalFormat; - } - - maybe_current_function = @fromBackingInt(@intCast(inst.operands[1])); - fn_ty_id = @fromBackingInt(@intCast(inst.operands[3])); - function_invocation_globals.clearRetainingCapacity(); - }, - .OpFunctionCall => { - const callee: ResultId = @fromBackingInt(@intCast(inst.operands[2])); - try calls.put(arena, callee, {}); - }, - .OpFunctionEnd => { - const current_function = maybe_current_function orelse { - log.err("encountered OpFunctionEnd without corresponding OpFunction", .{}); - return error.InvalidPhysicalFormat; - }; - const entry = try functions.getOrPut(arena, current_function); - if (entry.found_existing) { - log.err("Function {f} has duplicate definition", .{current_function}); - return error.DuplicateId; - } - - const first_callee = callee_store.items.len; - try callee_store.appendSlice(arena, calls.keys()); - - const fn_type = fn_types.get(fn_ty_id) orelse { - log.err("Function {f} has invalid OpFunction type", .{current_function}); - return error.InvalidId; - }; - - entry.value_ptr.* = .{ - .first_callee = first_callee, - .return_type = fn_type.return_type, - .param_types = fn_type.param_types, - .invocation_globals = try function_invocation_globals.clone(arena), - }; - maybe_current_function = null; - calls.clearRetainingCapacity(); - }, - else => {}, - } - - for (result_id_offsets.items) |off| { - const result_id: ResultId = @fromBackingInt(@intCast(inst.operands[off])); - if (invocation_globals.contains(result_id)) { - try function_invocation_globals.put(arena, result_id, {}); - } - } - } - - if (maybe_current_function) |current_function| { - log.err("OpFunction {f} does not have an OpFunctionEnd", .{current_function}); - return error.InvalidPhysicalFormat; - } - - return .{ - .functions = functions, - .entry_points = entry_points, - .callee_store = callee_store.items, - .invocation_globals = invocation_globals, - .live_invocation_globals = .empty, - .dead_initializers = .empty, - }; - } - - /// Derive the remaining info from the structures filled in by parsing. - fn resolve(self: *ModuleInfo, arena: Allocator) !void { - try self.resolveInvocationGlobalUsage(arena); - try self.resolveInvocationGlobalDependencies(arena); - try self.resolveLiveSet(arena); - } - - fn resolveLiveSet(self: *ModuleInfo, arena: Allocator) !void { - for (self.entry_points.keys()) |ep_id| { - const ep_info = self.functions.get(ep_id) orelse continue; - for (ep_info.invocation_globals.keys()) |g| { - try self.live_invocation_globals.put(arena, g, {}); - const g_info = self.invocation_globals.get(g).?; - for (g_info.dependencies.keys()) |dep| { - try self.live_invocation_globals.put(arena, dep, {}); - } - } - } - for (self.invocation_globals.keys(), self.invocation_globals.values()) |g, info| { - if (info.initializer == .none) continue; - if (self.live_invocation_globals.contains(g)) continue; - try self.dead_initializers.put(arena, info.initializer, {}); - } - } - - /// For each function, extend the list of `invocation_globals` with the - /// invocation globals that ALL of its dependencies use. - fn resolveInvocationGlobalUsage(self: *ModuleInfo, arena: Allocator) !void { - var seen: std.bit_set.Dynamic = try .initEmpty(arena, self.functions.count()); - - for (self.functions.keys()) |id| { - try self.resolveInvocationGlobalUsageStep(arena, id, &seen); - } - } - - fn resolveInvocationGlobalUsageStep( - self: *ModuleInfo, - arena: Allocator, - id: ResultId, - seen: *std.bit_set.Dynamic, - ) !void { - const index = self.functions.getIndex(id) orelse { - log.err("function calls invalid function {f}", .{id}); - return error.InvalidId; - }; - - if (seen.isSet(index)) { - return; - } - seen.set(index); - - const info = &self.functions.values()[index]; - for (self.callees(id)) |callee| { - try self.resolveInvocationGlobalUsageStep(arena, callee, seen); - const callee_info = self.functions.get(callee).?; - for (callee_info.invocation_globals.keys()) |global| { - try info.invocation_globals.put(arena, global, {}); - } - } - } - - /// For each invocation global, populate and fully resolve the `dependencies` set. - /// This requires `resolveInvocationGlobalUsage()` to be already done. - fn resolveInvocationGlobalDependencies( - self: *ModuleInfo, - arena: Allocator, - ) !void { - var seen: std.bit_set.Dynamic = try .initEmpty(arena, self.invocation_globals.count()); - - for (self.invocation_globals.keys()) |id| { - try self.resolveInvocationGlobalDependenciesStep(arena, id, &seen); - } - } - - fn resolveInvocationGlobalDependenciesStep( - self: *ModuleInfo, - arena: Allocator, - id: ResultId, - seen: *std.bit_set.Dynamic, - ) !void { - const index = self.invocation_globals.getIndex(id) orelse { - log.err("invalid invocation global {f}", .{id}); - return error.InvalidId; - }; - - if (seen.isSet(index)) { - return; - } - seen.set(index); - - const info = &self.invocation_globals.values()[index]; - if (info.initializer == .none) { - return; - } - - const initializer = self.functions.get(info.initializer) orelse { - log.err("invocation global {f} has invalid initializer {f}", .{ id, info.initializer }); - return error.InvalidId; - }; - - for (initializer.invocation_globals.keys()) |dependency| { - if (dependency == id) { - // The set of invocation global dependencies includes the dependency itself, - // so we need to skip that case. - continue; - } - - try info.dependencies.put(arena, dependency, {}); - try self.resolveInvocationGlobalDependenciesStep(arena, dependency, seen); - - const dep_info = self.invocation_globals.getPtr(dependency).?; - - for (dep_info.dependencies.keys()) |global| { - try info.dependencies.put(arena, global, {}); - } - } - } -}; - -const ModuleBuilder = struct { - const FunctionType = struct { - return_type: ResultId, - param_types: []const ResultId, - - const Context = struct { - pub fn hash(_: @This(), ty: FunctionType) u32 { - var hasher = std.hash.Wyhash.init(0); - hasher.update(std.mem.asBytes(&ty.return_type)); - hasher.update(std.mem.sliceAsBytes(ty.param_types)); - return @truncate(hasher.final()); - } - - pub fn eql(_: @This(), a: FunctionType, b: FunctionType, _: usize) bool { - if (a.return_type != b.return_type) return false; - return std.mem.eql(ResultId, a.param_types, b.param_types); - } - }; - }; - - const FunctionNewInfo = struct { - /// This is here just so that we don't need to allocate the new - /// param_types multiple times. - new_function_type: ResultId, - /// The first ID of the parameters for the invocation globals. - /// Each global is allocate here according to the index in - /// `ModuleInfo.Fn.invocation_globals`. - global_id_base: u32, - - fn invocationGlobalId(self: FunctionNewInfo, index: usize) ResultId { - return @fromBackingInt(@intCast(self.global_id_base + @as(u32, @intCast(index)))); - } - }; - - arena: Allocator, - section: Section, - /// The ID bound of the new module. - id_bound: u32, - /// The first ID of the new entry points. Entry points are allocated from - /// here according to their index in `info.entry_points`. - entry_point_new_id_base: u32, - /// OpName operands saved for invocation globals to re-emit. - global_names: std.array_hash_map.Auto(ResultId, []const Word) = .empty, - /// A set of all function types in the new program. SPIR-V mandates that these are unique, - /// and until a general type deduplication pass is programmed, we just handle it here via this. - function_types: std.array_hash_map.Custom(FunctionType, ResultId, FunctionType.Context, true) = .empty, - /// Maps functions to new information required for creating the module - function_new_info: std.array_hash_map.Auto(ResultId, FunctionNewInfo) = .empty, - /// Offset of the functions section in the new binary. - new_functions_section: ?usize, - - fn init(arena: Allocator, binary: BinaryModule, info: ModuleInfo) !ModuleBuilder { - var self = ModuleBuilder{ - .arena = arena, - .section = .{}, - .id_bound = binary.id_bound, - .entry_point_new_id_base = undefined, - .new_functions_section = null, - }; - self.entry_point_new_id_base = @backingInt(self.allocIds(@intCast(info.entry_points.count()))); - return self; - } - - fn allocId(self: *ModuleBuilder) ResultId { - return self.allocIds(1); - } - - fn allocIds(self: *ModuleBuilder, n: u32) ResultId { - defer self.id_bound += n; - return @fromBackingInt(@intCast(self.id_bound)); - } - - fn finalize(self: *ModuleBuilder, arena: Allocator, binary: *BinaryModule) !void { - binary.id_bound = self.id_bound; - binary.instructions = try arena.dupe(Word, self.section.instructions.items); - // Nothing is removed in this pass so we don't need to change any of the maps, - // just make sure the section is updated. - binary.functions_start = self.new_functions_section orelse binary.instructions.len; - } - - fn emitGlobalNames(self: *ModuleBuilder, info: ModuleInfo) !void { - for (info.functions.keys(), info.functions.values()) |func, fn_info| { - if (info.dead_initializers.contains(func)) continue; - const new_info = self.function_new_info.get(func) orelse continue; - for (fn_info.invocation_globals.keys(), 0..) |global, i| { - if (!info.live_invocation_globals.contains(global)) continue; - const name_words = self.global_names.get(global) orelse continue; - const id = new_info.invocationGlobalId(i); - try self.section.emitRaw(self.arena, .OpName, 1 + name_words.len); - self.section.writeOperand(ResultId, id); - self.section.writeWords(name_words); - } - } - } - - /// Process everything from `binary` up to the first function and emit it into the builder. - fn processPreamble(self: *ModuleBuilder, binary: BinaryModule, info: ModuleInfo) !void { - var emitted_global_names = false; - var it = binary.iterateInstructions(); - while (it.next()) |inst| { - if (!emitted_global_names) switch (inst.opcode.class()) { - .annotation, .type_declaration, .constant_creation => { - try self.emitGlobalNames(info); - emitted_global_names = true; - }, - else => {}, - }; - - switch (inst.opcode) { - .OpName => { - const id: ResultId = @fromBackingInt(@intCast(inst.operands[0])); - if (info.invocation_globals.contains(id)) { - try self.global_names.put(self.arena, id, inst.operands[1..]); - continue; - } - if (info.dead_initializers.contains(id)) continue; - }, - .OpExtInstImport => { - const set_id: ResultId = @fromBackingInt(@intCast(inst.operands[0])); - const set = binary.ext_inst_map.get(set_id).?; - if (set == .zig) continue; - }, - .OpExtInst => { - const set_id: ResultId = @fromBackingInt(@intCast(inst.operands[2])); - const set_inst = inst.operands[3]; - const set = binary.ext_inst_map.get(set_id).?; - if (set == .zig and set_inst == 0) { - continue; - } - }, - .OpEntryPoint => { - const original_id: ResultId = @fromBackingInt(@intCast(inst.operands[1])); - const fn_info = info.functions.get(original_id).?; - if (fn_info.invocation_globals.count() > 0) { - const new_id_index = info.entry_points.getIndex(original_id).?; - const new_id: ResultId = @fromBackingInt(@intCast(self.entry_point_new_id_base + new_id_index)); - try self.section.emitRaw(self.arena, .OpEntryPoint, inst.operands.len); - self.section.writeWord(inst.operands[0]); - self.section.writeOperand(ResultId, new_id); - self.section.writeWords(inst.operands[2..]); - } else { - try self.section.emitRawInstruction(self.arena, inst.opcode, inst.operands); - } - continue; - }, - .OpExecutionMode, .OpExecutionModeId => { - const original_id: ResultId = @fromBackingInt(@intCast(inst.operands[0])); - const fn_info = info.functions.get(original_id).?; - if (fn_info.invocation_globals.count() > 0) { - const new_id_index = info.entry_points.getIndex(original_id).?; - const new_id: ResultId = @fromBackingInt(@intCast(self.entry_point_new_id_base + new_id_index)); - try self.section.emitRaw(self.arena, inst.opcode, inst.operands.len); - self.section.writeOperand(ResultId, new_id); - self.section.writeWords(inst.operands[1..]); - } else { - try self.section.emitRawInstruction(self.arena, inst.opcode, inst.operands); - } - continue; - }, - .OpTypeFunction => { - continue; - }, - .OpFunction => break, - else => {}, - } - - try self.section.emitRawInstruction(self.arena, inst.opcode, inst.operands); - } - - if (!emitted_global_names) { - try self.emitGlobalNames(info); - } - } - - /// Derive new information required for further emitting this module, - fn deriveNewFnInfo(self: *ModuleBuilder, info: ModuleInfo) !void { - for (info.functions.keys(), info.functions.values()) |func, fn_info| { - const invocation_global_count = fn_info.invocation_globals.count(); - const new_param_types = try self.arena.alloc(ResultId, fn_info.param_types.len + invocation_global_count); - for (fn_info.invocation_globals.keys(), 0..) |global, i| { - new_param_types[i] = info.invocation_globals.get(global).?.ty; - } - @memcpy(new_param_types[invocation_global_count..], fn_info.param_types); - - const new_type = try self.internFunctionType(fn_info.return_type, new_param_types); - try self.function_new_info.put(self.arena, func, .{ - .new_function_type = new_type, - .global_id_base = @backingInt(self.allocIds(@intCast(invocation_global_count))), - }); - } - } - - /// Emit the new function types, which include the parameters for the invocation globals. - /// Currently, this function re-emits ALL function types to ensure that there are - /// no duplicates in the final program. - /// TODO: The above should be resolved by a generalized deduplication pass, and then - /// we only need to emit the new function pointers type here. - fn emitFunctionTypes(self: *ModuleBuilder, info: ModuleInfo) !void { - // TODO: Handle decorators. Function types usually don't have those - // though, but stuff like OpName could be a possibility. - - // Entry points retain their old function type, so make sure to emit - // those in the `function_types` set. - for (info.entry_points.keys()) |func| { - const fn_info = info.functions.get(func).?; - _ = try self.internFunctionType(fn_info.return_type, fn_info.param_types); - } - - for (self.function_types.keys(), self.function_types.values()) |fn_type, result_id| { - try self.section.emit(self.arena, .OpTypeFunction, .{ - .id_result = result_id, - .return_type = fn_type.return_type, - .id_ref_2 = fn_type.param_types, - }); - } - } - - fn internFunctionType(self: *ModuleBuilder, return_type: ResultId, param_types: []const ResultId) !ResultId { - const entry = try self.function_types.getOrPut(self.arena, .{ - .return_type = return_type, - .param_types = param_types, - }); - - if (!entry.found_existing) { - const new_id = self.allocId(); - entry.value_ptr.* = new_id; - } - - return entry.value_ptr.*; - } - - /// Rewrite the modules functions and emit them with the new parameter types. - fn rewriteFunctions( - self: *ModuleBuilder, - parser: *BinaryModule.Parser, - binary: BinaryModule, - info: ModuleInfo, - ) !void { - var result_id_offsets: std.ArrayList(u16) = .empty; - var operands: std.ArrayList(u32) = .empty; - - var maybe_current_function: ?ResultId = null; - var skip_until_end: bool = false; - var it = binary.iterateInstructionsFrom(binary.functions_start); - self.new_functions_section = self.section.instructions.items.len; - while (it.next()) |inst| { - if (skip_until_end) { - if (inst.opcode == .OpFunctionEnd) skip_until_end = false; - continue; - } - result_id_offsets.items.len = 0; - try parser.parseInstructionResultIds(binary, inst, &result_id_offsets); - - operands.items.len = 0; - try operands.appendSlice(self.arena, inst.operands); - - // Replace the result-ids with the global's new result-id if required. - for (result_id_offsets.items) |off| { - const result_id: ResultId = @fromBackingInt(@intCast(operands.items[off])); - if (info.invocation_globals.contains(result_id)) { - const func = maybe_current_function.?; - const new_info = self.function_new_info.get(func).?; - const fn_info = info.functions.get(func).?; - const index = fn_info.invocation_globals.getIndex(result_id).?; - operands.items[off] = @backingInt(new_info.invocationGlobalId(index)); - } - } - - switch (inst.opcode) { - .OpFunction => { - // Re-declare the function with the new parameters. - const func: ResultId = @fromBackingInt(@intCast(operands.items[1])); - if (info.dead_initializers.contains(func)) { - skip_until_end = true; - continue; - } - const fn_info = info.functions.get(func).?; - const new_info = self.function_new_info.get(func).?; - - try self.section.emitRaw(self.arena, .OpFunction, 4); - self.section.writeOperand(ResultId, fn_info.return_type); - self.section.writeOperand(ResultId, func); - self.section.writeWord(operands.items[2]); - self.section.writeOperand(ResultId, new_info.new_function_type); - - // Emit the OpFunctionParameters for the invocation globals. The functions - // actual parameters are emitted unchanged from their original form, so - // we don't need to handle those here. - - for (fn_info.invocation_globals.keys(), 0..) |global, index| { - const ty = info.invocation_globals.get(global).?.ty; - const id = new_info.invocationGlobalId(index); - try self.section.emit(self.arena, .OpFunctionParameter, .{ - .id_result_type = ty, - .id_result = id, - }); - } - - maybe_current_function = func; - }, - .OpFunctionCall => { - // Add the required invocation globals to the function's new parameter list. - const caller = maybe_current_function.?; - const callee: ResultId = @fromBackingInt(@intCast(operands.items[2])); - const caller_info = info.functions.get(caller).?; - const callee_info = info.functions.get(callee).?; - const caller_new_info = self.function_new_info.get(caller).?; - const total_params = callee_info.invocation_globals.count() + callee_info.param_types.len; - - try self.section.emitRaw(self.arena, .OpFunctionCall, 3 + total_params); - self.section.writeWord(operands.items[0]); // Copy result type-id - self.section.writeWord(operands.items[1]); // Copy result-id - self.section.writeOperand(ResultId, callee); - - // Add the new arguments - for (callee_info.invocation_globals.keys()) |global| { - const caller_global_index = caller_info.invocation_globals.getIndex(global).?; - const id = caller_new_info.invocationGlobalId(caller_global_index); - self.section.writeOperand(ResultId, id); - } - - // Add the original arguments - self.section.writeWords(operands.items[3..]); - }, - else => { - try self.section.emitRawInstruction(self.arena, inst.opcode, operands.items); - }, - } - } - } - - fn emitNewEntryPoints(self: *ModuleBuilder, info: ModuleInfo) !void { - const arena = self.arena; - var all_function_invocation_globals: std.array_hash_map.Auto(ResultId, void) = .empty; - - for (info.entry_points.keys(), 0..) |func, entry_point_index| { - const fn_info = info.functions.get(func).?; - if (fn_info.invocation_globals.count() == 0) continue; - const ep_id: ResultId = @fromBackingInt(@intCast(self.entry_point_new_id_base + @as(u32, @intCast(entry_point_index)))); - const fn_type = self.function_types.get(.{ - .return_type = fn_info.return_type, - .param_types = fn_info.param_types, - }).?; - - try self.section.emit(arena, .OpFunction, .{ - .id_result_type = fn_info.return_type, - .id_result = ep_id, - .function_control = .{}, // TODO: Copy the attributes from the original function maybe? - .function_type = fn_type, - }); - - // Emit OpFunctionParameter instructions for the original kernel's parameters. - const params_id_base: u32 = @backingInt(self.allocIds(@intCast(fn_info.param_types.len))); - for (fn_info.param_types, 0..) |param_type, i| { - const id: ResultId = @fromBackingInt(@intCast(params_id_base + @as(u32, @intCast(i)))); - try self.section.emit(arena, .OpFunctionParameter, .{ - .id_result_type = param_type, - .id_result = id, - }); - } - - try self.section.emit(arena, .OpLabel, .{ - .id_result = self.allocId(), - }); - - // Besides the IDs of the main kernel, we also need the - // dependencies of the globals. - // Just quickly construct that set here. - all_function_invocation_globals.clearRetainingCapacity(); - for (fn_info.invocation_globals.keys()) |global| { - try all_function_invocation_globals.put(arena, global, {}); - const global_info = info.invocation_globals.get(global).?; - for (global_info.dependencies.keys()) |dependency| { - try all_function_invocation_globals.put(arena, dependency, {}); - } - } - - // Declare the IDs of the invocation globals. - const global_id_base: u32 = @backingInt(self.allocIds(@intCast(all_function_invocation_globals.count()))); - for (all_function_invocation_globals.keys(), 0..) |global, i| { - const global_info = info.invocation_globals.get(global).?; - - const id: ResultId = @fromBackingInt(@intCast(global_id_base + @as(u32, @intCast(i)))); - try self.section.emit(arena, .OpVariable, .{ - .id_result_type = global_info.ty, - .id_result = id, - .storage_class = .function, - .initializer = null, - }); - } - - // Call initializers for invocation globals that need it - for (all_function_invocation_globals.keys()) |global| { - const global_info = info.invocation_globals.get(global).?; - if (global_info.initializer == .none) continue; - - const initializer_info = info.functions.get(global_info.initializer).?; - assert(initializer_info.param_types.len == 0); - - try self.callWithGlobalsAndLinearParams( - &all_function_invocation_globals, - global_info.initializer, - initializer_info, - global_id_base, - undefined, - ); - } - - // Call the main kernel entry - try self.callWithGlobalsAndLinearParams( - &all_function_invocation_globals, - func, - fn_info, - global_id_base, - params_id_base, - ); - - try self.section.emit(arena, .OpReturn, {}); - try self.section.emit(arena, .OpFunctionEnd, {}); - } - } - - fn callWithGlobalsAndLinearParams( - self: *ModuleBuilder, - all_globals: *const std.array_hash_map.Auto(ResultId, void), - func: ResultId, - callee_info: ModuleInfo.Fn, - global_id_base: u32, - params_id_base: u32, - ) !void { - const total_arguments = callee_info.invocation_globals.count() + callee_info.param_types.len; - try self.section.emitRaw(self.arena, .OpFunctionCall, 3 + total_arguments); - self.section.writeOperand(ResultId, callee_info.return_type); - self.section.writeOperand(ResultId, self.allocId()); - self.section.writeOperand(ResultId, func); - - // Add the invocation globals - for (callee_info.invocation_globals.keys()) |global| { - const index = all_globals.getIndex(global).?; - const id: ResultId = @fromBackingInt(@intCast(global_id_base + @as(u32, @intCast(index)))); - self.section.writeOperand(ResultId, id); - } - - // Add the arguments - for (0..callee_info.param_types.len) |index| { - const id: ResultId = @fromBackingInt(@intCast(params_id_base + @as(u32, @intCast(index)))); - self.section.writeOperand(ResultId, id); - } - } -}; - -pub fn run(parser: *BinaryModule.Parser, binary: *BinaryModule, progress: std.Progress.Node) !void { - const sub_node = progress.start("Lower invocation globals", 6); - defer sub_node.end(); - - var arena_state = std.heap.ArenaAllocator.init(parser.gpa); - defer arena_state.deinit(); - const arena = arena_state.allocator(); - - var info = try ModuleInfo.parse(arena, parser, binary.*); - try info.resolve(arena); - - var builder = try ModuleBuilder.init(arena, binary.*, info); - sub_node.completeOne(); - try builder.deriveNewFnInfo(info); - sub_node.completeOne(); - try builder.processPreamble(binary.*, info); - sub_node.completeOne(); - try builder.emitFunctionTypes(info); - sub_node.completeOne(); - try builder.rewriteFunctions(parser, binary.*, info); - sub_node.completeOne(); - try builder.emitNewEntryPoints(info); - sub_node.completeOne(); - try builder.finalize(parser.gpa, binary); -} diff --git a/src/link/SpirV/prune_unused.zig b/src/link/SpirV/prune_unused.zig deleted file mode 100644 index a41b0d878d07b7c3e3179429dae74e27aaf044b8..0000000000000000000000000000000000000000 --- a/src/link/SpirV/prune_unused.zig +++ /dev/null @@ -1,257 +0,0 @@ -const std = @import("std"); -const BinaryModule = @import("BinaryModule.zig"); -const spec = @import("../../codegen/spirv/spec.zig"); -const Opcode = spec.Opcode; -const ResultId = spec.Id; -const Word = spec.Word; - -pub fn run(parser: *BinaryModule.Parser, binary: *BinaryModule) !void { - const gpa = parser.gpa; - - // map result-id → index in id_offsets for preamble instructions and function headers - var id_to_index: std.AutoHashMapUnmanaged(ResultId, u32) = .empty; - defer id_to_index.deinit(gpa); - - // for each indexed instruction, its offset in the binary - var code_offsets: std.ArrayList(usize) = .empty; - defer code_offsets.deinit(gpa); - - var it = binary.iterateInstructions(); - while (it.next()) |inst| { - const inst_spec = parser.getInstSpec(inst.opcode) orelse continue; - const result_id = getResultId(inst, inst_spec) orelse continue; - - // only index preamble instructions and function headers - if (inst.offset < binary.functions_start or inst.opcode == .OpFunction) { - const index: u32 = @intCast(code_offsets.items.len); - try id_to_index.put(gpa, result_id, index); - try code_offsets.append(gpa, inst.offset); - } - } - - var alive: std.bit_set.Dynamic = try .initEmpty(gpa, code_offsets.items.len); - defer alive.deinit(gpa); - - var id_offset_buf: std.ArrayList(u16) = .empty; - defer id_offset_buf.deinit(gpa); - - // Mark non-prunable preamble instructions alive - // OpExtInst in the preamble is metadata (e.g. Zig error info) that references - // functions. skip it here so it doesn't root dead functions alive. - // These instructions are handled as prunable during the rewrite phase. - it = binary.iterateInstructions(); - while (it.next()) |inst| { - if (inst.offset >= binary.functions_start) break; - if (canPrune(inst.opcode) or inst.opcode == .OpExtInst) continue; - try markAlive( - parser, - binary.*, - inst, - &alive, - &id_to_index, - &code_offsets, - &id_offset_buf, - ); - } - - // mark functions with LinkageAttributes Export alive - it = binary.iterateInstructions(); - while (it.next()) |inst| { - if (inst.offset >= binary.functions_start) break; - if (inst.opcode == .OpDecorate and inst.operands.len >= 2 and - inst.operands[1] == @backingInt(spec.Decoration.linkage_attributes)) - { - // Last word after the string is the linkage type; Export = 0. - if (inst.operands[inst.operands.len - 1] == @backingInt(spec.LinkageType.@"export")) { - const target: ResultId = @fromBackingInt(@intCast(inst.operands[0])); - if (id_to_index.get(target)) |index| { - alive.set(index); - } - } - } - } - - // mark alive functions' contents alive - it = binary.iterateInstructionsFrom(binary.functions_start); - while (it.next()) |inst| { - if (inst.opcode == .OpFunction) { - const inst_spec = parser.getInstSpec(inst.opcode) orelse continue; - const result_id = getResultId(inst, inst_spec) orelse continue; - const index = id_to_index.get(result_id) orelse continue; - if (!alive.isSet(index)) { - // skip dead function - while (it.next()) |inner| { - if (inner.opcode == .OpFunctionEnd) break; - } - continue; - } - - // mark the function's type operands alive - try markAlive(parser, binary.*, inst, &alive, &id_to_index, &code_offsets, &id_offset_buf); - continue; - } - - // mark operands of alive function contents - try markAlive(parser, binary.*, inst, &alive, &id_to_index, &code_offsets, &id_offset_buf); - } - - // rewrite - var new_words: std.ArrayList(Word) = .empty; - defer new_words.deinit(gpa); - try new_words.ensureTotalCapacity(gpa, binary.instructions.len); - - var new_functions_start: ?usize = null; - - it = binary.iterateInstructions(); - while (it.next()) |inst| { - if (inst.offset >= binary.functions_start and inst.opcode == .OpFunction) { - const inst_spec = parser.getInstSpec(inst.opcode) orelse continue; - const result_id = getResultId(inst, inst_spec) orelse continue; - const index = id_to_index.get(result_id) orelse continue; - if (!alive.isSet(index)) { - while (it.next()) |inner| { - if (inner.opcode == .OpFunctionEnd) break; - } - continue; - } - } - - const is_prunable = canPrune(inst.opcode) or - (inst.opcode == .OpExtInst and inst.offset < binary.functions_start); - if (is_prunable) { - const inst_spec = parser.getInstSpec(inst.opcode) orelse { - appendInst(&new_words, binary, inst, &new_functions_start); - continue; - }; - - if (getResultId(inst, inst_spec)) |result_id| { - const index = id_to_index.get(result_id) orelse { - appendInst(&new_words, binary, inst, &new_functions_start); - continue; - }; - if (!alive.isSet(index)) continue; - } else { - // annotation-style: emit only if the target id is alive - if (inst.operands.len > 0) { - const target: ResultId = @fromBackingInt(@intCast(inst.operands[0])); - if (id_to_index.get(target)) |idx| { - if (!alive.isSet(idx)) continue; - } else continue; - } - } - } - - appendInst(&new_words, binary, inst, &new_functions_start); - } - - { - var to_remove: std.ArrayList(ResultId) = .empty; - defer to_remove.deinit(gpa); - - var ext_it = binary.ext_inst_map.iterator(); - while (ext_it.next()) |entry| { - if (id_to_index.get(entry.key_ptr.*)) |index| { - if (!alive.isSet(index)) try to_remove.append(gpa, entry.key_ptr.*); - } - } - for (to_remove.items) |id| _ = binary.ext_inst_map.remove(id); - - to_remove.items.len = 0; - var arith_it = binary.arith_type_width.iterator(); - while (arith_it.next()) |entry| { - if (id_to_index.get(entry.key_ptr.*)) |index| { - if (!alive.isSet(index)) try to_remove.append(gpa, entry.key_ptr.*); - } - } - for (to_remove.items) |id| _ = binary.arith_type_width.remove(id); - } - - binary.instructions = try gpa.dupe(Word, new_words.items); - binary.functions_start = new_functions_start orelse new_words.items.len; -} - -fn appendInst( - new_words: *std.ArrayList(Word), - binary: *const BinaryModule, - inst: BinaryModule.Instruction, - new_functions_start: *?usize, -) void { - if (new_functions_start.* == null and inst.offset >= binary.functions_start) { - new_functions_start.* = new_words.items.len; - } - const len = @as(usize, binary.instructions[inst.offset] >> 16); - new_words.appendSliceAssumeCapacity(binary.instructions[inst.offset..][0..len]); -} - -fn markAlive( - parser: *BinaryModule.Parser, - binary: BinaryModule, - inst: BinaryModule.Instruction, - alive: *std.bit_set.Dynamic, - id_to_index: *const std.AutoHashMapUnmanaged(ResultId, u32), - code_offsets: *const std.ArrayList(usize), - id_offset_buf: *std.ArrayList(u16), -) !void { - const start = id_offset_buf.items.len; - try parser.parseInstructionResultIds(binary, inst, id_offset_buf); - const end = id_offset_buf.items.len; - - var i = start; - while (i < end) : (i += 1) { - const off = id_offset_buf.items[i]; - const id: ResultId = @fromBackingInt(@intCast(inst.operands[off])); - const index = id_to_index.get(id) orelse continue; - if (alive.isSet(index)) continue; - alive.set(index); - - const offset = code_offsets.items[index]; - const ref_inst = BinaryModule.Instruction{ - .opcode = @fromBackingInt(@intCast(binary.instructions[offset] & 0xFFFF)), - .offset = offset, - .operands = blk: { - const l = binary.instructions[offset] >> 16; - break :blk binary.instructions[offset..][1..l]; - }, - }; - - if (ref_inst.opcode == .OpFunction) { - var fn_it = binary.iterateInstructionsFrom(ref_inst.offset); - _ = fn_it.next(); - while (fn_it.next()) |fn_inst| { - if (fn_inst.opcode == .OpFunctionEnd) break; - try markAlive(parser, binary, fn_inst, alive, id_to_index, code_offsets, id_offset_buf); - } - try markAlive(parser, binary, ref_inst, alive, id_to_index, code_offsets, id_offset_buf); - } else { - try markAlive(parser, binary, ref_inst, alive, id_to_index, code_offsets, id_offset_buf); - } - } -} - -fn getResultId(inst: BinaryModule.Instruction, inst_spec: spec.Instruction) ?ResultId { - for (0..@min(2, inst_spec.operands.len)) |i| { - if (inst_spec.operands[i].kind == .id_result) { - if (i < inst.operands.len) return @fromBackingInt(@intCast(inst.operands[i])); - } - } - return null; -} - -fn canPrune(op: Opcode) bool { - return switch (op.class()) { - .type_declaration, - .constant_creation, - .annotation, - => true, - else => switch (op) { - .OpFunction, - .OpUndef, - .OpString, - .OpName, - .OpMemberName, - .OpVariable, - => true, - else => false, - }, - }; -} diff --git a/src/link/Spirv.zig b/src/link/Spirv.zig new file mode 100644 index 0000000000000000000000000000000000000000..b40a3ae6e9cf99dabb5f1e7456a5b8b119393e72 --- /dev/null +++ b/src/link/Spirv.zig @@ -0,0 +1,252 @@ +const std = @import("std"); +const Allocator = std.mem.Allocator; +const Path = std.Build.Cache.Path; +const assert = std.debug.assert; +const Zcu = @import("../Zcu.zig"); +const InternPool = @import("../InternPool.zig"); +const Compilation = @import("../Compilation.zig"); +const link = @import("../link.zig"); +const codegen = @import("../codegen.zig"); +const CodeGen = @import("../codegen/spirv/CodeGen.zig"); +const Mir = @import("../codegen/spirv/Mir.zig"); +const spec = @import("../codegen/spirv/spec.zig"); +const Section = @import("../codegen/spirv/Section.zig"); +const Flush = @import("Spirv/Flush.zig"); +const Word = spec.Word; +const Linker = @This(); + +base: link.File, +mirs: std.array_hash_map.Auto(InternPool.Nav.Index, Mir), +objects: std.ArrayList(Object), +exports: std.array_hash_map.Auto(InternPool.Nav.Index, InternPool.NullTerminatedString), + +pub const Object = struct { path: Path, mir: Mir }; + +pub fn createEmpty( + arena: Allocator, + comp: *Compilation, + emit: Path, + options: link.File.OpenOptions, +) !*Linker { + const file = try emit.root_dir.handle.createFile(comp.io, emit.sub_path, .{}); + errdefer file.close(comp.io); + const linker = try arena.create(Linker); + linker.* = .{ + .base = .{ + .tag = .spirv, + .comp = comp, + .emit = emit, + .gc_sections = options.gc_sections orelse false, + .print_gc_sections = options.print_gc_sections, + .stack_size = options.stack_size orelse 0, + .allow_shlib_undefined = options.allow_shlib_undefined orelse false, + .file = file, + .build_id = options.build_id, + }, + .mirs = .empty, + .objects = .empty, + .exports = .empty, + }; + return linker; +} + +pub fn open( + arena: Allocator, + comp: *Compilation, + emit: Path, + options: link.File.OpenOptions, +) !*Linker { + return createEmpty(arena, comp, emit, options); +} + +pub fn deinit(linker: *Linker) void { + const gpa = linker.base.comp.gpa; + for (linker.mirs.values()) |*mir| mir.deinit(gpa); + linker.mirs.deinit(gpa); + for (linker.objects.items) |*object| object.mir.deinit(gpa); + linker.objects.deinit(gpa); + linker.exports.deinit(gpa); +} + +pub fn loadInput(linker: *Linker, input: link.Input) !void { + const diags = &linker.base.comp.link_diags; + switch (input) { + .object => |obj| try linker.loadObject(obj), + else => return diags.fail("unsupported link input for SPIR-V target", .{}), + } +} + +fn loadObject(linker: *Linker, obj: link.Input.Object) !void { + const comp = linker.base.comp; + const gpa = comp.gpa; + const io = comp.io; + const diags = &comp.link_diags; + + const file_size = obj.file.length(io) catch |err| { + return diags.failParse(obj.path, "failed to get file size: {t}", .{err}); + }; + if (file_size % @sizeOf(Word) != 0) { + return diags.failParse(obj.path, "file size is not a multiple of {d}", .{ + @sizeOf(Word), + }); + } + + const words = try gpa.alloc(Word, @intCast(file_size / @sizeOf(Word))); + defer gpa.free(words); + const bytes = std.mem.sliceAsBytes(words); + const n_read = obj.file.readPositionalAll(io, bytes, 0) catch |err| { + return diags.failParse(obj.path, "failed to read: {t}", .{err}); + }; + + if (n_read != bytes.len) { + return diags.failParse(obj.path, "incomplete read", .{}); + } + const header_len = @sizeOf(spec.Header) / @sizeOf(Word); + if (words.len < header_len) { + return diags.failParse(obj.path, "header too small", .{}); + } + const header = std.mem.bytesToValue(spec.Header, std.mem.sliceAsBytes(words[0..header_len])); + if (header.magic != spec.magic_number) { + return diags.failParse(obj.path, "invalid magic number", .{}); + } + if (header.id_bound == 0) { + return diags.failParse(obj.path, "invalid id bound", .{}); + } + + const instructions = words[header_len..]; + var module = Section.fromWords(gpa, instructions, header.id_bound) catch |err| switch (err) { + error.OutOfMemory => |e| return e, + else => return diags.failParse(obj.path, "failed to parse instructions: {t}", .{err}), + }; + errdefer module.deinit(gpa); + try linker.objects.append(gpa, .{ .path = obj.path, .mir = .{ + .id_bound = header.id_bound, + .module = module, + .nav_refs = &.{}, + .externs = &.{}, + .entry_points = &.{}, + } }); +} + +pub fn updateFunc( + linker: *Linker, + pt: Zcu.PerThread, + func_index: InternPool.Index, + mir: *codegen.AnyMir, +) !void { + const gpa = linker.base.comp.gpa; + const nav_index = pt.zcu.funcInfo(func_index).owner_nav; + const gop = try linker.mirs.getOrPut(gpa, nav_index); + if (gop.found_existing) gop.value_ptr.deinit(gpa); + gop.value_ptr.* = mir.spirv; + mir.spirv = .{ + .id_bound = 1, + .module = .empty, + .nav_refs = &.{}, + .externs = &.{}, + .entry_points = &.{}, + }; +} + +pub fn updateNav( + linker: *Linker, + pt: Zcu.PerThread, + nav_index: InternPool.Nav.Index, +) link.Error!void { + const gpa = linker.base.comp.gpa; + const ip = &pt.zcu.intern_pool; + const resolved = ip.getNav(nav_index).resolved.?; + switch (ip.indexToKey(resolved.value)) { + .func => return, + .@"extern" => |@"extern"| if (ip.isFunctionType(@"extern".ty)) return, + else => if (!resolved.@"const") assert(resolved.@"threadlocal") else return, + } + var mir = CodeGen.generateNav(pt, nav_index) catch |err| switch (err) { + error.AlreadyReported => return, + else => |e| return e, + }; + errdefer mir.deinit(gpa); + const gop = try linker.mirs.getOrPut(gpa, nav_index); + if (gop.found_existing) gop.value_ptr.deinit(gpa); + gop.value_ptr.* = mir; +} + +pub fn updateExports( + linker: *Linker, + pt: Zcu.PerThread, + export_indices: []const Zcu.Export.Index, +) link.Error!void { + const zcu = pt.zcu; + const ip = &zcu.intern_pool; + const gpa = linker.base.comp.gpa; + const diags = &linker.base.comp.link_diags; + + linker.exports.clearRetainingCapacity(); + try linker.exports.ensureUnusedCapacity(gpa, export_indices.len); + for (export_indices) |exp_index| { + const exp = exp_index.ptr(zcu); + const nav_index = switch (exp.exported) { + .nav => |nav| nav, + .uav => return diags.fail("cannot export a uav constant for SPIR-V target", .{}), + }; + const nav = ip.getNav(nav_index); + const resolved = nav.resolved.?; + if (!ip.isFunctionType(resolved.type) and !resolved.@"threadlocal") { + return diags.fail("cannot export constant '{f}' for SPIR-V target", .{ + nav.fqn.fmt(ip), + }); + } + linker.exports.putAssumeCapacity(nav_index, exp.opts.name); + } +} + +pub fn flush( + linker: *Linker, + arena: Allocator, + tid: Zcu.PerThread.Id, + prog_node: std.Progress.Node, +) link.Error!void { + _ = tid; + const comp = linker.base.comp; + const gpa = comp.gpa; + const diags = &comp.link_diags; + + const sub_node = prog_node.start("Flush Module", 1); + defer sub_node.end(); + + var f: Flush = .{ + .linker = linker, + .arena = arena, + .id_bound = 1, + .navs = .empty, + .symbols = .empty, + .interned = .empty, + .variables = .empty, + .function_references = .empty, + .entry_points = .empty, + .deps = .empty, + .scratch = .empty, + .extended_instruction_sets = .empty, + .object_entry_points = .empty, + .object_execution_modes = .empty, + .debug_strings = .empty, + .names = .empty, + .decorations = .empty, + .globals = .empty, + .declarations = .empty, + .functions = .empty, + }; + var out: Section = .empty; + defer out.deinit(gpa); + + try f.emitModule(&out); + sub_node.completeOne(); + + var writer = linker.base.file.?.writer(comp.io, &.{}); + writer.interface.writeSliceEndian(Word, out.instructions.items, .little) catch { + return diags.fail("failed to write {f}: {t}", .{ linker.base.emit, writer.err.? }); + }; + writer.end() catch |err| { + return diags.fail("failed to write {f}: {t}", .{ linker.base.emit, err }); + }; +} diff --git a/src/link/Spirv/Flush.zig b/src/link/Spirv/Flush.zig new file mode 100644 index 0000000000000000000000000000000000000000..a72fcf23f523d235f9acf1b5b0776df42edd2699 --- /dev/null +++ b/src/link/Spirv/Flush.zig @@ -0,0 +1,664 @@ +const std = @import("std"); +const Allocator = std.mem.Allocator; +const Path = std.Build.Cache.Path; +const assert = std.debug.assert; +const InternPool = @import("../../InternPool.zig"); +const link = @import("../../link.zig"); +const Type = @import("../../Type.zig"); +const Linker = @import("../Spirv.zig"); +const Mir = @import("../../codegen/spirv/Mir.zig"); +const spec = @import("../../codegen/spirv/spec.zig"); +const Section = @import("../../codegen/spirv/Section.zig"); +const zig_version = @import("builtin").zig_version; +const Id = spec.Id; +const Word = spec.Word; +const Flush = @This(); + +linker: *Linker, +arena: Allocator, +id_bound: Word, +navs: std.array_hash_map.Auto(InternPool.Nav.Index, Id), +symbols: std.array_hash_map.String(Symbol), +interned: std.array_hash_map.String(Id), +variables: std.array_hash_map.Auto(Id, spec.StorageClass), +function_references: std.array_hash_map.Auto(Id, []const Id), +entry_points: std.ArrayList(Mir.EntryPoint), +deps: std.ArrayList(Id), +scratch: Section, +extended_instruction_sets: Section, +object_entry_points: Section, +object_execution_modes: Section, +debug_strings: Section, +names: Section, +decorations: Section, +globals: Section, +declarations: Section, +functions: Section, + +const Symbol = struct { + id: Id, + defined: bool, + declaration: []const Word, +}; + +const Annotation = struct { + target: Word, + class: spec.Class, + start: usize, + end: usize, +}; + +const Input = struct { + mir: *const Mir, + ids: []Id, + marks: []u32, + mark: u32, + + fn copy( + input: *Input, + flush: *Flush, + dest: *Section, + start: usize, + end: usize, + result_index: ?usize, + ) !void { + const words = input.mir.module.instructions.items; + try dest.ensureUnusedCapacity(flush.arena, end - start); + for (words[start..end], start..) |word, i| { + if (i == result_index) { + dest.writeWord(0); + continue; + } + if (!input.mir.module.ids.isSet(i)) { + dest.writeWord(word); + continue; + } + if (input.marks[word] != input.mark) { + input.marks[word] = input.mark; + try flush.deps.append(flush.arena, input.ids[word]); + } + dest.writeWord(@backingInt(input.ids[word])); + } + } +}; + +fn allocId(flush: *Flush) Id { + const id: Id = @fromBackingInt(flush.id_bound); + flush.id_bound += 1; + return id; +} + +fn navId(flush: *Flush, nav: InternPool.Nav.Index) !Id { + const gop = try flush.navs.getOrPut(flush.arena, nav); + if (!gop.found_existing) gop.value_ptr.* = flush.allocId(); + return gop.value_ptr.*; +} + +pub fn emitModule(flush: *Flush, out: *Section) link.Error!void { + const linker = flush.linker; + const comp = linker.base.comp; + const zcu = comp.zcu.?; + const ip = &zcu.intern_pool; + const gpa = comp.gpa; + const arena = flush.arena; + const diags = &comp.link_diags; + const target = &comp.root_mod.resolved_target.result; + const is_object = comp.config.output_mode == .Obj; + + for (linker.exports.keys(), linker.exports.values()) |nav_index, name| { + if (!linker.mirs.contains(nav_index)) { + assert(zcu.failed_codegen.contains(nav_index)); + return error.AlreadyReported; + } + + const id = try flush.navId(nav_index); + const nav_ty: Type = .fromInterned(ip.getNav(nav_index).resolved.?.type); + if (nav_ty.zigTypeTag(zcu) == .@"fn") { + const cc = nav_ty.fnCallingConvention(zcu); + if (cc != .spirv_device) { + try flush.entry_points.append(arena, .{ + .id = id, + .name = name.toSlice(ip), + .cc = cc, + }); + continue; + } + } + if (!is_object) continue; + + try flush.symbols.putNoClobber(arena, name.toSlice(ip), .{ + .id = id, + .defined = true, + .declaration = &.{}, + }); + } + + for (linker.objects.items) |*object| { + try flush.load(&object.mir, object.path); + } + + const references = try zcu.resolveReferences(); + for (linker.mirs.keys(), linker.mirs.values()) |nav_index, *mir| { + const nav = ip.getNav(nav_index); + if (nav.getExtern(ip) != null) continue; + + const unit: InternPool.AnalUnit = switch (ip.indexToKey(nav.resolved.?.type)) { + .func_type => .wrap(.{ .func = zcu.navValue(nav_index).toIntern() }), + else => .wrap(.{ .nav_val = nav_index }), + }; + if (references.contains(unit)) try flush.load(mir, null); + } + + for (linker.mirs.keys(), linker.mirs.values()) |nav_index, *mir| { + if (ip.getNav(nav_index).getExtern(ip) == null) continue; + if (flush.navs.contains(nav_index)) try flush.load(mir, null); + } + + var failed = false; + for (flush.navs.keys()) |nav_index| { + if (linker.mirs.contains(nav_index) or zcu.failed_codegen.contains(nav_index)) continue; + diags.addError("undefined reference to '{f}'", .{ip.getNav(nav_index).fqn.fmt(ip)}); + failed = true; + } + for (flush.symbols.keys(), flush.symbols.values()) |name, symbol| { + if (is_object) { + try flush.decorations.emit(arena, .OpDecorate, .{ + .target = symbol.id, + .decoration = .{ .linkage_attributes = .{ + .name = name, + .linkage_type = if (symbol.defined) .@"export" else .import, + } }, + }); + } + if (symbol.defined) continue; + if (!is_object or symbol.declaration.len == 0) { + diags.addError("undefined symbol '{s}'", .{name}); + failed = true; + continue; + } + const header: spec.InstructionHeader = @bitCast(symbol.declaration[0]); + const section = if (header.opcode == .OpVariable) &flush.globals else &flush.declarations; + try section.writeWords(arena, symbol.declaration); + } + if (failed) return error.AlreadyReported; + + var version: spec.Version = .{ .major = 1, .minor = 0 }; + for ([_]std.Target.spirv.Feature{ + .v1_1, + .v1_2, + .v1_3, + .v1_4, + .v1_5, + .v1_6, + }) |feature| { + if (target.cpu.has(.spirv, feature)) version.minor += 1; + } + + const zig_packed_version = (zig_version.major << 12) | (zig_version.minor << 7) | zig_version.patch; + const header: spec.Header = .{ + .magic = spec.magic_number, + .version = version, + .generator = .{ .tool = spec.zig_generator_id, .version = zig_packed_version }, + .id_bound = flush.id_bound, + .schema = 0, + }; + try out.writeWords(gpa, @ptrCast(@alignCast(&header))); + try flush.emitCapabilities(out); + try out.writeWords(gpa, flush.extended_instruction_sets.instructions.items); + try flush.emitMemoryModel(out); + try flush.emitEntryPoints(out); + try out.writeWords(gpa, flush.object_entry_points.instructions.items); + try flush.emitExecutionModes(out); + try out.writeWords(gpa, flush.object_execution_modes.instructions.items); + try out.writeWords(gpa, flush.debug_strings.instructions.items); + try flush.emitSourceInfo(out, zig_packed_version); + try out.writeWords(gpa, flush.names.instructions.items); + try out.writeWords(gpa, flush.decorations.instructions.items); + try out.writeWords(gpa, flush.globals.instructions.items); + try out.writeWords(gpa, flush.declarations.instructions.items); + try out.writeWords(gpa, flush.functions.instructions.items); +} + +fn load(flush: *Flush, mir: *const Mir, path: ?Path) link.Error!void { + const comp = flush.linker.base.comp; + const gpa = comp.gpa; + const arena = flush.arena; + const diags = &comp.link_diags; + + const ids = try gpa.alloc(Id, mir.id_bound); + defer gpa.free(ids); + ids[0] = .none; + for (ids[1..], flush.id_bound..) |*id, i| id.* = @fromBackingInt(@intCast(i)); + flush.id_bound += mir.id_bound - 1; + + const marks = try gpa.alloc(u32, mir.id_bound); + defer gpa.free(marks); + @memset(marks, 0); + var input: Input = .{ .mir = mir, .ids = ids, .marks = marks, .mark = 0 }; + + var forward_pointers: std.bit_set.Dynamic = try .initEmpty(gpa, mir.id_bound); + defer forward_pointers.deinit(gpa); + var imports: std.array_hash_map.Auto(Word, u32) = .empty; + defer imports.deinit(gpa); + var annotations: std.ArrayList(Annotation) = .empty; + defer annotations.deinit(gpa); + + for (mir.nav_refs) |ref| ids[@backingInt(ref.id)] = try flush.navId(ref.nav); + for (mir.externs) |ext| { + const gop = try flush.symbols.getOrPut(arena, ext.name); + if (!gop.found_existing) gop.value_ptr.* = .{ + .id = ids[@backingInt(ext.id)], + .defined = false, + .declaration = &.{}, + }; + ids[@backingInt(ext.id)] = gop.value_ptr.id; + try imports.put(gpa, @backingInt(ext.id), @intCast(gop.index)); + } + + const words = mir.module.instructions.items; + var offset: usize = 0; + while (offset < words.len) { + const start = offset; + const header: spec.InstructionHeader = @bitCast(words[start]); + const inst = words[start..][0..header.word_count]; + offset += inst.len; + + if (header.opcode == .OpDecorate) { + const target = inst[1]; + const decoration: spec.Decoration = @fromBackingInt(inst[2]); + if (decoration == .linkage_attributes) { + const parameters = inst[3..]; + const name_words = parameters[0 .. parameters.len - 1]; + const name = std.mem.sliceTo(std.mem.sliceAsBytes(name_words), 0); + const linkage: spec.LinkageType = @fromBackingInt(parameters[parameters.len - 1]); + const gop = try flush.symbols.getOrPut(arena, name); + if (!gop.found_existing) gop.value_ptr.* = .{ + .id = ids[target], + .defined = false, + .declaration = &.{}, + }; + + switch (linkage) { + .@"export" => { + if (gop.value_ptr.defined) { + return diags.failParse(path.?, "duplicate export '{s}'", .{name}); + } + gop.value_ptr.defined = true; + }, + .import => try imports.put(gpa, target, @intCast(gop.index)), + .link_once_odr => { + return diags.failParse(path.?, "unsupported linkage '{t}'", .{linkage}); + }, + } + + ids[target] = gop.value_ptr.id; + continue; + } + } + + const class = header.opcode.class(); + const target: Word = switch (header.opcode) { + .OpName, .OpMemberName => inst[1], + .OpDecorationGroup, .OpGroupDecorate, .OpGroupMemberDecorate => { + return diags.failParse(path.?, "decoration groups are not supported", .{}); + }, + else => if (class == .annotation) inst[1] else continue, + }; + try annotations.append(gpa, .{ + .target = target, + .class = class, + .start = start, + .end = offset, + }); + } + + const starts = try gpa.alloc(u32, mir.id_bound + 1); + defer gpa.free(starts); + @memset(starts, 0); + + for (annotations.items) |annotation| starts[annotation.target + 1] += 1; + for (1..starts.len) |i| starts[i] += starts[i - 1]; + + const cursors = try gpa.dupe(u32, starts); + defer gpa.free(cursors); + const by_target = try gpa.alloc(u32, annotations.items.len); + defer gpa.free(by_target); + for (annotations.items, 0..) |annotation, i| { + by_target[cursors[annotation.target]] = @intCast(i); + cursors[annotation.target] += 1; + } + + var results: std.ArrayList(Word) = .empty; + defer results.deinit(gpa); + + offset = 0; + while (offset < words.len) { + const start = offset; + const header: spec.InstructionHeader = @bitCast(words[start]); + const inst = words[start..][0..header.word_count]; + offset += inst.len; + input.mark += 1; + flush.deps.clearRetainingCapacity(); + + const result_index = header.opcode.resultIndex() orelse { + switch (header.opcode) { + .OpEntryPoint => { + try input.copy(flush, &flush.object_entry_points, start, offset, null); + }, + .OpExecutionMode, .OpExecutionModeId => { + try input.copy(flush, &flush.object_execution_modes, start, offset, null); + }, + .OpTypeForwardPointer => { + forward_pointers.set(inst[1]); + try input.copy(flush, &flush.globals, start, offset, null); + }, + else => {}, + } + continue; + }; + const result = inst[result_index]; + results.clearRetainingCapacity(); + try results.append(gpa, result); + + var has_body = false; + if (header.opcode == .OpFunction) { + while (true) { + const body: spec.InstructionHeader = @bitCast(words[offset]); + if (body.opcode == .OpLabel) has_body = true; + if (body.opcode.resultIndex()) |index| { + try results.append(gpa, words[offset + index]); + } + offset += body.word_count; + if (body.opcode == .OpFunctionEnd) break; + } + } + + for (results.items) |own| input.marks[own] = input.mark; + + if (imports.get(result)) |symbol_index| { + flush.scratch.reset(); + try input.copy(flush, &flush.scratch, start, offset, null); + const declaration = try arena.dupe(Word, flush.scratch.instructions.items); + flush.symbols.values()[symbol_index].declaration = declaration; + continue; + } + + switch (header.opcode) { + .OpFunction => if (!has_body) return diags.failParse(path.?, "function declaration without linkage", .{}), + .OpVariable => try flush.variables.put(arena, ids[result], @fromBackingInt(inst[3])), + else => if (!forward_pointers.isSet(result)) { + flush.scratch.reset(); + try input.copy(flush, &flush.scratch, start, offset, start + result_index); + for (by_target[starts[result]..starts[result + 1]]) |index| { + const annotation = annotations.items[index]; + if (annotation.class != .annotation) continue; + const target = annotation.start + 1; + try input.copy(flush, &flush.scratch, annotation.start, annotation.end, target); + } + + const key = std.mem.sliceAsBytes(flush.scratch.instructions.items); + const gop = try flush.interned.getOrPut(arena, key); + if (gop.found_existing) { + ids[result] = gop.value_ptr.*; + continue; + } + gop.key_ptr.* = try arena.dupe(u8, key); + gop.value_ptr.* = ids[result]; + }, + } + + for (results.items) |target| { + for (by_target[starts[target]..starts[target + 1]]) |index| { + const annotation = annotations.items[index]; + const section = switch (annotation.class) { + .debug => &flush.names, + .annotation => &flush.decorations, + else => unreachable, + }; + try input.copy(flush, section, annotation.start, annotation.end, null); + } + } + + const section = switch (header.opcode) { + .OpFunction => &flush.functions, + .OpExtInstImport => &flush.extended_instruction_sets, + .OpString => &flush.debug_strings, + else => &flush.globals, + }; + try input.copy(flush, section, start, offset, null); + if (header.opcode == .OpFunction) { + const references = try arena.dupe(Id, flush.deps.items); + try flush.function_references.put(arena, ids[result], references); + } + } + + for (mir.entry_points) |entry_point| { + try flush.entry_points.append(arena, .{ + .id = ids[@backingInt(entry_point.id)], + .name = entry_point.name, + .cc = entry_point.cc, + }); + } +} + +fn emitCapabilities(flush: *Flush, out: *Section) link.Error!void { + const comp = flush.linker.base.comp; + const target = &comp.root_mod.resolved_target.result; + const gpa = comp.gpa; + + switch (target.os.tag) { + .opengl, .vulkan => try out.emit(gpa, .OpCapability, .{ .capability = .shader }), + .opencl => { + try out.emit(gpa, .OpCapability, .{ .capability = .kernel }); + try out.emit(gpa, .OpCapability, .{ .capability = .addresses }); + }, + else => unreachable, + } + + if (target.cpu.arch == .spirv64) { + if (!target.cpu.has(.spirv, .int64)) { + try out.emit(gpa, .OpCapability, .{ .capability = .int64 }); + } + if (target.os.tag == .vulkan) { + try out.emit(gpa, .OpCapability, .{ .capability = .physical_storage_buffer_addresses }); + } + } + + if (comp.config.output_mode == .Obj and flush.symbols.count() > 0) { + try out.emit(gpa, .OpCapability, .{ .capability = .linkage }); + } + + inline for (@typeInfo(spec.Capability).@"enum".field_names) |name| { + if (@hasField(std.Target.spirv.Feature, name)) { + const feature = @field(std.Target.spirv.Feature, name); + if (target.cpu.has(.spirv, feature)) { + try out.emit(gpa, .OpCapability, .{ .capability = @field(spec.Capability, name) }); + } + } + } + + if (target.cpu.arch == .spirv64 and target.os.tag == .vulkan) { + try out.emit(gpa, .OpExtension, .{ .name = "SPV_KHR_physical_storage_buffer" }); + } + + inline for (@typeInfo(spec.Extension).@"enum".field_names) |name| { + if (@hasField(std.Target.spirv.Feature, name)) { + const feature = @field(std.Target.spirv.Feature, name); + if (target.cpu.has(.spirv, feature)) try out.emit(gpa, .OpExtension, .{ .name = name }); + } + } +} + +fn emitMemoryModel(flush: *Flush, out: *Section) link.Error!void { + const comp = flush.linker.base.comp; + const target = &comp.root_mod.resolved_target.result; + const addressing_model: spec.AddressingModel = switch (target.os.tag) { + .opengl => .logical, + .vulkan => switch (target.cpu.arch) { + .spirv32 => .logical, + .spirv64 => .physical_storage_buffer64, + else => unreachable, + }, + .opencl => switch (target.cpu.arch) { + .spirv32 => .physical32, + .spirv64 => .physical64, + else => unreachable, + }, + else => unreachable, + }; + try out.emit(comp.gpa, .OpMemoryModel, .{ + .addressing_model = addressing_model, + .memory_model = switch (target.os.tag) { + .opencl => .open_cl, + .vulkan, .opengl => .glsl450, + else => unreachable, + }, + }); +} + +fn emitEntryPoints(flush: *Flush, out: *Section) link.Error!void { + const comp = flush.linker.base.comp; + const gpa = comp.gpa; + const arena = flush.arena; + const target = &comp.root_mod.resolved_target.result; + const v1_4 = target.cpu.has(.spirv, .v1_4); + + var visited: std.bit_set.Dynamic = try .initEmpty(arena, flush.id_bound); + var pending: std.ArrayList(Id) = .empty; + var interface: std.ArrayList(Id) = .empty; + for (flush.entry_points.items) |entry_point| { + const execution_model: spec.ExecutionModel = switch (entry_point.cc) { + .spirv_kernel => if (target.os.tag == .opencl) .kernel else .gl_compute, + .spirv_vertex => .vertex, + .spirv_fragment => .fragment, + .spirv_task => .task_ext, + .spirv_mesh => .mesh_ext, + else => unreachable, + }; + + visited.unsetAll(); + interface.clearRetainingCapacity(); + try pending.append(arena, entry_point.id); + while (pending.pop()) |id| { + if (visited.isSet(@backingInt(id))) continue; + visited.set(@backingInt(id)); + if (flush.variables.get(id)) |storage_class| { + if (storage_class == .function) continue; + if (!v1_4 and storage_class != .input and storage_class != .output) continue; + try interface.append(arena, id); + } else if (flush.function_references.get(id)) |references| { + try pending.appendSlice(arena, references); + } + } + + try out.emit(gpa, .OpEntryPoint, .{ + .execution_model = execution_model, + .entry_point = entry_point.id, + .name = entry_point.name, + .interface = interface.items, + }); + } +} + +fn emitExecutionModes(flush: *Flush, out: *Section) link.Error!void { + const comp = flush.linker.base.comp; + const gpa = comp.gpa; + const target = &comp.root_mod.resolved_target.result; + + for (flush.entry_points.items) |entry_point| switch (entry_point.cc) { + .spirv_kernel, .spirv_task => |kernel| { + try out.emit(gpa, .OpExecutionMode, .{ + .entry_point = entry_point.id, + .mode = .{ .local_size = .{ + .x_size = kernel.x, + .y_size = kernel.y, + .z_size = kernel.z, + } }, + }); + }, + .spirv_fragment => |fragment| { + try out.emit(gpa, .OpExecutionMode, .{ + .entry_point = entry_point.id, + .mode = if (target.os.tag == .vulkan) .origin_upper_left else .origin_lower_left, + }); + if (fragment.pixel_centered_integer) { + try out.emit(gpa, .OpExecutionMode, .{ + .entry_point = entry_point.id, + .mode = .pixel_center_integer, + }); + } + if (fragment.depth_assumption != .none) { + try out.emit(gpa, .OpExecutionMode, .{ + .entry_point = entry_point.id, + .mode = switch (fragment.depth_assumption) { + .none => unreachable, + .greater => .depth_greater, + .less => .depth_less, + .unchanged => .depth_unchanged, + }, + }); + } + }, + .spirv_mesh => |mesh| { + try out.emit(gpa, .OpExecutionMode, .{ + .entry_point = entry_point.id, + .mode = .{ .output_vertices = .{ .vertex_count = mesh.max_vertices } }, + }); + try out.emit(gpa, .OpExecutionMode, .{ + .entry_point = entry_point.id, + .mode = .{ .output_primitives_ext = .{ .primitive_count = mesh.max_primitives } }, + }); + try out.emit(gpa, .OpExecutionMode, .{ + .entry_point = entry_point.id, + .mode = .{ .local_size = .{ + .x_size = mesh.x, + .y_size = mesh.y, + .z_size = mesh.z, + } }, + }); + try out.emit(gpa, .OpExecutionMode, .{ + .entry_point = entry_point.id, + .mode = switch (mesh.stage_output) { + .output_points => .output_points, + .output_lines => .output_lines_ext, + .output_triangles => .output_triangles_ext, + }, + }); + }, + else => {}, + }; +} + +fn emitSourceInfo(flush: *Flush, out: *Section, version: u32) link.Error!void { + const comp = flush.linker.base.comp; + const gpa = comp.gpa; + const zcu = comp.zcu orelse return; + const ip = &zcu.intern_pool; + + var error_info: std.Io.Writer.Allocating = .init(gpa); + defer error_info.deinit(); + error_info.writer.writeAll("zig_errors:") catch return error.OutOfMemory; + for (ip.global_error_set.getNamesFromMainThread()) |name| { + error_info.writer.writeByte(':') catch return error.OutOfMemory; + std.Uri.Component.percentEncode( + &error_info.writer, + name.toSlice(ip), + struct { + fn isValidChar(c: u8) bool { + return switch (c) { + 0, '%', ':' => false, + else => true, + }; + } + }.isValidChar, + ) catch return error.OutOfMemory; + } + + try out.emit(gpa, .OpSourceExtension, .{ .extension = error_info.written() }); + try out.emit(gpa, .OpSource, .{ + .source_language = .zig, + .version = version, + .file = null, + .source = null, + }); +} diff --git a/src/target.zig b/src/target.zig index 5439374628c8f5d29c68a1e6aa55ad272e02e920..01fe63f4ef1bc77aaa56c4246298deb17715d8a7 100644 --- a/src/target.zig +++ b/src/target.zig @@ -604,6 +604,7 @@ pub fn defaultAddressSpace( // The default address space for functions on AVR is .flash to produce // correct fixups into progmem. if (context == .function and target.cpu.arch == .avr) return .flash; + if (context == .global_mutable and target.os.tag == .vulkan) return .private; return .generic; } @@ -649,6 +650,7 @@ pub fn shouldBlockPointerOps(target: *const std.Target, as: AddressSpace) bool { // Logical pointers that never support operations .constant, .local, + .private, .input, .output, .uniform, diff --git a/test/cases/compile_errors/SpirvType_vulkan_target.zig b/test/cases/compile_errors/SpirvType_vulkan_target.zig index fdb53678e3139870df23563a9b2ac5494e524cea..7871365f4ed83ecbda72abff178b24704b6496b8 100644 --- a/test/cases/compile_errors/SpirvType_vulkan_target.zig +++ b/test/cases/compile_errors/SpirvType_vulkan_target.zig @@ -50,7 +50,7 @@ comptime { // backend=selfhosted // target=spirv32-vulkan // -// :2:21: error: access qualifier '.read_only' is only valid under the 'opencl' os +// :2:21: error: access qualifier '.read_only' is only valid under the 'opencl' OS // :14:21: error: invalid 'sampled' field value 'bool' -// :26:21: error: 'void' type for 'sampled' field is only valid under the 'opencl' os -// :38:21: error: 'sampled' field value must be a 32-bit int, 64-bit int or 32-bit float under the 'vulkan' os +// :26:21: error: 'void' type for 'sampled' field is only valid under the 'opencl' OS +// :38:21: error: 'sampled' field value must be a 32-bit int, 64-bit int or 32-bit float under the 'vulkan' OS diff --git a/test/cases/compile_errors/extern_spirv_decoration_validation.zig b/test/cases/compile_errors/extern_spirv_decoration_validation.zig index a7cdd98b58e6195fe62281c9ed025659bc9c6a57..9d48f73bf50e2f653de0b690296c3bdccf4a3cd1 100644 --- a/test/cases/compile_errors/extern_spirv_decoration_validation.zig +++ b/test/cases/compile_errors/extern_spirv_decoration_validation.zig @@ -1,13 +1,30 @@ -const x = @extern(*addrspace(.push_constant) u32, .{ - .name = "x", +const flat = @extern(*addrspace(.push_constant) u32, .{ + .name = "flat", .decoration = .{ .flat = 0 }, }); +const location = @extern(*addrspace(.uniform) u32, .{ + .name = "location", + .decoration = .{ .location = 0 }, +}); +const descriptor = @extern(*addrspace(.input) u32, .{ + .name = "descriptor", + .decoration = .{ .descriptor = .{ .set = 0, .binding = 0 } }, +}); + comptime { - _ = x; + _ = flat; +} +comptime { + _ = location; +} +comptime { + _ = descriptor; } // error // backend=selfhosted // target=spirv32-vulkan // -// :1:52: error: "flat" decoration requires "input" or "output" address space +// :1:55: error: 'flat' decoration requires 'input' or 'output' address space +// :5:53: error: 'location' decoration requires 'input' or 'output' address space +// :9:53: error: 'descriptor' decoration requires 'storage_buffer', 'uniform', 'constant' or 'global' address space diff --git a/test/cases/compile_errors/spirv_global_var_must_be_threadlocal.zig b/test/cases/compile_errors/spirv_global_var_must_be_threadlocal.zig new file mode 100644 index 0000000000000000000000000000000000000000..107895a577d30a54735826ef23d1d4c245b1e845 --- /dev/null +++ b/test/cases/compile_errors/spirv_global_var_must_be_threadlocal.zig @@ -0,0 +1,12 @@ +var x: u32 = 0; + +comptime { + _ = x; +} + +// error +// backend=selfhosted +// target=spirv32-vulkan +// +// :1:1: error: SPIR-V target does not support global variables +// :1:1: note: consider using 'threadlocal' diff --git a/test/cases/compile_errors/spirv_vulkan_threadlocal_addrspace.zig b/test/cases/compile_errors/spirv_vulkan_threadlocal_addrspace.zig new file mode 100644 index 0000000000000000000000000000000000000000..517d2c7cb3a25afe41f8b7fe248d8a5c8c4f2df1 --- /dev/null +++ b/test/cases/compile_errors/spirv_vulkan_threadlocal_addrspace.zig @@ -0,0 +1,11 @@ +threadlocal var counter: u32 addrspace(.generic) = 0; + +export fn main() callconv(.kernel) void { + counter += 1; +} + +// error +// backend=selfhosted +// target=spirv32-vulkan +// +// :1:41: error: threadlocal variables with address space 'generic' are not supported on vulkan -- 2.54.0 From c4c3818c396dc57e1422356f3bb865d99c0c27e8 Mon Sep 17 00:00:00 2001 From: Ali Cheraghi Date: Sun, 13 Sep 2026 16:40:44 +0330 Subject: [PATCH 2/5] gen_spirv_spec: shrink output --- src/codegen/spirv/extinst.zig.grammar.json | 11 - src/codegen/spirv/spec.zig | 15037 ++----------------- src/link/Spirv/Flush.zig | 1 + tools/gen_spirv_spec.zig | 528 +- 4 files changed, 1539 insertions(+), 14038 deletions(-) delete mode 100644 src/codegen/spirv/extinst.zig.grammar.json diff --git a/src/codegen/spirv/extinst.zig.grammar.json b/src/codegen/spirv/extinst.zig.grammar.json deleted file mode 100644 index ea8c5f7729ea87446fe64b7981500d07f4959c55..0000000000000000000000000000000000000000 --- a/src/codegen/spirv/extinst.zig.grammar.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "version": 0, - "revision": 0, - "instructions": [ - { - "opname": "InvocationGlobal", - "opcode": 0, - "operands": [{ "kind": "IdRef", "name": "initializer function" }] - } - ] -} diff --git a/src/codegen/spirv/spec.zig b/src/codegen/spirv/spec.zig index 8f2733a92e6c169325d7e41ef0a166b21b46bee2..b45e3a2e73ec2809c9de1027b0d98c2bb56eeb30 100644 --- a/src/codegen/spirv/spec.zig +++ b/src/codegen/spirv/spec.zig @@ -1,31 +1,39 @@ //! This file is auto-generated by tools/gen_spirv_spec.zig. - const std = @import("std"); +pub const Word = u32; pub const Version = packed struct(Word) { padding: u8 = 0, minor: u8, major: u8, padding0: u8 = 0, - - pub fn toWord(self: @This()) Word { - return @bitCast(self); - } }; - -pub const Word = u32; +pub const Generator = packed struct(Word) { + version: u16, + tool: u16, +}; +pub const Header = extern struct { + magic: Word, + version: Version, + generator: Generator, + id_bound: Word, + schema: Word, +}; +pub const InstructionHeader = packed struct(Word) { + opcode: Opcode, + word_count: u16, +}; pub const Id = enum(Word) { none, _, - pub fn format(self: Id, writer: *std.Io.Writer) std.Io.Writer.Error!void { - switch (self) { + pub fn format(id: Id, writer: *std.Io.Writer) std.Io.Writer.Error!void { + switch (id) { .none => try writer.writeAll("(none)"), - else => try writer.print("%{d}", .{@backingInt(self)}), + else => try writer.print("%{d}", .{@backingInt(id)}), } } }; - pub const IdRange = struct { base: u32, len: u32, @@ -37,7 +45,6 @@ pub const IdRange = struct { }; pub const LiteralInteger = Word; -pub const LiteralFloat = Word; pub const LiteralString = []const u8; pub const LiteralContextDependentNumber = union(enum) { int32: i32, @@ -61,7 +68,7 @@ pub const Quantifier = enum { pub const Operand = struct { kind: OperandKind, - quantifier: Quantifier, + quantifier: Quantifier = .required, }; pub const OperandCategory = enum { @@ -75,16 +82,10 @@ pub const OperandCategory = enum { pub const Enumerant = struct { name: []const u8, value: Word, - parameters: []const OperandKind, + parameters: []const Operand, }; -pub const Instruction = struct { - name: []const u8, - opcode: Word, - operands: []const Operand, -}; - -pub const zig_generator_id: Word = 41; +pub const zig_generator_id: u16 = 41; pub const version: Version = .{ .major = 1, .minor = 6, .patch = 4 }; pub const magic_number: Word = 0x07230203; @@ -113,8 +114,6 @@ pub const Class = enum { pipe, device_side_enqueue, non_uniform, - tensor, - graph, reserved, }; @@ -192,8 +191,8 @@ pub const OperandKind = enum { pair_id_ref_id_ref, tensor_operands, - pub fn category(self: OperandKind) OperandCategory { - return switch (self) { + pub fn category(operand_kind: OperandKind) OperandCategory { + return switch (operand_kind) { .opcode => .literal, .image_operands => .bit_enum, .fp_fast_math_mode => .bit_enum, @@ -268,26 +267,26 @@ pub const OperandKind = enum { .tensor_operands => .bit_enum, }; } - pub fn enumerants(self: OperandKind) []const Enumerant { - return switch (self) { + pub fn enumerants(operand_kind: OperandKind) []const Enumerant { + return switch (operand_kind) { .opcode => unreachable, .image_operands => &.{ - .{ .name = "Bias", .value = 0x0001, .parameters = &.{.id_ref} }, - .{ .name = "Lod", .value = 0x0002, .parameters = &.{.id_ref} }, - .{ .name = "Grad", .value = 0x0004, .parameters = &.{ .id_ref, .id_ref } }, - .{ .name = "ConstOffset", .value = 0x0008, .parameters = &.{.id_ref} }, - .{ .name = "Offset", .value = 0x0010, .parameters = &.{.id_ref} }, - .{ .name = "ConstOffsets", .value = 0x0020, .parameters = &.{.id_ref} }, - .{ .name = "Sample", .value = 0x0040, .parameters = &.{.id_ref} }, - .{ .name = "MinLod", .value = 0x0080, .parameters = &.{.id_ref} }, - .{ .name = "MakeTexelAvailable", .value = 0x0100, .parameters = &.{.id_scope} }, - .{ .name = "MakeTexelVisible", .value = 0x0200, .parameters = &.{.id_scope} }, + .{ .name = "Bias", .value = 0x0001, .parameters = &.{.{ .kind = .id_ref }} }, + .{ .name = "Lod", .value = 0x0002, .parameters = &.{.{ .kind = .id_ref }} }, + .{ .name = "Grad", .value = 0x0004, .parameters = &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref } } }, + .{ .name = "ConstOffset", .value = 0x0008, .parameters = &.{.{ .kind = .id_ref }} }, + .{ .name = "Offset", .value = 0x0010, .parameters = &.{.{ .kind = .id_ref }} }, + .{ .name = "ConstOffsets", .value = 0x0020, .parameters = &.{.{ .kind = .id_ref }} }, + .{ .name = "Sample", .value = 0x0040, .parameters = &.{.{ .kind = .id_ref }} }, + .{ .name = "MinLod", .value = 0x0080, .parameters = &.{.{ .kind = .id_ref }} }, + .{ .name = "MakeTexelAvailable", .value = 0x0100, .parameters = &.{.{ .kind = .id_scope }} }, + .{ .name = "MakeTexelVisible", .value = 0x0200, .parameters = &.{.{ .kind = .id_scope }} }, .{ .name = "NonPrivateTexel", .value = 0x0400, .parameters = &.{} }, .{ .name = "VolatileTexel", .value = 0x0800, .parameters = &.{} }, .{ .name = "SignExtend", .value = 0x1000, .parameters = &.{} }, .{ .name = "ZeroExtend", .value = 0x2000, .parameters = &.{} }, .{ .name = "Nontemporal", .value = 0x4000, .parameters = &.{} }, - .{ .name = "Offsets", .value = 0x10000, .parameters = &.{.id_ref} }, + .{ .name = "Offsets", .value = 0x10000, .parameters = &.{.{ .kind = .id_ref }} }, }, .fp_fast_math_mode => &.{ .{ .name = "NotNaN", .value = 0x0001, .parameters = &.{} }, @@ -307,22 +306,12 @@ pub const OperandKind = enum { .{ .name = "Unroll", .value = 0x0001, .parameters = &.{} }, .{ .name = "DontUnroll", .value = 0x0002, .parameters = &.{} }, .{ .name = "DependencyInfinite", .value = 0x0004, .parameters = &.{} }, - .{ .name = "DependencyLength", .value = 0x0008, .parameters = &.{.literal_integer} }, - .{ .name = "MinIterations", .value = 0x0010, .parameters = &.{.literal_integer} }, - .{ .name = "MaxIterations", .value = 0x0020, .parameters = &.{.literal_integer} }, - .{ .name = "IterationMultiple", .value = 0x0040, .parameters = &.{.literal_integer} }, - .{ .name = "PeelCount", .value = 0x0080, .parameters = &.{.literal_integer} }, - .{ .name = "PartialCount", .value = 0x0100, .parameters = &.{.literal_integer} }, - .{ .name = "InitiationIntervalALTERA", .value = 0x10000, .parameters = &.{.literal_integer} }, - .{ .name = "MaxConcurrencyALTERA", .value = 0x20000, .parameters = &.{.literal_integer} }, - .{ .name = "DependencyArrayALTERA", .value = 0x40000, .parameters = &.{.literal_integer} }, - .{ .name = "PipelineEnableALTERA", .value = 0x80000, .parameters = &.{.literal_integer} }, - .{ .name = "LoopCoalesceALTERA", .value = 0x100000, .parameters = &.{.literal_integer} }, - .{ .name = "MaxInterleavingALTERA", .value = 0x200000, .parameters = &.{.literal_integer} }, - .{ .name = "SpeculatedIterationsALTERA", .value = 0x400000, .parameters = &.{.literal_integer} }, - .{ .name = "NoFusionALTERA", .value = 0x800000, .parameters = &.{} }, - .{ .name = "LoopCountALTERA", .value = 0x1000000, .parameters = &.{.literal_integer} }, - .{ .name = "MaxReinvocationDelayALTERA", .value = 0x2000000, .parameters = &.{.literal_integer} }, + .{ .name = "DependencyLength", .value = 0x0008, .parameters = &.{.{ .kind = .literal_integer }} }, + .{ .name = "MinIterations", .value = 0x0010, .parameters = &.{.{ .kind = .literal_integer }} }, + .{ .name = "MaxIterations", .value = 0x0020, .parameters = &.{.{ .kind = .literal_integer }} }, + .{ .name = "IterationMultiple", .value = 0x0040, .parameters = &.{.{ .kind = .literal_integer }} }, + .{ .name = "PeelCount", .value = 0x0080, .parameters = &.{.{ .kind = .literal_integer }} }, + .{ .name = "PartialCount", .value = 0x0100, .parameters = &.{.{ .kind = .literal_integer }} }, }, .function_control => &.{ .{ .name = "Inline", .value = 0x0001, .parameters = &.{} }, @@ -350,13 +339,11 @@ pub const OperandKind = enum { }, .memory_access => &.{ .{ .name = "Volatile", .value = 0x0001, .parameters = &.{} }, - .{ .name = "Aligned", .value = 0x0002, .parameters = &.{.literal_integer} }, + .{ .name = "Aligned", .value = 0x0002, .parameters = &.{.{ .kind = .literal_integer }} }, .{ .name = "Nontemporal", .value = 0x0004, .parameters = &.{} }, - .{ .name = "MakePointerAvailable", .value = 0x0008, .parameters = &.{.id_scope} }, - .{ .name = "MakePointerVisible", .value = 0x0010, .parameters = &.{.id_scope} }, + .{ .name = "MakePointerAvailable", .value = 0x0008, .parameters = &.{.{ .kind = .id_scope }} }, + .{ .name = "MakePointerVisible", .value = 0x0010, .parameters = &.{.{ .kind = .id_scope }} }, .{ .name = "NonPrivatePointer", .value = 0x0020, .parameters = &.{} }, - .{ .name = "AliasScopeINTELMask", .value = 0x10000, .parameters = &.{.id_ref} }, - .{ .name = "NoAliasINTELMask", .value = 0x20000, .parameters = &.{.id_ref} }, }, .kernel_profiling_info => &.{ .{ .name = "CmdExecTime", .value = 0x0001, .parameters = &.{} }, @@ -381,10 +368,7 @@ pub const OperandKind = enum { .{ .name = "Horizontal2Pixels", .value = 0x0004, .parameters = &.{} }, .{ .name = "Horizontal4Pixels", .value = 0x0008, .parameters = &.{} }, }, - .raw_access_chain_operands => &.{ - .{ .name = "RobustnessPerComponentNV", .value = 0x0001, .parameters = &.{} }, - .{ .name = "RobustnessPerElementNV", .value = 0x0002, .parameters = &.{} }, - }, + .raw_access_chain_operands => &.{}, .source_language => &.{ .{ .name = "Unknown", .value = 0, .parameters = &.{} }, .{ .name = "ESSL", .value = 1, .parameters = &.{} }, @@ -409,8 +393,6 @@ pub const OperandKind = enum { .{ .name = "Fragment", .value = 4, .parameters = &.{} }, .{ .name = "GLCompute", .value = 5, .parameters = &.{} }, .{ .name = "Kernel", .value = 6, .parameters = &.{} }, - .{ .name = "TaskNV", .value = 5267, .parameters = &.{} }, - .{ .name = "MeshNV", .value = 5268, .parameters = &.{} }, .{ .name = "RayGenerationKHR", .value = 5313, .parameters = &.{} }, .{ .name = "IntersectionKHR", .value = 5314, .parameters = &.{} }, .{ .name = "AnyHitKHR", .value = 5315, .parameters = &.{} }, @@ -433,7 +415,7 @@ pub const OperandKind = enum { .{ .name = "Vulkan", .value = 3, .parameters = &.{} }, }, .execution_mode => &.{ - .{ .name = "Invocations", .value = 0, .parameters = &.{.literal_integer} }, + .{ .name = "Invocations", .value = 0, .parameters = &.{.{ .kind = .literal_integer }} }, .{ .name = "SpacingEqual", .value = 1, .parameters = &.{} }, .{ .name = "SpacingFractionalEven", .value = 2, .parameters = &.{} }, .{ .name = "SpacingFractionalOdd", .value = 3, .parameters = &.{} }, @@ -449,8 +431,8 @@ pub const OperandKind = enum { .{ .name = "DepthGreater", .value = 14, .parameters = &.{} }, .{ .name = "DepthLess", .value = 15, .parameters = &.{} }, .{ .name = "DepthUnchanged", .value = 16, .parameters = &.{} }, - .{ .name = "LocalSize", .value = 17, .parameters = &.{ .literal_integer, .literal_integer, .literal_integer } }, - .{ .name = "LocalSizeHint", .value = 18, .parameters = &.{ .literal_integer, .literal_integer, .literal_integer } }, + .{ .name = "LocalSize", .value = 17, .parameters = &.{ .{ .kind = .literal_integer }, .{ .kind = .literal_integer }, .{ .kind = .literal_integer } } }, + .{ .name = "LocalSizeHint", .value = 18, .parameters = &.{ .{ .kind = .literal_integer }, .{ .kind = .literal_integer }, .{ .kind = .literal_integer } } }, .{ .name = "InputPoints", .value = 19, .parameters = &.{} }, .{ .name = "InputLines", .value = 20, .parameters = &.{} }, .{ .name = "InputLinesAdjacency", .value = 21, .parameters = &.{} }, @@ -458,39 +440,30 @@ pub const OperandKind = enum { .{ .name = "InputTrianglesAdjacency", .value = 23, .parameters = &.{} }, .{ .name = "Quads", .value = 24, .parameters = &.{} }, .{ .name = "Isolines", .value = 25, .parameters = &.{} }, - .{ .name = "OutputVertices", .value = 26, .parameters = &.{.literal_integer} }, + .{ .name = "OutputVertices", .value = 26, .parameters = &.{.{ .kind = .literal_integer }} }, .{ .name = "OutputPoints", .value = 27, .parameters = &.{} }, .{ .name = "OutputLineStrip", .value = 28, .parameters = &.{} }, .{ .name = "OutputTriangleStrip", .value = 29, .parameters = &.{} }, - .{ .name = "VecTypeHint", .value = 30, .parameters = &.{.literal_integer} }, + .{ .name = "VecTypeHint", .value = 30, .parameters = &.{.{ .kind = .literal_integer }} }, .{ .name = "ContractionOff", .value = 31, .parameters = &.{} }, .{ .name = "Initializer", .value = 33, .parameters = &.{} }, .{ .name = "Finalizer", .value = 34, .parameters = &.{} }, - .{ .name = "SubgroupSize", .value = 35, .parameters = &.{.literal_integer} }, - .{ .name = "SubgroupsPerWorkgroup", .value = 36, .parameters = &.{.literal_integer} }, - .{ .name = "SubgroupsPerWorkgroupId", .value = 37, .parameters = &.{.id_ref} }, - .{ .name = "LocalSizeId", .value = 38, .parameters = &.{ .id_ref, .id_ref, .id_ref } }, - .{ .name = "LocalSizeHintId", .value = 39, .parameters = &.{ .id_ref, .id_ref, .id_ref } }, + .{ .name = "SubgroupSize", .value = 35, .parameters = &.{.{ .kind = .literal_integer }} }, + .{ .name = "SubgroupsPerWorkgroup", .value = 36, .parameters = &.{.{ .kind = .literal_integer }} }, + .{ .name = "SubgroupsPerWorkgroupId", .value = 37, .parameters = &.{.{ .kind = .id_ref }} }, + .{ .name = "LocalSizeId", .value = 38, .parameters = &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref } } }, + .{ .name = "LocalSizeHintId", .value = 39, .parameters = &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref } } }, .{ .name = "NonCoherentColorAttachmentReadEXT", .value = 4169, .parameters = &.{} }, .{ .name = "NonCoherentDepthAttachmentReadEXT", .value = 4170, .parameters = &.{} }, .{ .name = "NonCoherentStencilAttachmentReadEXT", .value = 4171, .parameters = &.{} }, .{ .name = "SubgroupUniformControlFlowKHR", .value = 4421, .parameters = &.{} }, .{ .name = "PostDepthCoverage", .value = 4446, .parameters = &.{} }, - .{ .name = "DenormPreserve", .value = 4459, .parameters = &.{.literal_integer} }, - .{ .name = "DenormFlushToZero", .value = 4460, .parameters = &.{.literal_integer} }, - .{ .name = "SignedZeroInfNanPreserve", .value = 4461, .parameters = &.{.literal_integer} }, - .{ .name = "RoundingModeRTE", .value = 4462, .parameters = &.{.literal_integer} }, - .{ .name = "RoundingModeRTZ", .value = 4463, .parameters = &.{.literal_integer} }, - .{ .name = "NonCoherentTileAttachmentReadQCOM", .value = 4489, .parameters = &.{} }, - .{ .name = "TileShadingRateQCOM", .value = 4490, .parameters = &.{ .literal_integer, .literal_integer, .literal_integer } }, - .{ .name = "EarlyAndLateFragmentTestsAMD", .value = 5017, .parameters = &.{} }, + .{ .name = "DenormPreserve", .value = 4459, .parameters = &.{.{ .kind = .literal_integer }} }, + .{ .name = "DenormFlushToZero", .value = 4460, .parameters = &.{.{ .kind = .literal_integer }} }, + .{ .name = "SignedZeroInfNanPreserve", .value = 4461, .parameters = &.{.{ .kind = .literal_integer }} }, + .{ .name = "RoundingModeRTE", .value = 4462, .parameters = &.{.{ .kind = .literal_integer }} }, + .{ .name = "RoundingModeRTZ", .value = 4463, .parameters = &.{.{ .kind = .literal_integer }} }, .{ .name = "StencilRefReplacingEXT", .value = 5027, .parameters = &.{} }, - .{ .name = "CoalescingAMDX", .value = 5069, .parameters = &.{} }, - .{ .name = "IsApiEntryAMDX", .value = 5070, .parameters = &.{.id_ref} }, - .{ .name = "MaxNodeRecursionAMDX", .value = 5071, .parameters = &.{.id_ref} }, - .{ .name = "StaticNumWorkgroupsAMDX", .value = 5072, .parameters = &.{ .id_ref, .id_ref, .id_ref } }, - .{ .name = "ShaderIndexAMDX", .value = 5073, .parameters = &.{.id_ref} }, - .{ .name = "MaxNumWorkgroupsAMDX", .value = 5077, .parameters = &.{ .id_ref, .id_ref, .id_ref } }, .{ .name = "StencilRefUnchangedFrontAMD", .value = 5079, .parameters = &.{} }, .{ .name = "StencilRefGreaterFrontAMD", .value = 5080, .parameters = &.{} }, .{ .name = "StencilRefLessFrontAMD", .value = 5081, .parameters = &.{} }, @@ -499,10 +472,9 @@ pub const OperandKind = enum { .{ .name = "StencilRefLessBackAMD", .value = 5084, .parameters = &.{} }, .{ .name = "QuadDerivativesKHR", .value = 5088, .parameters = &.{} }, .{ .name = "RequireFullQuadsKHR", .value = 5089, .parameters = &.{} }, - .{ .name = "SharesInputWithAMDX", .value = 5102, .parameters = &.{ .id_ref, .id_ref } }, .{ .name = "ArithmeticPoisonKHR", .value = 5157, .parameters = &.{} }, .{ .name = "OutputLinesEXT", .value = 5269, .parameters = &.{} }, - .{ .name = "OutputPrimitivesEXT", .value = 5270, .parameters = &.{.literal_integer} }, + .{ .name = "OutputPrimitivesEXT", .value = 5270, .parameters = &.{.{ .kind = .literal_integer }} }, .{ .name = "DerivativeGroupQuadsKHR", .value = 5289, .parameters = &.{} }, .{ .name = "DerivativeGroupLinearKHR", .value = 5290, .parameters = &.{} }, .{ .name = "OutputTrianglesEXT", .value = 5298, .parameters = &.{} }, @@ -513,24 +485,8 @@ pub const OperandKind = enum { .{ .name = "ShadingRateInterlockOrderedEXT", .value = 5370, .parameters = &.{} }, .{ .name = "ShadingRateInterlockUnorderedEXT", .value = 5371, .parameters = &.{} }, .{ .name = "Shader64BitIndexingEXT", .value = 5427, .parameters = &.{} }, - .{ .name = "SharedLocalMemorySizeINTEL", .value = 5618, .parameters = &.{.literal_integer} }, - .{ .name = "RoundingModeRTPINTEL", .value = 5620, .parameters = &.{.literal_integer} }, - .{ .name = "RoundingModeRTNINTEL", .value = 5621, .parameters = &.{.literal_integer} }, - .{ .name = "FloatingPointModeALTINTEL", .value = 5622, .parameters = &.{.literal_integer} }, - .{ .name = "FloatingPointModeIEEEINTEL", .value = 5623, .parameters = &.{.literal_integer} }, - .{ .name = "MaxWorkgroupSizeINTEL", .value = 5893, .parameters = &.{ .literal_integer, .literal_integer, .literal_integer } }, - .{ .name = "MaxWorkDimINTEL", .value = 5894, .parameters = &.{.literal_integer} }, - .{ .name = "NoGlobalOffsetINTEL", .value = 5895, .parameters = &.{} }, - .{ .name = "NumSIMDWorkitemsINTEL", .value = 5896, .parameters = &.{.literal_integer} }, - .{ .name = "SchedulerTargetFmaxMhzINTEL", .value = 5903, .parameters = &.{.literal_integer} }, .{ .name = "MaximallyReconvergesKHR", .value = 6023, .parameters = &.{} }, - .{ .name = "FPFastMathDefault", .value = 6028, .parameters = &.{ .id_ref, .id_ref } }, - .{ .name = "StreamingInterfaceINTEL", .value = 6154, .parameters = &.{.literal_integer} }, - .{ .name = "RegisterMapInterfaceINTEL", .value = 6160, .parameters = &.{.literal_integer} }, - .{ .name = "NamedBarrierCountINTEL", .value = 6417, .parameters = &.{.literal_integer} }, - .{ .name = "MaximumRegistersINTEL", .value = 6461, .parameters = &.{.literal_integer} }, - .{ .name = "MaximumRegistersIdINTEL", .value = 6462, .parameters = &.{.id_ref} }, - .{ .name = "NamedMaximumRegistersINTEL", .value = 6463, .parameters = &.{.named_maximum_number_of_registers} }, + .{ .name = "FPFastMathDefault", .value = 6028, .parameters = &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref } } }, }, .storage_class => &.{ .{ .name = "UniformConstant", .value = 0, .parameters = &.{} }, @@ -547,8 +503,6 @@ pub const OperandKind = enum { .{ .name = "Image", .value = 11, .parameters = &.{} }, .{ .name = "StorageBuffer", .value = 12, .parameters = &.{} }, .{ .name = "TileImageEXT", .value = 4172, .parameters = &.{} }, - .{ .name = "TileAttachmentQCOM", .value = 4491, .parameters = &.{} }, - .{ .name = "NodePayloadAMDX", .value = 5068, .parameters = &.{} }, .{ .name = "CallableDataKHR", .value = 5328, .parameters = &.{} }, .{ .name = "IncomingCallableDataKHR", .value = 5329, .parameters = &.{} }, .{ .name = "RayPayloadKHR", .value = 5338, .parameters = &.{} }, @@ -556,12 +510,8 @@ pub const OperandKind = enum { .{ .name = "IncomingRayPayloadKHR", .value = 5342, .parameters = &.{} }, .{ .name = "ShaderRecordBufferKHR", .value = 5343, .parameters = &.{} }, .{ .name = "PhysicalStorageBuffer", .value = 5349, .parameters = &.{} }, - .{ .name = "HitObjectAttributeNV", .value = 5385, .parameters = &.{} }, .{ .name = "TaskPayloadWorkgroupEXT", .value = 5402, .parameters = &.{} }, .{ .name = "HitObjectAttributeEXT", .value = 5411, .parameters = &.{} }, - .{ .name = "CodeSectionINTEL", .value = 5605, .parameters = &.{} }, - .{ .name = "DeviceOnlyALTERA", .value = 5936, .parameters = &.{} }, - .{ .name = "HostOnlyALTERA", .value = 5937, .parameters = &.{} }, }, .dim => &.{ .{ .name = "1D", .value = 0, .parameters = &.{} }, @@ -684,30 +634,10 @@ pub const OperandKind = enum { .{ .name = "RTP", .value = 2, .parameters = &.{} }, .{ .name = "RTN", .value = 3, .parameters = &.{} }, }, - .fp_denorm_mode => &.{ - .{ .name = "Preserve", .value = 0, .parameters = &.{} }, - .{ .name = "FlushToZero", .value = 1, .parameters = &.{} }, - }, - .quantization_modes => &.{ - .{ .name = "TRN", .value = 0, .parameters = &.{} }, - .{ .name = "TRN_ZERO", .value = 1, .parameters = &.{} }, - .{ .name = "RND", .value = 2, .parameters = &.{} }, - .{ .name = "RND_ZERO", .value = 3, .parameters = &.{} }, - .{ .name = "RND_INF", .value = 4, .parameters = &.{} }, - .{ .name = "RND_MIN_INF", .value = 5, .parameters = &.{} }, - .{ .name = "RND_CONV", .value = 6, .parameters = &.{} }, - .{ .name = "RND_CONV_ODD", .value = 7, .parameters = &.{} }, - }, - .fp_operation_mode => &.{ - .{ .name = "IEEE", .value = 0, .parameters = &.{} }, - .{ .name = "ALT", .value = 1, .parameters = &.{} }, - }, - .overflow_modes => &.{ - .{ .name = "WRAP", .value = 0, .parameters = &.{} }, - .{ .name = "SAT", .value = 1, .parameters = &.{} }, - .{ .name = "SAT_ZERO", .value = 2, .parameters = &.{} }, - .{ .name = "SAT_SYM", .value = 3, .parameters = &.{} }, - }, + .fp_denorm_mode => &.{}, + .quantization_modes => &.{}, + .fp_operation_mode => &.{}, + .overflow_modes => &.{}, .linkage_type => &.{ .{ .name = "Export", .value = 0, .parameters = &.{} }, .{ .name = "Import", .value = 1, .parameters = &.{} }, @@ -718,12 +648,7 @@ pub const OperandKind = enum { .{ .name = "WriteOnly", .value = 1, .parameters = &.{} }, .{ .name = "ReadWrite", .value = 2, .parameters = &.{} }, }, - .host_access_qualifier => &.{ - .{ .name = "NoneINTEL", .value = 0, .parameters = &.{} }, - .{ .name = "ReadINTEL", .value = 1, .parameters = &.{} }, - .{ .name = "WriteINTEL", .value = 2, .parameters = &.{} }, - .{ .name = "ReadWriteINTEL", .value = 3, .parameters = &.{} }, - }, + .host_access_qualifier => &.{}, .function_parameter_attribute => &.{ .{ .name = "Zext", .value = 0, .parameters = &.{} }, .{ .name = "Sext", .value = 1, .parameters = &.{} }, @@ -737,17 +662,17 @@ pub const OperandKind = enum { }, .decoration => &.{ .{ .name = "RelaxedPrecision", .value = 0, .parameters = &.{} }, - .{ .name = "SpecId", .value = 1, .parameters = &.{.literal_integer} }, + .{ .name = "SpecId", .value = 1, .parameters = &.{.{ .kind = .literal_integer }} }, .{ .name = "Block", .value = 2, .parameters = &.{} }, .{ .name = "BufferBlock", .value = 3, .parameters = &.{} }, .{ .name = "RowMajor", .value = 4, .parameters = &.{} }, .{ .name = "ColMajor", .value = 5, .parameters = &.{} }, - .{ .name = "ArrayStride", .value = 6, .parameters = &.{.literal_integer} }, - .{ .name = "MatrixStride", .value = 7, .parameters = &.{.literal_integer} }, + .{ .name = "ArrayStride", .value = 6, .parameters = &.{.{ .kind = .literal_integer }} }, + .{ .name = "MatrixStride", .value = 7, .parameters = &.{.{ .kind = .literal_integer }} }, .{ .name = "GLSLShared", .value = 8, .parameters = &.{} }, .{ .name = "GLSLPacked", .value = 9, .parameters = &.{} }, .{ .name = "CPacked", .value = 10, .parameters = &.{} }, - .{ .name = "BuiltIn", .value = 11, .parameters = &.{.built_in} }, + .{ .name = "BuiltIn", .value = 11, .parameters = &.{.{ .kind = .built_in }} }, .{ .name = "NoPerspective", .value = 13, .parameters = &.{} }, .{ .name = "Flat", .value = 14, .parameters = &.{} }, .{ .name = "Patch", .value = 15, .parameters = &.{} }, @@ -762,130 +687,41 @@ pub const OperandKind = enum { .{ .name = "NonWritable", .value = 24, .parameters = &.{} }, .{ .name = "NonReadable", .value = 25, .parameters = &.{} }, .{ .name = "Uniform", .value = 26, .parameters = &.{} }, - .{ .name = "UniformId", .value = 27, .parameters = &.{.id_scope} }, + .{ .name = "UniformId", .value = 27, .parameters = &.{.{ .kind = .id_scope }} }, .{ .name = "SaturatedConversion", .value = 28, .parameters = &.{} }, - .{ .name = "Stream", .value = 29, .parameters = &.{.literal_integer} }, - .{ .name = "Location", .value = 30, .parameters = &.{.literal_integer} }, - .{ .name = "Component", .value = 31, .parameters = &.{.literal_integer} }, - .{ .name = "Index", .value = 32, .parameters = &.{.literal_integer} }, - .{ .name = "Binding", .value = 33, .parameters = &.{.literal_integer} }, - .{ .name = "DescriptorSet", .value = 34, .parameters = &.{.literal_integer} }, - .{ .name = "Offset", .value = 35, .parameters = &.{.literal_integer} }, - .{ .name = "XfbBuffer", .value = 36, .parameters = &.{.literal_integer} }, - .{ .name = "XfbStride", .value = 37, .parameters = &.{.literal_integer} }, - .{ .name = "FuncParamAttr", .value = 38, .parameters = &.{.function_parameter_attribute} }, - .{ .name = "FPRoundingMode", .value = 39, .parameters = &.{.fp_rounding_mode} }, - .{ .name = "FPFastMathMode", .value = 40, .parameters = &.{.fp_fast_math_mode} }, - .{ .name = "LinkageAttributes", .value = 41, .parameters = &.{ .literal_string, .linkage_type } }, + .{ .name = "Stream", .value = 29, .parameters = &.{.{ .kind = .literal_integer }} }, + .{ .name = "Location", .value = 30, .parameters = &.{.{ .kind = .literal_integer }} }, + .{ .name = "Component", .value = 31, .parameters = &.{.{ .kind = .literal_integer }} }, + .{ .name = "Index", .value = 32, .parameters = &.{.{ .kind = .literal_integer }} }, + .{ .name = "Binding", .value = 33, .parameters = &.{.{ .kind = .literal_integer }} }, + .{ .name = "DescriptorSet", .value = 34, .parameters = &.{.{ .kind = .literal_integer }} }, + .{ .name = "Offset", .value = 35, .parameters = &.{.{ .kind = .literal_integer }} }, + .{ .name = "XfbBuffer", .value = 36, .parameters = &.{.{ .kind = .literal_integer }} }, + .{ .name = "XfbStride", .value = 37, .parameters = &.{.{ .kind = .literal_integer }} }, + .{ .name = "FuncParamAttr", .value = 38, .parameters = &.{.{ .kind = .function_parameter_attribute }} }, + .{ .name = "FPRoundingMode", .value = 39, .parameters = &.{.{ .kind = .fp_rounding_mode }} }, + .{ .name = "FPFastMathMode", .value = 40, .parameters = &.{.{ .kind = .fp_fast_math_mode }} }, + .{ .name = "LinkageAttributes", .value = 41, .parameters = &.{ .{ .kind = .literal_string }, .{ .kind = .linkage_type } } }, .{ .name = "NoContraction", .value = 42, .parameters = &.{} }, - .{ .name = "InputAttachmentIndex", .value = 43, .parameters = &.{.literal_integer} }, - .{ .name = "Alignment", .value = 44, .parameters = &.{.literal_integer} }, - .{ .name = "MaxByteOffset", .value = 45, .parameters = &.{.literal_integer} }, - .{ .name = "AlignmentId", .value = 46, .parameters = &.{.id_ref} }, - .{ .name = "MaxByteOffsetId", .value = 47, .parameters = &.{.id_ref} }, + .{ .name = "InputAttachmentIndex", .value = 43, .parameters = &.{.{ .kind = .literal_integer }} }, + .{ .name = "Alignment", .value = 44, .parameters = &.{.{ .kind = .literal_integer }} }, + .{ .name = "MaxByteOffset", .value = 45, .parameters = &.{.{ .kind = .literal_integer }} }, + .{ .name = "AlignmentId", .value = 46, .parameters = &.{.{ .kind = .id_ref }} }, + .{ .name = "MaxByteOffsetId", .value = 47, .parameters = &.{.{ .kind = .id_ref }} }, .{ .name = "SaturatedToLargestFloat8NormalConversionEXT", .value = 4216, .parameters = &.{} }, .{ .name = "NoSignedWrap", .value = 4469, .parameters = &.{} }, .{ .name = "NoUnsignedWrap", .value = 4470, .parameters = &.{} }, - .{ .name = "WeightTextureQCOM", .value = 4487, .parameters = &.{} }, - .{ .name = "BlockMatchTextureQCOM", .value = 4488, .parameters = &.{} }, - .{ .name = "BlockMatchSamplerQCOM", .value = 4499, .parameters = &.{} }, - .{ .name = "ExplicitInterpAMD", .value = 4999, .parameters = &.{} }, - .{ .name = "NodeSharesPayloadLimitsWithAMDX", .value = 5019, .parameters = &.{.id_ref} }, - .{ .name = "NodeMaxPayloadsAMDX", .value = 5020, .parameters = &.{.id_ref} }, - .{ .name = "TrackFinishWritingAMDX", .value = 5078, .parameters = &.{} }, - .{ .name = "PayloadNodeNameAMDX", .value = 5091, .parameters = &.{.id_ref} }, - .{ .name = "PayloadNodeBaseIndexAMDX", .value = 5098, .parameters = &.{.id_ref} }, - .{ .name = "PayloadNodeSparseArrayAMDX", .value = 5099, .parameters = &.{} }, - .{ .name = "PayloadNodeArraySizeAMDX", .value = 5100, .parameters = &.{.id_ref} }, - .{ .name = "PayloadDispatchIndirectAMDX", .value = 5105, .parameters = &.{} }, - .{ .name = "ArrayStrideIdEXT", .value = 5124, .parameters = &.{.id_ref} }, - .{ .name = "OffsetIdEXT", .value = 5125, .parameters = &.{.id_ref} }, + .{ .name = "ArrayStrideIdEXT", .value = 5124, .parameters = &.{.{ .kind = .id_ref }} }, + .{ .name = "OffsetIdEXT", .value = 5125, .parameters = &.{.{ .kind = .id_ref }} }, .{ .name = "UTFEncodedKHR", .value = 5145, .parameters = &.{} }, - .{ .name = "OverrideCoverageNV", .value = 5248, .parameters = &.{} }, - .{ .name = "PassthroughNV", .value = 5250, .parameters = &.{} }, - .{ .name = "ViewportRelativeNV", .value = 5252, .parameters = &.{} }, - .{ .name = "SecondaryViewportRelativeNV", .value = 5256, .parameters = &.{.literal_integer} }, .{ .name = "PerPrimitiveEXT", .value = 5271, .parameters = &.{} }, - .{ .name = "PerViewNV", .value = 5272, .parameters = &.{} }, - .{ .name = "PerTaskNV", .value = 5273, .parameters = &.{} }, .{ .name = "PerVertexKHR", .value = 5285, .parameters = &.{} }, .{ .name = "NonUniform", .value = 5300, .parameters = &.{} }, .{ .name = "RestrictPointer", .value = 5355, .parameters = &.{} }, .{ .name = "AliasedPointer", .value = 5356, .parameters = &.{} }, - .{ .name = "MemberOffsetNV", .value = 5358, .parameters = &.{.literal_integer} }, - .{ .name = "HitObjectShaderRecordBufferNV", .value = 5386, .parameters = &.{} }, .{ .name = "HitObjectShaderRecordBufferEXT", .value = 5389, .parameters = &.{} }, - .{ .name = "BankNV", .value = 5397, .parameters = &.{.literal_integer} }, - .{ .name = "BindlessSamplerNV", .value = 5398, .parameters = &.{} }, - .{ .name = "BindlessImageNV", .value = 5399, .parameters = &.{} }, - .{ .name = "BoundSamplerNV", .value = 5400, .parameters = &.{} }, - .{ .name = "BoundImageNV", .value = 5401, .parameters = &.{} }, - .{ .name = "SIMTCallINTEL", .value = 5599, .parameters = &.{.literal_integer} }, - .{ .name = "ReferencedIndirectlyINTEL", .value = 5602, .parameters = &.{} }, - .{ .name = "ClobberINTEL", .value = 5607, .parameters = &.{.literal_string} }, - .{ .name = "SideEffectsINTEL", .value = 5608, .parameters = &.{} }, - .{ .name = "VectorComputeVariableINTEL", .value = 5624, .parameters = &.{} }, - .{ .name = "FuncParamIOKindINTEL", .value = 5625, .parameters = &.{.literal_integer} }, - .{ .name = "VectorComputeFunctionINTEL", .value = 5626, .parameters = &.{} }, - .{ .name = "StackCallINTEL", .value = 5627, .parameters = &.{} }, - .{ .name = "GlobalVariableOffsetINTEL", .value = 5628, .parameters = &.{.literal_integer} }, - .{ .name = "CounterBuffer", .value = 5634, .parameters = &.{.id_ref} }, - .{ .name = "UserSemantic", .value = 5635, .parameters = &.{.literal_string} }, - .{ .name = "UserTypeGOOGLE", .value = 5636, .parameters = &.{.literal_string} }, - .{ .name = "FunctionRoundingModeINTEL", .value = 5822, .parameters = &.{ .literal_integer, .fp_rounding_mode } }, - .{ .name = "FunctionDenormModeINTEL", .value = 5823, .parameters = &.{ .literal_integer, .fp_denorm_mode } }, - .{ .name = "RegisterALTERA", .value = 5825, .parameters = &.{} }, - .{ .name = "MemoryALTERA", .value = 5826, .parameters = &.{.literal_string} }, - .{ .name = "NumbanksALTERA", .value = 5827, .parameters = &.{.literal_integer} }, - .{ .name = "BankwidthALTERA", .value = 5828, .parameters = &.{.literal_integer} }, - .{ .name = "MaxPrivateCopiesALTERA", .value = 5829, .parameters = &.{.literal_integer} }, - .{ .name = "SinglepumpALTERA", .value = 5830, .parameters = &.{} }, - .{ .name = "DoublepumpALTERA", .value = 5831, .parameters = &.{} }, - .{ .name = "MaxReplicatesALTERA", .value = 5832, .parameters = &.{.literal_integer} }, - .{ .name = "SimpleDualPortALTERA", .value = 5833, .parameters = &.{} }, - .{ .name = "MergeALTERA", .value = 5834, .parameters = &.{ .literal_string, .literal_string } }, - .{ .name = "BankBitsALTERA", .value = 5835, .parameters = &.{.literal_integer} }, - .{ .name = "ForcePow2DepthALTERA", .value = 5836, .parameters = &.{.literal_integer} }, - .{ .name = "StridesizeALTERA", .value = 5883, .parameters = &.{.literal_integer} }, - .{ .name = "WordsizeALTERA", .value = 5884, .parameters = &.{.literal_integer} }, - .{ .name = "TrueDualPortALTERA", .value = 5885, .parameters = &.{} }, - .{ .name = "BurstCoalesceALTERA", .value = 5899, .parameters = &.{} }, - .{ .name = "CacheSizeALTERA", .value = 5900, .parameters = &.{.literal_integer} }, - .{ .name = "DontStaticallyCoalesceALTERA", .value = 5901, .parameters = &.{} }, - .{ .name = "PrefetchALTERA", .value = 5902, .parameters = &.{.literal_integer} }, - .{ .name = "StallEnableALTERA", .value = 5905, .parameters = &.{} }, - .{ .name = "FuseLoopsInFunctionALTERA", .value = 5907, .parameters = &.{} }, - .{ .name = "MathOpDSPModeALTERA", .value = 5909, .parameters = &.{ .literal_integer, .literal_integer } }, - .{ .name = "AliasScopeINTEL", .value = 5914, .parameters = &.{.id_ref} }, - .{ .name = "NoAliasINTEL", .value = 5915, .parameters = &.{.id_ref} }, - .{ .name = "InitiationIntervalALTERA", .value = 5917, .parameters = &.{.literal_integer} }, - .{ .name = "MaxConcurrencyALTERA", .value = 5918, .parameters = &.{.literal_integer} }, - .{ .name = "PipelineEnableALTERA", .value = 5919, .parameters = &.{.literal_integer} }, - .{ .name = "BufferLocationALTERA", .value = 5921, .parameters = &.{.literal_integer} }, - .{ .name = "IOPipeStorageALTERA", .value = 5944, .parameters = &.{.literal_integer} }, - .{ .name = "FunctionFloatingPointModeINTEL", .value = 6080, .parameters = &.{ .literal_integer, .fp_operation_mode } }, - .{ .name = "SingleElementVectorINTEL", .value = 6085, .parameters = &.{} }, - .{ .name = "VectorComputeCallableFunctionINTEL", .value = 6087, .parameters = &.{} }, - .{ .name = "MediaBlockIOINTEL", .value = 6140, .parameters = &.{} }, - .{ .name = "StallFreeALTERA", .value = 6151, .parameters = &.{} }, - .{ .name = "FPMaxErrorDecorationINTEL", .value = 6170, .parameters = &.{.literal_float} }, - .{ .name = "LatencyControlLabelALTERA", .value = 6172, .parameters = &.{.literal_integer} }, - .{ .name = "LatencyControlConstraintALTERA", .value = 6173, .parameters = &.{ .literal_integer, .literal_integer, .literal_integer } }, - .{ .name = "ConduitKernelArgumentALTERA", .value = 6175, .parameters = &.{} }, - .{ .name = "RegisterMapKernelArgumentALTERA", .value = 6176, .parameters = &.{} }, - .{ .name = "MMHostInterfaceAddressWidthALTERA", .value = 6177, .parameters = &.{.literal_integer} }, - .{ .name = "MMHostInterfaceDataWidthALTERA", .value = 6178, .parameters = &.{.literal_integer} }, - .{ .name = "MMHostInterfaceLatencyALTERA", .value = 6179, .parameters = &.{.literal_integer} }, - .{ .name = "MMHostInterfaceReadWriteModeALTERA", .value = 6180, .parameters = &.{.access_qualifier} }, - .{ .name = "MMHostInterfaceMaxBurstALTERA", .value = 6181, .parameters = &.{.literal_integer} }, - .{ .name = "MMHostInterfaceWaitRequestALTERA", .value = 6182, .parameters = &.{.literal_integer} }, - .{ .name = "StableKernelArgumentALTERA", .value = 6183, .parameters = &.{} }, - .{ .name = "HostAccessINTEL", .value = 6188, .parameters = &.{ .host_access_qualifier, .literal_string } }, - .{ .name = "InitModeALTERA", .value = 6190, .parameters = &.{.initialization_mode_qualifier} }, - .{ .name = "ImplementInRegisterMapALTERA", .value = 6191, .parameters = &.{.literal_integer} }, - .{ .name = "ConditionalINTEL", .value = 6247, .parameters = &.{.id_ref} }, - .{ .name = "CacheControlLoadINTEL", .value = 6442, .parameters = &.{ .literal_integer, .load_cache_control } }, - .{ .name = "CacheControlStoreINTEL", .value = 6443, .parameters = &.{ .literal_integer, .store_cache_control } }, + .{ .name = "CounterBuffer", .value = 5634, .parameters = &.{.{ .kind = .id_ref }} }, + .{ .name = "UserSemantic", .value = 5635, .parameters = &.{.{ .kind = .literal_string }} }, }, .built_in => &.{ .{ .name = "Position", .value = 0, .parameters = &.{} }, @@ -946,35 +782,10 @@ pub const OperandKind = enum { .{ .name = "DeviceIndex", .value = 4438, .parameters = &.{} }, .{ .name = "ViewIndex", .value = 4440, .parameters = &.{} }, .{ .name = "ShadingRateKHR", .value = 4444, .parameters = &.{} }, - .{ .name = "TileOffsetQCOM", .value = 4492, .parameters = &.{} }, - .{ .name = "TileDimensionQCOM", .value = 4493, .parameters = &.{} }, - .{ .name = "TileApronSizeQCOM", .value = 4494, .parameters = &.{} }, - .{ .name = "BaryCoordNoPerspAMD", .value = 4992, .parameters = &.{} }, - .{ .name = "BaryCoordNoPerspCentroidAMD", .value = 4993, .parameters = &.{} }, - .{ .name = "BaryCoordNoPerspSampleAMD", .value = 4994, .parameters = &.{} }, - .{ .name = "BaryCoordSmoothAMD", .value = 4995, .parameters = &.{} }, - .{ .name = "BaryCoordSmoothCentroidAMD", .value = 4996, .parameters = &.{} }, - .{ .name = "BaryCoordSmoothSampleAMD", .value = 4997, .parameters = &.{} }, - .{ .name = "BaryCoordPullModelAMD", .value = 4998, .parameters = &.{} }, .{ .name = "FragStencilRefEXT", .value = 5014, .parameters = &.{} }, - .{ .name = "RemainingRecursionLevelsAMDX", .value = 5021, .parameters = &.{} }, - .{ .name = "ShaderIndexAMDX", .value = 5073, .parameters = &.{} }, .{ .name = "SamplerHeapEXT", .value = 5122, .parameters = &.{} }, .{ .name = "ResourceHeapEXT", .value = 5123, .parameters = &.{} }, - .{ .name = "ViewportMaskNV", .value = 5253, .parameters = &.{} }, - .{ .name = "SecondaryPositionNV", .value = 5257, .parameters = &.{} }, - .{ .name = "SecondaryViewportMaskNV", .value = 5258, .parameters = &.{} }, - .{ .name = "PositionPerViewNV", .value = 5261, .parameters = &.{} }, - .{ .name = "ViewportMaskPerViewNV", .value = 5262, .parameters = &.{} }, .{ .name = "FullyCoveredEXT", .value = 5264, .parameters = &.{} }, - .{ .name = "TaskCountNV", .value = 5274, .parameters = &.{} }, - .{ .name = "PrimitiveCountNV", .value = 5275, .parameters = &.{} }, - .{ .name = "PrimitiveIndicesNV", .value = 5276, .parameters = &.{} }, - .{ .name = "ClipDistancePerViewNV", .value = 5277, .parameters = &.{} }, - .{ .name = "CullDistancePerViewNV", .value = 5278, .parameters = &.{} }, - .{ .name = "LayerPerViewNV", .value = 5279, .parameters = &.{} }, - .{ .name = "MeshViewCountNV", .value = 5280, .parameters = &.{} }, - .{ .name = "MeshViewIndicesNV", .value = 5281, .parameters = &.{} }, .{ .name = "BaryCoordKHR", .value = 5286, .parameters = &.{} }, .{ .name = "BaryCoordNoPerspKHR", .value = 5287, .parameters = &.{} }, .{ .name = "FragSizeEXT", .value = 5292, .parameters = &.{} }, @@ -994,27 +805,10 @@ pub const OperandKind = enum { .{ .name = "InstanceCustomIndexKHR", .value = 5327, .parameters = &.{} }, .{ .name = "ObjectToWorldKHR", .value = 5330, .parameters = &.{} }, .{ .name = "WorldToObjectKHR", .value = 5331, .parameters = &.{} }, - .{ .name = "HitTNV", .value = 5332, .parameters = &.{} }, .{ .name = "HitKindKHR", .value = 5333, .parameters = &.{} }, - .{ .name = "CurrentRayTimeNV", .value = 5334, .parameters = &.{} }, .{ .name = "HitTriangleVertexPositionsKHR", .value = 5335, .parameters = &.{} }, - .{ .name = "HitMicroTriangleVertexPositionsNV", .value = 5337, .parameters = &.{} }, - .{ .name = "HitMicroTriangleVertexBarycentricsNV", .value = 5344, .parameters = &.{} }, .{ .name = "IncomingRayFlagsKHR", .value = 5351, .parameters = &.{} }, .{ .name = "RayGeometryIndexKHR", .value = 5352, .parameters = &.{} }, - .{ .name = "HitIsSphereNV", .value = 5359, .parameters = &.{} }, - .{ .name = "HitIsLSSNV", .value = 5360, .parameters = &.{} }, - .{ .name = "HitSpherePositionNV", .value = 5361, .parameters = &.{} }, - .{ .name = "WarpsPerSMNV", .value = 5374, .parameters = &.{} }, - .{ .name = "SMCountNV", .value = 5375, .parameters = &.{} }, - .{ .name = "WarpIDNV", .value = 5376, .parameters = &.{} }, - .{ .name = "SMIDNV", .value = 5377, .parameters = &.{} }, - .{ .name = "HitLSSPositionsNV", .value = 5396, .parameters = &.{} }, - .{ .name = "HitKindFrontFacingMicroTriangleNV", .value = 5405, .parameters = &.{} }, - .{ .name = "HitKindBackFacingMicroTriangleNV", .value = 5406, .parameters = &.{} }, - .{ .name = "HitSphereRadiusNV", .value = 5420, .parameters = &.{} }, - .{ .name = "HitLSSRadiiNV", .value = 5421, .parameters = &.{} }, - .{ .name = "ClusterIDNV", .value = 5436, .parameters = &.{} }, .{ .name = "CullMaskKHR", .value = 6021, .parameters = &.{} }, }, .scope => &.{ @@ -1082,8 +876,6 @@ pub const OperandKind = enum { .{ .name = "InputAttachment", .value = 40, .parameters = &.{} }, .{ .name = "SparseResidency", .value = 41, .parameters = &.{} }, .{ .name = "MinLod", .value = 42, .parameters = &.{} }, - .{ .name = "Sampled1D", .value = 43, .parameters = &.{} }, - .{ .name = "Image1D", .value = 44, .parameters = &.{} }, .{ .name = "SampledCubeArray", .value = 45, .parameters = &.{} }, .{ .name = "SampledBuffer", .value = 46, .parameters = &.{} }, .{ .name = "ImageBuffer", .value = 47, .parameters = &.{} }, @@ -1111,15 +903,9 @@ pub const OperandKind = enum { .{ .name = "ShaderLayer", .value = 69, .parameters = &.{} }, .{ .name = "ShaderViewportIndex", .value = 70, .parameters = &.{} }, .{ .name = "UniformDecoration", .value = 71, .parameters = &.{} }, - .{ .name = "CoreBuiltinsARM", .value = 4165, .parameters = &.{} }, .{ .name = "TileImageColorReadAccessEXT", .value = 4166, .parameters = &.{} }, .{ .name = "TileImageDepthReadAccessEXT", .value = 4167, .parameters = &.{} }, .{ .name = "TileImageStencilReadAccessEXT", .value = 4168, .parameters = &.{} }, - .{ .name = "TensorsARM", .value = 4174, .parameters = &.{} }, - .{ .name = "StorageTensorArrayDynamicIndexingARM", .value = 4175, .parameters = &.{} }, - .{ .name = "StorageTensorArrayNonUniformIndexingARM", .value = 4176, .parameters = &.{} }, - .{ .name = "GraphARM", .value = 4191, .parameters = &.{} }, - .{ .name = "CooperativeMatrixLayoutsARM", .value = 4201, .parameters = &.{} }, .{ .name = "Float8EXT", .value = 4212, .parameters = &.{} }, .{ .name = "Float8CooperativeMatrixEXT", .value = 4213, .parameters = &.{} }, .{ .name = "FragmentShadingRateKHR", .value = 4422, .parameters = &.{} }, @@ -1145,30 +931,15 @@ pub const OperandKind = enum { .{ .name = "DenormPreserve", .value = 4464, .parameters = &.{} }, .{ .name = "DenormFlushToZero", .value = 4465, .parameters = &.{} }, .{ .name = "SignedZeroInfNanPreserve", .value = 4466, .parameters = &.{} }, - .{ .name = "RoundingModeRTE", .value = 4467, .parameters = &.{} }, - .{ .name = "RoundingModeRTZ", .value = 4468, .parameters = &.{} }, .{ .name = "RayQueryProvisionalKHR", .value = 4471, .parameters = &.{} }, .{ .name = "RayQueryKHR", .value = 4472, .parameters = &.{} }, .{ .name = "UntypedPointersKHR", .value = 4473, .parameters = &.{} }, .{ .name = "RayTraversalPrimitiveCullingKHR", .value = 4478, .parameters = &.{} }, .{ .name = "RayTracingKHR", .value = 4479, .parameters = &.{} }, - .{ .name = "TextureSampleWeightedQCOM", .value = 4484, .parameters = &.{} }, - .{ .name = "TextureBoxFilterQCOM", .value = 4485, .parameters = &.{} }, - .{ .name = "TextureBlockMatchQCOM", .value = 4486, .parameters = &.{} }, - .{ .name = "TileShadingQCOM", .value = 4495, .parameters = &.{} }, - .{ .name = "CooperativeMatrixConversionQCOM", .value = 4496, .parameters = &.{} }, - .{ .name = "TextureBlockMatch2QCOM", .value = 4498, .parameters = &.{} }, - .{ .name = "Float16ImageAMD", .value = 5008, .parameters = &.{} }, - .{ .name = "ImageGatherBiasLodAMD", .value = 5009, .parameters = &.{} }, - .{ .name = "FragmentMaskAMD", .value = 5010, .parameters = &.{} }, .{ .name = "StencilExportEXT", .value = 5013, .parameters = &.{} }, - .{ .name = "ImageReadWriteLodAMD", .value = 5015, .parameters = &.{} }, .{ .name = "Int64ImageEXT", .value = 5016, .parameters = &.{} }, .{ .name = "ShaderClockKHR", .value = 5055, .parameters = &.{} }, - .{ .name = "ShaderEnqueueAMDX", .value = 5067, .parameters = &.{} }, .{ .name = "QuadControlKHR", .value = 5087, .parameters = &.{} }, - .{ .name = "Int4TypeINTEL", .value = 5112, .parameters = &.{} }, - .{ .name = "Int4CooperativeMatrixINTEL", .value = 5114, .parameters = &.{} }, .{ .name = "BFloat16TypeKHR", .value = 5116, .parameters = &.{} }, .{ .name = "BFloat16DotProductKHR", .value = 5117, .parameters = &.{} }, .{ .name = "BFloat16CooperativeMatrixKHR", .value = 5118, .parameters = &.{} }, @@ -1176,15 +947,8 @@ pub const OperandKind = enum { .{ .name = "DescriptorHeapEXT", .value = 5128, .parameters = &.{} }, .{ .name = "ConstantDataKHR", .value = 5146, .parameters = &.{} }, .{ .name = "PoisonFreezeKHR", .value = 5156, .parameters = &.{} }, - .{ .name = "SampleMaskOverrideCoverageNV", .value = 5249, .parameters = &.{} }, - .{ .name = "GeometryShaderPassthroughNV", .value = 5251, .parameters = &.{} }, .{ .name = "ShaderViewportIndexLayerEXT", .value = 5254, .parameters = &.{} }, - .{ .name = "ShaderViewportMaskNV", .value = 5255, .parameters = &.{} }, - .{ .name = "ShaderStereoViewNV", .value = 5259, .parameters = &.{} }, - .{ .name = "PerViewAttributesNV", .value = 5260, .parameters = &.{} }, .{ .name = "FragmentFullyCoveredEXT", .value = 5265, .parameters = &.{} }, - .{ .name = "MeshShadingNV", .value = 5266, .parameters = &.{} }, - .{ .name = "ImageFootprintNV", .value = 5282, .parameters = &.{} }, .{ .name = "MeshShadingEXT", .value = 5283, .parameters = &.{} }, .{ .name = "FragmentBarycentricKHR", .value = 5284, .parameters = &.{} }, .{ .name = "ComputeDerivativeGroupQuadsKHR", .value = 5288, .parameters = &.{} }, @@ -1203,84 +967,24 @@ pub const OperandKind = enum { .{ .name = "UniformTexelBufferArrayNonUniformIndexing", .value = 5311, .parameters = &.{} }, .{ .name = "StorageTexelBufferArrayNonUniformIndexing", .value = 5312, .parameters = &.{} }, .{ .name = "RayTracingPositionFetchKHR", .value = 5336, .parameters = &.{} }, - .{ .name = "RayTracingNV", .value = 5340, .parameters = &.{} }, - .{ .name = "RayTracingMotionBlurNV", .value = 5341, .parameters = &.{} }, .{ .name = "VulkanMemoryModel", .value = 5345, .parameters = &.{} }, .{ .name = "VulkanMemoryModelDeviceScope", .value = 5346, .parameters = &.{} }, .{ .name = "PhysicalStorageBufferAddresses", .value = 5347, .parameters = &.{} }, .{ .name = "ComputeDerivativeGroupLinearKHR", .value = 5350, .parameters = &.{} }, .{ .name = "RayTracingProvisionalKHR", .value = 5353, .parameters = &.{} }, - .{ .name = "CooperativeMatrixNV", .value = 5357, .parameters = &.{} }, .{ .name = "FragmentShaderSampleInterlockEXT", .value = 5363, .parameters = &.{} }, .{ .name = "FragmentShaderShadingRateInterlockEXT", .value = 5372, .parameters = &.{} }, - .{ .name = "ShaderSMBuiltinsNV", .value = 5373, .parameters = &.{} }, .{ .name = "FragmentShaderPixelInterlockEXT", .value = 5378, .parameters = &.{} }, .{ .name = "DemoteToHelperInvocation", .value = 5379, .parameters = &.{} }, - .{ .name = "DisplacementMicromapNV", .value = 5380, .parameters = &.{} }, .{ .name = "RayTracingOpacityMicromapEXT", .value = 5381, .parameters = &.{} }, - .{ .name = "ShaderInvocationReorderNV", .value = 5383, .parameters = &.{} }, .{ .name = "ShaderInvocationReorderEXT", .value = 5388, .parameters = &.{} }, - .{ .name = "BindlessTextureNV", .value = 5390, .parameters = &.{} }, .{ .name = "RayQueryPositionFetchKHR", .value = 5391, .parameters = &.{} }, - .{ .name = "CooperativeVectorNV", .value = 5394, .parameters = &.{} }, - .{ .name = "AtomicFloat16VectorNV", .value = 5404, .parameters = &.{} }, - .{ .name = "RayTracingDisplacementMicromapNV", .value = 5409, .parameters = &.{} }, - .{ .name = "RawAccessChainsNV", .value = 5414, .parameters = &.{} }, - .{ .name = "RayTracingSpheresGeometryNV", .value = 5418, .parameters = &.{} }, - .{ .name = "RayTracingLinearSweptSpheresGeometryNV", .value = 5419, .parameters = &.{} }, - .{ .name = "PushConstantBanksNV", .value = 5423, .parameters = &.{} }, .{ .name = "LongVectorEXT", .value = 5425, .parameters = &.{} }, .{ .name = "Shader64BitIndexingEXT", .value = 5426, .parameters = &.{} }, - .{ .name = "CooperativeMatrixReductionsNV", .value = 5430, .parameters = &.{} }, - .{ .name = "CooperativeMatrixConversionsNV", .value = 5431, .parameters = &.{} }, - .{ .name = "CooperativeMatrixPerElementOperationsNV", .value = 5432, .parameters = &.{} }, - .{ .name = "CooperativeMatrixTensorAddressingNV", .value = 5433, .parameters = &.{} }, - .{ .name = "CooperativeMatrixBlockLoadsNV", .value = 5434, .parameters = &.{} }, - .{ .name = "CooperativeVectorTrainingNV", .value = 5435, .parameters = &.{} }, - .{ .name = "RayTracingClusterAccelerationStructureNV", .value = 5437, .parameters = &.{} }, - .{ .name = "TensorAddressingNV", .value = 5439, .parameters = &.{} }, - .{ .name = "SubgroupShuffleINTEL", .value = 5568, .parameters = &.{} }, - .{ .name = "SubgroupBufferBlockIOINTEL", .value = 5569, .parameters = &.{} }, - .{ .name = "SubgroupImageBlockIOINTEL", .value = 5570, .parameters = &.{} }, - .{ .name = "SubgroupImageMediaBlockIOINTEL", .value = 5579, .parameters = &.{} }, - .{ .name = "RoundToInfinityINTEL", .value = 5582, .parameters = &.{} }, - .{ .name = "FloatingPointModeINTEL", .value = 5583, .parameters = &.{} }, - .{ .name = "IntegerFunctions2INTEL", .value = 5584, .parameters = &.{} }, - .{ .name = "FunctionPointersINTEL", .value = 5603, .parameters = &.{} }, - .{ .name = "IndirectReferencesINTEL", .value = 5604, .parameters = &.{} }, - .{ .name = "AsmINTEL", .value = 5606, .parameters = &.{} }, .{ .name = "AtomicFloat32MinMaxEXT", .value = 5612, .parameters = &.{} }, .{ .name = "AtomicFloat64MinMaxEXT", .value = 5613, .parameters = &.{} }, .{ .name = "AtomicFloat16MinMaxEXT", .value = 5616, .parameters = &.{} }, - .{ .name = "VectorComputeINTEL", .value = 5617, .parameters = &.{} }, - .{ .name = "VectorAnyINTEL", .value = 5619, .parameters = &.{} }, .{ .name = "ExpectAssumeKHR", .value = 5629, .parameters = &.{} }, - .{ .name = "SubgroupAvcMotionEstimationINTEL", .value = 5696, .parameters = &.{} }, - .{ .name = "SubgroupAvcMotionEstimationIntraINTEL", .value = 5697, .parameters = &.{} }, - .{ .name = "SubgroupAvcMotionEstimationChromaINTEL", .value = 5698, .parameters = &.{} }, - .{ .name = "VariableLengthArrayINTEL", .value = 5817, .parameters = &.{} }, - .{ .name = "FunctionFloatControlINTEL", .value = 5821, .parameters = &.{} }, - .{ .name = "FPGAMemoryAttributesALTERA", .value = 5824, .parameters = &.{} }, - .{ .name = "FPFastMathModeINTEL", .value = 5837, .parameters = &.{} }, - .{ .name = "ArbitraryPrecisionIntegersALTERA", .value = 5844, .parameters = &.{} }, - .{ .name = "ArbitraryPrecisionFloatingPointALTERA", .value = 5845, .parameters = &.{} }, - .{ .name = "UnstructuredLoopControlsINTEL", .value = 5886, .parameters = &.{} }, - .{ .name = "FPGALoopControlsALTERA", .value = 5888, .parameters = &.{} }, - .{ .name = "KernelAttributesINTEL", .value = 5892, .parameters = &.{} }, - .{ .name = "FPGAKernelAttributesINTEL", .value = 5897, .parameters = &.{} }, - .{ .name = "FPGAMemoryAccessesALTERA", .value = 5898, .parameters = &.{} }, - .{ .name = "FPGAClusterAttributesALTERA", .value = 5904, .parameters = &.{} }, - .{ .name = "LoopFuseALTERA", .value = 5906, .parameters = &.{} }, - .{ .name = "FPGADSPControlALTERA", .value = 5908, .parameters = &.{} }, - .{ .name = "MemoryAccessAliasingINTEL", .value = 5910, .parameters = &.{} }, - .{ .name = "FPGAInvocationPipeliningAttributesALTERA", .value = 5916, .parameters = &.{} }, - .{ .name = "FPGABufferLocationALTERA", .value = 5920, .parameters = &.{} }, - .{ .name = "ArbitraryPrecisionFixedPointALTERA", .value = 5922, .parameters = &.{} }, - .{ .name = "USMStorageClassesALTERA", .value = 5935, .parameters = &.{} }, - .{ .name = "RuntimeAlignedAttributeALTERA", .value = 5939, .parameters = &.{} }, - .{ .name = "IOPipesALTERA", .value = 5943, .parameters = &.{} }, - .{ .name = "BlockingPipesALTERA", .value = 5945, .parameters = &.{} }, - .{ .name = "FPGARegALTERA", .value = 5948, .parameters = &.{} }, .{ .name = "DotProductInputAll", .value = 6016, .parameters = &.{} }, .{ .name = "DotProductInput4x8Bit", .value = 6017, .parameters = &.{} }, .{ .name = "DotProductInput4x8BitPacked", .value = 6018, .parameters = &.{} }, @@ -1294,40 +998,10 @@ pub const OperandKind = enum { .{ .name = "FMAKHR", .value = 6030, .parameters = &.{} }, .{ .name = "AtomicFloat32AddEXT", .value = 6033, .parameters = &.{} }, .{ .name = "AtomicFloat64AddEXT", .value = 6034, .parameters = &.{} }, - .{ .name = "LongCompositesINTEL", .value = 6089, .parameters = &.{} }, .{ .name = "OptNoneEXT", .value = 6094, .parameters = &.{} }, .{ .name = "AtomicFloat16AddEXT", .value = 6095, .parameters = &.{} }, - .{ .name = "DebugInfoModuleINTEL", .value = 6114, .parameters = &.{} }, - .{ .name = "BFloat16ConversionINTEL", .value = 6115, .parameters = &.{} }, - .{ .name = "SplitBarrierINTEL", .value = 6141, .parameters = &.{} }, .{ .name = "ArithmeticFenceEXT", .value = 6144, .parameters = &.{} }, - .{ .name = "FPGAClusterAttributesV2ALTERA", .value = 6150, .parameters = &.{} }, - .{ .name = "FPGAKernelAttributesv2INTEL", .value = 6161, .parameters = &.{} }, - .{ .name = "TaskSequenceALTERA", .value = 6162, .parameters = &.{} }, - .{ .name = "FPMaxErrorINTEL", .value = 6169, .parameters = &.{} }, - .{ .name = "FPGALatencyControlALTERA", .value = 6171, .parameters = &.{} }, - .{ .name = "FPGAArgumentInterfacesALTERA", .value = 6174, .parameters = &.{} }, - .{ .name = "GlobalVariableHostAccessINTEL", .value = 6187, .parameters = &.{} }, - .{ .name = "GlobalVariableFPGADecorationsALTERA", .value = 6189, .parameters = &.{} }, - .{ .name = "SubgroupBufferPrefetchINTEL", .value = 6220, .parameters = &.{} }, - .{ .name = "Subgroup2DBlockIOINTEL", .value = 6228, .parameters = &.{} }, - .{ .name = "Subgroup2DBlockTransformINTEL", .value = 6229, .parameters = &.{} }, - .{ .name = "Subgroup2DBlockTransposeINTEL", .value = 6230, .parameters = &.{} }, - .{ .name = "SubgroupMatrixMultiplyAccumulateINTEL", .value = 6236, .parameters = &.{} }, - .{ .name = "TernaryBitwiseFunctionINTEL", .value = 6241, .parameters = &.{} }, - .{ .name = "UntypedVariableLengthArrayINTEL", .value = 6243, .parameters = &.{} }, - .{ .name = "SpecConditionalINTEL", .value = 6245, .parameters = &.{} }, - .{ .name = "FunctionVariantsINTEL", .value = 6246, .parameters = &.{} }, .{ .name = "GroupUniformArithmeticKHR", .value = 6400, .parameters = &.{} }, - .{ .name = "TensorFloat32RoundingINTEL", .value = 6425, .parameters = &.{} }, - .{ .name = "MaskedGatherScatterINTEL", .value = 6427, .parameters = &.{} }, - .{ .name = "CacheControlsINTEL", .value = 6441, .parameters = &.{} }, - .{ .name = "RegisterLimitsINTEL", .value = 6460, .parameters = &.{} }, - .{ .name = "BindlessImagesINTEL", .value = 6528, .parameters = &.{} }, - .{ .name = "DotProductFloat16AccFloat32VALVE", .value = 6912, .parameters = &.{} }, - .{ .name = "DotProductFloat16AccFloat16VALVE", .value = 6913, .parameters = &.{} }, - .{ .name = "DotProductBFloat16AccVALVE", .value = 6914, .parameters = &.{} }, - .{ .name = "DotProductFloat8AccFloat32VALVE", .value = 6915, .parameters = &.{} }, }, .ray_query_intersection => &.{ .{ .name = "RayQueryCandidateIntersectionKHR", .value = 0, .parameters = &.{} }, @@ -1356,8 +1030,6 @@ pub const OperandKind = enum { .cooperative_matrix_layout => &.{ .{ .name = "RowMajorKHR", .value = 0, .parameters = &.{} }, .{ .name = "ColumnMajorKHR", .value = 1, .parameters = &.{} }, - .{ .name = "RowBlockedInterleavedARM", .value = 4202, .parameters = &.{} }, - .{ .name = "ColumnBlockedInterleavedARM", .value = 4203, .parameters = &.{} }, }, .cooperative_matrix_use => &.{ .{ .name = "MatrixAKHR", .value = 0, .parameters = &.{} }, @@ -1376,30 +1048,11 @@ pub const OperandKind = enum { .{ .name = "Repeat", .value = 3, .parameters = &.{} }, .{ .name = "RepeatMirrored", .value = 4, .parameters = &.{} }, }, - .tensor_addressing_operands => &.{ - .{ .name = "TensorView", .value = 0x0001, .parameters = &.{.id_ref} }, - .{ .name = "DecodeFunc", .value = 0x0002, .parameters = &.{.id_ref} }, - }, - .initialization_mode_qualifier => &.{ - .{ .name = "InitOnDeviceReprogramALTERA", .value = 0, .parameters = &.{} }, - .{ .name = "InitOnDeviceResetALTERA", .value = 1, .parameters = &.{} }, - }, - .load_cache_control => &.{ - .{ .name = "UncachedINTEL", .value = 0, .parameters = &.{} }, - .{ .name = "CachedINTEL", .value = 1, .parameters = &.{} }, - .{ .name = "StreamingINTEL", .value = 2, .parameters = &.{} }, - .{ .name = "InvalidateAfterReadINTEL", .value = 3, .parameters = &.{} }, - .{ .name = "ConstCachedINTEL", .value = 4, .parameters = &.{} }, - }, - .store_cache_control => &.{ - .{ .name = "UncachedINTEL", .value = 0, .parameters = &.{} }, - .{ .name = "WriteThroughINTEL", .value = 1, .parameters = &.{} }, - .{ .name = "WriteBackINTEL", .value = 2, .parameters = &.{} }, - .{ .name = "StreamingINTEL", .value = 3, .parameters = &.{} }, - }, - .named_maximum_number_of_registers => &.{ - .{ .name = "AutoINTEL", .value = 0, .parameters = &.{} }, - }, + .tensor_addressing_operands => &.{}, + .initialization_mode_qualifier => &.{}, + .load_cache_control => &.{}, + .store_cache_control => &.{}, + .named_maximum_number_of_registers => &.{}, .matrix_multiply_accumulate_operands => &.{ .{ .name = "MatrixASignedComponentsINTEL", .value = 0x1, .parameters = &.{} }, .{ .name = "MatrixBSignedComponentsINTEL", .value = 0x2, .parameters = &.{} }, @@ -1458,14 +1111,16 @@ pub const OperandKind = enum { .pair_literal_integer_id_ref => unreachable, .pair_id_ref_literal_integer => unreachable, .pair_id_ref_id_ref => unreachable, - .tensor_operands => &.{ - .{ .name = "NoneARM", .value = 0x0000, .parameters = &.{} }, - .{ .name = "NontemporalARM", .value = 0x0001, .parameters = &.{} }, - .{ .name = "OutOfBoundsValueARM", .value = 0x0002, .parameters = &.{.id_ref} }, - .{ .name = "MakeElementAvailableARM", .value = 0x0004, .parameters = &.{.id_ref} }, - .{ .name = "MakeElementVisibleARM", .value = 0x0008, .parameters = &.{.id_ref} }, - .{ .name = "NonPrivateElementARM", .value = 0x0010, .parameters = &.{} }, - }, + .tensor_operands => &.{}, + }; + } + + pub fn bases(operand_kind: OperandKind) []const OperandKind { + return switch (operand_kind) { + .pair_literal_integer_id_ref => &.{ .literal_integer, .id_ref }, + .pair_id_ref_literal_integer => &.{ .id_ref, .literal_integer }, + .pair_id_ref_id_ref => &.{ .id_ref, .id_ref }, + else => unreachable, }; } }; @@ -1818,17 +1473,6 @@ pub const Opcode = enum(u16) { OpColorAttachmentReadEXT = 4160, OpDepthAttachmentReadEXT = 4161, OpStencilAttachmentReadEXT = 4162, - OpTypeTensorARM = 4163, - OpTensorReadARM = 4164, - OpTensorWriteARM = 4165, - OpTensorQuerySizeARM = 4166, - OpGraphConstantARM = 4181, - OpGraphEntryPointARM = 4182, - OpGraphARM = 4183, - OpGraphInputARM = 4184, - OpGraphSetOutputARM = 4185, - OpGraphEndARM = 4186, - OpTypeGraphARM = 4190, OpTerminateInvocation = 4416, OpTypeUntypedPointerKHR = 4417, OpUntypedVariableKHR = 4418, @@ -1874,37 +1518,7 @@ pub const Opcode = enum(u16) { OpRayQueryConfirmIntersectionKHR = 4476, OpRayQueryProceedKHR = 4477, OpRayQueryGetIntersectionTypeKHR = 4479, - OpImageSampleWeightedQCOM = 4480, - OpImageBoxFilterQCOM = 4481, - OpImageBlockMatchSSDQCOM = 4482, - OpImageBlockMatchSADQCOM = 4483, - OpBitCastArrayQCOM = 4497, - OpImageBlockMatchWindowSSDQCOM = 4500, - OpImageBlockMatchWindowSADQCOM = 4501, - OpImageBlockMatchGatherSSDQCOM = 4502, - OpImageBlockMatchGatherSADQCOM = 4503, - OpCompositeConstructCoopMatQCOM = 4540, - OpCompositeExtractCoopMatQCOM = 4541, - OpExtractSubArrayQCOM = 4542, - OpGroupIAddNonUniformAMD = 5000, - OpGroupFAddNonUniformAMD = 5001, - OpGroupFMinNonUniformAMD = 5002, - OpGroupUMinNonUniformAMD = 5003, - OpGroupSMinNonUniformAMD = 5004, - OpGroupFMaxNonUniformAMD = 5005, - OpGroupUMaxNonUniformAMD = 5006, - OpGroupSMaxNonUniformAMD = 5007, - OpFragmentMaskFetchAMD = 5011, - OpFragmentFetchAMD = 5012, OpReadClockKHR = 5056, - OpAllocateNodePayloadsAMDX = 5074, - OpEnqueueNodePayloadsAMDX = 5075, - OpTypeNodePayloadArrayAMDX = 5076, - OpFinishWritingNodePayloadAMDX = 5078, - OpNodePayloadArrayLengthAMDX = 5090, - OpIsNodePayloadValidAMDX = 5101, - OpConstantStringAMDX = 5103, - OpSpecConstantStringAMDX = 5104, OpGroupNonUniformQuadAllKHR = 5110, OpGroupNonUniformQuadAnyKHR = 5111, OpTypeBufferEXT = 5115, @@ -1917,54 +1531,10 @@ pub const Opcode = enum(u16) { OpSpecConstantDataKHR = 5148, OpPoisonKHR = 5158, OpFreezeKHR = 5159, - OpHitObjectRecordHitMotionNV = 5249, - OpHitObjectRecordHitWithIndexMotionNV = 5250, - OpHitObjectRecordMissMotionNV = 5251, - OpHitObjectGetWorldToObjectNV = 5252, - OpHitObjectGetObjectToWorldNV = 5253, - OpHitObjectGetObjectRayDirectionNV = 5254, - OpHitObjectGetObjectRayOriginNV = 5255, - OpHitObjectTraceRayMotionNV = 5256, - OpHitObjectGetShaderRecordBufferHandleNV = 5257, - OpHitObjectGetShaderBindingTableRecordIndexNV = 5258, - OpHitObjectRecordEmptyNV = 5259, - OpHitObjectTraceRayNV = 5260, - OpHitObjectRecordHitNV = 5261, - OpHitObjectRecordHitWithIndexNV = 5262, - OpHitObjectRecordMissNV = 5263, - OpHitObjectExecuteShaderNV = 5264, - OpHitObjectGetCurrentTimeNV = 5265, - OpHitObjectGetAttributesNV = 5266, - OpHitObjectGetHitKindNV = 5267, - OpHitObjectGetPrimitiveIndexNV = 5268, - OpHitObjectGetGeometryIndexNV = 5269, - OpHitObjectGetInstanceIdNV = 5270, - OpHitObjectGetInstanceCustomIndexNV = 5271, - OpHitObjectGetWorldRayDirectionNV = 5272, - OpHitObjectGetWorldRayOriginNV = 5273, - OpHitObjectGetRayTMaxNV = 5274, - OpHitObjectGetRayTMinNV = 5275, - OpHitObjectIsEmptyNV = 5276, - OpHitObjectIsHitNV = 5277, - OpHitObjectIsMissNV = 5278, - OpReorderThreadWithHitObjectNV = 5279, - OpReorderThreadWithHintNV = 5280, - OpTypeHitObjectNV = 5281, - OpImageSampleFootprintNV = 5283, OpTypeVectorIdEXT = 5288, - OpCooperativeVectorMatrixMulNV = 5289, - OpCooperativeVectorOuterProductAccumulateNV = 5290, - OpCooperativeVectorReduceSumAccumulateNV = 5291, - OpCooperativeVectorMatrixMulAddNV = 5292, - OpCooperativeMatrixConvertNV = 5293, OpEmitMeshTasksEXT = 5294, OpSetMeshOutputsEXT = 5295, OpGroupNonUniformPartitionEXT = 5296, - OpWritePackedPrimitiveIndices4x8NV = 5299, - OpFetchMicroTriangleVertexPositionNV = 5300, - OpFetchMicroTriangleVertexBarycentricNV = 5301, - OpCooperativeVectorLoadNV = 5302, - OpCooperativeVectorStoreNV = 5303, OpHitObjectRecordFromQueryEXT = 5304, OpHitObjectRecordMissEXT = 5305, OpHitObjectRecordMissMotionEXT = 5306, @@ -1996,103 +1566,24 @@ pub const Opcode = enum(u16) { OpHitObjectGetWorldToObjectEXT = 5332, OpHitObjectGetRayTMaxEXT = 5333, OpReportIntersectionKHR = 5334, - OpIgnoreIntersectionNV = 5335, - OpTerminateRayNV = 5336, - OpTraceNV = 5337, - OpTraceMotionNV = 5338, - OpTraceRayMotionNV = 5339, OpRayQueryGetIntersectionTriangleVertexPositionsKHR = 5340, OpTypeAccelerationStructureKHR = 5341, - OpExecuteCallableNV = 5344, - OpRayQueryGetIntersectionClusterIdNV = 5345, - OpHitObjectGetClusterIdNV = 5346, OpHitObjectGetRayTMinEXT = 5347, OpHitObjectGetShaderBindingTableRecordIndexEXT = 5348, OpHitObjectGetShaderRecordBufferHandleEXT = 5349, OpHitObjectIsEmptyEXT = 5350, OpHitObjectIsHitEXT = 5351, OpHitObjectIsMissEXT = 5352, - OpTypeCooperativeMatrixNV = 5358, - OpCooperativeMatrixLoadNV = 5359, - OpCooperativeMatrixStoreNV = 5360, - OpCooperativeMatrixMulAddNV = 5361, - OpCooperativeMatrixLengthNV = 5362, OpBeginInvocationInterlockEXT = 5364, OpEndInvocationInterlockEXT = 5365, - OpCooperativeMatrixReduceNV = 5366, - OpCooperativeMatrixLoadTensorNV = 5367, - OpCooperativeMatrixStoreTensorNV = 5368, - OpCooperativeMatrixPerElementOpNV = 5369, - OpTypeTensorLayoutNV = 5370, - OpTypeTensorViewNV = 5371, - OpCreateTensorLayoutNV = 5372, - OpTensorLayoutSetDimensionNV = 5373, - OpTensorLayoutSetStrideNV = 5374, - OpTensorLayoutSliceNV = 5375, - OpTensorLayoutSetClampValueNV = 5376, - OpCreateTensorViewNV = 5377, - OpTensorViewSetDimensionNV = 5378, - OpTensorViewSetStrideNV = 5379, OpDemoteToHelperInvocation = 5380, OpIsHelperInvocationEXT = 5381, - OpTensorViewSetClipNV = 5382, - OpTensorLayoutSetBlockSizeNV = 5384, - OpCooperativeMatrixTransposeNV = 5390, - OpConvertUToImageNV = 5391, - OpConvertUToSamplerNV = 5392, - OpConvertImageToUNV = 5393, - OpConvertSamplerToUNV = 5394, - OpConvertUToSampledImageNV = 5395, - OpConvertSampledImageToUNV = 5396, - OpSamplerImageAddressingModeNV = 5397, - OpRawAccessChainNV = 5398, - OpRayQueryGetIntersectionSpherePositionNV = 5427, - OpRayQueryGetIntersectionSphereRadiusNV = 5428, - OpRayQueryGetIntersectionLSSPositionsNV = 5429, - OpRayQueryGetIntersectionLSSRadiiNV = 5430, - OpRayQueryGetIntersectionLSSHitValueNV = 5431, - OpHitObjectGetSpherePositionNV = 5432, - OpHitObjectGetSphereRadiusNV = 5433, - OpHitObjectGetLSSPositionsNV = 5434, - OpHitObjectGetLSSRadiiNV = 5435, - OpHitObjectIsSphereHitNV = 5436, - OpHitObjectIsLSSHitNV = 5437, - OpRayQueryIsSphereHitNV = 5438, - OpRayQueryIsLSSHitNV = 5439, - OpSubgroupShuffleINTEL = 5571, - OpSubgroupShuffleDownINTEL = 5572, - OpSubgroupShuffleUpINTEL = 5573, - OpSubgroupShuffleXorINTEL = 5574, - OpSubgroupBlockReadINTEL = 5575, - OpSubgroupBlockWriteINTEL = 5576, - OpSubgroupImageBlockReadINTEL = 5577, - OpSubgroupImageBlockWriteINTEL = 5578, - OpSubgroupImageMediaBlockReadINTEL = 5580, - OpSubgroupImageMediaBlockWriteINTEL = 5581, - OpUCountLeadingZerosINTEL = 5585, - OpUCountTrailingZerosINTEL = 5586, - OpAbsISubINTEL = 5587, - OpAbsUSubINTEL = 5588, - OpIAddSatINTEL = 5589, - OpUAddSatINTEL = 5590, - OpIAverageINTEL = 5591, - OpUAverageINTEL = 5592, - OpIAverageRoundedINTEL = 5593, - OpUAverageRoundedINTEL = 5594, - OpISubSatINTEL = 5595, - OpUSubSatINTEL = 5596, - OpIMul32x16INTEL = 5597, - OpUMul32x16INTEL = 5598, OpAtomicFMinEXT = 5614, OpAtomicFMaxEXT = 5615, OpAssumeTrueKHR = 5630, OpExpectKHR = 5631, OpDecorateString = 5632, OpMemberDecorateString = 5633, - OpVariableLengthArrayINTEL = 5818, - OpSaveMemoryINTEL = 5819, - OpRestoreMemoryINTEL = 5820, - OpLoopControlINTEL = 5887, OpRayQueryGetRayTMinKHR = 6016, OpRayQueryGetRayFlagsKHR = 6017, OpRayQueryGetIntersectionTKHR = 6018, @@ -2111,32 +1602,7 @@ pub const Opcode = enum(u16) { OpRayQueryGetIntersectionObjectToWorldKHR = 6031, OpRayQueryGetIntersectionWorldToObjectKHR = 6032, OpAtomicFAddEXT = 6035, - OpTypeBufferSurfaceINTEL = 6086, - OpTypeStructContinuedINTEL = 6090, - OpConstantCompositeContinuedINTEL = 6091, - OpSpecConstantCompositeContinuedINTEL = 6092, - OpCompositeConstructContinuedINTEL = 6096, - OpConvertFToBF16INTEL = 6116, - OpConvertBF16ToFINTEL = 6117, - OpControlBarrierArriveINTEL = 6142, - OpControlBarrierWaitINTEL = 6143, OpArithmeticFenceEXT = 6145, - OpSubgroupBlockPrefetchINTEL = 6221, - OpSubgroup2DBlockLoadINTEL = 6231, - OpSubgroup2DBlockLoadTransformINTEL = 6232, - OpSubgroup2DBlockLoadTransposeINTEL = 6233, - OpSubgroup2DBlockPrefetchINTEL = 6234, - OpSubgroup2DBlockStoreINTEL = 6235, - OpSubgroupMatrixMultiplyAccumulateINTEL = 6237, - OpBitwiseFunctionINTEL = 6242, - OpUntypedVariableLengthArrayINTEL = 6244, - OpConditionalExtensionINTEL = 6248, - OpConditionalEntryPointINTEL = 6249, - OpConditionalCapabilityINTEL = 6250, - OpSpecConstantTargetINTEL = 6251, - OpSpecConstantArchitectureINTEL = 6252, - OpSpecConstantCapabilitiesINTEL = 6253, - OpConditionalCopyObjectINTEL = 6254, OpGroupIMulKHR = 6401, OpGroupFMulKHR = 6402, OpGroupBitwiseAndKHR = 6403, @@ -2145,18 +1611,499 @@ pub const Opcode = enum(u16) { OpGroupLogicalAndKHR = 6406, OpGroupLogicalOrKHR = 6407, OpGroupLogicalXorKHR = 6408, - OpRoundFToTF32INTEL = 6426, - OpMaskedGatherINTEL = 6428, - OpMaskedScatterINTEL = 6429, - OpConvertHandleToImageINTEL = 6529, - OpConvertHandleToSamplerINTEL = 6530, - OpConvertHandleToSampledImageINTEL = 6531, - OpFDot2MixAcc32VALVE = 6916, - OpFDot2MixAcc16VALVE = 6917, - OpFDot4MixAcc32VALVE = 6918, - pub fn Operands(comptime self: Opcode) type { - return switch (self) { + pub fn operands(opcode: Opcode) []const Operand { + return switch (opcode) { + .OpNop => &.{}, + .OpUndef => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result } }, + .OpSourceContinued => &.{.{ .kind = .literal_string }}, + .OpSource => &.{ .{ .kind = .source_language }, .{ .kind = .literal_integer }, .{ .kind = .id_ref, .quantifier = .optional }, .{ .kind = .literal_string, .quantifier = .optional } }, + .OpSourceExtension => &.{.{ .kind = .literal_string }}, + .OpName => &.{ .{ .kind = .id_ref }, .{ .kind = .literal_string } }, + .OpMemberName => &.{ .{ .kind = .id_ref }, .{ .kind = .literal_integer }, .{ .kind = .literal_string } }, + .OpString => &.{ .{ .kind = .id_result }, .{ .kind = .literal_string } }, + .OpLine => &.{ .{ .kind = .id_ref }, .{ .kind = .literal_integer }, .{ .kind = .literal_integer } }, + .OpExtension => &.{.{ .kind = .literal_string }}, + .OpExtInstImport => &.{ .{ .kind = .id_result }, .{ .kind = .literal_string } }, + .OpExtInst => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .literal_ext_inst_integer }, .{ .kind = .id_ref, .quantifier = .variadic } }, + .OpMemoryModel => &.{ .{ .kind = .addressing_model }, .{ .kind = .memory_model } }, + .OpEntryPoint => &.{ .{ .kind = .execution_model }, .{ .kind = .id_ref }, .{ .kind = .literal_string }, .{ .kind = .id_ref, .quantifier = .variadic } }, + .OpExecutionMode => &.{ .{ .kind = .id_ref }, .{ .kind = .execution_mode } }, + .OpCapability => &.{.{ .kind = .capability }}, + .OpTypeVoid => &.{.{ .kind = .id_result }}, + .OpTypeBool => &.{.{ .kind = .id_result }}, + .OpTypeInt => &.{ .{ .kind = .id_result }, .{ .kind = .literal_integer }, .{ .kind = .literal_integer } }, + .OpTypeFloat => &.{ .{ .kind = .id_result }, .{ .kind = .literal_integer }, .{ .kind = .fp_encoding, .quantifier = .optional } }, + .OpTypeVector => &.{ .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .literal_integer } }, + .OpTypeMatrix => &.{ .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .literal_integer } }, + .OpTypeImage => &.{ .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .dim }, .{ .kind = .literal_integer }, .{ .kind = .literal_integer }, .{ .kind = .literal_integer }, .{ .kind = .literal_integer }, .{ .kind = .image_format }, .{ .kind = .access_qualifier, .quantifier = .optional } }, + .OpTypeSampler => &.{.{ .kind = .id_result }}, + .OpTypeSampledImage => &.{ .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpTypeArray => &.{ .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpTypeRuntimeArray => &.{ .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpTypeStruct => &.{ .{ .kind = .id_result }, .{ .kind = .id_ref, .quantifier = .variadic } }, + .OpTypeOpaque => &.{ .{ .kind = .id_result }, .{ .kind = .literal_string } }, + .OpTypePointer => &.{ .{ .kind = .id_result }, .{ .kind = .storage_class }, .{ .kind = .id_ref } }, + .OpTypeFunction => &.{ .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref, .quantifier = .variadic } }, + .OpTypeEvent => &.{.{ .kind = .id_result }}, + .OpTypeDeviceEvent => &.{.{ .kind = .id_result }}, + .OpTypeReserveId => &.{.{ .kind = .id_result }}, + .OpTypeQueue => &.{.{ .kind = .id_result }}, + .OpTypePipe => &.{ .{ .kind = .id_result }, .{ .kind = .access_qualifier } }, + .OpTypeForwardPointer => &.{ .{ .kind = .id_ref }, .{ .kind = .storage_class } }, + .OpConstantTrue => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result } }, + .OpConstantFalse => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result } }, + .OpConstant => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .literal_context_dependent_number } }, + .OpConstantComposite => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref, .quantifier = .variadic } }, + .OpConstantSampler => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .sampler_addressing_mode }, .{ .kind = .literal_integer }, .{ .kind = .sampler_filter_mode } }, + .OpConstantNull => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result } }, + .OpSpecConstantTrue => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result } }, + .OpSpecConstantFalse => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result } }, + .OpSpecConstant => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .literal_context_dependent_number } }, + .OpSpecConstantComposite => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref, .quantifier = .variadic } }, + .OpSpecConstantOp => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .literal_spec_constant_op_integer } }, + .OpFunction => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .function_control }, .{ .kind = .id_ref } }, + .OpFunctionParameter => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result } }, + .OpFunctionEnd => &.{}, + .OpFunctionCall => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref, .quantifier = .variadic } }, + .OpVariable => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .storage_class }, .{ .kind = .id_ref, .quantifier = .optional } }, + .OpImageTexelPointer => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpLoad => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .memory_access, .quantifier = .optional } }, + .OpStore => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .memory_access, .quantifier = .optional } }, + .OpCopyMemory => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .memory_access, .quantifier = .optional }, .{ .kind = .memory_access, .quantifier = .optional } }, + .OpCopyMemorySized => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .memory_access, .quantifier = .optional }, .{ .kind = .memory_access, .quantifier = .optional } }, + .OpAccessChain => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref, .quantifier = .variadic } }, + .OpInBoundsAccessChain => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref, .quantifier = .variadic } }, + .OpPtrAccessChain => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref, .quantifier = .variadic } }, + .OpArrayLength => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .literal_integer } }, + .OpGenericPtrMemSemantics => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpInBoundsPtrAccessChain => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref, .quantifier = .variadic } }, + .OpDecorate => &.{ .{ .kind = .id_ref }, .{ .kind = .decoration } }, + .OpMemberDecorate => &.{ .{ .kind = .id_ref }, .{ .kind = .literal_integer }, .{ .kind = .decoration } }, + .OpDecorationGroup => &.{.{ .kind = .id_result }}, + .OpGroupDecorate => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref, .quantifier = .variadic } }, + .OpGroupMemberDecorate => &.{ .{ .kind = .id_ref }, .{ .kind = .pair_id_ref_literal_integer, .quantifier = .variadic } }, + .OpVectorExtractDynamic => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpVectorInsertDynamic => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpVectorShuffle => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .literal_integer, .quantifier = .variadic } }, + .OpCompositeConstruct => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref, .quantifier = .variadic } }, + .OpCompositeExtract => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .literal_integer, .quantifier = .variadic } }, + .OpCompositeInsert => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .literal_integer, .quantifier = .variadic } }, + .OpCopyObject => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpTranspose => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpSampledImage => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpImageSampleImplicitLod => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .image_operands, .quantifier = .optional } }, + .OpImageSampleExplicitLod => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .image_operands } }, + .OpImageSampleDrefImplicitLod => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .image_operands, .quantifier = .optional } }, + .OpImageSampleDrefExplicitLod => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .image_operands } }, + .OpImageSampleProjImplicitLod => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .image_operands, .quantifier = .optional } }, + .OpImageSampleProjExplicitLod => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .image_operands } }, + .OpImageSampleProjDrefImplicitLod => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .image_operands, .quantifier = .optional } }, + .OpImageSampleProjDrefExplicitLod => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .image_operands } }, + .OpImageFetch => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .image_operands, .quantifier = .optional } }, + .OpImageGather => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .image_operands, .quantifier = .optional } }, + .OpImageDrefGather => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .image_operands, .quantifier = .optional } }, + .OpImageRead => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .image_operands, .quantifier = .optional } }, + .OpImageWrite => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .image_operands, .quantifier = .optional } }, + .OpImage => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpImageQueryFormat => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpImageQueryOrder => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpImageQuerySizeLod => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpImageQuerySize => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpImageQueryLod => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpImageQueryLevels => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpImageQuerySamples => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpConvertFToU => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpConvertFToS => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpConvertSToF => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpConvertUToF => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpUConvert => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpSConvert => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpFConvert => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpQuantizeToF16 => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpConvertPtrToU => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpSatConvertSToU => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpSatConvertUToS => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpConvertUToPtr => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpPtrCastToGeneric => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpGenericCastToPtr => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpGenericCastToPtrExplicit => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .storage_class } }, + .OpBitcast => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpSNegate => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpFNegate => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpIAdd => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpFAdd => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpISub => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpFSub => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpIMul => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpFMul => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpUDiv => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpSDiv => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpFDiv => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpUMod => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpSRem => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpSMod => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpFRem => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpFMod => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpVectorTimesScalar => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpMatrixTimesScalar => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpVectorTimesMatrix => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpMatrixTimesVector => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpMatrixTimesMatrix => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpOuterProduct => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpDot => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpIAddCarry => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpISubBorrow => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpUMulExtended => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpSMulExtended => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpAny => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpAll => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpIsNan => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpIsInf => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpIsFinite => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpIsNormal => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpSignBitSet => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpLessOrGreater => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpOrdered => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpUnordered => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpLogicalEqual => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpLogicalNotEqual => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpLogicalOr => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpLogicalAnd => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpLogicalNot => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpSelect => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpIEqual => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpINotEqual => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpUGreaterThan => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpSGreaterThan => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpUGreaterThanEqual => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpSGreaterThanEqual => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpULessThan => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpSLessThan => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpULessThanEqual => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpSLessThanEqual => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpFOrdEqual => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpFUnordEqual => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpFOrdNotEqual => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpFUnordNotEqual => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpFOrdLessThan => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpFUnordLessThan => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpFOrdGreaterThan => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpFUnordGreaterThan => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpFOrdLessThanEqual => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpFUnordLessThanEqual => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpFOrdGreaterThanEqual => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpFUnordGreaterThanEqual => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpShiftRightLogical => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpShiftRightArithmetic => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpShiftLeftLogical => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpBitwiseOr => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpBitwiseXor => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpBitwiseAnd => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpNot => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpBitFieldInsert => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpBitFieldSExtract => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpBitFieldUExtract => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpBitReverse => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpBitCount => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpDPdx => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpDPdy => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpFwidth => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpDPdxFine => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpDPdyFine => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpFwidthFine => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpDPdxCoarse => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpDPdyCoarse => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpFwidthCoarse => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpEmitVertex => &.{}, + .OpEndPrimitive => &.{}, + .OpEmitStreamVertex => &.{.{ .kind = .id_ref }}, + .OpEndStreamPrimitive => &.{.{ .kind = .id_ref }}, + .OpControlBarrier => &.{ .{ .kind = .id_scope }, .{ .kind = .id_scope }, .{ .kind = .id_memory_semantics } }, + .OpMemoryBarrier => &.{ .{ .kind = .id_scope }, .{ .kind = .id_memory_semantics } }, + .OpAtomicLoad => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_scope }, .{ .kind = .id_memory_semantics } }, + .OpAtomicStore => &.{ .{ .kind = .id_ref }, .{ .kind = .id_scope }, .{ .kind = .id_memory_semantics }, .{ .kind = .id_ref } }, + .OpAtomicExchange => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_scope }, .{ .kind = .id_memory_semantics }, .{ .kind = .id_ref } }, + .OpAtomicCompareExchange => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_scope }, .{ .kind = .id_memory_semantics }, .{ .kind = .id_memory_semantics }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpAtomicCompareExchangeWeak => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_scope }, .{ .kind = .id_memory_semantics }, .{ .kind = .id_memory_semantics }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpAtomicIIncrement => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_scope }, .{ .kind = .id_memory_semantics } }, + .OpAtomicIDecrement => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_scope }, .{ .kind = .id_memory_semantics } }, + .OpAtomicIAdd => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_scope }, .{ .kind = .id_memory_semantics }, .{ .kind = .id_ref } }, + .OpAtomicISub => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_scope }, .{ .kind = .id_memory_semantics }, .{ .kind = .id_ref } }, + .OpAtomicSMin => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_scope }, .{ .kind = .id_memory_semantics }, .{ .kind = .id_ref } }, + .OpAtomicUMin => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_scope }, .{ .kind = .id_memory_semantics }, .{ .kind = .id_ref } }, + .OpAtomicSMax => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_scope }, .{ .kind = .id_memory_semantics }, .{ .kind = .id_ref } }, + .OpAtomicUMax => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_scope }, .{ .kind = .id_memory_semantics }, .{ .kind = .id_ref } }, + .OpAtomicAnd => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_scope }, .{ .kind = .id_memory_semantics }, .{ .kind = .id_ref } }, + .OpAtomicOr => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_scope }, .{ .kind = .id_memory_semantics }, .{ .kind = .id_ref } }, + .OpAtomicXor => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_scope }, .{ .kind = .id_memory_semantics }, .{ .kind = .id_ref } }, + .OpPhi => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .pair_id_ref_id_ref, .quantifier = .variadic } }, + .OpLoopMerge => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .loop_control } }, + .OpSelectionMerge => &.{ .{ .kind = .id_ref }, .{ .kind = .selection_control } }, + .OpLabel => &.{.{ .kind = .id_result }}, + .OpBranch => &.{.{ .kind = .id_ref }}, + .OpBranchConditional => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .literal_integer, .quantifier = .variadic } }, + .OpSwitch => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .pair_literal_integer_id_ref, .quantifier = .variadic } }, + .OpKill => &.{}, + .OpReturn => &.{}, + .OpReturnValue => &.{.{ .kind = .id_ref }}, + .OpUnreachable => &.{}, + .OpLifetimeStart => &.{ .{ .kind = .id_ref }, .{ .kind = .literal_integer } }, + .OpLifetimeStop => &.{ .{ .kind = .id_ref }, .{ .kind = .literal_integer } }, + .OpGroupAsyncCopy => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_scope }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpGroupWaitEvents => &.{ .{ .kind = .id_scope }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpGroupAll => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_scope }, .{ .kind = .id_ref } }, + .OpGroupAny => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_scope }, .{ .kind = .id_ref } }, + .OpGroupBroadcast => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_scope }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpGroupIAdd => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_scope }, .{ .kind = .group_operation }, .{ .kind = .id_ref } }, + .OpGroupFAdd => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_scope }, .{ .kind = .group_operation }, .{ .kind = .id_ref } }, + .OpGroupFMin => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_scope }, .{ .kind = .group_operation }, .{ .kind = .id_ref } }, + .OpGroupUMin => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_scope }, .{ .kind = .group_operation }, .{ .kind = .id_ref } }, + .OpGroupSMin => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_scope }, .{ .kind = .group_operation }, .{ .kind = .id_ref } }, + .OpGroupFMax => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_scope }, .{ .kind = .group_operation }, .{ .kind = .id_ref } }, + .OpGroupUMax => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_scope }, .{ .kind = .group_operation }, .{ .kind = .id_ref } }, + .OpGroupSMax => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_scope }, .{ .kind = .group_operation }, .{ .kind = .id_ref } }, + .OpReadPipe => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpWritePipe => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpReservedReadPipe => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpReservedWritePipe => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpReserveReadPipePackets => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpReserveWritePipePackets => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpCommitReadPipe => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpCommitWritePipe => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpIsValidReserveId => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpGetNumPipePackets => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpGetMaxPipePackets => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpGroupReserveReadPipePackets => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_scope }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpGroupReserveWritePipePackets => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_scope }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpGroupCommitReadPipe => &.{ .{ .kind = .id_scope }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpGroupCommitWritePipe => &.{ .{ .kind = .id_scope }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpEnqueueMarker => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpEnqueueKernel => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref, .quantifier = .variadic } }, + .OpGetKernelNDrangeSubGroupCount => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpGetKernelNDrangeMaxSubGroupSize => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpGetKernelWorkGroupSize => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpGetKernelPreferredWorkGroupSizeMultiple => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpRetainEvent => &.{.{ .kind = .id_ref }}, + .OpReleaseEvent => &.{.{ .kind = .id_ref }}, + .OpCreateUserEvent => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result } }, + .OpIsValidEvent => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpSetUserEventStatus => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpCaptureEventProfilingInfo => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpGetDefaultQueue => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result } }, + .OpBuildNDRange => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpImageSparseSampleImplicitLod => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .image_operands, .quantifier = .optional } }, + .OpImageSparseSampleExplicitLod => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .image_operands } }, + .OpImageSparseSampleDrefImplicitLod => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .image_operands, .quantifier = .optional } }, + .OpImageSparseSampleDrefExplicitLod => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .image_operands } }, + .OpImageSparseSampleProjImplicitLod => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .image_operands, .quantifier = .optional } }, + .OpImageSparseSampleProjExplicitLod => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .image_operands } }, + .OpImageSparseSampleProjDrefImplicitLod => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .image_operands, .quantifier = .optional } }, + .OpImageSparseSampleProjDrefExplicitLod => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .image_operands } }, + .OpImageSparseFetch => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .image_operands, .quantifier = .optional } }, + .OpImageSparseGather => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .image_operands, .quantifier = .optional } }, + .OpImageSparseDrefGather => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .image_operands, .quantifier = .optional } }, + .OpImageSparseTexelsResident => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpNoLine => &.{}, + .OpAtomicFlagTestAndSet => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_scope }, .{ .kind = .id_memory_semantics } }, + .OpAtomicFlagClear => &.{ .{ .kind = .id_ref }, .{ .kind = .id_scope }, .{ .kind = .id_memory_semantics } }, + .OpImageSparseRead => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .image_operands, .quantifier = .optional } }, + .OpSizeOf => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpTypePipeStorage => &.{.{ .kind = .id_result }}, + .OpConstantPipeStorage => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .literal_integer }, .{ .kind = .literal_integer }, .{ .kind = .literal_integer } }, + .OpCreatePipeFromPipeStorage => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpGetKernelLocalSizeForSubgroupCount => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpGetKernelMaxNumSubgroups => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpTypeNamedBarrier => &.{.{ .kind = .id_result }}, + .OpNamedBarrierInitialize => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpMemoryNamedBarrier => &.{ .{ .kind = .id_ref }, .{ .kind = .id_scope }, .{ .kind = .id_memory_semantics } }, + .OpModuleProcessed => &.{.{ .kind = .literal_string }}, + .OpExecutionModeId => &.{ .{ .kind = .id_ref }, .{ .kind = .execution_mode } }, + .OpDecorateId => &.{ .{ .kind = .id_ref }, .{ .kind = .decoration } }, + .OpGroupNonUniformElect => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_scope } }, + .OpGroupNonUniformAll => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_scope }, .{ .kind = .id_ref } }, + .OpGroupNonUniformAny => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_scope }, .{ .kind = .id_ref } }, + .OpGroupNonUniformAllEqual => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_scope }, .{ .kind = .id_ref } }, + .OpGroupNonUniformBroadcast => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_scope }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpGroupNonUniformBroadcastFirst => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_scope }, .{ .kind = .id_ref } }, + .OpGroupNonUniformBallot => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_scope }, .{ .kind = .id_ref } }, + .OpGroupNonUniformInverseBallot => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_scope }, .{ .kind = .id_ref } }, + .OpGroupNonUniformBallotBitExtract => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_scope }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpGroupNonUniformBallotBitCount => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_scope }, .{ .kind = .group_operation }, .{ .kind = .id_ref } }, + .OpGroupNonUniformBallotFindLSB => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_scope }, .{ .kind = .id_ref } }, + .OpGroupNonUniformBallotFindMSB => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_scope }, .{ .kind = .id_ref } }, + .OpGroupNonUniformShuffle => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_scope }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpGroupNonUniformShuffleXor => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_scope }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpGroupNonUniformShuffleUp => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_scope }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpGroupNonUniformShuffleDown => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_scope }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpGroupNonUniformIAdd => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_scope }, .{ .kind = .group_operation }, .{ .kind = .id_ref }, .{ .kind = .id_ref, .quantifier = .optional } }, + .OpGroupNonUniformFAdd => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_scope }, .{ .kind = .group_operation }, .{ .kind = .id_ref }, .{ .kind = .id_ref, .quantifier = .optional } }, + .OpGroupNonUniformIMul => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_scope }, .{ .kind = .group_operation }, .{ .kind = .id_ref }, .{ .kind = .id_ref, .quantifier = .optional } }, + .OpGroupNonUniformFMul => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_scope }, .{ .kind = .group_operation }, .{ .kind = .id_ref }, .{ .kind = .id_ref, .quantifier = .optional } }, + .OpGroupNonUniformSMin => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_scope }, .{ .kind = .group_operation }, .{ .kind = .id_ref }, .{ .kind = .id_ref, .quantifier = .optional } }, + .OpGroupNonUniformUMin => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_scope }, .{ .kind = .group_operation }, .{ .kind = .id_ref }, .{ .kind = .id_ref, .quantifier = .optional } }, + .OpGroupNonUniformFMin => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_scope }, .{ .kind = .group_operation }, .{ .kind = .id_ref }, .{ .kind = .id_ref, .quantifier = .optional } }, + .OpGroupNonUniformSMax => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_scope }, .{ .kind = .group_operation }, .{ .kind = .id_ref }, .{ .kind = .id_ref, .quantifier = .optional } }, + .OpGroupNonUniformUMax => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_scope }, .{ .kind = .group_operation }, .{ .kind = .id_ref }, .{ .kind = .id_ref, .quantifier = .optional } }, + .OpGroupNonUniformFMax => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_scope }, .{ .kind = .group_operation }, .{ .kind = .id_ref }, .{ .kind = .id_ref, .quantifier = .optional } }, + .OpGroupNonUniformBitwiseAnd => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_scope }, .{ .kind = .group_operation }, .{ .kind = .id_ref }, .{ .kind = .id_ref, .quantifier = .optional } }, + .OpGroupNonUniformBitwiseOr => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_scope }, .{ .kind = .group_operation }, .{ .kind = .id_ref }, .{ .kind = .id_ref, .quantifier = .optional } }, + .OpGroupNonUniformBitwiseXor => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_scope }, .{ .kind = .group_operation }, .{ .kind = .id_ref }, .{ .kind = .id_ref, .quantifier = .optional } }, + .OpGroupNonUniformLogicalAnd => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_scope }, .{ .kind = .group_operation }, .{ .kind = .id_ref }, .{ .kind = .id_ref, .quantifier = .optional } }, + .OpGroupNonUniformLogicalOr => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_scope }, .{ .kind = .group_operation }, .{ .kind = .id_ref }, .{ .kind = .id_ref, .quantifier = .optional } }, + .OpGroupNonUniformLogicalXor => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_scope }, .{ .kind = .group_operation }, .{ .kind = .id_ref }, .{ .kind = .id_ref, .quantifier = .optional } }, + .OpGroupNonUniformQuadBroadcast => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_scope }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpGroupNonUniformQuadSwap => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_scope }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpCopyLogical => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpPtrEqual => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpPtrNotEqual => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpPtrDiff => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpColorAttachmentReadEXT => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref, .quantifier = .optional } }, + .OpDepthAttachmentReadEXT => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref, .quantifier = .optional } }, + .OpStencilAttachmentReadEXT => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref, .quantifier = .optional } }, + .OpTerminateInvocation => &.{}, + .OpTypeUntypedPointerKHR => &.{ .{ .kind = .id_result }, .{ .kind = .storage_class } }, + .OpUntypedVariableKHR => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .storage_class }, .{ .kind = .id_ref, .quantifier = .optional }, .{ .kind = .id_ref, .quantifier = .optional } }, + .OpUntypedAccessChainKHR => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref, .quantifier = .variadic } }, + .OpUntypedInBoundsAccessChainKHR => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref, .quantifier = .variadic } }, + .OpSubgroupBallotKHR => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpSubgroupFirstInvocationKHR => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpUntypedPtrAccessChainKHR => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref, .quantifier = .variadic } }, + .OpUntypedInBoundsPtrAccessChainKHR => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref, .quantifier = .variadic } }, + .OpUntypedArrayLengthKHR => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .literal_integer } }, + .OpUntypedPrefetchKHR => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref, .quantifier = .optional }, .{ .kind = .id_ref, .quantifier = .optional }, .{ .kind = .id_ref, .quantifier = .optional } }, + .OpFmaKHR => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpSubgroupAllKHR => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpSubgroupAnyKHR => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpSubgroupAllEqualKHR => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpGroupNonUniformRotateKHR => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_scope }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref, .quantifier = .optional } }, + .OpSubgroupReadInvocationKHR => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpExtInstWithForwardRefsKHR => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .literal_ext_inst_integer }, .{ .kind = .id_ref, .quantifier = .variadic } }, + .OpUntypedGroupAsyncCopyKHR => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .memory_access, .quantifier = .optional }, .{ .kind = .memory_access, .quantifier = .optional } }, + .OpTraceRayKHR => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpExecuteCallableKHR => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpConvertUToAccelerationStructureKHR => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpIgnoreIntersectionKHR => &.{}, + .OpTerminateRayKHR => &.{}, + .OpSDot => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .packed_vector_format, .quantifier = .optional } }, + .OpUDot => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .packed_vector_format, .quantifier = .optional } }, + .OpSUDot => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .packed_vector_format, .quantifier = .optional } }, + .OpSDotAccSat => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .packed_vector_format, .quantifier = .optional } }, + .OpUDotAccSat => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .packed_vector_format, .quantifier = .optional } }, + .OpSUDotAccSat => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .packed_vector_format, .quantifier = .optional } }, + .OpTypeCooperativeMatrixKHR => &.{ .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_scope }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpCooperativeMatrixLoadKHR => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref, .quantifier = .optional }, .{ .kind = .memory_access, .quantifier = .optional } }, + .OpCooperativeMatrixStoreKHR => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref, .quantifier = .optional }, .{ .kind = .memory_access, .quantifier = .optional } }, + .OpCooperativeMatrixMulAddKHR => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .cooperative_matrix_operands, .quantifier = .optional } }, + .OpCooperativeMatrixLengthKHR => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpConstantCompositeReplicateEXT => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpSpecConstantCompositeReplicateEXT => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpCompositeConstructReplicateEXT => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpTypeRayQueryKHR => &.{.{ .kind = .id_result }}, + .OpRayQueryInitializeKHR => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpRayQueryTerminateKHR => &.{.{ .kind = .id_ref }}, + .OpRayQueryGenerateIntersectionKHR => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpRayQueryConfirmIntersectionKHR => &.{.{ .kind = .id_ref }}, + .OpRayQueryProceedKHR => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpRayQueryGetIntersectionTypeKHR => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpReadClockKHR => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_scope } }, + .OpGroupNonUniformQuadAllKHR => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpGroupNonUniformQuadAnyKHR => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpTypeBufferEXT => &.{ .{ .kind = .id_result }, .{ .kind = .storage_class } }, + .OpBufferPointerEXT => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpAbortKHR => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpUntypedImageTexelPointerEXT => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpMemberDecorateIdEXT => &.{ .{ .kind = .id_ref }, .{ .kind = .literal_integer }, .{ .kind = .decoration } }, + .OpConstantSizeOfEXT => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpConstantDataKHR => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .literal_integer, .quantifier = .variadic } }, + .OpSpecConstantDataKHR => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .literal_integer, .quantifier = .variadic } }, + .OpPoisonKHR => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result } }, + .OpFreezeKHR => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpTypeVectorIdEXT => &.{ .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpEmitMeshTasksEXT => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref, .quantifier = .optional } }, + .OpSetMeshOutputsEXT => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpGroupNonUniformPartitionEXT => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpHitObjectRecordFromQueryEXT => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpHitObjectRecordMissEXT => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpHitObjectRecordMissMotionEXT => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpHitObjectGetIntersectionTriangleVertexPositionsEXT => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpHitObjectGetRayFlagsEXT => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpHitObjectSetShaderBindingTableRecordIndexEXT => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpHitObjectReorderExecuteShaderEXT => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref, .quantifier = .optional }, .{ .kind = .id_ref, .quantifier = .optional } }, + .OpHitObjectTraceReorderExecuteEXT => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref, .quantifier = .optional }, .{ .kind = .id_ref, .quantifier = .optional } }, + .OpHitObjectTraceMotionReorderExecuteEXT => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref, .quantifier = .optional }, .{ .kind = .id_ref, .quantifier = .optional } }, + .OpTypeHitObjectEXT => &.{.{ .kind = .id_result }}, + .OpReorderThreadWithHintEXT => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpReorderThreadWithHitObjectEXT => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref, .quantifier = .optional }, .{ .kind = .id_ref, .quantifier = .optional } }, + .OpHitObjectTraceRayEXT => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpHitObjectTraceRayMotionEXT => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpHitObjectRecordEmptyEXT => &.{.{ .kind = .id_ref }}, + .OpHitObjectExecuteShaderEXT => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpHitObjectGetCurrentTimeEXT => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpHitObjectGetAttributesEXT => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpHitObjectGetHitKindEXT => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpHitObjectGetPrimitiveIndexEXT => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpHitObjectGetGeometryIndexEXT => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpHitObjectGetInstanceIdEXT => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpHitObjectGetInstanceCustomIndexEXT => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpHitObjectGetObjectRayOriginEXT => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpHitObjectGetObjectRayDirectionEXT => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpHitObjectGetWorldRayDirectionEXT => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpHitObjectGetWorldRayOriginEXT => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpHitObjectGetObjectToWorldEXT => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpHitObjectGetWorldToObjectEXT => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpHitObjectGetRayTMaxEXT => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpReportIntersectionKHR => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpRayQueryGetIntersectionTriangleVertexPositionsKHR => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpTypeAccelerationStructureKHR => &.{.{ .kind = .id_result }}, + .OpHitObjectGetRayTMinEXT => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpHitObjectGetShaderBindingTableRecordIndexEXT => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpHitObjectGetShaderRecordBufferHandleEXT => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpHitObjectIsEmptyEXT => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpHitObjectIsHitEXT => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpHitObjectIsMissEXT => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpBeginInvocationInterlockEXT => &.{}, + .OpEndInvocationInterlockEXT => &.{}, + .OpDemoteToHelperInvocation => &.{}, + .OpIsHelperInvocationEXT => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result } }, + .OpAtomicFMinEXT => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_scope }, .{ .kind = .id_memory_semantics }, .{ .kind = .id_ref } }, + .OpAtomicFMaxEXT => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_scope }, .{ .kind = .id_memory_semantics }, .{ .kind = .id_ref } }, + .OpAssumeTrueKHR => &.{.{ .kind = .id_ref }}, + .OpExpectKHR => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpDecorateString => &.{ .{ .kind = .id_ref }, .{ .kind = .decoration } }, + .OpMemberDecorateString => &.{ .{ .kind = .id_ref }, .{ .kind = .literal_integer }, .{ .kind = .decoration } }, + .OpRayQueryGetRayTMinKHR => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpRayQueryGetRayFlagsKHR => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpRayQueryGetIntersectionTKHR => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpRayQueryGetIntersectionInstanceCustomIndexKHR => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpRayQueryGetIntersectionInstanceIdKHR => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpRayQueryGetIntersectionInstanceShaderBindingTableRecordOffsetKHR => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpRayQueryGetIntersectionGeometryIndexKHR => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpRayQueryGetIntersectionPrimitiveIndexKHR => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpRayQueryGetIntersectionBarycentricsKHR => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpRayQueryGetIntersectionFrontFaceKHR => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpRayQueryGetIntersectionCandidateAABBOpaqueKHR => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpRayQueryGetIntersectionObjectRayDirectionKHR => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpRayQueryGetIntersectionObjectRayOriginKHR => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpRayQueryGetWorldRayDirectionKHR => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpRayQueryGetWorldRayOriginKHR => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpRayQueryGetIntersectionObjectToWorldKHR => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpRayQueryGetIntersectionWorldToObjectKHR => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .OpAtomicFAddEXT => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref }, .{ .kind = .id_scope }, .{ .kind = .id_memory_semantics }, .{ .kind = .id_ref } }, + .OpArithmeticFenceEXT => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_ref } }, + .OpGroupIMulKHR => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_scope }, .{ .kind = .group_operation }, .{ .kind = .id_ref } }, + .OpGroupFMulKHR => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_scope }, .{ .kind = .group_operation }, .{ .kind = .id_ref } }, + .OpGroupBitwiseAndKHR => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_scope }, .{ .kind = .group_operation }, .{ .kind = .id_ref } }, + .OpGroupBitwiseOrKHR => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_scope }, .{ .kind = .group_operation }, .{ .kind = .id_ref } }, + .OpGroupBitwiseXorKHR => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_scope }, .{ .kind = .group_operation }, .{ .kind = .id_ref } }, + .OpGroupLogicalAndKHR => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_scope }, .{ .kind = .group_operation }, .{ .kind = .id_ref } }, + .OpGroupLogicalOrKHR => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_scope }, .{ .kind = .group_operation }, .{ .kind = .id_ref } }, + .OpGroupLogicalXorKHR => &.{ .{ .kind = .id_result_type }, .{ .kind = .id_result }, .{ .kind = .id_scope }, .{ .kind = .group_operation }, .{ .kind = .id_ref } }, + }; + } + + pub fn Operands(comptime opcode: Opcode) type { + return switch (opcode) { .OpNop => void, .OpUndef => struct { id_result_type: Id, id_result: Id }, .OpSourceContinued => struct { continued_source: LiteralString }, @@ -2504,17 +2451,6 @@ pub const Opcode = enum(u16) { .OpColorAttachmentReadEXT => struct { id_result_type: Id, id_result: Id, attachment: Id, sample: ?Id = null }, .OpDepthAttachmentReadEXT => struct { id_result_type: Id, id_result: Id, sample: ?Id = null }, .OpStencilAttachmentReadEXT => struct { id_result_type: Id, id_result: Id, sample: ?Id = null }, - .OpTypeTensorARM => struct { id_result: Id, element_type: Id, rank: ?Id = null, shape: ?Id = null }, - .OpTensorReadARM => struct { id_result_type: Id, id_result: Id, tensor: Id, coordinates: Id, tensor_operands: ?TensorOperands.Extended = null }, - .OpTensorWriteARM => struct { tensor: Id, coordinates: Id, object: Id, tensor_operands: ?TensorOperands.Extended = null }, - .OpTensorQuerySizeARM => struct { id_result_type: Id, id_result: Id, tensor: Id, dimension: Id }, - .OpGraphConstantARM => struct { id_result_type: Id, id_result: Id, graph_constant_id: LiteralInteger }, - .OpGraphEntryPointARM => struct { graph: Id, name: LiteralString, interface: []const Id = &.{} }, - .OpGraphARM => struct { id_result_type: Id, id_result: Id }, - .OpGraphInputARM => struct { id_result_type: Id, id_result: Id, input_index: Id, element_index: []const Id = &.{} }, - .OpGraphSetOutputARM => struct { value: Id, output_index: Id, element_index: []const Id = &.{} }, - .OpGraphEndARM => void, - .OpTypeGraphARM => struct { id_result: Id, num_inputs: LiteralInteger, in_out_types: []const Id = &.{} }, .OpTerminateInvocation => void, .OpTypeUntypedPointerKHR => struct { id_result: Id, storage_class: StorageClass }, .OpUntypedVariableKHR => struct { id_result_type: Id, id_result: Id, storage_class: StorageClass, data_type: ?Id = null, initializer: ?Id = null }, @@ -2560,37 +2496,7 @@ pub const Opcode = enum(u16) { .OpRayQueryConfirmIntersectionKHR => struct { ray_query: Id }, .OpRayQueryProceedKHR => struct { id_result_type: Id, id_result: Id, ray_query: Id }, .OpRayQueryGetIntersectionTypeKHR => struct { id_result_type: Id, id_result: Id, ray_query: Id, intersection: Id }, - .OpImageSampleWeightedQCOM => struct { id_result_type: Id, id_result: Id, texture: Id, coordinates: Id, weights: Id }, - .OpImageBoxFilterQCOM => struct { id_result_type: Id, id_result: Id, texture: Id, coordinates: Id, box_size: Id }, - .OpImageBlockMatchSSDQCOM => struct { id_result_type: Id, id_result: Id, target: Id, target_coordinates: Id, reference: Id, reference_coordinates: Id, block_size: Id }, - .OpImageBlockMatchSADQCOM => struct { id_result_type: Id, id_result: Id, target: Id, target_coordinates: Id, reference: Id, reference_coordinates: Id, block_size: Id }, - .OpBitCastArrayQCOM => struct { id_result_type: Id, id_result: Id, source_array: Id }, - .OpImageBlockMatchWindowSSDQCOM => struct { id_result_type: Id, id_result: Id, target_sampled_image: Id, target_coordinates: Id, reference_sampled_image: Id, reference_coordinates: Id, block_size: Id }, - .OpImageBlockMatchWindowSADQCOM => struct { id_result_type: Id, id_result: Id, target_sampled_image: Id, target_coordinates: Id, reference_sampled_image: Id, reference_coordinates: Id, block_size: Id }, - .OpImageBlockMatchGatherSSDQCOM => struct { id_result_type: Id, id_result: Id, target_sampled_image: Id, target_coordinates: Id, reference_sampled_image: Id, reference_coordinates: Id, block_size: Id }, - .OpImageBlockMatchGatherSADQCOM => struct { id_result_type: Id, id_result: Id, target_sampled_image: Id, target_coordinates: Id, reference_sampled_image: Id, reference_coordinates: Id, block_size: Id }, - .OpCompositeConstructCoopMatQCOM => struct { id_result_type: Id, id_result: Id, source_array: Id }, - .OpCompositeExtractCoopMatQCOM => struct { id_result_type: Id, id_result: Id, source_cooperative_matrix: Id }, - .OpExtractSubArrayQCOM => struct { id_result_type: Id, id_result: Id, source_array: Id, index: Id }, - .OpGroupIAddNonUniformAMD => struct { id_result_type: Id, id_result: Id, execution: Id, operation: GroupOperation, x: Id }, - .OpGroupFAddNonUniformAMD => struct { id_result_type: Id, id_result: Id, execution: Id, operation: GroupOperation, x: Id }, - .OpGroupFMinNonUniformAMD => struct { id_result_type: Id, id_result: Id, execution: Id, operation: GroupOperation, x: Id }, - .OpGroupUMinNonUniformAMD => struct { id_result_type: Id, id_result: Id, execution: Id, operation: GroupOperation, x: Id }, - .OpGroupSMinNonUniformAMD => struct { id_result_type: Id, id_result: Id, execution: Id, operation: GroupOperation, x: Id }, - .OpGroupFMaxNonUniformAMD => struct { id_result_type: Id, id_result: Id, execution: Id, operation: GroupOperation, x: Id }, - .OpGroupUMaxNonUniformAMD => struct { id_result_type: Id, id_result: Id, execution: Id, operation: GroupOperation, x: Id }, - .OpGroupSMaxNonUniformAMD => struct { id_result_type: Id, id_result: Id, execution: Id, operation: GroupOperation, x: Id }, - .OpFragmentMaskFetchAMD => struct { id_result_type: Id, id_result: Id, image: Id, coordinate: Id }, - .OpFragmentFetchAMD => struct { id_result_type: Id, id_result: Id, image: Id, coordinate: Id, fragment_index: Id }, .OpReadClockKHR => struct { id_result_type: Id, id_result: Id, scope: Id }, - .OpAllocateNodePayloadsAMDX => struct { id_result_type: Id, id_result: Id, visibility: Id, payload_count: Id, node_index: Id }, - .OpEnqueueNodePayloadsAMDX => struct { payload_array: Id }, - .OpTypeNodePayloadArrayAMDX => struct { id_result: Id, payload_type: Id }, - .OpFinishWritingNodePayloadAMDX => struct { id_result_type: Id, id_result: Id, payload: Id }, - .OpNodePayloadArrayLengthAMDX => struct { id_result_type: Id, id_result: Id, payload_array: Id }, - .OpIsNodePayloadValidAMDX => struct { id_result_type: Id, id_result: Id, payload_type: Id, node_index: Id }, - .OpConstantStringAMDX => struct { id_result: Id, literal_string: LiteralString }, - .OpSpecConstantStringAMDX => struct { id_result: Id, literal_string: LiteralString }, .OpGroupNonUniformQuadAllKHR => struct { id_result_type: Id, id_result: Id, predicate: Id }, .OpGroupNonUniformQuadAnyKHR => struct { id_result_type: Id, id_result: Id, predicate: Id }, .OpTypeBufferEXT => struct { id_result: Id, storage_class: StorageClass }, @@ -2603,54 +2509,10 @@ pub const Opcode = enum(u16) { .OpSpecConstantDataKHR => struct { id_result_type: Id, id_result: Id, data: []const LiteralInteger = &.{} }, .OpPoisonKHR => struct { id_result_type: Id, id_result: Id }, .OpFreezeKHR => struct { id_result_type: Id, id_result: Id, value: Id }, - .OpHitObjectRecordHitMotionNV => struct { hit_object: Id, acceleration_structure: Id, instance_id: Id, primitive_id: Id, geometry_index: Id, hit_kind: Id, sbt_record_offset: Id, sbt_record_stride: Id, origin: Id, t_min: Id, direction: Id, t_max: Id, current_time: Id, hit_object_attributes: Id }, - .OpHitObjectRecordHitWithIndexMotionNV => struct { hit_object: Id, acceleration_structure: Id, instance_id: Id, primitive_id: Id, geometry_index: Id, hit_kind: Id, sbt_record_index: Id, origin: Id, t_min: Id, direction: Id, t_max: Id, current_time: Id, hit_object_attributes: Id }, - .OpHitObjectRecordMissMotionNV => struct { hit_object: Id, sbt_index: Id, origin: Id, t_min: Id, direction: Id, t_max: Id, current_time: Id }, - .OpHitObjectGetWorldToObjectNV => struct { id_result_type: Id, id_result: Id, hit_object: Id }, - .OpHitObjectGetObjectToWorldNV => struct { id_result_type: Id, id_result: Id, hit_object: Id }, - .OpHitObjectGetObjectRayDirectionNV => struct { id_result_type: Id, id_result: Id, hit_object: Id }, - .OpHitObjectGetObjectRayOriginNV => struct { id_result_type: Id, id_result: Id, hit_object: Id }, - .OpHitObjectTraceRayMotionNV => struct { hit_object: Id, acceleration_structure: Id, ray_flags: Id, cullmask: Id, sbt_record_offset: Id, sbt_record_stride: Id, miss_index: Id, origin: Id, t_min: Id, direction: Id, t_max: Id, time: Id, payload: Id }, - .OpHitObjectGetShaderRecordBufferHandleNV => struct { id_result_type: Id, id_result: Id, hit_object: Id }, - .OpHitObjectGetShaderBindingTableRecordIndexNV => struct { id_result_type: Id, id_result: Id, hit_object: Id }, - .OpHitObjectRecordEmptyNV => struct { hit_object: Id }, - .OpHitObjectTraceRayNV => struct { hit_object: Id, acceleration_structure: Id, ray_flags: Id, cullmask: Id, sbt_record_offset: Id, sbt_record_stride: Id, miss_index: Id, origin: Id, t_min: Id, direction: Id, t_max: Id, payload: Id }, - .OpHitObjectRecordHitNV => struct { hit_object: Id, acceleration_structure: Id, instance_id: Id, primitive_id: Id, geometry_index: Id, hit_kind: Id, sbt_record_offset: Id, sbt_record_stride: Id, origin: Id, t_min: Id, direction: Id, t_max: Id, hit_object_attributes: Id }, - .OpHitObjectRecordHitWithIndexNV => struct { hit_object: Id, acceleration_structure: Id, instance_id: Id, primitive_id: Id, geometry_index: Id, hit_kind: Id, sbt_record_index: Id, origin: Id, t_min: Id, direction: Id, t_max: Id, hit_object_attributes: Id }, - .OpHitObjectRecordMissNV => struct { hit_object: Id, sbt_index: Id, origin: Id, t_min: Id, direction: Id, t_max: Id }, - .OpHitObjectExecuteShaderNV => struct { hit_object: Id, payload: Id }, - .OpHitObjectGetCurrentTimeNV => struct { id_result_type: Id, id_result: Id, hit_object: Id }, - .OpHitObjectGetAttributesNV => struct { hit_object: Id, hit_object_attribute: Id }, - .OpHitObjectGetHitKindNV => struct { id_result_type: Id, id_result: Id, hit_object: Id }, - .OpHitObjectGetPrimitiveIndexNV => struct { id_result_type: Id, id_result: Id, hit_object: Id }, - .OpHitObjectGetGeometryIndexNV => struct { id_result_type: Id, id_result: Id, hit_object: Id }, - .OpHitObjectGetInstanceIdNV => struct { id_result_type: Id, id_result: Id, hit_object: Id }, - .OpHitObjectGetInstanceCustomIndexNV => struct { id_result_type: Id, id_result: Id, hit_object: Id }, - .OpHitObjectGetWorldRayDirectionNV => struct { id_result_type: Id, id_result: Id, hit_object: Id }, - .OpHitObjectGetWorldRayOriginNV => struct { id_result_type: Id, id_result: Id, hit_object: Id }, - .OpHitObjectGetRayTMaxNV => struct { id_result_type: Id, id_result: Id, hit_object: Id }, - .OpHitObjectGetRayTMinNV => struct { id_result_type: Id, id_result: Id, hit_object: Id }, - .OpHitObjectIsEmptyNV => struct { id_result_type: Id, id_result: Id, hit_object: Id }, - .OpHitObjectIsHitNV => struct { id_result_type: Id, id_result: Id, hit_object: Id }, - .OpHitObjectIsMissNV => struct { id_result_type: Id, id_result: Id, hit_object: Id }, - .OpReorderThreadWithHitObjectNV => struct { hit_object: Id, hint: ?Id = null, bits: ?Id = null }, - .OpReorderThreadWithHintNV => struct { hint: Id, bits: Id }, - .OpTypeHitObjectNV => struct { id_result: Id }, - .OpImageSampleFootprintNV => struct { id_result_type: Id, id_result: Id, sampled_image: Id, coordinate: Id, granularity: Id, coarse: Id, image_operands: ?ImageOperands.Extended = null }, .OpTypeVectorIdEXT => struct { id_result: Id, component_type: Id, component_count: Id }, - .OpCooperativeVectorMatrixMulNV => struct { id_result_type: Id, id_result: Id, input: Id, input_interpretation: Id, matrix: Id, matrix_offset: Id, matrix_interpretation: Id, m: Id, k: Id, memory_layout: Id, transpose: Id, matrix_stride: ?Id = null, cooperative_matrix_operands: ?CooperativeMatrixOperands = null }, - .OpCooperativeVectorOuterProductAccumulateNV => struct { pointer: Id, offset: Id, a: Id, b: Id, memory_layout: Id, matrix_interpretation: Id, matrix_stride: ?Id = null }, - .OpCooperativeVectorReduceSumAccumulateNV => struct { pointer: Id, offset: Id, v: Id }, - .OpCooperativeVectorMatrixMulAddNV => struct { id_result_type: Id, id_result: Id, input: Id, input_interpretation: Id, matrix: Id, matrix_offset: Id, matrix_interpretation: Id, bias: Id, bias_offset: Id, bias_interpretation: Id, m: Id, k: Id, memory_layout: Id, transpose: Id, matrix_stride: ?Id = null, cooperative_matrix_operands: ?CooperativeMatrixOperands = null }, - .OpCooperativeMatrixConvertNV => struct { id_result_type: Id, id_result: Id, matrix: Id }, .OpEmitMeshTasksEXT => struct { group_count_x: Id, group_count_y: Id, group_count_z: Id, payload: ?Id = null }, .OpSetMeshOutputsEXT => struct { vertex_count: Id, primitive_count: Id }, .OpGroupNonUniformPartitionEXT => struct { id_result_type: Id, id_result: Id, value: Id }, - .OpWritePackedPrimitiveIndices4x8NV => struct { index_offset: Id, packed_indices: Id }, - .OpFetchMicroTriangleVertexPositionNV => struct { id_result_type: Id, id_result: Id, accel: Id, instance_id: Id, geometry_index: Id, primitive_index: Id, barycentric: Id }, - .OpFetchMicroTriangleVertexBarycentricNV => struct { id_result_type: Id, id_result: Id, accel: Id, instance_id: Id, geometry_index: Id, primitive_index: Id, barycentric: Id }, - .OpCooperativeVectorLoadNV => struct { id_result_type: Id, id_result: Id, pointer: Id, offset: Id, memory_access: ?MemoryAccess.Extended = null }, - .OpCooperativeVectorStoreNV => struct { pointer: Id, offset: Id, object: Id, memory_access: ?MemoryAccess.Extended = null }, .OpHitObjectRecordFromQueryEXT => struct { hit_object: Id, ray_query: Id, sbt_record_index: Id, hit_object_attributes: Id }, .OpHitObjectRecordMissEXT => struct { hit_object: Id, ray_flags: Id, miss_index: Id, ray_origin: Id, ray_tmin: Id, ray_direction: Id, ray_tmax: Id }, .OpHitObjectRecordMissMotionEXT => struct { hit_object: Id, ray_flags: Id, miss_index: Id, ray_origin: Id, ray_tmin: Id, ray_direction: Id, ray_tmax: Id, current_time: Id }, @@ -2682,103 +2544,24 @@ pub const Opcode = enum(u16) { .OpHitObjectGetWorldToObjectEXT => struct { id_result_type: Id, id_result: Id, hit_object: Id }, .OpHitObjectGetRayTMaxEXT => struct { id_result_type: Id, id_result: Id, hit_object: Id }, .OpReportIntersectionKHR => struct { id_result_type: Id, id_result: Id, hit: Id, hit_kind: Id }, - .OpIgnoreIntersectionNV => void, - .OpTerminateRayNV => void, - .OpTraceNV => struct { accel: Id, ray_flags: Id, cull_mask: Id, sbt_offset: Id, sbt_stride: Id, miss_index: Id, ray_origin: Id, ray_tmin: Id, ray_direction: Id, ray_tmax: Id, payload_id: Id }, - .OpTraceMotionNV => struct { accel: Id, ray_flags: Id, cull_mask: Id, sbt_offset: Id, sbt_stride: Id, miss_index: Id, ray_origin: Id, ray_tmin: Id, ray_direction: Id, ray_tmax: Id, time: Id, payload_id: Id }, - .OpTraceRayMotionNV => struct { accel: Id, ray_flags: Id, cull_mask: Id, sbt_offset: Id, sbt_stride: Id, miss_index: Id, ray_origin: Id, ray_tmin: Id, ray_direction: Id, ray_tmax: Id, time: Id, payload: Id }, .OpRayQueryGetIntersectionTriangleVertexPositionsKHR => struct { id_result_type: Id, id_result: Id, ray_query: Id, intersection: Id }, .OpTypeAccelerationStructureKHR => struct { id_result: Id }, - .OpExecuteCallableNV => struct { sbt_index: Id, callable_data_id: Id }, - .OpRayQueryGetIntersectionClusterIdNV => struct { id_result_type: Id, id_result: Id, ray_query: Id, intersection: Id }, - .OpHitObjectGetClusterIdNV => struct { id_result_type: Id, id_result: Id, hit_object: Id }, .OpHitObjectGetRayTMinEXT => struct { id_result_type: Id, id_result: Id, hit_object: Id }, .OpHitObjectGetShaderBindingTableRecordIndexEXT => struct { id_result_type: Id, id_result: Id, hit_object: Id }, .OpHitObjectGetShaderRecordBufferHandleEXT => struct { id_result_type: Id, id_result: Id, hit_object: Id }, .OpHitObjectIsEmptyEXT => struct { id_result_type: Id, id_result: Id, hit_object: Id }, .OpHitObjectIsHitEXT => struct { id_result_type: Id, id_result: Id, hit_object: Id }, .OpHitObjectIsMissEXT => struct { id_result_type: Id, id_result: Id, hit_object: Id }, - .OpTypeCooperativeMatrixNV => struct { id_result: Id, component_type: Id, execution: Id, rows: Id, columns: Id }, - .OpCooperativeMatrixLoadNV => struct { id_result_type: Id, id_result: Id, pointer: Id, stride: Id, column_major: Id, memory_access: ?MemoryAccess.Extended = null }, - .OpCooperativeMatrixStoreNV => struct { pointer: Id, object: Id, stride: Id, column_major: Id, memory_access: ?MemoryAccess.Extended = null }, - .OpCooperativeMatrixMulAddNV => struct { id_result_type: Id, id_result: Id, a: Id, b: Id, c: Id }, - .OpCooperativeMatrixLengthNV => struct { id_result_type: Id, id_result: Id, type: Id }, .OpBeginInvocationInterlockEXT => void, .OpEndInvocationInterlockEXT => void, - .OpCooperativeMatrixReduceNV => struct { id_result_type: Id, id_result: Id, matrix: Id, reduce: CooperativeMatrixReduce, combine_func: Id }, - .OpCooperativeMatrixLoadTensorNV => struct { id_result_type: Id, id_result: Id, pointer: Id, object: Id, tensor_layout: Id, memory_operand: MemoryAccess.Extended, tensor_addressing_operands: TensorAddressingOperands.Extended }, - .OpCooperativeMatrixStoreTensorNV => struct { pointer: Id, object: Id, tensor_layout: Id, memory_operand: MemoryAccess.Extended, tensor_addressing_operands: TensorAddressingOperands.Extended }, - .OpCooperativeMatrixPerElementOpNV => struct { id_result_type: Id, id_result: Id, matrix: Id, func: Id, operands: []const Id = &.{} }, - .OpTypeTensorLayoutNV => struct { id_result: Id, dim: Id, clamp_mode: Id }, - .OpTypeTensorViewNV => struct { id_result: Id, dim: Id, has_dimensions: Id, p: []const Id = &.{} }, - .OpCreateTensorLayoutNV => struct { id_result_type: Id, id_result: Id }, - .OpTensorLayoutSetDimensionNV => struct { id_result_type: Id, id_result: Id, tensor_layout: Id, dim: []const Id = &.{} }, - .OpTensorLayoutSetStrideNV => struct { id_result_type: Id, id_result: Id, tensor_layout: Id, stride: []const Id = &.{} }, - .OpTensorLayoutSliceNV => struct { id_result_type: Id, id_result: Id, tensor_layout: Id, operands: []const Id = &.{} }, - .OpTensorLayoutSetClampValueNV => struct { id_result_type: Id, id_result: Id, tensor_layout: Id, value: Id }, - .OpCreateTensorViewNV => struct { id_result_type: Id, id_result: Id }, - .OpTensorViewSetDimensionNV => struct { id_result_type: Id, id_result: Id, tensor_view: Id, dim: []const Id = &.{} }, - .OpTensorViewSetStrideNV => struct { id_result_type: Id, id_result: Id, tensor_view: Id, stride: []const Id = &.{} }, .OpDemoteToHelperInvocation => void, .OpIsHelperInvocationEXT => struct { id_result_type: Id, id_result: Id }, - .OpTensorViewSetClipNV => struct { id_result_type: Id, id_result: Id, tensor_view: Id, clip_row_offset: Id, clip_row_span: Id, clip_col_offset: Id, clip_col_span: Id }, - .OpTensorLayoutSetBlockSizeNV => struct { id_result_type: Id, id_result: Id, tensor_layout: Id, block_size: []const Id = &.{} }, - .OpCooperativeMatrixTransposeNV => struct { id_result_type: Id, id_result: Id, matrix: Id }, - .OpConvertUToImageNV => struct { id_result_type: Id, id_result: Id, operand: Id }, - .OpConvertUToSamplerNV => struct { id_result_type: Id, id_result: Id, operand: Id }, - .OpConvertImageToUNV => struct { id_result_type: Id, id_result: Id, operand: Id }, - .OpConvertSamplerToUNV => struct { id_result_type: Id, id_result: Id, operand: Id }, - .OpConvertUToSampledImageNV => struct { id_result_type: Id, id_result: Id, operand: Id }, - .OpConvertSampledImageToUNV => struct { id_result_type: Id, id_result: Id, operand: Id }, - .OpSamplerImageAddressingModeNV => struct { bit_width: LiteralInteger }, - .OpRawAccessChainNV => struct { id_result_type: Id, id_result: Id, base: Id, byte_stride: Id, element_index: Id, byte_offset: Id, raw_access_chain_operands: ?RawAccessChainOperands = null }, - .OpRayQueryGetIntersectionSpherePositionNV => struct { id_result_type: Id, id_result: Id, ray_query: Id, intersection: Id }, - .OpRayQueryGetIntersectionSphereRadiusNV => struct { id_result_type: Id, id_result: Id, ray_query: Id, intersection: Id }, - .OpRayQueryGetIntersectionLSSPositionsNV => struct { id_result_type: Id, id_result: Id, ray_query: Id, intersection: Id }, - .OpRayQueryGetIntersectionLSSRadiiNV => struct { id_result_type: Id, id_result: Id, ray_query: Id, intersection: Id }, - .OpRayQueryGetIntersectionLSSHitValueNV => struct { id_result_type: Id, id_result: Id, ray_query: Id, intersection: Id }, - .OpHitObjectGetSpherePositionNV => struct { id_result_type: Id, id_result: Id, hit_object: Id }, - .OpHitObjectGetSphereRadiusNV => struct { id_result_type: Id, id_result: Id, hit_object: Id }, - .OpHitObjectGetLSSPositionsNV => struct { id_result_type: Id, id_result: Id, hit_object: Id }, - .OpHitObjectGetLSSRadiiNV => struct { id_result_type: Id, id_result: Id, hit_object: Id }, - .OpHitObjectIsSphereHitNV => struct { id_result_type: Id, id_result: Id, hit_object: Id }, - .OpHitObjectIsLSSHitNV => struct { id_result_type: Id, id_result: Id, hit_object: Id }, - .OpRayQueryIsSphereHitNV => struct { id_result_type: Id, id_result: Id, ray_query: Id, intersection: Id }, - .OpRayQueryIsLSSHitNV => struct { id_result_type: Id, id_result: Id, ray_query: Id, intersection: Id }, - .OpSubgroupShuffleINTEL => struct { id_result_type: Id, id_result: Id, data: Id, invocation_id: Id }, - .OpSubgroupShuffleDownINTEL => struct { id_result_type: Id, id_result: Id, current: Id, next: Id, delta: Id }, - .OpSubgroupShuffleUpINTEL => struct { id_result_type: Id, id_result: Id, previous: Id, current: Id, delta: Id }, - .OpSubgroupShuffleXorINTEL => struct { id_result_type: Id, id_result: Id, data: Id, value: Id }, - .OpSubgroupBlockReadINTEL => struct { id_result_type: Id, id_result: Id, ptr: Id }, - .OpSubgroupBlockWriteINTEL => struct { ptr: Id, data: Id }, - .OpSubgroupImageBlockReadINTEL => struct { id_result_type: Id, id_result: Id, image: Id, coordinate: Id }, - .OpSubgroupImageBlockWriteINTEL => struct { image: Id, coordinate: Id, data: Id }, - .OpSubgroupImageMediaBlockReadINTEL => struct { id_result_type: Id, id_result: Id, image: Id, coordinate: Id, width: Id, height: Id }, - .OpSubgroupImageMediaBlockWriteINTEL => struct { image: Id, coordinate: Id, width: Id, height: Id, data: Id }, - .OpUCountLeadingZerosINTEL => struct { id_result_type: Id, id_result: Id, operand: Id }, - .OpUCountTrailingZerosINTEL => struct { id_result_type: Id, id_result: Id, operand: Id }, - .OpAbsISubINTEL => struct { id_result_type: Id, id_result: Id, operand_1: Id, operand_2: Id }, - .OpAbsUSubINTEL => struct { id_result_type: Id, id_result: Id, operand_1: Id, operand_2: Id }, - .OpIAddSatINTEL => struct { id_result_type: Id, id_result: Id, operand_1: Id, operand_2: Id }, - .OpUAddSatINTEL => struct { id_result_type: Id, id_result: Id, operand_1: Id, operand_2: Id }, - .OpIAverageINTEL => struct { id_result_type: Id, id_result: Id, operand_1: Id, operand_2: Id }, - .OpUAverageINTEL => struct { id_result_type: Id, id_result: Id, operand_1: Id, operand_2: Id }, - .OpIAverageRoundedINTEL => struct { id_result_type: Id, id_result: Id, operand_1: Id, operand_2: Id }, - .OpUAverageRoundedINTEL => struct { id_result_type: Id, id_result: Id, operand_1: Id, operand_2: Id }, - .OpISubSatINTEL => struct { id_result_type: Id, id_result: Id, operand_1: Id, operand_2: Id }, - .OpUSubSatINTEL => struct { id_result_type: Id, id_result: Id, operand_1: Id, operand_2: Id }, - .OpIMul32x16INTEL => struct { id_result_type: Id, id_result: Id, operand_1: Id, operand_2: Id }, - .OpUMul32x16INTEL => struct { id_result_type: Id, id_result: Id, operand_1: Id, operand_2: Id }, .OpAtomicFMinEXT => struct { id_result_type: Id, id_result: Id, pointer: Id, memory: Id, semantics: Id, value: Id }, .OpAtomicFMaxEXT => struct { id_result_type: Id, id_result: Id, pointer: Id, memory: Id, semantics: Id, value: Id }, .OpAssumeTrueKHR => struct { condition: Id }, .OpExpectKHR => struct { id_result_type: Id, id_result: Id, value: Id, expected_value: Id }, .OpDecorateString => struct { target: Id, decoration: Decoration.Extended }, .OpMemberDecorateString => struct { struct_type: Id, member: LiteralInteger, decoration: Decoration.Extended }, - .OpVariableLengthArrayINTEL => struct { id_result_type: Id, id_result: Id, length: Id }, - .OpSaveMemoryINTEL => struct { id_result_type: Id, id_result: Id }, - .OpRestoreMemoryINTEL => struct { ptr: Id }, - .OpLoopControlINTEL => struct { loop_control_parameters: []const LiteralInteger = &.{} }, .OpRayQueryGetRayTMinKHR => struct { id_result_type: Id, id_result: Id, ray_query: Id }, .OpRayQueryGetRayFlagsKHR => struct { id_result_type: Id, id_result: Id, ray_query: Id }, .OpRayQueryGetIntersectionTKHR => struct { id_result_type: Id, id_result: Id, ray_query: Id, intersection: Id }, @@ -2797,32 +2580,7 @@ pub const Opcode = enum(u16) { .OpRayQueryGetIntersectionObjectToWorldKHR => struct { id_result_type: Id, id_result: Id, ray_query: Id, intersection: Id }, .OpRayQueryGetIntersectionWorldToObjectKHR => struct { id_result_type: Id, id_result: Id, ray_query: Id, intersection: Id }, .OpAtomicFAddEXT => struct { id_result_type: Id, id_result: Id, pointer: Id, memory: Id, semantics: Id, value: Id }, - .OpTypeBufferSurfaceINTEL => struct { id_result: Id, access_qualifier: AccessQualifier }, - .OpTypeStructContinuedINTEL => struct { id_ref: []const Id = &.{} }, - .OpConstantCompositeContinuedINTEL => struct { constituents: []const Id = &.{} }, - .OpSpecConstantCompositeContinuedINTEL => struct { constituents: []const Id = &.{} }, - .OpCompositeConstructContinuedINTEL => struct { id_result_type: Id, id_result: Id, constituents: []const Id = &.{} }, - .OpConvertFToBF16INTEL => struct { id_result_type: Id, id_result: Id, float_value: Id }, - .OpConvertBF16ToFINTEL => struct { id_result_type: Id, id_result: Id, b_float16_value: Id }, - .OpControlBarrierArriveINTEL => struct { execution: Id, memory: Id, semantics: Id }, - .OpControlBarrierWaitINTEL => struct { execution: Id, memory: Id, semantics: Id }, .OpArithmeticFenceEXT => struct { id_result_type: Id, id_result: Id, target: Id }, - .OpSubgroupBlockPrefetchINTEL => struct { ptr: Id, num_bytes: Id, memory_access: ?MemoryAccess.Extended = null }, - .OpSubgroup2DBlockLoadINTEL => struct { element_size: Id, block_width: Id, block_height: Id, block_count: Id, src_base_pointer: Id, memory_width: Id, memory_height: Id, memory_pitch: Id, coordinate: Id, dst_pointer: Id }, - .OpSubgroup2DBlockLoadTransformINTEL => struct { element_size: Id, block_width: Id, block_height: Id, block_count: Id, src_base_pointer: Id, memory_width: Id, memory_height: Id, memory_pitch: Id, coordinate: Id, dst_pointer: Id }, - .OpSubgroup2DBlockLoadTransposeINTEL => struct { element_size: Id, block_width: Id, block_height: Id, block_count: Id, src_base_pointer: Id, memory_width: Id, memory_height: Id, memory_pitch: Id, coordinate: Id, dst_pointer: Id }, - .OpSubgroup2DBlockPrefetchINTEL => struct { element_size: Id, block_width: Id, block_height: Id, block_count: Id, src_base_pointer: Id, memory_width: Id, memory_height: Id, memory_pitch: Id, coordinate: Id }, - .OpSubgroup2DBlockStoreINTEL => struct { element_size: Id, block_width: Id, block_height: Id, block_count: Id, src_pointer: Id, dst_base_pointer: Id, memory_width: Id, memory_height: Id, memory_pitch: Id, coordinate: Id }, - .OpSubgroupMatrixMultiplyAccumulateINTEL => struct { id_result_type: Id, id_result: Id, k_dim: Id, matrix_a: Id, matrix_b: Id, matrix_c: Id, matrix_multiply_accumulate_operands: ?MatrixMultiplyAccumulateOperands = null }, - .OpBitwiseFunctionINTEL => struct { id_result_type: Id, id_result: Id, a: Id, b: Id, c: Id, lut_index: Id }, - .OpUntypedVariableLengthArrayINTEL => struct { id_result_type: Id, id_result: Id, element_type: Id, length: Id }, - .OpConditionalExtensionINTEL => struct { condition: Id, name: LiteralString }, - .OpConditionalEntryPointINTEL => struct { condition: Id, execution_model: ExecutionModel, entry_point: Id, name: LiteralString, interface: []const Id = &.{} }, - .OpConditionalCapabilityINTEL => struct { condition: Id, capability: Capability }, - .OpSpecConstantTargetINTEL => struct { id_result_type: Id, id_result: Id, target: LiteralInteger, features: []const LiteralInteger = &.{} }, - .OpSpecConstantArchitectureINTEL => struct { id_result_type: Id, id_result: Id, category: LiteralInteger, family: LiteralInteger, opcode: LiteralInteger, architecture: LiteralInteger }, - .OpSpecConstantCapabilitiesINTEL => struct { id_result_type: Id, id_result: Id, capabilities: []const Capability = &.{} }, - .OpConditionalCopyObjectINTEL => struct { id_result_type: Id, id_result: Id, id_ref: []const Id = &.{} }, .OpGroupIMulKHR => struct { id_result_type: Id, id_result: Id, execution: Id, operation: GroupOperation, x: Id }, .OpGroupFMulKHR => struct { id_result_type: Id, id_result: Id, execution: Id, operation: GroupOperation, x: Id }, .OpGroupBitwiseAndKHR => struct { id_result_type: Id, id_result: Id, execution: Id, operation: GroupOperation, x: Id }, @@ -2831,702 +2589,168 @@ pub const Opcode = enum(u16) { .OpGroupLogicalAndKHR => struct { id_result_type: Id, id_result: Id, execution: Id, operation: GroupOperation, x: Id }, .OpGroupLogicalOrKHR => struct { id_result_type: Id, id_result: Id, execution: Id, operation: GroupOperation, x: Id }, .OpGroupLogicalXorKHR => struct { id_result_type: Id, id_result: Id, execution: Id, operation: GroupOperation, x: Id }, - .OpRoundFToTF32INTEL => struct { id_result_type: Id, id_result: Id, float_value: Id }, - .OpMaskedGatherINTEL => struct { id_result_type: Id, id_result: Id, ptr_vector: Id, alignment: LiteralInteger, mask: Id, fill_empty: Id }, - .OpMaskedScatterINTEL => struct { input_vector: Id, ptr_vector: Id, alignment: LiteralInteger, mask: Id }, - .OpConvertHandleToImageINTEL => struct { id_result_type: Id, id_result: Id, operand: Id }, - .OpConvertHandleToSamplerINTEL => struct { id_result_type: Id, id_result: Id, operand: Id }, - .OpConvertHandleToSampledImageINTEL => struct { id_result_type: Id, id_result: Id, operand: Id }, - .OpFDot2MixAcc32VALVE => struct { id_result_type: Id, id_result: Id, vector_1: Id, vector_2: Id, accumulator: Id }, - .OpFDot2MixAcc16VALVE => struct { id_result_type: Id, id_result: Id, vector_1: Id, vector_2: Id, accumulator: Id }, - .OpFDot4MixAcc32VALVE => struct { id_result_type: Id, id_result: Id, vector_1: Id, vector_2: Id, accumulator: Id }, }; } - pub fn class(self: Opcode) Class { - return switch (self) { - .OpNop => .miscellaneous, - .OpUndef => .miscellaneous, - .OpSourceContinued => .debug, - .OpSource => .debug, - .OpSourceExtension => .debug, - .OpName => .debug, - .OpMemberName => .debug, - .OpString => .debug, - .OpLine => .debug, - .OpExtension => .extension, - .OpExtInstImport => .extension, - .OpExtInst => .extension, - .OpMemoryModel => .mode_setting, - .OpEntryPoint => .mode_setting, - .OpExecutionMode => .mode_setting, - .OpCapability => .mode_setting, - .OpTypeVoid => .type_declaration, - .OpTypeBool => .type_declaration, - .OpTypeInt => .type_declaration, - .OpTypeFloat => .type_declaration, - .OpTypeVector => .type_declaration, - .OpTypeMatrix => .type_declaration, - .OpTypeImage => .type_declaration, - .OpTypeSampler => .type_declaration, - .OpTypeSampledImage => .type_declaration, - .OpTypeArray => .type_declaration, - .OpTypeRuntimeArray => .type_declaration, - .OpTypeStruct => .type_declaration, - .OpTypeOpaque => .type_declaration, - .OpTypePointer => .type_declaration, - .OpTypeFunction => .type_declaration, - .OpTypeEvent => .type_declaration, - .OpTypeDeviceEvent => .type_declaration, - .OpTypeReserveId => .type_declaration, - .OpTypeQueue => .type_declaration, - .OpTypePipe => .type_declaration, - .OpTypeForwardPointer => .type_declaration, - .OpConstantTrue => .constant_creation, - .OpConstantFalse => .constant_creation, - .OpConstant => .constant_creation, - .OpConstantComposite => .constant_creation, - .OpConstantSampler => .constant_creation, - .OpConstantNull => .constant_creation, - .OpSpecConstantTrue => .constant_creation, - .OpSpecConstantFalse => .constant_creation, - .OpSpecConstant => .constant_creation, - .OpSpecConstantComposite => .constant_creation, - .OpSpecConstantOp => .constant_creation, - .OpFunction => .function, - .OpFunctionParameter => .function, - .OpFunctionEnd => .function, - .OpFunctionCall => .function, - .OpVariable => .memory, - .OpImageTexelPointer => .memory, - .OpLoad => .memory, - .OpStore => .memory, - .OpCopyMemory => .memory, - .OpCopyMemorySized => .memory, - .OpAccessChain => .memory, - .OpInBoundsAccessChain => .memory, - .OpPtrAccessChain => .memory, - .OpArrayLength => .memory, - .OpGenericPtrMemSemantics => .memory, - .OpInBoundsPtrAccessChain => .memory, - .OpDecorate => .annotation, - .OpMemberDecorate => .annotation, - .OpDecorationGroup => .annotation, - .OpGroupDecorate => .annotation, - .OpGroupMemberDecorate => .annotation, - .OpVectorExtractDynamic => .composite, - .OpVectorInsertDynamic => .composite, - .OpVectorShuffle => .composite, - .OpCompositeConstruct => .composite, - .OpCompositeExtract => .composite, - .OpCompositeInsert => .composite, - .OpCopyObject => .composite, - .OpTranspose => .composite, - .OpSampledImage => .image, - .OpImageSampleImplicitLod => .image, - .OpImageSampleExplicitLod => .image, - .OpImageSampleDrefImplicitLod => .image, - .OpImageSampleDrefExplicitLod => .image, - .OpImageSampleProjImplicitLod => .image, - .OpImageSampleProjExplicitLod => .image, - .OpImageSampleProjDrefImplicitLod => .image, - .OpImageSampleProjDrefExplicitLod => .image, - .OpImageFetch => .image, - .OpImageGather => .image, - .OpImageDrefGather => .image, - .OpImageRead => .image, - .OpImageWrite => .image, - .OpImage => .image, - .OpImageQueryFormat => .image, - .OpImageQueryOrder => .image, - .OpImageQuerySizeLod => .image, - .OpImageQuerySize => .image, - .OpImageQueryLod => .image, - .OpImageQueryLevels => .image, - .OpImageQuerySamples => .image, - .OpConvertFToU => .conversion, - .OpConvertFToS => .conversion, - .OpConvertSToF => .conversion, - .OpConvertUToF => .conversion, - .OpUConvert => .conversion, - .OpSConvert => .conversion, - .OpFConvert => .conversion, - .OpQuantizeToF16 => .conversion, - .OpConvertPtrToU => .conversion, - .OpSatConvertSToU => .conversion, - .OpSatConvertUToS => .conversion, - .OpConvertUToPtr => .conversion, - .OpPtrCastToGeneric => .conversion, - .OpGenericCastToPtr => .conversion, - .OpGenericCastToPtrExplicit => .conversion, - .OpBitcast => .conversion, - .OpSNegate => .arithmetic, - .OpFNegate => .arithmetic, - .OpIAdd => .arithmetic, - .OpFAdd => .arithmetic, - .OpISub => .arithmetic, - .OpFSub => .arithmetic, - .OpIMul => .arithmetic, - .OpFMul => .arithmetic, - .OpUDiv => .arithmetic, - .OpSDiv => .arithmetic, - .OpFDiv => .arithmetic, - .OpUMod => .arithmetic, - .OpSRem => .arithmetic, - .OpSMod => .arithmetic, - .OpFRem => .arithmetic, - .OpFMod => .arithmetic, - .OpVectorTimesScalar => .arithmetic, - .OpMatrixTimesScalar => .arithmetic, - .OpVectorTimesMatrix => .arithmetic, - .OpMatrixTimesVector => .arithmetic, - .OpMatrixTimesMatrix => .arithmetic, - .OpOuterProduct => .arithmetic, - .OpDot => .arithmetic, - .OpIAddCarry => .arithmetic, - .OpISubBorrow => .arithmetic, - .OpUMulExtended => .arithmetic, - .OpSMulExtended => .arithmetic, - .OpAny => .relational_and_logical, - .OpAll => .relational_and_logical, - .OpIsNan => .relational_and_logical, - .OpIsInf => .relational_and_logical, - .OpIsFinite => .relational_and_logical, - .OpIsNormal => .relational_and_logical, - .OpSignBitSet => .relational_and_logical, - .OpLessOrGreater => .relational_and_logical, - .OpOrdered => .relational_and_logical, - .OpUnordered => .relational_and_logical, - .OpLogicalEqual => .relational_and_logical, - .OpLogicalNotEqual => .relational_and_logical, - .OpLogicalOr => .relational_and_logical, - .OpLogicalAnd => .relational_and_logical, - .OpLogicalNot => .relational_and_logical, - .OpSelect => .relational_and_logical, - .OpIEqual => .relational_and_logical, - .OpINotEqual => .relational_and_logical, - .OpUGreaterThan => .relational_and_logical, - .OpSGreaterThan => .relational_and_logical, - .OpUGreaterThanEqual => .relational_and_logical, - .OpSGreaterThanEqual => .relational_and_logical, - .OpULessThan => .relational_and_logical, - .OpSLessThan => .relational_and_logical, - .OpULessThanEqual => .relational_and_logical, - .OpSLessThanEqual => .relational_and_logical, - .OpFOrdEqual => .relational_and_logical, - .OpFUnordEqual => .relational_and_logical, - .OpFOrdNotEqual => .relational_and_logical, - .OpFUnordNotEqual => .relational_and_logical, - .OpFOrdLessThan => .relational_and_logical, - .OpFUnordLessThan => .relational_and_logical, - .OpFOrdGreaterThan => .relational_and_logical, - .OpFUnordGreaterThan => .relational_and_logical, - .OpFOrdLessThanEqual => .relational_and_logical, - .OpFUnordLessThanEqual => .relational_and_logical, - .OpFOrdGreaterThanEqual => .relational_and_logical, - .OpFUnordGreaterThanEqual => .relational_and_logical, - .OpShiftRightLogical => .bit, - .OpShiftRightArithmetic => .bit, - .OpShiftLeftLogical => .bit, - .OpBitwiseOr => .bit, - .OpBitwiseXor => .bit, - .OpBitwiseAnd => .bit, - .OpNot => .bit, - .OpBitFieldInsert => .bit, - .OpBitFieldSExtract => .bit, - .OpBitFieldUExtract => .bit, - .OpBitReverse => .bit, - .OpBitCount => .bit, - .OpDPdx => .derivative, - .OpDPdy => .derivative, - .OpFwidth => .derivative, - .OpDPdxFine => .derivative, - .OpDPdyFine => .derivative, - .OpFwidthFine => .derivative, - .OpDPdxCoarse => .derivative, - .OpDPdyCoarse => .derivative, - .OpFwidthCoarse => .derivative, - .OpEmitVertex => .primitive, - .OpEndPrimitive => .primitive, - .OpEmitStreamVertex => .primitive, - .OpEndStreamPrimitive => .primitive, - .OpControlBarrier => .barrier, - .OpMemoryBarrier => .barrier, - .OpAtomicLoad => .atomic, - .OpAtomicStore => .atomic, - .OpAtomicExchange => .atomic, - .OpAtomicCompareExchange => .atomic, - .OpAtomicCompareExchangeWeak => .atomic, - .OpAtomicIIncrement => .atomic, - .OpAtomicIDecrement => .atomic, - .OpAtomicIAdd => .atomic, - .OpAtomicISub => .atomic, - .OpAtomicSMin => .atomic, - .OpAtomicUMin => .atomic, - .OpAtomicSMax => .atomic, - .OpAtomicUMax => .atomic, - .OpAtomicAnd => .atomic, - .OpAtomicOr => .atomic, - .OpAtomicXor => .atomic, - .OpPhi => .control_flow, - .OpLoopMerge => .control_flow, - .OpSelectionMerge => .control_flow, - .OpLabel => .control_flow, - .OpBranch => .control_flow, - .OpBranchConditional => .control_flow, - .OpSwitch => .control_flow, - .OpKill => .control_flow, - .OpReturn => .control_flow, - .OpReturnValue => .control_flow, - .OpUnreachable => .control_flow, - .OpLifetimeStart => .control_flow, - .OpLifetimeStop => .control_flow, - .OpGroupAsyncCopy => .group, - .OpGroupWaitEvents => .group, - .OpGroupAll => .group, - .OpGroupAny => .group, - .OpGroupBroadcast => .group, - .OpGroupIAdd => .group, - .OpGroupFAdd => .group, - .OpGroupFMin => .group, - .OpGroupUMin => .group, - .OpGroupSMin => .group, - .OpGroupFMax => .group, - .OpGroupUMax => .group, - .OpGroupSMax => .group, - .OpReadPipe => .pipe, - .OpWritePipe => .pipe, - .OpReservedReadPipe => .pipe, - .OpReservedWritePipe => .pipe, - .OpReserveReadPipePackets => .pipe, - .OpReserveWritePipePackets => .pipe, - .OpCommitReadPipe => .pipe, - .OpCommitWritePipe => .pipe, - .OpIsValidReserveId => .pipe, - .OpGetNumPipePackets => .pipe, - .OpGetMaxPipePackets => .pipe, - .OpGroupReserveReadPipePackets => .pipe, - .OpGroupReserveWritePipePackets => .pipe, - .OpGroupCommitReadPipe => .pipe, - .OpGroupCommitWritePipe => .pipe, - .OpEnqueueMarker => .device_side_enqueue, - .OpEnqueueKernel => .device_side_enqueue, - .OpGetKernelNDrangeSubGroupCount => .device_side_enqueue, - .OpGetKernelNDrangeMaxSubGroupSize => .device_side_enqueue, - .OpGetKernelWorkGroupSize => .device_side_enqueue, - .OpGetKernelPreferredWorkGroupSizeMultiple => .device_side_enqueue, - .OpRetainEvent => .device_side_enqueue, - .OpReleaseEvent => .device_side_enqueue, - .OpCreateUserEvent => .device_side_enqueue, - .OpIsValidEvent => .device_side_enqueue, - .OpSetUserEventStatus => .device_side_enqueue, - .OpCaptureEventProfilingInfo => .device_side_enqueue, - .OpGetDefaultQueue => .device_side_enqueue, - .OpBuildNDRange => .device_side_enqueue, - .OpImageSparseSampleImplicitLod => .image, - .OpImageSparseSampleExplicitLod => .image, - .OpImageSparseSampleDrefImplicitLod => .image, - .OpImageSparseSampleDrefExplicitLod => .image, - .OpImageSparseSampleProjImplicitLod => .image, - .OpImageSparseSampleProjExplicitLod => .image, - .OpImageSparseSampleProjDrefImplicitLod => .image, - .OpImageSparseSampleProjDrefExplicitLod => .image, - .OpImageSparseFetch => .image, - .OpImageSparseGather => .image, - .OpImageSparseDrefGather => .image, - .OpImageSparseTexelsResident => .image, - .OpNoLine => .debug, - .OpAtomicFlagTestAndSet => .atomic, - .OpAtomicFlagClear => .atomic, - .OpImageSparseRead => .image, - .OpSizeOf => .miscellaneous, - .OpTypePipeStorage => .type_declaration, - .OpConstantPipeStorage => .pipe, - .OpCreatePipeFromPipeStorage => .pipe, - .OpGetKernelLocalSizeForSubgroupCount => .device_side_enqueue, - .OpGetKernelMaxNumSubgroups => .device_side_enqueue, - .OpTypeNamedBarrier => .type_declaration, - .OpNamedBarrierInitialize => .barrier, - .OpMemoryNamedBarrier => .barrier, - .OpModuleProcessed => .debug, - .OpExecutionModeId => .mode_setting, - .OpDecorateId => .annotation, - .OpGroupNonUniformElect => .non_uniform, - .OpGroupNonUniformAll => .non_uniform, - .OpGroupNonUniformAny => .non_uniform, - .OpGroupNonUniformAllEqual => .non_uniform, - .OpGroupNonUniformBroadcast => .non_uniform, - .OpGroupNonUniformBroadcastFirst => .non_uniform, - .OpGroupNonUniformBallot => .non_uniform, - .OpGroupNonUniformInverseBallot => .non_uniform, - .OpGroupNonUniformBallotBitExtract => .non_uniform, - .OpGroupNonUniformBallotBitCount => .non_uniform, - .OpGroupNonUniformBallotFindLSB => .non_uniform, - .OpGroupNonUniformBallotFindMSB => .non_uniform, - .OpGroupNonUniformShuffle => .non_uniform, - .OpGroupNonUniformShuffleXor => .non_uniform, - .OpGroupNonUniformShuffleUp => .non_uniform, - .OpGroupNonUniformShuffleDown => .non_uniform, - .OpGroupNonUniformIAdd => .non_uniform, - .OpGroupNonUniformFAdd => .non_uniform, - .OpGroupNonUniformIMul => .non_uniform, - .OpGroupNonUniformFMul => .non_uniform, - .OpGroupNonUniformSMin => .non_uniform, - .OpGroupNonUniformUMin => .non_uniform, - .OpGroupNonUniformFMin => .non_uniform, - .OpGroupNonUniformSMax => .non_uniform, - .OpGroupNonUniformUMax => .non_uniform, - .OpGroupNonUniformFMax => .non_uniform, - .OpGroupNonUniformBitwiseAnd => .non_uniform, - .OpGroupNonUniformBitwiseOr => .non_uniform, - .OpGroupNonUniformBitwiseXor => .non_uniform, - .OpGroupNonUniformLogicalAnd => .non_uniform, - .OpGroupNonUniformLogicalOr => .non_uniform, - .OpGroupNonUniformLogicalXor => .non_uniform, - .OpGroupNonUniformQuadBroadcast => .non_uniform, - .OpGroupNonUniformQuadSwap => .non_uniform, - .OpCopyLogical => .composite, - .OpPtrEqual => .memory, - .OpPtrNotEqual => .memory, - .OpPtrDiff => .memory, - .OpColorAttachmentReadEXT => .image, - .OpDepthAttachmentReadEXT => .image, - .OpStencilAttachmentReadEXT => .image, - .OpTypeTensorARM => .type_declaration, - .OpTensorReadARM => .tensor, - .OpTensorWriteARM => .tensor, - .OpTensorQuerySizeARM => .tensor, - .OpGraphConstantARM => .graph, - .OpGraphEntryPointARM => .graph, - .OpGraphARM => .graph, - .OpGraphInputARM => .graph, - .OpGraphSetOutputARM => .graph, - .OpGraphEndARM => .graph, - .OpTypeGraphARM => .type_declaration, - .OpTerminateInvocation => .control_flow, - .OpTypeUntypedPointerKHR => .type_declaration, - .OpUntypedVariableKHR => .memory, - .OpUntypedAccessChainKHR => .memory, - .OpUntypedInBoundsAccessChainKHR => .memory, - .OpSubgroupBallotKHR => .group, - .OpSubgroupFirstInvocationKHR => .group, - .OpUntypedPtrAccessChainKHR => .memory, - .OpUntypedInBoundsPtrAccessChainKHR => .memory, - .OpUntypedArrayLengthKHR => .memory, - .OpUntypedPrefetchKHR => .memory, - .OpFmaKHR => .arithmetic, - .OpSubgroupAllKHR => .group, - .OpSubgroupAnyKHR => .group, - .OpSubgroupAllEqualKHR => .group, - .OpGroupNonUniformRotateKHR => .group, - .OpSubgroupReadInvocationKHR => .group, - .OpExtInstWithForwardRefsKHR => .extension, - .OpUntypedGroupAsyncCopyKHR => .group, - .OpTraceRayKHR => .reserved, - .OpExecuteCallableKHR => .reserved, - .OpConvertUToAccelerationStructureKHR => .reserved, - .OpIgnoreIntersectionKHR => .reserved, - .OpTerminateRayKHR => .reserved, - .OpSDot => .arithmetic, - .OpUDot => .arithmetic, - .OpSUDot => .arithmetic, - .OpSDotAccSat => .arithmetic, - .OpUDotAccSat => .arithmetic, - .OpSUDotAccSat => .arithmetic, - .OpTypeCooperativeMatrixKHR => .type_declaration, - .OpCooperativeMatrixLoadKHR => .memory, - .OpCooperativeMatrixStoreKHR => .memory, - .OpCooperativeMatrixMulAddKHR => .arithmetic, - .OpCooperativeMatrixLengthKHR => .miscellaneous, - .OpConstantCompositeReplicateEXT => .constant_creation, - .OpSpecConstantCompositeReplicateEXT => .constant_creation, - .OpCompositeConstructReplicateEXT => .composite, - .OpTypeRayQueryKHR => .type_declaration, - .OpRayQueryInitializeKHR => .reserved, - .OpRayQueryTerminateKHR => .reserved, - .OpRayQueryGenerateIntersectionKHR => .reserved, - .OpRayQueryConfirmIntersectionKHR => .reserved, - .OpRayQueryProceedKHR => .reserved, - .OpRayQueryGetIntersectionTypeKHR => .reserved, - .OpImageSampleWeightedQCOM => .image, - .OpImageBoxFilterQCOM => .image, - .OpImageBlockMatchSSDQCOM => .image, - .OpImageBlockMatchSADQCOM => .image, - .OpBitCastArrayQCOM => .conversion, - .OpImageBlockMatchWindowSSDQCOM => .image, - .OpImageBlockMatchWindowSADQCOM => .image, - .OpImageBlockMatchGatherSSDQCOM => .image, - .OpImageBlockMatchGatherSADQCOM => .image, - .OpCompositeConstructCoopMatQCOM => .composite, - .OpCompositeExtractCoopMatQCOM => .composite, - .OpExtractSubArrayQCOM => .composite, - .OpGroupIAddNonUniformAMD => .group, - .OpGroupFAddNonUniformAMD => .group, - .OpGroupFMinNonUniformAMD => .group, - .OpGroupUMinNonUniformAMD => .group, - .OpGroupSMinNonUniformAMD => .group, - .OpGroupFMaxNonUniformAMD => .group, - .OpGroupUMaxNonUniformAMD => .group, - .OpGroupSMaxNonUniformAMD => .group, - .OpFragmentMaskFetchAMD => .reserved, - .OpFragmentFetchAMD => .reserved, - .OpReadClockKHR => .reserved, - .OpAllocateNodePayloadsAMDX => .reserved, - .OpEnqueueNodePayloadsAMDX => .reserved, - .OpTypeNodePayloadArrayAMDX => .reserved, - .OpFinishWritingNodePayloadAMDX => .reserved, - .OpNodePayloadArrayLengthAMDX => .reserved, - .OpIsNodePayloadValidAMDX => .reserved, - .OpConstantStringAMDX => .reserved, - .OpSpecConstantStringAMDX => .reserved, - .OpGroupNonUniformQuadAllKHR => .non_uniform, - .OpGroupNonUniformQuadAnyKHR => .non_uniform, - .OpTypeBufferEXT => .type_declaration, - .OpBufferPointerEXT => .memory, - .OpAbortKHR => .control_flow, - .OpUntypedImageTexelPointerEXT => .memory, - .OpMemberDecorateIdEXT => .annotation, - .OpConstantSizeOfEXT => .constant_creation, - .OpConstantDataKHR => .constant_creation, - .OpSpecConstantDataKHR => .constant_creation, - .OpPoisonKHR => .miscellaneous, - .OpFreezeKHR => .miscellaneous, - .OpHitObjectRecordHitMotionNV => .reserved, - .OpHitObjectRecordHitWithIndexMotionNV => .reserved, - .OpHitObjectRecordMissMotionNV => .reserved, - .OpHitObjectGetWorldToObjectNV => .reserved, - .OpHitObjectGetObjectToWorldNV => .reserved, - .OpHitObjectGetObjectRayDirectionNV => .reserved, - .OpHitObjectGetObjectRayOriginNV => .reserved, - .OpHitObjectTraceRayMotionNV => .reserved, - .OpHitObjectGetShaderRecordBufferHandleNV => .reserved, - .OpHitObjectGetShaderBindingTableRecordIndexNV => .reserved, - .OpHitObjectRecordEmptyNV => .reserved, - .OpHitObjectTraceRayNV => .reserved, - .OpHitObjectRecordHitNV => .reserved, - .OpHitObjectRecordHitWithIndexNV => .reserved, - .OpHitObjectRecordMissNV => .reserved, - .OpHitObjectExecuteShaderNV => .reserved, - .OpHitObjectGetCurrentTimeNV => .reserved, - .OpHitObjectGetAttributesNV => .reserved, - .OpHitObjectGetHitKindNV => .reserved, - .OpHitObjectGetPrimitiveIndexNV => .reserved, - .OpHitObjectGetGeometryIndexNV => .reserved, - .OpHitObjectGetInstanceIdNV => .reserved, - .OpHitObjectGetInstanceCustomIndexNV => .reserved, - .OpHitObjectGetWorldRayDirectionNV => .reserved, - .OpHitObjectGetWorldRayOriginNV => .reserved, - .OpHitObjectGetRayTMaxNV => .reserved, - .OpHitObjectGetRayTMinNV => .reserved, - .OpHitObjectIsEmptyNV => .reserved, - .OpHitObjectIsHitNV => .reserved, - .OpHitObjectIsMissNV => .reserved, - .OpReorderThreadWithHitObjectNV => .reserved, - .OpReorderThreadWithHintNV => .reserved, - .OpTypeHitObjectNV => .type_declaration, - .OpImageSampleFootprintNV => .image, - .OpTypeVectorIdEXT => .type_declaration, - .OpCooperativeVectorMatrixMulNV => .reserved, - .OpCooperativeVectorOuterProductAccumulateNV => .reserved, - .OpCooperativeVectorReduceSumAccumulateNV => .reserved, - .OpCooperativeVectorMatrixMulAddNV => .reserved, - .OpCooperativeMatrixConvertNV => .conversion, - .OpEmitMeshTasksEXT => .reserved, - .OpSetMeshOutputsEXT => .reserved, - .OpGroupNonUniformPartitionEXT => .non_uniform, - .OpWritePackedPrimitiveIndices4x8NV => .reserved, - .OpFetchMicroTriangleVertexPositionNV => .reserved, - .OpFetchMicroTriangleVertexBarycentricNV => .reserved, - .OpCooperativeVectorLoadNV => .memory, - .OpCooperativeVectorStoreNV => .memory, - .OpHitObjectRecordFromQueryEXT => .reserved, - .OpHitObjectRecordMissEXT => .reserved, - .OpHitObjectRecordMissMotionEXT => .reserved, - .OpHitObjectGetIntersectionTriangleVertexPositionsEXT => .reserved, - .OpHitObjectGetRayFlagsEXT => .reserved, - .OpHitObjectSetShaderBindingTableRecordIndexEXT => .reserved, - .OpHitObjectReorderExecuteShaderEXT => .reserved, - .OpHitObjectTraceReorderExecuteEXT => .reserved, - .OpHitObjectTraceMotionReorderExecuteEXT => .reserved, - .OpTypeHitObjectEXT => .type_declaration, - .OpReorderThreadWithHintEXT => .reserved, - .OpReorderThreadWithHitObjectEXT => .reserved, - .OpHitObjectTraceRayEXT => .reserved, - .OpHitObjectTraceRayMotionEXT => .reserved, - .OpHitObjectRecordEmptyEXT => .reserved, - .OpHitObjectExecuteShaderEXT => .reserved, - .OpHitObjectGetCurrentTimeEXT => .reserved, - .OpHitObjectGetAttributesEXT => .reserved, - .OpHitObjectGetHitKindEXT => .reserved, - .OpHitObjectGetPrimitiveIndexEXT => .reserved, - .OpHitObjectGetGeometryIndexEXT => .reserved, - .OpHitObjectGetInstanceIdEXT => .reserved, - .OpHitObjectGetInstanceCustomIndexEXT => .reserved, - .OpHitObjectGetObjectRayOriginEXT => .reserved, - .OpHitObjectGetObjectRayDirectionEXT => .reserved, - .OpHitObjectGetWorldRayDirectionEXT => .reserved, - .OpHitObjectGetWorldRayOriginEXT => .reserved, - .OpHitObjectGetObjectToWorldEXT => .reserved, - .OpHitObjectGetWorldToObjectEXT => .reserved, - .OpHitObjectGetRayTMaxEXT => .reserved, - .OpReportIntersectionKHR => .reserved, - .OpIgnoreIntersectionNV => .reserved, - .OpTerminateRayNV => .reserved, - .OpTraceNV => .reserved, - .OpTraceMotionNV => .reserved, - .OpTraceRayMotionNV => .reserved, - .OpRayQueryGetIntersectionTriangleVertexPositionsKHR => .reserved, - .OpTypeAccelerationStructureKHR => .type_declaration, - .OpExecuteCallableNV => .reserved, - .OpRayQueryGetIntersectionClusterIdNV => .reserved, - .OpHitObjectGetClusterIdNV => .reserved, - .OpHitObjectGetRayTMinEXT => .reserved, - .OpHitObjectGetShaderBindingTableRecordIndexEXT => .reserved, - .OpHitObjectGetShaderRecordBufferHandleEXT => .reserved, - .OpHitObjectIsEmptyEXT => .reserved, - .OpHitObjectIsHitEXT => .reserved, - .OpHitObjectIsMissEXT => .reserved, - .OpTypeCooperativeMatrixNV => .type_declaration, - .OpCooperativeMatrixLoadNV => .reserved, - .OpCooperativeMatrixStoreNV => .reserved, - .OpCooperativeMatrixMulAddNV => .reserved, - .OpCooperativeMatrixLengthNV => .reserved, - .OpBeginInvocationInterlockEXT => .reserved, - .OpEndInvocationInterlockEXT => .reserved, - .OpCooperativeMatrixReduceNV => .arithmetic, - .OpCooperativeMatrixLoadTensorNV => .memory, - .OpCooperativeMatrixStoreTensorNV => .memory, - .OpCooperativeMatrixPerElementOpNV => .function, - .OpTypeTensorLayoutNV => .type_declaration, - .OpTypeTensorViewNV => .type_declaration, - .OpCreateTensorLayoutNV => .reserved, - .OpTensorLayoutSetDimensionNV => .reserved, - .OpTensorLayoutSetStrideNV => .reserved, - .OpTensorLayoutSliceNV => .reserved, - .OpTensorLayoutSetClampValueNV => .reserved, - .OpCreateTensorViewNV => .reserved, - .OpTensorViewSetDimensionNV => .reserved, - .OpTensorViewSetStrideNV => .reserved, - .OpDemoteToHelperInvocation => .control_flow, - .OpIsHelperInvocationEXT => .reserved, - .OpTensorViewSetClipNV => .reserved, - .OpTensorLayoutSetBlockSizeNV => .reserved, - .OpCooperativeMatrixTransposeNV => .conversion, - .OpConvertUToImageNV => .reserved, - .OpConvertUToSamplerNV => .reserved, - .OpConvertImageToUNV => .reserved, - .OpConvertSamplerToUNV => .reserved, - .OpConvertUToSampledImageNV => .reserved, - .OpConvertSampledImageToUNV => .reserved, - .OpSamplerImageAddressingModeNV => .reserved, - .OpRawAccessChainNV => .memory, - .OpRayQueryGetIntersectionSpherePositionNV => .reserved, - .OpRayQueryGetIntersectionSphereRadiusNV => .reserved, - .OpRayQueryGetIntersectionLSSPositionsNV => .reserved, - .OpRayQueryGetIntersectionLSSRadiiNV => .reserved, - .OpRayQueryGetIntersectionLSSHitValueNV => .reserved, - .OpHitObjectGetSpherePositionNV => .reserved, - .OpHitObjectGetSphereRadiusNV => .reserved, - .OpHitObjectGetLSSPositionsNV => .reserved, - .OpHitObjectGetLSSRadiiNV => .reserved, - .OpHitObjectIsSphereHitNV => .reserved, - .OpHitObjectIsLSSHitNV => .reserved, - .OpRayQueryIsSphereHitNV => .reserved, - .OpRayQueryIsLSSHitNV => .reserved, - .OpSubgroupShuffleINTEL => .group, - .OpSubgroupShuffleDownINTEL => .group, - .OpSubgroupShuffleUpINTEL => .group, - .OpSubgroupShuffleXorINTEL => .group, - .OpSubgroupBlockReadINTEL => .group, - .OpSubgroupBlockWriteINTEL => .group, - .OpSubgroupImageBlockReadINTEL => .group, - .OpSubgroupImageBlockWriteINTEL => .group, - .OpSubgroupImageMediaBlockReadINTEL => .group, - .OpSubgroupImageMediaBlockWriteINTEL => .group, - .OpUCountLeadingZerosINTEL => .reserved, - .OpUCountTrailingZerosINTEL => .reserved, - .OpAbsISubINTEL => .reserved, - .OpAbsUSubINTEL => .reserved, - .OpIAddSatINTEL => .reserved, - .OpUAddSatINTEL => .reserved, - .OpIAverageINTEL => .reserved, - .OpUAverageINTEL => .reserved, - .OpIAverageRoundedINTEL => .reserved, - .OpUAverageRoundedINTEL => .reserved, - .OpISubSatINTEL => .reserved, - .OpUSubSatINTEL => .reserved, - .OpIMul32x16INTEL => .reserved, - .OpUMul32x16INTEL => .reserved, - .OpAtomicFMinEXT => .atomic, - .OpAtomicFMaxEXT => .atomic, - .OpAssumeTrueKHR => .miscellaneous, - .OpExpectKHR => .miscellaneous, - .OpDecorateString => .annotation, - .OpMemberDecorateString => .annotation, - .OpVariableLengthArrayINTEL => .memory, - .OpSaveMemoryINTEL => .memory, - .OpRestoreMemoryINTEL => .memory, - .OpLoopControlINTEL => .reserved, - .OpRayQueryGetRayTMinKHR => .reserved, - .OpRayQueryGetRayFlagsKHR => .reserved, - .OpRayQueryGetIntersectionTKHR => .reserved, - .OpRayQueryGetIntersectionInstanceCustomIndexKHR => .reserved, - .OpRayQueryGetIntersectionInstanceIdKHR => .reserved, - .OpRayQueryGetIntersectionInstanceShaderBindingTableRecordOffsetKHR => .reserved, - .OpRayQueryGetIntersectionGeometryIndexKHR => .reserved, - .OpRayQueryGetIntersectionPrimitiveIndexKHR => .reserved, - .OpRayQueryGetIntersectionBarycentricsKHR => .reserved, - .OpRayQueryGetIntersectionFrontFaceKHR => .reserved, - .OpRayQueryGetIntersectionCandidateAABBOpaqueKHR => .reserved, - .OpRayQueryGetIntersectionObjectRayDirectionKHR => .reserved, - .OpRayQueryGetIntersectionObjectRayOriginKHR => .reserved, - .OpRayQueryGetWorldRayDirectionKHR => .reserved, - .OpRayQueryGetWorldRayOriginKHR => .reserved, - .OpRayQueryGetIntersectionObjectToWorldKHR => .reserved, - .OpRayQueryGetIntersectionWorldToObjectKHR => .reserved, - .OpAtomicFAddEXT => .atomic, - .OpTypeBufferSurfaceINTEL => .type_declaration, - .OpTypeStructContinuedINTEL => .type_declaration, - .OpConstantCompositeContinuedINTEL => .constant_creation, - .OpSpecConstantCompositeContinuedINTEL => .constant_creation, - .OpCompositeConstructContinuedINTEL => .composite, - .OpConvertFToBF16INTEL => .conversion, - .OpConvertBF16ToFINTEL => .conversion, - .OpControlBarrierArriveINTEL => .barrier, - .OpControlBarrierWaitINTEL => .barrier, - .OpArithmeticFenceEXT => .miscellaneous, - .OpSubgroupBlockPrefetchINTEL => .group, - .OpSubgroup2DBlockLoadINTEL => .group, - .OpSubgroup2DBlockLoadTransformINTEL => .group, - .OpSubgroup2DBlockLoadTransposeINTEL => .group, - .OpSubgroup2DBlockPrefetchINTEL => .group, - .OpSubgroup2DBlockStoreINTEL => .group, - .OpSubgroupMatrixMultiplyAccumulateINTEL => .group, - .OpBitwiseFunctionINTEL => .bit, - .OpUntypedVariableLengthArrayINTEL => .memory, - .OpConditionalExtensionINTEL => .extension, - .OpConditionalEntryPointINTEL => .mode_setting, - .OpConditionalCapabilityINTEL => .mode_setting, - .OpSpecConstantTargetINTEL => .constant_creation, - .OpSpecConstantArchitectureINTEL => .constant_creation, - .OpSpecConstantCapabilitiesINTEL => .constant_creation, - .OpConditionalCopyObjectINTEL => .composite, - .OpGroupIMulKHR => .group, - .OpGroupFMulKHR => .group, - .OpGroupBitwiseAndKHR => .group, - .OpGroupBitwiseOrKHR => .group, - .OpGroupBitwiseXorKHR => .group, - .OpGroupLogicalAndKHR => .group, - .OpGroupLogicalOrKHR => .group, - .OpGroupLogicalXorKHR => .group, - .OpRoundFToTF32INTEL => .conversion, - .OpMaskedGatherINTEL => .memory, - .OpMaskedScatterINTEL => .memory, - .OpConvertHandleToImageINTEL => .image, - .OpConvertHandleToSamplerINTEL => .image, - .OpConvertHandleToSampledImageINTEL => .image, - .OpFDot2MixAcc32VALVE => .reserved, - .OpFDot2MixAcc16VALVE => .reserved, - .OpFDot4MixAcc32VALVE => .reserved, + + pub fn class(opcode: Opcode) Class { + return switch (@backingInt(opcode)) { + 0...1 => .miscellaneous, + 2...8 => .debug, + 10...12 => .extension, + 14...17 => .mode_setting, + 19...39 => .type_declaration, + 41...52 => .constant_creation, + 54...57 => .function, + 59...70 => .memory, + 71...75 => .annotation, + 77...84 => .composite, + 86...107 => .image, + 109...124 => .conversion, + 126...152 => .arithmetic, + 154...191 => .relational_and_logical, + 194...205 => .bit, + 207...215 => .derivative, + 218...221 => .primitive, + 224...225 => .barrier, + 227...242 => .atomic, + 245...257 => .control_flow, + 259...271 => .group, + 274...288 => .pipe, + 291...304 => .device_side_enqueue, + 305...316 => .image, + 317 => .debug, + 318...319 => .atomic, + 320 => .image, + 321 => .miscellaneous, + 322 => .type_declaration, + 323...324 => .pipe, + 325...326 => .device_side_enqueue, + 327 => .type_declaration, + 328...329 => .barrier, + 330 => .debug, + 331 => .mode_setting, + 332 => .annotation, + 333...366 => .non_uniform, + 400 => .composite, + 401...403 => .memory, + 4160...4162 => .image, + 4416 => .control_flow, + 4417 => .type_declaration, + 4418...4420 => .memory, + 4421...4422 => .group, + 4423...4426 => .memory, + 4427 => .arithmetic, + 4428...4432 => .group, + 4433 => .extension, + 4434 => .group, + 4445...4449 => .reserved, + 4450...4455 => .arithmetic, + 4456 => .type_declaration, + 4457...4458 => .memory, + 4459 => .arithmetic, + 4460 => .miscellaneous, + 4461...4462 => .constant_creation, + 4463 => .composite, + 4472 => .type_declaration, + 4473...5056 => .reserved, + 5110...5111 => .non_uniform, + 5115 => .type_declaration, + 5119 => .memory, + 5121 => .control_flow, + 5126 => .memory, + 5127 => .annotation, + 5129...5148 => .constant_creation, + 5158...5159 => .miscellaneous, + 5288 => .type_declaration, + 5294...5295 => .reserved, + 5296 => .non_uniform, + 5304...5312 => .reserved, + 5313 => .type_declaration, + 5314...5340 => .reserved, + 5341 => .type_declaration, + 5347...5365 => .reserved, + 5380 => .control_flow, + 5381 => .reserved, + 5614...5615 => .atomic, + 5630...5631 => .miscellaneous, + 5632...5633 => .annotation, + 6016...6032 => .reserved, + 6035 => .atomic, + 6145 => .miscellaneous, + 6401...6408 => .group, + else => unreachable, + }; + } + + pub fn resultIndex(opcode: Opcode) ?u8 { + const list = opcode.operands(); + if (list.len == 0) return null; + return switch (list[0].kind) { + .id_result => 1, + .id_result_type => 2, + else => null, + }; + } + + pub fn instructionSize(comptime opcode: Opcode, ops: opcode.Operands()) usize { + return operandsSize(opcode.Operands(), ops) + 1; + } + + fn operandsSize(comptime T: type, ops: T) usize { + const info = switch (@typeInfo(T)) { + .@"struct" => |info| info, + .void => return 0, + else => unreachable, + }; + + var total: usize = 0; + inline for (info.field_names, info.field_types) |field_name, field_type| { + total += operandSize(field_type, @field(ops, field_name)); + } + + return total; + } + + fn operandSize(comptime T: type, operand: T) usize { + return switch (T) { + LiteralSpecConstantOpInteger => unreachable, + Id, LiteralInteger, LiteralExtInstInteger => 1, + LiteralString => @divCeil(operand.len + 1, @sizeOf(Word)), + LiteralContextDependentNumber => switch (operand) { + .int32, .uint32, .float32 => 1, + .int64, .uint64, .float64 => 2, + }, + PairLiteralIntegerIdRef, PairIdRefLiteralInteger, PairIdRefIdRef => 2, + else => switch (@typeInfo(T)) { + .@"enum" => 1, + .optional => |info| if (operand) |child| operandSize(info.child, child) else 0, + .pointer => |info| blk: { + std.debug.assert(info.size == .slice); + var total: usize = 0; + for (operand) |item| { + total += operandSize(info.child, item); + } + break :blk total; + }, + .@"struct" => |struct_info| { + if (struct_info.layout == .@"packed") return 1; + var total: usize = 0; + inline for (struct_info.field_names, struct_info.field_types) |field_name, field_type| { + switch (@typeInfo(field_type)) { + .optional => |info| if (@field(operand, field_name)) |child| { + total += operandsSize(info.child, child); + }, + .bool, .int => {}, + else => unreachable, + } + } + return total + 1; + }, + .@"union" => switch (operand) { + inline else => |op, tag| operandsSize(@FieldType(T, @tagName(tag)), op) + 1, + }, + else => unreachable, + }, }; } }; @@ -3694,6 +2918,173 @@ pub const OpenClOpcode = enum(u16) { u_abs_diff = 202, u_mul_hi = 203, u_mad_hi = 204, + + pub fn operands(opcode: OpenClOpcode) []const Operand { + return switch (opcode) { + .acos => &.{.{ .kind = .id_ref }}, + .acosh => &.{.{ .kind = .id_ref }}, + .acospi => &.{.{ .kind = .id_ref }}, + .asin => &.{.{ .kind = .id_ref }}, + .asinh => &.{.{ .kind = .id_ref }}, + .asinpi => &.{.{ .kind = .id_ref }}, + .atan => &.{.{ .kind = .id_ref }}, + .atan2 => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .atanh => &.{.{ .kind = .id_ref }}, + .atanpi => &.{.{ .kind = .id_ref }}, + .atan2pi => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .cbrt => &.{.{ .kind = .id_ref }}, + .ceil => &.{.{ .kind = .id_ref }}, + .copysign => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .cos => &.{.{ .kind = .id_ref }}, + .cosh => &.{.{ .kind = .id_ref }}, + .cospi => &.{.{ .kind = .id_ref }}, + .erfc => &.{.{ .kind = .id_ref }}, + .erf => &.{.{ .kind = .id_ref }}, + .exp => &.{.{ .kind = .id_ref }}, + .exp2 => &.{.{ .kind = .id_ref }}, + .exp10 => &.{.{ .kind = .id_ref }}, + .expm1 => &.{.{ .kind = .id_ref }}, + .fabs => &.{.{ .kind = .id_ref }}, + .fdim => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .floor => &.{.{ .kind = .id_ref }}, + .fma => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .fmax => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .fmin => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .fmod => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .fract => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .frexp => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .hypot => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .ilogb => &.{.{ .kind = .id_ref }}, + .ldexp => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .lgamma => &.{.{ .kind = .id_ref }}, + .lgamma_r => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .log => &.{.{ .kind = .id_ref }}, + .log2 => &.{.{ .kind = .id_ref }}, + .log10 => &.{.{ .kind = .id_ref }}, + .log1p => &.{.{ .kind = .id_ref }}, + .logb => &.{.{ .kind = .id_ref }}, + .mad => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .maxmag => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .minmag => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .modf => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .nan => &.{.{ .kind = .id_ref }}, + .nextafter => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .pow => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .pown => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .powr => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .remainder => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .remquo => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .rint => &.{.{ .kind = .id_ref }}, + .rootn => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .round => &.{.{ .kind = .id_ref }}, + .rsqrt => &.{.{ .kind = .id_ref }}, + .sin => &.{.{ .kind = .id_ref }}, + .sincos => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .sinh => &.{.{ .kind = .id_ref }}, + .sinpi => &.{.{ .kind = .id_ref }}, + .sqrt => &.{.{ .kind = .id_ref }}, + .tan => &.{.{ .kind = .id_ref }}, + .tanh => &.{.{ .kind = .id_ref }}, + .tanpi => &.{.{ .kind = .id_ref }}, + .tgamma => &.{.{ .kind = .id_ref }}, + .trunc => &.{.{ .kind = .id_ref }}, + .half_cos => &.{.{ .kind = .id_ref }}, + .half_divide => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .half_exp => &.{.{ .kind = .id_ref }}, + .half_exp2 => &.{.{ .kind = .id_ref }}, + .half_exp10 => &.{.{ .kind = .id_ref }}, + .half_log => &.{.{ .kind = .id_ref }}, + .half_log2 => &.{.{ .kind = .id_ref }}, + .half_log10 => &.{.{ .kind = .id_ref }}, + .half_powr => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .half_recip => &.{.{ .kind = .id_ref }}, + .half_rsqrt => &.{.{ .kind = .id_ref }}, + .half_sin => &.{.{ .kind = .id_ref }}, + .half_sqrt => &.{.{ .kind = .id_ref }}, + .half_tan => &.{.{ .kind = .id_ref }}, + .native_cos => &.{.{ .kind = .id_ref }}, + .native_divide => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .native_exp => &.{.{ .kind = .id_ref }}, + .native_exp2 => &.{.{ .kind = .id_ref }}, + .native_exp10 => &.{.{ .kind = .id_ref }}, + .native_log => &.{.{ .kind = .id_ref }}, + .native_log2 => &.{.{ .kind = .id_ref }}, + .native_log10 => &.{.{ .kind = .id_ref }}, + .native_powr => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .native_recip => &.{.{ .kind = .id_ref }}, + .native_rsqrt => &.{.{ .kind = .id_ref }}, + .native_sin => &.{.{ .kind = .id_ref }}, + .native_sqrt => &.{.{ .kind = .id_ref }}, + .native_tan => &.{.{ .kind = .id_ref }}, + .fclamp => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .degrees => &.{.{ .kind = .id_ref }}, + .fmax_common => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .fmin_common => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .mix => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .radians => &.{.{ .kind = .id_ref }}, + .step => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .smoothstep => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .sign => &.{.{ .kind = .id_ref }}, + .cross => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .distance => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .length => &.{.{ .kind = .id_ref }}, + .normalize => &.{.{ .kind = .id_ref }}, + .fast_distance => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .fast_length => &.{.{ .kind = .id_ref }}, + .fast_normalize => &.{.{ .kind = .id_ref }}, + .s_abs => &.{.{ .kind = .id_ref }}, + .s_abs_diff => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .s_add_sat => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .u_add_sat => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .s_hadd => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .u_hadd => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .s_rhadd => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .u_rhadd => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .s_clamp => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .u_clamp => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .clz => &.{.{ .kind = .id_ref }}, + .ctz => &.{.{ .kind = .id_ref }}, + .s_mad_hi => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .u_mad_sat => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .s_mad_sat => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .s_max => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .u_max => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .s_min => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .u_min => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .s_mul_hi => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .rotate => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .s_sub_sat => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .u_sub_sat => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .u_upsample => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .s_upsample => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .popcount => &.{.{ .kind = .id_ref }}, + .s_mad24 => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .u_mad24 => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .s_mul24 => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .u_mul24 => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .vloadn => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .literal_integer } }, + .vstoren => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .vload_half => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .vload_halfn => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .literal_integer } }, + .vstore_half => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .vstore_half_r => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .fp_rounding_mode } }, + .vstore_halfn => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .vstore_halfn_r => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .fp_rounding_mode } }, + .vloada_halfn => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .literal_integer } }, + .vstorea_halfn => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .vstorea_halfn_r => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .fp_rounding_mode } }, + .shuffle => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .shuffle2 => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .printf => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref, .quantifier = .variadic } }, + .prefetch => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .bitselect => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .select => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .u_abs => &.{.{ .kind = .id_ref }}, + .u_abs_diff => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .u_mul_hi => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .u_mad_hi => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + }; + } }; pub const GlslOpcode = enum(u16) { @@ -3778,12 +3169,94 @@ pub const GlslOpcode = enum(u16) { NMin = 79, NMax = 80, NClamp = 81, -}; -pub const Zig = enum(u16) { - InvocationGlobal = 0, + pub fn operands(opcode: GlslOpcode) []const Operand { + return switch (opcode) { + .Round => &.{.{ .kind = .id_ref }}, + .RoundEven => &.{.{ .kind = .id_ref }}, + .Trunc => &.{.{ .kind = .id_ref }}, + .FAbs => &.{.{ .kind = .id_ref }}, + .SAbs => &.{.{ .kind = .id_ref }}, + .FSign => &.{.{ .kind = .id_ref }}, + .SSign => &.{.{ .kind = .id_ref }}, + .Floor => &.{.{ .kind = .id_ref }}, + .Ceil => &.{.{ .kind = .id_ref }}, + .Fract => &.{.{ .kind = .id_ref }}, + .Radians => &.{.{ .kind = .id_ref }}, + .Degrees => &.{.{ .kind = .id_ref }}, + .Sin => &.{.{ .kind = .id_ref }}, + .Cos => &.{.{ .kind = .id_ref }}, + .Tan => &.{.{ .kind = .id_ref }}, + .Asin => &.{.{ .kind = .id_ref }}, + .Acos => &.{.{ .kind = .id_ref }}, + .Atan => &.{.{ .kind = .id_ref }}, + .Sinh => &.{.{ .kind = .id_ref }}, + .Cosh => &.{.{ .kind = .id_ref }}, + .Tanh => &.{.{ .kind = .id_ref }}, + .Asinh => &.{.{ .kind = .id_ref }}, + .Acosh => &.{.{ .kind = .id_ref }}, + .Atanh => &.{.{ .kind = .id_ref }}, + .Atan2 => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .Pow => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .Exp => &.{.{ .kind = .id_ref }}, + .Log => &.{.{ .kind = .id_ref }}, + .Exp2 => &.{.{ .kind = .id_ref }}, + .Log2 => &.{.{ .kind = .id_ref }}, + .Sqrt => &.{.{ .kind = .id_ref }}, + .InverseSqrt => &.{.{ .kind = .id_ref }}, + .Determinant => &.{.{ .kind = .id_ref }}, + .MatrixInverse => &.{.{ .kind = .id_ref }}, + .Modf => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .ModfStruct => &.{.{ .kind = .id_ref }}, + .FMin => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .UMin => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .SMin => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .FMax => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .UMax => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .SMax => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .FClamp => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .UClamp => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .SClamp => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .FMix => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .IMix => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .Step => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .SmoothStep => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .Fma => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .Frexp => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .FrexpStruct => &.{.{ .kind = .id_ref }}, + .Ldexp => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .PackSnorm4x8 => &.{.{ .kind = .id_ref }}, + .PackUnorm4x8 => &.{.{ .kind = .id_ref }}, + .PackSnorm2x16 => &.{.{ .kind = .id_ref }}, + .PackUnorm2x16 => &.{.{ .kind = .id_ref }}, + .PackHalf2x16 => &.{.{ .kind = .id_ref }}, + .PackDouble2x32 => &.{.{ .kind = .id_ref }}, + .UnpackSnorm2x16 => &.{.{ .kind = .id_ref }}, + .UnpackUnorm2x16 => &.{.{ .kind = .id_ref }}, + .UnpackHalf2x16 => &.{.{ .kind = .id_ref }}, + .UnpackSnorm4x8 => &.{.{ .kind = .id_ref }}, + .UnpackUnorm4x8 => &.{.{ .kind = .id_ref }}, + .UnpackDouble2x32 => &.{.{ .kind = .id_ref }}, + .Length => &.{.{ .kind = .id_ref }}, + .Distance => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .Cross => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .Normalize => &.{.{ .kind = .id_ref }}, + .FaceForward => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .Reflect => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .Refract => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .FindILsb => &.{.{ .kind = .id_ref }}, + .FindSMsb => &.{.{ .kind = .id_ref }}, + .FindUMsb => &.{.{ .kind = .id_ref }}, + .InterpolateAtCentroid => &.{.{ .kind = .id_ref }}, + .InterpolateAtSample => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .InterpolateAtOffset => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .NMin => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .NMax => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + .NClamp => &.{ .{ .kind = .id_ref }, .{ .kind = .id_ref }, .{ .kind = .id_ref } }, + }; + } }; -pub const ImageOperands = packed struct { +pub const ImageOperands = packed struct(Word) { bias: bool = false, lod: bool = false, grad: bool = false, @@ -3801,21 +3274,7 @@ pub const ImageOperands = packed struct { nontemporal: bool = false, _reserved_bit_15: bool = false, offsets: bool = false, - _reserved_bit_17: bool = false, - _reserved_bit_18: bool = false, - _reserved_bit_19: bool = false, - _reserved_bit_20: bool = false, - _reserved_bit_21: bool = false, - _reserved_bit_22: bool = false, - _reserved_bit_23: bool = false, - _reserved_bit_24: bool = false, - _reserved_bit_25: bool = false, - _reserved_bit_26: bool = false, - _reserved_bit_27: bool = false, - _reserved_bit_28: bool = false, - _reserved_bit_29: bool = false, - _reserved_bit_30: bool = false, - _reserved_bit_31: bool = false, + _reserved_bits_17_to_31: u15 = 0, pub const Extended = struct { bias: ?struct { id_ref: Id } = null, @@ -3835,92 +3294,27 @@ pub const ImageOperands = packed struct { nontemporal: bool = false, _reserved_bit_15: bool = false, offsets: ?struct { id_ref: Id } = null, - _reserved_bit_17: bool = false, - _reserved_bit_18: bool = false, - _reserved_bit_19: bool = false, - _reserved_bit_20: bool = false, - _reserved_bit_21: bool = false, - _reserved_bit_22: bool = false, - _reserved_bit_23: bool = false, - _reserved_bit_24: bool = false, - _reserved_bit_25: bool = false, - _reserved_bit_26: bool = false, - _reserved_bit_27: bool = false, - _reserved_bit_28: bool = false, - _reserved_bit_29: bool = false, - _reserved_bit_30: bool = false, - _reserved_bit_31: bool = false, + _reserved_bits_17_to_31: u15 = 0, }; }; -pub const FPFastMathMode = packed struct { +pub const FPFastMathMode = packed struct(Word) { not_na_n: bool = false, not_inf: bool = false, nsz: bool = false, allow_recip: bool = false, fast: bool = false, - _reserved_bit_5: bool = false, - _reserved_bit_6: bool = false, - _reserved_bit_7: bool = false, - _reserved_bit_8: bool = false, - _reserved_bit_9: bool = false, - _reserved_bit_10: bool = false, - _reserved_bit_11: bool = false, - _reserved_bit_12: bool = false, - _reserved_bit_13: bool = false, - _reserved_bit_14: bool = false, - _reserved_bit_15: bool = false, + _reserved_bits_5_to_15: u11 = 0, allow_contract: bool = false, allow_reassoc: bool = false, allow_transform: bool = false, - _reserved_bit_19: bool = false, - _reserved_bit_20: bool = false, - _reserved_bit_21: bool = false, - _reserved_bit_22: bool = false, - _reserved_bit_23: bool = false, - _reserved_bit_24: bool = false, - _reserved_bit_25: bool = false, - _reserved_bit_26: bool = false, - _reserved_bit_27: bool = false, - _reserved_bit_28: bool = false, - _reserved_bit_29: bool = false, - _reserved_bit_30: bool = false, - _reserved_bit_31: bool = false, + _reserved_bits_19_to_31: u13 = 0, }; -pub const SelectionControl = packed struct { +pub const SelectionControl = packed struct(Word) { flatten: bool = false, dont_flatten: bool = false, - _reserved_bit_2: bool = false, - _reserved_bit_3: bool = false, - _reserved_bit_4: bool = false, - _reserved_bit_5: bool = false, - _reserved_bit_6: bool = false, - _reserved_bit_7: bool = false, - _reserved_bit_8: bool = false, - _reserved_bit_9: bool = false, - _reserved_bit_10: bool = false, - _reserved_bit_11: bool = false, - _reserved_bit_12: bool = false, - _reserved_bit_13: bool = false, - _reserved_bit_14: bool = false, - _reserved_bit_15: bool = false, - _reserved_bit_16: bool = false, - _reserved_bit_17: bool = false, - _reserved_bit_18: bool = false, - _reserved_bit_19: bool = false, - _reserved_bit_20: bool = false, - _reserved_bit_21: bool = false, - _reserved_bit_22: bool = false, - _reserved_bit_23: bool = false, - _reserved_bit_24: bool = false, - _reserved_bit_25: bool = false, - _reserved_bit_26: bool = false, - _reserved_bit_27: bool = false, - _reserved_bit_28: bool = false, - _reserved_bit_29: bool = false, - _reserved_bit_30: bool = false, - _reserved_bit_31: bool = false, + _reserved_bits_2_to_31: u30 = 0, }; -pub const LoopControl = packed struct { +pub const LoopControl = packed struct(Word) { unroll: bool = false, dont_unroll: bool = false, dependency_infinite: bool = false, @@ -3930,29 +3324,7 @@ pub const LoopControl = packed struct { iteration_multiple: bool = false, peel_count: bool = false, partial_count: bool = false, - _reserved_bit_9: bool = false, - _reserved_bit_10: bool = false, - _reserved_bit_11: bool = false, - _reserved_bit_12: bool = false, - _reserved_bit_13: bool = false, - _reserved_bit_14: bool = false, - _reserved_bit_15: bool = false, - initiation_interval_altera: bool = false, - max_concurrency_altera: bool = false, - dependency_array_altera: bool = false, - pipeline_enable_altera: bool = false, - loop_coalesce_altera: bool = false, - max_interleaving_altera: bool = false, - speculated_iterations_altera: bool = false, - no_fusion_altera: bool = false, - loop_count_altera: bool = false, - max_reinvocation_delay_altera: bool = false, - _reserved_bit_26: bool = false, - _reserved_bit_27: bool = false, - _reserved_bit_28: bool = false, - _reserved_bit_29: bool = false, - _reserved_bit_30: bool = false, - _reserved_bit_31: bool = false, + _reserved_bits_9_to_31: u23 = 0, pub const Extended = struct { unroll: bool = false, @@ -3964,66 +3336,19 @@ pub const LoopControl = packed struct { iteration_multiple: ?struct { literal_integer: LiteralInteger } = null, peel_count: ?struct { literal_integer: LiteralInteger } = null, partial_count: ?struct { literal_integer: LiteralInteger } = null, - _reserved_bit_9: bool = false, - _reserved_bit_10: bool = false, - _reserved_bit_11: bool = false, - _reserved_bit_12: bool = false, - _reserved_bit_13: bool = false, - _reserved_bit_14: bool = false, - _reserved_bit_15: bool = false, - initiation_interval_altera: ?struct { literal_integer: LiteralInteger } = null, - max_concurrency_altera: ?struct { literal_integer: LiteralInteger } = null, - dependency_array_altera: ?struct { literal_integer: LiteralInteger } = null, - pipeline_enable_altera: ?struct { literal_integer: LiteralInteger } = null, - loop_coalesce_altera: ?struct { literal_integer: LiteralInteger } = null, - max_interleaving_altera: ?struct { literal_integer: LiteralInteger } = null, - speculated_iterations_altera: ?struct { literal_integer: LiteralInteger } = null, - no_fusion_altera: bool = false, - loop_count_altera: ?struct { literal_integer: LiteralInteger } = null, - max_reinvocation_delay_altera: ?struct { literal_integer: LiteralInteger } = null, - _reserved_bit_26: bool = false, - _reserved_bit_27: bool = false, - _reserved_bit_28: bool = false, - _reserved_bit_29: bool = false, - _reserved_bit_30: bool = false, - _reserved_bit_31: bool = false, + _reserved_bits_9_to_31: u23 = 0, }; }; -pub const FunctionControl = packed struct { +pub const FunctionControl = packed struct(Word) { @"inline": bool = false, dont_inline: bool = false, pure: bool = false, @"const": bool = false, - _reserved_bit_4: bool = false, - _reserved_bit_5: bool = false, - _reserved_bit_6: bool = false, - _reserved_bit_7: bool = false, - _reserved_bit_8: bool = false, - _reserved_bit_9: bool = false, - _reserved_bit_10: bool = false, - _reserved_bit_11: bool = false, - _reserved_bit_12: bool = false, - _reserved_bit_13: bool = false, - _reserved_bit_14: bool = false, - _reserved_bit_15: bool = false, + _reserved_bits_4_to_15: u12 = 0, opt_none_ext: bool = false, - _reserved_bit_17: bool = false, - _reserved_bit_18: bool = false, - _reserved_bit_19: bool = false, - _reserved_bit_20: bool = false, - _reserved_bit_21: bool = false, - _reserved_bit_22: bool = false, - _reserved_bit_23: bool = false, - _reserved_bit_24: bool = false, - _reserved_bit_25: bool = false, - _reserved_bit_26: bool = false, - _reserved_bit_27: bool = false, - _reserved_bit_28: bool = false, - _reserved_bit_29: bool = false, - _reserved_bit_30: bool = false, - _reserved_bit_31: bool = false, + _reserved_bits_17_to_31: u15 = 0, }; -pub const MemorySemantics = packed struct { +pub const MemorySemantics = packed struct(Word) { _reserved_bit_0: bool = false, acquire: bool = false, release: bool = false, @@ -4040,56 +3365,16 @@ pub const MemorySemantics = packed struct { make_available: bool = false, make_visible: bool = false, @"volatile": bool = false, - _reserved_bit_16: bool = false, - _reserved_bit_17: bool = false, - _reserved_bit_18: bool = false, - _reserved_bit_19: bool = false, - _reserved_bit_20: bool = false, - _reserved_bit_21: bool = false, - _reserved_bit_22: bool = false, - _reserved_bit_23: bool = false, - _reserved_bit_24: bool = false, - _reserved_bit_25: bool = false, - _reserved_bit_26: bool = false, - _reserved_bit_27: bool = false, - _reserved_bit_28: bool = false, - _reserved_bit_29: bool = false, - _reserved_bit_30: bool = false, - _reserved_bit_31: bool = false, + _reserved_bits_16_to_31: u16 = 0, }; -pub const MemoryAccess = packed struct { +pub const MemoryAccess = packed struct(Word) { @"volatile": bool = false, aligned: bool = false, nontemporal: bool = false, make_pointer_available: bool = false, make_pointer_visible: bool = false, non_private_pointer: bool = false, - _reserved_bit_6: bool = false, - _reserved_bit_7: bool = false, - _reserved_bit_8: bool = false, - _reserved_bit_9: bool = false, - _reserved_bit_10: bool = false, - _reserved_bit_11: bool = false, - _reserved_bit_12: bool = false, - _reserved_bit_13: bool = false, - _reserved_bit_14: bool = false, - _reserved_bit_15: bool = false, - alias_scope_intel_mask: bool = false, - no_alias_intel_mask: bool = false, - _reserved_bit_18: bool = false, - _reserved_bit_19: bool = false, - _reserved_bit_20: bool = false, - _reserved_bit_21: bool = false, - _reserved_bit_22: bool = false, - _reserved_bit_23: bool = false, - _reserved_bit_24: bool = false, - _reserved_bit_25: bool = false, - _reserved_bit_26: bool = false, - _reserved_bit_27: bool = false, - _reserved_bit_28: bool = false, - _reserved_bit_29: bool = false, - _reserved_bit_30: bool = false, - _reserved_bit_31: bool = false, + _reserved_bits_6_to_31: u26 = 0, pub const Extended = struct { @"volatile": bool = false, @@ -4098,69 +3383,14 @@ pub const MemoryAccess = packed struct { make_pointer_available: ?struct { id_scope: Id } = null, make_pointer_visible: ?struct { id_scope: Id } = null, non_private_pointer: bool = false, - _reserved_bit_6: bool = false, - _reserved_bit_7: bool = false, - _reserved_bit_8: bool = false, - _reserved_bit_9: bool = false, - _reserved_bit_10: bool = false, - _reserved_bit_11: bool = false, - _reserved_bit_12: bool = false, - _reserved_bit_13: bool = false, - _reserved_bit_14: bool = false, - _reserved_bit_15: bool = false, - alias_scope_intel_mask: ?struct { id_ref: Id } = null, - no_alias_intel_mask: ?struct { id_ref: Id } = null, - _reserved_bit_18: bool = false, - _reserved_bit_19: bool = false, - _reserved_bit_20: bool = false, - _reserved_bit_21: bool = false, - _reserved_bit_22: bool = false, - _reserved_bit_23: bool = false, - _reserved_bit_24: bool = false, - _reserved_bit_25: bool = false, - _reserved_bit_26: bool = false, - _reserved_bit_27: bool = false, - _reserved_bit_28: bool = false, - _reserved_bit_29: bool = false, - _reserved_bit_30: bool = false, - _reserved_bit_31: bool = false, + _reserved_bits_6_to_31: u26 = 0, }; }; -pub const KernelProfilingInfo = packed struct { +pub const KernelProfilingInfo = packed struct(Word) { cmd_exec_time: bool = false, - _reserved_bit_1: bool = false, - _reserved_bit_2: bool = false, - _reserved_bit_3: bool = false, - _reserved_bit_4: bool = false, - _reserved_bit_5: bool = false, - _reserved_bit_6: bool = false, - _reserved_bit_7: bool = false, - _reserved_bit_8: bool = false, - _reserved_bit_9: bool = false, - _reserved_bit_10: bool = false, - _reserved_bit_11: bool = false, - _reserved_bit_12: bool = false, - _reserved_bit_13: bool = false, - _reserved_bit_14: bool = false, - _reserved_bit_15: bool = false, - _reserved_bit_16: bool = false, - _reserved_bit_17: bool = false, - _reserved_bit_18: bool = false, - _reserved_bit_19: bool = false, - _reserved_bit_20: bool = false, - _reserved_bit_21: bool = false, - _reserved_bit_22: bool = false, - _reserved_bit_23: bool = false, - _reserved_bit_24: bool = false, - _reserved_bit_25: bool = false, - _reserved_bit_26: bool = false, - _reserved_bit_27: bool = false, - _reserved_bit_28: bool = false, - _reserved_bit_29: bool = false, - _reserved_bit_30: bool = false, - _reserved_bit_31: bool = false, + _reserved_bits_1_to_31: u31 = 0, }; -pub const RayFlags = packed struct { +pub const RayFlags = packed struct(Word) { opaque_khr: bool = false, no_opaque_khr: bool = false, terminate_on_first_hit_khr: bool = false, @@ -4172,95 +3402,17 @@ pub const RayFlags = packed struct { skip_triangles_khr: bool = false, skip_aab_bs_khr: bool = false, force_opacity_micromap2state_ext: bool = false, - _reserved_bit_11: bool = false, - _reserved_bit_12: bool = false, - _reserved_bit_13: bool = false, - _reserved_bit_14: bool = false, - _reserved_bit_15: bool = false, - _reserved_bit_16: bool = false, - _reserved_bit_17: bool = false, - _reserved_bit_18: bool = false, - _reserved_bit_19: bool = false, - _reserved_bit_20: bool = false, - _reserved_bit_21: bool = false, - _reserved_bit_22: bool = false, - _reserved_bit_23: bool = false, - _reserved_bit_24: bool = false, - _reserved_bit_25: bool = false, - _reserved_bit_26: bool = false, - _reserved_bit_27: bool = false, - _reserved_bit_28: bool = false, - _reserved_bit_29: bool = false, - _reserved_bit_30: bool = false, - _reserved_bit_31: bool = false, + _reserved_bits_11_to_31: u21 = 0, }; -pub const FragmentShadingRate = packed struct { +pub const FragmentShadingRate = packed struct(Word) { vertical2pixels: bool = false, vertical4pixels: bool = false, horizontal2pixels: bool = false, horizontal4pixels: bool = false, - _reserved_bit_4: bool = false, - _reserved_bit_5: bool = false, - _reserved_bit_6: bool = false, - _reserved_bit_7: bool = false, - _reserved_bit_8: bool = false, - _reserved_bit_9: bool = false, - _reserved_bit_10: bool = false, - _reserved_bit_11: bool = false, - _reserved_bit_12: bool = false, - _reserved_bit_13: bool = false, - _reserved_bit_14: bool = false, - _reserved_bit_15: bool = false, - _reserved_bit_16: bool = false, - _reserved_bit_17: bool = false, - _reserved_bit_18: bool = false, - _reserved_bit_19: bool = false, - _reserved_bit_20: bool = false, - _reserved_bit_21: bool = false, - _reserved_bit_22: bool = false, - _reserved_bit_23: bool = false, - _reserved_bit_24: bool = false, - _reserved_bit_25: bool = false, - _reserved_bit_26: bool = false, - _reserved_bit_27: bool = false, - _reserved_bit_28: bool = false, - _reserved_bit_29: bool = false, - _reserved_bit_30: bool = false, - _reserved_bit_31: bool = false, + _reserved_bits_4_to_31: u28 = 0, }; -pub const RawAccessChainOperands = packed struct { - robustness_per_component_nv: bool = false, - robustness_per_element_nv: bool = false, - _reserved_bit_2: bool = false, - _reserved_bit_3: bool = false, - _reserved_bit_4: bool = false, - _reserved_bit_5: bool = false, - _reserved_bit_6: bool = false, - _reserved_bit_7: bool = false, - _reserved_bit_8: bool = false, - _reserved_bit_9: bool = false, - _reserved_bit_10: bool = false, - _reserved_bit_11: bool = false, - _reserved_bit_12: bool = false, - _reserved_bit_13: bool = false, - _reserved_bit_14: bool = false, - _reserved_bit_15: bool = false, - _reserved_bit_16: bool = false, - _reserved_bit_17: bool = false, - _reserved_bit_18: bool = false, - _reserved_bit_19: bool = false, - _reserved_bit_20: bool = false, - _reserved_bit_21: bool = false, - _reserved_bit_22: bool = false, - _reserved_bit_23: bool = false, - _reserved_bit_24: bool = false, - _reserved_bit_25: bool = false, - _reserved_bit_26: bool = false, - _reserved_bit_27: bool = false, - _reserved_bit_28: bool = false, - _reserved_bit_29: bool = false, - _reserved_bit_30: bool = false, - _reserved_bit_31: bool = false, +pub const RawAccessChainOperands = packed struct(Word) { + _reserved_bits_0_to_31: u32 = 0, }; pub const SourceLanguage = enum(u32) { unknown = 0, @@ -4286,8 +3438,6 @@ pub const ExecutionModel = enum(u32) { fragment = 4, gl_compute = 5, kernel = 6, - task_nv = 5267, - mesh_nv = 5268, ray_generation_khr = 5313, intersection_khr = 5314, any_hit_khr = 5315, @@ -4358,16 +3508,7 @@ pub const ExecutionMode = enum(u32) { signed_zero_inf_nan_preserve = 4461, rounding_mode_rte = 4462, rounding_mode_rtz = 4463, - non_coherent_tile_attachment_read_qcom = 4489, - tile_shading_rate_qcom = 4490, - early_and_late_fragment_tests_amd = 5017, stencil_ref_replacing_ext = 5027, - coalescing_amdx = 5069, - is_api_entry_amdx = 5070, - max_node_recursion_amdx = 5071, - static_num_workgroups_amdx = 5072, - shader_index_amdx = 5073, - max_num_workgroups_amdx = 5077, stencil_ref_unchanged_front_amd = 5079, stencil_ref_greater_front_amd = 5080, stencil_ref_less_front_amd = 5081, @@ -4376,7 +3517,6 @@ pub const ExecutionMode = enum(u32) { stencil_ref_less_back_amd = 5084, quad_derivatives_khr = 5088, require_full_quads_khr = 5089, - shares_input_with_amdx = 5102, arithmetic_poison_khr = 5157, output_lines_ext = 5269, output_primitives_ext = 5270, @@ -4390,24 +3530,8 @@ pub const ExecutionMode = enum(u32) { shading_rate_interlock_ordered_ext = 5370, shading_rate_interlock_unordered_ext = 5371, shader64bit_indexing_ext = 5427, - shared_local_memory_size_intel = 5618, - rounding_mode_rtpintel = 5620, - rounding_mode_rtnintel = 5621, - floating_point_mode_altintel = 5622, - floating_point_mode_ieeeintel = 5623, - max_workgroup_size_intel = 5893, - max_work_dim_intel = 5894, - no_global_offset_intel = 5895, - num_simd_workitems_intel = 5896, - scheduler_target_fmax_mhz_intel = 5903, maximally_reconverges_khr = 6023, fp_fast_math_default = 6028, - streaming_interface_intel = 6154, - register_map_interface_intel = 6160, - named_barrier_count_intel = 6417, - maximum_registers_intel = 6461, - maximum_registers_id_intel = 6462, - named_maximum_registers_intel = 6463, pub const Extended = union(ExecutionMode) { invocations: struct { literal_integer: LiteralInteger }, @@ -4458,16 +3582,7 @@ pub const ExecutionMode = enum(u32) { signed_zero_inf_nan_preserve: struct { target_width: LiteralInteger }, rounding_mode_rte: struct { target_width: LiteralInteger }, rounding_mode_rtz: struct { target_width: LiteralInteger }, - non_coherent_tile_attachment_read_qcom, - tile_shading_rate_qcom: struct { x_rate: LiteralInteger, y_rate: LiteralInteger, z_rate: LiteralInteger }, - early_and_late_fragment_tests_amd, stencil_ref_replacing_ext, - coalescing_amdx, - is_api_entry_amdx: struct { is_entry: Id }, - max_node_recursion_amdx: struct { number_of_recursions: Id }, - static_num_workgroups_amdx: struct { x_size: Id, y_size: Id, z_size: Id }, - shader_index_amdx: struct { shader_index: Id }, - max_num_workgroups_amdx: struct { x_size: Id, y_size: Id, z_size: Id }, stencil_ref_unchanged_front_amd, stencil_ref_greater_front_amd, stencil_ref_less_front_amd, @@ -4476,7 +3591,6 @@ pub const ExecutionMode = enum(u32) { stencil_ref_less_back_amd, quad_derivatives_khr, require_full_quads_khr, - shares_input_with_amdx: struct { node_name: Id, shader_index: Id }, arithmetic_poison_khr, output_lines_ext, output_primitives_ext: struct { primitive_count: LiteralInteger }, @@ -4490,24 +3604,8 @@ pub const ExecutionMode = enum(u32) { shading_rate_interlock_ordered_ext, shading_rate_interlock_unordered_ext, shader64bit_indexing_ext, - shared_local_memory_size_intel: struct { size: LiteralInteger }, - rounding_mode_rtpintel: struct { target_width: LiteralInteger }, - rounding_mode_rtnintel: struct { target_width: LiteralInteger }, - floating_point_mode_altintel: struct { target_width: LiteralInteger }, - floating_point_mode_ieeeintel: struct { target_width: LiteralInteger }, - max_workgroup_size_intel: struct { literal_integer_0: LiteralInteger, literal_integer_1: LiteralInteger, literal_integer_2: LiteralInteger }, - max_work_dim_intel: struct { literal_integer: LiteralInteger }, - no_global_offset_intel, - num_simd_workitems_intel: struct { literal_integer: LiteralInteger }, - scheduler_target_fmax_mhz_intel: struct { literal_integer: LiteralInteger }, maximally_reconverges_khr, fp_fast_math_default: struct { target_type: Id, id_ref_1: Id }, - streaming_interface_intel: struct { stall_free_return: LiteralInteger }, - register_map_interface_intel: struct { wait_for_done_write: LiteralInteger }, - named_barrier_count_intel: struct { barrier_count: LiteralInteger }, - maximum_registers_intel: struct { number_of_registers: LiteralInteger }, - maximum_registers_id_intel: struct { number_of_registers: Id }, - named_maximum_registers_intel: struct { named_maximum_number_of_registers: NamedMaximumNumberOfRegisters }, }; }; pub const StorageClass = enum(u32) { @@ -4525,8 +3623,6 @@ pub const StorageClass = enum(u32) { image = 11, storage_buffer = 12, tile_image_ext = 4172, - tile_attachment_qcom = 4491, - node_payload_amdx = 5068, callable_data_khr = 5328, incoming_callable_data_khr = 5329, ray_payload_khr = 5338, @@ -4534,12 +3630,8 @@ pub const StorageClass = enum(u32) { incoming_ray_payload_khr = 5342, shader_record_buffer_khr = 5343, physical_storage_buffer = 5349, - hit_object_attribute_nv = 5385, task_payload_workgroup_ext = 5402, hit_object_attribute_ext = 5411, - code_section_intel = 5605, - device_only_altera = 5936, - host_only_altera = 5937, }; pub const Dim = enum(u32) { @"1d" = 0, @@ -4662,30 +3754,10 @@ pub const FPRoundingMode = enum(u32) { rtp = 2, rtn = 3, }; -pub const FPDenormMode = enum(u32) { - preserve = 0, - flush_to_zero = 1, -}; -pub const QuantizationModes = enum(u32) { - trn = 0, - trn_zero = 1, - rnd = 2, - rnd_zero = 3, - rnd_inf = 4, - rnd_min_inf = 5, - rnd_conv = 6, - rnd_conv_odd = 7, -}; -pub const FPOperationMode = enum(u32) { - ieee = 0, - alt = 1, -}; -pub const OverflowModes = enum(u32) { - wrap = 0, - sat = 1, - sat_zero = 2, - sat_sym = 3, -}; +pub const FPDenormMode = enum(u32) {}; +pub const QuantizationModes = enum(u32) {}; +pub const FPOperationMode = enum(u32) {}; +pub const OverflowModes = enum(u32) {}; pub const LinkageType = enum(u32) { @"export" = 0, import = 1, @@ -4696,12 +3768,7 @@ pub const AccessQualifier = enum(u32) { write_only = 1, read_write = 2, }; -pub const HostAccessQualifier = enum(u32) { - none_intel = 0, - read_intel = 1, - write_intel = 2, - read_write_intel = 3, -}; +pub const HostAccessQualifier = enum(u32) {}; pub const FunctionParameterAttribute = enum(u32) { zext = 0, sext = 1, @@ -4764,106 +3831,17 @@ pub const Decoration = enum(u32) { saturated_to_largest_float8normal_conversion_ext = 4216, no_signed_wrap = 4469, no_unsigned_wrap = 4470, - weight_texture_qcom = 4487, - block_match_texture_qcom = 4488, - block_match_sampler_qcom = 4499, - explicit_interp_amd = 4999, - node_shares_payload_limits_with_amdx = 5019, - node_max_payloads_amdx = 5020, - track_finish_writing_amdx = 5078, - payload_node_name_amdx = 5091, - payload_node_base_index_amdx = 5098, - payload_node_sparse_array_amdx = 5099, - payload_node_array_size_amdx = 5100, - payload_dispatch_indirect_amdx = 5105, array_stride_id_ext = 5124, offset_id_ext = 5125, utf_encoded_khr = 5145, - override_coverage_nv = 5248, - passthrough_nv = 5250, - viewport_relative_nv = 5252, - secondary_viewport_relative_nv = 5256, per_primitive_ext = 5271, - per_view_nv = 5272, - per_task_nv = 5273, per_vertex_khr = 5285, non_uniform = 5300, restrict_pointer = 5355, aliased_pointer = 5356, - member_offset_nv = 5358, - hit_object_shader_record_buffer_nv = 5386, hit_object_shader_record_buffer_ext = 5389, - bank_nv = 5397, - bindless_sampler_nv = 5398, - bindless_image_nv = 5399, - bound_sampler_nv = 5400, - bound_image_nv = 5401, - simt_call_intel = 5599, - referenced_indirectly_intel = 5602, - clobber_intel = 5607, - side_effects_intel = 5608, - vector_compute_variable_intel = 5624, - func_param_io_kind_intel = 5625, - vector_compute_function_intel = 5626, - stack_call_intel = 5627, - global_variable_offset_intel = 5628, counter_buffer = 5634, user_semantic = 5635, - user_type_google = 5636, - function_rounding_mode_intel = 5822, - function_denorm_mode_intel = 5823, - register_altera = 5825, - memory_altera = 5826, - numbanks_altera = 5827, - bankwidth_altera = 5828, - max_private_copies_altera = 5829, - singlepump_altera = 5830, - doublepump_altera = 5831, - max_replicates_altera = 5832, - simple_dual_port_altera = 5833, - merge_altera = 5834, - bank_bits_altera = 5835, - force_pow2depth_altera = 5836, - stridesize_altera = 5883, - wordsize_altera = 5884, - true_dual_port_altera = 5885, - burst_coalesce_altera = 5899, - cache_size_altera = 5900, - dont_statically_coalesce_altera = 5901, - prefetch_altera = 5902, - stall_enable_altera = 5905, - fuse_loops_in_function_altera = 5907, - math_op_dsp_mode_altera = 5909, - alias_scope_intel = 5914, - no_alias_intel = 5915, - initiation_interval_altera = 5917, - max_concurrency_altera = 5918, - pipeline_enable_altera = 5919, - buffer_location_altera = 5921, - io_pipe_storage_altera = 5944, - function_floating_point_mode_intel = 6080, - single_element_vector_intel = 6085, - vector_compute_callable_function_intel = 6087, - media_block_iointel = 6140, - stall_free_altera = 6151, - fp_max_error_decoration_intel = 6170, - latency_control_label_altera = 6172, - latency_control_constraint_altera = 6173, - conduit_kernel_argument_altera = 6175, - register_map_kernel_argument_altera = 6176, - mm_host_interface_address_width_altera = 6177, - mm_host_interface_data_width_altera = 6178, - mm_host_interface_latency_altera = 6179, - mm_host_interface_read_write_mode_altera = 6180, - mm_host_interface_max_burst_altera = 6181, - mm_host_interface_wait_request_altera = 6182, - stable_kernel_argument_altera = 6183, - host_access_intel = 6188, - init_mode_altera = 6190, - implement_in_register_map_altera = 6191, - conditional_intel = 6247, - cache_control_load_intel = 6442, - cache_control_store_intel = 6443, pub const Extended = union(Decoration) { relaxed_precision, @@ -4916,106 +3894,17 @@ pub const Decoration = enum(u32) { saturated_to_largest_float8normal_conversion_ext, no_signed_wrap, no_unsigned_wrap, - weight_texture_qcom, - block_match_texture_qcom, - block_match_sampler_qcom, - explicit_interp_amd, - node_shares_payload_limits_with_amdx: struct { payload_type: Id }, - node_max_payloads_amdx: struct { max_number_of_payloads: Id }, - track_finish_writing_amdx, - payload_node_name_amdx: struct { node_name: Id }, - payload_node_base_index_amdx: struct { base_index: Id }, - payload_node_sparse_array_amdx, - payload_node_array_size_amdx: struct { array_size: Id }, - payload_dispatch_indirect_amdx, array_stride_id_ext: struct { array_stride: Id }, offset_id_ext: struct { byte_offset: Id }, utf_encoded_khr, - override_coverage_nv, - passthrough_nv, - viewport_relative_nv, - secondary_viewport_relative_nv: struct { offset: LiteralInteger }, per_primitive_ext, - per_view_nv, - per_task_nv, per_vertex_khr, non_uniform, restrict_pointer, aliased_pointer, - member_offset_nv: struct { member_offset: LiteralInteger }, - hit_object_shader_record_buffer_nv, hit_object_shader_record_buffer_ext, - bank_nv: struct { bank: LiteralInteger }, - bindless_sampler_nv, - bindless_image_nv, - bound_sampler_nv, - bound_image_nv, - simt_call_intel: struct { n: LiteralInteger }, - referenced_indirectly_intel, - clobber_intel: struct { register: LiteralString }, - side_effects_intel, - vector_compute_variable_intel, - func_param_io_kind_intel: struct { kind: LiteralInteger }, - vector_compute_function_intel, - stack_call_intel, - global_variable_offset_intel: struct { offset: LiteralInteger }, counter_buffer: struct { counter_buffer: Id }, user_semantic: struct { semantic: LiteralString }, - user_type_google: struct { user_type: LiteralString }, - function_rounding_mode_intel: struct { target_width: LiteralInteger, fp_rounding_mode: FPRoundingMode }, - function_denorm_mode_intel: struct { target_width: LiteralInteger, fp_denorm_mode: FPDenormMode }, - register_altera, - memory_altera: struct { memory_type: LiteralString }, - numbanks_altera: struct { banks: LiteralInteger }, - bankwidth_altera: struct { bank_width: LiteralInteger }, - max_private_copies_altera: struct { maximum_copies: LiteralInteger }, - singlepump_altera, - doublepump_altera, - max_replicates_altera: struct { maximum_replicates: LiteralInteger }, - simple_dual_port_altera, - merge_altera: struct { merge_key: LiteralString, merge_type: LiteralString }, - bank_bits_altera: struct { bank_bits: []const LiteralInteger = &.{} }, - force_pow2depth_altera: struct { force_key: LiteralInteger }, - stridesize_altera: struct { stride_size: LiteralInteger }, - wordsize_altera: struct { word_size: LiteralInteger }, - true_dual_port_altera, - burst_coalesce_altera, - cache_size_altera: struct { cache_size_in_bytes: LiteralInteger }, - dont_statically_coalesce_altera, - prefetch_altera: struct { prefetcher_size_in_bytes: LiteralInteger }, - stall_enable_altera, - fuse_loops_in_function_altera, - math_op_dsp_mode_altera: struct { mode: LiteralInteger, propagate: LiteralInteger }, - alias_scope_intel: struct { aliasing_scopes_list: Id }, - no_alias_intel: struct { aliasing_scopes_list: Id }, - initiation_interval_altera: struct { cycles: LiteralInteger }, - max_concurrency_altera: struct { invocations: LiteralInteger }, - pipeline_enable_altera: struct { enable: LiteralInteger }, - buffer_location_altera: struct { buffer_location_id: LiteralInteger }, - io_pipe_storage_altera: struct { io_pipe_id: LiteralInteger }, - function_floating_point_mode_intel: struct { target_width: LiteralInteger, fp_operation_mode: FPOperationMode }, - single_element_vector_intel, - vector_compute_callable_function_intel, - media_block_iointel, - stall_free_altera, - fp_max_error_decoration_intel: struct { max_error: LiteralFloat }, - latency_control_label_altera: struct { latency_label: LiteralInteger }, - latency_control_constraint_altera: struct { relative_to: LiteralInteger, control_type: LiteralInteger, relative_cycle: LiteralInteger }, - conduit_kernel_argument_altera, - register_map_kernel_argument_altera, - mm_host_interface_address_width_altera: struct { address_width: LiteralInteger }, - mm_host_interface_data_width_altera: struct { data_width: LiteralInteger }, - mm_host_interface_latency_altera: struct { latency: LiteralInteger }, - mm_host_interface_read_write_mode_altera: struct { read_write_mode: AccessQualifier }, - mm_host_interface_max_burst_altera: struct { max_burst_count: LiteralInteger }, - mm_host_interface_wait_request_altera: struct { waitrequest: LiteralInteger }, - stable_kernel_argument_altera, - host_access_intel: struct { access: HostAccessQualifier, name: LiteralString }, - init_mode_altera: struct { trigger: InitializationModeQualifier }, - implement_in_register_map_altera: struct { value: LiteralInteger }, - conditional_intel: struct { condition: Id }, - cache_control_load_intel: struct { cache_level: LiteralInteger, cache_control: LoadCacheControl }, - cache_control_store_intel: struct { cache_level: LiteralInteger, cache_control: StoreCacheControl }, }; }; pub const BuiltIn = enum(u32) { @@ -5077,35 +3966,10 @@ pub const BuiltIn = enum(u32) { device_index = 4438, view_index = 4440, shading_rate_khr = 4444, - tile_offset_qcom = 4492, - tile_dimension_qcom = 4493, - tile_apron_size_qcom = 4494, - bary_coord_no_persp_amd = 4992, - bary_coord_no_persp_centroid_amd = 4993, - bary_coord_no_persp_sample_amd = 4994, - bary_coord_smooth_amd = 4995, - bary_coord_smooth_centroid_amd = 4996, - bary_coord_smooth_sample_amd = 4997, - bary_coord_pull_model_amd = 4998, frag_stencil_ref_ext = 5014, - remaining_recursion_levels_amdx = 5021, - shader_index_amdx = 5073, sampler_heap_ext = 5122, resource_heap_ext = 5123, - viewport_mask_nv = 5253, - secondary_position_nv = 5257, - secondary_viewport_mask_nv = 5258, - position_per_view_nv = 5261, - viewport_mask_per_view_nv = 5262, fully_covered_ext = 5264, - task_count_nv = 5274, - primitive_count_nv = 5275, - primitive_indices_nv = 5276, - clip_distance_per_view_nv = 5277, - cull_distance_per_view_nv = 5278, - layer_per_view_nv = 5279, - mesh_view_count_nv = 5280, - mesh_view_indices_nv = 5281, bary_coord_khr = 5286, bary_coord_no_persp_khr = 5287, frag_size_ext = 5292, @@ -5125,27 +3989,10 @@ pub const BuiltIn = enum(u32) { instance_custom_index_khr = 5327, object_to_world_khr = 5330, world_to_object_khr = 5331, - hit_tnv = 5332, hit_kind_khr = 5333, - current_ray_time_nv = 5334, hit_triangle_vertex_positions_khr = 5335, - hit_micro_triangle_vertex_positions_nv = 5337, - hit_micro_triangle_vertex_barycentrics_nv = 5344, incoming_ray_flags_khr = 5351, ray_geometry_index_khr = 5352, - hit_is_sphere_nv = 5359, - hit_is_lssnv = 5360, - hit_sphere_position_nv = 5361, - warps_per_smnv = 5374, - sm_count_nv = 5375, - warp_idnv = 5376, - smidnv = 5377, - hit_lss_positions_nv = 5396, - hit_kind_front_facing_micro_triangle_nv = 5405, - hit_kind_back_facing_micro_triangle_nv = 5406, - hit_sphere_radius_nv = 5420, - hit_lss_radii_nv = 5421, - cluster_idnv = 5436, cull_mask_khr = 6021, }; pub const Scope = enum(u32) { @@ -5342,608 +4189,173 @@ pub const Capability = enum(u32) { pub fn dependencies(self: Capability) []const Extension { return switch (self) { - .matrix => &.{ - .v1_0, - }, - .shader => &.{ - .v1_0, - }, - .geometry => &.{ - .v1_0, - }, - .tessellation => &.{ - .v1_0, - }, - .addresses => &.{ - .v1_0, - }, - .linkage => &.{ - .v1_0, - }, - .kernel => &.{ - .v1_0, - }, - .vector16 => &.{ - .v1_0, - }, - .float16buffer => &.{ - .v1_0, - }, - .float16 => &.{ - .v1_0, - }, - .float64 => &.{ - .v1_0, - }, - .int64 => &.{ - .v1_0, - }, - .int64atomics => &.{ - .v1_0, - }, - .image_basic => &.{ - .v1_0, - }, - .image_read_write => &.{ - .v1_0, - }, - .image_mipmap => &.{ - .v1_0, - }, - .pipes => &.{ - .v1_0, - }, - .groups => &.{ - .v1_0, - }, - .device_enqueue => &.{ - .v1_0, - }, - .literal_sampler => &.{ - .v1_0, - }, - .atomic_storage => &.{ - .v1_0, - }, - .int16 => &.{ - .v1_0, - }, - .tessellation_point_size => &.{ - .v1_0, - }, - .geometry_point_size => &.{ - .v1_0, - }, - .image_gather_extended => &.{ - .v1_0, - }, - .storage_image_multisample => &.{ - .v1_0, - }, - .uniform_buffer_array_dynamic_indexing => &.{ - .v1_0, - }, - .sampled_image_array_dynamic_indexing => &.{ - .v1_0, - }, - .storage_buffer_array_dynamic_indexing => &.{ - .v1_0, - }, - .storage_image_array_dynamic_indexing => &.{ - .v1_0, - }, - .clip_distance => &.{ - .v1_0, - }, - .cull_distance => &.{ - .v1_0, - }, - .image_cube_array => &.{ - .v1_0, - }, - .sample_rate_shading => &.{ - .v1_0, - }, - .image_rect => &.{ - .v1_0, - }, - .sampled_rect => &.{ - .v1_0, - }, - .generic_pointer => &.{ - .v1_0, - }, - .int8 => &.{ - .v1_0, - }, - .input_attachment => &.{ - .v1_0, - }, - .sparse_residency => &.{ - .v1_0, - }, - .min_lod => &.{ - .v1_0, - }, - .sampled_cube_array => &.{ - .v1_0, - }, - .sampled_buffer => &.{ - .v1_0, - }, - .image_buffer => &.{ - .v1_0, - }, - .image_ms_array => &.{ - .v1_0, - }, - .storage_image_extended_formats => &.{ - .v1_0, - }, - .image_query => &.{ - .v1_0, - }, - .derivative_control => &.{ - .v1_0, - }, - .interpolation_function => &.{ - .v1_0, - }, - .transform_feedback => &.{ - .v1_0, - }, - .geometry_streams => &.{ - .v1_0, - }, - .storage_image_read_without_format => &.{ - .v1_0, - }, - .storage_image_write_without_format => &.{ - .v1_0, - }, - .multi_viewport => &.{ - .v1_0, - }, - .subgroup_dispatch => &.{ - .v1_1, - }, - .named_barrier => &.{ - .v1_1, - }, - .pipe_storage => &.{ - .v1_1, - }, - .group_non_uniform => &.{ - .v1_3, - }, - .group_non_uniform_vote => &.{ - .v1_3, - }, - .group_non_uniform_arithmetic => &.{ - .v1_3, - }, - .group_non_uniform_ballot => &.{ - .v1_3, - }, - .group_non_uniform_shuffle => &.{ - .v1_3, - }, - .group_non_uniform_shuffle_relative => &.{ - .v1_3, - }, - .group_non_uniform_clustered => &.{ - .v1_3, - }, - .group_non_uniform_quad => &.{ - .v1_3, - }, - .shader_layer => &.{ - .v1_5, - }, - .shader_viewport_index => &.{ - .v1_5, - }, - .uniform_decoration => &.{ - .v1_6, - }, - .tile_image_color_read_access_ext => &.{ - .v1_0, - .SPV_EXT_shader_tile_image, - }, - .tile_image_depth_read_access_ext => &.{ - .v1_0, - .SPV_EXT_shader_tile_image, - }, - .tile_image_stencil_read_access_ext => &.{ - .v1_0, - .SPV_EXT_shader_tile_image, - }, - .float8ext => &.{ - .v1_0, - .SPV_EXT_float8, - }, - .float8cooperative_matrix_ext => &.{ - .v1_0, - .SPV_EXT_float8, - }, - .fragment_shading_rate_khr => &.{ - .v1_0, - .SPV_KHR_fragment_shading_rate, - }, - .subgroup_ballot_khr => &.{ - .v1_0, - .SPV_KHR_shader_ballot, - }, - .draw_parameters => &.{ - .v1_3, - .SPV_KHR_shader_draw_parameters, - }, - .workgroup_memory_explicit_layout_khr => &.{ - .v1_0, - .SPV_KHR_workgroup_memory_explicit_layout, - }, - .workgroup_memory_explicit_layout8bit_access_khr => &.{ - .v1_0, - .SPV_KHR_workgroup_memory_explicit_layout, - }, - .workgroup_memory_explicit_layout16bit_access_khr => &.{ - .v1_0, - .SPV_KHR_workgroup_memory_explicit_layout, - }, - .subgroup_vote_khr => &.{ - .v1_0, - .SPV_KHR_subgroup_vote, - }, - .storage_buffer16bit_access => &.{ - .v1_3, - .SPV_KHR_16bit_storage, - }, - .uniform_and_storage_buffer16bit_access => &.{ - .v1_3, - .SPV_KHR_16bit_storage, - }, - .storage_push_constant16 => &.{ - .v1_3, - .SPV_KHR_16bit_storage, - }, - .storage_input_output16 => &.{ - .v1_3, - .SPV_KHR_16bit_storage, - }, - .device_group => &.{ - .v1_3, - .SPV_KHR_device_group, - }, - .multi_view => &.{ - .v1_3, - .SPV_KHR_multiview, - }, - .variable_pointers_storage_buffer => &.{ - .v1_3, - .SPV_KHR_variable_pointers, - }, - .variable_pointers => &.{ - .v1_3, - .SPV_KHR_variable_pointers, - }, - .atomic_storage_ops => &.{ - .v1_0, - .SPV_KHR_shader_atomic_counter_ops, - }, - .sample_mask_post_depth_coverage => &.{ - .v1_0, - .SPV_KHR_post_depth_coverage, - }, - .storage_buffer8bit_access => &.{ - .v1_5, - .SPV_KHR_8bit_storage, - }, - .uniform_and_storage_buffer8bit_access => &.{ - .v1_5, - .SPV_KHR_8bit_storage, - }, - .storage_push_constant8 => &.{ - .v1_5, - .SPV_KHR_8bit_storage, - }, - .denorm_preserve => &.{ - .v1_4, - .SPV_KHR_float_controls, - }, - .denorm_flush_to_zero => &.{ - .v1_4, - .SPV_KHR_float_controls, - }, - .signed_zero_inf_nan_preserve => &.{ - .v1_4, - .SPV_KHR_float_controls, - }, - .ray_query_provisional_khr => &.{ - .v1_0, - .SPV_KHR_ray_query, - }, - .ray_query_khr => &.{ - .v1_0, - .SPV_KHR_ray_query, - }, - .untyped_pointers_khr => &.{ - .v1_0, - .SPV_KHR_untyped_pointers, - }, - .ray_traversal_primitive_culling_khr => &.{ - .v1_0, - .SPV_KHR_ray_query, - .SPV_KHR_ray_tracing, - }, - .ray_tracing_khr => &.{ - .v1_0, - .SPV_KHR_ray_tracing, - }, - .stencil_export_ext => &.{ - .v1_0, - .SPV_EXT_shader_stencil_export, - }, - .int64image_ext => &.{ - .v1_0, - .SPV_EXT_shader_image_int64, - }, - .shader_clock_khr => &.{ - .v1_0, - .SPV_KHR_shader_clock, - }, - .quad_control_khr => &.{ - .v1_0, - .SPV_KHR_quad_control, - }, - .b_float16type_khr => &.{ - .v1_0, - .SPV_KHR_bfloat16, - }, - .b_float16dot_product_khr => &.{ - .v1_0, - .SPV_KHR_bfloat16, - }, - .b_float16cooperative_matrix_khr => &.{ - .v1_0, - .SPV_KHR_bfloat16, - }, - .abort_khr => &.{ - .v1_0, - .SPV_KHR_abort, - }, - .descriptor_heap_ext => &.{ - .v1_0, - .SPV_EXT_descriptor_heap, - }, - .constant_data_khr => &.{ - .v1_0, - .SPV_KHR_constant_data, - }, - .poison_freeze_khr => &.{ - .v1_0, - .SPV_KHR_poison_freeze, - }, - .shader_viewport_index_layer_ext => &.{ - .v1_0, - .SPV_EXT_shader_viewport_index_layer, - }, - .fragment_fully_covered_ext => &.{ - .v1_0, - .SPV_EXT_fragment_fully_covered, - }, - .mesh_shading_ext => &.{ - .v1_0, - .SPV_EXT_mesh_shader, - }, - .fragment_barycentric_khr => &.{ - .v1_0, - .SPV_KHR_fragment_shader_barycentric, - }, - .compute_derivative_group_quads_khr => &.{ - .v1_0, - .SPV_KHR_compute_shader_derivatives, - }, - .fragment_density_ext => &.{ - .v1_0, - .SPV_EXT_fragment_invocation_density, - }, - .group_non_uniform_partitioned_ext => &.{ - .v1_0, - .SPV_EXT_shader_subgroup_partitioned, - }, - .shader_non_uniform => &.{ - .v1_5, - .SPV_EXT_descriptor_indexing, - }, - .runtime_descriptor_array => &.{ - .v1_5, - .SPV_EXT_descriptor_indexing, - }, - .input_attachment_array_dynamic_indexing => &.{ - .v1_5, - .SPV_EXT_descriptor_indexing, - }, - .uniform_texel_buffer_array_dynamic_indexing => &.{ - .v1_5, - .SPV_EXT_descriptor_indexing, - }, - .storage_texel_buffer_array_dynamic_indexing => &.{ - .v1_5, - .SPV_EXT_descriptor_indexing, - }, - .uniform_buffer_array_non_uniform_indexing => &.{ - .v1_5, - .SPV_EXT_descriptor_indexing, - }, - .sampled_image_array_non_uniform_indexing => &.{ - .v1_5, - .SPV_EXT_descriptor_indexing, - }, - .storage_buffer_array_non_uniform_indexing => &.{ - .v1_5, - .SPV_EXT_descriptor_indexing, - }, - .storage_image_array_non_uniform_indexing => &.{ - .v1_5, - .SPV_EXT_descriptor_indexing, - }, - .input_attachment_array_non_uniform_indexing => &.{ - .v1_5, - .SPV_EXT_descriptor_indexing, - }, - .uniform_texel_buffer_array_non_uniform_indexing => &.{ - .v1_5, - .SPV_EXT_descriptor_indexing, - }, - .storage_texel_buffer_array_non_uniform_indexing => &.{ - .v1_5, - .SPV_EXT_descriptor_indexing, - }, - .ray_tracing_position_fetch_khr => &.{ - .v1_0, - .SPV_KHR_ray_tracing_position_fetch, - }, - .vulkan_memory_model => &.{ - .v1_5, - .SPV_KHR_vulkan_memory_model, - }, - .vulkan_memory_model_device_scope => &.{ - .v1_5, - .SPV_KHR_vulkan_memory_model, - }, - .physical_storage_buffer_addresses => &.{ - .v1_5, - .SPV_EXT_physical_storage_buffer, - .SPV_KHR_physical_storage_buffer, - }, - .compute_derivative_group_linear_khr => &.{ - .v1_0, - .SPV_KHR_compute_shader_derivatives, - }, - .ray_tracing_provisional_khr => &.{ - .v1_0, - .SPV_KHR_ray_tracing, - }, - .fragment_shader_sample_interlock_ext => &.{ - .v1_0, - .SPV_EXT_fragment_shader_interlock, - }, - .fragment_shader_shading_rate_interlock_ext => &.{ - .v1_0, - .SPV_EXT_fragment_shader_interlock, - }, - .fragment_shader_pixel_interlock_ext => &.{ - .v1_0, - .SPV_EXT_fragment_shader_interlock, - }, - .demote_to_helper_invocation => &.{ - .v1_6, - .SPV_EXT_demote_to_helper_invocation, - }, - .ray_tracing_opacity_micromap_ext => &.{ - .v1_0, - .SPV_EXT_opacity_micromap, - }, - .shader_invocation_reorder_ext => &.{ - .v1_0, - .SPV_EXT_shader_invocation_reorder, - }, - .ray_query_position_fetch_khr => &.{ - .v1_0, - .SPV_KHR_ray_tracing_position_fetch, - }, - .long_vector_ext => &.{ - .v1_0, - .SPV_EXT_long_vector, - }, - .shader64bit_indexing_ext => &.{ - .v1_0, - .SPV_EXT_shader_64bit_indexing, - }, - .atomic_float32min_max_ext => &.{ - .v1_0, - .SPV_EXT_shader_atomic_float_min_max, - }, - .atomic_float64min_max_ext => &.{ - .v1_0, - .SPV_EXT_shader_atomic_float_min_max, - }, - .atomic_float16min_max_ext => &.{ - .v1_0, - .SPV_EXT_shader_atomic_float_min_max, - }, - .expect_assume_khr => &.{ - .v1_0, - .SPV_KHR_expect_assume, - }, - .dot_product_input_all => &.{ - .v1_6, - .SPV_KHR_integer_dot_product, - }, - .dot_product_input4x8bit => &.{ - .v1_6, - .SPV_KHR_integer_dot_product, - }, - .dot_product_input4x8bit_packed => &.{ - .v1_6, - .SPV_KHR_integer_dot_product, - }, - .dot_product => &.{ - .v1_6, - .SPV_KHR_integer_dot_product, - }, - .ray_cull_mask_khr => &.{ - .v1_0, - .SPV_KHR_ray_cull_mask, - }, - .cooperative_matrix_khr => &.{ - .v1_0, - .SPV_KHR_cooperative_matrix, - }, - .replicated_composites_ext => &.{ - .v1_0, - .SPV_EXT_replicated_composites, - }, - .bit_instructions => &.{ - .v1_0, - .SPV_KHR_bit_instructions, - }, - .group_non_uniform_rotate_khr => &.{ - .v1_0, - .SPV_KHR_subgroup_rotate, - }, - .float_controls2 => &.{ - .v1_0, - .SPV_KHR_float_controls2, - }, - .fmakhr => &.{ - .v1_0, - .SPV_KHR_fma, - }, - .atomic_float32add_ext => &.{ - .v1_0, - .SPV_EXT_shader_atomic_float_add, - }, - .atomic_float64add_ext => &.{ - .v1_0, - .SPV_EXT_shader_atomic_float_add, - }, - .opt_none_ext => &.{ - .v1_0, - .SPV_EXT_optnone, - }, - .atomic_float16add_ext => &.{ - .v1_0, - .SPV_EXT_shader_atomic_float16_add, - }, - .arithmetic_fence_ext => &.{ - .v1_0, - .SPV_EXT_arithmetic_fence, - }, - .group_uniform_arithmetic_khr => &.{ - .v1_0, - .SPV_KHR_uniform_group_instructions, - }, + .matrix => &.{.v1_0}, + .shader => &.{.v1_0}, + .geometry => &.{.v1_0}, + .tessellation => &.{.v1_0}, + .addresses => &.{.v1_0}, + .linkage => &.{.v1_0}, + .kernel => &.{.v1_0}, + .vector16 => &.{.v1_0}, + .float16buffer => &.{.v1_0}, + .float16 => &.{.v1_0}, + .float64 => &.{.v1_0}, + .int64 => &.{.v1_0}, + .int64atomics => &.{.v1_0}, + .image_basic => &.{.v1_0}, + .image_read_write => &.{.v1_0}, + .image_mipmap => &.{.v1_0}, + .pipes => &.{.v1_0}, + .groups => &.{.v1_0}, + .device_enqueue => &.{.v1_0}, + .literal_sampler => &.{.v1_0}, + .atomic_storage => &.{.v1_0}, + .int16 => &.{.v1_0}, + .tessellation_point_size => &.{.v1_0}, + .geometry_point_size => &.{.v1_0}, + .image_gather_extended => &.{.v1_0}, + .storage_image_multisample => &.{.v1_0}, + .uniform_buffer_array_dynamic_indexing => &.{.v1_0}, + .sampled_image_array_dynamic_indexing => &.{.v1_0}, + .storage_buffer_array_dynamic_indexing => &.{.v1_0}, + .storage_image_array_dynamic_indexing => &.{.v1_0}, + .clip_distance => &.{.v1_0}, + .cull_distance => &.{.v1_0}, + .image_cube_array => &.{.v1_0}, + .sample_rate_shading => &.{.v1_0}, + .image_rect => &.{.v1_0}, + .sampled_rect => &.{.v1_0}, + .generic_pointer => &.{.v1_0}, + .int8 => &.{.v1_0}, + .input_attachment => &.{.v1_0}, + .sparse_residency => &.{.v1_0}, + .min_lod => &.{.v1_0}, + .sampled_cube_array => &.{.v1_0}, + .sampled_buffer => &.{.v1_0}, + .image_buffer => &.{.v1_0}, + .image_ms_array => &.{.v1_0}, + .storage_image_extended_formats => &.{.v1_0}, + .image_query => &.{.v1_0}, + .derivative_control => &.{.v1_0}, + .interpolation_function => &.{.v1_0}, + .transform_feedback => &.{.v1_0}, + .geometry_streams => &.{.v1_0}, + .storage_image_read_without_format => &.{.v1_0}, + .storage_image_write_without_format => &.{.v1_0}, + .multi_viewport => &.{.v1_0}, + .subgroup_dispatch => &.{.v1_1}, + .named_barrier => &.{.v1_1}, + .pipe_storage => &.{.v1_1}, + .group_non_uniform => &.{.v1_3}, + .group_non_uniform_vote => &.{.v1_3}, + .group_non_uniform_arithmetic => &.{.v1_3}, + .group_non_uniform_ballot => &.{.v1_3}, + .group_non_uniform_shuffle => &.{.v1_3}, + .group_non_uniform_shuffle_relative => &.{.v1_3}, + .group_non_uniform_clustered => &.{.v1_3}, + .group_non_uniform_quad => &.{.v1_3}, + .shader_layer => &.{.v1_5}, + .shader_viewport_index => &.{.v1_5}, + .uniform_decoration => &.{.v1_6}, + .tile_image_color_read_access_ext => &.{ .v1_0, .SPV_EXT_shader_tile_image }, + .tile_image_depth_read_access_ext => &.{ .v1_0, .SPV_EXT_shader_tile_image }, + .tile_image_stencil_read_access_ext => &.{ .v1_0, .SPV_EXT_shader_tile_image }, + .float8ext => &.{ .v1_0, .SPV_EXT_float8 }, + .float8cooperative_matrix_ext => &.{ .v1_0, .SPV_EXT_float8 }, + .fragment_shading_rate_khr => &.{ .v1_0, .SPV_KHR_fragment_shading_rate }, + .subgroup_ballot_khr => &.{ .v1_0, .SPV_KHR_shader_ballot }, + .draw_parameters => &.{ .v1_3, .SPV_KHR_shader_draw_parameters }, + .workgroup_memory_explicit_layout_khr => &.{ .v1_0, .SPV_KHR_workgroup_memory_explicit_layout }, + .workgroup_memory_explicit_layout8bit_access_khr => &.{ .v1_0, .SPV_KHR_workgroup_memory_explicit_layout }, + .workgroup_memory_explicit_layout16bit_access_khr => &.{ .v1_0, .SPV_KHR_workgroup_memory_explicit_layout }, + .subgroup_vote_khr => &.{ .v1_0, .SPV_KHR_subgroup_vote }, + .storage_buffer16bit_access => &.{ .v1_3, .SPV_KHR_16bit_storage }, + .uniform_and_storage_buffer16bit_access => &.{ .v1_3, .SPV_KHR_16bit_storage }, + .storage_push_constant16 => &.{ .v1_3, .SPV_KHR_16bit_storage }, + .storage_input_output16 => &.{ .v1_3, .SPV_KHR_16bit_storage }, + .device_group => &.{ .v1_3, .SPV_KHR_device_group }, + .multi_view => &.{ .v1_3, .SPV_KHR_multiview }, + .variable_pointers_storage_buffer => &.{ .v1_3, .SPV_KHR_variable_pointers }, + .variable_pointers => &.{ .v1_3, .SPV_KHR_variable_pointers }, + .atomic_storage_ops => &.{ .v1_0, .SPV_KHR_shader_atomic_counter_ops }, + .sample_mask_post_depth_coverage => &.{ .v1_0, .SPV_KHR_post_depth_coverage }, + .storage_buffer8bit_access => &.{ .v1_5, .SPV_KHR_8bit_storage }, + .uniform_and_storage_buffer8bit_access => &.{ .v1_5, .SPV_KHR_8bit_storage }, + .storage_push_constant8 => &.{ .v1_5, .SPV_KHR_8bit_storage }, + .denorm_preserve => &.{ .v1_4, .SPV_KHR_float_controls }, + .denorm_flush_to_zero => &.{ .v1_4, .SPV_KHR_float_controls }, + .signed_zero_inf_nan_preserve => &.{ .v1_4, .SPV_KHR_float_controls }, + .ray_query_provisional_khr => &.{ .v1_0, .SPV_KHR_ray_query }, + .ray_query_khr => &.{ .v1_0, .SPV_KHR_ray_query }, + .untyped_pointers_khr => &.{ .v1_0, .SPV_KHR_untyped_pointers }, + .ray_traversal_primitive_culling_khr => &.{ .v1_0, .SPV_KHR_ray_query, .SPV_KHR_ray_tracing }, + .ray_tracing_khr => &.{ .v1_0, .SPV_KHR_ray_tracing }, + .stencil_export_ext => &.{ .v1_0, .SPV_EXT_shader_stencil_export }, + .int64image_ext => &.{ .v1_0, .SPV_EXT_shader_image_int64 }, + .shader_clock_khr => &.{ .v1_0, .SPV_KHR_shader_clock }, + .quad_control_khr => &.{ .v1_0, .SPV_KHR_quad_control }, + .b_float16type_khr => &.{ .v1_0, .SPV_KHR_bfloat16 }, + .b_float16dot_product_khr => &.{ .v1_0, .SPV_KHR_bfloat16 }, + .b_float16cooperative_matrix_khr => &.{ .v1_0, .SPV_KHR_bfloat16 }, + .abort_khr => &.{ .v1_0, .SPV_KHR_abort }, + .descriptor_heap_ext => &.{ .v1_0, .SPV_EXT_descriptor_heap }, + .constant_data_khr => &.{ .v1_0, .SPV_KHR_constant_data }, + .poison_freeze_khr => &.{ .v1_0, .SPV_KHR_poison_freeze }, + .shader_viewport_index_layer_ext => &.{ .v1_0, .SPV_EXT_shader_viewport_index_layer }, + .fragment_fully_covered_ext => &.{ .v1_0, .SPV_EXT_fragment_fully_covered }, + .mesh_shading_ext => &.{ .v1_0, .SPV_EXT_mesh_shader }, + .fragment_barycentric_khr => &.{ .v1_0, .SPV_KHR_fragment_shader_barycentric }, + .compute_derivative_group_quads_khr => &.{ .v1_0, .SPV_KHR_compute_shader_derivatives }, + .fragment_density_ext => &.{ .v1_0, .SPV_EXT_fragment_invocation_density }, + .group_non_uniform_partitioned_ext => &.{ .v1_0, .SPV_EXT_shader_subgroup_partitioned }, + .shader_non_uniform => &.{ .v1_5, .SPV_EXT_descriptor_indexing }, + .runtime_descriptor_array => &.{ .v1_5, .SPV_EXT_descriptor_indexing }, + .input_attachment_array_dynamic_indexing => &.{ .v1_5, .SPV_EXT_descriptor_indexing }, + .uniform_texel_buffer_array_dynamic_indexing => &.{ .v1_5, .SPV_EXT_descriptor_indexing }, + .storage_texel_buffer_array_dynamic_indexing => &.{ .v1_5, .SPV_EXT_descriptor_indexing }, + .uniform_buffer_array_non_uniform_indexing => &.{ .v1_5, .SPV_EXT_descriptor_indexing }, + .sampled_image_array_non_uniform_indexing => &.{ .v1_5, .SPV_EXT_descriptor_indexing }, + .storage_buffer_array_non_uniform_indexing => &.{ .v1_5, .SPV_EXT_descriptor_indexing }, + .storage_image_array_non_uniform_indexing => &.{ .v1_5, .SPV_EXT_descriptor_indexing }, + .input_attachment_array_non_uniform_indexing => &.{ .v1_5, .SPV_EXT_descriptor_indexing }, + .uniform_texel_buffer_array_non_uniform_indexing => &.{ .v1_5, .SPV_EXT_descriptor_indexing }, + .storage_texel_buffer_array_non_uniform_indexing => &.{ .v1_5, .SPV_EXT_descriptor_indexing }, + .ray_tracing_position_fetch_khr => &.{ .v1_0, .SPV_KHR_ray_tracing_position_fetch }, + .vulkan_memory_model => &.{ .v1_5, .SPV_KHR_vulkan_memory_model }, + .vulkan_memory_model_device_scope => &.{ .v1_5, .SPV_KHR_vulkan_memory_model }, + .physical_storage_buffer_addresses => &.{ .v1_5, .SPV_EXT_physical_storage_buffer, .SPV_KHR_physical_storage_buffer }, + .compute_derivative_group_linear_khr => &.{ .v1_0, .SPV_KHR_compute_shader_derivatives }, + .ray_tracing_provisional_khr => &.{ .v1_0, .SPV_KHR_ray_tracing }, + .fragment_shader_sample_interlock_ext => &.{ .v1_0, .SPV_EXT_fragment_shader_interlock }, + .fragment_shader_shading_rate_interlock_ext => &.{ .v1_0, .SPV_EXT_fragment_shader_interlock }, + .fragment_shader_pixel_interlock_ext => &.{ .v1_0, .SPV_EXT_fragment_shader_interlock }, + .demote_to_helper_invocation => &.{ .v1_6, .SPV_EXT_demote_to_helper_invocation }, + .ray_tracing_opacity_micromap_ext => &.{ .v1_0, .SPV_EXT_opacity_micromap }, + .shader_invocation_reorder_ext => &.{ .v1_0, .SPV_EXT_shader_invocation_reorder }, + .ray_query_position_fetch_khr => &.{ .v1_0, .SPV_KHR_ray_tracing_position_fetch }, + .long_vector_ext => &.{ .v1_0, .SPV_EXT_long_vector }, + .shader64bit_indexing_ext => &.{ .v1_0, .SPV_EXT_shader_64bit_indexing }, + .atomic_float32min_max_ext => &.{ .v1_0, .SPV_EXT_shader_atomic_float_min_max }, + .atomic_float64min_max_ext => &.{ .v1_0, .SPV_EXT_shader_atomic_float_min_max }, + .atomic_float16min_max_ext => &.{ .v1_0, .SPV_EXT_shader_atomic_float_min_max }, + .expect_assume_khr => &.{ .v1_0, .SPV_KHR_expect_assume }, + .dot_product_input_all => &.{ .v1_6, .SPV_KHR_integer_dot_product }, + .dot_product_input4x8bit => &.{ .v1_6, .SPV_KHR_integer_dot_product }, + .dot_product_input4x8bit_packed => &.{ .v1_6, .SPV_KHR_integer_dot_product }, + .dot_product => &.{ .v1_6, .SPV_KHR_integer_dot_product }, + .ray_cull_mask_khr => &.{ .v1_0, .SPV_KHR_ray_cull_mask }, + .cooperative_matrix_khr => &.{ .v1_0, .SPV_KHR_cooperative_matrix }, + .replicated_composites_ext => &.{ .v1_0, .SPV_EXT_replicated_composites }, + .bit_instructions => &.{ .v1_0, .SPV_KHR_bit_instructions }, + .group_non_uniform_rotate_khr => &.{ .v1_0, .SPV_KHR_subgroup_rotate }, + .float_controls2 => &.{ .v1_0, .SPV_KHR_float_controls2 }, + .fmakhr => &.{ .v1_0, .SPV_KHR_fma }, + .atomic_float32add_ext => &.{ .v1_0, .SPV_EXT_shader_atomic_float_add }, + .atomic_float64add_ext => &.{ .v1_0, .SPV_EXT_shader_atomic_float_add }, + .opt_none_ext => &.{ .v1_0, .SPV_EXT_optnone }, + .atomic_float16add_ext => &.{ .v1_0, .SPV_EXT_shader_atomic_float16_add }, + .arithmetic_fence_ext => &.{ .v1_0, .SPV_EXT_arithmetic_fence }, + .group_uniform_arithmetic_khr => &.{ .v1_0, .SPV_KHR_uniform_group_instructions }, }; } }; @@ -5963,84 +4375,28 @@ pub const RayQueryCandidateIntersectionType = enum(u32) { pub const PackedVectorFormat = enum(u32) { packed_vector_format4x8bit = 0, }; -pub const CooperativeMatrixOperands = packed struct { +pub const CooperativeMatrixOperands = packed struct(Word) { matrix_a_signed_components_khr: bool = false, matrix_b_signed_components_khr: bool = false, matrix_c_signed_components_khr: bool = false, matrix_result_signed_components_khr: bool = false, saturating_accumulation_khr: bool = false, - _reserved_bit_5: bool = false, - _reserved_bit_6: bool = false, - _reserved_bit_7: bool = false, - _reserved_bit_8: bool = false, - _reserved_bit_9: bool = false, - _reserved_bit_10: bool = false, - _reserved_bit_11: bool = false, - _reserved_bit_12: bool = false, - _reserved_bit_13: bool = false, - _reserved_bit_14: bool = false, - _reserved_bit_15: bool = false, - _reserved_bit_16: bool = false, - _reserved_bit_17: bool = false, - _reserved_bit_18: bool = false, - _reserved_bit_19: bool = false, - _reserved_bit_20: bool = false, - _reserved_bit_21: bool = false, - _reserved_bit_22: bool = false, - _reserved_bit_23: bool = false, - _reserved_bit_24: bool = false, - _reserved_bit_25: bool = false, - _reserved_bit_26: bool = false, - _reserved_bit_27: bool = false, - _reserved_bit_28: bool = false, - _reserved_bit_29: bool = false, - _reserved_bit_30: bool = false, - _reserved_bit_31: bool = false, + _reserved_bits_5_to_31: u27 = 0, }; pub const CooperativeMatrixLayout = enum(u32) { row_major_khr = 0, column_major_khr = 1, - row_blocked_interleaved_arm = 4202, - column_blocked_interleaved_arm = 4203, }; pub const CooperativeMatrixUse = enum(u32) { matrix_akhr = 0, matrix_bkhr = 1, matrix_accumulator_khr = 2, }; -pub const CooperativeMatrixReduce = packed struct { +pub const CooperativeMatrixReduce = packed struct(Word) { row: bool = false, column: bool = false, @"2x2": bool = false, - _reserved_bit_3: bool = false, - _reserved_bit_4: bool = false, - _reserved_bit_5: bool = false, - _reserved_bit_6: bool = false, - _reserved_bit_7: bool = false, - _reserved_bit_8: bool = false, - _reserved_bit_9: bool = false, - _reserved_bit_10: bool = false, - _reserved_bit_11: bool = false, - _reserved_bit_12: bool = false, - _reserved_bit_13: bool = false, - _reserved_bit_14: bool = false, - _reserved_bit_15: bool = false, - _reserved_bit_16: bool = false, - _reserved_bit_17: bool = false, - _reserved_bit_18: bool = false, - _reserved_bit_19: bool = false, - _reserved_bit_20: bool = false, - _reserved_bit_21: bool = false, - _reserved_bit_22: bool = false, - _reserved_bit_23: bool = false, - _reserved_bit_24: bool = false, - _reserved_bit_25: bool = false, - _reserved_bit_26: bool = false, - _reserved_bit_27: bool = false, - _reserved_bit_28: bool = false, - _reserved_bit_29: bool = false, - _reserved_bit_30: bool = false, - _reserved_bit_31: bool = false, + _reserved_bits_3_to_31: u29 = 0, }; pub const TensorClampMode = enum(u32) { undefined = 0, @@ -6049,96 +4405,14 @@ pub const TensorClampMode = enum(u32) { repeat = 3, repeat_mirrored = 4, }; -pub const TensorAddressingOperands = packed struct { - tensor_view: bool = false, - decode_func: bool = false, - _reserved_bit_2: bool = false, - _reserved_bit_3: bool = false, - _reserved_bit_4: bool = false, - _reserved_bit_5: bool = false, - _reserved_bit_6: bool = false, - _reserved_bit_7: bool = false, - _reserved_bit_8: bool = false, - _reserved_bit_9: bool = false, - _reserved_bit_10: bool = false, - _reserved_bit_11: bool = false, - _reserved_bit_12: bool = false, - _reserved_bit_13: bool = false, - _reserved_bit_14: bool = false, - _reserved_bit_15: bool = false, - _reserved_bit_16: bool = false, - _reserved_bit_17: bool = false, - _reserved_bit_18: bool = false, - _reserved_bit_19: bool = false, - _reserved_bit_20: bool = false, - _reserved_bit_21: bool = false, - _reserved_bit_22: bool = false, - _reserved_bit_23: bool = false, - _reserved_bit_24: bool = false, - _reserved_bit_25: bool = false, - _reserved_bit_26: bool = false, - _reserved_bit_27: bool = false, - _reserved_bit_28: bool = false, - _reserved_bit_29: bool = false, - _reserved_bit_30: bool = false, - _reserved_bit_31: bool = false, - - pub const Extended = struct { - tensor_view: ?struct { id_ref: Id } = null, - decode_func: ?struct { id_ref: Id } = null, - _reserved_bit_2: bool = false, - _reserved_bit_3: bool = false, - _reserved_bit_4: bool = false, - _reserved_bit_5: bool = false, - _reserved_bit_6: bool = false, - _reserved_bit_7: bool = false, - _reserved_bit_8: bool = false, - _reserved_bit_9: bool = false, - _reserved_bit_10: bool = false, - _reserved_bit_11: bool = false, - _reserved_bit_12: bool = false, - _reserved_bit_13: bool = false, - _reserved_bit_14: bool = false, - _reserved_bit_15: bool = false, - _reserved_bit_16: bool = false, - _reserved_bit_17: bool = false, - _reserved_bit_18: bool = false, - _reserved_bit_19: bool = false, - _reserved_bit_20: bool = false, - _reserved_bit_21: bool = false, - _reserved_bit_22: bool = false, - _reserved_bit_23: bool = false, - _reserved_bit_24: bool = false, - _reserved_bit_25: bool = false, - _reserved_bit_26: bool = false, - _reserved_bit_27: bool = false, - _reserved_bit_28: bool = false, - _reserved_bit_29: bool = false, - _reserved_bit_30: bool = false, - _reserved_bit_31: bool = false, - }; -}; -pub const InitializationModeQualifier = enum(u32) { - init_on_device_reprogram_altera = 0, - init_on_device_reset_altera = 1, -}; -pub const LoadCacheControl = enum(u32) { - uncached_intel = 0, - cached_intel = 1, - streaming_intel = 2, - invalidate_after_read_intel = 3, - const_cached_intel = 4, -}; -pub const StoreCacheControl = enum(u32) { - uncached_intel = 0, - write_through_intel = 1, - write_back_intel = 2, - streaming_intel = 3, -}; -pub const NamedMaximumNumberOfRegisters = enum(u32) { - auto_intel = 0, -}; -pub const MatrixMultiplyAccumulateOperands = packed struct { +pub const TensorAddressingOperands = packed struct(Word) { + _reserved_bits_0_to_31: u32 = 0, +}; +pub const InitializationModeQualifier = enum(u32) {}; +pub const LoadCacheControl = enum(u32) {}; +pub const StoreCacheControl = enum(u32) {}; +pub const NamedMaximumNumberOfRegisters = enum(u32) {}; +pub const MatrixMultiplyAccumulateOperands = packed struct(Word) { matrix_a_signed_components_intel: bool = false, matrix_b_signed_components_intel: bool = false, matrix_cb_float16intel: bool = false, @@ -6153,24 +4427,7 @@ pub const MatrixMultiplyAccumulateOperands = packed struct { matrix_b_packed_float16intel: bool = false, matrix_a_packed_b_float16intel: bool = false, matrix_b_packed_b_float16intel: bool = false, - _reserved_bit_14: bool = false, - _reserved_bit_15: bool = false, - _reserved_bit_16: bool = false, - _reserved_bit_17: bool = false, - _reserved_bit_18: bool = false, - _reserved_bit_19: bool = false, - _reserved_bit_20: bool = false, - _reserved_bit_21: bool = false, - _reserved_bit_22: bool = false, - _reserved_bit_23: bool = false, - _reserved_bit_24: bool = false, - _reserved_bit_25: bool = false, - _reserved_bit_26: bool = false, - _reserved_bit_27: bool = false, - _reserved_bit_28: bool = false, - _reserved_bit_29: bool = false, - _reserved_bit_30: bool = false, - _reserved_bit_31: bool = false, + _reserved_bits_14_to_31: u18 = 0, }; pub const FPEncoding = enum(u32) { b_float16khr = 0, @@ -6200,10845 +4457,19 @@ pub const ComponentType = enum(u32) { float_e4m3nv = 1000491002, float_e5m2nv = 1000491003, }; -pub const TensorOperands = packed struct { - nontemporal_arm: bool = false, - out_of_bounds_value_arm: bool = false, - make_element_available_arm: bool = false, - make_element_visible_arm: bool = false, - non_private_element_arm: bool = false, - _reserved_bit_5: bool = false, - _reserved_bit_6: bool = false, - _reserved_bit_7: bool = false, - _reserved_bit_8: bool = false, - _reserved_bit_9: bool = false, - _reserved_bit_10: bool = false, - _reserved_bit_11: bool = false, - _reserved_bit_12: bool = false, - _reserved_bit_13: bool = false, - _reserved_bit_14: bool = false, - _reserved_bit_15: bool = false, - _reserved_bit_16: bool = false, - _reserved_bit_17: bool = false, - _reserved_bit_18: bool = false, - _reserved_bit_19: bool = false, - _reserved_bit_20: bool = false, - _reserved_bit_21: bool = false, - _reserved_bit_22: bool = false, - _reserved_bit_23: bool = false, - _reserved_bit_24: bool = false, - _reserved_bit_25: bool = false, - _reserved_bit_26: bool = false, - _reserved_bit_27: bool = false, - _reserved_bit_28: bool = false, - _reserved_bit_29: bool = false, - _reserved_bit_30: bool = false, - _reserved_bit_31: bool = false, - - pub const Extended = struct { - nontemporal_arm: bool = false, - out_of_bounds_value_arm: ?struct { id_ref: Id } = null, - make_element_available_arm: ?struct { id_ref: Id } = null, - make_element_visible_arm: ?struct { id_ref: Id } = null, - non_private_element_arm: bool = false, - _reserved_bit_5: bool = false, - _reserved_bit_6: bool = false, - _reserved_bit_7: bool = false, - _reserved_bit_8: bool = false, - _reserved_bit_9: bool = false, - _reserved_bit_10: bool = false, - _reserved_bit_11: bool = false, - _reserved_bit_12: bool = false, - _reserved_bit_13: bool = false, - _reserved_bit_14: bool = false, - _reserved_bit_15: bool = false, - _reserved_bit_16: bool = false, - _reserved_bit_17: bool = false, - _reserved_bit_18: bool = false, - _reserved_bit_19: bool = false, - _reserved_bit_20: bool = false, - _reserved_bit_21: bool = false, - _reserved_bit_22: bool = false, - _reserved_bit_23: bool = false, - _reserved_bit_24: bool = false, - _reserved_bit_25: bool = false, - _reserved_bit_26: bool = false, - _reserved_bit_27: bool = false, - _reserved_bit_28: bool = false, - _reserved_bit_29: bool = false, - _reserved_bit_30: bool = false, - _reserved_bit_31: bool = false, - }; +pub const TensorOperands = packed struct(Word) { + _reserved_bits_0_to_31: u32 = 0, }; pub const InstructionSet = enum { core, @"OpenCL.std", @"GLSL.std.450", - zig, - pub fn instructions(self: InstructionSet) []const Instruction { - return switch (self) { - .core => &.{ - .{ - .name = "OpNop", - .opcode = 0, - .operands = &.{}, - }, - .{ - .name = "OpUndef", - .opcode = 1, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - }, - }, - .{ - .name = "OpSourceContinued", - .opcode = 2, - .operands = &.{ - .{ .kind = .literal_string, .quantifier = .required }, - }, - }, - .{ - .name = "OpSource", - .opcode = 3, - .operands = &.{ - .{ .kind = .source_language, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .optional }, - .{ .kind = .literal_string, .quantifier = .optional }, - }, - }, - .{ - .name = "OpSourceExtension", - .opcode = 4, - .operands = &.{ - .{ .kind = .literal_string, .quantifier = .required }, - }, - }, - .{ - .name = "OpName", - .opcode = 5, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .literal_string, .quantifier = .required }, - }, - }, - .{ - .name = "OpMemberName", - .opcode = 6, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_string, .quantifier = .required }, - }, - }, - .{ - .name = "OpString", - .opcode = 7, - .operands = &.{ - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .literal_string, .quantifier = .required }, - }, - }, - .{ - .name = "OpLine", - .opcode = 8, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - }, - }, - .{ - .name = "OpExtension", - .opcode = 10, - .operands = &.{ - .{ .kind = .literal_string, .quantifier = .required }, - }, - }, - .{ - .name = "OpExtInstImport", - .opcode = 11, - .operands = &.{ - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .literal_string, .quantifier = .required }, - }, - }, - .{ - .name = "OpExtInst", - .opcode = 12, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .literal_ext_inst_integer, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .variadic }, - }, - }, - .{ - .name = "OpMemoryModel", - .opcode = 14, - .operands = &.{ - .{ .kind = .addressing_model, .quantifier = .required }, - .{ .kind = .memory_model, .quantifier = .required }, - }, - }, - .{ - .name = "OpEntryPoint", - .opcode = 15, - .operands = &.{ - .{ .kind = .execution_model, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .literal_string, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .variadic }, - }, - }, - .{ - .name = "OpExecutionMode", - .opcode = 16, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .execution_mode, .quantifier = .required }, - }, - }, - .{ - .name = "OpCapability", - .opcode = 17, - .operands = &.{ - .{ .kind = .capability, .quantifier = .required }, - }, - }, - .{ - .name = "OpTypeVoid", - .opcode = 19, - .operands = &.{ - .{ .kind = .id_result, .quantifier = .required }, - }, - }, - .{ - .name = "OpTypeBool", - .opcode = 20, - .operands = &.{ - .{ .kind = .id_result, .quantifier = .required }, - }, - }, - .{ - .name = "OpTypeInt", - .opcode = 21, - .operands = &.{ - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - }, - }, - .{ - .name = "OpTypeFloat", - .opcode = 22, - .operands = &.{ - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .fp_encoding, .quantifier = .optional }, - }, - }, - .{ - .name = "OpTypeVector", - .opcode = 23, - .operands = &.{ - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - }, - }, - .{ - .name = "OpTypeMatrix", - .opcode = 24, - .operands = &.{ - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - }, - }, - .{ - .name = "OpTypeImage", - .opcode = 25, - .operands = &.{ - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .dim, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .image_format, .quantifier = .required }, - .{ .kind = .access_qualifier, .quantifier = .optional }, - }, - }, - .{ - .name = "OpTypeSampler", - .opcode = 26, - .operands = &.{ - .{ .kind = .id_result, .quantifier = .required }, - }, - }, - .{ - .name = "OpTypeSampledImage", - .opcode = 27, - .operands = &.{ - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpTypeArray", - .opcode = 28, - .operands = &.{ - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpTypeRuntimeArray", - .opcode = 29, - .operands = &.{ - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpTypeStruct", - .opcode = 30, - .operands = &.{ - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .variadic }, - }, - }, - .{ - .name = "OpTypeOpaque", - .opcode = 31, - .operands = &.{ - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .literal_string, .quantifier = .required }, - }, - }, - .{ - .name = "OpTypePointer", - .opcode = 32, - .operands = &.{ - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .storage_class, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpTypeFunction", - .opcode = 33, - .operands = &.{ - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .variadic }, - }, - }, - .{ - .name = "OpTypeEvent", - .opcode = 34, - .operands = &.{ - .{ .kind = .id_result, .quantifier = .required }, - }, - }, - .{ - .name = "OpTypeDeviceEvent", - .opcode = 35, - .operands = &.{ - .{ .kind = .id_result, .quantifier = .required }, - }, - }, - .{ - .name = "OpTypeReserveId", - .opcode = 36, - .operands = &.{ - .{ .kind = .id_result, .quantifier = .required }, - }, - }, - .{ - .name = "OpTypeQueue", - .opcode = 37, - .operands = &.{ - .{ .kind = .id_result, .quantifier = .required }, - }, - }, - .{ - .name = "OpTypePipe", - .opcode = 38, - .operands = &.{ - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .access_qualifier, .quantifier = .required }, - }, - }, - .{ - .name = "OpTypeForwardPointer", - .opcode = 39, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .storage_class, .quantifier = .required }, - }, - }, - .{ - .name = "OpConstantTrue", - .opcode = 41, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - }, - }, - .{ - .name = "OpConstantFalse", - .opcode = 42, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - }, - }, - .{ - .name = "OpConstant", - .opcode = 43, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .literal_context_dependent_number, .quantifier = .required }, - }, - }, - .{ - .name = "OpConstantComposite", - .opcode = 44, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .variadic }, - }, - }, - .{ - .name = "OpConstantSampler", - .opcode = 45, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .sampler_addressing_mode, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .sampler_filter_mode, .quantifier = .required }, - }, - }, - .{ - .name = "OpConstantNull", - .opcode = 46, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - }, - }, - .{ - .name = "OpSpecConstantTrue", - .opcode = 48, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - }, - }, - .{ - .name = "OpSpecConstantFalse", - .opcode = 49, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - }, - }, - .{ - .name = "OpSpecConstant", - .opcode = 50, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .literal_context_dependent_number, .quantifier = .required }, - }, - }, - .{ - .name = "OpSpecConstantComposite", - .opcode = 51, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .variadic }, - }, - }, - .{ - .name = "OpSpecConstantOp", - .opcode = 52, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .literal_spec_constant_op_integer, .quantifier = .required }, - }, - }, - .{ - .name = "OpFunction", - .opcode = 54, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .function_control, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpFunctionParameter", - .opcode = 55, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - }, - }, - .{ - .name = "OpFunctionEnd", - .opcode = 56, - .operands = &.{}, - }, - .{ - .name = "OpFunctionCall", - .opcode = 57, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .variadic }, - }, - }, - .{ - .name = "OpVariable", - .opcode = 59, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .storage_class, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .optional }, - }, - }, - .{ - .name = "OpImageTexelPointer", - .opcode = 60, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpLoad", - .opcode = 61, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .memory_access, .quantifier = .optional }, - }, - }, - .{ - .name = "OpStore", - .opcode = 62, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .memory_access, .quantifier = .optional }, - }, - }, - .{ - .name = "OpCopyMemory", - .opcode = 63, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .memory_access, .quantifier = .optional }, - .{ .kind = .memory_access, .quantifier = .optional }, - }, - }, - .{ - .name = "OpCopyMemorySized", - .opcode = 64, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .memory_access, .quantifier = .optional }, - .{ .kind = .memory_access, .quantifier = .optional }, - }, - }, - .{ - .name = "OpAccessChain", - .opcode = 65, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .variadic }, - }, - }, - .{ - .name = "OpInBoundsAccessChain", - .opcode = 66, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .variadic }, - }, - }, - .{ - .name = "OpPtrAccessChain", - .opcode = 67, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .variadic }, - }, - }, - .{ - .name = "OpArrayLength", - .opcode = 68, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - }, - }, - .{ - .name = "OpGenericPtrMemSemantics", - .opcode = 69, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpInBoundsPtrAccessChain", - .opcode = 70, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .variadic }, - }, - }, - .{ - .name = "OpDecorate", - .opcode = 71, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .decoration, .quantifier = .required }, - }, - }, - .{ - .name = "OpMemberDecorate", - .opcode = 72, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .decoration, .quantifier = .required }, - }, - }, - .{ - .name = "OpDecorationGroup", - .opcode = 73, - .operands = &.{ - .{ .kind = .id_result, .quantifier = .required }, - }, - }, - .{ - .name = "OpGroupDecorate", - .opcode = 74, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .variadic }, - }, - }, - .{ - .name = "OpGroupMemberDecorate", - .opcode = 75, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .pair_id_ref_literal_integer, .quantifier = .variadic }, - }, - }, - .{ - .name = "OpVectorExtractDynamic", - .opcode = 77, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpVectorInsertDynamic", - .opcode = 78, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpVectorShuffle", - .opcode = 79, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .variadic }, - }, - }, - .{ - .name = "OpCompositeConstruct", - .opcode = 80, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .variadic }, - }, - }, - .{ - .name = "OpCompositeExtract", - .opcode = 81, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .variadic }, - }, - }, - .{ - .name = "OpCompositeInsert", - .opcode = 82, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .variadic }, - }, - }, - .{ - .name = "OpCopyObject", - .opcode = 83, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpTranspose", - .opcode = 84, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSampledImage", - .opcode = 86, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpImageSampleImplicitLod", - .opcode = 87, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .image_operands, .quantifier = .optional }, - }, - }, - .{ - .name = "OpImageSampleExplicitLod", - .opcode = 88, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .image_operands, .quantifier = .required }, - }, - }, - .{ - .name = "OpImageSampleDrefImplicitLod", - .opcode = 89, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .image_operands, .quantifier = .optional }, - }, - }, - .{ - .name = "OpImageSampleDrefExplicitLod", - .opcode = 90, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .image_operands, .quantifier = .required }, - }, - }, - .{ - .name = "OpImageSampleProjImplicitLod", - .opcode = 91, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .image_operands, .quantifier = .optional }, - }, - }, - .{ - .name = "OpImageSampleProjExplicitLod", - .opcode = 92, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .image_operands, .quantifier = .required }, - }, - }, - .{ - .name = "OpImageSampleProjDrefImplicitLod", - .opcode = 93, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .image_operands, .quantifier = .optional }, - }, - }, - .{ - .name = "OpImageSampleProjDrefExplicitLod", - .opcode = 94, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .image_operands, .quantifier = .required }, - }, - }, - .{ - .name = "OpImageFetch", - .opcode = 95, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .image_operands, .quantifier = .optional }, - }, - }, - .{ - .name = "OpImageGather", - .opcode = 96, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .image_operands, .quantifier = .optional }, - }, - }, - .{ - .name = "OpImageDrefGather", - .opcode = 97, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .image_operands, .quantifier = .optional }, - }, - }, - .{ - .name = "OpImageRead", - .opcode = 98, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .image_operands, .quantifier = .optional }, - }, - }, - .{ - .name = "OpImageWrite", - .opcode = 99, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .image_operands, .quantifier = .optional }, - }, - }, - .{ - .name = "OpImage", - .opcode = 100, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpImageQueryFormat", - .opcode = 101, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpImageQueryOrder", - .opcode = 102, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpImageQuerySizeLod", - .opcode = 103, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpImageQuerySize", - .opcode = 104, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpImageQueryLod", - .opcode = 105, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpImageQueryLevels", - .opcode = 106, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpImageQuerySamples", - .opcode = 107, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpConvertFToU", - .opcode = 109, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpConvertFToS", - .opcode = 110, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpConvertSToF", - .opcode = 111, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpConvertUToF", - .opcode = 112, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpUConvert", - .opcode = 113, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSConvert", - .opcode = 114, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpFConvert", - .opcode = 115, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpQuantizeToF16", - .opcode = 116, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpConvertPtrToU", - .opcode = 117, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSatConvertSToU", - .opcode = 118, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSatConvertUToS", - .opcode = 119, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpConvertUToPtr", - .opcode = 120, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpPtrCastToGeneric", - .opcode = 121, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpGenericCastToPtr", - .opcode = 122, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpGenericCastToPtrExplicit", - .opcode = 123, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .storage_class, .quantifier = .required }, - }, - }, - .{ - .name = "OpBitcast", - .opcode = 124, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSNegate", - .opcode = 126, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpFNegate", - .opcode = 127, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpIAdd", - .opcode = 128, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpFAdd", - .opcode = 129, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpISub", - .opcode = 130, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpFSub", - .opcode = 131, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpIMul", - .opcode = 132, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpFMul", - .opcode = 133, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpUDiv", - .opcode = 134, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSDiv", - .opcode = 135, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpFDiv", - .opcode = 136, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpUMod", - .opcode = 137, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSRem", - .opcode = 138, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSMod", - .opcode = 139, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpFRem", - .opcode = 140, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpFMod", - .opcode = 141, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpVectorTimesScalar", - .opcode = 142, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpMatrixTimesScalar", - .opcode = 143, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpVectorTimesMatrix", - .opcode = 144, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpMatrixTimesVector", - .opcode = 145, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpMatrixTimesMatrix", - .opcode = 146, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpOuterProduct", - .opcode = 147, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpDot", - .opcode = 148, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpIAddCarry", - .opcode = 149, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpISubBorrow", - .opcode = 150, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpUMulExtended", - .opcode = 151, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSMulExtended", - .opcode = 152, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpAny", - .opcode = 154, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpAll", - .opcode = 155, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpIsNan", - .opcode = 156, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpIsInf", - .opcode = 157, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpIsFinite", - .opcode = 158, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpIsNormal", - .opcode = 159, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSignBitSet", - .opcode = 160, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpLessOrGreater", - .opcode = 161, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpOrdered", - .opcode = 162, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpUnordered", - .opcode = 163, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpLogicalEqual", - .opcode = 164, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpLogicalNotEqual", - .opcode = 165, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpLogicalOr", - .opcode = 166, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpLogicalAnd", - .opcode = 167, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpLogicalNot", - .opcode = 168, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSelect", - .opcode = 169, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpIEqual", - .opcode = 170, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpINotEqual", - .opcode = 171, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpUGreaterThan", - .opcode = 172, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSGreaterThan", - .opcode = 173, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpUGreaterThanEqual", - .opcode = 174, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSGreaterThanEqual", - .opcode = 175, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpULessThan", - .opcode = 176, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSLessThan", - .opcode = 177, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpULessThanEqual", - .opcode = 178, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSLessThanEqual", - .opcode = 179, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpFOrdEqual", - .opcode = 180, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpFUnordEqual", - .opcode = 181, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpFOrdNotEqual", - .opcode = 182, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpFUnordNotEqual", - .opcode = 183, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpFOrdLessThan", - .opcode = 184, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpFUnordLessThan", - .opcode = 185, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpFOrdGreaterThan", - .opcode = 186, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpFUnordGreaterThan", - .opcode = 187, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpFOrdLessThanEqual", - .opcode = 188, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpFUnordLessThanEqual", - .opcode = 189, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpFOrdGreaterThanEqual", - .opcode = 190, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpFUnordGreaterThanEqual", - .opcode = 191, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpShiftRightLogical", - .opcode = 194, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpShiftRightArithmetic", - .opcode = 195, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpShiftLeftLogical", - .opcode = 196, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpBitwiseOr", - .opcode = 197, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpBitwiseXor", - .opcode = 198, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpBitwiseAnd", - .opcode = 199, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpNot", - .opcode = 200, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpBitFieldInsert", - .opcode = 201, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpBitFieldSExtract", - .opcode = 202, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpBitFieldUExtract", - .opcode = 203, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpBitReverse", - .opcode = 204, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpBitCount", - .opcode = 205, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpDPdx", - .opcode = 207, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpDPdy", - .opcode = 208, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpFwidth", - .opcode = 209, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpDPdxFine", - .opcode = 210, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpDPdyFine", - .opcode = 211, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpFwidthFine", - .opcode = 212, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpDPdxCoarse", - .opcode = 213, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpDPdyCoarse", - .opcode = 214, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpFwidthCoarse", - .opcode = 215, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpEmitVertex", - .opcode = 218, - .operands = &.{}, - }, - .{ - .name = "OpEndPrimitive", - .opcode = 219, - .operands = &.{}, - }, - .{ - .name = "OpEmitStreamVertex", - .opcode = 220, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpEndStreamPrimitive", - .opcode = 221, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpControlBarrier", - .opcode = 224, - .operands = &.{ - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .id_memory_semantics, .quantifier = .required }, - }, - }, - .{ - .name = "OpMemoryBarrier", - .opcode = 225, - .operands = &.{ - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .id_memory_semantics, .quantifier = .required }, - }, - }, - .{ - .name = "OpAtomicLoad", - .opcode = 227, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .id_memory_semantics, .quantifier = .required }, - }, - }, - .{ - .name = "OpAtomicStore", - .opcode = 228, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .id_memory_semantics, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpAtomicExchange", - .opcode = 229, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .id_memory_semantics, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpAtomicCompareExchange", - .opcode = 230, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .id_memory_semantics, .quantifier = .required }, - .{ .kind = .id_memory_semantics, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpAtomicCompareExchangeWeak", - .opcode = 231, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .id_memory_semantics, .quantifier = .required }, - .{ .kind = .id_memory_semantics, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpAtomicIIncrement", - .opcode = 232, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .id_memory_semantics, .quantifier = .required }, - }, - }, - .{ - .name = "OpAtomicIDecrement", - .opcode = 233, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .id_memory_semantics, .quantifier = .required }, - }, - }, - .{ - .name = "OpAtomicIAdd", - .opcode = 234, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .id_memory_semantics, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpAtomicISub", - .opcode = 235, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .id_memory_semantics, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpAtomicSMin", - .opcode = 236, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .id_memory_semantics, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpAtomicUMin", - .opcode = 237, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .id_memory_semantics, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpAtomicSMax", - .opcode = 238, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .id_memory_semantics, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpAtomicUMax", - .opcode = 239, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .id_memory_semantics, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpAtomicAnd", - .opcode = 240, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .id_memory_semantics, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpAtomicOr", - .opcode = 241, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .id_memory_semantics, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpAtomicXor", - .opcode = 242, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .id_memory_semantics, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpPhi", - .opcode = 245, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .pair_id_ref_id_ref, .quantifier = .variadic }, - }, - }, - .{ - .name = "OpLoopMerge", - .opcode = 246, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .loop_control, .quantifier = .required }, - }, - }, - .{ - .name = "OpSelectionMerge", - .opcode = 247, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .selection_control, .quantifier = .required }, - }, - }, - .{ - .name = "OpLabel", - .opcode = 248, - .operands = &.{ - .{ .kind = .id_result, .quantifier = .required }, - }, - }, - .{ - .name = "OpBranch", - .opcode = 249, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpBranchConditional", - .opcode = 250, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .variadic }, - }, - }, - .{ - .name = "OpSwitch", - .opcode = 251, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .pair_literal_integer_id_ref, .quantifier = .variadic }, - }, - }, - .{ - .name = "OpKill", - .opcode = 252, - .operands = &.{}, - }, - .{ - .name = "OpReturn", - .opcode = 253, - .operands = &.{}, - }, - .{ - .name = "OpReturnValue", - .opcode = 254, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpUnreachable", - .opcode = 255, - .operands = &.{}, - }, - .{ - .name = "OpLifetimeStart", - .opcode = 256, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - }, - }, - .{ - .name = "OpLifetimeStop", - .opcode = 257, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - }, - }, - .{ - .name = "OpGroupAsyncCopy", - .opcode = 259, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpGroupWaitEvents", - .opcode = 260, - .operands = &.{ - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpGroupAll", - .opcode = 261, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpGroupAny", - .opcode = 262, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpGroupBroadcast", - .opcode = 263, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpGroupIAdd", - .opcode = 264, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .group_operation, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpGroupFAdd", - .opcode = 265, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .group_operation, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpGroupFMin", - .opcode = 266, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .group_operation, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpGroupUMin", - .opcode = 267, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .group_operation, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpGroupSMin", - .opcode = 268, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .group_operation, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpGroupFMax", - .opcode = 269, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .group_operation, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpGroupUMax", - .opcode = 270, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .group_operation, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpGroupSMax", - .opcode = 271, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .group_operation, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpReadPipe", - .opcode = 274, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpWritePipe", - .opcode = 275, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpReservedReadPipe", - .opcode = 276, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpReservedWritePipe", - .opcode = 277, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpReserveReadPipePackets", - .opcode = 278, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpReserveWritePipePackets", - .opcode = 279, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpCommitReadPipe", - .opcode = 280, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpCommitWritePipe", - .opcode = 281, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpIsValidReserveId", - .opcode = 282, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpGetNumPipePackets", - .opcode = 283, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpGetMaxPipePackets", - .opcode = 284, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpGroupReserveReadPipePackets", - .opcode = 285, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpGroupReserveWritePipePackets", - .opcode = 286, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpGroupCommitReadPipe", - .opcode = 287, - .operands = &.{ - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpGroupCommitWritePipe", - .opcode = 288, - .operands = &.{ - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpEnqueueMarker", - .opcode = 291, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpEnqueueKernel", - .opcode = 292, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .variadic }, - }, - }, - .{ - .name = "OpGetKernelNDrangeSubGroupCount", - .opcode = 293, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpGetKernelNDrangeMaxSubGroupSize", - .opcode = 294, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpGetKernelWorkGroupSize", - .opcode = 295, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpGetKernelPreferredWorkGroupSizeMultiple", - .opcode = 296, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpRetainEvent", - .opcode = 297, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpReleaseEvent", - .opcode = 298, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpCreateUserEvent", - .opcode = 299, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - }, - }, - .{ - .name = "OpIsValidEvent", - .opcode = 300, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSetUserEventStatus", - .opcode = 301, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpCaptureEventProfilingInfo", - .opcode = 302, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpGetDefaultQueue", - .opcode = 303, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - }, - }, - .{ - .name = "OpBuildNDRange", - .opcode = 304, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpImageSparseSampleImplicitLod", - .opcode = 305, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .image_operands, .quantifier = .optional }, - }, - }, - .{ - .name = "OpImageSparseSampleExplicitLod", - .opcode = 306, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .image_operands, .quantifier = .required }, - }, - }, - .{ - .name = "OpImageSparseSampleDrefImplicitLod", - .opcode = 307, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .image_operands, .quantifier = .optional }, - }, - }, - .{ - .name = "OpImageSparseSampleDrefExplicitLod", - .opcode = 308, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .image_operands, .quantifier = .required }, - }, - }, - .{ - .name = "OpImageSparseSampleProjImplicitLod", - .opcode = 309, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .image_operands, .quantifier = .optional }, - }, - }, - .{ - .name = "OpImageSparseSampleProjExplicitLod", - .opcode = 310, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .image_operands, .quantifier = .required }, - }, - }, - .{ - .name = "OpImageSparseSampleProjDrefImplicitLod", - .opcode = 311, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .image_operands, .quantifier = .optional }, - }, - }, - .{ - .name = "OpImageSparseSampleProjDrefExplicitLod", - .opcode = 312, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .image_operands, .quantifier = .required }, - }, - }, - .{ - .name = "OpImageSparseFetch", - .opcode = 313, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .image_operands, .quantifier = .optional }, - }, - }, - .{ - .name = "OpImageSparseGather", - .opcode = 314, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .image_operands, .quantifier = .optional }, - }, - }, - .{ - .name = "OpImageSparseDrefGather", - .opcode = 315, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .image_operands, .quantifier = .optional }, - }, - }, - .{ - .name = "OpImageSparseTexelsResident", - .opcode = 316, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpNoLine", - .opcode = 317, - .operands = &.{}, - }, - .{ - .name = "OpAtomicFlagTestAndSet", - .opcode = 318, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .id_memory_semantics, .quantifier = .required }, - }, - }, - .{ - .name = "OpAtomicFlagClear", - .opcode = 319, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .id_memory_semantics, .quantifier = .required }, - }, - }, - .{ - .name = "OpImageSparseRead", - .opcode = 320, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .image_operands, .quantifier = .optional }, - }, - }, - .{ - .name = "OpSizeOf", - .opcode = 321, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpTypePipeStorage", - .opcode = 322, - .operands = &.{ - .{ .kind = .id_result, .quantifier = .required }, - }, - }, - .{ - .name = "OpConstantPipeStorage", - .opcode = 323, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - }, - }, - .{ - .name = "OpCreatePipeFromPipeStorage", - .opcode = 324, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpGetKernelLocalSizeForSubgroupCount", - .opcode = 325, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpGetKernelMaxNumSubgroups", - .opcode = 326, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpTypeNamedBarrier", - .opcode = 327, - .operands = &.{ - .{ .kind = .id_result, .quantifier = .required }, - }, - }, - .{ - .name = "OpNamedBarrierInitialize", - .opcode = 328, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpMemoryNamedBarrier", - .opcode = 329, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .id_memory_semantics, .quantifier = .required }, - }, - }, - .{ - .name = "OpModuleProcessed", - .opcode = 330, - .operands = &.{ - .{ .kind = .literal_string, .quantifier = .required }, - }, - }, - .{ - .name = "OpExecutionModeId", - .opcode = 331, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .execution_mode, .quantifier = .required }, - }, - }, - .{ - .name = "OpDecorateId", - .opcode = 332, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .decoration, .quantifier = .required }, - }, - }, - .{ - .name = "OpGroupNonUniformElect", - .opcode = 333, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_scope, .quantifier = .required }, - }, - }, - .{ - .name = "OpGroupNonUniformAll", - .opcode = 334, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpGroupNonUniformAny", - .opcode = 335, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpGroupNonUniformAllEqual", - .opcode = 336, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpGroupNonUniformBroadcast", - .opcode = 337, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpGroupNonUniformBroadcastFirst", - .opcode = 338, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpGroupNonUniformBallot", - .opcode = 339, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpGroupNonUniformInverseBallot", - .opcode = 340, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpGroupNonUniformBallotBitExtract", - .opcode = 341, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpGroupNonUniformBallotBitCount", - .opcode = 342, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .group_operation, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpGroupNonUniformBallotFindLSB", - .opcode = 343, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpGroupNonUniformBallotFindMSB", - .opcode = 344, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpGroupNonUniformShuffle", - .opcode = 345, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpGroupNonUniformShuffleXor", - .opcode = 346, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpGroupNonUniformShuffleUp", - .opcode = 347, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpGroupNonUniformShuffleDown", - .opcode = 348, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpGroupNonUniformIAdd", - .opcode = 349, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .group_operation, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .optional }, - }, - }, - .{ - .name = "OpGroupNonUniformFAdd", - .opcode = 350, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .group_operation, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .optional }, - }, - }, - .{ - .name = "OpGroupNonUniformIMul", - .opcode = 351, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .group_operation, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .optional }, - }, - }, - .{ - .name = "OpGroupNonUniformFMul", - .opcode = 352, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .group_operation, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .optional }, - }, - }, - .{ - .name = "OpGroupNonUniformSMin", - .opcode = 353, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .group_operation, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .optional }, - }, - }, - .{ - .name = "OpGroupNonUniformUMin", - .opcode = 354, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .group_operation, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .optional }, - }, - }, - .{ - .name = "OpGroupNonUniformFMin", - .opcode = 355, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .group_operation, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .optional }, - }, - }, - .{ - .name = "OpGroupNonUniformSMax", - .opcode = 356, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .group_operation, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .optional }, - }, - }, - .{ - .name = "OpGroupNonUniformUMax", - .opcode = 357, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .group_operation, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .optional }, - }, - }, - .{ - .name = "OpGroupNonUniformFMax", - .opcode = 358, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .group_operation, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .optional }, - }, - }, - .{ - .name = "OpGroupNonUniformBitwiseAnd", - .opcode = 359, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .group_operation, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .optional }, - }, - }, - .{ - .name = "OpGroupNonUniformBitwiseOr", - .opcode = 360, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .group_operation, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .optional }, - }, - }, - .{ - .name = "OpGroupNonUniformBitwiseXor", - .opcode = 361, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .group_operation, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .optional }, - }, - }, - .{ - .name = "OpGroupNonUniformLogicalAnd", - .opcode = 362, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .group_operation, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .optional }, - }, - }, - .{ - .name = "OpGroupNonUniformLogicalOr", - .opcode = 363, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .group_operation, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .optional }, - }, - }, - .{ - .name = "OpGroupNonUniformLogicalXor", - .opcode = 364, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .group_operation, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .optional }, - }, - }, - .{ - .name = "OpGroupNonUniformQuadBroadcast", - .opcode = 365, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpGroupNonUniformQuadSwap", - .opcode = 366, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpCopyLogical", - .opcode = 400, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpPtrEqual", - .opcode = 401, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpPtrNotEqual", - .opcode = 402, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpPtrDiff", - .opcode = 403, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpColorAttachmentReadEXT", - .opcode = 4160, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .optional }, - }, - }, - .{ - .name = "OpDepthAttachmentReadEXT", - .opcode = 4161, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .optional }, - }, - }, - .{ - .name = "OpStencilAttachmentReadEXT", - .opcode = 4162, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .optional }, - }, - }, - .{ - .name = "OpTypeTensorARM", - .opcode = 4163, - .operands = &.{ - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .optional }, - .{ .kind = .id_ref, .quantifier = .optional }, - }, - }, - .{ - .name = "OpTensorReadARM", - .opcode = 4164, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .tensor_operands, .quantifier = .optional }, - }, - }, - .{ - .name = "OpTensorWriteARM", - .opcode = 4165, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .tensor_operands, .quantifier = .optional }, - }, - }, - .{ - .name = "OpTensorQuerySizeARM", - .opcode = 4166, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpGraphConstantARM", - .opcode = 4181, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - }, - }, - .{ - .name = "OpGraphEntryPointARM", - .opcode = 4182, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .literal_string, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .variadic }, - }, - }, - .{ - .name = "OpGraphARM", - .opcode = 4183, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - }, - }, - .{ - .name = "OpGraphInputARM", - .opcode = 4184, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .variadic }, - }, - }, - .{ - .name = "OpGraphSetOutputARM", - .opcode = 4185, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .variadic }, - }, - }, - .{ - .name = "OpGraphEndARM", - .opcode = 4186, - .operands = &.{}, - }, - .{ - .name = "OpTypeGraphARM", - .opcode = 4190, - .operands = &.{ - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .variadic }, - }, - }, - .{ - .name = "OpTerminateInvocation", - .opcode = 4416, - .operands = &.{}, - }, - .{ - .name = "OpTypeUntypedPointerKHR", - .opcode = 4417, - .operands = &.{ - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .storage_class, .quantifier = .required }, - }, - }, - .{ - .name = "OpUntypedVariableKHR", - .opcode = 4418, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .storage_class, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .optional }, - .{ .kind = .id_ref, .quantifier = .optional }, - }, - }, - .{ - .name = "OpUntypedAccessChainKHR", - .opcode = 4419, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .variadic }, - }, - }, - .{ - .name = "OpUntypedInBoundsAccessChainKHR", - .opcode = 4420, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .variadic }, - }, - }, - .{ - .name = "OpSubgroupBallotKHR", - .opcode = 4421, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupFirstInvocationKHR", - .opcode = 4422, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpUntypedPtrAccessChainKHR", - .opcode = 4423, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .variadic }, - }, - }, - .{ - .name = "OpUntypedInBoundsPtrAccessChainKHR", - .opcode = 4424, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .variadic }, - }, - }, - .{ - .name = "OpUntypedArrayLengthKHR", - .opcode = 4425, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - }, - }, - .{ - .name = "OpUntypedPrefetchKHR", - .opcode = 4426, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .optional }, - .{ .kind = .id_ref, .quantifier = .optional }, - .{ .kind = .id_ref, .quantifier = .optional }, - }, - }, - .{ - .name = "OpFmaKHR", - .opcode = 4427, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAllKHR", - .opcode = 4428, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAnyKHR", - .opcode = 4429, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAllEqualKHR", - .opcode = 4430, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpGroupNonUniformRotateKHR", - .opcode = 4431, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .optional }, - }, - }, - .{ - .name = "OpSubgroupReadInvocationKHR", - .opcode = 4432, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpExtInstWithForwardRefsKHR", - .opcode = 4433, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .literal_ext_inst_integer, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .variadic }, - }, - }, - .{ - .name = "OpUntypedGroupAsyncCopyKHR", - .opcode = 4434, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .memory_access, .quantifier = .optional }, - .{ .kind = .memory_access, .quantifier = .optional }, - }, - }, - .{ - .name = "OpTraceRayKHR", - .opcode = 4445, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpExecuteCallableKHR", - .opcode = 4446, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpConvertUToAccelerationStructureKHR", - .opcode = 4447, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpIgnoreIntersectionKHR", - .opcode = 4448, - .operands = &.{}, - }, - .{ - .name = "OpTerminateRayKHR", - .opcode = 4449, - .operands = &.{}, - }, - .{ - .name = "OpSDot", - .opcode = 4450, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .packed_vector_format, .quantifier = .optional }, - }, - }, - .{ - .name = "OpUDot", - .opcode = 4451, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .packed_vector_format, .quantifier = .optional }, - }, - }, - .{ - .name = "OpSUDot", - .opcode = 4452, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .packed_vector_format, .quantifier = .optional }, - }, - }, - .{ - .name = "OpSDotAccSat", - .opcode = 4453, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .packed_vector_format, .quantifier = .optional }, - }, - }, - .{ - .name = "OpUDotAccSat", - .opcode = 4454, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .packed_vector_format, .quantifier = .optional }, - }, - }, - .{ - .name = "OpSUDotAccSat", - .opcode = 4455, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .packed_vector_format, .quantifier = .optional }, - }, - }, - .{ - .name = "OpTypeCooperativeMatrixKHR", - .opcode = 4456, - .operands = &.{ - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpCooperativeMatrixLoadKHR", - .opcode = 4457, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .optional }, - .{ .kind = .memory_access, .quantifier = .optional }, - }, - }, - .{ - .name = "OpCooperativeMatrixStoreKHR", - .opcode = 4458, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .optional }, - .{ .kind = .memory_access, .quantifier = .optional }, - }, - }, - .{ - .name = "OpCooperativeMatrixMulAddKHR", - .opcode = 4459, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .cooperative_matrix_operands, .quantifier = .optional }, - }, - }, - .{ - .name = "OpCooperativeMatrixLengthKHR", - .opcode = 4460, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpConstantCompositeReplicateEXT", - .opcode = 4461, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSpecConstantCompositeReplicateEXT", - .opcode = 4462, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpCompositeConstructReplicateEXT", - .opcode = 4463, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpTypeRayQueryKHR", - .opcode = 4472, - .operands = &.{ - .{ .kind = .id_result, .quantifier = .required }, - }, - }, - .{ - .name = "OpRayQueryInitializeKHR", - .opcode = 4473, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpRayQueryTerminateKHR", - .opcode = 4474, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpRayQueryGenerateIntersectionKHR", - .opcode = 4475, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpRayQueryConfirmIntersectionKHR", - .opcode = 4476, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpRayQueryProceedKHR", - .opcode = 4477, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpRayQueryGetIntersectionTypeKHR", - .opcode = 4479, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpImageSampleWeightedQCOM", - .opcode = 4480, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpImageBoxFilterQCOM", - .opcode = 4481, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpImageBlockMatchSSDQCOM", - .opcode = 4482, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpImageBlockMatchSADQCOM", - .opcode = 4483, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpBitCastArrayQCOM", - .opcode = 4497, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpImageBlockMatchWindowSSDQCOM", - .opcode = 4500, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpImageBlockMatchWindowSADQCOM", - .opcode = 4501, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpImageBlockMatchGatherSSDQCOM", - .opcode = 4502, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpImageBlockMatchGatherSADQCOM", - .opcode = 4503, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpCompositeConstructCoopMatQCOM", - .opcode = 4540, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpCompositeExtractCoopMatQCOM", - .opcode = 4541, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpExtractSubArrayQCOM", - .opcode = 4542, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpGroupIAddNonUniformAMD", - .opcode = 5000, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .group_operation, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpGroupFAddNonUniformAMD", - .opcode = 5001, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .group_operation, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpGroupFMinNonUniformAMD", - .opcode = 5002, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .group_operation, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpGroupUMinNonUniformAMD", - .opcode = 5003, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .group_operation, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpGroupSMinNonUniformAMD", - .opcode = 5004, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .group_operation, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpGroupFMaxNonUniformAMD", - .opcode = 5005, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .group_operation, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpGroupUMaxNonUniformAMD", - .opcode = 5006, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .group_operation, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpGroupSMaxNonUniformAMD", - .opcode = 5007, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .group_operation, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpFragmentMaskFetchAMD", - .opcode = 5011, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpFragmentFetchAMD", - .opcode = 5012, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpReadClockKHR", - .opcode = 5056, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_scope, .quantifier = .required }, - }, - }, - .{ - .name = "OpAllocateNodePayloadsAMDX", - .opcode = 5074, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpEnqueueNodePayloadsAMDX", - .opcode = 5075, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpTypeNodePayloadArrayAMDX", - .opcode = 5076, - .operands = &.{ - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpFinishWritingNodePayloadAMDX", - .opcode = 5078, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpNodePayloadArrayLengthAMDX", - .opcode = 5090, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpIsNodePayloadValidAMDX", - .opcode = 5101, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpConstantStringAMDX", - .opcode = 5103, - .operands = &.{ - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .literal_string, .quantifier = .required }, - }, - }, - .{ - .name = "OpSpecConstantStringAMDX", - .opcode = 5104, - .operands = &.{ - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .literal_string, .quantifier = .required }, - }, - }, - .{ - .name = "OpGroupNonUniformQuadAllKHR", - .opcode = 5110, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpGroupNonUniformQuadAnyKHR", - .opcode = 5111, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpTypeBufferEXT", - .opcode = 5115, - .operands = &.{ - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .storage_class, .quantifier = .required }, - }, - }, - .{ - .name = "OpBufferPointerEXT", - .opcode = 5119, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpAbortKHR", - .opcode = 5121, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpUntypedImageTexelPointerEXT", - .opcode = 5126, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpMemberDecorateIdEXT", - .opcode = 5127, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .decoration, .quantifier = .required }, - }, - }, - .{ - .name = "OpConstantSizeOfEXT", - .opcode = 5129, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpConstantDataKHR", - .opcode = 5147, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .variadic }, - }, - }, - .{ - .name = "OpSpecConstantDataKHR", - .opcode = 5148, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .variadic }, - }, - }, - .{ - .name = "OpPoisonKHR", - .opcode = 5158, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - }, - }, - .{ - .name = "OpFreezeKHR", - .opcode = 5159, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpHitObjectRecordHitMotionNV", - .opcode = 5249, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpHitObjectRecordHitWithIndexMotionNV", - .opcode = 5250, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpHitObjectRecordMissMotionNV", - .opcode = 5251, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpHitObjectGetWorldToObjectNV", - .opcode = 5252, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpHitObjectGetObjectToWorldNV", - .opcode = 5253, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpHitObjectGetObjectRayDirectionNV", - .opcode = 5254, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpHitObjectGetObjectRayOriginNV", - .opcode = 5255, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpHitObjectTraceRayMotionNV", - .opcode = 5256, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpHitObjectGetShaderRecordBufferHandleNV", - .opcode = 5257, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpHitObjectGetShaderBindingTableRecordIndexNV", - .opcode = 5258, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpHitObjectRecordEmptyNV", - .opcode = 5259, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpHitObjectTraceRayNV", - .opcode = 5260, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpHitObjectRecordHitNV", - .opcode = 5261, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpHitObjectRecordHitWithIndexNV", - .opcode = 5262, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpHitObjectRecordMissNV", - .opcode = 5263, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpHitObjectExecuteShaderNV", - .opcode = 5264, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpHitObjectGetCurrentTimeNV", - .opcode = 5265, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpHitObjectGetAttributesNV", - .opcode = 5266, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpHitObjectGetHitKindNV", - .opcode = 5267, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpHitObjectGetPrimitiveIndexNV", - .opcode = 5268, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpHitObjectGetGeometryIndexNV", - .opcode = 5269, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpHitObjectGetInstanceIdNV", - .opcode = 5270, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpHitObjectGetInstanceCustomIndexNV", - .opcode = 5271, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpHitObjectGetWorldRayDirectionNV", - .opcode = 5272, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpHitObjectGetWorldRayOriginNV", - .opcode = 5273, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpHitObjectGetRayTMaxNV", - .opcode = 5274, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpHitObjectGetRayTMinNV", - .opcode = 5275, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpHitObjectIsEmptyNV", - .opcode = 5276, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpHitObjectIsHitNV", - .opcode = 5277, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpHitObjectIsMissNV", - .opcode = 5278, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpReorderThreadWithHitObjectNV", - .opcode = 5279, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .optional }, - .{ .kind = .id_ref, .quantifier = .optional }, - }, - }, - .{ - .name = "OpReorderThreadWithHintNV", - .opcode = 5280, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpTypeHitObjectNV", - .opcode = 5281, - .operands = &.{ - .{ .kind = .id_result, .quantifier = .required }, - }, - }, - .{ - .name = "OpImageSampleFootprintNV", - .opcode = 5283, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .image_operands, .quantifier = .optional }, - }, - }, - .{ - .name = "OpTypeVectorIdEXT", - .opcode = 5288, - .operands = &.{ - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpCooperativeVectorMatrixMulNV", - .opcode = 5289, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .optional }, - .{ .kind = .cooperative_matrix_operands, .quantifier = .optional }, - }, - }, - .{ - .name = "OpCooperativeVectorOuterProductAccumulateNV", - .opcode = 5290, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .optional }, - }, - }, - .{ - .name = "OpCooperativeVectorReduceSumAccumulateNV", - .opcode = 5291, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpCooperativeVectorMatrixMulAddNV", - .opcode = 5292, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .optional }, - .{ .kind = .cooperative_matrix_operands, .quantifier = .optional }, - }, - }, - .{ - .name = "OpCooperativeMatrixConvertNV", - .opcode = 5293, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpEmitMeshTasksEXT", - .opcode = 5294, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .optional }, - }, - }, - .{ - .name = "OpSetMeshOutputsEXT", - .opcode = 5295, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpGroupNonUniformPartitionEXT", - .opcode = 5296, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpWritePackedPrimitiveIndices4x8NV", - .opcode = 5299, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpFetchMicroTriangleVertexPositionNV", - .opcode = 5300, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpFetchMicroTriangleVertexBarycentricNV", - .opcode = 5301, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpCooperativeVectorLoadNV", - .opcode = 5302, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .memory_access, .quantifier = .optional }, - }, - }, - .{ - .name = "OpCooperativeVectorStoreNV", - .opcode = 5303, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .memory_access, .quantifier = .optional }, - }, - }, - .{ - .name = "OpHitObjectRecordFromQueryEXT", - .opcode = 5304, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpHitObjectRecordMissEXT", - .opcode = 5305, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpHitObjectRecordMissMotionEXT", - .opcode = 5306, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpHitObjectGetIntersectionTriangleVertexPositionsEXT", - .opcode = 5307, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpHitObjectGetRayFlagsEXT", - .opcode = 5308, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpHitObjectSetShaderBindingTableRecordIndexEXT", - .opcode = 5309, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpHitObjectReorderExecuteShaderEXT", - .opcode = 5310, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .optional }, - .{ .kind = .id_ref, .quantifier = .optional }, - }, - }, - .{ - .name = "OpHitObjectTraceReorderExecuteEXT", - .opcode = 5311, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .optional }, - .{ .kind = .id_ref, .quantifier = .optional }, - }, - }, - .{ - .name = "OpHitObjectTraceMotionReorderExecuteEXT", - .opcode = 5312, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .optional }, - .{ .kind = .id_ref, .quantifier = .optional }, - }, - }, - .{ - .name = "OpTypeHitObjectEXT", - .opcode = 5313, - .operands = &.{ - .{ .kind = .id_result, .quantifier = .required }, - }, - }, - .{ - .name = "OpReorderThreadWithHintEXT", - .opcode = 5314, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpReorderThreadWithHitObjectEXT", - .opcode = 5315, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .optional }, - .{ .kind = .id_ref, .quantifier = .optional }, - }, - }, - .{ - .name = "OpHitObjectTraceRayEXT", - .opcode = 5316, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpHitObjectTraceRayMotionEXT", - .opcode = 5317, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpHitObjectRecordEmptyEXT", - .opcode = 5318, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpHitObjectExecuteShaderEXT", - .opcode = 5319, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpHitObjectGetCurrentTimeEXT", - .opcode = 5320, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpHitObjectGetAttributesEXT", - .opcode = 5321, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpHitObjectGetHitKindEXT", - .opcode = 5322, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpHitObjectGetPrimitiveIndexEXT", - .opcode = 5323, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpHitObjectGetGeometryIndexEXT", - .opcode = 5324, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpHitObjectGetInstanceIdEXT", - .opcode = 5325, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpHitObjectGetInstanceCustomIndexEXT", - .opcode = 5326, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpHitObjectGetObjectRayOriginEXT", - .opcode = 5327, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpHitObjectGetObjectRayDirectionEXT", - .opcode = 5328, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpHitObjectGetWorldRayDirectionEXT", - .opcode = 5329, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpHitObjectGetWorldRayOriginEXT", - .opcode = 5330, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpHitObjectGetObjectToWorldEXT", - .opcode = 5331, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpHitObjectGetWorldToObjectEXT", - .opcode = 5332, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpHitObjectGetRayTMaxEXT", - .opcode = 5333, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpReportIntersectionKHR", - .opcode = 5334, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpIgnoreIntersectionNV", - .opcode = 5335, - .operands = &.{}, - }, - .{ - .name = "OpTerminateRayNV", - .opcode = 5336, - .operands = &.{}, - }, - .{ - .name = "OpTraceNV", - .opcode = 5337, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpTraceMotionNV", - .opcode = 5338, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpTraceRayMotionNV", - .opcode = 5339, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpRayQueryGetIntersectionTriangleVertexPositionsKHR", - .opcode = 5340, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpTypeAccelerationStructureKHR", - .opcode = 5341, - .operands = &.{ - .{ .kind = .id_result, .quantifier = .required }, - }, - }, - .{ - .name = "OpExecuteCallableNV", - .opcode = 5344, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpRayQueryGetIntersectionClusterIdNV", - .opcode = 5345, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpHitObjectGetClusterIdNV", - .opcode = 5346, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpHitObjectGetRayTMinEXT", - .opcode = 5347, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpHitObjectGetShaderBindingTableRecordIndexEXT", - .opcode = 5348, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpHitObjectGetShaderRecordBufferHandleEXT", - .opcode = 5349, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpHitObjectIsEmptyEXT", - .opcode = 5350, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpHitObjectIsHitEXT", - .opcode = 5351, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpHitObjectIsMissEXT", - .opcode = 5352, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpTypeCooperativeMatrixNV", - .opcode = 5358, - .operands = &.{ - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpCooperativeMatrixLoadNV", - .opcode = 5359, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .memory_access, .quantifier = .optional }, - }, - }, - .{ - .name = "OpCooperativeMatrixStoreNV", - .opcode = 5360, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .memory_access, .quantifier = .optional }, - }, - }, - .{ - .name = "OpCooperativeMatrixMulAddNV", - .opcode = 5361, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpCooperativeMatrixLengthNV", - .opcode = 5362, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpBeginInvocationInterlockEXT", - .opcode = 5364, - .operands = &.{}, - }, - .{ - .name = "OpEndInvocationInterlockEXT", - .opcode = 5365, - .operands = &.{}, - }, - .{ - .name = "OpCooperativeMatrixReduceNV", - .opcode = 5366, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .cooperative_matrix_reduce, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpCooperativeMatrixLoadTensorNV", - .opcode = 5367, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .memory_access, .quantifier = .required }, - .{ .kind = .tensor_addressing_operands, .quantifier = .required }, - }, - }, - .{ - .name = "OpCooperativeMatrixStoreTensorNV", - .opcode = 5368, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .memory_access, .quantifier = .required }, - .{ .kind = .tensor_addressing_operands, .quantifier = .required }, - }, - }, - .{ - .name = "OpCooperativeMatrixPerElementOpNV", - .opcode = 5369, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .variadic }, - }, - }, - .{ - .name = "OpTypeTensorLayoutNV", - .opcode = 5370, - .operands = &.{ - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpTypeTensorViewNV", - .opcode = 5371, - .operands = &.{ - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .variadic }, - }, - }, - .{ - .name = "OpCreateTensorLayoutNV", - .opcode = 5372, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - }, - }, - .{ - .name = "OpTensorLayoutSetDimensionNV", - .opcode = 5373, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .variadic }, - }, - }, - .{ - .name = "OpTensorLayoutSetStrideNV", - .opcode = 5374, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .variadic }, - }, - }, - .{ - .name = "OpTensorLayoutSliceNV", - .opcode = 5375, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .variadic }, - }, - }, - .{ - .name = "OpTensorLayoutSetClampValueNV", - .opcode = 5376, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpCreateTensorViewNV", - .opcode = 5377, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - }, - }, - .{ - .name = "OpTensorViewSetDimensionNV", - .opcode = 5378, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .variadic }, - }, - }, - .{ - .name = "OpTensorViewSetStrideNV", - .opcode = 5379, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .variadic }, - }, - }, - .{ - .name = "OpDemoteToHelperInvocation", - .opcode = 5380, - .operands = &.{}, - }, - .{ - .name = "OpIsHelperInvocationEXT", - .opcode = 5381, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - }, - }, - .{ - .name = "OpTensorViewSetClipNV", - .opcode = 5382, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpTensorLayoutSetBlockSizeNV", - .opcode = 5384, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .variadic }, - }, - }, - .{ - .name = "OpCooperativeMatrixTransposeNV", - .opcode = 5390, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpConvertUToImageNV", - .opcode = 5391, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpConvertUToSamplerNV", - .opcode = 5392, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpConvertImageToUNV", - .opcode = 5393, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpConvertSamplerToUNV", - .opcode = 5394, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpConvertUToSampledImageNV", - .opcode = 5395, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpConvertSampledImageToUNV", - .opcode = 5396, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSamplerImageAddressingModeNV", - .opcode = 5397, - .operands = &.{ - .{ .kind = .literal_integer, .quantifier = .required }, - }, - }, - .{ - .name = "OpRawAccessChainNV", - .opcode = 5398, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .raw_access_chain_operands, .quantifier = .optional }, - }, - }, - .{ - .name = "OpRayQueryGetIntersectionSpherePositionNV", - .opcode = 5427, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpRayQueryGetIntersectionSphereRadiusNV", - .opcode = 5428, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpRayQueryGetIntersectionLSSPositionsNV", - .opcode = 5429, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpRayQueryGetIntersectionLSSRadiiNV", - .opcode = 5430, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpRayQueryGetIntersectionLSSHitValueNV", - .opcode = 5431, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpHitObjectGetSpherePositionNV", - .opcode = 5432, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpHitObjectGetSphereRadiusNV", - .opcode = 5433, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpHitObjectGetLSSPositionsNV", - .opcode = 5434, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpHitObjectGetLSSRadiiNV", - .opcode = 5435, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpHitObjectIsSphereHitNV", - .opcode = 5436, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpHitObjectIsLSSHitNV", - .opcode = 5437, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpRayQueryIsSphereHitNV", - .opcode = 5438, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpRayQueryIsLSSHitNV", - .opcode = 5439, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupShuffleINTEL", - .opcode = 5571, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupShuffleDownINTEL", - .opcode = 5572, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupShuffleUpINTEL", - .opcode = 5573, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupShuffleXorINTEL", - .opcode = 5574, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupBlockReadINTEL", - .opcode = 5575, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupBlockWriteINTEL", - .opcode = 5576, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupImageBlockReadINTEL", - .opcode = 5577, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupImageBlockWriteINTEL", - .opcode = 5578, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupImageMediaBlockReadINTEL", - .opcode = 5580, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupImageMediaBlockWriteINTEL", - .opcode = 5581, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpUCountLeadingZerosINTEL", - .opcode = 5585, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpUCountTrailingZerosINTEL", - .opcode = 5586, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpAbsISubINTEL", - .opcode = 5587, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpAbsUSubINTEL", - .opcode = 5588, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpIAddSatINTEL", - .opcode = 5589, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpUAddSatINTEL", - .opcode = 5590, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpIAverageINTEL", - .opcode = 5591, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpUAverageINTEL", - .opcode = 5592, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpIAverageRoundedINTEL", - .opcode = 5593, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpUAverageRoundedINTEL", - .opcode = 5594, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpISubSatINTEL", - .opcode = 5595, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpUSubSatINTEL", - .opcode = 5596, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpIMul32x16INTEL", - .opcode = 5597, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpUMul32x16INTEL", - .opcode = 5598, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpConstantFunctionPointerINTEL", - .opcode = 5600, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpFunctionPointerCallINTEL", - .opcode = 5601, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .variadic }, - }, - }, - .{ - .name = "OpAsmTargetINTEL", - .opcode = 5609, - .operands = &.{ - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .literal_string, .quantifier = .required }, - }, - }, - .{ - .name = "OpAsmINTEL", - .opcode = 5610, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .literal_string, .quantifier = .required }, - .{ .kind = .literal_string, .quantifier = .required }, - }, - }, - .{ - .name = "OpAsmCallINTEL", - .opcode = 5611, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .variadic }, - }, - }, - .{ - .name = "OpAtomicFMinEXT", - .opcode = 5614, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .id_memory_semantics, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpAtomicFMaxEXT", - .opcode = 5615, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .id_memory_semantics, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpAssumeTrueKHR", - .opcode = 5630, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpExpectKHR", - .opcode = 5631, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpDecorateString", - .opcode = 5632, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .decoration, .quantifier = .required }, - }, - }, - .{ - .name = "OpMemberDecorateString", - .opcode = 5633, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .decoration, .quantifier = .required }, - }, - }, - .{ - .name = "OpVmeImageINTEL", - .opcode = 5699, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpTypeVmeImageINTEL", - .opcode = 5700, - .operands = &.{ - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpTypeAvcImePayloadINTEL", - .opcode = 5701, - .operands = &.{ - .{ .kind = .id_result, .quantifier = .required }, - }, - }, - .{ - .name = "OpTypeAvcRefPayloadINTEL", - .opcode = 5702, - .operands = &.{ - .{ .kind = .id_result, .quantifier = .required }, - }, - }, - .{ - .name = "OpTypeAvcSicPayloadINTEL", - .opcode = 5703, - .operands = &.{ - .{ .kind = .id_result, .quantifier = .required }, - }, - }, - .{ - .name = "OpTypeAvcMcePayloadINTEL", - .opcode = 5704, - .operands = &.{ - .{ .kind = .id_result, .quantifier = .required }, - }, - }, - .{ - .name = "OpTypeAvcMceResultINTEL", - .opcode = 5705, - .operands = &.{ - .{ .kind = .id_result, .quantifier = .required }, - }, - }, - .{ - .name = "OpTypeAvcImeResultINTEL", - .opcode = 5706, - .operands = &.{ - .{ .kind = .id_result, .quantifier = .required }, - }, - }, - .{ - .name = "OpTypeAvcImeResultSingleReferenceStreamoutINTEL", - .opcode = 5707, - .operands = &.{ - .{ .kind = .id_result, .quantifier = .required }, - }, - }, - .{ - .name = "OpTypeAvcImeResultDualReferenceStreamoutINTEL", - .opcode = 5708, - .operands = &.{ - .{ .kind = .id_result, .quantifier = .required }, - }, - }, - .{ - .name = "OpTypeAvcImeSingleReferenceStreaminINTEL", - .opcode = 5709, - .operands = &.{ - .{ .kind = .id_result, .quantifier = .required }, - }, - }, - .{ - .name = "OpTypeAvcImeDualReferenceStreaminINTEL", - .opcode = 5710, - .operands = &.{ - .{ .kind = .id_result, .quantifier = .required }, - }, - }, - .{ - .name = "OpTypeAvcRefResultINTEL", - .opcode = 5711, - .operands = &.{ - .{ .kind = .id_result, .quantifier = .required }, - }, - }, - .{ - .name = "OpTypeAvcSicResultINTEL", - .opcode = 5712, - .operands = &.{ - .{ .kind = .id_result, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcMceGetDefaultInterBaseMultiReferencePenaltyINTEL", - .opcode = 5713, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcMceSetInterBaseMultiReferencePenaltyINTEL", - .opcode = 5714, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcMceGetDefaultInterShapePenaltyINTEL", - .opcode = 5715, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcMceSetInterShapePenaltyINTEL", - .opcode = 5716, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcMceGetDefaultInterDirectionPenaltyINTEL", - .opcode = 5717, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcMceSetInterDirectionPenaltyINTEL", - .opcode = 5718, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcMceGetDefaultIntraLumaShapePenaltyINTEL", - .opcode = 5719, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcMceGetDefaultInterMotionVectorCostTableINTEL", - .opcode = 5720, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcMceGetDefaultHighPenaltyCostTableINTEL", - .opcode = 5721, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcMceGetDefaultMediumPenaltyCostTableINTEL", - .opcode = 5722, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcMceGetDefaultLowPenaltyCostTableINTEL", - .opcode = 5723, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcMceSetMotionVectorCostFunctionINTEL", - .opcode = 5724, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcMceGetDefaultIntraLumaModePenaltyINTEL", - .opcode = 5725, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcMceGetDefaultNonDcLumaIntraPenaltyINTEL", - .opcode = 5726, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcMceGetDefaultIntraChromaModeBasePenaltyINTEL", - .opcode = 5727, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcMceSetAcOnlyHaarINTEL", - .opcode = 5728, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcMceSetSourceInterlacedFieldPolarityINTEL", - .opcode = 5729, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcMceSetSingleReferenceInterlacedFieldPolarityINTEL", - .opcode = 5730, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcMceSetDualReferenceInterlacedFieldPolaritiesINTEL", - .opcode = 5731, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcMceConvertToImePayloadINTEL", - .opcode = 5732, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcMceConvertToImeResultINTEL", - .opcode = 5733, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcMceConvertToRefPayloadINTEL", - .opcode = 5734, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcMceConvertToRefResultINTEL", - .opcode = 5735, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcMceConvertToSicPayloadINTEL", - .opcode = 5736, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcMceConvertToSicResultINTEL", - .opcode = 5737, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcMceGetMotionVectorsINTEL", - .opcode = 5738, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcMceGetInterDistortionsINTEL", - .opcode = 5739, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcMceGetBestInterDistortionsINTEL", - .opcode = 5740, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcMceGetInterMajorShapeINTEL", - .opcode = 5741, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcMceGetInterMinorShapeINTEL", - .opcode = 5742, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcMceGetInterDirectionsINTEL", - .opcode = 5743, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcMceGetInterMotionVectorCountINTEL", - .opcode = 5744, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcMceGetInterReferenceIdsINTEL", - .opcode = 5745, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcMceGetInterReferenceInterlacedFieldPolaritiesINTEL", - .opcode = 5746, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcImeInitializeINTEL", - .opcode = 5747, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcImeSetSingleReferenceINTEL", - .opcode = 5748, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcImeSetDualReferenceINTEL", - .opcode = 5749, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcImeRefWindowSizeINTEL", - .opcode = 5750, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcImeAdjustRefOffsetINTEL", - .opcode = 5751, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcImeConvertToMcePayloadINTEL", - .opcode = 5752, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcImeSetMaxMotionVectorCountINTEL", - .opcode = 5753, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcImeSetUnidirectionalMixDisableINTEL", - .opcode = 5754, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcImeSetEarlySearchTerminationThresholdINTEL", - .opcode = 5755, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcImeSetWeightedSadINTEL", - .opcode = 5756, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcImeEvaluateWithSingleReferenceINTEL", - .opcode = 5757, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcImeEvaluateWithDualReferenceINTEL", - .opcode = 5758, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcImeEvaluateWithSingleReferenceStreaminINTEL", - .opcode = 5759, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcImeEvaluateWithDualReferenceStreaminINTEL", - .opcode = 5760, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcImeEvaluateWithSingleReferenceStreamoutINTEL", - .opcode = 5761, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcImeEvaluateWithDualReferenceStreamoutINTEL", - .opcode = 5762, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcImeEvaluateWithSingleReferenceStreaminoutINTEL", - .opcode = 5763, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcImeEvaluateWithDualReferenceStreaminoutINTEL", - .opcode = 5764, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcImeConvertToMceResultINTEL", - .opcode = 5765, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcImeGetSingleReferenceStreaminINTEL", - .opcode = 5766, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcImeGetDualReferenceStreaminINTEL", - .opcode = 5767, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcImeStripSingleReferenceStreamoutINTEL", - .opcode = 5768, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcImeStripDualReferenceStreamoutINTEL", - .opcode = 5769, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcImeGetStreamoutSingleReferenceMajorShapeMotionVectorsINTEL", - .opcode = 5770, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcImeGetStreamoutSingleReferenceMajorShapeDistortionsINTEL", - .opcode = 5771, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcImeGetStreamoutSingleReferenceMajorShapeReferenceIdsINTEL", - .opcode = 5772, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcImeGetStreamoutDualReferenceMajorShapeMotionVectorsINTEL", - .opcode = 5773, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcImeGetStreamoutDualReferenceMajorShapeDistortionsINTEL", - .opcode = 5774, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcImeGetStreamoutDualReferenceMajorShapeReferenceIdsINTEL", - .opcode = 5775, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcImeGetBorderReachedINTEL", - .opcode = 5776, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcImeGetTruncatedSearchIndicationINTEL", - .opcode = 5777, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcImeGetUnidirectionalEarlySearchTerminationINTEL", - .opcode = 5778, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcImeGetWeightingPatternMinimumMotionVectorINTEL", - .opcode = 5779, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcImeGetWeightingPatternMinimumDistortionINTEL", - .opcode = 5780, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcFmeInitializeINTEL", - .opcode = 5781, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcBmeInitializeINTEL", - .opcode = 5782, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcRefConvertToMcePayloadINTEL", - .opcode = 5783, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcRefSetBidirectionalMixDisableINTEL", - .opcode = 5784, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcRefSetBilinearFilterEnableINTEL", - .opcode = 5785, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcRefEvaluateWithSingleReferenceINTEL", - .opcode = 5786, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcRefEvaluateWithDualReferenceINTEL", - .opcode = 5787, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcRefEvaluateWithMultiReferenceINTEL", - .opcode = 5788, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcRefEvaluateWithMultiReferenceInterlacedINTEL", - .opcode = 5789, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcRefConvertToMceResultINTEL", - .opcode = 5790, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcSicInitializeINTEL", - .opcode = 5791, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcSicConfigureSkcINTEL", - .opcode = 5792, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcSicConfigureIpeLumaINTEL", - .opcode = 5793, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcSicConfigureIpeLumaChromaINTEL", - .opcode = 5794, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcSicGetMotionVectorMaskINTEL", - .opcode = 5795, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcSicConvertToMcePayloadINTEL", - .opcode = 5796, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcSicSetIntraLumaShapePenaltyINTEL", - .opcode = 5797, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcSicSetIntraLumaModeCostFunctionINTEL", - .opcode = 5798, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcSicSetIntraChromaModeCostFunctionINTEL", - .opcode = 5799, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcSicSetBilinearFilterEnableINTEL", - .opcode = 5800, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcSicSetSkcForwardTransformEnableINTEL", - .opcode = 5801, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcSicSetBlockBasedRawSkipSadINTEL", - .opcode = 5802, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcSicEvaluateIpeINTEL", - .opcode = 5803, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcSicEvaluateWithSingleReferenceINTEL", - .opcode = 5804, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcSicEvaluateWithDualReferenceINTEL", - .opcode = 5805, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcSicEvaluateWithMultiReferenceINTEL", - .opcode = 5806, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcSicEvaluateWithMultiReferenceInterlacedINTEL", - .opcode = 5807, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcSicConvertToMceResultINTEL", - .opcode = 5808, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcSicGetIpeLumaShapeINTEL", - .opcode = 5809, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcSicGetBestIpeLumaDistortionINTEL", - .opcode = 5810, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcSicGetBestIpeChromaDistortionINTEL", - .opcode = 5811, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcSicGetPackedIpeLumaModesINTEL", - .opcode = 5812, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcSicGetIpeChromaModeINTEL", - .opcode = 5813, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcSicGetPackedSkcLumaCountThresholdINTEL", - .opcode = 5814, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcSicGetPackedSkcLumaSumThresholdINTEL", - .opcode = 5815, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupAvcSicGetInterRawSadsINTEL", - .opcode = 5816, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpVariableLengthArrayINTEL", - .opcode = 5818, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSaveMemoryINTEL", - .opcode = 5819, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - }, - }, - .{ - .name = "OpRestoreMemoryINTEL", - .opcode = 5820, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpArbitraryFloatSinCosPiALTERA", - .opcode = 5840, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - }, - }, - .{ - .name = "OpArbitraryFloatCastALTERA", - .opcode = 5841, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - }, - }, - .{ - .name = "OpArbitraryFloatCastFromIntALTERA", - .opcode = 5842, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - }, - }, - .{ - .name = "OpArbitraryFloatCastToIntALTERA", - .opcode = 5843, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - }, - }, - .{ - .name = "OpArbitraryFloatAddALTERA", - .opcode = 5846, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - }, - }, - .{ - .name = "OpArbitraryFloatSubALTERA", - .opcode = 5847, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - }, - }, - .{ - .name = "OpArbitraryFloatMulALTERA", - .opcode = 5848, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - }, - }, - .{ - .name = "OpArbitraryFloatDivALTERA", - .opcode = 5849, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - }, - }, - .{ - .name = "OpArbitraryFloatGTALTERA", - .opcode = 5850, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - }, - }, - .{ - .name = "OpArbitraryFloatGEALTERA", - .opcode = 5851, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - }, - }, - .{ - .name = "OpArbitraryFloatLTALTERA", - .opcode = 5852, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - }, - }, - .{ - .name = "OpArbitraryFloatLEALTERA", - .opcode = 5853, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - }, - }, - .{ - .name = "OpArbitraryFloatEQALTERA", - .opcode = 5854, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - }, - }, - .{ - .name = "OpArbitraryFloatRecipALTERA", - .opcode = 5855, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - }, - }, - .{ - .name = "OpArbitraryFloatRSqrtALTERA", - .opcode = 5856, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - }, - }, - .{ - .name = "OpArbitraryFloatCbrtALTERA", - .opcode = 5857, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - }, - }, - .{ - .name = "OpArbitraryFloatHypotALTERA", - .opcode = 5858, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - }, - }, - .{ - .name = "OpArbitraryFloatSqrtALTERA", - .opcode = 5859, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - }, - }, - .{ - .name = "OpArbitraryFloatLogINTEL", - .opcode = 5860, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - }, - }, - .{ - .name = "OpArbitraryFloatLog2INTEL", - .opcode = 5861, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - }, - }, - .{ - .name = "OpArbitraryFloatLog10INTEL", - .opcode = 5862, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - }, - }, - .{ - .name = "OpArbitraryFloatLog1pINTEL", - .opcode = 5863, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - }, - }, - .{ - .name = "OpArbitraryFloatExpINTEL", - .opcode = 5864, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - }, - }, - .{ - .name = "OpArbitraryFloatExp2INTEL", - .opcode = 5865, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - }, - }, - .{ - .name = "OpArbitraryFloatExp10INTEL", - .opcode = 5866, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - }, - }, - .{ - .name = "OpArbitraryFloatExpm1INTEL", - .opcode = 5867, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - }, - }, - .{ - .name = "OpArbitraryFloatSinINTEL", - .opcode = 5868, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - }, - }, - .{ - .name = "OpArbitraryFloatCosINTEL", - .opcode = 5869, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - }, - }, - .{ - .name = "OpArbitraryFloatSinCosINTEL", - .opcode = 5870, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - }, - }, - .{ - .name = "OpArbitraryFloatSinPiINTEL", - .opcode = 5871, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - }, - }, - .{ - .name = "OpArbitraryFloatCosPiINTEL", - .opcode = 5872, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - }, - }, - .{ - .name = "OpArbitraryFloatASinINTEL", - .opcode = 5873, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - }, - }, - .{ - .name = "OpArbitraryFloatASinPiINTEL", - .opcode = 5874, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - }, - }, - .{ - .name = "OpArbitraryFloatACosINTEL", - .opcode = 5875, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - }, - }, - .{ - .name = "OpArbitraryFloatACosPiINTEL", - .opcode = 5876, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - }, - }, - .{ - .name = "OpArbitraryFloatATanINTEL", - .opcode = 5877, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - }, - }, - .{ - .name = "OpArbitraryFloatATanPiINTEL", - .opcode = 5878, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - }, - }, - .{ - .name = "OpArbitraryFloatATan2INTEL", - .opcode = 5879, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - }, - }, - .{ - .name = "OpArbitraryFloatPowINTEL", - .opcode = 5880, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - }, - }, - .{ - .name = "OpArbitraryFloatPowRINTEL", - .opcode = 5881, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - }, - }, - .{ - .name = "OpArbitraryFloatPowNINTEL", - .opcode = 5882, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - }, - }, - .{ - .name = "OpLoopControlINTEL", - .opcode = 5887, - .operands = &.{ - .{ .kind = .literal_integer, .quantifier = .variadic }, - }, - }, - .{ - .name = "OpAliasDomainDeclINTEL", - .opcode = 5911, - .operands = &.{ - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .optional }, - }, - }, - .{ - .name = "OpAliasScopeDeclINTEL", - .opcode = 5912, - .operands = &.{ - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .optional }, - }, - }, - .{ - .name = "OpAliasScopeListDeclINTEL", - .opcode = 5913, - .operands = &.{ - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .variadic }, - }, - }, - .{ - .name = "OpFixedSqrtALTERA", - .opcode = 5923, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - }, - }, - .{ - .name = "OpFixedRecipALTERA", - .opcode = 5924, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - }, - }, - .{ - .name = "OpFixedRsqrtALTERA", - .opcode = 5925, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - }, - }, - .{ - .name = "OpFixedSinALTERA", - .opcode = 5926, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - }, - }, - .{ - .name = "OpFixedCosALTERA", - .opcode = 5927, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - }, - }, - .{ - .name = "OpFixedSinCosALTERA", - .opcode = 5928, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - }, - }, - .{ - .name = "OpFixedSinPiALTERA", - .opcode = 5929, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - }, - }, - .{ - .name = "OpFixedCosPiALTERA", - .opcode = 5930, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - }, - }, - .{ - .name = "OpFixedSinCosPiALTERA", - .opcode = 5931, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - }, - }, - .{ - .name = "OpFixedLogALTERA", - .opcode = 5932, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - }, - }, - .{ - .name = "OpFixedExpALTERA", - .opcode = 5933, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - }, - }, - .{ - .name = "OpPtrCastToCrossWorkgroupALTERA", - .opcode = 5934, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpCrossWorkgroupCastToPtrALTERA", - .opcode = 5938, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpReadPipeBlockingALTERA", - .opcode = 5946, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpWritePipeBlockingALTERA", - .opcode = 5947, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpFPGARegALTERA", - .opcode = 5949, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpRayQueryGetRayTMinKHR", - .opcode = 6016, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpRayQueryGetRayFlagsKHR", - .opcode = 6017, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpRayQueryGetIntersectionTKHR", - .opcode = 6018, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpRayQueryGetIntersectionInstanceCustomIndexKHR", - .opcode = 6019, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpRayQueryGetIntersectionInstanceIdKHR", - .opcode = 6020, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpRayQueryGetIntersectionInstanceShaderBindingTableRecordOffsetKHR", - .opcode = 6021, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpRayQueryGetIntersectionGeometryIndexKHR", - .opcode = 6022, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpRayQueryGetIntersectionPrimitiveIndexKHR", - .opcode = 6023, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpRayQueryGetIntersectionBarycentricsKHR", - .opcode = 6024, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpRayQueryGetIntersectionFrontFaceKHR", - .opcode = 6025, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpRayQueryGetIntersectionCandidateAABBOpaqueKHR", - .opcode = 6026, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpRayQueryGetIntersectionObjectRayDirectionKHR", - .opcode = 6027, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpRayQueryGetIntersectionObjectRayOriginKHR", - .opcode = 6028, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpRayQueryGetWorldRayDirectionKHR", - .opcode = 6029, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpRayQueryGetWorldRayOriginKHR", - .opcode = 6030, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpRayQueryGetIntersectionObjectToWorldKHR", - .opcode = 6031, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpRayQueryGetIntersectionWorldToObjectKHR", - .opcode = 6032, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpAtomicFAddEXT", - .opcode = 6035, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .id_memory_semantics, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpTypeBufferSurfaceINTEL", - .opcode = 6086, - .operands = &.{ - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .access_qualifier, .quantifier = .required }, - }, - }, - .{ - .name = "OpTypeStructContinuedINTEL", - .opcode = 6090, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .variadic }, - }, - }, - .{ - .name = "OpConstantCompositeContinuedINTEL", - .opcode = 6091, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .variadic }, - }, - }, - .{ - .name = "OpSpecConstantCompositeContinuedINTEL", - .opcode = 6092, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .variadic }, - }, - }, - .{ - .name = "OpCompositeConstructContinuedINTEL", - .opcode = 6096, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .variadic }, - }, - }, - .{ - .name = "OpConvertFToBF16INTEL", - .opcode = 6116, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpConvertBF16ToFINTEL", - .opcode = 6117, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpControlBarrierArriveINTEL", - .opcode = 6142, - .operands = &.{ - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .id_memory_semantics, .quantifier = .required }, - }, - }, - .{ - .name = "OpControlBarrierWaitINTEL", - .opcode = 6143, - .operands = &.{ - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .id_memory_semantics, .quantifier = .required }, - }, - }, - .{ - .name = "OpArithmeticFenceEXT", - .opcode = 6145, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpTaskSequenceCreateALTERA", - .opcode = 6163, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - }, - }, - .{ - .name = "OpTaskSequenceAsyncALTERA", - .opcode = 6164, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .variadic }, - }, - }, - .{ - .name = "OpTaskSequenceGetALTERA", - .opcode = 6165, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpTaskSequenceReleaseALTERA", - .opcode = 6166, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpTypeTaskSequenceALTERA", - .opcode = 6199, - .operands = &.{ - .{ .kind = .id_result, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupBlockPrefetchINTEL", - .opcode = 6221, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .memory_access, .quantifier = .optional }, - }, - }, - .{ - .name = "OpSubgroup2DBlockLoadINTEL", - .opcode = 6231, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroup2DBlockLoadTransformINTEL", - .opcode = 6232, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroup2DBlockLoadTransposeINTEL", - .opcode = 6233, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroup2DBlockPrefetchINTEL", - .opcode = 6234, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroup2DBlockStoreINTEL", - .opcode = 6235, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpSubgroupMatrixMultiplyAccumulateINTEL", - .opcode = 6237, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .matrix_multiply_accumulate_operands, .quantifier = .optional }, - }, - }, - .{ - .name = "OpBitwiseFunctionINTEL", - .opcode = 6242, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpUntypedVariableLengthArrayINTEL", - .opcode = 6244, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpConditionalExtensionINTEL", - .opcode = 6248, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .literal_string, .quantifier = .required }, - }, - }, - .{ - .name = "OpConditionalEntryPointINTEL", - .opcode = 6249, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .execution_model, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .literal_string, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .variadic }, - }, - }, - .{ - .name = "OpConditionalCapabilityINTEL", - .opcode = 6250, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .capability, .quantifier = .required }, - }, - }, - .{ - .name = "OpSpecConstantTargetINTEL", - .opcode = 6251, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .variadic }, - }, - }, - .{ - .name = "OpSpecConstantArchitectureINTEL", - .opcode = 6252, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - }, - }, - .{ - .name = "OpSpecConstantCapabilitiesINTEL", - .opcode = 6253, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .capability, .quantifier = .variadic }, - }, - }, - .{ - .name = "OpConditionalCopyObjectINTEL", - .opcode = 6254, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .variadic }, - }, - }, - .{ - .name = "OpGroupIMulKHR", - .opcode = 6401, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .group_operation, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpGroupFMulKHR", - .opcode = 6402, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .group_operation, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpGroupBitwiseAndKHR", - .opcode = 6403, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .group_operation, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpGroupBitwiseOrKHR", - .opcode = 6404, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .group_operation, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpGroupBitwiseXorKHR", - .opcode = 6405, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .group_operation, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpGroupLogicalAndKHR", - .opcode = 6406, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .group_operation, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpGroupLogicalOrKHR", - .opcode = 6407, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .group_operation, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpGroupLogicalXorKHR", - .opcode = 6408, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_scope, .quantifier = .required }, - .{ .kind = .group_operation, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpRoundFToTF32INTEL", - .opcode = 6426, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpMaskedGatherINTEL", - .opcode = 6428, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpMaskedScatterINTEL", - .opcode = 6429, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpConvertHandleToImageINTEL", - .opcode = 6529, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpConvertHandleToSamplerINTEL", - .opcode = 6530, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpConvertHandleToSampledImageINTEL", - .opcode = 6531, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpFDot2MixAcc32VALVE", - .opcode = 6916, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpFDot2MixAcc16VALVE", - .opcode = 6917, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "OpFDot4MixAcc32VALVE", - .opcode = 6918, - .operands = &.{ - .{ .kind = .id_result_type, .quantifier = .required }, - .{ .kind = .id_result, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - }, - .@"OpenCL.std" => &.{ - .{ - .name = "acos", - .opcode = 0, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "acosh", - .opcode = 1, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "acospi", - .opcode = 2, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "asin", - .opcode = 3, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "asinh", - .opcode = 4, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "asinpi", - .opcode = 5, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "atan", - .opcode = 6, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "atan2", - .opcode = 7, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "atanh", - .opcode = 8, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "atanpi", - .opcode = 9, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "atan2pi", - .opcode = 10, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "cbrt", - .opcode = 11, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "ceil", - .opcode = 12, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "copysign", - .opcode = 13, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "cos", - .opcode = 14, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "cosh", - .opcode = 15, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "cospi", - .opcode = 16, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "erfc", - .opcode = 17, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "erf", - .opcode = 18, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "exp", - .opcode = 19, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "exp2", - .opcode = 20, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "exp10", - .opcode = 21, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "expm1", - .opcode = 22, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "fabs", - .opcode = 23, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "fdim", - .opcode = 24, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "floor", - .opcode = 25, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "fma", - .opcode = 26, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "fmax", - .opcode = 27, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "fmin", - .opcode = 28, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "fmod", - .opcode = 29, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "fract", - .opcode = 30, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "frexp", - .opcode = 31, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "hypot", - .opcode = 32, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "ilogb", - .opcode = 33, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "ldexp", - .opcode = 34, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "lgamma", - .opcode = 35, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "lgamma_r", - .opcode = 36, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "log", - .opcode = 37, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "log2", - .opcode = 38, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "log10", - .opcode = 39, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "log1p", - .opcode = 40, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "logb", - .opcode = 41, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "mad", - .opcode = 42, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "maxmag", - .opcode = 43, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "minmag", - .opcode = 44, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "modf", - .opcode = 45, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "nan", - .opcode = 46, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "nextafter", - .opcode = 47, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "pow", - .opcode = 48, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "pown", - .opcode = 49, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "powr", - .opcode = 50, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "remainder", - .opcode = 51, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "remquo", - .opcode = 52, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "rint", - .opcode = 53, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "rootn", - .opcode = 54, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "round", - .opcode = 55, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "rsqrt", - .opcode = 56, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "sin", - .opcode = 57, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "sincos", - .opcode = 58, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "sinh", - .opcode = 59, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "sinpi", - .opcode = 60, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "sqrt", - .opcode = 61, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "tan", - .opcode = 62, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "tanh", - .opcode = 63, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "tanpi", - .opcode = 64, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "tgamma", - .opcode = 65, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "trunc", - .opcode = 66, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "half_cos", - .opcode = 67, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "half_divide", - .opcode = 68, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "half_exp", - .opcode = 69, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "half_exp2", - .opcode = 70, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "half_exp10", - .opcode = 71, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "half_log", - .opcode = 72, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "half_log2", - .opcode = 73, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "half_log10", - .opcode = 74, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "half_powr", - .opcode = 75, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "half_recip", - .opcode = 76, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "half_rsqrt", - .opcode = 77, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "half_sin", - .opcode = 78, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "half_sqrt", - .opcode = 79, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "half_tan", - .opcode = 80, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "native_cos", - .opcode = 81, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "native_divide", - .opcode = 82, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "native_exp", - .opcode = 83, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "native_exp2", - .opcode = 84, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "native_exp10", - .opcode = 85, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "native_log", - .opcode = 86, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "native_log2", - .opcode = 87, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "native_log10", - .opcode = 88, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "native_powr", - .opcode = 89, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "native_recip", - .opcode = 90, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "native_rsqrt", - .opcode = 91, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "native_sin", - .opcode = 92, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "native_sqrt", - .opcode = 93, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "native_tan", - .opcode = 94, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "fclamp", - .opcode = 95, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "degrees", - .opcode = 96, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "fmax_common", - .opcode = 97, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "fmin_common", - .opcode = 98, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "mix", - .opcode = 99, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "radians", - .opcode = 100, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "step", - .opcode = 101, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "smoothstep", - .opcode = 102, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "sign", - .opcode = 103, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "cross", - .opcode = 104, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "distance", - .opcode = 105, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "length", - .opcode = 106, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "normalize", - .opcode = 107, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "fast_distance", - .opcode = 108, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "fast_length", - .opcode = 109, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "fast_normalize", - .opcode = 110, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "s_abs", - .opcode = 141, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "s_abs_diff", - .opcode = 142, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "s_add_sat", - .opcode = 143, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "u_add_sat", - .opcode = 144, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "s_hadd", - .opcode = 145, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "u_hadd", - .opcode = 146, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "s_rhadd", - .opcode = 147, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "u_rhadd", - .opcode = 148, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "s_clamp", - .opcode = 149, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "u_clamp", - .opcode = 150, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "clz", - .opcode = 151, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "ctz", - .opcode = 152, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "s_mad_hi", - .opcode = 153, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "u_mad_sat", - .opcode = 154, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "s_mad_sat", - .opcode = 155, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "s_max", - .opcode = 156, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "u_max", - .opcode = 157, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "s_min", - .opcode = 158, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "u_min", - .opcode = 159, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "s_mul_hi", - .opcode = 160, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "rotate", - .opcode = 161, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "s_sub_sat", - .opcode = 162, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "u_sub_sat", - .opcode = 163, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "u_upsample", - .opcode = 164, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "s_upsample", - .opcode = 165, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "popcount", - .opcode = 166, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "s_mad24", - .opcode = 167, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "u_mad24", - .opcode = 168, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "s_mul24", - .opcode = 169, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "u_mul24", - .opcode = 170, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "vloadn", - .opcode = 171, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - }, - }, - .{ - .name = "vstoren", - .opcode = 172, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "vload_half", - .opcode = 173, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "vload_halfn", - .opcode = 174, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - }, - }, - .{ - .name = "vstore_half", - .opcode = 175, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "vstore_half_r", - .opcode = 176, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .fp_rounding_mode, .quantifier = .required }, - }, - }, - .{ - .name = "vstore_halfn", - .opcode = 177, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "vstore_halfn_r", - .opcode = 178, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .fp_rounding_mode, .quantifier = .required }, - }, - }, - .{ - .name = "vloada_halfn", - .opcode = 179, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .literal_integer, .quantifier = .required }, - }, - }, - .{ - .name = "vstorea_halfn", - .opcode = 180, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "vstorea_halfn_r", - .opcode = 181, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .fp_rounding_mode, .quantifier = .required }, - }, - }, - .{ - .name = "shuffle", - .opcode = 182, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "shuffle2", - .opcode = 183, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "printf", - .opcode = 184, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .variadic }, - }, - }, - .{ - .name = "prefetch", - .opcode = 185, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "bitselect", - .opcode = 186, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "select", - .opcode = 187, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "u_abs", - .opcode = 201, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "u_abs_diff", - .opcode = 202, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "u_mul_hi", - .opcode = 203, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "u_mad_hi", - .opcode = 204, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - }, - .@"GLSL.std.450" => &.{ - .{ - .name = "Round", - .opcode = 1, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "RoundEven", - .opcode = 2, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "Trunc", - .opcode = 3, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "FAbs", - .opcode = 4, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "SAbs", - .opcode = 5, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "FSign", - .opcode = 6, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "SSign", - .opcode = 7, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "Floor", - .opcode = 8, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "Ceil", - .opcode = 9, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "Fract", - .opcode = 10, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "Radians", - .opcode = 11, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "Degrees", - .opcode = 12, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "Sin", - .opcode = 13, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "Cos", - .opcode = 14, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "Tan", - .opcode = 15, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "Asin", - .opcode = 16, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "Acos", - .opcode = 17, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "Atan", - .opcode = 18, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "Sinh", - .opcode = 19, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "Cosh", - .opcode = 20, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "Tanh", - .opcode = 21, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "Asinh", - .opcode = 22, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "Acosh", - .opcode = 23, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "Atanh", - .opcode = 24, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "Atan2", - .opcode = 25, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "Pow", - .opcode = 26, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "Exp", - .opcode = 27, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "Log", - .opcode = 28, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "Exp2", - .opcode = 29, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "Log2", - .opcode = 30, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "Sqrt", - .opcode = 31, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "InverseSqrt", - .opcode = 32, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "Determinant", - .opcode = 33, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "MatrixInverse", - .opcode = 34, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "Modf", - .opcode = 35, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "ModfStruct", - .opcode = 36, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "FMin", - .opcode = 37, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "UMin", - .opcode = 38, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "SMin", - .opcode = 39, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "FMax", - .opcode = 40, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "UMax", - .opcode = 41, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "SMax", - .opcode = 42, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "FClamp", - .opcode = 43, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "UClamp", - .opcode = 44, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "SClamp", - .opcode = 45, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "FMix", - .opcode = 46, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "IMix", - .opcode = 47, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "Step", - .opcode = 48, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "SmoothStep", - .opcode = 49, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "Fma", - .opcode = 50, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "Frexp", - .opcode = 51, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "FrexpStruct", - .opcode = 52, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "Ldexp", - .opcode = 53, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "PackSnorm4x8", - .opcode = 54, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "PackUnorm4x8", - .opcode = 55, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "PackSnorm2x16", - .opcode = 56, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "PackUnorm2x16", - .opcode = 57, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "PackHalf2x16", - .opcode = 58, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "PackDouble2x32", - .opcode = 59, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "UnpackSnorm2x16", - .opcode = 60, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "UnpackUnorm2x16", - .opcode = 61, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "UnpackHalf2x16", - .opcode = 62, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "UnpackSnorm4x8", - .opcode = 63, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "UnpackUnorm4x8", - .opcode = 64, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "UnpackDouble2x32", - .opcode = 65, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "Length", - .opcode = 66, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "Distance", - .opcode = 67, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "Cross", - .opcode = 68, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "Normalize", - .opcode = 69, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "FaceForward", - .opcode = 70, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "Reflect", - .opcode = 71, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "Refract", - .opcode = 72, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "FindILsb", - .opcode = 73, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "FindSMsb", - .opcode = 74, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "FindUMsb", - .opcode = 75, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "InterpolateAtCentroid", - .opcode = 76, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "InterpolateAtSample", - .opcode = 77, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "InterpolateAtOffset", - .opcode = 78, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "NMin", - .opcode = 79, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "NMax", - .opcode = 80, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - .{ - .name = "NClamp", - .opcode = 81, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - }, - .zig => &.{ - .{ - .name = "InvocationGlobal", - .opcode = 0, - .operands = &.{ - .{ .kind = .id_ref, .quantifier = .required }, - }, - }, - }, + pub fn operands(inst_set: InstructionSet, opcode: Word) ?[]const Operand { + return switch (inst_set) { + .core => if (std.enums.fromInt(Opcode, opcode)) |op| op.operands() else null, + .@"OpenCL.std" => if (std.enums.fromInt(OpenClOpcode, opcode)) |op| op.operands() else null, + .@"GLSL.std.450" => if (std.enums.fromInt(GlslOpcode, opcode)) |op| op.operands() else null, }; } }; diff --git a/src/link/Spirv/Flush.zig b/src/link/Spirv/Flush.zig index a72fcf23f523d235f9acf1b5b0776df42edd2699..c07873869fafb1415441331758c9552f9d26132f 100644 --- a/src/link/Spirv/Flush.zig +++ b/src/link/Spirv/Flush.zig @@ -482,6 +482,7 @@ fn emitCapabilities(flush: *Flush, out: *Section) link.Error!void { } inline for (@typeInfo(spec.Extension).@"enum".field_names) |name| { + if (comptime std.mem.startsWith(u8, name, "v1_")) continue; if (@hasField(std.Target.spirv.Feature, name)) { const feature = @field(std.Target.spirv.Feature, name); if (target.cpu.has(.spirv, feature)) try out.emit(gpa, .OpExtension, .{ .name = name }); diff --git a/tools/gen_spirv_spec.zig b/tools/gen_spirv_spec.zig index d9886a4eb1918af7131f9bb6d21ddc7e65d2e5f8..b9967d378570ede07fa26cfc2aa7870ba9d6fed7 100644 --- a/tools/gen_spirv_spec.zig +++ b/tools/gen_spirv_spec.zig @@ -1,8 +1,8 @@ const std = @import("std"); const Io = std.Io; const Allocator = std.mem.Allocator; +const ExtendedStructSet = std.StringHashMapUnmanaged(void); const assert = std.debug.assert; - const g = @import("spirv/grammar.zig"); const CoreRegistry = g.CoreRegistry; const ExtensionRegistry = g.ExtensionRegistry; @@ -11,49 +11,23 @@ const OperandKind = g.OperandKind; const Enumerant = g.Enumerant; const Operand = g.Operand; -const ExtendedStructSet = std.StringHashMap(void); - -const allowed_vendors = [_][]const u8{ - "KHR", - "EXT", -}; - -fn isAllowedCapability(name: []const u8) bool { - // core capabilities (no vendor suffix) end in a lowercase letter or digit. - const last = name[name.len - 1]; - if (std.ascii.isLower(last) or std.ascii.isDigit(last)) return true; - for (allowed_vendors) |vendor| { - if (std.mem.endsWith(u8, name, vendor)) return true; - } - return false; -} - -fn isAllowedExtension(name: []const u8) bool { - const spv_prefix = "SPV_"; - if (!std.mem.startsWith(u8, name, spv_prefix)) return false; - const tail = name[spv_prefix.len..]; - for (allowed_vendors) |vendor| { - if (std.mem.startsWith(u8, tail, vendor) and - tail.len > vendor.len and tail[vendor.len] == '_') - return true; - } - return false; -} +const allowed_vendors = [_][]const u8{ "KHR", "EXT" }; +const set_names = std.StaticStringMap(struct { []const u8, []const u8 }).initComptime(.{ + .{ "opencl.std.100", .{ "OpenCL.std", "OpenClOpcode" } }, + .{ "glsl.std.450", .{ "GLSL.std.450", "GlslOpcode" } }, +}); const Extension = struct { name: []const u8, opcode_name: []const u8, spec: ExtensionRegistry, }; - const CmpInst = struct { fn lt(_: CmpInst, a: Instruction, b: Instruction) bool { return a.opcode < b.opcode; } }; - const StringPair = struct { []const u8, []const u8 }; - const StringPairContext = struct { pub fn hash(_: @This(), a: StringPair) u32 { var hasher = std.hash.Wyhash.init(0); @@ -70,34 +44,24 @@ const StringPairContext = struct { return std.mem.eql(u8, a_x, b_x) and std.mem.eql(u8, a_y, b_y); } }; - const OperandKindMap = std.array_hash_map.Custom(StringPair, OperandKind, StringPairContext, true); -/// Khronos made it so that these names are not defined explicitly, so -/// we need to hardcode it (like they did). -/// See https://github.com/KhronosGroup/SPIRV-Registry -const set_names = std.StaticStringMap(struct { []const u8, []const u8 }).initComptime(.{ - .{ "opencl.std.100", .{ "OpenCL.std", "OpenClOpcode" } }, - .{ "glsl.std.450", .{ "GLSL.std.450", "GlslOpcode" } }, - .{ "zig", .{ "zig", "Zig" } }, -}); - pub fn main(init: std.process.Init) !void { + const io = init.io; const arena = init.arena.allocator(); const args = try init.minimal.args.toSlice(arena); - if (args.len != 3) { + if (args.len != 2) { usageAndExit(args[0], 1); } - const io = init.io; - const json_path = try Io.Dir.path.join(arena, &.{ args[1], "include/spirv/unified1/" }); const dir = try Io.Dir.cwd().openDir(io, json_path, .{ .iterate = true }); - const core_spec = try readRegistry(io, arena, CoreRegistry, dir, "spirv.core.grammar.json"); + var core_spec = try readRegistry(io, arena, CoreRegistry, dir, "spirv.core.grammar.json"); std.mem.sortUnstable(Instruction, core_spec.instructions, CmpInst{}, CmpInst.lt); + keepEnabled(&core_spec.instructions, core_spec.operand_kinds); - var exts = std.array_list.Managed(Extension).init(arena); + var exts: std.ArrayList(Extension) = .empty; var it = dir.iterate(); while (try it.next(io)) |entry| { @@ -108,8 +72,6 @@ pub fn main(init: std.process.Init) !void { try readExtRegistry(io, arena, &exts, dir, entry.name); } - try readExtRegistry(io, arena, &exts, Io.Dir.cwd(), args[2]); - var allocating: std.Io.Writer.Allocating = .init(arena); defer allocating.deinit(); try render(arena, &allocating.writer, core_spec, exts.items); @@ -117,7 +79,6 @@ pub fn main(init: std.process.Init) !void { const output = allocating.written()[0 .. allocating.written().len - 1 :0]; var tree = try std.zig.Ast.parse(arena, output, .{}); - if (tree.errors.len != 0) { try std.zig.printAstErrorsToStderr(arena, io, tree, "", .auto); return; @@ -138,7 +99,7 @@ pub fn main(init: std.process.Init) !void { try Io.File.stdout().writeStreamingAll(io, formatted_output); } -fn readExtRegistry(io: Io, arena: Allocator, exts: *std.array_list.Managed(Extension), dir: Io.Dir, sub_path: []const u8) !void { +fn readExtRegistry(io: Io, arena: Allocator, exts: *std.ArrayList(Extension), dir: Io.Dir, sub_path: []const u8) !void { const filename = Io.Dir.path.basename(sub_path); if (!std.mem.startsWith(u8, filename, "extinst.")) { return; @@ -146,16 +107,17 @@ fn readExtRegistry(io: Io, arena: Allocator, exts: *std.array_list.Managed(Exten assert(std.mem.endsWith(u8, filename, ".grammar.json")); const name = filename["extinst.".len .. filename.len - ".grammar.json".len]; - const spec = try readRegistry(io, arena, ExtensionRegistry, dir, sub_path); + var spec = try readRegistry(io, arena, ExtensionRegistry, dir, sub_path); const set_name = set_names.get(name) orelse { std.log.info("ignored instruction set '{s}'", .{name}); return; }; - std.sort.block(Instruction, spec.instructions, CmpInst{}, CmpInst.lt); + std.mem.sort(Instruction, spec.instructions, CmpInst{}, CmpInst.lt); + keepEnabled(&spec.instructions, spec.operand_kinds); - try exts.append(.{ + try exts.append(arena, .{ .name = set_name.@"0", .opcode_name = set_name.@"1", .spec = spec, @@ -164,8 +126,6 @@ fn readExtRegistry(io: Io, arena: Allocator, exts: *std.array_list.Managed(Exten fn readRegistry(io: Io, arena: Allocator, comptime RegistryType: type, dir: Io.Dir, path: []const u8) !RegistryType { const spec = try dir.readFileAlloc(io, path, arena, .unlimited); - // Required for json parsing. - // TODO: ALI @setEvalBranchQuota(10000); var scanner = std.json.Scanner.initCompleteInput(arena, spec); @@ -178,11 +138,9 @@ fn readRegistry(io: Io, arena: Allocator, comptime RegistryType: type, dir: Io.D return parsed.value; } -/// Returns a set with types that require an extra struct for the `Instruction` interface -/// to the spir-v spec, or whether the original type can be used. fn extendedStructs(arena: Allocator, kinds: []const OperandKind) !ExtendedStructSet { - var map = ExtendedStructSet.init(arena); - try map.ensureTotalCapacity(@as(u32, @intCast(kinds.len))); + var map: ExtendedStructSet = .empty; + try map.ensureTotalCapacity(arena, @as(u32, @intCast(kinds.len))); for (kinds) |kind| { const enumerants = kind.enumerants orelse continue; @@ -199,10 +157,6 @@ fn extendedStructs(arena: Allocator, kinds: []const OperandKind) !ExtendedStruct return map; } -// Return a score for a particular priority. Duplicate instruction/operand enum values are -// removed by picking the tag with the lowest score to keep, and by making an alias for the -// other. Note that the tag does not need to be just a tag at this point, in which case it -// gets the lowest score automatically anyway. fn tagPriorityScore(tag: []const u8) usize { if (tag.len == 0) { return 1; @@ -223,45 +177,52 @@ fn render( ) !void { try writer.writeAll( \\//! This file is auto-generated by tools/gen_spirv_spec.zig. - \\ \\const std = @import("std"); \\ + \\pub const Word = u32; \\pub const Version = packed struct(Word) { \\ padding: u8 = 0, \\ minor: u8, \\ major: u8, \\ padding0: u8 = 0, - \\ - \\ pub fn toWord(self: @This()) Word { - \\ return @bitCast(self); - \\ } \\}; - \\ - \\pub const Word = u32; + \\pub const Generator = packed struct(Word) { + \\ version: u16, + \\ tool: u16, + \\}; + \\pub const Header = extern struct { + \\ magic: Word, + \\ version: Version, + \\ generator: Generator, + \\ id_bound: Word, + \\ schema: Word, + \\}; + \\pub const InstructionHeader = packed struct(Word) { + \\ opcode: Opcode, + \\ word_count: u16, + \\}; \\pub const Id = enum(Word) { \\ none, \\ _, \\ - \\ pub fn format(self: Id, writer: *std.Io.Writer) std.Io.Writer.Error!void { - \\ switch (self) { + \\ pub fn format(id: Id, writer: *std.Io.Writer) std.Io.Writer.Error!void { + \\ switch (id) { \\ .none => try writer.writeAll("(none)"), - \\ else => try writer.print("%{d}", .{@intFromEnum(self)}), + \\ else => try writer.print("%{d}", .{@backingInt(id)}), \\ } \\ } \\}; - \\ \\pub const IdRange = struct { \\ base: u32, \\ len: u32, \\ \\ pub fn at(range: IdRange, i: usize) Id { \\ std.debug.assert(i < range.len); - \\ return @enumFromInt(range.base + i); + \\ return @fromBackingInt(@intCast(range.base + i)); \\ } \\}; \\ \\pub const LiteralInteger = Word; - \\pub const LiteralFloat = Word; \\pub const LiteralString = []const u8; \\pub const LiteralContextDependentNumber = union(enum) { \\ int32: i32, @@ -285,7 +246,7 @@ fn render( \\ \\pub const Operand = struct { \\ kind: OperandKind, - \\ quantifier: Quantifier, + \\ quantifier: Quantifier = .required, \\}; \\ \\pub const OperandCategory = enum { @@ -299,16 +260,10 @@ fn render( \\pub const Enumerant = struct { \\ name: []const u8, \\ value: Word, - \\ parameters: []const OperandKind, + \\ parameters: []const Operand, \\}; \\ - \\pub const Instruction = struct { - \\ name: []const u8, - \\ opcode: Word, - \\ operands: []const Operand, - \\}; - \\ - \\pub const zig_generator_id: Word = 41; + \\pub const zig_generator_id: u16 = 41; \\ ); @@ -321,17 +276,11 @@ fn render( .{ registry.major_version, registry.minor_version, registry.revision, registry.magic_number }, ); - // Merge the operand kinds from all extensions together. var all_operand_kinds: OperandKindMap = .empty; for (registry.operand_kinds) |kind| { try all_operand_kinds.putNoClobber(arena, .{ "core", kind.kind }, kind); } for (extensions) |ext| { - // Note: extensions may define the same operand kind, with different - // parameters. Instead of trying to merge them, just discriminate them - // using the name of the extension. This is similar to what - // the official headers do. - try all_operand_kinds.ensureUnusedCapacity(arena, ext.spec.operand_kinds.len); for (ext.spec.operand_kinds) |kind| { var new_kind = kind; @@ -340,19 +289,19 @@ fn render( } } - const extended_structs = try extendedStructs(arena, all_operand_kinds.values()); - // Note: extensions don't seem to have class. + const kinds = all_operand_kinds.values(); + const extended_structs = try extendedStructs(arena, kinds); try renderClass(arena, writer, registry.instructions); - try renderOperandKind(writer, all_operand_kinds.values()); + try renderOperandKind(writer, kinds); - try renderOpcodes(arena, writer, "Opcode", true, registry.instructions, extended_structs); + try renderOpcodes(arena, writer, "core", "Opcode", true, registry.instructions, extended_structs, all_operand_kinds); for (extensions) |ext| { - try renderOpcodes(arena, writer, ext.opcode_name, false, ext.spec.instructions, extended_structs); + try renderOpcodes(arena, writer, ext.name, ext.opcode_name, false, ext.spec.instructions, extended_structs, all_operand_kinds); } - try renderOperandKinds(arena, writer, all_operand_kinds.values(), extended_structs); - try renderInstructionSet(writer, registry, extensions, all_operand_kinds); - try renderExtension(arena, writer, all_operand_kinds.values()); + try renderOperandKinds(arena, writer, kinds, extended_structs); + try renderInstructionSet(writer, extensions); + try renderExtension(arena, writer, kinds); } fn renderExtension( @@ -378,7 +327,6 @@ fn renderExtension( for (kinds) |kind| { if (std.mem.eql(u8, "Capability", kind.kind)) { for (kind.enumerants.?) |enumerant| { - if (!isAllowedCapability(enumerant.enumerant)) continue; for (enumerant.extensions) |ext| { if (!isAllowedExtension(ext)) continue; if (seen_extensions.contains(ext)) continue; @@ -393,9 +341,7 @@ fn renderExtension( fn renderInstructionSet( writer: *std.Io.Writer, - core: CoreRegistry, extensions: []const Extension, - all_operand_kinds: OperandKindMap, ) !void { try writer.writeAll( \\pub const InstructionSet = enum { @@ -408,14 +354,17 @@ fn renderInstructionSet( try writer.writeAll( \\ - \\ pub fn instructions(self: InstructionSet) []const Instruction { - \\ return switch (self) { + \\ pub fn operands(inst_set: InstructionSet, opcode: Word) ?[]const Operand { + \\ return switch (inst_set) { + \\ .core => if (std.enums.fromInt(Opcode, opcode)) |op| op.operands() else null, \\ ); - try renderInstructionsCase(writer, "core", core.instructions, all_operand_kinds); for (extensions) |ext| { - try renderInstructionsCase(writer, ext.name, ext.spec.instructions, all_operand_kinds); + try writer.print( + " .{f} => if (std.enums.fromInt({f}, opcode)) |op| op.operands() else null,\n", + .{ std.zig.fmtId(ext.name), std.zig.fmtId(ext.opcode_name) }, + ); } try writer.writeAll( @@ -426,54 +375,6 @@ fn renderInstructionSet( ); } -fn renderInstructionsCase( - writer: *std.Io.Writer, - set_name: []const u8, - instructions: []const Instruction, - all_operand_kinds: OperandKindMap, -) !void { - // Note: theoretically we could dedup from tags and give every instruction a list of aliases, - // but there aren't so many total aliases and that would add more overhead in total. We will - // just filter those out when needed. - - try writer.print(".{f} => &.{{\n", .{std.zig.fmtId(set_name)}); - - for (instructions) |inst| { - try writer.print( - \\.{{ - \\ .name = "{s}", - \\ .opcode = {}, - \\ .operands = &.{{ - \\ - , .{ inst.opname, inst.opcode }); - - for (inst.operands) |operand| { - const quantifier = if (operand.quantifier) |q| - switch (q) { - .@"?" => "optional", - .@"*" => "variadic", - } - else - "required"; - - const kind = all_operand_kinds.get(.{ set_name, operand.kind }) orelse - all_operand_kinds.get(.{ "core", operand.kind }).?; - try writer.print(".{{.kind = .{f}, .quantifier = .{s}}},\n", .{ formatId(kind.kind), quantifier }); - } - - try writer.writeAll( - \\ }, - \\}, - \\ - ); - } - - try writer.writeAll( - \\}, - \\ - ); -} - fn renderClass(arena: Allocator, writer: *std.Io.Writer, instructions: []const Instruction) !void { var class_map: std.array_hash_map.String(void) = .empty; @@ -513,7 +414,6 @@ const Formatter = struct { } } - // make sure that this won't clobber with zig keywords try writer.print("{f}", .{std.zig.fmtId(fw.buffered())}); } }; @@ -533,8 +433,8 @@ fn renderOperandKind(writer: *std.Io.Writer, operands: []const OperandKind) !voi } try writer.writeAll( \\ - \\pub fn category(self: OperandKind) OperandCategory { - \\ return switch (self) { + \\pub fn category(operand_kind: OperandKind) OperandCategory { + \\ return switch (operand_kind) { \\ .opcode => .literal, \\ ); @@ -551,8 +451,8 @@ fn renderOperandKind(writer: *std.Io.Writer, operands: []const OperandKind) !voi try writer.writeAll( \\ }; \\} - \\pub fn enumerants(self: OperandKind) []const Enumerant { - \\ return switch (self) { + \\pub fn enumerants(operand_kind: OperandKind) []const Enumerant { + \\ return switch (operand_kind) { \\ .opcode => unreachable, \\ ); @@ -575,7 +475,24 @@ fn renderOperandKind(writer: *std.Io.Writer, operands: []const OperandKind) !voi } try writer.writeAll("},\n"); } - try writer.writeAll("};\n}\n};\n"); + try writer.writeAll( + \\}; + \\} + \\ + \\pub fn bases(operand_kind: OperandKind) []const OperandKind { + \\ return switch (operand_kind) { + \\ + ); + for (operands) |operand| { + if (operand.category != .Composite) continue; + try writer.print(".{f} => &.{{", .{formatId(operand.kind)}); + for (operand.bases.?, 0..) |base, i| { + if (i != 0) try writer.writeAll(", "); + try writer.print(".{f}", .{formatId(base)}); + } + try writer.writeAll("},\n"); + } + try writer.writeAll("else => unreachable,\n};\n}\n};\n"); } fn renderEnumerant(writer: *std.Io.Writer, enumerant: Enumerant) !void { @@ -588,8 +505,7 @@ fn renderEnumerant(writer: *std.Io.Writer, enumerant: Enumerant) !void { for (enumerant.parameters, 0..) |param, i| { if (i != 0) try writer.writeAll(", "); - // Note, param.quantifier will always be one. - try writer.print(".{f}", .{formatId(param.kind)}); + try writer.print(".{{ .kind = .{f} }}", .{formatId(param.kind)}); } try writer.writeAll("}}"); } @@ -597,16 +513,18 @@ fn renderEnumerant(writer: *std.Io.Writer, enumerant: Enumerant) !void { fn renderOpcodes( arena: Allocator, writer: *std.Io.Writer, + set_name: []const u8, opcode_type_name: []const u8, want_operands: bool, instructions: []const Instruction, extended_structs: ExtendedStructSet, + all_operand_kinds: OperandKindMap, ) !void { var inst_map: std.array_hash_map.Auto(u32, usize) = .empty; try inst_map.ensureTotalCapacity(arena, instructions.len); - var aliases = std.array_list.Managed(struct { inst: usize, alias: usize }).init(arena); - try aliases.ensureTotalCapacity(instructions.len); + var aliases: std.ArrayList(struct { inst: usize, alias: usize }) = .empty; + try aliases.ensureTotalCapacity(arena, instructions.len); for (instructions, 0..) |inst, i| { if (inst.class) |class| { @@ -651,13 +569,45 @@ fn renderOpcodes( }); } + try writer.print( + \\ + \\pub fn operands(opcode: {f}) []const Operand {{ + \\ return switch (opcode) {{ + \\ + , .{std.zig.fmtId(opcode_type_name)}); + + for (instructions_indices) |i| { + const inst = instructions[i]; + try writer.print(".{f} => &.{{", .{std.zig.fmtId(inst.opname)}); + for (inst.operands, 0..) |operand, j| { + const kind = all_operand_kinds.get(.{ set_name, operand.kind }) orelse + all_operand_kinds.get(.{ "core", operand.kind }).?; + if (j != 0) try writer.writeAll(", "); + try writer.print(".{{ .kind = .{f}", .{formatId(kind.kind)}); + if (operand.quantifier) |quantifier| { + try writer.print(", .quantifier = .{s}", .{switch (quantifier) { + .@"?" => "optional", + .@"*" => "variadic", + }}); + } + try writer.writeAll(" }"); + } + try writer.writeAll("},\n"); + } + + try writer.writeAll( + \\ }; + \\} + \\ + ); + if (want_operands) { - try writer.print( + try writer.writeAll( \\ - \\pub fn Operands(comptime self: {f}) type {{ - \\ return switch (self) {{ + \\pub fn Operands(comptime opcode: Opcode) type { + \\ return switch (opcode) { \\ - , .{std.zig.fmtId(opcode_type_name)}); + ); for (instructions_indices) |i| { const inst = instructions[i]; @@ -670,19 +620,104 @@ fn renderOpcodes( \\ ); - try writer.print( - \\pub fn class(self: {f}) Class {{ - \\ return switch (self) {{ + try writer.writeAll( \\ - , .{std.zig.fmtId(opcode_type_name)}); + \\pub fn class(opcode: Opcode) Class { + \\ return switch (@backingInt(opcode)) { + \\ + ); - for (instructions_indices) |i| { - const inst = instructions[i]; - try writer.print(".{f} => .{f},\n", .{ std.zig.fmtId(inst.opname), formatId(inst.class.?) }); + var first: usize = 0; + while (first < instructions_indices.len) { + const class = instructions[instructions_indices[first]].class.?; + var last = first; + while (last + 1 < instructions_indices.len and + std.mem.eql(u8, instructions[instructions_indices[last + 1]].class.?, class)) last += 1; + const lo = instructions[instructions_indices[first]].opcode; + const hi = instructions[instructions_indices[last]].opcode; + if (lo == hi) { + try writer.print("{d} => .{f},\n", .{ lo, formatId(class) }); + } else { + try writer.print("{d}...{d} => .{f},\n", .{ lo, hi, formatId(class) }); + } + first = last + 1; } try writer.writeAll( - \\ }; + \\ else => unreachable, + \\ }; + \\} + \\ + \\pub fn resultIndex(opcode: Opcode) ?u8 { + \\ const list = opcode.operands(); + \\ if (list.len == 0) return null; + \\ return switch (list[0].kind) { + \\ .id_result => 1, + \\ .id_result_type => 2, + \\ else => null, + \\ }; + \\} + \\ + \\pub fn instructionSize(comptime opcode: Opcode, ops: opcode.Operands()) usize { + \\ return operandsSize(opcode.Operands(), ops) + 1; + \\} + \\ + \\fn operandsSize(comptime T: type, ops: T) usize { + \\ const info = switch (@typeInfo(T)) { + \\ .@"struct" => |info| info, + \\ .void => return 0, + \\ else => unreachable, + \\ }; + \\ + \\ var total: usize = 0; + \\ inline for (info.field_names, info.field_types) |field_name, field_type| { + \\ total += operandSize(field_type, @field(ops, field_name)); + \\ } + \\ + \\ return total; + \\} + \\ + \\fn operandSize(comptime T: type, operand: T) usize { + \\ return switch (T) { + \\ LiteralSpecConstantOpInteger => unreachable, + \\ Id, LiteralInteger, LiteralExtInstInteger => 1, + \\ LiteralString => @divCeil(operand.len + 1, @sizeOf(Word)), + \\ LiteralContextDependentNumber => switch (operand) { + \\ .int32, .uint32, .float32 => 1, + \\ .int64, .uint64, .float64 => 2, + \\ }, + \\ PairLiteralIntegerIdRef, PairIdRefLiteralInteger, PairIdRefIdRef => 2, + \\ else => switch (@typeInfo(T)) { + \\ .@"enum" => 1, + \\ .optional => |info| if (operand) |child| operandSize(info.child, child) else 0, + \\ .pointer => |info| blk: { + \\ std.debug.assert(info.size == .slice); + \\ var total: usize = 0; + \\ for (operand) |item| { + \\ total += operandSize(info.child, item); + \\ } + \\ break :blk total; + \\ }, + \\ .@"struct" => |struct_info| { + \\ if (struct_info.layout == .@"packed") return 1; + \\ var total: usize = 0; + \\ inline for (struct_info.field_names, struct_info.field_types) |field_name, field_type| { + \\ switch (@typeInfo(field_type)) { + \\ .optional => |info| if (@field(operand, field_name)) |child| { + \\ total += operandsSize(info.child, child); + \\ }, + \\ .bool, .int => {}, + \\ else => unreachable, + \\ } + \\ } + \\ return total + 1; + \\ }, + \\ .@"union" => switch (operand) { + \\ inline else => |op, tag| operandsSize(@FieldType(T, @tagName(tag)), op) + 1, + \\ }, + \\ else => unreachable, + \\ }, + \\ }; \\} \\ ); @@ -720,13 +755,12 @@ fn renderValueEnum( var enum_map: std.array_hash_map.Auto(u32, usize) = .empty; try enum_map.ensureTotalCapacity(arena, enumerants.len); - var aliases = std.array_list.Managed(struct { enumerant: usize, alias: usize }).init(arena); - try aliases.ensureTotalCapacity(enumerants.len); + var aliases: std.ArrayList(struct { enumerant: usize, alias: usize }) = .empty; + try aliases.ensureTotalCapacity(arena, enumerants.len); for (enumerants, 0..) |enumerant, i| { const value: u31 = switch (enumerant.value) { .int => |value| value, - // Some extensions declare ints as string .bitflag => |value| try std.fmt.parseInt(u31, value, 10), }; const result = enum_map.getOrPutAssumeCapacity(value); @@ -751,15 +785,10 @@ fn renderValueEnum( const enum_indices = enum_map.values(); - const is_capability = std.mem.eql(u8, "Capability", enumeration.kind); - try writer.print("pub const {f} = enum(u32) {{\n", .{std.zig.fmtId(enumeration.kind)}); for (enum_indices) |i| { const enumerant = enumerants[i]; - if (is_capability and !isAllowedCapability(enumerant.enumerant)) continue; - // if (enumerant.value != .int) return error.InvalidRegistry; - switch (enumerant.value) { .int => |value| try writer.print("{f} = {},\n", .{ formatId(enumerant.enumerant), value }), .bitflag => |value| try writer.print("{f} = {s},\n", .{ formatId(enumerant.enumerant), value }), @@ -769,8 +798,6 @@ fn renderValueEnum( try writer.writeByte('\n'); for (aliases.items) |alias| { - if (is_capability and (!isAllowedCapability(enumerants[alias.enumerant].enumerant) or - !isAllowedCapability(enumerants[alias.alias].enumerant))) continue; try writer.print("pub const {f} = {f}.{f};\n", .{ formatId(enumerants[alias.enumerant].enumerant), std.zig.fmtId(enumeration.kind), @@ -778,32 +805,23 @@ fn renderValueEnum( }); } - if (is_capability) { + if (std.mem.eql(u8, "Capability", enumeration.kind)) { try writer.writeAll( \\ \\pub fn dependencies(self: Capability) []const Extension { \\ return switch (self) { ); - for (enum_indices) |i| { const enumerant = enumerants[i]; - if (!isAllowedCapability(enumerant.enumerant)) continue; - - // Convert version to enum. - // None is for reserved - // Example: "None" -> .v1_0 - // Example: "1.5" -> .v1_5 const enum_version = enumerant.version.?; - const version: [4]u8 = .{ 'v', '1', '_', if (enum_version[0] == 'N') '0' else enum_version[2] }; - - try writer.print("\n.{f} => &.{{.{s},", .{ formatId(enumerant.enumerant), version }); + const minor = if (enum_version[0] == 'N') '0' else enum_version[2]; + try writer.print("\n.{f} => &.{{.v1_{c}", .{ formatId(enumerant.enumerant), minor }); for (enumerant.extensions) |extension| { if (!isAllowedExtension(extension)) continue; - try writer.print(".{s},", .{extension}); + try writer.print(", .{s}", .{extension}); } try writer.writeAll("},"); } - try writer.writeAll( \\}; \\} @@ -834,22 +852,20 @@ fn renderBitEnum( enumeration: OperandKind, extended_structs: ExtendedStructSet, ) !void { - try writer.print("pub const {f} = packed struct {{\n", .{std.zig.fmtId(enumeration.kind)}); + try writer.print("pub const {f} = packed struct(Word) {{\n", .{std.zig.fmtId(enumeration.kind)}); var flags_by_bitpos: [32]?usize = @splat(null); const enumerants = enumeration.enumerants orelse return error.InvalidRegistry; - var aliases = std.array_list.Managed(struct { flag: usize, alias: u5 }).init(arena); - try aliases.ensureTotalCapacity(enumerants.len); + var aliases: std.ArrayList(struct { flag: usize, alias: u5 }) = .empty; + try aliases.ensureTotalCapacity(arena, enumerants.len); for (enumerants, 0..) |enumerant, i| { if (enumerant.value != .bitflag) return error.InvalidRegistry; const value = try parseHexInt(enumerant.value.bitflag); if (value == 0) { - continue; // Skip 'none' items + continue; } else if (std.mem.eql(u8, enumerant.enumerant, "FlagIsPublic")) { - // This flag is special and poorly defined in the json files. - // Just skip it for now continue; } @@ -872,14 +888,14 @@ fn renderBitEnum( } } - for (flags_by_bitpos, 0..) |maybe_flag_index, bitpos| { - if (maybe_flag_index) |flag_index| { - try writer.print("{f}", .{formatId(enumerants[flag_index].enumerant)}); - } else { - try writer.print("_reserved_bit_{}", .{bitpos}); - } - - try writer.writeAll(": bool = false,\n"); + var bitpos: usize = 0; + while (bitpos < flags_by_bitpos.len) { + const flag_index = flags_by_bitpos[bitpos] orelse { + bitpos = try renderReservedBits(writer, flags_by_bitpos, bitpos); + continue; + }; + try writer.print("{f}: bool = false,\n", .{formatId(enumerants[flag_index].enumerant)}); + bitpos += 1; } try writer.writeByte('\n'); @@ -899,19 +915,31 @@ fn renderBitEnum( try writer.print("\npub const Extended = struct {{\n", .{}); - for (flags_by_bitpos, 0..) |maybe_flag_index, bitpos| { - const flag_index = maybe_flag_index orelse { - try writer.print("_reserved_bit_{}: bool = false,\n", .{bitpos}); + bitpos = 0; + while (bitpos < flags_by_bitpos.len) { + const flag_index = flags_by_bitpos[bitpos] orelse { + bitpos = try renderReservedBits(writer, flags_by_bitpos, bitpos); continue; }; const enumerant = enumerants[flag_index]; - try renderOperand(writer, .mask, enumerant.enumerant, enumerant.parameters, extended_structs, true); + bitpos += 1; } try writer.writeAll("};\n};\n"); } +fn renderReservedBits(writer: *std.Io.Writer, flags_by_bitpos: [32]?usize, start: usize) !usize { + var end = start + 1; + while (end < flags_by_bitpos.len and flags_by_bitpos[end] == null) end += 1; + if (end == start + 1) { + try writer.print("_reserved_bit_{}: bool = false,\n", .{start}); + } else { + try writer.print("_reserved_bits_{}_to_{}: u{} = 0,\n", .{ start, end - 1, end - start }); + } + return end; +} + fn renderOperand( writer: *std.Io.Writer, kind: enum { @@ -1001,8 +1029,6 @@ fn renderFieldName(writer: *std.Io.Writer, operands: []const Operand, field_inde const operand = operands[field_index]; derive_from_kind: { - // Operand names are often in the json encoded as "'Name'" (with two sets of quotes). - // Additionally, some operands have ~ in them at the end (D~ref~). const name = std.mem.trim(u8, operand.name, "'~"); if (name.len == 0) break :derive_from_kind; @@ -1019,8 +1045,6 @@ fn renderFieldName(writer: *std.Io.Writer, operands: []const Operand, field_inde try writer.print("{f}", .{formatId(operand.kind)}); - // For fields derived from type name, there could be any amount. - // Simply check against all other fields, and if another similar one exists, add a number. const need_extra_index = for (operands, 0..) |other_operand, i| { if (i != field_index and std.mem.eql(u8, operand.kind, other_operand.kind)) { break true; @@ -1032,6 +1056,62 @@ fn renderFieldName(writer: *std.Io.Writer, operands: []const Operand, field_inde } } +fn isAllowedCapability(name: []const u8) bool { + const last = name[name.len - 1]; + if (std.ascii.isLower(last) or std.ascii.isDigit(last)) return true; + for (allowed_vendors) |vendor| { + if (std.mem.endsWith(u8, name, vendor)) return true; + } + return false; +} + +fn isAllowedExtension(name: []const u8) bool { + const spv_prefix = "SPV_"; + if (!std.mem.startsWith(u8, name, spv_prefix)) return false; + const tail = name[spv_prefix.len..]; + for (allowed_vendors) |vendor| { + if (std.mem.startsWith(u8, tail, vendor) and + tail.len > vendor.len and tail[vendor.len] == '_') + return true; + } + return false; +} + +fn isEnabled(version: ?[]const u8, capabilities: []const []const u8, extensions: []const []const u8) bool { + if (version) |v| if (!std.mem.eql(u8, v, "None")) return true; + if (extensions.len != 0) { + for (extensions) |ext| if (isAllowedExtension(ext)) return true; + return false; + } + if (capabilities.len == 0) return true; + for (capabilities) |cap| if (isAllowedCapability(cap)) return true; + return false; +} + +fn keepEnabled(instructions: *[]Instruction, kinds: []OperandKind) void { + var kept: usize = 0; + for (instructions.*) |inst| { + if (!isEnabled(inst.version, inst.capabilities, inst.extensions)) continue; + instructions.*[kept] = inst; + kept += 1; + } + instructions.* = instructions.*[0..kept]; + for (kinds) |*kind| { + const enumerants = kind.enumerants orelse continue; + var kept_enumerants: usize = 0; + for (enumerants) |enumerant| { + const enabled = if (std.mem.eql(u8, kind.kind, "Capability")) + isAllowedCapability(enumerant.enumerant) + else + isEnabled(enumerant.version, enumerant.capabilities, enumerant.extensions); + if (!enabled) continue; + enumerants[kept_enumerants] = enumerant; + kept_enumerants += 1; + } + kind.enumerants = enumerants[0..kept_enumerants]; + } +} + fn parseHexInt(text: []const u8) !u31 { const prefix = "0x"; if (!std.mem.startsWith(u8, text, prefix)) @@ -1043,11 +1123,11 @@ fn usageAndExit(arg0: []const u8, code: u8) noreturn { const stderr = std.debug.lockStderr(&.{}); const w = &stderr.file_writer.interface; w.print( - \\Usage: {s} + \\Usage: {s} \\ \\Generates Zig bindings for SPIR-V specifications found in the SPIRV-Headers \\repository. The result, printed to stdout, should be used to update - \\files in src/codegen/spirv. Don't forget to format the output. + \\src/codegen/spirv/spec.zig. \\ \\ should point to a clone of \\https://github.com/KhronosGroup/SPIRV-Headers/ -- 2.54.0 From 65b95b0af42b3da0aaa86c9448e32e8aca388a17 Mon Sep 17 00:00:00 2001 From: Ali Cheraghi Date: Sun, 13 Sep 2026 16:41:22 +0330 Subject: [PATCH 3/5] add unskip_spirv_tests.zig tool --- test/behavior/addrspace_and_linksection.zig | 4 + test/behavior/align.zig | 1 + test/behavior/array.zig | 2 +- test/behavior/basic.zig | 6 + test/behavior/bitcast.zig | 1 - test/behavior/call.zig | 2 + test/behavior/comptime_memory.zig | 2 + test/behavior/decl_literals.zig | 1 - test/behavior/defer.zig | 1 + test/behavior/enum.zig | 1 - test/behavior/error.zig | 4 +- test/behavior/eval.zig | 13 + test/behavior/export_builtin.zig | 2 + test/behavior/floatop.zig | 7 - test/behavior/generics.zig | 1 + test/behavior/globals.zig | 6 +- test/behavior/if.zig | 1 + test/behavior/inline_switch.zig | 2 - test/behavior/ir_block_deps.zig | 1 - test/behavior/math.zig | 1 + test/behavior/null.zig | 1 + test/behavior/optional.zig | 6 +- test/behavior/packed-struct.zig | 9 - test/behavior/pointers.zig | 2 + test/behavior/shuffle.zig | 1 - test/behavior/sizeof_and_typeof.zig | 1 + test/behavior/slice.zig | 3 +- test/behavior/splat.zig | 1 + test/behavior/struct.zig | 7 +- test/behavior/switch.zig | 11 +- test/behavior/switch_loop.zig | 2 - test/behavior/switch_prong_implicit_cast.zig | 1 - test/behavior/threadlocal.zig | 1 - test/behavior/tuple.zig | 2 + test/behavior/type.zig | 2 + test/behavior/union.zig | 14 +- test/behavior/vector.zig | 1 - test/behavior/while.zig | 5 + test/standalone/build.zig | 1 + tools/unskip_spirv_tests.zig | 264 +++++++++++++++++++ 40 files changed, 331 insertions(+), 63 deletions(-) create mode 100644 tools/unskip_spirv_tests.zig diff --git a/test/behavior/addrspace_and_linksection.zig b/test/behavior/addrspace_and_linksection.zig index 5af04595baa0005f47bd9c35e0cd1833f0c895b8..a340ee4b6e79c55dc75cef12e4255abccccc9fb9 100644 --- a/test/behavior/addrspace_and_linksection.zig +++ b/test/behavior/addrspace_and_linksection.zig @@ -12,6 +12,8 @@ const var_linksection = linksections.?[1]; const fn_linksection = linksections.?[2]; test "addrspace on container-level const" { + if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; + const S = struct { const a: u32 addrspace(.generic) = 123; fn check(ptr: anytype) !void { @@ -47,6 +49,8 @@ test "addrspace and linksection on container-level const" { } test "addrspace on container-level var" { + if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; + const S = struct { var a: u32 addrspace(.generic) = 123; fn check(ptr: anytype) !void { diff --git a/test/behavior/align.zig b/test/behavior/align.zig index c9294e953b8d2c907a8b86e2c6b5916b1d75941a..b3333c2d233d7ed448338dea9a9b9a6220594244 100644 --- a/test/behavior/align.zig +++ b/test/behavior/align.zig @@ -467,6 +467,7 @@ var default_aligned_global = DefaultAligned{ }; test "read 128-bit field from default aligned struct in global memory" { + if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO diff --git a/test/behavior/array.zig b/test/behavior/array.zig index 6c228f76eba5fed6d0899a74e0a5544cb94efa66..dfafeeaf271ae03bf3e02553ffe9873d795cfb58 100644 --- a/test/behavior/array.zig +++ b/test/behavior/array.zig @@ -582,6 +582,7 @@ test "array with comptime-only element type" { } test "tuple to array handles sentinel" { + if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO @@ -936,7 +937,6 @@ test "accessing multidimensional global array at comptime" { test "union that needs padding bytes inside an array" { if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; - if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO diff --git a/test/behavior/basic.zig b/test/behavior/basic.zig index 42c85b0487e2d024adf394300c165feaa126d325..07bf89c9348748786f7b337e5cee3084d8f18b98 100644 --- a/test/behavior/basic.zig +++ b/test/behavior/basic.zig @@ -60,6 +60,7 @@ const g1: i32 = 1233 + 1; var g2: i32 = 0; test "global variables" { + if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO try expect(g2 == 0); @@ -683,6 +684,7 @@ var gdt = [_]GDTEntry{ var global_ptr = &gdt[0]; test "global constant is loaded with a runtime-known index" { + if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO const S = struct { @@ -999,6 +1001,8 @@ test "generic function uses return type of other generic function" { } test "const alloc with comptime-known initializer is made comptime-known" { + if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; + const S = struct { a: bool, b: [2]u8, @@ -1079,6 +1083,8 @@ test "inline call of function with a switch inside the return statement" { } test "pointer to zero sized global is mutable" { + if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; + const S = struct { const Thing = struct {}; diff --git a/test/behavior/bitcast.zig b/test/behavior/bitcast.zig index d790d68416add0ba62603eaabaa691d1bdfe9c32..e0bac5c59aa8caca367af85a394b61d32bc94058 100644 --- a/test/behavior/bitcast.zig +++ b/test/behavior/bitcast.zig @@ -110,7 +110,6 @@ test "@bitCast packed structs at runtime and comptime" { if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO - if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; const Full = packed struct { number: u16, diff --git a/test/behavior/call.zig b/test/behavior/call.zig index 5f2b24b6b72eadd8dfffa6998ee996e292ed381c..b096123a3d3c8af6dfe1b6e994a4f1809724fb2c 100644 --- a/test/behavior/call.zig +++ b/test/behavior/call.zig @@ -538,6 +538,8 @@ test "call function pointer in comptime field" { } test "generic function pointer can be called" { + if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; + const S = struct { var ok = false; fn foo(x: anytype) void { diff --git a/test/behavior/comptime_memory.zig b/test/behavior/comptime_memory.zig index 2e4989a7e6ee1f0065469b23aa04e631a7b56c6b..979e6a3752e533596d7f1c5bb1a5af4e33a40b49 100644 --- a/test/behavior/comptime_memory.zig +++ b/test/behavior/comptime_memory.zig @@ -431,6 +431,8 @@ test "type pun @ptrFromInt" { } test "type pun null pointer-like optional" { + if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; + const p: ?*u8 = null; // note that expectEqual hides the bug try testing.expect(@as(*const ?*i8, @ptrCast(&p)).* == null); diff --git a/test/behavior/decl_literals.zig b/test/behavior/decl_literals.zig index 5d237778757f3c2f2a3faa160668f26debfee9f9..08576cf4a6980ee7e855627094513a59cf780544 100644 --- a/test/behavior/decl_literals.zig +++ b/test/behavior/decl_literals.zig @@ -35,7 +35,6 @@ test "decl literal with pointer" { test "call decl literal with optional" { if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; - if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; const S = struct { x: u32, diff --git a/test/behavior/defer.zig b/test/behavior/defer.zig index 1a999c32c01a30dfe4c0cf98cdca5642c8b83511..be22d37ea2f9c71f5fd44dbbb5db099136e4cf14 100644 --- a/test/behavior/defer.zig +++ b/test/behavior/defer.zig @@ -89,6 +89,7 @@ fn runSomeErrorDefers(x: bool) !bool { } test "mixing normal and error defers" { + if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO diff --git a/test/behavior/enum.zig b/test/behavior/enum.zig index fb3501d4541d006092b270d4b5cf2bf85ca686c1..6eacd6a5194dd16f116f4b7bab0cfe12c5faa8e0 100644 --- a/test/behavior/enum.zig +++ b/test/behavior/enum.zig @@ -930,7 +930,6 @@ test "constant enum initialization with differing sizes" { if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; - if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; try test3_1(test3_foo); try test3_2(test3_bar); } diff --git a/test/behavior/error.zig b/test/behavior/error.zig index ab8d8ddf1d70d7916304ec513faa3a0a84a7d003..53c4614d6965927691943ade8f359833f74d5a73 100644 --- a/test/behavior/error.zig +++ b/test/behavior/error.zig @@ -524,7 +524,6 @@ test "function pointer with return type that is error union with payload which i } test "return result loc as peer result loc in inferred error set function" { - if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO @@ -783,6 +782,7 @@ const NoReturn = struct { }; test "error union of noreturn used with if" { + if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; @@ -796,6 +796,7 @@ test "error union of noreturn used with if" { } test "error union of noreturn used with try" { + if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; @@ -806,6 +807,7 @@ test "error union of noreturn used with try" { } test "error union of noreturn used with catch" { + if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; diff --git a/test/behavior/eval.zig b/test/behavior/eval.zig index f86ab963d2a4ea5dd0cec5493f583ac672a174e7..50e264c1df6fbfc7bdbc3c8c8e0784f33f642ed3 100644 --- a/test/behavior/eval.zig +++ b/test/behavior/eval.zig @@ -5,6 +5,8 @@ const expect = std.testing.expect; const expectEqual = std.testing.expectEqual; test "compile time recursion" { + if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; + try expect(some_data.len == 21); } var some_data: [@as(usize, @intCast(fibonacci(7)))]u8 = undefined; @@ -388,6 +390,7 @@ test "return 0 from function that has u0 return type" { } test "statically initialized struct" { + if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO st_init_str_foo.x += 1; @@ -927,6 +930,7 @@ test "closure capture type of runtime-known var" { } test "comptime break passing through runtime condition converted to runtime break" { + if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO const S = struct { @@ -959,6 +963,7 @@ test "comptime break passing through runtime condition converted to runtime brea } test "comptime break to outer loop passing through runtime condition converted to runtime break" { + if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO @@ -1158,6 +1163,8 @@ test "repeated value is correctly expanded" { } test "value in if block is comptime-known" { + if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; + const first = blk: { const s = if (false) "a" else "b"; break :blk "foo" ++ s; @@ -1266,6 +1273,8 @@ test "continue in inline for inside a comptime switch" { } test "length of global array is determinable at comptime" { + if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; + const S = struct { var bytes: [1024]u8 = undefined; @@ -1313,6 +1322,7 @@ test "continue nested inline for loop in named block expr" { } test "x and false is comptime-known false" { + if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO const T = struct { @@ -1340,6 +1350,7 @@ test "x and false is comptime-known false" { } test "x or true is comptime-known true" { + if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO const T = struct { @@ -1401,6 +1412,8 @@ test "comptime function turns function value to function pointer" { } test "container level const and var have unique addresses" { + if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; + const S = struct { x: i32, y: i32, diff --git a/test/behavior/export_builtin.zig b/test/behavior/export_builtin.zig index 0381e9645488d4565a56c16630c9e937e152df61..84187b403168c6ee2e786ea0e51f1fccf3c447c8 100644 --- a/test/behavior/export_builtin.zig +++ b/test/behavior/export_builtin.zig @@ -4,6 +4,7 @@ const expect = std.testing.expect; test "exporting enum value" { if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; + if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; const S = struct { const E = enum(c_int) { one, two }; @@ -29,6 +30,7 @@ test "exporting with internal linkage" { test "exporting using namespace access" { if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; + if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; const S = struct { const Inner = struct { diff --git a/test/behavior/floatop.zig b/test/behavior/floatop.zig index dbd2deb0fd5c4ef49546d1ef0f533211c642de01..cb6910fdaf2c1caf3c95737f538a1deea88fe2ff 100644 --- a/test/behavior/floatop.zig +++ b/test/behavior/floatop.zig @@ -464,7 +464,6 @@ test "@sqrt with vectors" { if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; - if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; try testSqrtWithVectors(); try comptime testSqrtWithVectors(); @@ -532,7 +531,6 @@ test "@sin with vectors" { if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; - if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; try testSinWithVectors(); try comptime testSinWithVectors(); @@ -600,7 +598,6 @@ test "@cos with vectors" { if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; - if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; try testCosWithVectors(); try comptime testCosWithVectors(); @@ -668,7 +665,6 @@ test "@tan with vectors" { if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; - if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; try testTanWithVectors(); try comptime testTanWithVectors(); @@ -740,7 +736,6 @@ test "@exp with vectors" { if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; - if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; try testExpWithVectors(); try comptime testExpWithVectors(); @@ -807,7 +802,6 @@ test "@exp2 with @vectors" { if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; - if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; try testExp2WithVectors(); try comptime testExp2WithVectors(); @@ -939,7 +933,6 @@ test "@log2 with vectors" { if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; - if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; // https://github.com/ziglang/zig/issues/13681 if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .aarch64 and diff --git a/test/behavior/generics.zig b/test/behavior/generics.zig index e17ea4fdd682672e5315832c936993dce36355ae..a30529a193a20693b87158fe7ad90079c1f00c8b 100644 --- a/test/behavior/generics.zig +++ b/test/behavior/generics.zig @@ -516,6 +516,7 @@ test "comptime callconv(.c) function ptr uses comptime type argument" { } test "call generic function with from function called by the generic function" { + if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO diff --git a/test/behavior/globals.zig b/test/behavior/globals.zig index eab88cdfbdc4da73079c041fdc71cde54ba16821..bb3ba105e92d324d6b2b58b8c49f6ee643d82594 100644 --- a/test/behavior/globals.zig +++ b/test/behavior/globals.zig @@ -4,6 +4,7 @@ const expect = std.testing.expect; var pos = [2]f32{ 0.0, 0.0 }; test "store to global array" { + if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; @@ -14,6 +15,7 @@ test "store to global array" { var vpos = @Vector(2, f32){ 0.0, 0.0 }; test "store to global vector" { + if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; @@ -66,8 +68,6 @@ test "global loads can affect liveness" { } test "global const can be self-referential" { - if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; - const S = struct { self: *const @This(), x: u32, @@ -112,8 +112,6 @@ test "global var can be self-referential" { } test "global const can be indirectly self-referential" { - if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; - const S = struct { other: *const @This(), x: u32, diff --git a/test/behavior/if.zig b/test/behavior/if.zig index 78151da211bc9103f15d7f69dc43c31c7d5f63a9..449c6e4c5f4d73e5e1f8e84b4435df11d608da87 100644 --- a/test/behavior/if.zig +++ b/test/behavior/if.zig @@ -44,6 +44,7 @@ var global_with_val: anyerror!u32 = 0; var global_with_err: anyerror!u32 = error.SomeError; test "unwrap mutable global var" { + if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO if (global_with_val) |v| { diff --git a/test/behavior/inline_switch.zig b/test/behavior/inline_switch.zig index 676ef30874b6fa4685f70ae5a8cb31118a89a208..54c41f4fac3bd5c1a386a95b55a590c257aa1afe 100644 --- a/test/behavior/inline_switch.zig +++ b/test/behavior/inline_switch.zig @@ -4,7 +4,6 @@ const builtin = @import("builtin"); test "inline scalar prongs" { if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO - if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; var x: usize = 0; switch (x) { @@ -19,7 +18,6 @@ test "inline scalar prongs" { test "inline prong ranges" { if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO - if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; var x: usize = 0; _ = &x; diff --git a/test/behavior/ir_block_deps.zig b/test/behavior/ir_block_deps.zig index d4218387ecd6987feaaa1c751947b2b27e8fb01f..4708af87f4bd27060125a8e2c0e111e0996badab 100644 --- a/test/behavior/ir_block_deps.zig +++ b/test/behavior/ir_block_deps.zig @@ -19,7 +19,6 @@ fn getErrInt() anyerror!i32 { test "ir block deps" { if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO - if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO try expect((foo(1) catch unreachable) == 0); diff --git a/test/behavior/math.zig b/test/behavior/math.zig index 259b9dfe7c3aa908713374a60e21116d6e1edb73..88d83ba60d052ef5da1c23f8226325e41c885f8c 100644 --- a/test/behavior/math.zig +++ b/test/behavior/math.zig @@ -2570,6 +2570,7 @@ test "partially-runtime integer vector division would be illegal if vector eleme if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; + if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .hexagon) return error.SkipZigTest; var lhs: @Vector(2, i8) = .{ -128, 5 }; diff --git a/test/behavior/null.zig b/test/behavior/null.zig index 7b6806428d7fdecd2cc381fabe1b16126967226c..ba9ce5127b9539b2e00b85486d33ac28a141d3de 100644 --- a/test/behavior/null.zig +++ b/test/behavior/null.zig @@ -183,6 +183,7 @@ const SillyStruct = struct { const here_is_a_null_literal = SillyStruct{ .context = null }; test "unwrap optional which is field of global var" { + if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO diff --git a/test/behavior/optional.zig b/test/behavior/optional.zig index 4d54d96ad9bb702e85228464f02664aa3187824d..4a6695fd5ec46df9bb5abb5b86de558a4a136ab6 100644 --- a/test/behavior/optional.zig +++ b/test/behavior/optional.zig @@ -319,7 +319,6 @@ test "assigning to an unwrapped optional field in an inline loop" { test "coerce an anon struct literal to optional struct" { if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO - if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; const S = struct { const Struct = struct { @@ -388,7 +387,6 @@ test "0-bit child type coerced to optional" { test "array of optional unaligned types" { if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO - if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; const Enum = enum { one, two, three }; @@ -477,6 +475,7 @@ const NoReturn = struct { }; test "optional of noreturn used with if" { + if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO NoReturn.a = 64; @@ -488,6 +487,7 @@ test "optional of noreturn used with if" { } test "optional of noreturn used with orelse" { + if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO NoReturn.a = 64; @@ -652,8 +652,6 @@ test "result location initialization of optional with OPV payload" { } test "global comptime only optional" { - if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; - const S = struct { const @"null": ?*type = null; const @"void": ?*const type = &void; diff --git a/test/behavior/packed-struct.zig b/test/behavior/packed-struct.zig index 045c19767454b64d970fe6c7a46dafcb9b2a1ac4..82256ba7782d503b1c476a28785841aba3bf4bbc 100644 --- a/test/behavior/packed-struct.zig +++ b/test/behavior/packed-struct.zig @@ -794,7 +794,6 @@ test "nested packed struct at non-zero offset 2" { test "runtime init of unnamed packed struct type" { if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO - if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; var z: u8 = 123; _ = &z; @@ -889,7 +888,6 @@ test "store undefined to packed result location" { if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; - if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; var x: u4 = 0; _ = &x; @@ -910,7 +908,6 @@ test "bitcast back and forth" { // Originally reported at https://github.com/ziglang/zig/issues/14200 test "field access of packed struct smaller than its abi size inside struct initialized with rls" { if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; - if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; // TODO const S = struct { @@ -1006,7 +1003,6 @@ test "packed struct acts as a namespace" { test "assignment to non-byte-aligned field in packed struct" { if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO - if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; // TODO const Frame = packed struct { @@ -1046,7 +1042,6 @@ test "load flag from packed struct in union" { if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO - if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; const A = packed struct { @@ -1168,7 +1163,6 @@ test "packed struct equality" { test "packed struct equality ignores padding bits" { if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; - if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; const S = packed struct { b: bool }; var s: S = undefined; @@ -1178,7 +1172,6 @@ test "packed struct equality ignores padding bits" { } test "packed struct with signed field" { - if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; var s: packed struct { @@ -1193,7 +1186,6 @@ test "packed struct with signed field" { test "assign packed struct initialized with RLS to packed struct literal field" { if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; - if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; const Inner = packed struct { x: u17 }; const Outer = packed struct { inner: Inner, x: u15 }; @@ -1209,7 +1201,6 @@ test "assign packed struct initialized with RLS to packed struct literal field" test "packed struct store of comparison result" { if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; - if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; // TODO const S1 = packed struct { diff --git a/test/behavior/pointers.zig b/test/behavior/pointers.zig index 7f75454495996b29620880b5ee180d8261261970..23b976f02ac63e4bdd418fd6d8a512e930fb8dd7 100644 --- a/test/behavior/pointers.zig +++ b/test/behavior/pointers.zig @@ -642,6 +642,8 @@ test "result type preserved through multiple references" { } test "result type found through optional pointer" { + if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; + const ptr1: ?*const u32 = &@intCast(123); const ptr2: ?[]const u8 = &.{ @intCast(123), @truncate(0xABCD) }; try expect(ptr1.?.* == 123); diff --git a/test/behavior/shuffle.zig b/test/behavior/shuffle.zig index e61e8f17a8d940c94b054228894bf6d799aa4c8d..0ba5f6f72882c0f3e5ec029198b429f99f7810dd 100644 --- a/test/behavior/shuffle.zig +++ b/test/behavior/shuffle.zig @@ -176,7 +176,6 @@ test "@shuffle u0" { if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; - if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; const S = struct { fn doTheTest() !void { diff --git a/test/behavior/sizeof_and_typeof.zig b/test/behavior/sizeof_and_typeof.zig index 96b17e2151712787ebf63f4f1cc7b8cbaecaf139..9e881ff480fbad959f7c8479ec771786c88881bc 100644 --- a/test/behavior/sizeof_and_typeof.zig +++ b/test/behavior/sizeof_and_typeof.zig @@ -134,6 +134,7 @@ test "@TypeOf() has no runtime side effects" { } test "branching logic inside @TypeOf" { + if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; const S = struct { diff --git a/test/behavior/slice.zig b/test/behavior/slice.zig index e3685562e5259913edfcd99590a1452bbafb7075..a08e134cb75a554598372275d7381c973ed435fb 100644 --- a/test/behavior/slice.zig +++ b/test/behavior/slice.zig @@ -254,8 +254,6 @@ test "slicing pointer by length" { const x = @as([*]i32, @ptrFromInt(0x1000))[0..0x500]; const y = x[0x100..]; test "compile time slice of pointer to hard coded address" { - if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; - try expect(@intFromPtr(x) == 0x1000); try expect(x.len == 0x500); @@ -858,6 +856,7 @@ test "slice len modification at comptime" { } test "slice field ptr const" { + if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; const const_slice: []const u8 = "string"; const const_ptr_const_slice = &const_slice; diff --git a/test/behavior/splat.zig b/test/behavior/splat.zig index 7ffb02017d456c7a854021251d6e567d7395ddca..859dfd8634e8ce9cd6d425194d182740b44d87ac 100644 --- a/test/behavior/splat.zig +++ b/test/behavior/splat.zig @@ -92,6 +92,7 @@ test "splat with an error union or optional result type" { } test "read/write through global variable array of struct fields initialized via splat" { + if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO diff --git a/test/behavior/struct.zig b/test/behavior/struct.zig index 2aa7920ab4b17ae56df165a880d3242e3a3fedb0..00a42d3b384540b891f4962a3add671b453064da 100644 --- a/test/behavior/struct.zig +++ b/test/behavior/struct.zig @@ -443,6 +443,7 @@ test "packed struct 24bits" { } test "runtime struct initialization of bitfield" { + if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO @@ -714,6 +715,7 @@ test "packed struct with u0 field access" { } test "access to global struct fields" { + if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO g_foo.bar.value = 42; @@ -943,7 +945,6 @@ test "tuple element initialized with fn call" { } test "struct with union field" { - if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO @@ -1081,7 +1082,6 @@ test "anon init through error unions and optionals" { test "anon init through optional" { if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO - if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; const S = struct { a: u32, @@ -1760,6 +1760,8 @@ test "circular dependency through pointer field of a struct" { } test "field calls do not force struct field init resolution" { + if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; + const S = struct { x: u32 = blk: { _ = @TypeOf(make().dummyFn()); // runtime field call - S not fully resolved - dummyFn call should not force field init resolution @@ -1985,6 +1987,7 @@ test "assignment of field with padding" { } test "initiate global variable with runtime value" { + if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO diff --git a/test/behavior/switch.zig b/test/behavior/switch.zig index c5ffdfa3e1872bfa58edb53b414b523660e9a9bb..25eb5159357c06134f6b8e2f3fa5276528b7d4c4 100644 --- a/test/behavior/switch.zig +++ b/test/behavior/switch.zig @@ -252,6 +252,7 @@ fn poll() void { } test "switch on global mutable var isn't constant-folded" { + if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO while (state < 2) { @@ -270,7 +271,6 @@ test "switch prong with variable" { if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; - if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; try switchProngWithVarFn(SwitchProngWithVarEnum{ .One = 13 }); try switchProngWithVarFn(SwitchProngWithVarEnum{ .Two = 13.0 }); @@ -294,7 +294,6 @@ fn switchProngWithVarFn(a: SwitchProngWithVarEnum) !void { test "switch on enum using pointer capture" { if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO - if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; try testSwitchEnumPtrCapture(); try comptime testSwitchEnumPtrCapture(); @@ -570,7 +569,6 @@ test "switch with null and T peer types and inferred result location type" { test "switch prongs with cases with identical payload types" { if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO - if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; const Union = union(enum) { A: usize, @@ -726,7 +724,6 @@ test "switch on error set with single else" { test "switch capture copies its payload" { if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO - if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; const S = struct { fn doTheTest() !void { @@ -788,7 +785,6 @@ test "enum value without tag name used as switch item" { } test "switch item sizeof" { - if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; const S = struct { fn doTheTest() !void { var a: usize = 0; @@ -817,8 +813,6 @@ test "comptime inline switch" { } test "switch capture peer type resolution" { - if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; - const U = union(enum) { a: u32, b: u64, @@ -835,7 +829,6 @@ test "switch capture peer type resolution" { test "switch capture peer type resolution for in-memory coercible payloads" { if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; - if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; const T1 = c_int; const t1_info = @typeInfo(T1).int; @@ -1166,8 +1159,6 @@ test "switch with uninstantiable union fields" { } test "switch with tag capture" { - if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; - const U = union(enum) { a, b: i32, diff --git a/test/behavior/switch_loop.zig b/test/behavior/switch_loop.zig index caaea13e7f8aa3571a0f3f34c7b05b0ee37eea3b..f45ef3ef4113b493fc434f75ba1fe5c6a0111945 100644 --- a/test/behavior/switch_loop.zig +++ b/test/behavior/switch_loop.zig @@ -96,7 +96,6 @@ test "switch loop on tagged union" { if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO - if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; const S = struct { @@ -291,7 +290,6 @@ test "switch loop with discarded tag capture" { } test "switch loop with single catch-all prong" { - if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; const S = struct { const E = enum { a, b, c }; const U = union(E) { a: u32, b: u16, c: u8 }; diff --git a/test/behavior/switch_prong_implicit_cast.zig b/test/behavior/switch_prong_implicit_cast.zig index aab365f027ea17273c77e05bf96da48cfbedd612..0de343898df9a5b0a47b381bd25d45c0d265cb91 100644 --- a/test/behavior/switch_prong_implicit_cast.zig +++ b/test/behavior/switch_prong_implicit_cast.zig @@ -18,7 +18,6 @@ test "switch prong implicit cast" { if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO - if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; const result = switch (foo(2) catch unreachable) { FormValue.One => false, diff --git a/test/behavior/threadlocal.zig b/test/behavior/threadlocal.zig index ec1ce0b62677b9cbb4988814e4c69f94ae65548c..9c888bf762dd521cd3a6d53e0faebffe02d13bc0 100644 --- a/test/behavior/threadlocal.zig +++ b/test/behavior/threadlocal.zig @@ -6,7 +6,6 @@ test "thread local variable" { if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO - if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; // TODO const S = struct { diff --git a/test/behavior/tuple.zig b/test/behavior/tuple.zig index 1d6ec8a6e43e70e2472777143cec18e586c3397f..6be6c65fb51292a7982337dab704dadb6b4336e4 100644 --- a/test/behavior/tuple.zig +++ b/test/behavior/tuple.zig @@ -548,6 +548,8 @@ test "OPV tuple fields aren't comptime" { } test "array of tuples that end with a zero-bit field followed by padding" { + if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; + const S = struct { var foo: [2]struct { u32, u8, void } = .{ .{ 1, 2, {} }, .{ 3, 4, {} } }; }; diff --git a/test/behavior/type.zig b/test/behavior/type.zig index 875e77ffcb037bce22bf124d5ecea3689913d163..5f310bd4729aeb51b755e50a1eafa4d38d8e5c82 100644 --- a/test/behavior/type.zig +++ b/test/behavior/type.zig @@ -406,6 +406,8 @@ test "matching captures causes opaque equivalence" { } test "reify enum where fields refers to part of array" { + if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; + const field_names: [3][]const u8 = .{ "foo", "bar", undefined }; const field_values: [3]u8 = .{ undefined, 0, 1 }; const E = @Enum(u8, .exhaustive, field_names[0..2], field_values[1..3]); diff --git a/test/behavior/union.zig b/test/behavior/union.zig index 0ba364aabe557a0bac5832d285cc4595dc9cec25..083da4df4bf67ae8b6d36a4a5dd3d1394f1f8ff4 100644 --- a/test/behavior/union.zig +++ b/test/behavior/union.zig @@ -442,6 +442,7 @@ const Foo1 = union(enum) { var glbl: Foo1 = undefined; test "global union with single field is correctly initialized" { + if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO @@ -551,7 +552,6 @@ const Baz = enum { A, B, C, D }; test "tagged union type" { if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO - if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; const foo1 = TaggedFoo{ .One = 13 }; const foo2 = TaggedFoo{ @@ -576,7 +576,6 @@ test "tagged union as return value" { if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; - if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; switch (returnAnInt(13)) { TaggedFoo.One => |value| try expect(value == 13), @@ -619,7 +618,6 @@ test "union(enum(u32)) with specified and unspecified tag values" { if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO - if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; comptime assert(Tag(Tag(MultipleChoice2)) == u32); try testEnumWithSpecifiedAndUnspecifiedTagValues(MultipleChoice2{ .C = 123 }); @@ -709,7 +707,6 @@ test "union with only 1 field casted to its enum type which has enum value speci test "@intFromEnum works on unions" { if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO - if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; const Bar = union(enum) { A: bool, @@ -793,7 +790,6 @@ test "@unionInit stored to a const" { if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; - if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; const S = struct { const U = union(enum) { @@ -823,7 +819,6 @@ test "@unionInit stored to a const" { test "@unionInit can modify a union type" { if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO - if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; const UnionInitEnum = union(enum) { Boolean: bool, @@ -846,7 +841,6 @@ test "@unionInit can modify a union type" { test "@unionInit can modify a pointer value" { if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO - if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; const UnionInitEnum = union(enum) { Boolean: bool, @@ -954,7 +948,6 @@ test "function call result coerces from tagged union to the tag" { test "switching on non exhaustive union" { if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO - if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; const S = struct { const E = enum(u8) { @@ -1256,7 +1249,6 @@ test "@unionInit uses tag value instead of field index" { if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; - if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; const E = enum(u8) { b = 255, a = 3, @@ -1414,6 +1406,8 @@ test "reinterpreting enum value inside packed union" { } test "access the tag of a global tagged union" { + if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; + const U = union(enum) { a, b: u8, @@ -2005,7 +1999,6 @@ test "circular dependency through pointer field of a union" { test "pass nested union with rls" { if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; - if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; const Union = union(enum) { a: u32, @@ -2052,7 +2045,6 @@ test "runtime union init, most-aligned field != largest" { test "copied union field doesn't alias source" { if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO - if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; const U = union(enum) { array: [10]u32, diff --git a/test/behavior/vector.zig b/test/behavior/vector.zig index 0566293f9066147a7a717866b2be28f739555fb2..912b189f3926f43eced3fd093592db8d26a8c7fd 100644 --- a/test/behavior/vector.zig +++ b/test/behavior/vector.zig @@ -378,7 +378,6 @@ test "array of non-abi-sized integer to vector of same type" { if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO - if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; const S = struct { fn doTheTest() !void { diff --git a/test/behavior/while.zig b/test/behavior/while.zig index d62495589b9458a441aaed0000514f60a0942528..f08c045c831cdb2b2cecd99c6b968c2b869b8cf1 100644 --- a/test/behavior/while.zig +++ b/test/behavior/while.zig @@ -122,6 +122,8 @@ test "while copies its payload" { } test "continue and break" { + if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; + try runContinueAndBreakTest(); try expect(continue_and_break_counter == 8); } @@ -140,6 +142,7 @@ fn runContinueAndBreakTest() !void { } test "while with optional as condition" { + if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; @@ -153,6 +156,7 @@ test "while with optional as condition" { } test "while with optional as condition with else" { + if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; @@ -171,6 +175,7 @@ test "while with optional as condition with else" { } test "while with error union condition" { + if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; diff --git a/test/standalone/build.zig b/test/standalone/build.zig index fa1c4186abcd7da988acfcda5ca30ed966d62a80..ab4262c8b90686517cf32f90b7b99263c72d3969 100644 --- a/test/standalone/build.zig +++ b/test/standalone/build.zig @@ -44,6 +44,7 @@ pub fn build(b: *std.Build) void { "../../tools/generate_linux_syscalls.zig", "../../tools/process_headers.zig", "../../tools/migrate_langref.zig", + "../../tools/unskip_spirv_tests.zig", "../../tools/update-linux-headers.zig", "../../tools/update_clang_options.zig", "../../tools/update_cpu_features.zig", diff --git a/tools/unskip_spirv_tests.zig b/tools/unskip_spirv_tests.zig new file mode 100644 index 0000000000000000000000000000000000000000..a3100d9846bf9897c570a7c0c09fe710a899034a --- /dev/null +++ b/tools/unskip_spirv_tests.zig @@ -0,0 +1,264 @@ +const std = @import("std"); +const Io = std.Io; +const Allocator = std.mem.Allocator; +const Ast = std.zig.Ast; + +const usage = + \\Usage: unskip_spirv_tests [test/behavior/*.zig ...] + \\ + \\For example: + \\zig run tools/unskip_spirv_tests.zig -- zig-out/bin/zig \ + \\ ../zig-spirv-test-executor/src/test_runner.zig \ + \\ ../zig-spirv-test-executor/zig-out/bin/zig-spirv-test-executor [files...] + \\ + \\Runs every behavior test that is skipped on stage2_spirv in isolation and + \\removes the skip if the test passes. + \\ +; + +const Test = struct { + body: Ast.Node.Index, + name: []const u8, + skip: ?Ast.Node.Index, +}; + +pub fn main(init: std.process.Init) !void { + const io = init.io; + const arena = init.arena.allocator(); + + var args = try init.minimal.args.iterateAllocator(arena); + _ = args.skip(); + const zig = args.next() orelse std.process.fatal(usage, .{}); + const test_runner = args.next() orelse std.process.fatal(usage, .{}); + const test_cmd = args.next() orelse std.process.fatal(usage, .{}); + + var files: std.ArrayList([]const u8) = .empty; + while (args.next()) |path| try files.append(arena, path); + + if (files.items.len == 0) { + var dir = try Io.Dir.openDir(.cwd(), io, "test/behavior", .{ .iterate = true }); + defer dir.close(io); + + var it = dir.iterate(); + while (try it.next(io)) |entry| { + if (entry.kind != .file or !std.mem.endsWith(u8, entry.name, ".zig")) continue; + const path = try std.fs.path.join(arena, &.{ "test/behavior", entry.name }); + const source = try Io.Dir.readFileAlloc(.cwd(), io, path, arena, .unlimited); + if (std.mem.find(u8, source, "stage2_spirv") != null) { + try files.append(arena, path); + } + } + } + + var stdout_buffer: [4096]u8 = undefined; + var stdout_writer = Io.File.stdout().writer(io, &stdout_buffer); + const stdout = &stdout_writer.interface; + + const progress = std.Progress.start(io, .{ .estimated_total_items = files.items.len }); + const cache_dir = init.environ_map.get("ZIG_LOCAL_CACHE_DIR") orelse ".zig-cache"; + const variant_dir = try std.fs.path.join(arena, &.{ cache_dir, "unskip" }); + try Io.Dir.createDirPath(.cwd(), io, variant_dir); + + var failures: std.array_hash_map.String(std.ArrayList([]const u8)) = .empty; + var total_removed: usize = 0; + var files_changed: usize = 0; + for (files.items) |path| { + const basename = std.fs.path.basename(path); + const source = try Io.Dir.readFileAlloc(.cwd(), io, path, arena, .unlimited); + const ast = try Ast.parse(arena, try arena.dupeSentinel(u8, source, 0), .{}); + if (ast.errors.len != 0) std.process.fatal("{s}: parse error", .{path}); + + var tests: std.ArrayList(Test) = .empty; + var skips: usize = 0; + for (ast.rootDecls()) |decl| { + if (ast.nodeTag(decl) != .test_decl) continue; + const name_token, const body = ast.nodeData(decl).opt_token_and_node; + const token = name_token.unwrap() orelse continue; + const name = if (ast.tokenTag(token) == .string_literal) + try std.zig.string_literal.parseAlloc(arena, ast.tokenSlice(token)) + else + ast.tokenSlice(token); + + var buffer: [2]Ast.Node.Index = undefined; + const skip: ?Ast.Node.Index = for (ast.blockStatements(&buffer, body) orelse &.{}) |statement| { + const if_full = ast.fullIf(statement) orelse continue; + if (ast.nodeTag(if_full.ast.cond_expr) != .equal_equal) continue; + _, const rhs = ast.nodeData(if_full.ast.cond_expr).node_and_node; + if (!std.mem.eql(u8, ast.getNodeSource(rhs), ".stage2_spirv")) continue; + if (ast.nodeTag(if_full.ast.then_expr) != .@"return") continue; + const value = ast.nodeData(if_full.ast.then_expr).opt_node.unwrap() orelse continue; + if (!std.mem.eql(u8, ast.getNodeSource(value), "error.SkipZigTest")) continue; + break statement; + } else null; + skips += @intFromBool(skip != null); + + try tests.append(arena, .{ .body = body, .name = name, .skip = skip }); + } + + if (skips == 0) { + progress.completeOne(); + continue; + } + + const file_node = progress.start(basename, skips); + defer file_node.end(); + const variant_path = try std.fs.path.join(arena, &.{ variant_dir, basename }); + + var removed: Ast.Render.Fixups = .{}; + for (tests.items) |candidate| { + const skip = candidate.skip orelse continue; + const test_node = file_node.start(candidate.name, 0); + defer test_node.end(); + + var fixups: Ast.Render.Fixups = .{}; + try fixups.omit_nodes.put(arena, skip, {}); + for (tests.items) |other| { + if (other.body == candidate.body) continue; + try fixups.replace_nodes_with_string.put(arena, other.body, "{ return error.SkipZigTest; }"); + } + + var variant: Io.Writer.Allocating = .init(arena); + try ast.render(arena, &variant.writer, fixups); + try Io.Dir.writeFile(.cwd(), io, .{ .sub_path = variant_path, .data = variant.written() }); + + const signature: []const u8 = signature: { + const result = std.process.run(arena, io, .{ + .argv = &.{ + zig, "test", variant_path, + "--test-runner", test_runner, "-target", + "spirv64-vulkan", "-mcpu", "vulkan_v1_2+variable_pointers+int64", + "-fno-llvm", "--zig-lib-dir", "lib", + "--test-cmd", test_cmd, "--test-cmd-bin", + }, + .timeout = .{ .duration = .{ .raw = .fromSeconds(120), .clock = .awake } }, + .progress_node = test_node, + }) catch |err| switch (err) { + error.Timeout => break :signature "timeout", + else => |e| return e, + }; + + if (result.term.success()) { + try removed.omit_nodes.put(arena, skip, {}); + std.debug.print("{s}: removed skip for {s}\n", .{ basename, candidate.name }); + continue; + } + + const output = try std.mem.concat(arena, u8, &.{ result.stdout, result.stderr }); + var lines = std.mem.splitScalar(u8, output, '\n'); + while (lines.next()) |line| { + const rest = std.mem.cutPrefix(u8, line, "error: line ") orelse continue; + const colon = std.mem.findScalar(u8, rest, ':') orelse continue; + if (!allDigits(rest[0..colon])) continue; + break :signature try normalize(arena, "spirv-val: ", rest[colon + 1 ..]); + } + lines.reset(); + + while (lines.next()) |line| { + const rest = std.mem.cutPrefix(u8, line, "thread ") orelse continue; + const panic = std.mem.find(u8, rest, " panic: ") orelse continue; + if (std.mem.findScalar(u8, rest[0..panic], ' ') != null) continue; + break :signature try normalize(arena, "panic: ", rest[panic + " panic: ".len ..]); + } + lines.reset(); + + while (lines.next()) |line| { + const marker = std.mem.find(u8, line, ": error: ") orelse continue; + const location = line[0..marker]; + const line_colon = std.mem.findScalarLast(u8, location, ':') orelse continue; + const file_colon = std.mem.findScalarLast(u8, location[0..line_colon], ':') orelse continue; + if (std.mem.findScalar(u8, location[0..file_colon], ' ') != null) continue; + if (!allDigits(location[file_colon + 1 .. line_colon])) continue; + if (!allDigits(location[line_colon + 1 ..])) continue; + const message = line[marker + ": error: ".len ..]; + break :signature try normalize(arena, "compile error: ", message); + } + lines.reset(); + + while (lines.next()) |line| { + const rest = std.mem.cutPrefix(u8, line, "error: ") orelse continue; + break :signature try normalize(arena, "error: ", rest); + } + + if (std.mem.trim(u8, output, &std.ascii.whitespace).len > 0) { + break :signature "unknown failure (no error: line found)"; + } + break :signature "no output"; + }; + + const gop = try failures.getOrPut(arena, signature); + if (!gop.found_existing) gop.value_ptr.* = .empty; + const failed_test = try std.fmt.allocPrint(arena, "{s} :: {s}", .{ basename, candidate.name }); + try gop.value_ptr.append(arena, failed_test); + } + + std.debug.print("{s}: {d}/{d} skips removed\n", .{ basename, removed.omit_nodes.count(), skips }); + Io.Dir.deleteFile(.cwd(), io, variant_path) catch {}; + if (removed.omit_nodes.count() == 0) continue; + + var final: Io.Writer.Allocating = .init(arena); + try ast.render(arena, &final.writer, removed); + const rendered = try Ast.parse(arena, try arena.dupeSentinel(u8, final.written(), 0), .{}); + const formatted = try rendered.renderAlloc(arena); + try Io.Dir.writeFile(.cwd(), io, .{ .sub_path = path, .data = formatted }); + total_removed += removed.omit_nodes.count(); + files_changed += 1; + } + + progress.end(); + + try stdout.print("\nDone: removed {d} spirv skips across {d} files\n", .{ total_removed, files_changed }); + if (failures.count() > 0) { + var total_failures: usize = 0; + for (failures.values()) |failed_tests| total_failures += failed_tests.items.len; + try stdout.print("\nMost common blockers ({d} failing attempts, {d} unique signatures):\n", .{ + total_failures, + failures.count(), + }); + + const Ctx = struct { + failed_tests: []const std.ArrayList([]const u8), + + pub fn lessThan(ctx: @This(), a: usize, b: usize) bool { + return ctx.failed_tests[a].items.len > ctx.failed_tests[b].items.len; + } + }; + failures.sort(Ctx{ .failed_tests = failures.values() }); + + for (failures.keys()[0..@min(failures.count(), 30)], failures.values()) |signature, failed_tests| { + const count = failed_tests.items.len; + const percent = @as(f64, @floatFromInt(count)) * 100 / @as(f64, @floatFromInt(total_failures)); + try stdout.print("{d:4} ({d:5.1}%) {s}\n", .{ count, percent, signature }); + for (failed_tests.items) |failed_test| try stdout.print(" {s}\n", .{failed_test}); + } + } + try stdout.flush(); +} + +fn allDigits(text: []const u8) bool { + if (text.len == 0) return false; + for (text) |c| if (!std.ascii.isDigit(c)) return false; + return true; +} + +fn normalize(arena: Allocator, prefix: []const u8, message: []const u8) ![]u8 { + const source = try arena.dupeSentinel(u8, std.mem.trim(u8, message, &std.ascii.whitespace), 0); + var out: std.ArrayList(u8) = .empty; + try out.appendSlice(arena, prefix); + var tokenizer: std.zig.Tokenizer = .init(source); + var end: usize = 0; + while (true) { + const token = tokenizer.next(); + if (token.tag == .eof) break; + try out.appendSlice(arena, source[end..token.loc.start]); + end = token.loc.end; + const text = source[token.loc.start..token.loc.end]; + try out.appendSlice(arena, switch (token.tag) { + .number_literal => "", + .char_literal, .string_literal => "", + .identifier => if (token.loc.start > 0 and source[token.loc.start - 1] == '%') "" else text, + else => text, + }); + } + try out.appendSlice(arena, source[end..]); + return out.items[0..@min(out.items.len, prefix.len + 200)]; +} -- 2.54.0 From 2d6970dd2c5f4fa7b1b141710d5d319668f0b46b Mon Sep 17 00:00:00 2001 From: Ali Cheraghi Date: Sun, 13 Sep 2026 20:37:15 +0330 Subject: [PATCH 4/5] spirv: accept all image type access qualifiers for vulkan --- src/codegen/spirv/CodeGen.zig | 30 +++++++++++++++---- .../SpirvType_vulkan_target.zig | 19 ++---------- 2 files changed, 28 insertions(+), 21 deletions(-) diff --git a/src/codegen/spirv/CodeGen.zig b/src/codegen/spirv/CodeGen.zig index df127e949b55dcc7401d3dbb7ad53179c7f7d3ef..7c2595beec3d7322284ac8b111d9c71e0be53911 100644 --- a/src/codegen/spirv/CodeGen.zig +++ b/src/codegen/spirv/CodeGen.zig @@ -308,6 +308,21 @@ pub fn generateNav(pt: Zcu.PerThread, nav_index: InternPool.Nav.Index) codegen.E else => {}, } + const image_ty = blk: { + if (ty.zigTypeTag(zcu) == .array or ty.isSpirvRuntimeArray(zcu)) { + break :blk ty.childType(zcu); + } + break :blk ty; + }; + if (image_ty.zigTypeTag(zcu) == .spirv) { + const spirv_type = ip.loadSpirvType(image_ty.toIntern()); + if (spirv_type.flags.tag == .image) switch (spirv_type.flags.access) { + .read_only => try cg.decorate(result_id, .non_writable), + .write_only => try cg.decorate(result_id, .non_readable), + .read_write, .unknown => {}, + }; + } + if (ext.decoration) |decoration| switch (decoration) { .location => |location| { try cg.decorate(result_id, .{ @@ -2237,11 +2252,16 @@ fn resolveType(cg: *CodeGen, ty: Type, repr: Repr) Error!Id { .r32i => .r32i, .r32u => .r32ui, }, - .access_qualifier = switch (spirv_type.flags.access) { - .unknown => null, - .read_only => .read_only, - .write_only => .write_only, - .read_write => .read_write, + .access_qualifier = blk: { + if (target.os.tag == .opencl) { + break :blk switch (spirv_type.flags.access) { + .unknown => null, + .read_only => .read_only, + .write_only => .write_only, + .read_write => .read_write, + }; + } + break :blk null; }, }); }, diff --git a/test/cases/compile_errors/SpirvType_vulkan_target.zig b/test/cases/compile_errors/SpirvType_vulkan_target.zig index 7871365f4ed83ecbda72abff178b24704b6496b8..855eaad9c1ddbc6dc1fcb3f07a7b2bf7b3574fbe 100644 --- a/test/cases/compile_errors/SpirvType_vulkan_target.zig +++ b/test/cases/compile_errors/SpirvType_vulkan_target.zig @@ -1,15 +1,3 @@ -comptime { - _ = @SpirvType(.{ .image = .{ - .usage = .{ .storage = u32 }, - .format = .unknown, - .dim = .@"2d", - .depth = .unknown, - .arrayed = false, - .multisampled = false, - .access = .read_only, - } }); -} - comptime { _ = @SpirvType(.{ .image = .{ .usage = .{ .sampled = bool }, @@ -50,7 +38,6 @@ comptime { // backend=selfhosted // target=spirv32-vulkan // -// :2:21: error: access qualifier '.read_only' is only valid under the 'opencl' OS -// :14:21: error: invalid 'sampled' field value 'bool' -// :26:21: error: 'void' type for 'sampled' field is only valid under the 'opencl' OS -// :38:21: error: 'sampled' field value must be a 32-bit int, 64-bit int or 32-bit float under the 'vulkan' OS +// :2:21: error: invalid 'sampled' field value 'bool' +// :14:21: error: 'void' type for 'sampled' field is only valid under the 'opencl' OS +// :26:21: error: 'sampled' field value must be a 32-bit int, 64-bit int or 32-bit float under the 'vulkan' OS -- 2.54.0 From ec82de3637c3727bfbf2f8f6b014d144256daa95 Mon Sep 17 00:00:00 2001 From: Ali Cheraghi Date: Sun, 13 Sep 2026 21:00:59 +0330 Subject: [PATCH 5/5] spirv: correctly map struct field indices to emitted member --- src/codegen/spirv/CodeGen.zig | 32 ++++++++++++++++++++++++++++++-- test/behavior/struct.zig | 2 -- test/behavior/tuple.zig | 2 -- 3 files changed, 30 insertions(+), 6 deletions(-) diff --git a/src/codegen/spirv/CodeGen.zig b/src/codegen/spirv/CodeGen.zig index 7c2595beec3d7322284ac8b111d9c71e0be53911..fa304a7473a5b0777702830faf79293bc8a05a4f 100644 --- a/src/codegen/spirv/CodeGen.zig +++ b/src/codegen/spirv/CodeGen.zig @@ -6732,7 +6732,7 @@ fn airAggFieldVal(cg: *CodeGen, inst: Air.Inst.Index) !?Id { if (field_ty.isInt(zcu)) return result_id; return try cg.bitCast(field_ty, field_int_ty, result_id); }, - else => return try cg.extractField(field_ty, object_id, field_index), + else => return try cg.extractField(field_ty, object_id, cg.memberIndex(object_ty, field_index)), }, .@"union" => switch (object_ty.containerLayout(zcu)) { .@"packed" => { @@ -6882,7 +6882,8 @@ fn structFieldPtr( return result_id; }, .auto, .@"extern" => { - return try cg.accessChain(result_ty_id, object_ptr, &.{field_index}); + const member_index = cg.memberIndex(object_ty, field_index); + return try cg.accessChain(result_ty_id, object_ptr, &.{member_index}); }, }, .@"union" => switch (object_ty.containerLayout(zcu)) { @@ -6937,6 +6938,33 @@ fn structFieldPtr( } } +fn memberIndex(cg: *CodeGen, struct_ty: Type, field_index: u32) u32 { + const zcu = cg.zcu; + const ip = &zcu.intern_pool; + var index: u32 = 0; + switch (ip.indexToKey(struct_ty.toIntern())) { + .tuple_type => |tuple| { + const types = tuple.types.get(ip)[0..field_index]; + for (types, tuple.values.get(ip)[0..field_index]) |field_ty_index, field_val| { + const field_ty: Type = .fromInterned(field_ty_index); + if (field_val != .none or !field_ty.hasRuntimeBits(zcu)) continue; + index += 1; + } + }, + .struct_type => { + const struct_type = ip.loadStructType(struct_ty.toIntern()); + var it = struct_type.iterateRuntimeOrder(ip); + while (it.next()) |i| { + if (i == field_index) break; + const field_ty: Type = .fromInterned(struct_type.field_types.get(ip)[i]); + if (field_ty.hasRuntimeBits(zcu)) index += 1; + } + }, + else => unreachable, + } + return index; +} + fn airStructFieldPtr(cg: *CodeGen, inst: Air.Inst.Index) !?Id { const ty_pl = cg.air.instructions.items(.data)[@backingInt(inst)].ty_pl; const struct_field = cg.air.extraData(Air.StructField, ty_pl.payload).data; diff --git a/test/behavior/struct.zig b/test/behavior/struct.zig index 00a42d3b384540b891f4962a3add671b453064da..b65833a251ae69f60cdef52c7e0f9eacc0e89e8d 100644 --- a/test/behavior/struct.zig +++ b/test/behavior/struct.zig @@ -1945,8 +1945,6 @@ test "struct field default value is a call" { } test "aggregate initializers should allow initializing comptime fields, verifying equality" { - if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; - var x: u32 = 15; _ = &x; const T = @TypeOf(.{ @as(i32, -1234), @as(u32, 5678), x }); diff --git a/test/behavior/tuple.zig b/test/behavior/tuple.zig index 6be6c65fb51292a7982337dab704dadb6b4336e4..2241de5dcb8d12bab80303496a2b83e0c2e7f376 100644 --- a/test/behavior/tuple.zig +++ b/test/behavior/tuple.zig @@ -203,8 +203,6 @@ test "offsetOf anon struct" { } test "initializing tuple with mixed comptime-runtime fields" { - if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; - var x: u32 = 15; _ = &x; const T = @TypeOf(.{ @as(i32, -1234), @as(u32, 5678), x }); -- 2.54.0