问题
I have an error when I am trying to compile Merrill's radix sort under win-XP + VS2005.
error: asm operand type size(1) does not match type/size implied by constraint 'r'.
it occurs in the following code
#define B40C_DEFINE_GLOBAL_LOAD(base_type, dest_type, short_type, ptx_type, reg_mod)\
asm("ld.global.cg."#ptx_type" %0, [%1];" : "="#reg_mod(dest) : _B40C_ASM_PTR_(d_ptr + offset));\
...
B40C_DEFINE_GLOBAL_LOAD(char, signed char, char, s8, r)
Thanks
回答1:
This would appear to be caused by attempting to compile CUDA kernel code containing inline assembly instructions writing specifically for a 64 bit host platform on a 32 bit platform.
The CUDA toolchain ensures that sizeof(void *)
is consistent on both host and device by emitting GPU code which matches the address mode of the host CPU. This particular code is assuming that pointers are 64 bit, whereas the code is being compiled in 32 bit host mode, leading to a size mismatch.
来源:https://stackoverflow.com/questions/7073711/error-asm-operand-type-size1-does-not-match-type-size-implied-by-constraint