Skip to content

Commit 79568fc

Browse files
LegNeatoFirestar99
authored andcommitted
Cleanup / make more consistent
1 parent f856181 commit 79568fc

File tree

3 files changed

+25
-25
lines changed
  • tests/difftests/tests
    • arch
      • atomic_ops/atomic_ops-rust/src
      • memory_barriers/memory_barriers-rust/src
    • lang/core/ops/vector_swizzle/vector_swizzle-rust/src

3 files changed

+25
-25
lines changed

tests/difftests/tests/arch/atomic_ops/atomic_ops-rust/src/main.rs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
#[cfg(not(target_arch = "spirv"))]
2-
fn main() {
3-
use difftest::config::Config;
4-
use difftest::scaffold::compute::{
5-
BufferConfig, BufferUsage, RustComputeShader, WgpuComputeTestMultiBuffer,
6-
};
1+
use difftest::config::Config;
2+
use difftest::scaffold::compute::{
3+
BufferConfig, BufferUsage, RustComputeShader, WgpuComputeTestMultiBuffer,
4+
};
75

6+
fn main() {
87
let config = Config::from_path(std::env::args().nth(1).unwrap()).unwrap();
98

109
// Initialize counter buffer with test values
@@ -32,6 +31,3 @@ fn main() {
3231

3332
test.run_test(&config).unwrap();
3433
}
35-
36-
#[cfg(target_arch = "spirv")]
37-
fn main() {}

tests/difftests/tests/arch/memory_barriers/memory_barriers-rust/src/lib.rs

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -27,24 +27,29 @@ pub fn main_cs(
2727
let mut result = shared[lid];
2828

2929
// Different threads perform different operations
30-
if lid % 4 == 0 {
31-
// Read from neighboring thread's data
32-
if lid + 1 < 64 {
33-
result += shared[lid + 1];
30+
match lid % 4 {
31+
0 => {
32+
// Read from neighboring thread's data
33+
if lid + 1 < 64 {
34+
result += shared[lid + 1];
35+
}
3436
}
35-
} else if lid % 4 == 1 {
36-
// Read from previous thread's data
37-
if lid > 0 {
38-
result += shared[lid - 1];
37+
1 => {
38+
// Read from previous thread's data
39+
if lid > 0 {
40+
result += shared[lid - 1];
41+
}
3942
}
40-
} else if lid % 4 == 2 {
41-
// Sum reduction within groups of 4
42-
if lid + 2 < 64 {
43-
result = shared[lid] + shared[lid + 1] + shared[lid + 2];
43+
2 => {
44+
// Sum reduction within groups of 4
45+
if lid + 2 < 64 {
46+
result = shared[lid] + shared[lid + 1] + shared[lid + 2];
47+
}
48+
}
49+
_ => {
50+
// XOR with wrapped neighbor
51+
result ^= shared[(lid + 32) % 64];
4452
}
45-
} else {
46-
// XOR with wrapped neighbor
47-
result ^= shared[(lid + 32) % 64];
4853
}
4954

5055
// Another barrier before writing back

tests/difftests/tests/lang/core/ops/vector_swizzle/vector_swizzle-rust/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#![no_std]
2-
#![cfg_attr(target_arch = "spirv", feature(asm_experimental_arch))]
32

43
use glam::{Vec3Swizzles, Vec4, Vec4Swizzles};
54
use spirv_std::spirv;

0 commit comments

Comments
 (0)