SWDEV-470698 - fix formatting, add format check workflow (#657)
This commit is contained in:
committed by
GitHub
parent
5840940caa
commit
f7338717ae
@@ -77,16 +77,11 @@ TEST_CASE("Unit_hipGetLastError_Positive_Basic") {
|
||||
*/
|
||||
|
||||
TEST_CASE("Unit_hipGetLastError_Positive_Threaded") {
|
||||
class HipGetLastErrorThreadedTest
|
||||
: public ThreadedZigZagTest<HipGetLastErrorThreadedTest> {
|
||||
class HipGetLastErrorThreadedTest : public ThreadedZigZagTest<HipGetLastErrorThreadedTest> {
|
||||
public:
|
||||
void TestPart2() {
|
||||
REQUIRE_THREAD(hipMalloc(nullptr, 1) == hipErrorInvalidValue);
|
||||
}
|
||||
void TestPart3() { HIP_CHECK(hipGetLastError()); }
|
||||
void TestPart4() {
|
||||
REQUIRE_THREAD(hipGetLastError() == hipErrorInvalidValue);
|
||||
}
|
||||
void TestPart2() { REQUIRE_THREAD(hipMalloc(nullptr, 1) == hipErrorInvalidValue); }
|
||||
void TestPart3() { HIP_CHECK(hipGetLastError()); }
|
||||
void TestPart4() { REQUIRE_THREAD(hipGetLastError() == hipErrorInvalidValue); }
|
||||
};
|
||||
|
||||
HipGetLastErrorThreadedTest test;
|
||||
@@ -135,8 +130,7 @@ TEST_CASE("Unit_hipGetLastError_with_hipMemcpyPeerAsync") {
|
||||
HIP_CHECK(hipStreamCreate(&stream));
|
||||
|
||||
HIP_CHECK(hipGetLastError());
|
||||
HIP_CHECK_ERROR(hipMemcpyPeerAsync(B_d, dst_device, A_d, src_device,
|
||||
Nbytes * 2, stream),
|
||||
HIP_CHECK_ERROR(hipMemcpyPeerAsync(B_d, dst_device, A_d, src_device, Nbytes * 2, stream),
|
||||
hipErrorInvalidValue);
|
||||
HIP_CHECK_ERROR(hipGetLastError(), hipErrorInvalidValue);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
@@ -147,8 +141,8 @@ TEST_CASE("Unit_hipGetLastError_with_hipMemcpyPeerAsync") {
|
||||
HIP_CHECK(hipSetDevice(dst_device));
|
||||
HIP_CHECK(hipFree(B_d));
|
||||
} else {
|
||||
INFO("Peer access cannot be enabled between devices "
|
||||
<< src_device << " and devices " << dst_device);
|
||||
INFO("Peer access cannot be enabled between devices " << src_device << " and devices "
|
||||
<< dst_device);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -171,22 +165,20 @@ TEST_CASE("Unit_hipGetLastError_with_hipMemcpyDtoHAsync") {
|
||||
hipStream_t stream;
|
||||
HIP_CHECK(hipStreamCreate(&stream));
|
||||
|
||||
HipTest::initArrays<int>(&A_d, &B_d, nullptr, &A_h, nullptr, nullptr, N,
|
||||
false);
|
||||
HipTest::initArrays<int>(&A_d, &B_d, nullptr, &A_h, nullptr, nullptr, N, false);
|
||||
|
||||
SECTION("Verify with hipMemcpyDtoHAsync api invalid arg call") {
|
||||
HIP_CHECK(hipGetLastError());
|
||||
HIP_CHECK_ERROR(
|
||||
hipMemcpyDtoHAsync(A_h, (hipDeviceptr_t)A_d, Nbytes * 2, stream),
|
||||
hipErrorInvalidValue);
|
||||
HIP_CHECK_ERROR(hipMemcpyDtoHAsync(A_h, (hipDeviceptr_t)A_d, Nbytes * 2, stream),
|
||||
hipErrorInvalidValue);
|
||||
HIP_CHECK_ERROR(hipGetLastError(), hipErrorInvalidValue);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
}
|
||||
SECTION("Verify with hipMemcpyDtoDAsync api invalid arg call") {
|
||||
HIP_CHECK(hipGetLastError());
|
||||
HIP_CHECK_ERROR(hipMemcpyDtoDAsync((hipDeviceptr_t)A_d, (hipDeviceptr_t)B_d,
|
||||
Nbytes * 2, stream),
|
||||
hipErrorInvalidValue);
|
||||
HIP_CHECK_ERROR(
|
||||
hipMemcpyDtoDAsync((hipDeviceptr_t)A_d, (hipDeviceptr_t)B_d, Nbytes * 2, stream),
|
||||
hipErrorInvalidValue);
|
||||
HIP_CHECK_ERROR(hipGetLastError(), hipErrorInvalidValue);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
}
|
||||
@@ -217,10 +209,8 @@ TEST_CASE("Unit_hipGetLastError_with_hipMemcpyParam2DAsync") {
|
||||
HIP_CHECK(hipStreamCreate(&stream));
|
||||
|
||||
// Allocating and Initializing the data
|
||||
HIP_CHECK(
|
||||
hipMallocPitch(reinterpret_cast<void **>(&A_d), &pitch_A, width, HEIGHT));
|
||||
HipTest::initArrays<float>(nullptr, nullptr, nullptr, &A_h, &B_h, &C_h,
|
||||
width * HEIGHT, false);
|
||||
HIP_CHECK(hipMallocPitch(reinterpret_cast<void**>(&A_d), &pitch_A, width, HEIGHT));
|
||||
HipTest::initArrays<float>(nullptr, nullptr, nullptr, &A_h, &B_h, &C_h, width * HEIGHT, false);
|
||||
HipTest::setDefaultData<float>(WIDTH * HEIGHT, A_h, B_h, C_h);
|
||||
HIP_CHECK(hipMemset2D(A_d, pitch_A, memsetval, WIDTH, HEIGHT));
|
||||
|
||||
@@ -266,8 +256,7 @@ TEST_CASE("Unit_hipGetLastError_with_hipDrvMemcpy3DAsync") {
|
||||
HIP_CHECK(hipStreamCreate(&stream));
|
||||
|
||||
HIP_CHECK(hipGetLastError());
|
||||
HIP_CHECK_ERROR(hipDrvMemcpy3DAsync(nullptr, hipStreamPerThread),
|
||||
hipErrorInvalidValue);
|
||||
HIP_CHECK_ERROR(hipDrvMemcpy3DAsync(nullptr, hipStreamPerThread), hipErrorInvalidValue);
|
||||
HIP_CHECK_ERROR(hipGetLastError(), hipErrorInvalidValue);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
HIP_CHECK(hipStreamDestroy(stream));
|
||||
@@ -296,26 +285,24 @@ TEST_CASE("Unit_hipGetLastError_with_hipMemcpy3DAsync") {
|
||||
hipStream_t stream;
|
||||
HIP_CHECK(hipStreamCreate(&stream));
|
||||
|
||||
int *hData = reinterpret_cast<int *>(malloc(size));
|
||||
int* hData = reinterpret_cast<int*>(malloc(size));
|
||||
REQUIRE(hData != nullptr);
|
||||
memset(hData, 0, size);
|
||||
|
||||
// Initialize host buffer
|
||||
HipTest::setDefaultData<int>(width * height * depth, hData, nullptr, nullptr);
|
||||
|
||||
hipChannelFormatDesc channelDesc = hipCreateChannelDesc(
|
||||
sizeof(int) * 8, 0, 0, 0, hipChannelFormatKindSigned);
|
||||
HIP_CHECK(hipMalloc3DArray(&devArray, &channelDesc,
|
||||
make_hipExtent(width, height, 2),
|
||||
hipArrayDefault));
|
||||
hipChannelFormatDesc channelDesc =
|
||||
hipCreateChannelDesc(sizeof(int) * 8, 0, 0, 0, hipChannelFormatKindSigned);
|
||||
HIP_CHECK(
|
||||
hipMalloc3DArray(&devArray, &channelDesc, make_hipExtent(width, height, 2), hipArrayDefault));
|
||||
|
||||
hipMemcpy3DParms myparams;
|
||||
memset(&myparams, 0x0, sizeof(hipMemcpy3DParms));
|
||||
myparams.srcPos = make_hipPos(0, 0, 0);
|
||||
myparams.dstPos = make_hipPos(0, 0, 0);
|
||||
myparams.extent = make_hipExtent(width, height, depth);
|
||||
myparams.srcPtr =
|
||||
make_hipPitchedPtr(hData, width * sizeof(int), width, height);
|
||||
myparams.srcPtr = make_hipPitchedPtr(hData, width * sizeof(int), width, height);
|
||||
myparams.dstArray = devArray;
|
||||
myparams.kind = hipMemcpyHostToDevice;
|
||||
|
||||
@@ -344,7 +331,7 @@ TEST_CASE("Unit_hipGetLastError_with_hipMemcpy3DAsync") {
|
||||
*/
|
||||
|
||||
TEST_CASE("Unit_hipGetLastError_with_hipMemcpy2D_To_From_ArrayAsync") {
|
||||
int *hData = reinterpret_cast<int *>(malloc(WIDTH));
|
||||
int* hData = reinterpret_cast<int*>(malloc(WIDTH));
|
||||
REQUIRE(hData != nullptr);
|
||||
memset(hData, 0, WIDTH);
|
||||
hipStream_t stream;
|
||||
@@ -352,17 +339,15 @@ TEST_CASE("Unit_hipGetLastError_with_hipMemcpy2D_To_From_ArrayAsync") {
|
||||
|
||||
SECTION("Verify with hipMemcpyDtoHAsync api invalid arg call") {
|
||||
HIP_CHECK(hipGetLastError());
|
||||
HIP_CHECK_ERROR(hipMemcpy2DToArrayAsync(nullptr, 0, 0, hData, WIDTH, WIDTH,
|
||||
HEIGHT, hipMemcpyHostToDevice,
|
||||
stream),
|
||||
HIP_CHECK_ERROR(hipMemcpy2DToArrayAsync(nullptr, 0, 0, hData, WIDTH, WIDTH, HEIGHT,
|
||||
hipMemcpyHostToDevice, stream),
|
||||
hipErrorInvalidHandle);
|
||||
HIP_CHECK_ERROR(hipGetLastError(), hipErrorInvalidHandle);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
}
|
||||
SECTION("Verify with hipMemcpyDtoHAsync api invalid arg call") {
|
||||
HIP_CHECK(hipGetLastError());
|
||||
HIP_CHECK_ERROR(hipMemcpy2DFromArrayAsync(hData, WIDTH, nullptr, 0, 0,
|
||||
WIDTH, HEIGHT,
|
||||
HIP_CHECK_ERROR(hipMemcpy2DFromArrayAsync(hData, WIDTH, nullptr, 0, 0, WIDTH, HEIGHT,
|
||||
hipMemcpyDeviceToHost, stream),
|
||||
hipErrorInvalidHandle);
|
||||
HIP_CHECK_ERROR(hipGetLastError(), hipErrorInvalidHandle);
|
||||
@@ -386,10 +371,9 @@ TEST_CASE("Unit_hipGetLastError_with_hipMemcpy2D_To_From_ArrayAsync") {
|
||||
*/
|
||||
|
||||
TEST_CASE("Unit_hipGetLastError_with_hipStreamAttachMemAsync") {
|
||||
void *d_memory{nullptr};
|
||||
void* d_memory{nullptr};
|
||||
HIP_CHECK(hipGetLastError());
|
||||
HIP_CHECK_ERROR(hipMemPrefetchAsync(reinterpret_cast<void *>(d_memory), 0,
|
||||
hipMemAttachHost, 0),
|
||||
HIP_CHECK_ERROR(hipMemPrefetchAsync(reinterpret_cast<void*>(d_memory), 0, hipMemAttachHost, 0),
|
||||
hipErrorInvalidValue);
|
||||
HIP_CHECK_ERROR(hipGetLastError(), hipErrorInvalidValue);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
@@ -412,9 +396,8 @@ TEST_CASE("Unit_hipGetLastError_with_hipWaitExternalSemaphoresAsync") {
|
||||
wait_params.params.fence.value = 1;
|
||||
|
||||
HIP_CHECK(hipGetLastError());
|
||||
HIP_CHECK_ERROR(
|
||||
hipWaitExternalSemaphoresAsync(nullptr, &wait_params, 1, nullptr),
|
||||
hipErrorInvalidValue);
|
||||
HIP_CHECK_ERROR(hipWaitExternalSemaphoresAsync(nullptr, &wait_params, 1, nullptr),
|
||||
hipErrorInvalidValue);
|
||||
HIP_CHECK_ERROR(hipGetLastError(), hipErrorInvalidValue);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
}
|
||||
@@ -436,9 +419,8 @@ TEST_CASE("Unit_hipGetLastError_with_hipSignalExternalSemaphoresAsync") {
|
||||
signal_params.params.fence.value = 1;
|
||||
|
||||
HIP_CHECK(hipGetLastError());
|
||||
HIP_CHECK_ERROR(
|
||||
hipSignalExternalSemaphoresAsync(nullptr, &signal_params, 1, nullptr),
|
||||
hipErrorInvalidValue);
|
||||
HIP_CHECK_ERROR(hipSignalExternalSemaphoresAsync(nullptr, &signal_params, 1, nullptr),
|
||||
hipErrorInvalidValue);
|
||||
HIP_CHECK_ERROR(hipGetLastError(), hipErrorInvalidValue);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
}
|
||||
@@ -485,10 +467,9 @@ TEST_CASE("Unit_hipGetLastError_with_hipMemcpy2DAsync") {
|
||||
HIP_CHECK(hipStreamCreate(&stream));
|
||||
|
||||
// Allocating memory
|
||||
A_h = reinterpret_cast<int *>(malloc(Nbytes));
|
||||
A_h = reinterpret_cast<int*>(malloc(Nbytes));
|
||||
REQUIRE(A_h != nullptr);
|
||||
HIP_CHECK(
|
||||
hipMallocPitch(reinterpret_cast<void **>(&A_d), &pitch_A, width, WIDTH));
|
||||
HIP_CHECK(hipMallocPitch(reinterpret_cast<void**>(&A_d), &pitch_A, width, WIDTH));
|
||||
REQUIRE(A_d != nullptr);
|
||||
|
||||
// Initialize the data
|
||||
@@ -496,8 +477,7 @@ TEST_CASE("Unit_hipGetLastError_with_hipMemcpy2DAsync") {
|
||||
|
||||
SECTION("Verify with hipMemcpy2DAsync api invalid arg call") {
|
||||
HIP_CHECK(hipGetLastError());
|
||||
HIP_CHECK_ERROR(hipMemcpy2DAsync(A_h, WIDTH * 2, A_d, pitch_A,
|
||||
WIDTH * sizeof(int), WIDTH,
|
||||
HIP_CHECK_ERROR(hipMemcpy2DAsync(A_h, WIDTH * 2, A_d, pitch_A, WIDTH * sizeof(int), WIDTH,
|
||||
hipMemcpyDeviceToHost, stream),
|
||||
hipErrorInvalidPitchValue);
|
||||
HIP_CHECK_ERROR(hipGetLastError(), hipErrorInvalidPitchValue);
|
||||
@@ -505,8 +485,7 @@ TEST_CASE("Unit_hipGetLastError_with_hipMemcpy2DAsync") {
|
||||
}
|
||||
SECTION("Verify with hipMemset2DAsync api invalid arg call") {
|
||||
HIP_CHECK(hipGetLastError());
|
||||
HIP_CHECK_ERROR(hipMemset2DAsync(A_d, pitch_A, 22, WIDTH * sizeof(int),
|
||||
WIDTH * 9, stream),
|
||||
HIP_CHECK_ERROR(hipMemset2DAsync(A_d, pitch_A, 22, WIDTH * sizeof(int), WIDTH * 9, stream),
|
||||
hipErrorInvalidValue);
|
||||
HIP_CHECK_ERROR(hipGetLastError(), hipErrorInvalidValue);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
@@ -531,7 +510,7 @@ TEST_CASE("Unit_hipGetLastError_with_hipMemcpy2DAsync") {
|
||||
*/
|
||||
|
||||
TEST_CASE("Unit_hipGetLastError_with_hipMemsetAsync") {
|
||||
int *A_d;
|
||||
int* A_d;
|
||||
HIP_CHECK(hipMalloc(&A_d, Nbytes));
|
||||
REQUIRE(A_d != nullptr);
|
||||
|
||||
@@ -539,8 +518,7 @@ TEST_CASE("Unit_hipGetLastError_with_hipMemsetAsync") {
|
||||
HIP_CHECK(hipStreamCreate(&stream));
|
||||
|
||||
HIP_CHECK(hipGetLastError());
|
||||
HIP_CHECK_ERROR(hipMemsetAsync(A_d, 0, Nbytes * 2, stream),
|
||||
hipErrorInvalidValue);
|
||||
HIP_CHECK_ERROR(hipMemsetAsync(A_d, 0, Nbytes * 2, stream), hipErrorInvalidValue);
|
||||
HIP_CHECK_ERROR(hipGetLastError(), hipErrorInvalidValue);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
|
||||
@@ -579,9 +557,8 @@ TEST_CASE("Unit_hipGetLastError_with_MemCpyAsync") {
|
||||
HIP_CHECK(hipStreamSynchronize(stream));
|
||||
|
||||
// testing to check error manually
|
||||
HIP_CHECK_ERROR(
|
||||
hipMemcpyAsync(C_h, C_d, Nbytes + N, hipMemcpyDeviceToHost, 0),
|
||||
hipErrorInvalidValue);
|
||||
HIP_CHECK_ERROR(hipMemcpyAsync(C_h, C_d, Nbytes + N, hipMemcpyDeviceToHost, 0),
|
||||
hipErrorInvalidValue);
|
||||
HIP_CHECK_ERROR(hipGetLastError(), hipErrorInvalidValue);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
|
||||
@@ -633,9 +610,8 @@ TEST_CASE("Unit_hipGetLastError_with_MemCpyAsync_thread") {
|
||||
std::thread t(thread_wait_func, 2);
|
||||
|
||||
// testing to check error manually
|
||||
HIP_CHECK_ERROR(
|
||||
hipMemcpyAsync(C_h, C_d, Nbytes + N, hipMemcpyDeviceToHost, 0),
|
||||
hipErrorInvalidValue);
|
||||
HIP_CHECK_ERROR(hipMemcpyAsync(C_h, C_d, Nbytes + N, hipMemcpyDeviceToHost, 0),
|
||||
hipErrorInvalidValue);
|
||||
|
||||
t.join();
|
||||
|
||||
@@ -679,20 +655,20 @@ TEST_CASE("Unit_hipGetLastError_with_hipGraphAddMemcpyNode1D") {
|
||||
|
||||
HIP_CHECK(hipGraphCreate(&graph, 0));
|
||||
HIP_CHECK(hipStreamCreate(&stream));
|
||||
HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpy_A, graph, nullptr, 0, A_d, A_h,
|
||||
Nbytes, hipMemcpyHostToDevice));
|
||||
HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpy_B, graph, nullptr, 0, B_d, B_h,
|
||||
Nbytes, hipMemcpyHostToDevice));
|
||||
HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpy_C, graph, nullptr, 0, C_h, C_d,
|
||||
Nbytes, hipMemcpyDeviceToHost));
|
||||
HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpy_A, graph, nullptr, 0, A_d, A_h, Nbytes,
|
||||
hipMemcpyHostToDevice));
|
||||
HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpy_B, graph, nullptr, 0, B_d, B_h, Nbytes,
|
||||
hipMemcpyHostToDevice));
|
||||
HIP_CHECK(hipGraphAddMemcpyNode1D(&memcpy_C, graph, nullptr, 0, C_h, C_d, Nbytes,
|
||||
hipMemcpyDeviceToHost));
|
||||
|
||||
hipKernelNodeParams kNodeParams{};
|
||||
void *kernelArgs[] = {&A_d, &B_d, &C_d, reinterpret_cast<void *>(&NElem)};
|
||||
kNodeParams.func = reinterpret_cast<void *>(HipTest::vectorADD<int>);
|
||||
void* kernelArgs[] = {&A_d, &B_d, &C_d, reinterpret_cast<void*>(&NElem)};
|
||||
kNodeParams.func = reinterpret_cast<void*>(HipTest::vectorADD<int>);
|
||||
kNodeParams.gridDim = dim3(blocks);
|
||||
kNodeParams.blockDim = dim3(threadsPerBlock);
|
||||
kNodeParams.sharedMemBytes = 0;
|
||||
kNodeParams.kernelParams = reinterpret_cast<void **>(kernelArgs);
|
||||
kNodeParams.kernelParams = reinterpret_cast<void**>(kernelArgs);
|
||||
kNodeParams.extra = nullptr;
|
||||
HIP_CHECK(hipGraphAddKernelNode(&kVecAdd, graph, nullptr, 0, &kNodeParams));
|
||||
|
||||
@@ -700,8 +676,7 @@ TEST_CASE("Unit_hipGetLastError_with_hipGraphAddMemcpyNode1D") {
|
||||
// so that it produces an error, which will be used to verify the
|
||||
// behavior of hipGetLastError api.
|
||||
HIP_CHECK(hipGetLastError());
|
||||
HIP_CHECK_ERROR(hipGraphAddMemcpyNode1D(&memcpy_E, graph, nullptr, 0, C_h,
|
||||
C_d, Nbytes * 2,
|
||||
HIP_CHECK_ERROR(hipGraphAddMemcpyNode1D(&memcpy_E, graph, nullptr, 0, C_h, C_d, Nbytes * 2,
|
||||
hipMemcpyDeviceToHost),
|
||||
hipErrorInvalidValue);
|
||||
HIP_CHECK_ERROR(hipGetLastError(), hipErrorInvalidValue);
|
||||
@@ -853,9 +828,8 @@ TEST_CASE("Unit_hipGetLastError_success_before_hipGetLastError_check_again") {
|
||||
HIP_CHECK_ERROR(hipGraphCreate(&graph, 1), hipErrorInvalidValue);
|
||||
HIP_CHECK_ERROR(hipGetLastError(), hipErrorInvalidValue);
|
||||
|
||||
HIP_CHECK_ERROR(
|
||||
hipDeviceGetGraphMemAttribute(-1, hipGraphMemAttrUsedMemCurrent, &value),
|
||||
hipErrorInvalidDevice);
|
||||
HIP_CHECK_ERROR(hipDeviceGetGraphMemAttribute(-1, hipGraphMemAttrUsedMemCurrent, &value),
|
||||
hipErrorInvalidDevice);
|
||||
HIP_CHECK_ERROR(hipGetLastError(), hipErrorInvalidDevice);
|
||||
HIP_CHECK(hipGetLastError());
|
||||
}
|
||||
@@ -872,10 +846,10 @@ TEST_CASE("Unit_hipGetLastError_success_before_hipGetLastError_check_again") {
|
||||
* - HIP_VERSION >= 6.0
|
||||
*/
|
||||
|
||||
static void __global__ devideKernl(int *i, int x, int y) { *i = x / (x - y); }
|
||||
static void __global__ devideKernl(int* i, int x, int y) { *i = x / (x - y); }
|
||||
|
||||
TEST_CASE("Unit_hipGetLastError_with_Kernel_divide_by_zero") {
|
||||
int *i_d;
|
||||
int* i_d;
|
||||
int i = 9;
|
||||
HIP_CHECK(hipMalloc(&i_d, sizeof(int)));
|
||||
REQUIRE(i_d != nullptr);
|
||||
@@ -908,10 +882,10 @@ TEST_CASE("Unit_hipGetLastError_with_Kernel_divide_by_zero") {
|
||||
* - HIP_VERSION >= 6.0
|
||||
*/
|
||||
|
||||
static void __global__ incrementKernl(int *i) { *i += 1; }
|
||||
static void __global__ incrementKernl(int* i) { *i += 1; }
|
||||
|
||||
TEST_CASE("Unit_hipGetLastError_with_Kernel_Invalid_Configuration") {
|
||||
int *i_d;
|
||||
int* i_d;
|
||||
HIP_CHECK(hipMalloc(&i_d, sizeof(int)));
|
||||
REQUIRE(i_d != nullptr);
|
||||
|
||||
@@ -982,7 +956,7 @@ major ROCm release 7.0. This will be removed after the ROCm release 7.0.
|
||||
TEST_CASE("Unit_hipGetLastError_With_EnvVar_Positive_Basic") {
|
||||
if (setenv("DEBUG_HIP_7_PREVIEW", "1", 1) == 0) {
|
||||
HIP_CHECK_ERROR(hipMalloc(nullptr, 1), hipErrorInvalidValue);
|
||||
int *A_d;
|
||||
int* A_d;
|
||||
HIP_CHECK(hipMalloc(&A_d, 1024));
|
||||
HIP_CHECK_ERROR(hipGetLastError(), hipErrorInvalidValue);
|
||||
HIP_CHECK_ERROR(hipGetLastError(), hipSuccess);
|
||||
@@ -1011,7 +985,7 @@ TEST_CASE("Unit_hipGetLastError_With_EnvVar_Chk_Updated_Status") {
|
||||
hipGraph_t graph;
|
||||
HIP_CHECK_ERROR(hipGraphCreate(&graph, 1), hipErrorInvalidValue);
|
||||
HIP_CHECK_ERROR(hipGetLastError(), hipErrorInvalidValue);
|
||||
int *C_d;
|
||||
int* C_d;
|
||||
HIP_CHECK(hipMalloc(&C_d, 1024));
|
||||
HIP_CHECK_ERROR(hipGetLastError(), hipSuccess);
|
||||
HIP_CHECK(hipFree(C_d));
|
||||
@@ -1037,7 +1011,7 @@ TEST_CASE("Unit_hipGetLastError_With_EnvVar_Chk_Along_hipPeekAtLastError") {
|
||||
hipGraph_t graph;
|
||||
HIP_CHECK_ERROR(hipGraphCreate(&graph, 1), hipErrorInvalidValue);
|
||||
HIP_CHECK_ERROR(hipPeekAtLastError(), hipErrorInvalidValue);
|
||||
int *C_d;
|
||||
int* C_d;
|
||||
HIP_CHECK(hipMalloc(&C_d, 1024));
|
||||
HIP_CHECK(hipFree(C_d));
|
||||
HIP_CHECK_ERROR(hipGetLastError(), hipErrorInvalidValue);
|
||||
@@ -1067,8 +1041,7 @@ TEST_CASE("Unit_hipGetLastError_With_EnvVar_Error_Combinations") {
|
||||
if (setenv("DEBUG_HIP_7_PREVIEW", "1", 1) == 0) {
|
||||
HIP_CHECK(hipGetLastError());
|
||||
HIP_CHECK_ERROR(hipGraphCreate(&graph, 1), hipErrorInvalidValue);
|
||||
HIP_CHECK_ERROR(hipDeviceGetGraphMemAttribute(
|
||||
-1, hipGraphMemAttrUsedMemCurrent, &value),
|
||||
HIP_CHECK_ERROR(hipDeviceGetGraphMemAttribute(-1, hipGraphMemAttrUsedMemCurrent, &value),
|
||||
hipErrorInvalidDevice);
|
||||
HIP_CHECK_ERROR(hipGetLastError(), hipErrorInvalidDevice);
|
||||
HIP_CHECK_ERROR(hipGetLastError(), hipSuccess);
|
||||
@@ -1080,10 +1053,9 @@ TEST_CASE("Unit_hipGetLastError_With_EnvVar_Error_Combinations") {
|
||||
SECTION("A case with Error-Success-Error-Success") {
|
||||
if (setenv("DEBUG_HIP_7_PREVIEW", "1", 1) == 0) {
|
||||
HIP_CHECK_ERROR(hipGraphCreate(&graph, 1), hipErrorInvalidValue);
|
||||
int *A_d;
|
||||
int* A_d;
|
||||
HIP_CHECK(hipMalloc(&A_d, 1024));
|
||||
HIP_CHECK_ERROR(hipDeviceGetGraphMemAttribute(
|
||||
-1, hipGraphMemAttrUsedMemCurrent, &value),
|
||||
HIP_CHECK_ERROR(hipDeviceGetGraphMemAttribute(-1, hipGraphMemAttrUsedMemCurrent, &value),
|
||||
hipErrorInvalidDevice);
|
||||
HIP_CHECK(hipFree(A_d));
|
||||
HIP_CHECK_ERROR(hipGetLastError(), hipErrorInvalidDevice);
|
||||
@@ -1095,11 +1067,10 @@ TEST_CASE("Unit_hipGetLastError_With_EnvVar_Error_Combinations") {
|
||||
}
|
||||
SECTION("A case with Success-Error-Error-Success") {
|
||||
if (setenv("DEBUG_HIP_7_PREVIEW", "1", 1) == 0) {
|
||||
int *A_d;
|
||||
int* A_d;
|
||||
HIP_CHECK(hipMalloc(&A_d, 1024));
|
||||
HIP_CHECK_ERROR(hipGraphCreate(&graph, 1), hipErrorInvalidValue);
|
||||
HIP_CHECK_ERROR(hipDeviceGetGraphMemAttribute(
|
||||
-1, hipGraphMemAttrUsedMemCurrent, &value),
|
||||
HIP_CHECK_ERROR(hipDeviceGetGraphMemAttribute(-1, hipGraphMemAttrUsedMemCurrent, &value),
|
||||
hipErrorInvalidDevice);
|
||||
HIP_CHECK(hipFree(A_d));
|
||||
HIP_CHECK_ERROR(hipGetLastError(), hipErrorInvalidDevice);
|
||||
@@ -1111,12 +1082,11 @@ TEST_CASE("Unit_hipGetLastError_With_EnvVar_Error_Combinations") {
|
||||
}
|
||||
SECTION("A Case with Success-Error-Success-Error") {
|
||||
if (setenv("DEBUG_HIP_7_PREVIEW", "1", 1) == 0) {
|
||||
int *A_d;
|
||||
int* A_d;
|
||||
HIP_CHECK(hipMalloc(&A_d, 1024));
|
||||
HIP_CHECK_ERROR(hipGraphCreate(&graph, 1), hipErrorInvalidValue);
|
||||
HIP_CHECK(hipFree(A_d));
|
||||
HIP_CHECK_ERROR(hipDeviceGetGraphMemAttribute(
|
||||
-1, hipGraphMemAttrUsedMemCurrent, &value),
|
||||
HIP_CHECK_ERROR(hipDeviceGetGraphMemAttribute(-1, hipGraphMemAttrUsedMemCurrent, &value),
|
||||
hipErrorInvalidDevice);
|
||||
HIP_CHECK_ERROR(hipGetLastError(), hipErrorInvalidDevice);
|
||||
HIP_CHECK_ERROR(hipGetLastError(), hipSuccess);
|
||||
@@ -1149,7 +1119,7 @@ static void thread_func() {
|
||||
TEST_CASE("Unit_hipGetLastError_With_EnvVar_With_Thread") {
|
||||
hipGraph_t graph;
|
||||
if (setenv("DEBUG_HIP_7_PREVIEW", "1", 1) == 0) {
|
||||
int *A_d;
|
||||
int* A_d;
|
||||
HIP_CHECK(hipMalloc(&A_d, 1024));
|
||||
HIP_CHECK_ERROR(hipGraphCreate(&graph, 1), hipErrorInvalidValue);
|
||||
std::thread t(thread_func);
|
||||
@@ -1194,7 +1164,7 @@ TEST_CASE("Unit_hipGetLastError_With_EnvVar_MultiProcess") {
|
||||
}
|
||||
}
|
||||
#endif
|
||||
static void __global__ emptyKernl() { }
|
||||
static void __global__ emptyKernl() {}
|
||||
/**
|
||||
* Test Description
|
||||
* ------------------------
|
||||
@@ -1216,7 +1186,7 @@ TEST_CASE("Unit_hipGetLastError_With_EnvVar_Kernel_Invalid_Config") {
|
||||
hipError_t ret;
|
||||
if (setenv("DEBUG_HIP_7_PREVIEW", "1", 1) == 0) {
|
||||
hipLaunchKernelGGL(emptyKernl, dim3(0), dim3(0), 0, 0);
|
||||
int *A_d;
|
||||
int* A_d;
|
||||
HIP_CHECK(hipMalloc(&A_d, 1024));
|
||||
ret = hipGetLastError();
|
||||
REQUIRE(ret == hipErrorInvalidConfiguration);
|
||||
@@ -1232,4 +1202,3 @@ TEST_CASE("Unit_hipGetLastError_With_EnvVar_Kernel_Invalid_Config") {
|
||||
* End doxygen group ErrorTest.
|
||||
* @}
|
||||
*/
|
||||
|
||||
|
||||
Reference in New Issue
Block a user