Merge branch 'amd-master' into amd-master-next

Change-Id: I3094c15008093f2072bcd38aca4ea90aeae2d97b


[ROCm/hip commit: 2af31479e2]
Этот коммит содержится в:
Maneesh Gupta
2020-04-07 06:57:42 -04:00
родитель c34599e77c
Коммит 4e1f6f2a0e
67 изменённых файлов: 2278 добавлений и 601 удалений
+39
Просмотреть файл
@@ -96,6 +96,18 @@ void kernel_hisinf(__half* input, int* output) {
output[tx] = __hisinf(input[tx]);
}
__global__ void testHalfAbs(float* p) {
auto a = __float2half(*p);
a = __habs(a);
*p = __half2float(a);
}
__global__ void testHalf2Abs(float2* p) {
auto a = __float22half2_rn(*p);
a = __habs2(a);
*p = __half22float2(a);
}
#endif
@@ -237,6 +249,31 @@ void checkFunctional() {
return;
}
void checkHalfAbs() {
{
float *p;
hipMalloc(&p, sizeof(float));
float pp = -2.1f;
hipMemcpy(p, &pp, sizeof(float), hipMemcpyDefault);
hipLaunchKernelGGL(testHalfAbs, 1, 1, 0, 0, p);
hipMemcpy(&pp, p, sizeof(float), hipMemcpyDefault);
hipFree(p);
if(pp < 0.0f) { failed("Half Abs failed"); }
}
{
float2 *p;
hipMalloc(&p, sizeof(float2));
float2 pp;
pp.x = -2.1f;
pp.y = -1.1f;
hipMemcpy(p, &pp, sizeof(float2), hipMemcpyDefault);
hipLaunchKernelGGL(testHalf2Abs, 1, 1, 0, 0, p);
hipMemcpy(&pp, p, sizeof(float2), hipMemcpyDefault);
hipFree(p);
if(pp.x < 0.0f || pp.y < 0.0f) { failed("Half2 Abs Test Failed"); }
}
}
int main() {
bool* result{nullptr};
hipMemAllocHost((void**)&result, sizeof(result));
@@ -260,5 +297,7 @@ int main() {
// run some functional checks
checkFunctional();
checkHalfAbs();
passed();
}