SWDEV-470698 - fix formatting, add format check workflow (#657)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
5840940caa
Коммит
f7338717ae
@@ -37,7 +37,7 @@ __global__ void MyKernelConstSize(int* C_d, const int* A_d) {
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < N; ++i) {
|
||||
C_d[i] = A_d[i] + A1[i%A1size];
|
||||
C_d[i] = A_d[i] + A1[i % A1size];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,13 +50,13 @@ __global__ void MyKernelVariableSize(int* C_d, const int* A_d) {
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < N; ++i) {
|
||||
C_d[i] = A_d[i] + A1[i%A1size];
|
||||
C_d[i] = A_d[i] + A1[i % A1size];
|
||||
}
|
||||
}
|
||||
|
||||
static bool verify(const int* C_d, const int* A_d) {
|
||||
for (size_t i = 0; i < N; i++) {
|
||||
if (C_d[i] != A_d[i] + i%1024) {
|
||||
if (C_d[i] != A_d[i] + i % 1024) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -68,7 +68,7 @@ TEST_CASE("Unit_hipMemFaultStackAllocation_Check") {
|
||||
int *A_d, *C_d;
|
||||
const size_t Nbytes = N * sizeof(int);
|
||||
const unsigned threadsPerBlock = 256;
|
||||
const unsigned blocks = (N + threadsPerBlock - 1)/threadsPerBlock;
|
||||
const unsigned blocks = (N + threadsPerBlock - 1) / threadsPerBlock;
|
||||
|
||||
HIP_CHECK(hipMallocManaged(&A_d, Nbytes));
|
||||
REQUIRE(A_d != nullptr);
|
||||
@@ -76,20 +76,18 @@ TEST_CASE("Unit_hipMemFaultStackAllocation_Check") {
|
||||
REQUIRE(C_d != nullptr);
|
||||
|
||||
for (size_t i = 0; i < N; i++) {
|
||||
A_d[i] = i%1024;
|
||||
A_d[i] = i % 1024;
|
||||
}
|
||||
|
||||
SECTION("Calling Kernel which allocate ConstSize to local array") {
|
||||
hipLaunchKernelGGL(MyKernelConstSize, dim3(blocks),
|
||||
dim3(threadsPerBlock), 0, 0, C_d, A_d);
|
||||
hipLaunchKernelGGL(MyKernelConstSize, dim3(blocks), dim3(threadsPerBlock), 0, 0, C_d, A_d);
|
||||
ret = hipGetLastError();
|
||||
REQUIRE(hipSuccess == ret);
|
||||
HIP_CHECK(hipDeviceSynchronize());
|
||||
REQUIRE(true == verify(C_d, A_d));
|
||||
}
|
||||
SECTION("Calling Kernel which allocate VariableSize to local array") {
|
||||
hipLaunchKernelGGL(MyKernelVariableSize, dim3(blocks),
|
||||
dim3(threadsPerBlock), 0, 0, C_d, A_d);
|
||||
hipLaunchKernelGGL(MyKernelVariableSize, dim3(blocks), dim3(threadsPerBlock), 0, 0, C_d, A_d);
|
||||
ret = hipGetLastError();
|
||||
REQUIRE(hipSuccess == ret);
|
||||
HIP_CHECK(hipDeviceSynchronize());
|
||||
@@ -99,4 +97,3 @@ TEST_CASE("Unit_hipMemFaultStackAllocation_Check") {
|
||||
HIP_CHECK(hipFree(C_d));
|
||||
HIP_CHECK(hipFree(A_d));
|
||||
}
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user