This repository was archived by the owner on Jan 26, 2024. It is now read-only.
Open
Conversation
This is necessary for consistency between the representation of vector types
between host and device, as well as for consistency with the way vector types
behave when defined as structures (as is the case for code ported from CUDA).
Without this patch, this simple test case:
````
const float& pick(float4 const& v)
{ return v.x; }
const volatile float& pick(float4 const volatile& v)
{ return v.x; }
int main() {
const float4 c = make_float4(0, 1, 2, 3);
volatile float4 v = make_float4(1, 2, 3, 0);
std::cout << pick(c) << std::endl;
std::cout << pick(v) << std::endl;
}
````
will fail to compile when built with the host compiler.
Closes hipamd issue ROCm#3
This is necessary to avoid errors about ambiguous overloads in code such as
````
struct Point {
float4 pos;
float mass;
};
template<typename T>
Point operator+(Point const& p, T const& v)
{
return Point{p.pos + v, p.mass};
}
int main() {
float4 v = make_float4(0, 1, 2, 3);
Point p{make_float4(3, 2, 1, 0), 1.0f};
Point q = p + v;
}
````
when building with the host compiler.
Closes hipamd issue ROCm#4
This allows compilation of code such as
````
int main() {
float4 v1, v2, v3;
v3 = v1 + v2;
v3 = v1 - v2;
v3 = v1 * v2;
v3 = v1 / v2;
int4 i1, i2, i3;
i3 = -i1;
i3 = ~i2;
i3 = i1 % i2;
i3 = i1 ^ i2;
i3 = i1 >> i2;
i3 = i1 << i2;
}
````
with a host compiler that supports __has_attribute,
but does not support the ext_vector_type attribute (e.g. g++).
Author
|
OK, this merge has become the only remaining blocker to add AMD GPU support to GPUSPH. Is there anything that can be done to bring it to someone's attention? |
This file contains hidden or 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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This patchset fixes the behavior of HIP vector types when used on host and building with a host compiler. Closes issues #3 and #4, that emerged while introducing HIP support in GPUSPH and affect both g++ and clang++ as host compiler. The last patch also fixes operators that assume ext_vector_type is supported (which is not the case for g++).