-
Notifications
You must be signed in to change notification settings - Fork 244
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added memory barrier intrinsics to spirv-std (#769)
* added memory barrier intrinsics to spirv-std * added function-level docs * added unit-tests constants could not be validated in tests because of the limited output * clippy fixes * improved documentation * Added missing features to device_memory and all_memory barrier intrinsics.
- Loading branch information
1 parent
1fbb241
commit 4831789
Showing
13 changed files
with
247 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// build-pass | ||
// compile-flags: -C target-feature=+VulkanMemoryModelDeviceScopeKHR,+ext:SPV_KHR_vulkan_memory_model | ||
// compile-flags: -C llvm-args=--disassemble-fn=all_memory_barrier::all_memory_barrier | ||
|
||
use spirv_std as _; | ||
|
||
unsafe fn all_memory_barrier() { | ||
spirv_std::arch::all_memory_barrier(); | ||
} | ||
|
||
#[spirv(compute(threads(1, 1, 1)))] | ||
pub fn main() { | ||
unsafe { | ||
all_memory_barrier(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
%1 = OpFunction %2 None %3 | ||
%4 = OpLabel | ||
OpLine %5 72 4 | ||
OpMemoryBarrier %6 %7 | ||
OpLine %8 9 1 | ||
OpReturn | ||
OpFunctionEnd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// build-pass | ||
// compile-flags: -C target-feature=+VulkanMemoryModelDeviceScopeKHR,+ext:SPV_KHR_vulkan_memory_model | ||
// compile-flags: -C llvm-args=--disassemble-fn=all_memory_barrier_with_group_sync::all_memory_barrier_with_group_sync | ||
|
||
use spirv_std as _; | ||
|
||
unsafe fn all_memory_barrier_with_group_sync() { | ||
spirv_std::arch::all_memory_barrier_with_group_sync(); | ||
} | ||
|
||
#[spirv(compute(threads(1, 1, 1)))] | ||
pub fn main() { | ||
unsafe { | ||
all_memory_barrier_with_group_sync(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
%1 = OpFunction %2 None %3 | ||
%4 = OpLabel | ||
OpLine %5 38 4 | ||
OpControlBarrier %6 %7 %8 | ||
OpLine %9 9 1 | ||
OpReturn | ||
OpFunctionEnd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// build-pass | ||
// compile-flags: -C target-feature=+VulkanMemoryModelDeviceScopeKHR,+ext:SPV_KHR_vulkan_memory_model | ||
// compile-flags: -C llvm-args=--disassemble-fn=device_memory_barrier::device_memory_barrier | ||
|
||
use spirv_std as _; | ||
|
||
unsafe fn device_memory_barrier() { | ||
spirv_std::arch::device_memory_barrier(); | ||
} | ||
|
||
#[spirv(compute(threads(1, 1, 1)))] | ||
pub fn main() { | ||
unsafe { | ||
device_memory_barrier(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
%1 = OpFunction %2 None %3 | ||
%4 = OpLabel | ||
OpLine %5 72 4 | ||
OpMemoryBarrier %6 %7 | ||
OpLine %8 9 1 | ||
OpReturn | ||
OpFunctionEnd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// build-pass | ||
// compile-flags: -C target-feature=+VulkanMemoryModelDeviceScopeKHR,+ext:SPV_KHR_vulkan_memory_model | ||
// compile-flags: -C llvm-args=--disassemble-fn=device_memory_barrier_with_group_sync::device_memory_barrier_with_group_sync | ||
|
||
use spirv_std as _; | ||
|
||
unsafe fn device_memory_barrier_with_group_sync() { | ||
spirv_std::arch::device_memory_barrier_with_group_sync(); | ||
} | ||
|
||
#[spirv(compute(threads(1, 1, 1)))] | ||
pub fn main() { | ||
unsafe { | ||
device_memory_barrier_with_group_sync(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
%1 = OpFunction %2 None %3 | ||
%4 = OpLabel | ||
OpLine %5 38 4 | ||
OpControlBarrier %6 %7 %8 | ||
OpLine %9 9 1 | ||
OpReturn | ||
OpFunctionEnd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// build-pass | ||
// compile-flags: -C llvm-args=--disassemble-fn=workgroup_memory_barrier::workgroup_memory_barrier | ||
|
||
use spirv_std as _; | ||
|
||
unsafe fn workgroup_memory_barrier() { | ||
spirv_std::arch::workgroup_memory_barrier(); | ||
} | ||
|
||
#[spirv(compute(threads(1, 1, 1)))] | ||
pub fn main() { | ||
unsafe { | ||
workgroup_memory_barrier(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
%1 = OpFunction %2 None %3 | ||
%4 = OpLabel | ||
OpLine %5 72 4 | ||
OpMemoryBarrier %6 %7 | ||
OpLine %8 8 1 | ||
OpReturn | ||
OpFunctionEnd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// build-pass | ||
// compile-flags: -C llvm-args=--disassemble-fn=workgroup_memory_barrier_with_group_sync::workgroup_memory_barrier_with_group_sync | ||
|
||
use spirv_std as _; | ||
|
||
unsafe fn workgroup_memory_barrier_with_group_sync() { | ||
spirv_std::arch::workgroup_memory_barrier_with_group_sync(); | ||
} | ||
|
||
#[spirv(compute(threads(1, 1, 1)))] | ||
pub fn main() { | ||
unsafe { | ||
workgroup_memory_barrier_with_group_sync(); | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
tests/ui/arch/workgroup_memory_barrier_with_group_sync.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
%1 = OpFunction %2 None %3 | ||
%4 = OpLabel | ||
OpLine %5 38 4 | ||
OpControlBarrier %6 %6 %7 | ||
OpLine %8 8 1 | ||
OpReturn | ||
OpFunctionEnd |