SWDEV-380340 - [catch2][dtest] DeviceLib tests migrated from direct to catch2 (#225)
Change-Id: Ie2ec1c7dabdfedbe0bd36fd2525df7dc9d9ba2e5
This commit is contained in:
committed by
GitHub
parent
cdf434b357
commit
3447a59895
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANNTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER INN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR INN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
#include <hip/hip_runtime.h>
|
||||
#include <hip/math_functions.h>
|
||||
#include <hip_test_common.hh>
|
||||
|
||||
__global__ static void DotFunctions(bool* result) {
|
||||
// Dot Functions
|
||||
#if HT_AMD
|
||||
short2 sa{1}, sb{1};
|
||||
result[0] = amd_mixed_dot(sa, sb, 1, result[0]) && result[0];
|
||||
|
||||
ushort2 usa{1}, usb{1};
|
||||
result[0] = amd_mixed_dot(usa, usb, (uint) 1, result[0]) && result[0];
|
||||
|
||||
char4 ca{1}, cb{1};
|
||||
result[0] = amd_mixed_dot(ca, cb, 1, result[0]) && result[0];
|
||||
|
||||
uchar4 uca{1}, ucb{1};
|
||||
result[0] = amd_mixed_dot(uca, ucb, (uint) 1, result[0]) && result[0];
|
||||
|
||||
int ia{1}, ib{1};
|
||||
result[0] = amd_mixed_dot(ia, ib, 1, result[0]) && result[0];
|
||||
|
||||
uint ua{1}, ub{1};
|
||||
result[0] = amd_mixed_dot(ua, ub, (uint) 1, result[0]) && result[0];
|
||||
#endif
|
||||
}
|
||||
|
||||
TEST_CASE("Unit_hipTestDotFunctions") {
|
||||
bool* result{nullptr};
|
||||
hipHostMalloc(&result, 1);
|
||||
result[0] = true;
|
||||
hipLaunchKernelGGL(DotFunctions, dim3(1, 1, 1), dim3(1, 1, 1), 0, 0, result);
|
||||
hipDeviceSynchronize();
|
||||
REQUIRE(result[0] == true);
|
||||
hipHostFree(result);
|
||||
}
|
||||
Reference in New Issue
Block a user