Skip to content

Commit acdf98c

Browse files
committed
Merge branch 'master' into k12
* master: Implement threaded BLAKE3 (ziglang#25587) std: Skip element comparisons if `mem.order` args point to same memory std.Target: bump vulkan max version to 1.4.331 std.Target: bump opencl/nvcl max version to 3.0.19 std.Target: bump cuda max version to 13.0.2 std.Target: bump amdhsa max version to 7.1.0 std.Target: bump wasi max version to 0.3.0 std.Target: bump dragonfly max version to 6.4.2 std.Target: bump linux max version to 6.17 std.Target: bump fuchsia max version to 28.0.0 std.Target: bump contiki max version to 5.1.0 test: remove some unsupported x86_64 darwin targets from llvm_targets std.os.windows: eliminate forwarder function in kernel32 (ziglang#25766)
2 parents cdf26a9 + d5585bc commit acdf98c

File tree

13 files changed

+374
-129
lines changed

13 files changed

+374
-129
lines changed

lib/std/Target.zig

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -398,13 +398,13 @@ pub const Os = struct {
398398
.contiki => .{
399399
.semver = .{
400400
.min = .{ .major = 4, .minor = 0, .patch = 0 },
401-
.max = .{ .major = 5, .minor = 0, .patch = 0 },
401+
.max = .{ .major = 5, .minor = 1, .patch = 0 },
402402
},
403403
},
404404
.fuchsia => .{
405405
.semver = .{
406406
.min = .{ .major = 1, .minor = 0, .patch = 0 },
407-
.max = .{ .major = 27, .minor = 0, .patch = 0 },
407+
.max = .{ .major = 28, .minor = 0, .patch = 0 },
408408
},
409409
},
410410
.hermit => .{
@@ -439,7 +439,7 @@ pub const Os = struct {
439439

440440
break :blk default_min;
441441
},
442-
.max = .{ .major = 6, .minor = 16, .patch = 0 },
442+
.max = .{ .major = 6, .minor = 17, .patch = 0 },
443443
},
444444
.glibc = blk: {
445445
// For 32-bit targets that traditionally used 32-bit time, we require
@@ -488,7 +488,7 @@ pub const Os = struct {
488488
.dragonfly => .{
489489
.semver = .{
490490
.min = .{ .major = 6, .minor = 0, .patch = 0 },
491-
.max = .{ .major = 6, .minor = 4, .patch = 1 },
491+
.max = .{ .major = 6, .minor = 4, .patch = 2 },
492492
},
493493
},
494494
.freebsd => .{
@@ -607,14 +607,14 @@ pub const Os = struct {
607607
.wasi => .{
608608
.semver = .{
609609
.min = .{ .major = 0, .minor = 1, .patch = 0 },
610-
.max = .{ .major = 0, .minor = 2, .patch = 2 },
610+
.max = .{ .major = 0, .minor = 3, .patch = 0 },
611611
},
612612
},
613613

614614
.amdhsa => .{
615615
.semver = .{
616616
.min = .{ .major = 5, .minor = 0, .patch = 0 },
617-
.max = .{ .major = 6, .minor = 4, .patch = 2 },
617+
.max = .{ .major = 7, .minor = 1, .patch = 0 },
618618
},
619619
},
620620
.amdpal => .{
@@ -626,15 +626,15 @@ pub const Os = struct {
626626
.cuda => .{
627627
.semver = .{
628628
.min = .{ .major = 11, .minor = 0, .patch = 1 },
629-
.max = .{ .major = 12, .minor = 9, .patch = 1 },
629+
.max = .{ .major = 13, .minor = 0, .patch = 2 },
630630
},
631631
},
632632
.nvcl,
633633
.opencl,
634634
=> .{
635635
.semver = .{
636636
.min = .{ .major = 2, .minor = 2, .patch = 0 },
637-
.max = .{ .major = 3, .minor = 0, .patch = 17 },
637+
.max = .{ .major = 3, .minor = 0, .patch = 19 },
638638
},
639639
},
640640
.opengl => .{
@@ -646,7 +646,7 @@ pub const Os = struct {
646646
.vulkan => .{
647647
.semver = .{
648648
.min = .{ .major = 1, .minor = 2, .patch = 0 },
649-
.max = .{ .major = 1, .minor = 4, .patch = 321 },
649+
.max = .{ .major = 1, .minor = 4, .patch = 331 },
650650
},
651651
},
652652
};

lib/std/Thread.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -674,7 +674,7 @@ const WindowsThreadImpl = struct {
674674

675675
const heap_handle = windows.kernel32.GetProcessHeap() orelse return error.OutOfMemory;
676676
const alloc_bytes = @alignOf(Instance) + @sizeOf(Instance);
677-
const alloc_ptr = windows.kernel32.HeapAlloc(heap_handle, 0, alloc_bytes) orelse return error.OutOfMemory;
677+
const alloc_ptr = windows.ntdll.RtlAllocateHeap(heap_handle, 0, alloc_bytes) orelse return error.OutOfMemory;
678678
errdefer assert(windows.kernel32.HeapFree(heap_handle, 0, alloc_ptr) != 0);
679679

680680
const instance_bytes = @as([*]u8, @ptrCast(alloc_ptr))[0..alloc_bytes];

lib/std/Thread/Condition.zig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,8 @@ const WindowsImpl = struct {
180180

181181
fn wake(self: *Impl, comptime notify: Notify) void {
182182
switch (notify) {
183-
.one => os.windows.kernel32.WakeConditionVariable(&self.condition),
184-
.all => os.windows.kernel32.WakeAllConditionVariable(&self.condition),
183+
.one => os.windows.ntdll.RtlWakeConditionVariable(&self.condition),
184+
.all => os.windows.ntdll.RtlWakeAllConditionVariable(&self.condition),
185185
}
186186
}
187187
};

lib/std/Thread/Mutex.zig

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,15 +109,15 @@ const WindowsImpl = struct {
109109
srwlock: windows.SRWLOCK = .{},
110110

111111
fn tryLock(self: *@This()) bool {
112-
return windows.kernel32.TryAcquireSRWLockExclusive(&self.srwlock) != windows.FALSE;
112+
return windows.ntdll.RtlTryAcquireSRWLockExclusive(&self.srwlock) != windows.FALSE;
113113
}
114114

115115
fn lock(self: *@This()) void {
116-
windows.kernel32.AcquireSRWLockExclusive(&self.srwlock);
116+
windows.ntdll.RtlAcquireSRWLockExclusive(&self.srwlock);
117117
}
118118

119119
fn unlock(self: *@This()) void {
120-
windows.kernel32.ReleaseSRWLockExclusive(&self.srwlock);
120+
windows.ntdll.RtlReleaseSRWLockExclusive(&self.srwlock);
121121
}
122122

123123
const windows = std.os.windows;

lib/std/ascii.zig

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -420,13 +420,15 @@ test indexOfIgnoreCase {
420420

421421
/// Returns the lexicographical order of two slices. O(n).
422422
pub fn orderIgnoreCase(lhs: []const u8, rhs: []const u8) std.math.Order {
423-
const n = @min(lhs.len, rhs.len);
424-
var i: usize = 0;
425-
while (i < n) : (i += 1) {
426-
switch (std.math.order(toLower(lhs[i]), toLower(rhs[i]))) {
427-
.eq => continue,
428-
.lt => return .lt,
429-
.gt => return .gt,
423+
if (lhs.ptr != rhs.ptr) {
424+
const n = @min(lhs.len, rhs.len);
425+
var i: usize = 0;
426+
while (i < n) : (i += 1) {
427+
switch (std.math.order(toLower(lhs[i]), toLower(rhs[i]))) {
428+
.eq => continue,
429+
.lt => return .lt,
430+
.gt => return .gt,
431+
}
430432
}
431433
}
432434
return std.math.order(lhs.len, rhs.len);

lib/std/crypto/benchmark.zig

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ const hashes = [_]Crypto{
3535
Crypto{ .ty = crypto.hash.Blake3, .name = "blake3" },
3636
};
3737

38+
const parallel_hashes = [_]Crypto{
39+
Crypto{ .ty = crypto.hash.Blake3, .name = "blake3-parallel" },
40+
};
41+
3842
const block_size: usize = 8 * 8192;
3943

4044
pub fn benchmarkHash(comptime Hash: anytype, comptime bytes: comptime_int) !u64 {
@@ -61,6 +65,25 @@ pub fn benchmarkHash(comptime Hash: anytype, comptime bytes: comptime_int) !u64
6165
return throughput;
6266
}
6367

68+
pub fn benchmarkHashParallel(comptime Hash: anytype, comptime bytes: comptime_int, allocator: mem.Allocator, io: std.Io) !u64 {
69+
const data: []u8 = try allocator.alloc(u8, bytes);
70+
defer allocator.free(data);
71+
random.bytes(data);
72+
73+
var timer = try Timer.start();
74+
const start = timer.lap();
75+
var final: [Hash.digest_length]u8 = undefined;
76+
try Hash.hashParallel(data, &final, .{}, allocator, io);
77+
std.mem.doNotOptimizeAway(final);
78+
79+
const end = timer.read();
80+
81+
const elapsed_s = @as(f64, @floatFromInt(end - start)) / time.ns_per_s;
82+
const throughput = @as(u64, @intFromFloat(bytes / elapsed_s));
83+
84+
return throughput;
85+
}
86+
6487
const macs = [_]Crypto{
6588
Crypto{ .ty = crypto.onetimeauth.Ghash, .name = "ghash" },
6689
Crypto{ .ty = crypto.onetimeauth.Polyval, .name = "polyval" },
@@ -512,6 +535,18 @@ pub fn main() !void {
512535
}
513536
}
514537

538+
var io_threaded = std.Io.Threaded.init(arena_allocator);
539+
defer io_threaded.deinit();
540+
const io = io_threaded.io();
541+
542+
inline for (parallel_hashes) |H| {
543+
if (filter == null or std.mem.indexOf(u8, H.name, filter.?) != null) {
544+
const throughput = try benchmarkHashParallel(H.ty, mode(128 * MiB), arena_allocator, io);
545+
try stdout.print("{s:>17}: {:10} MiB/s\n", .{ H.name, throughput / (1 * MiB) });
546+
try stdout.flush();
547+
}
548+
}
549+
515550
inline for (macs) |M| {
516551
if (filter == null or std.mem.indexOf(u8, M.name, filter.?) != null) {
517552
const throughput = try benchmarkMac(M.ty, mode(128 * MiB));

0 commit comments

Comments
 (0)