C compatibility for public headers (#566)
* C compatibility for public headers
- add tests/tools/c-tool.c
- builds a tool (which does nothing) with C language
- ensures that tool can be compiled in C
- add tests/c-tool/CMakeLists.txt
- ensures that tool library build from C is a valid tool
- rocprofiler_counter_info_v0_t is_derived is int instead of bool
- C does not have bool unless <stdbool.h> is included
- add `include/rocprofiler-sdk/hsa/api_trace_version.h
- handles providing HSA_*_TABLE_(MAJOR|STEP)_VERSION values if compiled from C
- cmake define in version.h.in for ROCPROFILER_HSA_*_TABLE_(MAJOR|STEP)_VERSION
- HSA table versions compiled with
- use rocprofiler_(hsa|hip|marker)_api_no_args struct to handle incompatibility b/t empty structs in C vs. C++ (size of 0 vs. size of 1)
- extern "C" in include/rocprofiler-sdk/{hsa,hip,marker}/api_args.h
- fixed spelling error: derrived -> derived
- scope YY_NO_INPUT compile definition to lib/rocprofiler-sdk/counters/parser/*
* Revert CDash dashboard
This commit is contained in:
committed by
GitHub
parent
31dcfabe23
commit
a1267e1fd2
@@ -176,8 +176,6 @@ if(ROCPROFILER_UNSAFE_NO_VERSION_CHECK)
|
||||
INTERFACE ROCPROFILER_UNSAFE_NO_VERSION_CHECK)
|
||||
endif()
|
||||
|
||||
rocprofiler_target_compile_definitions(rocprofiler-build-flags INTERFACE YY_NO_INPUT)
|
||||
|
||||
# ----------------------------------------------------------------------------------------#
|
||||
# user customization
|
||||
#
|
||||
|
||||
@@ -138,6 +138,8 @@ target_link_libraries(rocprofiler-hsa-runtime INTERFACE hsa-runtime64::hsa-runti
|
||||
rocprofiler_config_nolink_target(rocprofiler-hsa-runtime-nolink
|
||||
hsa-runtime64::hsa-runtime64)
|
||||
|
||||
rocprofiler_parse_hsa_api_table_versions(rocprofiler-hsa-runtime-nolink)
|
||||
|
||||
# ----------------------------------------------------------------------------------------#
|
||||
#
|
||||
# amd comgr
|
||||
|
||||
@@ -945,4 +945,57 @@ function(COMPUTE_POW2_CEIL _OUTPUT _VALUE)
|
||||
|
||||
endfunction()
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Parses headers in hsa/hsa_api_trace*.h for API table version numbers
|
||||
#
|
||||
function(rocprofiler_parse_hsa_api_table_versions _TARGET)
|
||||
get_target_property(HSA_API_TRACE_HEADER_PATH ${_TARGET}
|
||||
INTERFACE_SYSTEM_INCLUDE_DIRECTORIES)
|
||||
|
||||
if(HSA_API_TRACE_HEADER AND NOT EXISTS "${HSA_API_TRACE_HEADER}")
|
||||
unset(HSA_API_TRACE_HEADER CACHE)
|
||||
endif()
|
||||
|
||||
find_file(
|
||||
HSA_API_TRACE_HEADER
|
||||
NAMES hsa_api_trace_version.h hsa_api_trace.h
|
||||
HINTS ${HSA_API_TRACE_HEADER_PATH}
|
||||
PATHS ${HSA_API_TRACE_HEADER_PATH}
|
||||
PATH_SUFFIXES hsa
|
||||
NO_DEFAULT_PATH)
|
||||
|
||||
if(EXISTS "${HSA_API_TRACE_HEADER}")
|
||||
file(READ "${HSA_API_TRACE_HEADER}" HSA_API_TRACE_HEADER_CONTENTS)
|
||||
string(REPLACE "\n" ";" HSA_API_TRACE_HEADER_CONTENTS
|
||||
"${HSA_API_TRACE_HEADER_CONTENTS}")
|
||||
|
||||
foreach(_LINE ${HSA_API_TRACE_HEADER_CONTENTS})
|
||||
if("${_LINE}" MATCHES ".*define HSA_.*_(MAJOR|STEP)_VERSION .*")
|
||||
# message(STATUS "LINE: ${_LINE}")
|
||||
string(
|
||||
REGEX
|
||||
REPLACE
|
||||
"#[ ]*define HSA_([A-Z_]*)API_TABLE_(MAJOR|STEP)_VERSION [ ]*(0x[0-9A-Fa-f]+)"
|
||||
"HSA_\\1API_TABLE_\\2_VERSION"
|
||||
_VAR
|
||||
"${_LINE}")
|
||||
string(
|
||||
REGEX
|
||||
REPLACE
|
||||
"#[ ]*define HSA_([A-Z_]*)API_TABLE_(MAJOR|STEP)_VERSION [ ]*(0x[0-9A-Fa-f]+)"
|
||||
"\\3"
|
||||
_VAL
|
||||
"${_LINE}")
|
||||
|
||||
# used with cmakedefine in source/include/rocprofiler-sdk/version.h.in
|
||||
if(_VAR AND _VAL)
|
||||
set(ROCPROFILER_${_VAR}
|
||||
"${_VAL}"
|
||||
PARENT_SCOPE)
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
cmake_policy(POP)
|
||||
|
||||
Reference in New Issue
Block a user