EXSWHTEC-113 - Implement tests for hipModuleGetTexRef #24
Change-Id: I5fe18f2ca977a740e29dda356b68ea4eb6e0565f
[ROCm/hip-tests commit: 72aa591328]
This commit is contained in:
committed by
Rakesh Roy
parent
de6db48460
commit
d30d6a5a62
@@ -268,6 +268,10 @@
|
||||
"Unit_hipModuleGetGlobal_Negative_Name_Is_Empty_String",
|
||||
"Note: Test disabled due to defect - EXSWHTEC-165",
|
||||
"Unit_hipModuleGetGlobal_Negative_Dptr_And_Bytes_Are_Nullptr",
|
||||
"Note: Test disabled due to defect - EXSWHTEC-166",
|
||||
"Unit_hipModuleGetTexRef_Negative_Hmod_Is_Nullptr",
|
||||
"Note: Test disabled due to defect - EXSWHTEC-167",
|
||||
"Unit_hipModuleGetTexRef_Negative_Name_Is_Empty_String",
|
||||
#endif
|
||||
#if defined VEGA20
|
||||
"=== SWDEV-419112 Below tests fail in stress test on 29/08/23 ===",
|
||||
|
||||
@@ -369,6 +369,10 @@
|
||||
"Unit_hipModuleGetGlobal_Negative_Name_Is_Empty_String",
|
||||
"Note: Test disabled due to defect - EXSWHTEC-165",
|
||||
"Unit_hipModuleGetGlobal_Negative_Dptr_And_Bytes_Are_Nullptr",
|
||||
"Note: Test disabled due to defect - EXSWHTEC-166",
|
||||
"Unit_hipModuleGetTexRef_Negative_Hmod_Is_Nullptr",
|
||||
"Note: Test disabled due to defect - EXSWHTEC-167",
|
||||
"Unit_hipModuleGetTexRef_Negative_Name_Is_Empty_String",
|
||||
#endif
|
||||
"End of json"
|
||||
]
|
||||
|
||||
@@ -28,6 +28,7 @@ set(TEST_SRC
|
||||
hipModuleGetFunction.cc
|
||||
hipModuleLaunchKernel.cc
|
||||
hipModuleGetGlobal.cc
|
||||
hipModuleGetTexRef.cc
|
||||
)
|
||||
|
||||
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/get_function_module.code
|
||||
@@ -46,6 +47,12 @@ add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/get_global_test_module.cod
|
||||
add_custom_target(get_global_test_module ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/get_global_test_module.code)
|
||||
|
||||
|
||||
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/get_tex_ref_module.code
|
||||
COMMAND ${CMAKE_CXX_COMPILER} --genco --std=c++17 ${CMAKE_CURRENT_SOURCE_DIR}/get_tex_ref_module.cc -o get_tex_ref_module.code
|
||||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/get_tex_ref_module.cc)
|
||||
add_custom_target(get_tex_ref_module ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/get_tex_ref_module.code)
|
||||
|
||||
|
||||
add_custom_target(empty_module.code
|
||||
COMMAND ${CMAKE_CXX_COMPILER} --genco ${OFFLOAD_ARCH_STR}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/empty_module.cc
|
||||
@@ -151,6 +158,7 @@ add_dependencies(build_tests empty_module.code)
|
||||
add_dependencies(ModuleTest get_function_module)
|
||||
add_dependencies(ModuleTest launch_kernel_module)
|
||||
add_dependencies(ModuleTest get_global_test_module)
|
||||
add_dependencies(ModuleTest get_tex_ref_module)
|
||||
|
||||
if(HIP_PLATFORM MATCHES "amd")
|
||||
add_dependencies(build_tests copyKernel.code copyKernel.s)
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
Copyright (c) 2022 Advanced Micro Devices, Inc. All rights reserved.
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <hip/hip_runtime_api.h>
|
||||
|
||||
texture<float, 2> tex;
|
||||
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
Copyright (c) 2022 Advanced Micro Devices, Inc. All rights reserved.
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "hip_module_common.hh"
|
||||
|
||||
#include <hip_test_common.hh>
|
||||
#include <hip/hip_runtime_api.h>
|
||||
|
||||
static hipModule_t GetModule() {
|
||||
HIP_CHECK(hipFree(nullptr));
|
||||
static const auto mg = ModuleGuard::LoadModule("get_tex_ref_module.code");
|
||||
return mg.module();
|
||||
}
|
||||
|
||||
TEST_CASE("Unit_hipModuleGetTexRef_Positive_Basic") {
|
||||
hipTexRef tex_ref = nullptr;
|
||||
HIP_CHECK(hipModuleGetTexRef(&tex_ref, GetModule(), "tex"));
|
||||
REQUIRE(tex_ref != nullptr);
|
||||
}
|
||||
|
||||
TEST_CASE("Unit_hipModuleGetTexRef_Negative_Parameters") {
|
||||
hipModule_t module = GetModule();
|
||||
hipTexRef tex_ref = nullptr;
|
||||
|
||||
SECTION("texRef == nullptr") {
|
||||
HIP_CHECK_ERROR(hipModuleGetTexRef(nullptr, module, "tex"), hipErrorInvalidValue);
|
||||
}
|
||||
|
||||
SECTION("name == nullptr") {
|
||||
HIP_CHECK_ERROR(hipModuleGetTexRef(&tex_ref, module, nullptr), hipErrorInvalidValue);
|
||||
}
|
||||
|
||||
SECTION("name == non existent texture") {
|
||||
HIP_CHECK_ERROR(hipModuleGetTexRef(&tex_ref, module, "non_existent_texture"), hipErrorNotFound);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("Unit_hipModuleGetTexRef_Negative_Hmod_Is_Nullptr") {
|
||||
hipTexRef tex_ref = nullptr;
|
||||
|
||||
HIP_CHECK_ERROR(hipModuleGetTexRef(&tex_ref, nullptr, "tex"), hipErrorInvalidResourceHandle);
|
||||
}
|
||||
|
||||
TEST_CASE("Unit_hipModuleGetTexRef_Negative_Name_Is_Empty_String") {
|
||||
hipModule_t module = GetModule();
|
||||
hipTexRef tex_ref = nullptr;
|
||||
|
||||
HIP_CHECK_ERROR(hipModuleGetTexRef(&tex_ref, module, ""), hipErrorInvalidValue);
|
||||
}
|
||||
Reference in New Issue
Block a user