SWDEV-547554 - Resolve memory leaks in hiprtc tests (#967)
Esse commit está contido em:
@@ -125,6 +125,8 @@ TEST_CASE("Unit_hiprtc_devicemalloc") {
|
||||
|
||||
HIP_CHECK(hipFree(dX));
|
||||
HIP_CHECK(hipFree(dY));
|
||||
HIP_CHECK(hipFree(pA));
|
||||
HIP_CHECK(hipFree(pB));
|
||||
HIP_CHECK(hipFree(dOut));
|
||||
|
||||
HIP_CHECK(hipModuleUnload(module));
|
||||
|
||||
@@ -166,11 +166,7 @@ TEST_CASE("Unit_Rtc_MathConstants_header") {
|
||||
const char* compiler_option = complete_CO.c_str();
|
||||
for (int scenario = 0; scenario < 2; scenario++) {
|
||||
hiprtcProgram prog;
|
||||
const char** compiler_options = new const char*[2];
|
||||
for (int i = 0; i < 2; i++) {
|
||||
compiler_options[0] = compiler_option;
|
||||
compiler_options[1] = "";
|
||||
}
|
||||
std::array<const char*, 2> compiler_options = {compiler_option, ""};
|
||||
HIPRTC_CHECK(hiprtcCreateProgram(&prog, mathConstants_string, kername, 0, NULL, NULL));
|
||||
if (scenario == 0) {
|
||||
hiprtcResult compileResult{hiprtcCompileProgram(prog, 1, &compiler_option)};
|
||||
@@ -184,7 +180,7 @@ TEST_CASE("Unit_Rtc_MathConstants_header") {
|
||||
REQUIRE(false);
|
||||
}
|
||||
} else {
|
||||
hiprtcResult compileResult{hiprtcCompileProgram(prog, 2, compiler_options)};
|
||||
hiprtcResult compileResult{hiprtcCompileProgram(prog, 2, compiler_options.data())};
|
||||
if (!(compileResult == HIPRTC_SUCCESS)) {
|
||||
WARN("hiprtcCompileProgram() api failed!!");
|
||||
size_t logSize;
|
||||
|
||||
@@ -135,6 +135,7 @@ TEST_CASE("Unit_Rtc_bfloat16_header") {
|
||||
}
|
||||
}
|
||||
HIP_CHECK(hipModuleUnload(module));
|
||||
HIP_CHECK(hipFree(result_d));
|
||||
HIPRTC_CHECK(hiprtcDestroyProgram(&prog));
|
||||
delete[] result_h;
|
||||
}
|
||||
|
||||
Referência em uma Nova Issue
Bloquear um usuário