diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2020-01-21 19:40:44 -0500 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2020-01-21 19:40:44 -0500 |
| commit | 92559cd02cbf6497b99eb5193c9094e6d92c214e (patch) | |
| tree | 13ff36b93f06555fd31803750debbd03d10f4b47 /lib/std/target/nvptx.zig | |
| parent | 15d5cab569a5ffc6495d606f460264429043aabf (diff) | |
| download | zig-92559cd02cbf6497b99eb5193c9094e6d92c214e.tar.gz zig-92559cd02cbf6497b99eb5193c9094e6d92c214e.zip | |
hit a comptime limitation with computing dense sets
Diffstat (limited to 'lib/std/target/nvptx.zig')
| -rw-r--r-- | lib/std/target/nvptx.zig | 140 |
1 files changed, 48 insertions, 92 deletions
diff --git a/lib/std/target/nvptx.zig b/lib/std/target/nvptx.zig index 3cc4f18a14..58babffd86 100644 --- a/lib/std/target/nvptx.zig +++ b/lib/std/target/nvptx.zig @@ -33,183 +33,139 @@ pub usingnamespace Cpu.Feature.feature_set_fns(Feature); pub const all_features = blk: { const len = @typeInfo(Feature).Enum.fields.len; - std.debug.assert(len <= Cpu.Feature.Set.bit_count); + std.debug.assert(len <= Cpu.Feature.Set.needed_bit_count); var result: [len]Cpu.Feature = undefined; result[@enumToInt(Feature.ptx32)] = .{ - .index = @enumToInt(Feature.ptx32), - .name = @tagName(Feature.ptx32), .llvm_name = "ptx32", .description = "Use PTX version 3.2", - .dependencies = featureSet(&[_]Feature{}), + .dependencies = sparseFeatureSet(&[_]Feature{}), }; result[@enumToInt(Feature.ptx40)] = .{ - .index = @enumToInt(Feature.ptx40), - .name = @tagName(Feature.ptx40), .llvm_name = "ptx40", .description = "Use PTX version 4.0", - .dependencies = featureSet(&[_]Feature{}), + .dependencies = sparseFeatureSet(&[_]Feature{}), }; result[@enumToInt(Feature.ptx41)] = .{ - .index = @enumToInt(Feature.ptx41), - .name = @tagName(Feature.ptx41), .llvm_name = "ptx41", .description = "Use PTX version 4.1", - .dependencies = featureSet(&[_]Feature{}), + .dependencies = sparseFeatureSet(&[_]Feature{}), }; result[@enumToInt(Feature.ptx42)] = .{ - .index = @enumToInt(Feature.ptx42), - .name = @tagName(Feature.ptx42), .llvm_name = "ptx42", .description = "Use PTX version 4.2", - .dependencies = featureSet(&[_]Feature{}), + .dependencies = sparseFeatureSet(&[_]Feature{}), }; result[@enumToInt(Feature.ptx43)] = .{ - .index = @enumToInt(Feature.ptx43), - .name = @tagName(Feature.ptx43), .llvm_name = "ptx43", .description = "Use PTX version 4.3", - .dependencies = featureSet(&[_]Feature{}), + .dependencies = sparseFeatureSet(&[_]Feature{}), }; result[@enumToInt(Feature.ptx50)] = .{ - .index = @enumToInt(Feature.ptx50), - .name = @tagName(Feature.ptx50), .llvm_name = "ptx50", .description = "Use PTX version 5.0", - .dependencies = featureSet(&[_]Feature{}), + .dependencies = sparseFeatureSet(&[_]Feature{}), }; result[@enumToInt(Feature.ptx60)] = .{ - .index = @enumToInt(Feature.ptx60), - .name = @tagName(Feature.ptx60), .llvm_name = "ptx60", .description = "Use PTX version 6.0", - .dependencies = featureSet(&[_]Feature{}), + .dependencies = sparseFeatureSet(&[_]Feature{}), }; result[@enumToInt(Feature.ptx61)] = .{ - .index = @enumToInt(Feature.ptx61), - .name = @tagName(Feature.ptx61), .llvm_name = "ptx61", .description = "Use PTX version 6.1", - .dependencies = featureSet(&[_]Feature{}), + .dependencies = sparseFeatureSet(&[_]Feature{}), }; result[@enumToInt(Feature.ptx63)] = .{ - .index = @enumToInt(Feature.ptx63), - .name = @tagName(Feature.ptx63), .llvm_name = "ptx63", .description = "Use PTX version 6.3", - .dependencies = featureSet(&[_]Feature{}), + .dependencies = sparseFeatureSet(&[_]Feature{}), }; result[@enumToInt(Feature.ptx64)] = .{ - .index = @enumToInt(Feature.ptx64), - .name = @tagName(Feature.ptx64), .llvm_name = "ptx64", .description = "Use PTX version 6.4", - .dependencies = featureSet(&[_]Feature{}), + .dependencies = sparseFeatureSet(&[_]Feature{}), }; result[@enumToInt(Feature.sm_20)] = .{ - .index = @enumToInt(Feature.sm_20), - .name = @tagName(Feature.sm_20), .llvm_name = "sm_20", .description = "Target SM 2.0", - .dependencies = featureSet(&[_]Feature{}), + .dependencies = sparseFeatureSet(&[_]Feature{}), }; result[@enumToInt(Feature.sm_21)] = .{ - .index = @enumToInt(Feature.sm_21), - .name = @tagName(Feature.sm_21), .llvm_name = "sm_21", .description = "Target SM 2.1", - .dependencies = featureSet(&[_]Feature{}), + .dependencies = sparseFeatureSet(&[_]Feature{}), }; result[@enumToInt(Feature.sm_30)] = .{ - .index = @enumToInt(Feature.sm_30), - .name = @tagName(Feature.sm_30), .llvm_name = "sm_30", .description = "Target SM 3.0", - .dependencies = featureSet(&[_]Feature{}), + .dependencies = sparseFeatureSet(&[_]Feature{}), }; result[@enumToInt(Feature.sm_32)] = .{ - .index = @enumToInt(Feature.sm_32), - .name = @tagName(Feature.sm_32), .llvm_name = "sm_32", .description = "Target SM 3.2", - .dependencies = featureSet(&[_]Feature{}), + .dependencies = sparseFeatureSet(&[_]Feature{}), }; result[@enumToInt(Feature.sm_35)] = .{ - .index = @enumToInt(Feature.sm_35), - .name = @tagName(Feature.sm_35), .llvm_name = "sm_35", .description = "Target SM 3.5", - .dependencies = featureSet(&[_]Feature{}), + .dependencies = sparseFeatureSet(&[_]Feature{}), }; result[@enumToInt(Feature.sm_37)] = .{ - .index = @enumToInt(Feature.sm_37), - .name = @tagName(Feature.sm_37), .llvm_name = "sm_37", .description = "Target SM 3.7", - .dependencies = featureSet(&[_]Feature{}), + .dependencies = sparseFeatureSet(&[_]Feature{}), }; result[@enumToInt(Feature.sm_50)] = .{ - .index = @enumToInt(Feature.sm_50), - .name = @tagName(Feature.sm_50), .llvm_name = "sm_50", .description = "Target SM 5.0", - .dependencies = featureSet(&[_]Feature{}), + .dependencies = sparseFeatureSet(&[_]Feature{}), }; result[@enumToInt(Feature.sm_52)] = .{ - .index = @enumToInt(Feature.sm_52), - .name = @tagName(Feature.sm_52), .llvm_name = "sm_52", .description = "Target SM 5.2", - .dependencies = featureSet(&[_]Feature{}), + .dependencies = sparseFeatureSet(&[_]Feature{}), }; result[@enumToInt(Feature.sm_53)] = .{ - .index = @enumToInt(Feature.sm_53), - .name = @tagName(Feature.sm_53), .llvm_name = "sm_53", .description = "Target SM 5.3", - .dependencies = featureSet(&[_]Feature{}), + .dependencies = sparseFeatureSet(&[_]Feature{}), }; result[@enumToInt(Feature.sm_60)] = .{ - .index = @enumToInt(Feature.sm_60), - .name = @tagName(Feature.sm_60), .llvm_name = "sm_60", .description = "Target SM 6.0", - .dependencies = featureSet(&[_]Feature{}), + .dependencies = sparseFeatureSet(&[_]Feature{}), }; result[@enumToInt(Feature.sm_61)] = .{ - .index = @enumToInt(Feature.sm_61), - .name = @tagName(Feature.sm_61), .llvm_name = "sm_61", .description = "Target SM 6.1", - .dependencies = featureSet(&[_]Feature{}), + .dependencies = sparseFeatureSet(&[_]Feature{}), }; result[@enumToInt(Feature.sm_62)] = .{ - .index = @enumToInt(Feature.sm_62), - .name = @tagName(Feature.sm_62), .llvm_name = "sm_62", .description = "Target SM 6.2", - .dependencies = featureSet(&[_]Feature{}), + .dependencies = sparseFeatureSet(&[_]Feature{}), }; result[@enumToInt(Feature.sm_70)] = .{ - .index = @enumToInt(Feature.sm_70), - .name = @tagName(Feature.sm_70), .llvm_name = "sm_70", .description = "Target SM 7.0", - .dependencies = featureSet(&[_]Feature{}), + .dependencies = sparseFeatureSet(&[_]Feature{}), }; result[@enumToInt(Feature.sm_72)] = .{ - .index = @enumToInt(Feature.sm_72), - .name = @tagName(Feature.sm_72), .llvm_name = "sm_72", .description = "Target SM 7.2", - .dependencies = featureSet(&[_]Feature{}), + .dependencies = sparseFeatureSet(&[_]Feature{}), }; result[@enumToInt(Feature.sm_75)] = .{ - .index = @enumToInt(Feature.sm_75), - .name = @tagName(Feature.sm_75), .llvm_name = "sm_75", .description = "Target SM 7.5", - .dependencies = featureSet(&[_]Feature{}), - }; + .dependencies = sparseFeatureSet(&[_]Feature{}), + }; + const ti = @typeInfo(Feature); + for (result) |*elem, i| { + elem.index = i; + elem.name = ti.Enum.fields[i].name; + elem.dependencies.initAsDependencies(i, &result); + } break :blk result; }; @@ -217,28 +173,28 @@ pub const cpu = struct { pub const sm_20 = Cpu{ .name = "sm_20", .llvm_name = "sm_20", - .features = featureSet(&[_]Feature{ + .features = featureSet(&all_features, &[_]Feature{ .sm_20, }), }; pub const sm_21 = Cpu{ .name = "sm_21", .llvm_name = "sm_21", - .features = featureSet(&[_]Feature{ + .features = featureSet(&all_features, &[_]Feature{ .sm_21, }), }; pub const sm_30 = Cpu{ .name = "sm_30", .llvm_name = "sm_30", - .features = featureSet(&[_]Feature{ + .features = featureSet(&all_features, &[_]Feature{ .sm_30, }), }; pub const sm_32 = Cpu{ .name = "sm_32", .llvm_name = "sm_32", - .features = featureSet(&[_]Feature{ + .features = featureSet(&all_features, &[_]Feature{ .ptx40, .sm_32, }), @@ -246,14 +202,14 @@ pub const cpu = struct { pub const sm_35 = Cpu{ .name = "sm_35", .llvm_name = "sm_35", - .features = featureSet(&[_]Feature{ + .features = featureSet(&all_features, &[_]Feature{ .sm_35, }), }; pub const sm_37 = Cpu{ .name = "sm_37", .llvm_name = "sm_37", - .features = featureSet(&[_]Feature{ + .features = featureSet(&all_features, &[_]Feature{ .ptx41, .sm_37, }), @@ -261,7 +217,7 @@ pub const cpu = struct { pub const sm_50 = Cpu{ .name = "sm_50", .llvm_name = "sm_50", - .features = featureSet(&[_]Feature{ + .features = featureSet(&all_features, &[_]Feature{ .ptx40, .sm_50, }), @@ -269,7 +225,7 @@ pub const cpu = struct { pub const sm_52 = Cpu{ .name = "sm_52", .llvm_name = "sm_52", - .features = featureSet(&[_]Feature{ + .features = featureSet(&all_features, &[_]Feature{ .ptx41, .sm_52, }), @@ -277,7 +233,7 @@ pub const cpu = struct { pub const sm_53 = Cpu{ .name = "sm_53", .llvm_name = "sm_53", - .features = featureSet(&[_]Feature{ + .features = featureSet(&all_features, &[_]Feature{ .ptx42, .sm_53, }), @@ -285,7 +241,7 @@ pub const cpu = struct { pub const sm_60 = Cpu{ .name = "sm_60", .llvm_name = "sm_60", - .features = featureSet(&[_]Feature{ + .features = featureSet(&all_features, &[_]Feature{ .ptx50, .sm_60, }), @@ -293,7 +249,7 @@ pub const cpu = struct { pub const sm_61 = Cpu{ .name = "sm_61", .llvm_name = "sm_61", - .features = featureSet(&[_]Feature{ + .features = featureSet(&all_features, &[_]Feature{ .ptx50, .sm_61, }), @@ -301,7 +257,7 @@ pub const cpu = struct { pub const sm_62 = Cpu{ .name = "sm_62", .llvm_name = "sm_62", - .features = featureSet(&[_]Feature{ + .features = featureSet(&all_features, &[_]Feature{ .ptx50, .sm_62, }), @@ -309,7 +265,7 @@ pub const cpu = struct { pub const sm_70 = Cpu{ .name = "sm_70", .llvm_name = "sm_70", - .features = featureSet(&[_]Feature{ + .features = featureSet(&all_features, &[_]Feature{ .ptx60, .sm_70, }), @@ -317,7 +273,7 @@ pub const cpu = struct { pub const sm_72 = Cpu{ .name = "sm_72", .llvm_name = "sm_72", - .features = featureSet(&[_]Feature{ + .features = featureSet(&all_features, &[_]Feature{ .ptx61, .sm_72, }), @@ -325,7 +281,7 @@ pub const cpu = struct { pub const sm_75 = Cpu{ .name = "sm_75", .llvm_name = "sm_75", - .features = featureSet(&[_]Feature{ + .features = featureSet(&all_features, &[_]Feature{ .ptx63, .sm_75, }), |
