We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 124999d commit 8a24547Copy full SHA for 8a24547
include/scope/do_not_optimize.hpp
@@ -8,10 +8,11 @@ do_not_optimize(Tp const &value) {
8
}
9
10
// https://gcc.gnu.org/onlinedocs/gcc/Machine-Constraints.html#Machine-Constraints
11
+// https://github.com/ROCm-Developer-Tools/HIP/tree/master/samples/2_Cookbook/10_inline_asm
12
template <class Tp>
13
__device__ void __attribute__((always_inline)) do_not_optimize(Tp &value) {
14
#if defined(__HIP_DEVICE_COMPILE__)
- asm volatile("" : "+v"(value) : : "memory");
15
+ asm volatile("" : "=v,m"(value) : : "memory");
16
#else
17
asm volatile("" : "+r,m"(value) : : "memory");
18
#endif
0 commit comments