[go: nahoru, domu]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

float3 vs Vector for cuda #11

Open
luchete80 opened this issue Oct 18, 2021 · 1 comment
Open

float3 vs Vector for cuda #11

luchete80 opened this issue Oct 18, 2021 · 1 comment

Comments

@luchete80
Copy link
Owner

No description provided.

@luchete80
Copy link
Owner Author

https://forums.developer.nvidia.com/t/own-float3-and-float4/30236/2

Note that if you define your own float4 type as a simple struct, it will have insufficient alignment to qualify for vector loads on the device side, which may reduce performance. CUDA’s built-in float4 type is implemented as a struct with added alignment attributes on both host and device.

What won’t work (in the general case) is using CUDA’s aligned float4 for device code and interface it to your own unaligned float4 on the host side. This kind of mix-and-match might work under carefully constrained circumstances, but generally speaking you definitely want to use the same type for both host and device code. So your original concerns along those lines were justified.

Note that CUDA does not provide a built-in float3 type so you have no choice but to define your own.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant