[CI] Increase rocDecode and rocJPEG Code Coverage (#183)

* Increase rocDecode code coverage and add version check

* Update rocJPEG tests

* Fix rocJPEG tests

* Enable building tests/samples in rocm release compat workflow

* Readded rocJPEG test skips

* formatting

* Adding ROCm libraries for the code-coverage job

* Added return value check for error message and updated compatability to enable tests

* Disable rocm_release_compatibility samples and tests until openmp issue is resolved

---------

Co-authored-by: Ian Trowbridge <Ian.Trowbridge@amd.com>
Co-authored-by: Jonathan R. Madsen <jonathanrmadsen@gmail.com>
Co-authored-by: Jonathan R. Madsen <Jonathan.Madsen@amd.com>
Этот коммит содержится в:
systems-assistant[bot]
2025-09-03 19:20:11 +05:30
коммит произвёл GitHub
родитель 230a22b395
Коммит 2cfedef6b6
7 изменённых файлов: 122 добавлений и 31 удалений
+1
Просмотреть файл
@@ -107,6 +107,7 @@ jobs:
git config --global --add safe.directory '*'
apt-get update
apt-get install -y build-essential cmake python3-pip gcovr wkhtmltopdf xvfb xfonts-base xfonts-75dpi xfonts-100dpi xfonts-utils xfonts-encodings libfontconfig libdw-dev libsqlite3-dev
apt-get install -y rccl-dev rccl-unittests rocjpeg-dev rocjpeg-test rocdecode-dev rocdecode-test
python3 -m pip install -U --user -r requirements.txt
rm -rf /opt/rocm/lib/*rocprofiler-sdk* /opt/rocm/lib/cmake/*rocprofiler-sdk* /opt/rocm/share/*rocprofiler-sdk* /opt/rocm/libexec/*rocprofiler-sdk*
+93 -14
Просмотреть файл
@@ -26,28 +26,76 @@ THE SOFTWARE.
#include <cstring>
#include <iostream>
// Call rocDecode API with nullptrs to test rocDecode trace
// Eventually should replace with functional calls, but this requires
// finding and linking several FFmpeg and AV.. libraries (AVUTIL, AVCODEC, AVFORMAT)
// Additionally, some rocdecode/share files like ffmpeg_video_dec.cpp would need
// to be updated to resolve compiler warnings to compile with rocprofiler-sdk
int
main(int argc, char** argv)
test_rocdecode_decoder()
{
// Get input file
std::string input_file_path{};
for(int i = 1; i < argc; i++)
rocDecStatus rocdecode_status = rocDecCreateDecoder(nullptr, nullptr);
if(rocdecode_status != ROCDEC_INVALID_PARAMETER)
{
if(!strcmp(argv[i], "-i"))
{
if(++i == argc)
{
std::cerr << "Provide path to input file" << std::endl;
}
input_file_path = argv[i];
continue;
}
std::cerr << "Expected ROCDEC_INVALID_PARAMETER\n";
return 1;
}
if(rocDecGetErrorName(rocdecode_status) == nullptr)
{
std::cerr << "Expected error name to not be null\n";
return 1;
}
if(rocDecCreateVideoParser(nullptr, nullptr) != ROCDEC_INVALID_PARAMETER)
{
std::cerr << "Expected ROCDEC_INVALID_PARAMETER\n";
return 1;
}
if(rocDecParseVideoData(nullptr, nullptr) != ROCDEC_INVALID_PARAMETER)
{
std::cerr << "Expected ROCDEC_INVALID_PARAMETER\n";
return 1;
}
if(rocDecDestroyVideoParser(nullptr) != ROCDEC_INVALID_PARAMETER)
{
std::cerr << "Expected ROCDEC_INVALID_PARAMETER\n";
return 1;
}
if(rocDecDestroyDecoder(nullptr) != ROCDEC_INVALID_PARAMETER)
{
std::cerr << "Expected ROCDEC_INVALID_PARAMETER\n";
return 1;
}
if(rocDecGetDecoderCaps(nullptr) != ROCDEC_INVALID_PARAMETER)
{
std::cerr << "Expected ROCDEC_INVALID_PARAMETER\n";
return 1;
}
if(rocDecGetDecodeStatus(nullptr, 0, nullptr) != ROCDEC_INVALID_PARAMETER)
{
std::cerr << "Expected ROCDEC_INVALID_PARAMETER\n";
return 1;
}
if(rocDecReconfigureDecoder(nullptr, nullptr) != ROCDEC_INVALID_PARAMETER)
{
std::cerr << "Expected ROCDEC_INVALID_PARAMETER\n";
return 1;
}
if(rocDecGetVideoFrame(nullptr, 0, nullptr, nullptr, nullptr) != ROCDEC_INVALID_PARAMETER)
{
std::cerr << "Expected ROCDEC_INVALID_PARAMETER\n";
return 1;
}
return 0;
}
int
test_rocdecode_bitstream_reader(const std::string& input_file)
{
// Set up bitstreamreader
RocdecBitstreamReader bs_reader = nullptr;
rocDecVideoCodec rocdec_codec_id{};
int bit_depth{};
if(rocDecCreateBitstreamReader(&bs_reader, input_file_path.c_str()) != ROCDEC_SUCCESS)
if(rocDecCreateBitstreamReader(&bs_reader, input_file.c_str()) != ROCDEC_SUCCESS)
{
std::cerr << "Failed to create the bitstream reader." << std::endl;
return 1;
@@ -131,4 +179,35 @@ main(int argc, char** argv)
{
rocDecDestroyBitstreamReader(bs_reader);
}
return 0;
}
int
main(int argc, char** argv)
{
// Get input file
std::string input_file_path{};
for(int i = 1; i < argc; i++)
{
if(!strcmp(argv[i], "-i"))
{
if(++i == argc)
{
std::cerr << "Provide path to input file" << std::endl;
}
input_file_path = argv[i];
continue;
}
}
if(test_rocdecode_bitstream_reader(input_file_path) != 0)
{
std::cerr << "rocDecode bitsream reader test failed\n";
return 1;
}
if(test_rocdecode_decoder() != 0)
{
std::cerr << "rocDecode decoder test failed\n";
return 1;
}
return 0;
}
+10
Просмотреть файл
@@ -177,6 +177,16 @@ def test_rocdecode_traces(input_data):
"rocDecGetVideoFrame",
"rocDecGetDecodeStatus",
"rocDecDestroyBitstreamReader",
"rocDecCreateDecoder",
"rocDecGetErrorName",
"rocDecCreateVideoParser",
"rocDecParseVideoData",
"rocDecDestroyVideoParser",
"rocDecDestroyDecoder",
"rocDecGetDecoderCaps",
"rocDecGetDecodeStatus",
"rocDecReconfigureDecoder",
"rocDecGetVideoFrame",
]:
assert call in api_calls
+2 -4
Просмотреть файл
@@ -53,12 +53,10 @@ def test_data_structure(input_data):
node_exists("buffer_records", sdk_data)
node_exists("names", sdk_data["callback_records"])
# Uncomment once mainline rocprofiler register supports rocJPEG
# node_exists("rocjpeg_api_traces", sdk_data["callback_records"])
node_exists("rocjpeg_api_traces", sdk_data["callback_records"])
node_exists("names", sdk_data["buffer_records"])
# Uncomment once mainline rocprofiler register supports rocJPEG
# node_exists("rocjpeg_api_traces", sdk_data["buffer_records"])
node_exists("rocjpeg_api_traces", sdk_data["buffer_records"])
def test_size_entries(input_data):
+10
Просмотреть файл
@@ -123,6 +123,16 @@ def test_csv_data(csv_data):
"rocDecGetVideoFrame",
"rocDecGetDecodeStatus",
"rocDecDestroyBitstreamReader",
"rocDecCreateDecoder",
"rocDecGetErrorName",
"rocDecCreateVideoParser",
"rocDecParseVideoData",
"rocDecDestroyVideoParser",
"rocDecDestroyDecoder",
"rocDecGetDecoderCaps",
"rocDecGetDecodeStatus",
"rocDecReconfigureDecoder",
"rocDecGetVideoFrame",
]:
assert call in api_calls
+4 -4
Просмотреть файл
@@ -77,10 +77,10 @@ add_test(
NAME rocprofv3-test-rocjpeg-tracing-validate
COMMAND
${Python3_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/validate.py --json-input
${CMAKE_CURRENT_BINARY_DIR}/rocjpeg-trace/out_results.json --otf2-input
${CMAKE_CURRENT_BINARY_DIR}/rocjpeg-trace/out_results.otf2 --pftrace-input
${CMAKE_CURRENT_BINARY_DIR}/rocjpeg-trace/out_results.pftrace --csv-input
${CMAKE_CURRENT_BINARY_DIR}/rocjpeg-trace/out_rocjpeg_api_trace.csv)
${CMAKE_CURRENT_BINARY_DIR}/rocjpeg-demo-trace/out_results.json --otf2-input
${CMAKE_CURRENT_BINARY_DIR}/rocjpeg-demo-trace/out_results.otf2 --pftrace-input
${CMAKE_CURRENT_BINARY_DIR}/rocjpeg-demo-trace/out_results.pftrace --csv-input
${CMAKE_CURRENT_BINARY_DIR}/rocjpeg-demo-trace/out_rocjpeg_api_trace.csv)
set_tests_properties(
rocprofv3-test-rocjpeg-tracing-validate
+2 -9
Просмотреть файл
@@ -90,7 +90,6 @@ def test_csv_data(csv_data):
# If rocJPEG tracing is not supported, end early
if len(csv_data) <= 2:
return pytest.skip("rocjpeg tracing unavailable")
assert len(csv_data) > 0, "Expected non-empty csv data"
api_calls = []
@@ -140,10 +139,7 @@ def test_perfetto_data(pftrace_data, json_data):
import rocprofiler_sdk.tests.rocprofv3 as rocprofv3
# If rocJPEG tracing is not supported, end early
if (
pftrace_data == None
or len(json_data["rocprofiler-sdk-tool"]["buffer_records"]["rocjpeg_api"]) == 0
):
if len(json_data["rocprofiler-sdk-tool"]["buffer_records"]["rocjpeg_api"]) == 0:
return pytest.skip("rocjpeg tracing unavailable")
rocprofv3.test_perfetto_data(
@@ -157,10 +153,7 @@ def test_otf2_data(otf2_data, json_data):
import rocprofiler_sdk.tests.rocprofv3 as rocprofv3
# If rocJPEG tracing is not supported, end early
if (
otf2_data == None
or len(json_data["rocprofiler-sdk-tool"]["buffer_records"]["rocjpeg_api"]) == 0
):
if len(json_data["rocprofiler-sdk-tool"]["buffer_records"]["rocjpeg_api"]) == 0:
return pytest.skip("rocjpeg tracing unavailable")
rocprofv3.test_otf2_data(