Skip to content

Commit

Permalink
subgroup: drop the non_uniform from all subgroup functions, matchin…
Browse files Browse the repository at this point in the history
…g glsl
  • Loading branch information
Firestar99 committed Sep 20, 2024
1 parent 96f3959 commit 2502eb1
Show file tree
Hide file tree
Showing 23 changed files with 161 additions and 204 deletions.
137 changes: 50 additions & 87 deletions crates/spirv-std/src/arch/subgroup.rs

Large diffs are not rendered by default.

17 changes: 17 additions & 0 deletions tests/ui/arch/subgroup/subgroup_ballot.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// build-pass
// compile-flags: -C target-feature=+GroupNonUniform,+GroupNonUniformBallot,+ext:SPV_KHR_vulkan_memory_model
// compile-flags: -C llvm-args=--disassemble-fn=subgroup_ballot::subgroup_ballot

use spirv_std::spirv;

unsafe fn subgroup_ballot(predicate: bool) -> bool {
let ballot = spirv_std::arch::subgroup_ballot(predicate);
spirv_std::arch::subgroup_inverse_ballot(ballot)
}

#[spirv(compute(threads(1, 1, 1)))]
pub fn main() {
unsafe {
subgroup_ballot(true);
}
}
17 changes: 17 additions & 0 deletions tests/ui/arch/subgroup/subgroup_ballot_bit_count.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// build-pass
// compile-flags: -C target-feature=+GroupNonUniform,+GroupNonUniformBallot,+ext:SPV_KHR_vulkan_memory_model
// compile-flags: -C llvm-args=--disassemble-fn=subgroup_ballot_bit_count::subgroup_ballot_bit_count

use spirv_std::arch::{GroupOperation, SubgroupMask};
use spirv_std::spirv;

unsafe fn subgroup_ballot_bit_count(ballot: SubgroupMask) -> u32 {
spirv_std::arch::subgroup_ballot_bit_count::<{ GroupOperation::Reduce as u32 }>(ballot)
}

#[spirv(compute(threads(1, 1, 1)))]
pub fn main() {
unsafe {
subgroup_ballot_bit_count(spirv_std::arch::subgroup_ballot(true));
}
}
17 changes: 17 additions & 0 deletions tests/ui/arch/subgroup/subgroup_broadcast_first.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// build-pass
// compile-flags: -C target-feature=+GroupNonUniform,+GroupNonUniformBallot,+ext:SPV_KHR_vulkan_memory_model
// compile-flags: -C llvm-args=--disassemble-fn=subgroup_broadcast_first::subgroup_broadcast_first

use glam::Vec3;
use spirv_std::spirv;

unsafe fn subgroup_broadcast_first(vec: Vec3) -> Vec3 {
spirv_std::arch::subgroup_broadcast_first::<Vec3>(vec)
}

#[spirv(compute(threads(1, 1, 1)))]
pub fn main() {
unsafe {
subgroup_broadcast_first(Vec3::new(1., 2., 3.));
}
}
16 changes: 16 additions & 0 deletions tests/ui/arch/subgroup/subgroup_elect.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// build-pass
// compile-flags: -C target-feature=+GroupNonUniform,+ext:SPV_KHR_vulkan_memory_model
// compile-flags: -C llvm-args=--disassemble-fn=subgroup_elect::subgroup_elect

use spirv_std::spirv;

unsafe fn subgroup_elect() -> bool {
spirv_std::arch::subgroup_elect()
}

#[spirv(compute(threads(1, 1, 1)))]
pub fn main() {
unsafe {
subgroup_elect();
}
}
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
// build-pass
// compile-flags: -C target-feature=+GroupNonUniform,+GroupNonUniformArithmetic,+GroupNonUniformClustered,+ext:SPV_KHR_vulkan_memory_model
// compile-flags: -C llvm-args=--disassemble-fn=subgroup_non_uniform_i_add_clustered::subgroup_non_uniform_i_add_clustered
// compile-flags: -C llvm-args=--disassemble-fn=subgroup_i_add_clustered::subgroup_i_add_clustered

use glam::UVec3;
use spirv_std::arch::{GroupOperation, SubgroupMask};
use spirv_std::spirv;

unsafe fn subgroup_non_uniform_i_add_clustered(value: u32) -> u32 {
spirv_std::arch::subgroup_non_uniform_i_add_clustered::<8, _>(value)
unsafe fn subgroup_i_add_clustered(value: u32) -> u32 {
spirv_std::arch::subgroup_i_add_clustered::<8, _>(value)
}

#[spirv(compute(threads(32, 1, 1)))]
pub fn main(#[spirv(local_invocation_id)] local_invocation_id: UVec3) {
unsafe {
subgroup_non_uniform_i_add_clustered(local_invocation_id.x);
subgroup_i_add_clustered(local_invocation_id.x);
}
}
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
// build-pass
// compile-flags: -C target-feature=+GroupNonUniform,+GroupNonUniformArithmetic,+ext:SPV_KHR_vulkan_memory_model
// compile-flags: -C llvm-args=--disassemble-fn=subgroup_non_uniform_i_add_reduce::subgroup_non_uniform_i_add_reduce
// compile-flags: -C llvm-args=--disassemble-fn=subgroup_i_add_exclusive_scan::subgroup_i_add_exclusive_scan

use glam::UVec3;
use spirv_std::arch::{GroupOperation, SubgroupMask};
use spirv_std::spirv;

unsafe fn subgroup_non_uniform_i_add_reduce(value: u32) -> u32 {
spirv_std::arch::subgroup_non_uniform_i_add::<{ GroupOperation::Reduce as u32 }, _>(value)
unsafe fn subgroup_i_add_exclusive_scan(value: u32) -> u32 {
spirv_std::arch::subgroup_i_add::<{ GroupOperation::ExclusiveScan as u32 }, _>(value)
}

#[spirv(compute(threads(32, 1, 1)))]
pub fn main(#[spirv(local_invocation_id)] local_invocation_id: UVec3) {
unsafe {
subgroup_non_uniform_i_add_reduce(local_invocation_id.x);
subgroup_i_add_exclusive_scan(local_invocation_id.x);
}
}
18 changes: 18 additions & 0 deletions tests/ui/arch/subgroup/subgroup_i_add_inclusive_scan.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// build-pass
// compile-flags: -C target-feature=+GroupNonUniform,+GroupNonUniformArithmetic,+ext:SPV_KHR_vulkan_memory_model
// compile-flags: -C llvm-args=--disassemble-fn=subgroup_i_add_inclusive_scan::subgroup_i_add_inclusive_scan

use glam::UVec3;
use spirv_std::arch::{GroupOperation, SubgroupMask};
use spirv_std::spirv;

unsafe fn subgroup_i_add_inclusive_scan(value: u32) -> u32 {
spirv_std::arch::subgroup_i_add::<{ GroupOperation::InclusiveScan as u32 }, _>(value)
}

#[spirv(compute(threads(32, 1, 1)))]
pub fn main(#[spirv(local_invocation_id)] local_invocation_id: UVec3) {
unsafe {
subgroup_i_add_inclusive_scan(local_invocation_id.x);
}
}
18 changes: 18 additions & 0 deletions tests/ui/arch/subgroup/subgroup_i_add_reduce.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// build-pass
// compile-flags: -C target-feature=+GroupNonUniform,+GroupNonUniformArithmetic,+ext:SPV_KHR_vulkan_memory_model
// compile-flags: -C llvm-args=--disassemble-fn=subgroup_i_add_reduce::subgroup_i_add_reduce

use glam::UVec3;
use spirv_std::arch::{GroupOperation, SubgroupMask};
use spirv_std::spirv;

unsafe fn subgroup_i_add_reduce(value: u32) -> u32 {
spirv_std::arch::subgroup_i_add::<{ GroupOperation::Reduce as u32 }, _>(value)
}

#[spirv(compute(threads(32, 1, 1)))]
pub fn main(#[spirv(local_invocation_id)] local_invocation_id: UVec3) {
unsafe {
subgroup_i_add_reduce(local_invocation_id.x);
}
}
17 changes: 0 additions & 17 deletions tests/ui/arch/subgroup/subgroup_non_uniform_ballot.rs

This file was deleted.

19 changes: 0 additions & 19 deletions tests/ui/arch/subgroup/subgroup_non_uniform_ballot_bit_count.rs

This file was deleted.

17 changes: 0 additions & 17 deletions tests/ui/arch/subgroup/subgroup_non_uniform_broadcast_first.rs

This file was deleted.

16 changes: 0 additions & 16 deletions tests/ui/arch/subgroup/subgroup_non_uniform_elect.rs

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit 2502eb1

Please sign in to comment.