SWDEV-557828 - fix hip-tests on cuda (#1152)
Co-authored-by: Rahul Manocha <rmanocha@amd.com>
This commit is contained in:
@@ -12,9 +12,16 @@ add_custom_target(library_code_load.code
|
||||
set_property(GLOBAL APPEND PROPERTY
|
||||
G_INSTALL_CUSTOM_TARGETS ${CMAKE_CURRENT_BINARY_DIR}/library_code_load.code)
|
||||
|
||||
hip_add_exe_to_target(NAME LibraryTests
|
||||
TEST_SRC ${TEST_SRC}
|
||||
TEST_TARGET_NAME build_tests
|
||||
LINKER_LIBS hiprtc)
|
||||
if(HIP_PLATFORM MATCHES "amd")
|
||||
hip_add_exe_to_target(NAME LibraryTests
|
||||
TEST_SRC ${TEST_SRC}
|
||||
TEST_TARGET_NAME build_tests
|
||||
LINKER_LIBS hiprtc)
|
||||
else()
|
||||
hip_add_exe_to_target(NAME LibraryTests
|
||||
TEST_SRC ${TEST_SRC}
|
||||
TEST_TARGET_NAME build_tests
|
||||
LINKER_LIBS nvrtc)
|
||||
endif()
|
||||
|
||||
add_dependencies(LibraryTests library_code_load.code)
|
||||
|
||||
@@ -29,7 +29,7 @@ TEST_CASE("Unit_library_negative") {
|
||||
HIP_CHECK_ERROR(
|
||||
hipLibraryLoadFromFile(nullptr, nullptr, nullptr, nullptr, 0, nullptr, nullptr, 0),
|
||||
hipErrorInvalidValue);
|
||||
HIP_CHECK_ERROR(hipLibraryUnload(nullptr), hipErrorInvalidValue);
|
||||
HIP_CHECK_ERROR(hipLibraryUnload(nullptr), hipErrorInvalidResourceHandle);
|
||||
HIP_CHECK_ERROR(hipLibraryGetKernel(nullptr, nullptr, nullptr), hipErrorInvalidValue);
|
||||
HIP_CHECK_ERROR(hipLibraryGetKernelCount(nullptr, nullptr), hipErrorInvalidValue);
|
||||
}
|
||||
|
||||
@@ -29,7 +29,11 @@ THE SOFTWARE.
|
||||
static std::vector<char> compile_using_hiprtc(const std::string& code, std::string gpu_arch) {
|
||||
hiprtcProgram prog;
|
||||
HIPRTC_CHECK(hiprtcCreateProgram(&prog, code.c_str(), "code.cu", 0, NULL, NULL));
|
||||
std::string offload_arch = "--offload-arch=" + gpu_arch;
|
||||
#ifdef __HIP_PLATFORM_AMD__
|
||||
std::string offload_arch = "--offload-arch=" + gpu_arch;
|
||||
#else
|
||||
std::string offload_arch = "--fmad=false";
|
||||
#endif
|
||||
const char* opts[] = {offload_arch.c_str()};
|
||||
HIPRTC_CHECK(hiprtcCompileProgram(prog, 1, opts));
|
||||
size_t size;
|
||||
|
||||
@@ -930,9 +930,11 @@ TEMPLATE_TEST_CASE("Unit_hipHostRegister_Flags", "", int, float, double) {
|
||||
#endif
|
||||
FlagType{0xF0, false}, FlagType{0xFFF2, false}, FlagType{0xFFFFFFFF, false});
|
||||
|
||||
#if (HT_AMD == 1) && (HT_LINUX == 1)
|
||||
if (IsNavi4X() && (flags.value & hipExtHostRegisterUncached)) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
INFO("Testing hipHostRegister flag: " << flags.value);
|
||||
if (flags.valid) {
|
||||
HIP_CHECK(hipHostRegister(hostPtr, sizeBytes, flags.value));
|
||||
@@ -942,7 +944,6 @@ TEMPLATE_TEST_CASE("Unit_hipHostRegister_Flags", "", int, float, double) {
|
||||
}
|
||||
free(hostPtr);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test Description
|
||||
* ------------------------
|
||||
|
||||
Reference in New Issue
Block a user