SWDEV-470698 - fix formatting, add format check workflow (#657)
This commit is contained in:
committed by
GitHub
vanhempi
5840940caa
commit
f7338717ae
@@ -61,22 +61,22 @@ TEST_CASE("Unit_hipHccModuleLaunchKernel_basic") {
|
||||
size_t width = GENERATE(3, 4, 100);
|
||||
size_t widthInBytes = width * sizeof(int);
|
||||
int *A_d, *B_d;
|
||||
int *A_h = reinterpret_cast<int*>(malloc(widthInBytes));
|
||||
int *B_h = reinterpret_cast<int*>(malloc(widthInBytes));
|
||||
int* A_h = reinterpret_cast<int*>(malloc(widthInBytes));
|
||||
int* B_h = reinterpret_cast<int*>(malloc(widthInBytes));
|
||||
for (int i = 0; i < width; i++) {
|
||||
A_h[i] = i;
|
||||
}
|
||||
HIP_CHECK(hipMalloc(reinterpret_cast<void**>(&A_d), widthInBytes));
|
||||
HIP_CHECK(hipMalloc(reinterpret_cast<void**>(&B_d), widthInBytes));
|
||||
void *kernelArgs[3] = {&A_d, &B_d, &widthInBytes};
|
||||
void* kernelArgs[3] = {&A_d, &B_d, &widthInBytes};
|
||||
HIP_CHECK(hipMemcpyHtoD((hipDeviceptr_t)A_d, A_h, widthInBytes));
|
||||
hipModule_t module;
|
||||
HIP_CHECK(hipModuleLoad(&module, fileName));
|
||||
hipFunction_t kernelFunc;
|
||||
HIP_CHECK(hipModuleGetFunction(&kernelFunc, module, kernel_name));
|
||||
|
||||
HIP_CHECK(hipHccModuleLaunchKernel(kernelFunc, width, 1, 1, width, 1, 1, 0, 0,
|
||||
kernelArgs, nullptr, nullptr, nullptr));
|
||||
HIP_CHECK(hipHccModuleLaunchKernel(kernelFunc, width, 1, 1, width, 1, 1, 0, 0, kernelArgs,
|
||||
nullptr, nullptr, nullptr));
|
||||
HIP_CHECK(hipMemcpyDtoH(B_h, (hipDeviceptr_t)B_d, widthInBytes));
|
||||
for (int i = 0; i < width; i++) {
|
||||
REQUIRE(A_h[i] == B_h[i]);
|
||||
@@ -105,43 +105,42 @@ TEST_CASE("Unit_hipHccModuleLaunchKernel_NegTst") {
|
||||
int *A_d, *B_d;
|
||||
HIP_CHECK(hipMalloc(reinterpret_cast<void**>(&A_d), widthInBytes));
|
||||
HIP_CHECK(hipMalloc(reinterpret_cast<void**>(&B_d), widthInBytes));
|
||||
void *kernelArgs[3] = {&A_d, &B_d, &widthInBytes};
|
||||
void* kernelArgs[3] = {&A_d, &B_d, &widthInBytes};
|
||||
hipModule_t module;
|
||||
HIP_CHECK(hipModuleLoad(&module, fileName));
|
||||
hipFunction_t kernelFunc;
|
||||
HIP_CHECK(hipModuleGetFunction(&kernelFunc, module, kernel_name));
|
||||
SECTION("nullptr to f(first argument)") {
|
||||
HIP_CHECK_ERROR(hipHccModuleLaunchKernel(nullptr, width, 1, 1, width, 1, 1,
|
||||
0, 0, kernelArgs, nullptr, nullptr, nullptr),
|
||||
HIP_CHECK_ERROR(hipHccModuleLaunchKernel(nullptr, width, 1, 1, width, 1, 1, 0, 0, kernelArgs,
|
||||
nullptr, nullptr, nullptr),
|
||||
hipErrorInvalidHandle);
|
||||
}
|
||||
SECTION("-1 to localWorkSizeX(fifth argument)") {
|
||||
HIP_CHECK_ERROR(hipHccModuleLaunchKernel(kernelFunc, width, 1, 1, -1, 1, 1,
|
||||
0, 0, kernelArgs, nullptr, nullptr, nullptr),
|
||||
HIP_CHECK_ERROR(hipHccModuleLaunchKernel(kernelFunc, width, 1, 1, -1, 1, 1, 0, 0, kernelArgs,
|
||||
nullptr, nullptr, nullptr),
|
||||
hipErrorInvalidConfiguration);
|
||||
}
|
||||
SECTION("-1 to localWorkSizeY(sixth argument)") {
|
||||
HIP_CHECK_ERROR(hipHccModuleLaunchKernel(kernelFunc, width, 1, 1, width,
|
||||
-1, 1, 0, 0, kernelArgs, nullptr, nullptr, nullptr),
|
||||
HIP_CHECK_ERROR(hipHccModuleLaunchKernel(kernelFunc, width, 1, 1, width, -1, 1, 0, 0,
|
||||
kernelArgs, nullptr, nullptr, nullptr),
|
||||
hipErrorInvalidConfiguration);
|
||||
}
|
||||
SECTION("-1 to localWorkSizeZ(seventh argument)") {
|
||||
HIP_CHECK_ERROR(hipHccModuleLaunchKernel(kernelFunc, width, 1, 1, width, 1,
|
||||
-1, 0, 0, kernelArgs, nullptr, nullptr, nullptr),
|
||||
HIP_CHECK_ERROR(hipHccModuleLaunchKernel(kernelFunc, width, 1, 1, width, 1, -1, 0, 0,
|
||||
kernelArgs, nullptr, nullptr, nullptr),
|
||||
hipErrorInvalidConfiguration);
|
||||
}
|
||||
SECTION("-1 to sharedMemBytes(eighth argument)") {
|
||||
HIP_CHECK_ERROR(hipHccModuleLaunchKernel(kernelFunc, width, 1, 1, width, 1,
|
||||
1, -1, 0, kernelArgs, nullptr, nullptr, nullptr),
|
||||
HIP_CHECK_ERROR(hipHccModuleLaunchKernel(kernelFunc, width, 1, 1, width, 1, 1, -1, 0,
|
||||
kernelArgs, nullptr, nullptr, nullptr),
|
||||
hipErrorInvalidValue);
|
||||
}
|
||||
SECTION("nullptr to kernelParams(10th argument)") {
|
||||
HIP_CHECK_ERROR(hipHccModuleLaunchKernel(kernelFunc, width, 1, 1, width, 1,
|
||||
1, 0, 0, nullptr, nullptr, nullptr, nullptr),
|
||||
HIP_CHECK_ERROR(hipHccModuleLaunchKernel(kernelFunc, width, 1, 1, width, 1, 1, 0, 0, nullptr,
|
||||
nullptr, nullptr, nullptr),
|
||||
hipErrorInvalidValue);
|
||||
}
|
||||
HIP_CHECK(hipModuleUnload(module));
|
||||
HIP_CHECK(hipFree(A_d));
|
||||
HIP_CHECK(hipFree(B_d));
|
||||
}
|
||||
|
||||
|
||||
Viittaa uudesa ongelmassa
Block a user