NVlabs / nvdiffrast

Nvdiffrast - Modular Primitives for High-Performance Differentiable Rendering
Other
1.35k stars 144 forks source link

identifier "__match_any_sync" is undefined #4

Closed zakharos closed 3 years ago

zakharos commented 3 years ago

I get the above error when running your code in a docker container. I suppose it's due to the fact that warp match functions are only supported by devices of compute capability 7.x or higher and my GPU has the compute capability of 6.1. Could you provide a workaround for such cases? Thank you!

s-laine commented 3 years ago

The warp matching is related to coalescing of atomic operations which reduces memory bandwidth in gradient calculations. To disable coalescing and perform the atomics one by one, you can replace the entire block of coalescing macros at the end of nvdiffrast/common/common.h with the following:

#define CA_TEMP       _ca_temp
#define CA_TEMP_PARAM float CA_TEMP
#define CA_DECLARE_TEMP(threads_per_block) CA_TEMP_PARAM
#define CA_SET_GROUP_MASK(group, thread_mask)
#define CA_SET_GROUP(group)
#define caAtomicAdd(ptr, value) atomicAdd((ptr), (value))
#define caAtomicAdd3_xyw(ptr, x, y, w)  \
    do {                                \
        atomicAdd((ptr), (x));          \
        atomicAdd((ptr)+1, (y));        \
        atomicAdd((ptr)+3, (w));        \
    } while(0)
#define caAtomicAddTexture(ptr, level, idx, value) atomicAdd((ptr)+(idx), (value))
zakharos commented 3 years ago

That works! Thanks!