EXSWHTEC-283 - Introduce build dependencies for numerical accuracy tests #233
Change-Id: I5381beb47347c24a161113b986fa7f252057ffdb
[ROCm/hip-tests commit: 122403f464]
This commit is contained in:
committato da
Rakesh Roy
parent
dcade635c6
commit
db33e97368
@@ -89,6 +89,9 @@ else()
|
||||
set(HIP_PACKAGING_VERSION_PATCH ${HIP_VERSION_PATCH}-${HIP_VERSION_GITHASH})
|
||||
endif()
|
||||
|
||||
|
||||
find_package(Boost 1.70.0)
|
||||
|
||||
if(NOT DEFINED CATCH2_PATH)
|
||||
if(DEFINED ENV{CATCH2_PATH})
|
||||
set(CATCH2_PATH $ENV{CATCH2_PATH} CACHE STRING "Catch2 Path")
|
||||
@@ -126,6 +129,7 @@ include_directories(
|
||||
"./kernels"
|
||||
${HIP_PATH}/include
|
||||
${JSON_PARSER}
|
||||
${Boost_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
option(RTC_TESTING "Run tests using HIP RTC to compile the kernels" OFF)
|
||||
|
||||
@@ -36,6 +36,12 @@ int main(int argc, char** argv) {
|
||||
| Opt(cmd_options.cg_iterations, "cg_iterations")
|
||||
["-C"]["--cg-iterations"]
|
||||
("Number of iterations used for cooperative groups sync tests (default: 5)")
|
||||
| Opt(cmd_options.accuracy_iterations, "accuracy_iterations")
|
||||
["-A"]["--accuracy-iterations"]
|
||||
("Number of iterations used for math accuracy tests with randomly generated inputs (default: 2^32)")
|
||||
| Opt(cmd_options.accuracy_max_memory, "accuracy_max_memory")
|
||||
["-M"]["--accuracy-max-memory"]
|
||||
("Percentage of global device memory allowed for math accuracy tests (default: 80%)")
|
||||
;
|
||||
// clang-format on
|
||||
|
||||
|
||||
@@ -22,6 +22,9 @@ THE SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <limits>
|
||||
|
||||
struct CmdOptions {
|
||||
int iterations = 10;
|
||||
int warmups = 100;
|
||||
@@ -29,6 +32,8 @@ struct CmdOptions {
|
||||
int cg_iterations = 5;
|
||||
bool no_display = false;
|
||||
bool progress = false;
|
||||
uint64_t accuracy_iterations = std::numeric_limits<uint32_t>::max() + 1ull;
|
||||
int accuracy_max_memory = 80;
|
||||
};
|
||||
|
||||
extern CmdOptions cmd_options;
|
||||
|
||||
@@ -284,6 +284,9 @@ TEST_CASE("Unit_atomicDec_Negative_Parameters") {}
|
||||
|
||||
/**
|
||||
* End doxygen group AtomicsTest.
|
||||
* @defgroup MathTest Math Device Functions
|
||||
* @{
|
||||
* This section describes tests for device math functions of HIP runtime API.
|
||||
* @}
|
||||
*/
|
||||
|
||||
|
||||
@@ -43,6 +43,7 @@ add_subdirectory(g++)
|
||||
add_subdirectory(module)
|
||||
add_subdirectory(channelDescriptor)
|
||||
add_subdirectory(executionControl)
|
||||
add_subdirectory(math)
|
||||
add_subdirectory(vector_types)
|
||||
add_subdirectory(atomics)
|
||||
add_subdirectory(complex)
|
||||
|
||||
@@ -52,7 +52,7 @@ class CompileAndCapture(unittest.TestCase):
|
||||
# HIP compiler on AMD platforms has limit of 20 errors, and some negative
|
||||
# test cases expect that more errors are detected.
|
||||
if (self.platform == 'amd'):
|
||||
compiler_args.append('-ferror-limit=100')
|
||||
compiler_args.append('-ferror-limit=200')
|
||||
compiler_output = subprocess.run(compiler_args, stderr=subprocess.PIPE)
|
||||
# Get the compiler output in the stdout if -V flag is raised during ctest invocation.
|
||||
compiler_stderr = compiler_output.stderr.decode('UTF-8')
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
# Copyright (c) 2023 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.
|
||||
|
||||
set(TEST_SRC
|
||||
)
|
||||
|
||||
hip_add_exe_to_target(NAME MathsTest
|
||||
TEST_SRC ${TEST_SRC}
|
||||
TEST_TARGET_NAME build_tests COMMON_SHARED_SRC ${COMMON_SHARED_SRC})
|
||||
@@ -47,6 +47,7 @@ void findAPICallInFile(HipAPI& hip_api, std::string test_module_file) {
|
||||
std::string api_member{"." + hip_api.getName() + "("};
|
||||
std::string api_newline{" " + hip_api.getName() + "("};
|
||||
std::string api_templated{" " + hip_api.getName() + "<"};
|
||||
std::string api_kernel_def_macro{"_KERNEL_DEF(" + hip_api.getName() + ")"};
|
||||
|
||||
std::string api_restriction{hip_api.getFileRestriction()};
|
||||
bool found_restriction{false};
|
||||
@@ -66,7 +67,8 @@ void findAPICallInFile(HipAPI& hip_api, std::string test_module_file) {
|
||||
(line.find(api_member) != std::string::npos) ||
|
||||
(line.find(api_newline) != std::string::npos) ||
|
||||
(line.find(hip_api.getName() + "(") == 0) ||
|
||||
(line.find(api_templated) != std::string::npos)) {
|
||||
(line.find(api_templated) != std::string::npos) ||
|
||||
(line.find(api_kernel_def_macro) != std::string::npos)) {
|
||||
if (api_restriction == "" || found_restriction) {
|
||||
hip_api.addFileOccurrence(FileOccurrence(test_module_file, line_number));
|
||||
}
|
||||
@@ -135,6 +137,8 @@ void findAPITestCaseInFileByAPIName(HipAPI& hip_api, std::string test_module_fil
|
||||
std::string line;
|
||||
|
||||
std::string test_case_definition{"TEST_CASE("};
|
||||
std::string test_def_macro{"_TEST_DEF("};
|
||||
std::string test_def_impl_macro{"_TEST_DEF_IMPL("};
|
||||
std::string test_case{"None"};
|
||||
|
||||
while (std::getline(test_module_file_handler, line)) {
|
||||
@@ -146,6 +150,14 @@ void findAPITestCaseInFileByAPIName(HipAPI& hip_api, std::string test_module_fil
|
||||
if (test_case.find("_" + hip_api.getName() + "_") != std::string::npos) {
|
||||
hip_api.addTestCase(TestCaseOccurrence{test_case, test_module_file, line_number});
|
||||
}
|
||||
} else if ((line.find(test_def_macro) != std::string::npos) ||
|
||||
(line.find(test_def_impl_macro) != std::string::npos)) {
|
||||
test_case = line.substr(line.find("(") + 1);
|
||||
test_case = test_case.substr(0, test_case.find(","));
|
||||
if (test_case == hip_api.getName() || test_case == hip_api.getName() + "_wrapper") {
|
||||
hip_api.addTestCase(TestCaseOccurrence{"Unit_Device_" + test_case + "_Accuracy_Positive",
|
||||
test_module_file, line_number});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -403,4 +415,4 @@ std::vector<std::string> extractTestModuleFiles(std::string& tests_root_director
|
||||
|
||||
std::string findAbsolutePathOfFile(std::string file_path) {
|
||||
return std::filesystem::canonical(std::filesystem::absolute(file_path));
|
||||
}
|
||||
}
|
||||
Fai riferimento in un nuovo problema
Block a user