rocJPEG API Tracing (#73)
* rocDecode API Tracing support
* Test bin file added to rocdecode. Need to add validate python methods
* Added option to not make rocDecode tests
* Added rocdecode and rocprofv3 tests
* Added csv test
* Address PR comments. Changed tests to use built-in rocstreambit decoder to remove ffmpeg dependancy. Changed cmake option to disbale tests rather than not build them. Tests work locally, but will fail until rocDecode is built with tracing enabled on CI
* Add option to avoid building rocdecode tests
* Added option to avoid building rocdecode bin file
* Support for rocJPEG API Trace
* Added newline to rocjpeg_version.h
* json-tool code added, initial test/bin commit
* Formatting
* Resolved rocjpeg bin test compilation errors
* Tests implemented. Perfetto module currently resulting in errors, so need to retest whenever it is fixed
* Formatting and compilation errors
* Minor fixes
* Copyright year update and minor fixes
* Doc update fix
* Added rocjpeg csv file in data
* Addresses review comments: Updated fixed Findroc.. and uses root directory as a hint, fixed documentation error, changed tables to use _CORE, minor style fixes
* Added rocdecode and rocjpeg to CI
* Removed rocdecode and rocjpeg from CI and added back build tests option
* Updated Cmake Files
* Added rocDecode and rocJPEG to CI
* Remove cmake line added in error
* Temporarily modified tests to pass if rocdecode or rocjpeg tracing are not supported for CI, cmake changes
* Added find_package for test
* Added back use of system rocDecode and rocJPEG, modifies system files to include prefix path
* Updated no-link to include INCLUDE_DIR/roc(decode|jpeg), added comments for tests
* Resolve merge conflicts and formatting
* Added regex find and replace instead of include for CI
* VAAPI package causing errors on Vega20
* Removed system rocjpeg and rocdecode use temporarily until cmake issues resolved
* Removed workflows regex
* Formatting and minor test modification
* Modified test for vega20
* Update rocDecode and rocJPEG cmake and tests
* Changelog
* Fix merge conflict
* Added back if-statements around add-tests since cmake-generator-expressions are resulting in errors when the packages are missing
* Removed if found statements, replaced with TARGET:EXISTS
* Skip json file for rocjpeg and rocdecode tests if not supported
* Add os import
---------
Co-authored-by: Kandula, Venkateshwar reddy <Venkateshwarreddy.Kandula@amd.com>
Co-authored-by: Jonathan R. Madsen <jonathanrmadsen@gmail.com>
[ROCm/rocprofiler-sdk commit: 31fe8858d1]
This commit is contained in:
@@ -9,6 +9,7 @@ project(
|
||||
VERSION 0.0.0)
|
||||
|
||||
find_package(rocprofiler-sdk REQUIRED)
|
||||
find_package(rocDecode)
|
||||
|
||||
rocprofiler_configure_pytest_files(CONFIG pytest.ini COPY validate.py conftest.py)
|
||||
|
||||
@@ -18,23 +19,34 @@ string(REPLACE "LD_PRELOAD=" "ROCPROF_PRELOAD=" PRELOAD_ENV
|
||||
set(rocdecode-tracing-env "${PRELOAD_ENV}")
|
||||
|
||||
set(ROCDECODE_VIDEO_FILE
|
||||
"${ROCM_PATH}/share/rocdecode/video/AMD_driving_virtual_20-H265.265")
|
||||
if(NOT EXISTS "${ROCDECODE_VIDEO_FILE}")
|
||||
"${rocDecode_ROOT_DIR}/share/rocdecode/video/AMD_driving_virtual_20-H265.265")
|
||||
if(TARGET rocdecode-demo AND NOT EXISTS "${ROCDECODE_VIDEO_FILE}")
|
||||
message(
|
||||
FATAL_ERROR
|
||||
"Unable to find video file for rocdecode tests: ${ROCDECODE_VIDEO_FILE}")
|
||||
endif()
|
||||
|
||||
add_test(
|
||||
NAME rocprofv3-test-rocdecode-tracing-execute
|
||||
COMMAND
|
||||
$<TARGET_FILE:rocprofiler-sdk::rocprofv3> --rocdecode-trace -d
|
||||
${CMAKE_CURRENT_BINARY_DIR}/%tag%-trace -o out --output-format json otf2 pftrace
|
||||
csv --log-level env -- $<TARGET_FILE:rocdecode> -i ${ROCDECODE_VIDEO_FILE})
|
||||
${CMAKE_CURRENT_BINARY_DIR}/%tag%-trace -o out --output-format json csv
|
||||
--log-level env --
|
||||
$<IF:$<TARGET_EXISTS:rocdecode-demo>,$<$<TARGET_EXISTS:rocdecode-demo>:$<TARGET_FILE:rocdecode-demo>>,rocdecode-demo>
|
||||
-i ${ROCDECODE_VIDEO_FILE})
|
||||
|
||||
set_tests_properties(
|
||||
rocprofv3-test-rocdecode-tracing-execute
|
||||
PROPERTIES TIMEOUT 45 LABELS "integration-tests" ENVIRONMENT
|
||||
"${rocdecode-tracing-env}" FAIL_REGULAR_EXPRESSION "threw an exception")
|
||||
PROPERTIES TIMEOUT
|
||||
45
|
||||
LABELS
|
||||
"integration-tests"
|
||||
ENVIRONMENT
|
||||
"${rocdecode-tracing-env}"
|
||||
FAIL_REGULAR_EXPRESSION
|
||||
"threw an exception"
|
||||
DISABLED
|
||||
$<NOT:$<TARGET_EXISTS:rocdecode-demo>>)
|
||||
|
||||
add_test(
|
||||
NAME rocprofv3-test-rocdecode-tracing-validate
|
||||
@@ -47,6 +59,13 @@ add_test(
|
||||
|
||||
set_tests_properties(
|
||||
rocprofv3-test-rocdecode-tracing-validate
|
||||
PROPERTIES TIMEOUT 45 LABELS "integration-tests" DEPENDS
|
||||
rocprofv3-test-rocdecode-tracing-execute FAIL_REGULAR_EXPRESSION
|
||||
"AssertionError")
|
||||
PROPERTIES TIMEOUT
|
||||
45
|
||||
LABELS
|
||||
"integration-tests"
|
||||
DEPENDS
|
||||
rocprofv3-test-rocdecode-tracing-execute
|
||||
FAIL_REGULAR_EXPRESSION
|
||||
"AssertionError"
|
||||
DISABLED
|
||||
$<NOT:$<TARGET_EXISTS:rocdecode-demo>>)
|
||||
|
||||
@@ -41,6 +41,8 @@ def pytest_addoption(parser):
|
||||
@pytest.fixture
|
||||
def json_data(request):
|
||||
filename = request.config.getoption("--json-input")
|
||||
if not os.path.isfile(filename):
|
||||
return pytest.skip("rocdecode tracing unavailable")
|
||||
with open(filename, "r") as inp:
|
||||
return dotdict(collapse_dict_list(json.load(inp)))
|
||||
|
||||
@@ -49,23 +51,30 @@ def json_data(request):
|
||||
def csv_data(request):
|
||||
filename = request.config.getoption("--csv-input")
|
||||
data = []
|
||||
with open(filename, "r") as inp:
|
||||
reader = csv.DictReader(inp)
|
||||
for row in reader:
|
||||
data.append(row)
|
||||
|
||||
if not os.path.isfile(filename):
|
||||
# The CSV file is not generated, because the dependency test
|
||||
# responsible to generate this file was skipped or failed.
|
||||
# Thus emit the message to skip this test as well.
|
||||
return pytest.skip("rocdecode tracing unavailable")
|
||||
else:
|
||||
with open(filename, "r") as inp:
|
||||
reader = csv.DictReader(inp)
|
||||
for row in reader:
|
||||
data.append(row)
|
||||
return data
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def otf2_data(request):
|
||||
filename = request.config.getoption("--otf2-input")
|
||||
if not os.path.exists(filename):
|
||||
raise FileExistsError(f"{filename} does not exist")
|
||||
if not os.path.isfile(filename):
|
||||
return pytest.skip("rocdecode tracing unavailable")
|
||||
return OTF2Reader(filename).read()[0]
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def pftrace_data(request):
|
||||
filename = request.config.getoption("--pftrace-input")
|
||||
if not os.path.isfile(filename):
|
||||
return pytest.skip("rocdecode tracing unavailable")
|
||||
return PerfettoReader(filename).read()[0]
|
||||
|
||||
@@ -32,6 +32,9 @@ def test_rocdeocde(json_data):
|
||||
buffer_records = data["buffer_records"]
|
||||
|
||||
rocdecode_data = buffer_records["rocdecode_api"]
|
||||
# If rocDecode tracing is not supported, end early
|
||||
if len(rocdecode_data) == 0:
|
||||
return pytest.skip("rocdecode tracing unavailable")
|
||||
|
||||
_, bf_op_names = get_operation(data, "ROCDECODE_API")
|
||||
|
||||
@@ -62,6 +65,9 @@ def test_rocdeocde(json_data):
|
||||
|
||||
|
||||
def test_csv_data(csv_data):
|
||||
# If rocDecode tracing is not supported, end early
|
||||
if len(csv_data) == 0:
|
||||
return pytest.skip("rocdecode tracing unavailable")
|
||||
assert len(csv_data) > 0, "Expected non-empty csv data"
|
||||
|
||||
api_calls = []
|
||||
@@ -116,20 +122,34 @@ def test_csv_data(csv_data):
|
||||
def test_perfetto_data(pftrace_data, json_data):
|
||||
import rocprofiler_sdk.tests.rocprofv3 as rocprofv3
|
||||
|
||||
# If rocDecode tracing is not supported, end early
|
||||
if (
|
||||
pftrace_data == None
|
||||
or len(json_data["rocprofiler-sdk-tool"]["buffer_records"]["rocdecode_api"]) == 0
|
||||
):
|
||||
return pytest.skip("rocdecode tracing unavailable")
|
||||
|
||||
rocprofv3.test_perfetto_data(
|
||||
pftrace_data,
|
||||
json_data,
|
||||
("hip", "hsa", "memory_allocation", "rocdecode_api"),
|
||||
("rocdecode_api",),
|
||||
)
|
||||
|
||||
|
||||
def test_otf2_data(otf2_data, json_data):
|
||||
import rocprofiler_sdk.tests.rocprofv3 as rocprofv3
|
||||
|
||||
# If rocDecode tracing is not supported, end early
|
||||
if (
|
||||
otf2_data == None
|
||||
or len(json_data["rocprofiler-sdk-tool"]["buffer_records"]["rocdecode_api"]) == 0
|
||||
):
|
||||
return pytest.skip("rocdecode tracing unavailable")
|
||||
|
||||
rocprofv3.test_otf2_data(
|
||||
otf2_data,
|
||||
json_data,
|
||||
("hip", "hsa", "memory_allocation", "rocdecode_api"),
|
||||
("rocdecode_api",),
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user