Skip to content

Commit 837e0f9

Browse files
committed
std.Target: Remove ObjectFormat.nvptx (and associated linker code).
Textual PTX is just assembly language like any other. And if we do ever add support for emitting PTX object files after reverse engineering the bytecode format, we'd be emitting ELF files like the CUDA toolchain. So there's really no need for a special ObjectFormat tag here, nor linker code that treats it as a distinct format.
1 parent 2c241b2 commit 837e0f9

File tree

9 files changed

+4
-147
lines changed

9 files changed

+4
-147
lines changed

CMakeLists.txt

-1
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,6 @@ set(ZIG_STAGE2_SOURCES
640640
src/link/MachO/synthetic.zig
641641
src/link/MachO/Thunk.zig
642642
src/link/MachO/uuid.zig
643-
src/link/NvPtx.zig
644643
src/link/Plan9.zig
645644
src/link/Plan9/aout.zig
646645
src/link/SpirV.zig

lib/std/Target.zig

-4
Original file line numberDiff line numberDiff line change
@@ -1017,8 +1017,6 @@ pub const ObjectFormat = enum {
10171017
hex,
10181018
/// The Mach object format used by macOS and other Apple platforms.
10191019
macho,
1020-
/// Nvidia's PTX (Parallel Thread Execution) assembly language.
1021-
nvptx,
10221020
/// The a.out format used by Plan 9 from Bell Labs.
10231021
plan9,
10241022
/// Machine code with no metadata.
@@ -1039,7 +1037,6 @@ pub const ObjectFormat = enum {
10391037
.coff => ".obj",
10401038
.elf, .goff, .macho, .wasm, .xcoff => ".o",
10411039
.hex => ".ihex",
1042-
.nvptx => ".ptx",
10431040
.plan9 => arch.plan9Ext(),
10441041
.raw => ".bin",
10451042
.spirv => ".spv",
@@ -1054,7 +1051,6 @@ pub const ObjectFormat = enum {
10541051
.uefi, .windows => .coff,
10551052
.zos => .goff,
10561053
else => switch (arch) {
1057-
.nvptx, .nvptx64 => .nvptx,
10581054
.spirv, .spirv32, .spirv64 => .spirv,
10591055
.wasm32, .wasm64 => .wasm,
10601056
else => .elf,

lib/std/zig.zig

-1
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,6 @@ pub fn binNameAlloc(allocator: Allocator, options: BinNameOptions) error{OutOfMe
232232
t.libPrefix(), root_name,
233233
}),
234234
},
235-
.nvptx => return std.fmt.allocPrint(allocator, "{s}.ptx", .{root_name}),
236235
}
237236
}
238237

src/Compilation/Config.zig

+1-1
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ pub fn resolve(options: Options) ResolveError!Config {
434434
.windows, .uefi => .code_view,
435435
else => .{ .dwarf = .@"32" },
436436
},
437-
.spirv, .nvptx, .hex, .raw, .plan9 => .strip,
437+
.spirv, .hex, .raw, .plan9 => .strip,
438438
};
439439
};
440440

src/codegen.zig

-2
Original file line numberDiff line numberDiff line change
@@ -666,7 +666,6 @@ fn lowerUavRef(
666666
switch (lf.tag) {
667667
.c => unreachable,
668668
.spirv => unreachable,
669-
.nvptx => unreachable,
670669
.wasm => {
671670
dev.check(link.File.Tag.wasm.devFeature());
672671
const wasm = lf.cast(.wasm).?;
@@ -739,7 +738,6 @@ fn lowerNavRef(
739738
switch (lf.tag) {
740739
.c => unreachable,
741740
.spirv => unreachable,
742-
.nvptx => unreachable,
743741
.wasm => {
744742
dev.check(link.File.Tag.wasm.devFeature());
745743
const wasm = lf.cast(.wasm).?;

src/dev.zig

-2
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ pub const Env = enum {
8181
.wasm_linker,
8282
.spirv_linker,
8383
.plan9_linker,
84-
.nvptx_linker,
8584
.goff_linker,
8685
.xcoff_linker,
8786
=> true,
@@ -229,7 +228,6 @@ pub const Feature = enum {
229228
wasm_linker,
230229
spirv_linker,
231230
plan9_linker,
232-
nvptx_linker,
233231
goff_linker,
234232
xcoff_linker,
235233
};

src/link.zig

+3-12
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,7 @@ pub const File = struct {
597597
.mode = determineMode(use_lld, output_mode, link_mode),
598598
});
599599
},
600-
.c, .spirv, .nvptx => dev.checkAny(&.{ .c_linker, .spirv_linker, .nvptx_linker }),
600+
.c, .spirv => dev.checkAny(&.{ .c_linker, .spirv_linker }),
601601
}
602602
}
603603

@@ -670,7 +670,7 @@ pub const File = struct {
670670
}
671671
}
672672
},
673-
.c, .spirv, .nvptx => dev.checkAny(&.{ .c_linker, .spirv_linker, .nvptx_linker }),
673+
.c, .spirv => dev.checkAny(&.{ .c_linker, .spirv_linker }),
674674
}
675675
}
676676

@@ -697,7 +697,6 @@ pub const File = struct {
697697
.plan9 => unreachable,
698698
.spirv => unreachable,
699699
.c => unreachable,
700-
.nvptx => unreachable,
701700
inline else => |tag| {
702701
dev.check(tag.devFeature());
703702
return @as(*tag.Type(), @fieldParentPtr("base", base)).getGlobalSymbol(name, lib_name);
@@ -766,7 +765,7 @@ pub const File = struct {
766765
}
767766

768767
switch (base.tag) {
769-
.spirv, .nvptx => {},
768+
.spirv => {},
770769
.goff, .xcoff => {},
771770
inline else => |tag| {
772771
dev.check(tag.devFeature());
@@ -901,7 +900,6 @@ pub const File = struct {
901900
switch (base.tag) {
902901
.c => unreachable,
903902
.spirv => unreachable,
904-
.nvptx => unreachable,
905903
.wasm => unreachable,
906904
.goff, .xcoff => unreachable,
907905
inline else => |tag| {
@@ -921,7 +919,6 @@ pub const File = struct {
921919
switch (base.tag) {
922920
.c => unreachable,
923921
.spirv => unreachable,
924-
.nvptx => unreachable,
925922
.wasm => unreachable,
926923
.goff, .xcoff => unreachable,
927924
inline else => |tag| {
@@ -935,7 +932,6 @@ pub const File = struct {
935932
switch (base.tag) {
936933
.c => unreachable,
937934
.spirv => unreachable,
938-
.nvptx => unreachable,
939935
.wasm => unreachable,
940936
.goff, .xcoff => unreachable,
941937
inline else => |tag| {
@@ -953,7 +949,6 @@ pub const File = struct {
953949
switch (base.tag) {
954950
.plan9,
955951
.spirv,
956-
.nvptx,
957952
.goff,
958953
.xcoff,
959954
=> {},
@@ -1251,7 +1246,6 @@ pub const File = struct {
12511246
wasm,
12521247
spirv,
12531248
plan9,
1254-
nvptx,
12551249
goff,
12561250
xcoff,
12571251

@@ -1264,7 +1258,6 @@ pub const File = struct {
12641258
.wasm => Wasm,
12651259
.spirv => SpirV,
12661260
.plan9 => Plan9,
1267-
.nvptx => NvPtx,
12681261
.goff => Goff,
12691262
.xcoff => Xcoff,
12701263
};
@@ -1279,7 +1272,6 @@ pub const File = struct {
12791272
.plan9 => .plan9,
12801273
.c => .c,
12811274
.spirv => .spirv,
1282-
.nvptx => .nvptx,
12831275
.goff => .goff,
12841276
.xcoff => .xcoff,
12851277
.hex => @panic("TODO implement hex object format"),
@@ -1386,7 +1378,6 @@ pub const File = struct {
13861378
pub const MachO = @import("link/MachO.zig");
13871379
pub const SpirV = @import("link/SpirV.zig");
13881380
pub const Wasm = @import("link/Wasm.zig");
1389-
pub const NvPtx = @import("link/NvPtx.zig");
13901381
pub const Goff = @import("link/Goff.zig");
13911382
pub const Xcoff = @import("link/Xcoff.zig");
13921383
pub const Dwarf = @import("link/Dwarf.zig");

src/link/NvPtx.zig

-123
This file was deleted.

src/target.zig

-1
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,6 @@ pub fn hasLlvmSupport(target: std.Target, ofmt: std.Target.ObjectFormat) bool {
140140
.goff,
141141
.hex,
142142
.macho,
143-
.nvptx,
144143
.spirv,
145144
.raw,
146145
.wasm,

0 commit comments

Comments
 (0)