diff options
| author | Robin Voetter <robin@voetter.nl> | 2024-03-02 13:08:21 +0100 |
|---|---|---|
| committer | Robin Voetter <robin@voetter.nl> | 2024-03-18 19:13:50 +0100 |
| commit | 9b18125562b2402cae8450253decd906f09e4dc6 (patch) | |
| tree | 5525843896ccb333dfeb4fe832c565f4e1cd3b49 /src/codegen | |
| parent | 20d7bb68ac7043e7d4ec8f0653ec73a1090187da (diff) | |
| download | zig-9b18125562b2402cae8450253decd906f09e4dc6.tar.gz zig-9b18125562b2402cae8450253decd906f09e4dc6.zip | |
spirv: make generic globals invocation-local
Diffstat (limited to 'src/codegen')
| -rw-r--r-- | src/codegen/spirv.zig | 448 | ||||
| -rw-r--r-- | src/codegen/spirv/Cache.zig | 31 | ||||
| -rw-r--r-- | src/codegen/spirv/Module.zig | 270 | ||||
| -rw-r--r-- | src/codegen/spirv/Section.zig | 11 | ||||
| -rw-r--r-- | src/codegen/spirv/spec.zig | 279 |
5 files changed, 451 insertions, 588 deletions
diff --git a/src/codegen/spirv.zig b/src/codegen/spirv.zig index 97b09c13a2..038265f838 100644 --- a/src/codegen/spirv.zig +++ b/src/codegen/spirv.zig @@ -30,6 +30,8 @@ const SpvAssembler = @import("spirv/Assembler.zig"); const InstMap = std.AutoHashMapUnmanaged(Air.Inst.Index, IdRef); +pub const zig_call_abi_ver = 3; + /// We want to store some extra facts about types as mapped from Zig to SPIR-V. /// This structure is used to keep that extra information, as well as /// the cached reference to the type. @@ -252,15 +254,18 @@ pub const Object = struct { /// Note: Function does not actually generate the decl, it just allocates an index. pub fn resolveDecl(self: *Object, mod: *Module, decl_index: InternPool.DeclIndex) !SpvModule.Decl.Index { const decl = mod.declPtr(decl_index); + assert(decl.has_tv); // TODO: Do we need to handle a situation where this is false? try mod.markDeclAlive(decl); const entry = try self.decl_link.getOrPut(self.gpa, decl_index); if (!entry.found_existing) { // TODO: Extern fn? - const kind: SpvModule.DeclKind = if (decl.val.isFuncBody(mod)) + const kind: SpvModule.Decl.Kind = if (decl.val.isFuncBody(mod)) .func - else - .global; + else switch (decl.@"addrspace") { + .generic => .invocation_global, + else => .global, + }; entry.value_ptr.* = try self.spv.allocDecl(kind); } @@ -443,87 +448,90 @@ const DeclGen = struct { return self.inst_results.get(index).?; // Assertion means instruction does not dominate usage. } - fn resolveAnonDecl(self: *DeclGen, val: InternPool.Index, storage_class: StorageClass) !IdRef { + fn resolveAnonDecl(self: *DeclGen, val: InternPool.Index) !IdRef { // TODO: This cannot be a function at this point, but it should probably be handled anyway. + + const mod = self.module; + const ty = Type.fromInterned(mod.intern_pool.typeOf(val)); + const decl_ptr_ty_ref = try self.ptrType(ty, .Generic); + const spv_decl_index = blk: { - const entry = try self.object.anon_decl_link.getOrPut(self.object.gpa, .{ val, storage_class }); + const entry = try self.object.anon_decl_link.getOrPut(self.object.gpa, .{ val, .Function }); if (entry.found_existing) { - try self.addFunctionDep(entry.value_ptr.*, storage_class); - return self.spv.declPtr(entry.value_ptr.*).result_id; + try self.addFunctionDep(entry.value_ptr.*, .Function); + + const result_id = self.spv.declPtr(entry.value_ptr.*).result_id; + return try self.castToGeneric(self.typeId(decl_ptr_ty_ref), result_id); } - const spv_decl_index = try self.spv.allocDecl(.global); - try self.addFunctionDep(spv_decl_index, storage_class); + const spv_decl_index = try self.spv.allocDecl(.invocation_global); + try self.addFunctionDep(spv_decl_index, .Function); entry.value_ptr.* = spv_decl_index; break :blk spv_decl_index; }; - const mod = self.module; - const ty = Type.fromInterned(mod.intern_pool.typeOf(val)); - const ptr_ty_ref = try self.ptrType(ty, storage_class); - - const var_id = self.spv.declPtr(spv_decl_index).result_id; - - const section = &self.spv.sections.types_globals_constants; - try section.emit(self.spv.gpa, .OpVariable, .{ - .id_result_type = self.typeId(ptr_ty_ref), - .id_result = var_id, - .storage_class = storage_class, - }); - // 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 some other function, which - // is then added to the list of initializers using endGlobal(). + // constant lowering of this value will need to be deferred to an initializer similar to + // other globals. - // 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 = self.func; - defer self.func = func; - const block_label = self.current_block_label; - defer self.current_block_label = block_label; + const result_id = self.spv.declPtr(spv_decl_index).result_id; - self.func = .{}; - defer self.func.deinit(self.gpa); + { + // 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 = self.func; + defer self.func = func; + const block_label = self.current_block_label; + defer self.current_block_label = block_label; - // TODO: Merge this with genDecl? - const begin = self.spv.beginGlobal(); + self.func = .{}; + defer self.func.deinit(self.gpa); - const void_ty_ref = try self.resolveType(Type.void, .direct); - const initializer_proto_ty_ref = try self.spv.resolve(.{ .function_type = .{ - .return_type = void_ty_ref, - .parameters = &.{}, - } }); + const void_ty_ref = try self.resolveType(Type.void, .direct); + const initializer_proto_ty_ref = try self.spv.resolve(.{ .function_type = .{ + .return_type = void_ty_ref, + .parameters = &.{}, + } }); - const initializer_id = self.spv.allocId(); - try self.func.prologue.emit(self.spv.gpa, .OpFunction, .{ - .id_result_type = self.typeId(void_ty_ref), - .id_result = initializer_id, - .function_control = .{}, - .function_type = self.typeId(initializer_proto_ty_ref), - }); - const root_block_id = self.spv.allocId(); - try self.func.prologue.emit(self.spv.gpa, .OpLabel, .{ - .id_result = root_block_id, - }); - self.current_block_label = root_block_id; + const initializer_id = self.spv.allocId(); - const val_id = try self.constant(ty, Value.fromInterned(val), .indirect); - try self.func.body.emit(self.spv.gpa, .OpStore, .{ - .pointer = var_id, - .object = val_id, - }); + try self.func.prologue.emit(self.spv.gpa, .OpFunction, .{ + .id_result_type = self.typeId(void_ty_ref), + .id_result = initializer_id, + .function_control = .{}, + .function_type = self.typeId(initializer_proto_ty_ref), + }); + const root_block_id = self.spv.allocId(); + try self.func.prologue.emit(self.spv.gpa, .OpLabel, .{ + .id_result = root_block_id, + }); + self.current_block_label = root_block_id; - self.spv.endGlobal(spv_decl_index, begin, var_id, initializer_id); - try self.func.body.emit(self.spv.gpa, .OpReturn, {}); - try self.func.body.emit(self.spv.gpa, .OpFunctionEnd, {}); - try self.spv.addFunction(spv_decl_index, self.func); + const val_id = try self.constant(ty, Value.fromInterned(val), .indirect); + try self.func.body.emit(self.spv.gpa, .OpStore, .{ + .pointer = result_id, + .object = val_id, + }); - try self.spv.debugNameFmt(var_id, "__anon_{d}", .{@intFromEnum(val)}); - try self.spv.debugNameFmt(initializer_id, "initializer of __anon_{d}", .{@intFromEnum(val)}); + try self.func.body.emit(self.spv.gpa, .OpReturn, {}); + try self.func.body.emit(self.spv.gpa, .OpFunctionEnd, {}); + try self.spv.addFunction(spv_decl_index, self.func); + + try self.spv.debugNameFmt(initializer_id, "initializer of __anon_{d}", .{@intFromEnum(val)}); - return var_id; + const fn_decl_ptr_ty_ref = try self.ptrType(ty, .Function); + try self.spv.sections.types_globals_constants.emit(self.spv.gpa, .OpExtInst, .{ + .id_result_type = self.typeId(fn_decl_ptr_ty_ref), + .id_result = result_id, + .set = try self.spv.importInstructionSet(.zig), + .instruction = .{ .inst = 0 }, // TODO: Put this definition somewhere... + .id_ref_4 = &.{initializer_id}, + }); + } + + return try self.castToGeneric(self.typeId(decl_ptr_ty_ref), result_id); } fn addFunctionDep(self: *DeclGen, decl_index: SpvModule.Decl.Index, storage_class: StorageClass) !void { @@ -1179,19 +1187,10 @@ const DeclGen = struct { unreachable; // TODO } - const final_storage_class = self.spvStorageClass(ty.ptrAddressSpace(mod)); - const actual_storage_class = switch (final_storage_class) { - .Generic => .CrossWorkgroup, - else => |other| other, - }; - - const decl_id = try self.resolveAnonDecl(decl_val, actual_storage_class); - const decl_ptr_ty_ref = try self.ptrType(decl_ty, final_storage_class); - - const ptr_id = switch (final_storage_class) { - .Generic => try self.castToGeneric(self.typeId(decl_ptr_ty_ref), decl_id), - else => decl_id, - }; + // Anon decl refs are always generic. + assert(ty.ptrAddressSpace(mod) == .generic); + const decl_ptr_ty_ref = try self.ptrType(decl_ty, .Generic); + const ptr_id = try self.resolveAnonDecl(decl_val); if (decl_ptr_ty_ref != ty_ref) { // Differing pointer types, insert a cast. @@ -1229,8 +1228,13 @@ const DeclGen = struct { } const spv_decl_index = try self.object.resolveDecl(mod, decl_index); + const spv_decl = self.spv.declPtr(spv_decl_index); + + const decl_id = switch (spv_decl.kind) { + .func => unreachable, // TODO: Is this possible? + .global, .invocation_global => spv_decl.result_id, + }; - const decl_id = self.spv.declPtr(spv_decl_index).result_id; const final_storage_class = self.spvStorageClass(decl.@"addrspace"); try self.addFunctionDep(spv_decl_index, final_storage_class); @@ -1509,6 +1513,13 @@ const DeclGen = struct { if (self.type_map.get(ty.toIntern())) |info| return info.ty_ref; const fn_info = mod.typeToFunc(ty).?; + + comptime assert(zig_call_abi_ver == 3); + switch (fn_info.cc) { + .Unspecified, .Kernel, .Fragment, .Vertex, .C => {}, + else => unreachable, // TODO + } + // TODO: Put this somewhere in Sema.zig if (fn_info.is_var_args) return self.fail("VarArgs functions are unsupported for SPIR-V", .{}); @@ -1956,13 +1967,15 @@ const DeclGen = struct { /// (anyerror!void has the same layout as anyerror). /// Each test declaration generates a function like. /// %anyerror = OpTypeInt 0 16 + /// %p_invocation_globals_struct_ty = ... /// %p_anyerror = OpTypePointer CrossWorkgroup %anyerror - /// %K = OpTypeFunction %void %p_anyerror + /// %K = OpTypeFunction %void %p_invocation_globals_struct_ty %p_anyerror /// /// %test = OpFunction %void %K + /// %p_invocation_globals = OpFunctionParameter p_invocation_globals_struct_ty /// %p_err = OpFunctionParameter %p_anyerror /// %lbl = OpLabel - /// %result = OpFunctionCall %anyerror %func + /// %result = OpFunctionCall %anyerror %func %p_invocation_globals /// OpStore %p_err %result /// OpFunctionEnd /// TODO is to also write out the error as a function call parameter, and to somehow fetch @@ -1972,10 +1985,12 @@ const DeclGen = struct { const ptr_anyerror_ty_ref = try self.ptrType(Type.anyerror, .CrossWorkgroup); const void_ty_ref = try self.resolveType(Type.void, .direct); - const kernel_proto_ty_ref = try self.spv.resolve(.{ .function_type = .{ - .return_type = void_ty_ref, - .parameters = &.{ptr_anyerror_ty_ref}, - } }); + const kernel_proto_ty_ref = try self.spv.resolve(.{ + .function_type = .{ + .return_type = void_ty_ref, + .parameters = &.{ptr_anyerror_ty_ref}, + }, + }); const test_id = self.spv.declPtr(spv_test_decl_index).result_id; @@ -2026,147 +2041,164 @@ const DeclGen = struct { const ip = &mod.intern_pool; const decl = mod.declPtr(self.decl_index); const spv_decl_index = try self.object.resolveDecl(mod, self.decl_index); - const target = self.getTarget(); + const result_id = self.spv.declPtr(spv_decl_index).result_id; - const decl_id = self.spv.declPtr(spv_decl_index).result_id; + switch (self.spv.declPtr(spv_decl_index).kind) { + .func => { + assert(decl.ty.zigTypeTag(mod) == .Fn); + const fn_info = mod.typeToFunc(decl.ty).?; + const return_ty_ref = try self.resolveFnReturnType(Type.fromInterned(fn_info.return_type)); - if (decl.val.getFunction(mod)) |_| { - assert(decl.ty.zigTypeTag(mod) == .Fn); - const fn_info = mod.typeToFunc(decl.ty).?; - const return_ty_ref = try self.resolveFnReturnType(Type.fromInterned(fn_info.return_type)); + const prototype_ty_ref = try self.resolveType(decl.ty, .direct); + try self.func.prologue.emit(self.spv.gpa, .OpFunction, .{ + .id_result_type = self.typeId(return_ty_ref), + .id_result = result_id, + .function_control = switch (fn_info.cc) { + .Inline => .{ .Inline = true }, + else => .{}, + }, + .function_type = self.typeId(prototype_ty_ref), + }); - const prototype_id = try self.resolveTypeId(decl.ty); - try self.func.prologue.emit(self.spv.gpa, .OpFunction, .{ - .id_result_type = self.typeId(return_ty_ref), - .id_result = decl_id, - .function_control = switch (fn_info.cc) { - .Inline => .{ .Inline = true }, - else => .{}, - }, - .function_type = prototype_id, - }); + comptime assert(zig_call_abi_ver == 3); + try self.args.ensureUnusedCapacity(self.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.hasRuntimeBitsIgnoreComptime(mod)) continue; + + const param_type_id = try self.resolveTypeId(param_ty); + const arg_result_id = self.spv.allocId(); + try self.func.prologue.emit(self.spv.gpa, .OpFunctionParameter, .{ + .id_result_type = param_type_id, + .id_result = arg_result_id, + }); + self.args.appendAssumeCapacity(arg_result_id); + } - try self.args.ensureUnusedCapacity(self.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.hasRuntimeBitsIgnoreComptime(mod)) continue; + // TODO: This could probably be done in a better way... + const root_block_id = self.spv.allocId(); - const param_type_id = try self.resolveTypeId(param_ty); - const arg_result_id = self.spv.allocId(); - try self.func.prologue.emit(self.spv.gpa, .OpFunctionParameter, .{ - .id_result_type = param_type_id, - .id_result = arg_result_id, + // The root block of a function declaration should appear before OpVariable instructions, + // so it is generated into the function's prologue. + try self.func.prologue.emit(self.spv.gpa, .OpLabel, .{ + .id_result = root_block_id, }); - self.args.appendAssumeCapacity(arg_result_id); - } + self.current_block_label = root_block_id; - // TODO: This could probably be done in a better way... - const root_block_id = self.spv.allocId(); + const main_body = self.air.getMainBody(); + switch (self.control_flow) { + .structured => { + _ = try self.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 self.func.body.emit(self.spv.gpa, .OpUnreachable, {}); + }, + .unstructured => { + try self.genBody(main_body); + }, + } + try self.func.body.emit(self.spv.gpa, .OpFunctionEnd, {}); + // Append the actual code into the functions section. + try self.spv.addFunction(spv_decl_index, self.func); - // The root block of a function declaration should appear before OpVariable instructions, - // so it is generated into the function's prologue. - try self.func.prologue.emit(self.spv.gpa, .OpLabel, .{ - .id_result = root_block_id, - }); - self.current_block_label = root_block_id; + const fqn = ip.stringToSlice(try decl.fullyQualifiedName(self.module)); + try self.spv.debugName(result_id, fqn); - const main_body = self.air.getMainBody(); - switch (self.control_flow) { - .structured => { - _ = try self.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 self.func.body.emit(self.spv.gpa, .OpUnreachable, {}); - }, - .unstructured => { - try self.genBody(main_body); - }, - } - try self.func.body.emit(self.spv.gpa, .OpFunctionEnd, {}); - // Append the actual code into the functions section. - try self.spv.addFunction(spv_decl_index, self.func); + // Temporarily generate a test kernel declaration if this is a test function. + if (self.module.test_functions.contains(self.decl_index)) { + try self.generateTestEntryPoint(fqn, spv_decl_index); + } + }, + .global => { + const maybe_init_val: ?Value = blk: { + if (decl.val.getVariable(mod)) |payload| { + if (payload.is_extern) break :blk null; + break :blk Value.fromInterned(payload.init); + } + break :blk decl.val; + }; + assert(maybe_init_val == null); // TODO - const fqn = ip.stringToSlice(try decl.fullyQualifiedName(self.module)); - try self.spv.debugName(decl_id, fqn); + const final_storage_class = self.spvStorageClass(decl.@"addrspace"); + assert(final_storage_class != .Generic); // These should be instance globals - // Temporarily generate a test kernel declaration if this is a test function. - if (self.module.test_functions.contains(self.decl_index)) { - try self.generateTestEntryPoint(fqn, spv_decl_index); - } - } else { - const opt_init_val: ?Value = blk: { - if (decl.val.getVariable(mod)) |payload| { - if (payload.is_extern) break :blk null; - break :blk Value.fromInterned(payload.init); - } - break :blk decl.val; - }; + const ptr_ty_ref = try self.ptrType(decl.ty, final_storage_class); - // Generate the actual variable for the global... - const final_storage_class = self.spvStorageClass(decl.@"addrspace"); - const actual_storage_class = blk: { - if (target.os.tag != .vulkan) { - break :blk switch (final_storage_class) { - .Generic => .CrossWorkgroup, - else => final_storage_class, - }; - } - break :blk final_storage_class; - }; + try self.spv.sections.types_globals_constants.emit(self.spv.gpa, .OpVariable, .{ + .id_result_type = self.typeId(ptr_ty_ref), + .id_result = result_id, + .storage_class = final_storage_class, + }); - const ptr_ty_ref = try self.ptrType(decl.ty, actual_storage_class); + const fqn = ip.stringToSlice(try decl.fullyQualifiedName(self.module)); + try self.spv.debugName(result_id, fqn); + try self.spv.declareDeclDeps(spv_decl_index, &.{}); + }, + .invocation_global => { + const maybe_init_val: ?Value = blk: { + if (decl.val.getVariable(mod)) |payload| { + if (payload.is_extern) break :blk null; + break :blk Value.fromInterned(payload.init); + } + break :blk decl.val; + }; - const begin = self.spv.beginGlobal(); - try self.spv.globals.section.emit(self.spv.gpa, .OpVariable, .{ - .id_result_type = self.typeId(ptr_ty_ref), - .id_result = decl_id, - .storage_class = actual_storage_class, - }); - const fqn = ip.stringToSlice(try decl.fullyQualifiedName(self.module)); - try self.spv.debugName(decl_id, fqn); + try self.spv.declareDeclDeps(spv_decl_index, &.{}); - if (opt_init_val) |init_val| { - // Currently, initializers for CrossWorkgroup variables is not implemented - // in Mesa. Therefore we generate an initialization kernel instead. - const void_ty_ref = try self.resolveType(Type.void, .direct); + const ptr_ty_ref = try self.ptrType(decl.ty, .Function); - const initializer_proto_ty_ref = try self.spv.resolve(.{ .function_type = .{ - .return_type = void_ty_ref, - .parameters = &.{}, - } }); + if (maybe_init_val) |init_val| { + // TODO: Combine with resolveAnonDecl? + const void_ty_ref = try self.resolveType(Type.void, .direct); + const initializer_proto_ty_ref = try self.spv.resolve(.{ .function_type = .{ + .return_type = void_ty_ref, + .parameters = &.{}, + } }); - // Now emit the instructions that initialize the variable. - const initializer_id = self.spv.allocId(); - try self.func.prologue.emit(self.spv.gpa, .OpFunction, .{ - .id_result_type = self.typeId(void_ty_ref), - .id_result = initializer_id, - .function_control = .{}, - .function_type = self.typeId(initializer_proto_ty_ref), - }); - const root_block_id = self.spv.allocId(); - try self.func.prologue.emit(self.spv.gpa, .OpLabel, .{ - .id_result = root_block_id, - }); - self.current_block_label = root_block_id; + const initializer_id = self.spv.allocId(); + try self.func.prologue.emit(self.spv.gpa, .OpFunction, .{ + .id_result_type = self.typeId(void_ty_ref), + .id_result = initializer_id, + .function_control = .{}, + .function_type = self.typeId(initializer_proto_ty_ref), + }); - const val_id = try self.constant(decl.ty, init_val, .indirect); - try self.func.body.emit(self.spv.gpa, .OpStore, .{ - .pointer = decl_id, - .object = val_id, - }); + const root_block_id = self.spv.allocId(); + try self.func.prologue.emit(self.spv.gpa, .OpLabel, .{ + .id_result = root_block_id, + }); + self.current_block_label = root_block_id; - // TODO: We should be able to get rid of this by now... - self.spv.endGlobal(spv_decl_index, begin, decl_id, initializer_id); + const val_id = try self.constant(decl.ty, init_val, .indirect); + try self.func.body.emit(self.spv.gpa, .OpStore, .{ + .pointer = result_id, + .object = val_id, + }); - try self.func.body.emit(self.spv.gpa, .OpReturn, {}); - try self.func.body.emit(self.spv.gpa, .OpFunctionEnd, {}); - try self.spv.addFunction(spv_decl_index, self.func); + try self.func.body.emit(self.spv.gpa, .OpReturn, {}); + try self.func.body.emit(self.spv.gpa, .OpFunctionEnd, {}); + try self.spv.addFunction(spv_decl_index, self.func); - try self.spv.debugNameFmt(initializer_id, "initializer of {s}", .{fqn}); - } else { - self.spv.endGlobal(spv_decl_index, begin, decl_id, null); - try self.spv.declareDeclDeps(spv_decl_index, &.{}); - } + const fqn = ip.stringToSlice(try decl.fullyQualifiedName(self.module)); + try self.spv.debugNameFmt(initializer_id, "initializer of {s}", .{fqn}); + + try self.spv.sections.types_globals_constants.emit(self.spv.gpa, .OpExtInst, .{ + .id_result_type = self.typeId(ptr_ty_ref), + .id_result = result_id, + .set = try self.spv.importInstructionSet(.zig), + .instruction = .{ .inst = 0 }, // TODO: Put this definition somewhere... + .id_ref_4 = &.{initializer_id}, + }); + } else { + try self.spv.sections.types_globals_constants.emit(self.spv.gpa, .OpExtInst, .{ + .id_result_type = self.typeId(ptr_ty_ref), + .id_result = result_id, + .set = try self.spv.importInstructionSet(.zig), + .instruction = .{ .inst = 0 }, // TODO: Put this definition somewhere... + .id_ref_4 = &.{}, + }); + } + }, } } @@ -2559,8 +2591,8 @@ const DeclGen = struct { else => unreachable, }; const set_id = switch (target.os.tag) { - .opencl => try self.spv.importInstructionSet(.opencl), - .vulkan => try self.spv.importInstructionSet(.glsl), + .opencl => try self.spv.importInstructionSet(.@"OpenCL.std"), + .vulkan => try self.spv.importInstructionSet(.@"GLSL.std.450"), else => unreachable, }; @@ -2734,8 +2766,8 @@ const DeclGen = struct { else => unreachable, }; const set_id = switch (target.os.tag) { - .opencl => try self.spv.importInstructionSet(.opencl), - .vulkan => try self.spv.importInstructionSet(.glsl), + .opencl => try self.spv.importInstructionSet(.@"OpenCL.std"), + .vulkan => try self.spv.importInstructionSet(.@"GLSL.std.450"), else => unreachable, }; @@ -5427,9 +5459,9 @@ const DeclGen = struct { const result_id = self.spv.allocId(); const callee_id = try self.resolve(pl_op.operand); + comptime assert(zig_call_abi_ver == 3); const params = try self.gpa.alloc(spec.IdRef, args.len); defer self.gpa.free(params); - var n_params: usize = 0; for (args) |arg| { // Note: resolve() might emit instructions, so we need to call it diff --git a/src/codegen/spirv/Cache.zig b/src/codegen/spirv/Cache.zig index 93921204db..e8460e1d79 100644 --- a/src/codegen/spirv/Cache.zig +++ b/src/codegen/spirv/Cache.zig @@ -134,7 +134,10 @@ const Tag = enum { /// data is (bool) type bool_false, - const SimpleType = enum { void, bool }; + const SimpleType = enum { + void, + bool, + }; const VectorType = Key.VectorType; const ArrayType = Key.ArrayType; @@ -287,11 +290,12 @@ pub const Key = union(enum) { pub const PointerType = struct { storage_class: StorageClass, child_type: Ref, + /// Ref to a .fwd_ptr_type. fwd: Ref, // TODO: Decorations: // - Alignment - // - ArrayStride, - // - MaxByteOffset, + // - ArrayStride + // - MaxByteOffset }; pub const ForwardPointerType = struct { @@ -728,6 +732,9 @@ pub fn resolve(self: *Self, spv: *Module, key: Key) !Ref { // }, .ptr_type => |ptr| Item{ .tag = .type_ptr_simple, + // For this variant we need to steal the ID of the forward-declaration, instead + // of allocating one manually. This will make sure that we get a single result-id + // any possibly forward declared pointer type. .result_id = self.resultId(ptr.fwd), .data = try self.addExtra(spv, Tag.SimplePointerType{ .storage_class = ptr.storage_class, @@ -896,24 +903,6 @@ pub fn lookup(self: *const Self, ref: Ref) Key { }, }; }, - // .type_ptr_generic => .{ - // .ptr_type = .{ - // .storage_class = .Generic, - // .child_type = @enumFromInt(data), - // }, - // }, - // .type_ptr_crosswgp => .{ - // .ptr_type = .{ - // .storage_class = .CrossWorkgroup, - // .child_type = @enumFromInt(data), - // }, - // }, - // .type_ptr_function => .{ - // .ptr_type = .{ - // .storage_class = .Function, - // .child_type = @enumFromInt(data), - // }, - // }, .type_ptr_simple => { const payload = self.extraData(Tag.SimplePointerType, data); return .{ diff --git a/src/codegen/spirv/Module.zig b/src/codegen/spirv/Module.zig index 23b0d5d0db..b650566890 100644 --- a/src/codegen/spirv/Module.zig +++ b/src/codegen/spirv/Module.zig @@ -72,9 +72,20 @@ pub const Decl = struct { /// Index to refer to a Decl by. pub const Index = enum(u32) { _ }; - /// The result-id to be used for this declaration. This is the final result-id - /// of the decl, which may be an OpFunction, OpVariable, or the result of a sequence - /// of OpSpecConstantOp operations. + /// Useful to tell what kind of decl this is, and hold the result-id or field index + /// to be used for this decl. + pub const Kind = enum { + func, + global, + invocation_global, + }; + + /// See comment on Kind + kind: Kind, + /// The result-id associated to this decl. The specific meaning of this depends on `kind`: + /// - For `func`, this is the result-id of the associated OpFunction instruction. + /// - For `global`, this is the result-id of the associated OpVariable instruction. + /// - For `invocation_global`, this is the result-id of the associated InvocationGlobal instruction. result_id: IdRef, /// The offset of the first dependency of this decl in the `decl_deps` array. begin_dep: u32, @@ -82,20 +93,6 @@ pub const Decl = struct { end_dep: u32, }; -/// Globals must be kept in order: operations involving globals must be ordered -/// so that the global declaration precedes any usage. -pub const Global = struct { - /// This is the result-id of the OpVariable instruction that declares the global. - result_id: IdRef, - /// The offset into `self.globals.section` of the first instruction of this global - /// declaration. - begin_inst: u32, - /// The past-end offset into `self.flobals.section`. - end_inst: u32, - /// The result-id of the function that initializes this value. - initializer_id: ?IdRef, -}; - /// This models a kernel entry point. pub const EntryPoint = struct { /// The declaration that should be exported. @@ -165,18 +162,8 @@ decl_deps: std.ArrayListUnmanaged(Decl.Index) = .{}, /// The list of entry points that should be exported from this module. entry_points: std.ArrayListUnmanaged(EntryPoint) = .{}, -/// The fields in this structure help to maintain the required order for global variables. -globals: struct { - /// Set of globals, referred to by Decl.Index. - globals: std.AutoArrayHashMapUnmanaged(Decl.Index, Global) = .{}, - /// This pseudo-section contains the initialization code for all the globals. Instructions from - /// here are reordered when flushing the module. Its contents should be part of the - /// `types_globals_constants` SPIR-V section when the module is emitted. - section: Section = .{}, -} = .{}, - /// The list of extended instruction sets that should be imported. -extended_instruction_set: std.AutoHashMapUnmanaged(ExtendedInstructionSet, IdRef) = .{}, +extended_instruction_set: std.AutoHashMapUnmanaged(spec.InstructionSet, IdRef) = .{}, pub fn init(gpa: Allocator) Module { return .{ @@ -205,9 +192,6 @@ pub fn deinit(self: *Module) void { self.entry_points.deinit(self.gpa); - self.globals.globals.deinit(self.gpa); - self.globals.section.deinit(self.gpa); - self.extended_instruction_set.deinit(self.gpa); self.* = undefined; @@ -243,46 +227,6 @@ pub fn resolveString(self: *Module, str: []const u8) !CacheString { return try self.cache.addString(self, str); } -fn orderGlobalsInto( - self: *Module, - decl_index: Decl.Index, - section: *Section, - seen: *std.DynamicBitSetUnmanaged, -) !void { - const decl = self.declPtr(decl_index); - const deps = self.decl_deps.items[decl.begin_dep..decl.end_dep]; - const global = self.globalPtr(decl_index).?; - const insts = self.globals.section.instructions.items[global.begin_inst..global.end_inst]; - - seen.set(@intFromEnum(decl_index)); - - for (deps) |dep| { - if (!seen.isSet(@intFromEnum(dep))) { - try self.orderGlobalsInto(dep, section, seen); - } - } - - try section.instructions.appendSlice(self.gpa, insts); -} - -fn orderGlobals(self: *Module) !Section { - const globals = self.globals.globals.keys(); - - var seen = try std.DynamicBitSetUnmanaged.initEmpty(self.gpa, self.decls.items.len); - defer seen.deinit(self.gpa); - - var ordered_globals = Section{}; - errdefer ordered_globals.deinit(self.gpa); - - for (globals) |decl_index| { - if (!seen.isSet(@intFromEnum(decl_index))) { - try self.orderGlobalsInto(decl_index, &ordered_globals, &seen); - } - } - - return ordered_globals; -} - fn addEntryPointDeps( self: *Module, decl_index: Decl.Index, @@ -298,8 +242,8 @@ fn addEntryPointDeps( seen.set(@intFromEnum(decl_index)); - if (self.globalPtr(decl_index)) |global| { - try interface.append(global.result_id); + if (decl.kind == .global) { + try interface.append(decl.result_id); } for (deps) |dep| { @@ -335,81 +279,9 @@ fn entryPoints(self: *Module) !Section { return entry_points; } -/// Generate a function that calls all initialization functions, -/// in unspecified order (an order should not be required here). -/// It generated as follows: -/// %init = OpFunction %void None -/// foreach %initializer: -/// OpFunctionCall %initializer -/// OpReturn -/// OpFunctionEnd -fn initializer(self: *Module, entry_points: *Section) !Section { - var section = Section{}; - errdefer section.deinit(self.gpa); - - // const void_ty_ref = try self.resolveType(Type.void, .direct); - const void_ty_ref = try self.resolve(.void_type); - const void_ty_id = self.resultId(void_ty_ref); - const init_proto_ty_ref = try self.resolve(.{ .function_type = .{ - .return_type = void_ty_ref, - .parameters = &.{}, - } }); - - const init_id = self.allocId(); - try section.emit(self.gpa, .OpFunction, .{ - .id_result_type = void_ty_id, - .id_result = init_id, - .function_control = .{}, - .function_type = self.resultId(init_proto_ty_ref), - }); - try section.emit(self.gpa, .OpLabel, .{ - .id_result = self.allocId(), - }); - - var seen = try std.DynamicBitSetUnmanaged.initEmpty(self.gpa, self.decls.items.len); - defer seen.deinit(self.gpa); - - var interface = std.ArrayList(IdRef).init(self.gpa); - defer interface.deinit(); - - for (self.globals.globals.keys(), self.globals.globals.values()) |decl_index, global| { - try self.addEntryPointDeps(decl_index, &seen, &interface); - if (global.initializer_id) |initializer_id| { - try section.emit(self.gpa, .OpFunctionCall, .{ - .id_result_type = void_ty_id, - .id_result = self.allocId(), - .function = initializer_id, - }); - } - } - - try section.emit(self.gpa, .OpReturn, {}); - try section.emit(self.gpa, .OpFunctionEnd, {}); - - try entry_points.emit(self.gpa, .OpEntryPoint, .{ - // TODO: Rusticl does not support this because its poorly defined. - // Do we need to generate a workaround here? - .execution_model = .Kernel, - .entry_point = init_id, - .name = "zig global initializer", - .interface = interface.items, - }); - - try self.sections.execution_modes.emit(self.gpa, .OpExecutionMode, .{ - .entry_point = init_id, - .mode = .Initializer, - }); - - return section; -} - -/// Emit this module as a spir-v binary. -pub fn flush(self: *Module, file: std.fs.File, target: std.Target) !void { +pub fn finalize(self: *Module, a: Allocator, target: std.Target) ![]Word { // See SPIR-V Spec section 2.3, "Physical Layout of a SPIR-V Module and Instruction" - - // TODO: Perform topological sort on the globals. - var globals = try self.orderGlobals(); - defer globals.deinit(self.gpa); + // TODO: Audit calls to allocId() in this function to make it idempotent. var entry_points = try self.entryPoints(); defer entry_points.deinit(self.gpa); @@ -417,13 +289,6 @@ pub fn flush(self: *Module, file: std.fs.File, target: std.Target) !void { var types_constants = try self.cache.materialize(self); defer types_constants.deinit(self.gpa); - // // TODO: Pass global variables as function parameters - // var init_func = if (target.os.tag != .vulkan) - // try self.initializer(&entry_points) - // else - // Section{}; - // defer init_func.deinit(self.gpa); - const header = [_]Word{ spec.magic_number, // TODO: From cpu features @@ -436,7 +301,7 @@ pub fn flush(self: *Module, file: std.fs.File, target: std.Target) !void { else => 4, }, }), - 0, // TODO: Register Zig compiler magic number. + spec.zig_generator_id, self.idBound(), 0, // Schema (currently reserved for future use) }; @@ -468,30 +333,23 @@ pub fn flush(self: *Module, file: std.fs.File, target: std.Target) !void { self.sections.annotations.toWords(), types_constants.toWords(), self.sections.types_globals_constants.toWords(), - globals.toWords(), self.sections.functions.toWords(), }; - if (builtin.zig_backend == .stage2_x86_64) { - for (buffers) |buf| { - try file.writeAll(std.mem.sliceAsBytes(buf)); - } - } else { - // miscompiles with x86_64 backend - var iovc_buffers: [buffers.len]std.os.iovec_const = undefined; - var file_size: u64 = 0; - for (&iovc_buffers, 0..) |*iovc, i| { - // Note, since spir-v supports both little and big endian we can ignore byte order here and - // just treat the words as a sequence of bytes. - const bytes = std.mem.sliceAsBytes(buffers[i]); - iovc.* = .{ .iov_base = bytes.ptr, .iov_len = bytes.len }; - file_size += bytes.len; - } - - try file.seekTo(0); - try file.setEndPos(file_size); - try file.pwritevAll(&iovc_buffers, 0); + var total_result_size: usize = 0; + for (buffers) |buffer| { + total_result_size += buffer.len; + } + const result = try a.alloc(Word, total_result_size); + errdefer a.free(result); + + var offset: usize = 0; + for (buffers) |buffer| { + @memcpy(result[offset..][0..buffer.len], buffer); + offset += buffer.len; } + + return result; } /// Merge the sections making up a function declaration into this module. @@ -501,23 +359,17 @@ pub fn addFunction(self: *Module, decl_index: Decl.Index, func: Fn) !void { try self.declareDeclDeps(decl_index, func.decl_deps.keys()); } -pub const ExtendedInstructionSet = enum { - glsl, - opencl, -}; - /// Imports or returns the existing id of an extended instruction set -pub fn importInstructionSet(self: *Module, set: ExtendedInstructionSet) !IdRef { +pub fn importInstructionSet(self: *Module, set: spec.InstructionSet) !IdRef { + assert(set != .core); + const gop = try self.extended_instruction_set.getOrPut(self.gpa, set); if (gop.found_existing) return gop.value_ptr.*; const result_id = self.allocId(); try self.sections.extended_instruction_set.emit(self.gpa, .OpExtInstImport, .{ .id_result = result_id, - .name = switch (set) { - .glsl => "GLSL.std.450", - .opencl => "OpenCL.std", - }, + .name = @tagName(set), }); gop.value_ptr.* = result_id; @@ -631,40 +483,21 @@ pub fn decorateMember( }); } -pub const DeclKind = enum { - func, - global, -}; - -pub fn allocDecl(self: *Module, kind: DeclKind) !Decl.Index { +pub fn allocDecl(self: *Module, kind: Decl.Kind) !Decl.Index { try self.decls.append(self.gpa, .{ + .kind = kind, .result_id = self.allocId(), .begin_dep = undefined, .end_dep = undefined, }); - const index = @as(Decl.Index, @enumFromInt(@as(u32, @intCast(self.decls.items.len - 1)))); - switch (kind) { - .func => {}, - // If the decl represents a global, also allocate a global node. - .global => try self.globals.globals.putNoClobber(self.gpa, index, .{ - .result_id = undefined, - .begin_inst = undefined, - .end_inst = undefined, - .initializer_id = undefined, - }), - } - return index; + return @as(Decl.Index, @enumFromInt(@as(u32, @intCast(self.decls.items.len - 1)))); } pub fn declPtr(self: *Module, index: Decl.Index) *Decl { return &self.decls.items[@intFromEnum(index)]; } -pub fn globalPtr(self: *Module, index: Decl.Index) ?*Global { - return self.globals.globals.getPtr(index); -} - /// Declare ALL dependencies for a decl. pub fn declareDeclDeps(self: *Module, decl_index: Decl.Index, deps: []const Decl.Index) !void { const begin_dep = @as(u32, @intCast(self.decl_deps.items.len)); @@ -676,26 +509,9 @@ pub fn declareDeclDeps(self: *Module, decl_index: Decl.Index, deps: []const Decl decl.end_dep = end_dep; } -pub fn beginGlobal(self: *Module) u32 { - return @as(u32, @intCast(self.globals.section.instructions.items.len)); -} - -pub fn endGlobal( - self: *Module, - global_index: Decl.Index, - begin_inst: u32, - result_id: IdRef, - initializer_id: ?IdRef, -) void { - const global = self.globalPtr(global_index).?; - global.* = .{ - .result_id = result_id, - .begin_inst = begin_inst, - .end_inst = @intCast(self.globals.section.instructions.items.len), - .initializer_id = initializer_id, - }; -} - +/// Declare a SPIR-V function as an entry point. This causes an extra wrapper +/// function to be generated, which is then exported as the real entry point. The purpose of this +/// wrapper is to allocate and initialize the structure holding the instance globals. pub fn declareEntryPoint( self: *Module, decl_index: Decl.Index, diff --git a/src/codegen/spirv/Section.zig b/src/codegen/spirv/Section.zig index ef3f8a2fa4..d3b84dc27d 100644 --- a/src/codegen/spirv/Section.zig +++ b/src/codegen/spirv/Section.zig @@ -53,6 +53,17 @@ pub fn emitRaw( section.writeWord((@as(Word, @intCast(word_count << 16))) | @intFromEnum(opcode)); } +/// Write an entire instruction, including all operands +pub fn emitRawInstruction( + section: *Section, + allocator: Allocator, + opcode: Opcode, + operands: []const Word, +) !void { + try section.emitRaw(allocator, opcode, operands.len); + section.writeWords(operands); +} + pub fn emit( section: *Section, allocator: Allocator, diff --git a/src/codegen/spirv/spec.zig b/src/codegen/spirv/spec.zig index a0b3048961..970f5bfe7f 100644 --- a/src/codegen/spirv/spec.zig +++ b/src/codegen/spirv/spec.zig @@ -1,5 +1,7 @@ //! This file is auto-generated by tools/gen_spirv_spec.zig. +const std = @import("std"); + pub const Version = packed struct(Word) { padding: u8 = 0, minor: u8, @@ -15,6 +17,18 @@ pub const Word = u32; pub const IdResult = enum(Word) { none, _, + + pub fn format( + self: IdResult, + comptime _: []const u8, + _: std.fmt.FormatOptions, + writer: anytype, + ) @TypeOf(writer).Error!void { + switch (self) { + .none => try writer.writeAll("(none)"), + else => try writer.print("%{}", .{@intFromEnum(self)}), + } + } }; pub const IdResultType = IdResult; pub const IdRef = IdResult; @@ -70,6 +84,7 @@ pub const Instruction = struct { operands: []const Operand, }; +pub const zig_generator_id: Word = 41; pub const version = Version{ .major = 1, .minor = 6, .patch = 1 }; pub const magic_number: Word = 0x07230203; @@ -166,25 +181,25 @@ pub const OperandKind = enum { PairLiteralIntegerIdRef, PairIdRefLiteralInteger, PairIdRefIdRef, - @"opencl.debuginfo.100.DebugInfoFlags", - @"opencl.debuginfo.100.DebugBaseTypeAttributeEncoding", - @"opencl.debuginfo.100.DebugCompositeType", - @"opencl.debuginfo.100.DebugTypeQualifier", - @"opencl.debuginfo.100.DebugOperation", - @"opencl.debuginfo.100.DebugImportedEntity", - @"nonsemantic.shader.debuginfo.100.DebugInfoFlags", - @"nonsemantic.shader.debuginfo.100.BuildIdentifierFlags", - @"nonsemantic.shader.debuginfo.100.DebugBaseTypeAttributeEncoding", - @"nonsemantic.shader.debuginfo.100.DebugCompositeType", - @"nonsemantic.shader.debuginfo.100.DebugTypeQualifier", - @"nonsemantic.shader.debuginfo.100.DebugOperation", - @"nonsemantic.shader.debuginfo.100.DebugImportedEntity", - @"nonsemantic.clspvreflection.KernelPropertyFlags", - @"debuginfo.DebugInfoFlags", - @"debuginfo.DebugBaseTypeAttributeEncoding", - @"debuginfo.DebugCompositeType", - @"debuginfo.DebugTypeQualifier", - @"debuginfo.DebugOperation", + @"OpenCL.DebugInfo.100.DebugInfoFlags", + @"OpenCL.DebugInfo.100.DebugBaseTypeAttributeEncoding", + @"OpenCL.DebugInfo.100.DebugCompositeType", + @"OpenCL.DebugInfo.100.DebugTypeQualifier", + @"OpenCL.DebugInfo.100.DebugOperation", + @"OpenCL.DebugInfo.100.DebugImportedEntity", + @"NonSemantic.Shader.DebugInfo.100.DebugInfoFlags", + @"NonSemantic.Shader.DebugInfo.100.BuildIdentifierFlags", + @"NonSemantic.Shader.DebugInfo.100.DebugBaseTypeAttributeEncoding", + @"NonSemantic.Shader.DebugInfo.100.DebugCompositeType", + @"NonSemantic.Shader.DebugInfo.100.DebugTypeQualifier", + @"NonSemantic.Shader.DebugInfo.100.DebugOperation", + @"NonSemantic.Shader.DebugInfo.100.DebugImportedEntity", + @"NonSemantic.ClspvReflection.6.KernelPropertyFlags", + @"DebugInfo.DebugInfoFlags", + @"DebugInfo.DebugBaseTypeAttributeEncoding", + @"DebugInfo.DebugCompositeType", + @"DebugInfo.DebugTypeQualifier", + @"DebugInfo.DebugOperation", pub fn category(self: OperandKind) OperandCategory { return switch (self) { @@ -252,25 +267,25 @@ pub const OperandKind = enum { .PairLiteralIntegerIdRef => .composite, .PairIdRefLiteralInteger => .composite, .PairIdRefIdRef => .composite, - .@"opencl.debuginfo.100.DebugInfoFlags" => .bit_enum, - .@"opencl.debuginfo.100.DebugBaseTypeAttributeEncoding" => .value_enum, - .@"opencl.debuginfo.100.DebugCompositeType" => .value_enum, - .@"opencl.debuginfo.100.DebugTypeQualifier" => .value_enum, - .@"opencl.debuginfo.100.DebugOperation" => .value_enum, - .@"opencl.debuginfo.100.DebugImportedEntity" => .value_enum, - .@"nonsemantic.shader.debuginfo.100.DebugInfoFlags" => .bit_enum, - .@"nonsemantic.shader.debuginfo.100.BuildIdentifierFlags" => .bit_enum, - .@"nonsemantic.shader.debuginfo.100.DebugBaseTypeAttributeEncoding" => .value_enum, - .@"nonsemantic.shader.debuginfo.100.DebugCompositeType" => .value_enum, - .@"nonsemantic.shader.debuginfo.100.DebugTypeQualifier" => .value_enum, - .@"nonsemantic.shader.debuginfo.100.DebugOperation" => .value_enum, - .@"nonsemantic.shader.debuginfo.100.DebugImportedEntity" => .value_enum, - .@"nonsemantic.clspvreflection.KernelPropertyFlags" => .bit_enum, - .@"debuginfo.DebugInfoFlags" => .bit_enum, - .@"debuginfo.DebugBaseTypeAttributeEncoding" => .value_enum, - .@"debuginfo.DebugCompositeType" => .value_enum, - .@"debuginfo.DebugTypeQualifier" => .value_enum, - .@"debuginfo.DebugOperation" => .value_enum, + .@"OpenCL.DebugInfo.100.DebugInfoFlags" => .bit_enum, + .@"OpenCL.DebugInfo.100.DebugBaseTypeAttributeEncoding" => .value_enum, + .@"OpenCL.DebugInfo.100.DebugCompositeType" => .value_enum, + .@"OpenCL.DebugInfo.100.DebugTypeQualifier" => .value_enum, + .@"OpenCL.DebugInfo.100.DebugOperation" => .value_enum, + .@"OpenCL.DebugInfo.100.DebugImportedEntity" => .value_enum, + .@"NonSemantic.Shader.DebugInfo.100.DebugInfoFlags" => .bit_enum, + .@"NonSemantic.Shader.DebugInfo.100.BuildIdentifierFlags" => .bit_enum, + .@"NonSemantic.Shader.DebugInfo.100.DebugBaseTypeAttributeEncoding" => .value_enum, + .@"NonSemantic.Shader.DebugInfo.100.DebugCompositeType" => .value_enum, + .@"NonSemantic.Shader.DebugInfo.100.DebugTypeQualifier" => .value_enum, + .@"NonSemantic.Shader.DebugInfo.100.DebugOperation" => .value_enum, + .@"NonSemantic.Shader.DebugInfo.100.DebugImportedEntity" => .value_enum, + .@"NonSemantic.ClspvReflection.6.KernelPropertyFlags" => .bit_enum, + .@"DebugInfo.DebugInfoFlags" => .bit_enum, + .@"DebugInfo.DebugBaseTypeAttributeEncoding" => .value_enum, + .@"DebugInfo.DebugCompositeType" => .value_enum, + .@"DebugInfo.DebugTypeQualifier" => .value_enum, + .@"DebugInfo.DebugOperation" => .value_enum, }; } pub fn enumerants(self: OperandKind) []const Enumerant { @@ -1395,7 +1410,7 @@ pub const OperandKind = enum { .PairLiteralIntegerIdRef => unreachable, .PairIdRefLiteralInteger => unreachable, .PairIdRefIdRef => unreachable, - .@"opencl.debuginfo.100.DebugInfoFlags" => &[_]Enumerant{ + .@"OpenCL.DebugInfo.100.DebugInfoFlags" => &[_]Enumerant{ .{ .name = "FlagIsProtected", .value = 0x01, .parameters = &[_]OperandKind{} }, .{ .name = "FlagIsPrivate", .value = 0x02, .parameters = &[_]OperandKind{} }, .{ .name = "FlagIsPublic", .value = 0x03, .parameters = &[_]OperandKind{} }, @@ -1415,7 +1430,7 @@ pub const OperandKind = enum { .{ .name = "FlagTypePassByValue", .value = 0x8000, .parameters = &[_]OperandKind{} }, .{ .name = "FlagTypePassByReference", .value = 0x10000, .parameters = &[_]OperandKind{} }, }, - .@"opencl.debuginfo.100.DebugBaseTypeAttributeEncoding" => &[_]Enumerant{ + .@"OpenCL.DebugInfo.100.DebugBaseTypeAttributeEncoding" => &[_]Enumerant{ .{ .name = "Unspecified", .value = 0, .parameters = &[_]OperandKind{} }, .{ .name = "Address", .value = 1, .parameters = &[_]OperandKind{} }, .{ .name = "Boolean", .value = 2, .parameters = &[_]OperandKind{} }, @@ -1425,18 +1440,18 @@ pub const OperandKind = enum { .{ .name = "Unsigned", .value = 6, .parameters = &[_]OperandKind{} }, .{ .name = "UnsignedChar", .value = 7, .parameters = &[_]OperandKind{} }, }, - .@"opencl.debuginfo.100.DebugCompositeType" => &[_]Enumerant{ + .@"OpenCL.DebugInfo.100.DebugCompositeType" => &[_]Enumerant{ .{ .name = "Class", .value = 0, .parameters = &[_]OperandKind{} }, .{ .name = "Structure", .value = 1, .parameters = &[_]OperandKind{} }, .{ .name = "Union", .value = 2, .parameters = &[_]OperandKind{} }, }, - .@"opencl.debuginfo.100.DebugTypeQualifier" => &[_]Enumerant{ + .@"OpenCL.DebugInfo.100.DebugTypeQualifier" => &[_]Enumerant{ .{ .name = "ConstType", .value = 0, .parameters = &[_]OperandKind{} }, .{ .name = "VolatileType", .value = 1, .parameters = &[_]OperandKind{} }, .{ .name = "RestrictType", .value = 2, .parameters = &[_]OperandKind{} }, .{ .name = "AtomicType", .value = 3, .parameters = &[_]OperandKind{} }, }, - .@"opencl.debuginfo.100.DebugOperation" => &[_]Enumerant{ + .@"OpenCL.DebugInfo.100.DebugOperation" => &[_]Enumerant{ .{ .name = "Deref", .value = 0, .parameters = &[_]OperandKind{} }, .{ .name = "Plus", .value = 1, .parameters = &[_]OperandKind{} }, .{ .name = "Minus", .value = 2, .parameters = &[_]OperandKind{} }, @@ -1448,11 +1463,11 @@ pub const OperandKind = enum { .{ .name = "Constu", .value = 8, .parameters = &[_]OperandKind{.LiteralInteger} }, .{ .name = "Fragment", .value = 9, .parameters = &[_]OperandKind{ .LiteralInteger, .LiteralInteger } }, }, - .@"opencl.debuginfo.100.DebugImportedEntity" => &[_]Enumerant{ + .@"OpenCL.DebugInfo.100.DebugImportedEntity" => &[_]Enumerant{ .{ .name = "ImportedModule", .value = 0, .parameters = &[_]OperandKind{} }, .{ .name = "ImportedDeclaration", .value = 1, .parameters = &[_]OperandKind{} }, }, - .@"nonsemantic.shader.debuginfo.100.DebugInfoFlags" => &[_]Enumerant{ + .@"NonSemantic.Shader.DebugInfo.100.DebugInfoFlags" => &[_]Enumerant{ .{ .name = "FlagIsProtected", .value = 0x01, .parameters = &[_]OperandKind{} }, .{ .name = "FlagIsPrivate", .value = 0x02, .parameters = &[_]OperandKind{} }, .{ .name = "FlagIsPublic", .value = 0x03, .parameters = &[_]OperandKind{} }, @@ -1473,10 +1488,10 @@ pub const OperandKind = enum { .{ .name = "FlagTypePassByReference", .value = 0x10000, .parameters = &[_]OperandKind{} }, .{ .name = "FlagUnknownPhysicalLayout", .value = 0x20000, .parameters = &[_]OperandKind{} }, }, - .@"nonsemantic.shader.debuginfo.100.BuildIdentifierFlags" => &[_]Enumerant{ + .@"NonSemantic.Shader.DebugInfo.100.BuildIdentifierFlags" => &[_]Enumerant{ .{ .name = "IdentifierPossibleDuplicates", .value = 0x01, .parameters = &[_]OperandKind{} }, }, - .@"nonsemantic.shader.debuginfo.100.DebugBaseTypeAttributeEncoding" => &[_]Enumerant{ + .@"NonSemantic.Shader.DebugInfo.100.DebugBaseTypeAttributeEncoding" => &[_]Enumerant{ .{ .name = "Unspecified", .value = 0, .parameters = &[_]OperandKind{} }, .{ .name = "Address", .value = 1, .parameters = &[_]OperandKind{} }, .{ .name = "Boolean", .value = 2, .parameters = &[_]OperandKind{} }, @@ -1486,18 +1501,18 @@ pub const OperandKind = enum { .{ .name = "Unsigned", .value = 6, .parameters = &[_]OperandKind{} }, .{ .name = "UnsignedChar", .value = 7, .parameters = &[_]OperandKind{} }, }, - .@"nonsemantic.shader.debuginfo.100.DebugCompositeType" => &[_]Enumerant{ + .@"NonSemantic.Shader.DebugInfo.100.DebugCompositeType" => &[_]Enumerant{ .{ .name = "Class", .value = 0, .parameters = &[_]OperandKind{} }, .{ .name = "Structure", .value = 1, .parameters = &[_]OperandKind{} }, .{ .name = "Union", .value = 2, .parameters = &[_]OperandKind{} }, }, - .@"nonsemantic.shader.debuginfo.100.DebugTypeQualifier" => &[_]Enumerant{ + .@"NonSemantic.Shader.DebugInfo.100.DebugTypeQualifier" => &[_]Enumerant{ .{ .name = "ConstType", .value = 0, .parameters = &[_]OperandKind{} }, .{ .name = "VolatileType", .value = 1, .parameters = &[_]OperandKind{} }, .{ .name = "RestrictType", .value = 2, .parameters = &[_]OperandKind{} }, .{ .name = "AtomicType", .value = 3, .parameters = &[_]OperandKind{} }, }, - .@"nonsemantic.shader.debuginfo.100.DebugOperation" => &[_]Enumerant{ + .@"NonSemantic.Shader.DebugInfo.100.DebugOperation" => &[_]Enumerant{ .{ .name = "Deref", .value = 0, .parameters = &[_]OperandKind{} }, .{ .name = "Plus", .value = 1, .parameters = &[_]OperandKind{} }, .{ .name = "Minus", .value = 2, .parameters = &[_]OperandKind{} }, @@ -1509,14 +1524,14 @@ pub const OperandKind = enum { .{ .name = "Constu", .value = 8, .parameters = &[_]OperandKind{.IdRef} }, .{ .name = "Fragment", .value = 9, .parameters = &[_]OperandKind{ .IdRef, .IdRef } }, }, - .@"nonsemantic.shader.debuginfo.100.DebugImportedEntity" => &[_]Enumerant{ + .@"NonSemantic.Shader.DebugInfo.100.DebugImportedEntity" => &[_]Enumerant{ .{ .name = "ImportedModule", .value = 0, .parameters = &[_]OperandKind{} }, .{ .name = "ImportedDeclaration", .value = 1, .parameters = &[_]OperandKind{} }, }, - .@"nonsemantic.clspvreflection.KernelPropertyFlags" => &[_]Enumerant{ + .@"NonSemantic.ClspvReflection.6.KernelPropertyFlags" => &[_]Enumerant{ .{ .name = "MayUsePrintf", .value = 0x1, .parameters = &[_]OperandKind{} }, }, - .@"debuginfo.DebugInfoFlags" => &[_]Enumerant{ + .@"DebugInfo.DebugInfoFlags" => &[_]Enumerant{ .{ .name = "FlagIsProtected", .value = 0x01, .parameters = &[_]OperandKind{} }, .{ .name = "FlagIsPrivate", .value = 0x02, .parameters = &[_]OperandKind{} }, .{ .name = "FlagIsPublic", .value = 0x03, .parameters = &[_]OperandKind{} }, @@ -1533,7 +1548,7 @@ pub const OperandKind = enum { .{ .name = "FlagRValueReference", .value = 0x1000, .parameters = &[_]OperandKind{} }, .{ .name = "FlagIsOptimized", .value = 0x2000, .parameters = &[_]OperandKind{} }, }, - .@"debuginfo.DebugBaseTypeAttributeEncoding" => &[_]Enumerant{ + .@"DebugInfo.DebugBaseTypeAttributeEncoding" => &[_]Enumerant{ .{ .name = "Unspecified", .value = 0, .parameters = &[_]OperandKind{} }, .{ .name = "Address", .value = 1, .parameters = &[_]OperandKind{} }, .{ .name = "Boolean", .value = 2, .parameters = &[_]OperandKind{} }, @@ -1543,17 +1558,17 @@ pub const OperandKind = enum { .{ .name = "Unsigned", .value = 7, .parameters = &[_]OperandKind{} }, .{ .name = "UnsignedChar", .value = 8, .parameters = &[_]OperandKind{} }, }, - .@"debuginfo.DebugCompositeType" => &[_]Enumerant{ + .@"DebugInfo.DebugCompositeType" => &[_]Enumerant{ .{ .name = "Class", .value = 0, .parameters = &[_]OperandKind{} }, .{ .name = "Structure", .value = 1, .parameters = &[_]OperandKind{} }, .{ .name = "Union", .value = 2, .parameters = &[_]OperandKind{} }, }, - .@"debuginfo.DebugTypeQualifier" => &[_]Enumerant{ + .@"DebugInfo.DebugTypeQualifier" => &[_]Enumerant{ .{ .name = "ConstType", .value = 0, .parameters = &[_]OperandKind{} }, .{ .name = "VolatileType", .value = 1, .parameters = &[_]OperandKind{} }, .{ .name = "RestrictType", .value = 2, .parameters = &[_]OperandKind{} }, }, - .@"debuginfo.DebugOperation" => &[_]Enumerant{ + .@"DebugInfo.DebugOperation" => &[_]Enumerant{ .{ .name = "Deref", .value = 0, .parameters = &[_]OperandKind{} }, .{ .name = "Plus", .value = 1, .parameters = &[_]OperandKind{} }, .{ .name = "Minus", .value = 2, .parameters = &[_]OperandKind{} }, @@ -4952,7 +4967,7 @@ pub const StoreCacheControl = enum(u32) { pub const NamedMaximumNumberOfRegisters = enum(u32) { AutoINTEL = 0, }; -pub const @"opencl.debuginfo.100.DebugInfoFlags" = packed struct { +pub const @"OpenCL.DebugInfo.100.DebugInfoFlags" = packed struct { FlagIsProtected: bool = false, FlagIsPrivate: bool = false, FlagIsLocal: bool = false, @@ -4986,7 +5001,7 @@ pub const @"opencl.debuginfo.100.DebugInfoFlags" = packed struct { _reserved_bit_30: bool = false, _reserved_bit_31: bool = false, }; -pub const @"opencl.debuginfo.100.DebugBaseTypeAttributeEncoding" = enum(u32) { +pub const @"OpenCL.DebugInfo.100.DebugBaseTypeAttributeEncoding" = enum(u32) { Unspecified = 0, Address = 1, Boolean = 2, @@ -4996,18 +5011,18 @@ pub const @"opencl.debuginfo.100.DebugBaseTypeAttributeEncoding" = enum(u32) { Unsigned = 6, UnsignedChar = 7, }; -pub const @"opencl.debuginfo.100.DebugCompositeType" = enum(u32) { +pub const @"OpenCL.DebugInfo.100.DebugCompositeType" = enum(u32) { Class = 0, Structure = 1, Union = 2, }; -pub const @"opencl.debuginfo.100.DebugTypeQualifier" = enum(u32) { +pub const @"OpenCL.DebugInfo.100.DebugTypeQualifier" = enum(u32) { ConstType = 0, VolatileType = 1, RestrictType = 2, AtomicType = 3, }; -pub const @"opencl.debuginfo.100.DebugOperation" = enum(u32) { +pub const @"OpenCL.DebugInfo.100.DebugOperation" = enum(u32) { Deref = 0, Plus = 1, Minus = 2, @@ -5019,7 +5034,7 @@ pub const @"opencl.debuginfo.100.DebugOperation" = enum(u32) { Constu = 8, Fragment = 9, - pub const Extended = union(@"opencl.debuginfo.100.DebugOperation") { + pub const Extended = union(@"OpenCL.DebugInfo.100.DebugOperation") { Deref, Plus, Minus, @@ -5032,11 +5047,11 @@ pub const @"opencl.debuginfo.100.DebugOperation" = enum(u32) { Fragment: struct { literal_integer_0: LiteralInteger, literal_integer_1: LiteralInteger }, }; }; -pub const @"opencl.debuginfo.100.DebugImportedEntity" = enum(u32) { +pub const @"OpenCL.DebugInfo.100.DebugImportedEntity" = enum(u32) { ImportedModule = 0, ImportedDeclaration = 1, }; -pub const @"nonsemantic.shader.debuginfo.100.DebugInfoFlags" = packed struct { +pub const @"NonSemantic.Shader.DebugInfo.100.DebugInfoFlags" = packed struct { FlagIsProtected: bool = false, FlagIsPrivate: bool = false, FlagIsLocal: bool = false, @@ -5070,7 +5085,7 @@ pub const @"nonsemantic.shader.debuginfo.100.DebugInfoFlags" = packed struct { _reserved_bit_30: bool = false, _reserved_bit_31: bool = false, }; -pub const @"nonsemantic.shader.debuginfo.100.BuildIdentifierFlags" = packed struct { +pub const @"NonSemantic.Shader.DebugInfo.100.BuildIdentifierFlags" = packed struct { IdentifierPossibleDuplicates: bool = false, _reserved_bit_1: bool = false, _reserved_bit_2: bool = false, @@ -5104,7 +5119,7 @@ pub const @"nonsemantic.shader.debuginfo.100.BuildIdentifierFlags" = packed stru _reserved_bit_30: bool = false, _reserved_bit_31: bool = false, }; -pub const @"nonsemantic.shader.debuginfo.100.DebugBaseTypeAttributeEncoding" = enum(u32) { +pub const @"NonSemantic.Shader.DebugInfo.100.DebugBaseTypeAttributeEncoding" = enum(u32) { Unspecified = 0, Address = 1, Boolean = 2, @@ -5114,18 +5129,18 @@ pub const @"nonsemantic.shader.debuginfo.100.DebugBaseTypeAttributeEncoding" = e Unsigned = 6, UnsignedChar = 7, }; -pub const @"nonsemantic.shader.debuginfo.100.DebugCompositeType" = enum(u32) { +pub const @"NonSemantic.Shader.DebugInfo.100.DebugCompositeType" = enum(u32) { Class = 0, Structure = 1, Union = 2, }; -pub const @"nonsemantic.shader.debuginfo.100.DebugTypeQualifier" = enum(u32) { +pub const @"NonSemantic.Shader.DebugInfo.100.DebugTypeQualifier" = enum(u32) { ConstType = 0, VolatileType = 1, RestrictType = 2, AtomicType = 3, }; -pub const @"nonsemantic.shader.debuginfo.100.DebugOperation" = enum(u32) { +pub const @"NonSemantic.Shader.DebugInfo.100.DebugOperation" = enum(u32) { Deref = 0, Plus = 1, Minus = 2, @@ -5137,7 +5152,7 @@ pub const @"nonsemantic.shader.debuginfo.100.DebugOperation" = enum(u32) { Constu = 8, Fragment = 9, - pub const Extended = union(@"nonsemantic.shader.debuginfo.100.DebugOperation") { + pub const Extended = union(@"NonSemantic.Shader.DebugInfo.100.DebugOperation") { Deref, Plus, Minus, @@ -5150,11 +5165,11 @@ pub const @"nonsemantic.shader.debuginfo.100.DebugOperation" = enum(u32) { Fragment: struct { id_ref_0: IdRef, id_ref_1: IdRef }, }; }; -pub const @"nonsemantic.shader.debuginfo.100.DebugImportedEntity" = enum(u32) { +pub const @"NonSemantic.Shader.DebugInfo.100.DebugImportedEntity" = enum(u32) { ImportedModule = 0, ImportedDeclaration = 1, }; -pub const @"nonsemantic.clspvreflection.KernelPropertyFlags" = packed struct { +pub const @"NonSemantic.ClspvReflection.6.KernelPropertyFlags" = packed struct { MayUsePrintf: bool = false, _reserved_bit_1: bool = false, _reserved_bit_2: bool = false, @@ -5188,7 +5203,7 @@ pub const @"nonsemantic.clspvreflection.KernelPropertyFlags" = packed struct { _reserved_bit_30: bool = false, _reserved_bit_31: bool = false, }; -pub const @"debuginfo.DebugInfoFlags" = packed struct { +pub const @"DebugInfo.DebugInfoFlags" = packed struct { FlagIsProtected: bool = false, FlagIsPrivate: bool = false, FlagIsLocal: bool = false, @@ -5222,7 +5237,7 @@ pub const @"debuginfo.DebugInfoFlags" = packed struct { _reserved_bit_30: bool = false, _reserved_bit_31: bool = false, }; -pub const @"debuginfo.DebugBaseTypeAttributeEncoding" = enum(u32) { +pub const @"DebugInfo.DebugBaseTypeAttributeEncoding" = enum(u32) { Unspecified = 0, Address = 1, Boolean = 2, @@ -5232,17 +5247,17 @@ pub const @"debuginfo.DebugBaseTypeAttributeEncoding" = enum(u32) { Unsigned = 7, UnsignedChar = 8, }; -pub const @"debuginfo.DebugCompositeType" = enum(u32) { +pub const @"DebugInfo.DebugCompositeType" = enum(u32) { Class = 0, Structure = 1, Union = 2, }; -pub const @"debuginfo.DebugTypeQualifier" = enum(u32) { +pub const @"DebugInfo.DebugTypeQualifier" = enum(u32) { ConstType = 0, VolatileType = 1, RestrictType = 2, }; -pub const @"debuginfo.DebugOperation" = enum(u32) { +pub const @"DebugInfo.DebugOperation" = enum(u32) { Deref = 0, Plus = 1, Minus = 2, @@ -5253,7 +5268,7 @@ pub const @"debuginfo.DebugOperation" = enum(u32) { StackValue = 7, Constu = 8, - pub const Extended = union(@"debuginfo.DebugOperation") { + pub const Extended = union(@"DebugInfo.DebugOperation") { Deref, Plus, Minus, @@ -5267,19 +5282,19 @@ pub const @"debuginfo.DebugOperation" = enum(u32) { }; pub const InstructionSet = enum { core, - @"opencl.std.100", - @"glsl.std.450", - @"opencl.debuginfo.100", - @"spv-amd-shader-ballot", - @"nonsemantic.shader.debuginfo.100", - @"nonsemantic.vkspreflection", - @"nonsemantic.clspvreflection", - @"spv-amd-gcn-shader", - @"spv-amd-shader-trinary-minmax", - debuginfo, - @"nonsemantic.debugprintf", - @"spv-amd-shader-explicit-vertex-parameter", - @"nonsemantic.debugbreak", + @"OpenCL.std", + @"GLSL.std.450", + @"OpenCL.DebugInfo.100", + SPV_AMD_shader_ballot, + @"NonSemantic.Shader.DebugInfo.100", + @"NonSemantic.VkspReflection", + @"NonSemantic.ClspvReflection.6", + SPV_AMD_gcn_shader, + SPV_AMD_shader_trinary_minmax, + DebugInfo, + @"NonSemantic.DebugPrintf", + SPV_AMD_shader_explicit_vertex_parameter, + @"NonSemantic.DebugBreak", zig, pub fn instructions(self: InstructionSet) []const Instruction { @@ -12775,7 +12790,7 @@ pub const InstructionSet = enum { }, }, }, - .@"opencl.std.100" => &[_]Instruction{ + .@"OpenCL.std" => &[_]Instruction{ .{ .name = "acos", .opcode = 0, @@ -14025,7 +14040,7 @@ pub const InstructionSet = enum { }, }, }, - .@"glsl.std.450" => &[_]Instruction{ + .@"GLSL.std.450" => &[_]Instruction{ .{ .name = "Round", .opcode = 1, @@ -14633,7 +14648,7 @@ pub const InstructionSet = enum { }, }, }, - .@"opencl.debuginfo.100" => &[_]Instruction{ + .@"OpenCL.DebugInfo.100" => &[_]Instruction{ .{ .name = "DebugInfoNone", .opcode = 0, @@ -14655,7 +14670,7 @@ pub const InstructionSet = enum { .operands = &[_]Operand{ .{ .kind = .IdRef, .quantifier = .required }, .{ .kind = .IdRef, .quantifier = .required }, - .{ .kind = .@"opencl.debuginfo.100.DebugBaseTypeAttributeEncoding", .quantifier = .required }, + .{ .kind = .@"OpenCL.DebugInfo.100.DebugBaseTypeAttributeEncoding", .quantifier = .required }, }, }, .{ @@ -14664,7 +14679,7 @@ pub const InstructionSet = enum { .operands = &[_]Operand{ .{ .kind = .IdRef, .quantifier = .required }, .{ .kind = .StorageClass, .quantifier = .required }, - .{ .kind = .@"opencl.debuginfo.100.DebugInfoFlags", .quantifier = .required }, + .{ .kind = .@"OpenCL.DebugInfo.100.DebugInfoFlags", .quantifier = .required }, }, }, .{ @@ -14672,7 +14687,7 @@ pub const InstructionSet = enum { .opcode = 4, .operands = &[_]Operand{ .{ .kind = .IdRef, .quantifier = .required }, - .{ .kind = .@"opencl.debuginfo.100.DebugTypeQualifier", .quantifier = .required }, + .{ .kind = .@"OpenCL.DebugInfo.100.DebugTypeQualifier", .quantifier = .required }, }, }, .{ @@ -14707,7 +14722,7 @@ pub const InstructionSet = enum { .name = "DebugTypeFunction", .opcode = 8, .operands = &[_]Operand{ - .{ .kind = .@"opencl.debuginfo.100.DebugInfoFlags", .quantifier = .required }, + .{ .kind = .@"OpenCL.DebugInfo.100.DebugInfoFlags", .quantifier = .required }, .{ .kind = .IdRef, .quantifier = .required }, .{ .kind = .IdRef, .quantifier = .variadic }, }, @@ -14723,7 +14738,7 @@ pub const InstructionSet = enum { .{ .kind = .LiteralInteger, .quantifier = .required }, .{ .kind = .IdRef, .quantifier = .required }, .{ .kind = .IdRef, .quantifier = .required }, - .{ .kind = .@"opencl.debuginfo.100.DebugInfoFlags", .quantifier = .required }, + .{ .kind = .@"OpenCL.DebugInfo.100.DebugInfoFlags", .quantifier = .required }, .{ .kind = .PairIdRefIdRef, .quantifier = .variadic }, }, }, @@ -14732,14 +14747,14 @@ pub const InstructionSet = enum { .opcode = 10, .operands = &[_]Operand{ .{ .kind = .IdRef, .quantifier = .required }, - .{ .kind = .@"opencl.debuginfo.100.DebugCompositeType", .quantifier = .required }, + .{ .kind = .@"OpenCL.DebugInfo.100.DebugCompositeType", .quantifier = .required }, .{ .kind = .IdRef, .quantifier = .required }, .{ .kind = .LiteralInteger, .quantifier = .required }, .{ .kind = .LiteralInteger, .quantifier = .required }, .{ .kind = .IdRef, .quantifier = .required }, .{ .kind = .IdRef, .quantifier = .required }, .{ .kind = .IdRef, .quantifier = .required }, - .{ .kind = .@"opencl.debuginfo.100.DebugInfoFlags", .quantifier = .required }, + .{ .kind = .@"OpenCL.DebugInfo.100.DebugInfoFlags", .quantifier = .required }, .{ .kind = .IdRef, .quantifier = .variadic }, }, }, @@ -14755,7 +14770,7 @@ pub const InstructionSet = enum { .{ .kind = .IdRef, .quantifier = .required }, .{ .kind = .IdRef, .quantifier = .required }, .{ .kind = .IdRef, .quantifier = .required }, - .{ .kind = .@"opencl.debuginfo.100.DebugInfoFlags", .quantifier = .required }, + .{ .kind = .@"OpenCL.DebugInfo.100.DebugInfoFlags", .quantifier = .required }, .{ .kind = .IdRef, .quantifier = .optional }, }, }, @@ -14767,7 +14782,7 @@ pub const InstructionSet = enum { .{ .kind = .IdRef, .quantifier = .required }, .{ .kind = .IdRef, .quantifier = .required }, .{ .kind = .IdRef, .quantifier = .required }, - .{ .kind = .@"opencl.debuginfo.100.DebugInfoFlags", .quantifier = .required }, + .{ .kind = .@"OpenCL.DebugInfo.100.DebugInfoFlags", .quantifier = .required }, }, }, .{ @@ -14832,7 +14847,7 @@ pub const InstructionSet = enum { .{ .kind = .IdRef, .quantifier = .required }, .{ .kind = .IdRef, .quantifier = .required }, .{ .kind = .IdRef, .quantifier = .required }, - .{ .kind = .@"opencl.debuginfo.100.DebugInfoFlags", .quantifier = .required }, + .{ .kind = .@"OpenCL.DebugInfo.100.DebugInfoFlags", .quantifier = .required }, .{ .kind = .IdRef, .quantifier = .optional }, }, }, @@ -14847,7 +14862,7 @@ pub const InstructionSet = enum { .{ .kind = .LiteralInteger, .quantifier = .required }, .{ .kind = .IdRef, .quantifier = .required }, .{ .kind = .IdRef, .quantifier = .required }, - .{ .kind = .@"opencl.debuginfo.100.DebugInfoFlags", .quantifier = .required }, + .{ .kind = .@"OpenCL.DebugInfo.100.DebugInfoFlags", .quantifier = .required }, }, }, .{ @@ -14861,7 +14876,7 @@ pub const InstructionSet = enum { .{ .kind = .LiteralInteger, .quantifier = .required }, .{ .kind = .IdRef, .quantifier = .required }, .{ .kind = .IdRef, .quantifier = .required }, - .{ .kind = .@"opencl.debuginfo.100.DebugInfoFlags", .quantifier = .required }, + .{ .kind = .@"OpenCL.DebugInfo.100.DebugInfoFlags", .quantifier = .required }, .{ .kind = .LiteralInteger, .quantifier = .required }, .{ .kind = .IdRef, .quantifier = .required }, .{ .kind = .IdRef, .quantifier = .optional }, @@ -14919,7 +14934,7 @@ pub const InstructionSet = enum { .{ .kind = .LiteralInteger, .quantifier = .required }, .{ .kind = .LiteralInteger, .quantifier = .required }, .{ .kind = .IdRef, .quantifier = .required }, - .{ .kind = .@"opencl.debuginfo.100.DebugInfoFlags", .quantifier = .required }, + .{ .kind = .@"OpenCL.DebugInfo.100.DebugInfoFlags", .quantifier = .required }, .{ .kind = .LiteralInteger, .quantifier = .optional }, }, }, @@ -14954,7 +14969,7 @@ pub const InstructionSet = enum { .name = "DebugOperation", .opcode = 30, .operands = &[_]Operand{ - .{ .kind = .@"opencl.debuginfo.100.DebugOperation", .quantifier = .required }, + .{ .kind = .@"OpenCL.DebugInfo.100.DebugOperation", .quantifier = .required }, .{ .kind = .LiteralInteger, .quantifier = .variadic }, }, }, @@ -14989,7 +15004,7 @@ pub const InstructionSet = enum { .opcode = 34, .operands = &[_]Operand{ .{ .kind = .IdRef, .quantifier = .required }, - .{ .kind = .@"opencl.debuginfo.100.DebugImportedEntity", .quantifier = .required }, + .{ .kind = .@"OpenCL.DebugInfo.100.DebugImportedEntity", .quantifier = .required }, .{ .kind = .IdRef, .quantifier = .required }, .{ .kind = .IdRef, .quantifier = .required }, .{ .kind = .LiteralInteger, .quantifier = .required }, @@ -15020,7 +15035,7 @@ pub const InstructionSet = enum { }, }, }, - .@"spv-amd-shader-ballot" => &[_]Instruction{ + .SPV_AMD_shader_ballot => &[_]Instruction{ .{ .name = "SwizzleInvocationsAMD", .opcode = 1, @@ -15054,7 +15069,7 @@ pub const InstructionSet = enum { }, }, }, - .@"nonsemantic.shader.debuginfo.100" => &[_]Instruction{ + .@"NonSemantic.Shader.DebugInfo.100" => &[_]Instruction{ .{ .name = "DebugInfoNone", .opcode = 0, @@ -15491,7 +15506,7 @@ pub const InstructionSet = enum { }, }, }, - .@"nonsemantic.vkspreflection" => &[_]Instruction{ + .@"NonSemantic.VkspReflection" => &[_]Instruction{ .{ .name = "Configuration", .opcode = 1, @@ -15623,7 +15638,7 @@ pub const InstructionSet = enum { }, }, }, - .@"nonsemantic.clspvreflection" => &[_]Instruction{ + .@"NonSemantic.ClspvReflection.6" => &[_]Instruction{ .{ .name = "Kernel", .opcode = 1, @@ -16030,7 +16045,7 @@ pub const InstructionSet = enum { }, }, }, - .@"spv-amd-gcn-shader" => &[_]Instruction{ + .SPV_AMD_gcn_shader => &[_]Instruction{ .{ .name = "CubeFaceIndexAMD", .opcode = 1, @@ -16051,7 +16066,7 @@ pub const InstructionSet = enum { .operands = &[_]Operand{}, }, }, - .@"spv-amd-shader-trinary-minmax" => &[_]Instruction{ + .SPV_AMD_shader_trinary_minmax => &[_]Instruction{ .{ .name = "FMin3AMD", .opcode = 1, @@ -16134,7 +16149,7 @@ pub const InstructionSet = enum { }, }, }, - .debuginfo => &[_]Instruction{ + .DebugInfo => &[_]Instruction{ .{ .name = "DebugInfoNone", .opcode = 0, @@ -16155,7 +16170,7 @@ pub const InstructionSet = enum { .operands = &[_]Operand{ .{ .kind = .IdRef, .quantifier = .required }, .{ .kind = .IdRef, .quantifier = .required }, - .{ .kind = .@"debuginfo.DebugBaseTypeAttributeEncoding", .quantifier = .required }, + .{ .kind = .@"DebugInfo.DebugBaseTypeAttributeEncoding", .quantifier = .required }, }, }, .{ @@ -16164,7 +16179,7 @@ pub const InstructionSet = enum { .operands = &[_]Operand{ .{ .kind = .IdRef, .quantifier = .required }, .{ .kind = .StorageClass, .quantifier = .required }, - .{ .kind = .@"debuginfo.DebugInfoFlags", .quantifier = .required }, + .{ .kind = .@"DebugInfo.DebugInfoFlags", .quantifier = .required }, }, }, .{ @@ -16172,7 +16187,7 @@ pub const InstructionSet = enum { .opcode = 4, .operands = &[_]Operand{ .{ .kind = .IdRef, .quantifier = .required }, - .{ .kind = .@"debuginfo.DebugTypeQualifier", .quantifier = .required }, + .{ .kind = .@"DebugInfo.DebugTypeQualifier", .quantifier = .required }, }, }, .{ @@ -16222,7 +16237,7 @@ pub const InstructionSet = enum { .{ .kind = .LiteralInteger, .quantifier = .required }, .{ .kind = .IdRef, .quantifier = .required }, .{ .kind = .IdRef, .quantifier = .required }, - .{ .kind = .@"debuginfo.DebugInfoFlags", .quantifier = .required }, + .{ .kind = .@"DebugInfo.DebugInfoFlags", .quantifier = .required }, .{ .kind = .PairIdRefIdRef, .quantifier = .variadic }, }, }, @@ -16231,13 +16246,13 @@ pub const InstructionSet = enum { .opcode = 10, .operands = &[_]Operand{ .{ .kind = .IdRef, .quantifier = .required }, - .{ .kind = .@"debuginfo.DebugCompositeType", .quantifier = .required }, + .{ .kind = .@"DebugInfo.DebugCompositeType", .quantifier = .required }, .{ .kind = .IdRef, .quantifier = .required }, .{ .kind = .LiteralInteger, .quantifier = .required }, .{ .kind = .LiteralInteger, .quantifier = .required }, .{ .kind = .IdRef, .quantifier = .required }, .{ .kind = .IdRef, .quantifier = .required }, - .{ .kind = .@"debuginfo.DebugInfoFlags", .quantifier = .required }, + .{ .kind = .@"DebugInfo.DebugInfoFlags", .quantifier = .required }, .{ .kind = .IdRef, .quantifier = .variadic }, }, }, @@ -16253,7 +16268,7 @@ pub const InstructionSet = enum { .{ .kind = .IdRef, .quantifier = .required }, .{ .kind = .IdRef, .quantifier = .required }, .{ .kind = .IdRef, .quantifier = .required }, - .{ .kind = .@"debuginfo.DebugInfoFlags", .quantifier = .required }, + .{ .kind = .@"DebugInfo.DebugInfoFlags", .quantifier = .required }, .{ .kind = .IdRef, .quantifier = .optional }, }, }, @@ -16265,7 +16280,7 @@ pub const InstructionSet = enum { .{ .kind = .IdRef, .quantifier = .required }, .{ .kind = .IdRef, .quantifier = .required }, .{ .kind = .IdRef, .quantifier = .required }, - .{ .kind = .@"debuginfo.DebugInfoFlags", .quantifier = .required }, + .{ .kind = .@"DebugInfo.DebugInfoFlags", .quantifier = .required }, }, }, .{ @@ -16330,7 +16345,7 @@ pub const InstructionSet = enum { .{ .kind = .IdRef, .quantifier = .required }, .{ .kind = .IdRef, .quantifier = .required }, .{ .kind = .IdRef, .quantifier = .required }, - .{ .kind = .@"debuginfo.DebugInfoFlags", .quantifier = .required }, + .{ .kind = .@"DebugInfo.DebugInfoFlags", .quantifier = .required }, .{ .kind = .IdRef, .quantifier = .optional }, }, }, @@ -16345,7 +16360,7 @@ pub const InstructionSet = enum { .{ .kind = .LiteralInteger, .quantifier = .required }, .{ .kind = .IdRef, .quantifier = .required }, .{ .kind = .IdRef, .quantifier = .required }, - .{ .kind = .@"debuginfo.DebugInfoFlags", .quantifier = .required }, + .{ .kind = .@"DebugInfo.DebugInfoFlags", .quantifier = .required }, }, }, .{ @@ -16359,7 +16374,7 @@ pub const InstructionSet = enum { .{ .kind = .LiteralInteger, .quantifier = .required }, .{ .kind = .IdRef, .quantifier = .required }, .{ .kind = .IdRef, .quantifier = .required }, - .{ .kind = .@"debuginfo.DebugInfoFlags", .quantifier = .required }, + .{ .kind = .@"DebugInfo.DebugInfoFlags", .quantifier = .required }, .{ .kind = .LiteralInteger, .quantifier = .required }, .{ .kind = .IdRef, .quantifier = .required }, .{ .kind = .IdRef, .quantifier = .optional }, @@ -16450,7 +16465,7 @@ pub const InstructionSet = enum { .name = "DebugOperation", .opcode = 30, .operands = &[_]Operand{ - .{ .kind = .@"debuginfo.DebugOperation", .quantifier = .required }, + .{ .kind = .@"DebugInfo.DebugOperation", .quantifier = .required }, .{ .kind = .LiteralInteger, .quantifier = .variadic }, }, }, @@ -16481,7 +16496,7 @@ pub const InstructionSet = enum { }, }, }, - .@"nonsemantic.debugprintf" => &[_]Instruction{ + .@"NonSemantic.DebugPrintf" => &[_]Instruction{ .{ .name = "DebugPrintf", .opcode = 1, @@ -16491,7 +16506,7 @@ pub const InstructionSet = enum { }, }, }, - .@"spv-amd-shader-explicit-vertex-parameter" => &[_]Instruction{ + .SPV_AMD_shader_explicit_vertex_parameter => &[_]Instruction{ .{ .name = "InterpolateAtVertexAMD", .opcode = 1, @@ -16501,7 +16516,7 @@ pub const InstructionSet = enum { }, }, }, - .@"nonsemantic.debugbreak" => &[_]Instruction{ + .@"NonSemantic.DebugBreak" => &[_]Instruction{ .{ .name = "DebugBreak", .opcode = 1, |
