Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CR-1169187 Disable all PS tests #7639

Merged
merged 2 commits into from
Jul 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions tests/validate/ps_aie_test/src/host.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ int main(int argc, char** argv) {
return EXIT_FAILURE;
}

return EOPNOTSUPP;

auto num_devices = xrt::system::enumerate_devices();

auto device = xrt::device {dev_id};
Expand Down
2 changes: 2 additions & 0 deletions tests/validate/ps_bandwidth_test/src/host.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ int main(int argc, char** argv) {
return EXIT_FAILURE;
}

return EOPNOTSUPP;

auto num_devices = xrt::system::enumerate_devices();

auto device = xrt::device {dev_id};
Expand Down
2 changes: 1 addition & 1 deletion tests/validate/ps_iops_test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ endif()
if (NOT WIN32)
include_directories(../common/includes/cmdparser ../common/includes/logger)
add_executable(${TESTNAME} ../common/includes/cmdparser/cmdlineparser.cpp ../common/includes/logger/logger.cpp src/ps_iops.cpp)
target_link_libraries(${TESTNAME} PRIVATE ${uuid_LIBRARY} pthread ${xrt_coreutil_LIBRARY} ${xrt_core_LIBRARY})
target_link_libraries(${TESTNAME} PRIVATE ${uuid_LIBRARY} pthread ${xrt_coreutil_LIBRARY} ${xrt_core_LIBRARY} ${Boost_PROGRAM_OPTIONS_LIBRARY} ${Boost_FILESYSTEM_LIBRARY} ${Boost_SYSTEM_LIBRARY})
install(TARGETS ${TESTNAME}
RUNTIME DESTINATION ${XRT_VALIDATE_DIR})
endif(NOT WIN32)
Expand Down
122 changes: 70 additions & 52 deletions tests/validate/ps_iops_test/src/ps_iops.cpp
Original file line number Diff line number Diff line change
@@ -1,27 +1,15 @@
/**
* Copyright (C) 2022 Xilinx, Inc
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may
* not use this file except in compliance with the License. A copy of the
* License is located at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*/
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2022 Xilinx, Inc
// Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.

#include <boost/program_options.hpp>
#include <chrono>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <thread>
#include <vector>

#include "cmdlineparser.h"

#include "xilutil.hpp"
#include "xrt/xrt_bo.h"
#include "xrt/xrt_device.h"
Expand Down Expand Up @@ -179,48 +167,76 @@ testMultiThreads(const std::string& dev, const std::string& xclbin_fn,
return 0;
}

int
_main(int argc, char* argv[])
static int
validate_binary_file(const std::string& binaryfile, bool print = false)
{
if (argc < 2) {
usage(argv[0]);
throw std::runtime_error("Number of argument should not less than 2");
std::ifstream infile(binaryfile);
if (!infile.good()) {
if (print)
std::cout << "\nNOT SUPPORTED" << std::endl;
return EOPNOTSUPP;
} else {
if (print)
std::cout << "\nSUPPORTED" << std::endl;
return EXIT_SUCCESS;
}
}

// Command Line Parser
sda::utils::CmdLineParser parser;

// Switches
//**************
//"<Full Arg>", "<Short Arg>", "<Description>", "<Default>"
parser.addSwitch("--kernel", "-k",
"kernel (imply old style verify.xclbin is used)", "");
parser.addSwitch("--device", "-d", "device id", "0");
parser.addSwitch("--threads", "-t", "number of threads", "2");
parser.addSwitch("--length", "-l", "length of queue", "128");
parser.addSwitch("--total", "-a", "total amount of commands per thread",
"50000");
parser.addSwitch("--verbose", "-v", "verbose output", "", true);
parser.parse(argc, argv);

int
_main(int argc, char* argv[])
{
/* Could be BDF or device index */
std::string device_str = parser.value("device");
int threadNumber = parser.value_to_int("threads");
int queueLength = parser.value_to_int("length");
int total = parser.value_to_int("total");
std::string xclbin_fn = parser.value("kernel");
if (xclbin_fn.empty()) {
std::string test_path = argv[1];
xclbin_fn = test_path + "/ps_validate_bandwidth.xclbin";
krnl.name = "hello_world";
krnl.new_style = true;
std::string device_str;
std::string test_path;
bool flag_s;
int threadNumber;
int queueLength;
int total;
std::string xclbin_fn;
std::vector<std::string> dependency_paths;

boost::program_options::options_description options;
options.add_options()
("help,h", "Print help messages")
("xclbin,x", boost::program_options::value<decltype(xclbin_fn)>(&xclbin_fn)->implicit_value("/lib/firmware/xilinx/ps_kernels/ps_bandwidth.xclbin"), "Path to the xclbin file for the test")
("path,p", boost::program_options::value<decltype(test_path)>(&test_path)->required(), "Path to the platform resources")
("device,d", boost::program_options::value<decltype(device_str)>(&device_str)->required(), "The Bus:Device.Function (e.g., 0000:d8:00.0) device of interest")
("supported,s", boost::program_options::bool_switch(&flag_s), "Print supported or not")
("include,i" , boost::program_options::value<decltype(dependency_paths)>(&dependency_paths)->multitoken(), "Paths to xclbins required for this test")
("threads,t" , boost::program_options::value<decltype(threadNumber)>(&threadNumber)->default_value(2), "Number of threads to run within this test")
("length,l" , boost::program_options::value<decltype(queueLength)>(&queueLength)->default_value(128), "Length of queue")
("total,a" , boost::program_options::value<decltype(total)>(&total)->default_value(50000), "Total amount of commands per thread")
("verbose,v", boost::program_options::bool_switch(&verbose)->default_value(false), "Enable verbose output")
;

boost::program_options::variables_map vm;
try {
boost::program_options::store(boost::program_options::parse_command_line(argc, argv, options), vm);
if (vm.count("help")) {
std::cout << options << std::endl;
return EXIT_SUCCESS;
}
boost::program_options::notify(vm);
} catch (boost::program_options::error& e) {
std::cerr << "ERROR: " << e.what() << std::endl;
std::cout << options << std::endl;
return EXIT_FAILURE;
}
verbose = parser.isValid("verbose");

/* Sanity check */
std::ifstream infile(xclbin_fn);
if (!infile.good())
throw std::runtime_error("Wrong xclbin file " + xclbin_fn);
// Validate dependency xclbins if any
for (const auto& path : dependency_paths) {
auto retVal = validate_binary_file(path);
if (retVal != EXIT_SUCCESS)
return retVal;
}

// Validate ps kernel
auto retVal = validate_binary_file(xclbin_fn, flag_s);
if (flag_s || retVal != EXIT_SUCCESS)
return retVal;

krnl.new_style = true;

if (queueLength <= 0)
throw std::runtime_error("Negative/Zero queue length");
Expand All @@ -231,6 +247,7 @@ _main(int argc, char* argv[])
if (threadNumber <= 0)
throw std::runtime_error("Invalid thread number");

// TODO need to add processing for dependency paths
testMultiThreads(device_str, xclbin_fn, threadNumber, queueLength, total);

return 0;
Expand All @@ -239,6 +256,7 @@ _main(int argc, char* argv[])
int
main(int argc, char* argv[])
{
return EOPNOTSUPP;
try {
_main(argc, argv);
std::cout << "TEST PASSED" << std::endl;
Expand Down
2 changes: 2 additions & 0 deletions tests/validate/ps_validate_test/src/host.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ int main(int argc, char** argv) {
return EXIT_FAILURE;
}

return EOPNOTSUPP;

auto num_devices = xrt::system::enumerate_devices();

auto device = xrt::device {dev_id};
Expand Down