Skip to content

Commit cece82e

Browse files
authored
[XPTI][Framework] Reference implementation of the Xpti framework to be used with instrumentation in SYCL (#1557)
+ Implementation of the specification in llvm/xpti + Documentation on the API and the architecture of the framework + Unit tests and additional semantic and performance tests + Sample collector (subscriber) to attach to an instrumented application and print out the trace data being received + The framework is fully enabled to use TBB or the standard library containers + The default build will use standard library containers in the implementation in order to remove the explicit dependency on TBB + Tests that use TBB for multi-threaded tests are disabled by default + TBB can be enabled with the soft option -DXPTI_ENABLE_TBB=ON Signed-off-by: Vasanth Tovinkere <vasanth.tovinkere@intel.com>
1 parent d8eb099 commit cece82e

24 files changed

+5709
-0
lines changed

xptifw/.gitignore

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
CMakeCache.txt
2+
CMakeFiles/
3+
Makefile
4+
basic_test/CMakeFiles/
5+
basic_test/Makefile
6+
basic_test/cmake_install.cmake
7+
cmake_install.cmake
8+
lib/
9+
samples/basic_collector/CMakeFiles/
10+
samples/basic_collector/Makefile
11+
samples/basic_collector/cmake_install.cmake
12+
samples/basic_collector/xpti_timers.hpp
13+
src/CMakeFiles/
14+
src/Makefile
15+
src/cmake_install.cmake
16+
unit_test/CMakeFiles/
17+
unit_test/Makefile
18+
unit_test/cmake_install.cmake
19+
unit_test/googletest-build/
20+
unit_test/googletest-download/
21+
unit_test/googletest-src/
22+

xptifw/CMakeLists.txt

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
cmake_minimum_required(VERSION 2.8.9)
2+
3+
set(XPTI_VERSION 0.4.1)
4+
set(XPTIFW_DIR ${CMAKE_CURRENT_LIST_DIR})
5+
# The XPTI framework requires the includes from
6+
# the proxy implementation of XPTI
7+
set(XPTI_DIR ${CMAKE_CURRENT_LIST_DIR}/../xpti)
8+
9+
# Create a soft option for enabling the use of TBB
10+
option(XPTI_ENABLE_TBB "Enable TBB in the framework" OFF)
11+
12+
if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
13+
message(STATUS "No build type selected, default to Release")
14+
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Build type (default Release)" FORCE)
15+
endif()
16+
17+
project (xptifw)
18+
19+
set(CMAKE_BINARY_DIR ${CMAKE_SOURCE_DIR}/lib/${CMAKE_BUILD_TYPE})
20+
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR})
21+
set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR})
22+
23+
include_directories(${CMAKE_SOURCE_DIR}/include ${XPTI_DIR}/include)
24+
add_subdirectory(src)
25+
add_subdirectory(unit_test)
26+
add_subdirectory(samples/basic_collector)
27+
# The tests in basic_test are written using TBB, so these tests are enabled
28+
# only if TBB has been enabled.
29+
if (XPTI_ENABLE_TBB)
30+
add_subdirectory(basic_test)
31+
endif()

xptifw/CMakeLists.txt.in

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
cmake_minimum_required(VERSION 2.8.2)
2+
3+
project(googletest-download NONE)
4+
5+
include(ExternalProject)
6+
ExternalProject_Add(googletest
7+
GIT_REPOSITORY https://github.com/google/googletest.git
8+
GIT_TAG master
9+
SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/googletest-src"
10+
BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/googletest-build"
11+
CONFIGURE_COMMAND ""
12+
BUILD_COMMAND ""
13+
INSTALL_COMMAND ""
14+
TEST_COMMAND ""
15+
)

xptifw/README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# XPTI Framework Library
2+
3+
Implementation of the instrumentation framework library to support
4+
instrumentation of arbitrary regions of code. This implementation requires the
5+
specification header files used by the proxy library in `xpti/`. This
6+
library is not necessary for building the SYCL runtime library and only required
7+
to build tools that extract the traces from instrumented code.
8+
9+
To see the implementation of the basic collector and how it can be attached to
10+
an application that has been instrumented with XPTI, see [samples/basic_collector/README.md](samples/basic_collector/README.md).
11+
12+
To see how to determine the cost of the APIs, see the tests under [basic_test/](basic_test/README.md).
13+
14+
Unit tests are available under [unit_test](unit_test/README.md).
15+
16+
To see the complete documentation on XPTI framework API, please see [XPTI Framework library documentation](doc/XPTI_Framework.md)

xptifw/basic_test/CMakeLists.txt

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
cmake_minimum_required(VERSION 2.8.9)
2+
project (run_test)
3+
4+
file(GLOB SOURCES *.cpp *.hpp)
5+
include_directories(${XPTIFW_DIR}/include)
6+
include_directories(${XPTI_DIR}/include)
7+
8+
remove_definitions(-DXPTI_STATIC_LIBRARY)
9+
add_definitions(-DXPTI_API_EXPORTS -g -O3)
10+
add_executable(run_test ${SOURCES})
11+
add_dependencies(run_test xptifw)
12+
target_link_libraries(run_test PRIVATE xptifw)
13+
if(UNIX)
14+
target_link_libraries(run_test PRIVATE dl)
15+
endif()
16+
17+
if (XPTI_ENABLE_TBB)
18+
target_link_libraries(run_test PRIVATE tbb)
19+
endif()
20+
21+
# Set the location of the library installation
22+
install(TARGETS run_test DESTINATION ${CMAKE_BINARY_DIR})

xptifw/basic_test/README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Basic tests
2+
3+
In order to capture the cost of various API calls in the framework and test the
4+
correctness of the API, a set of basic tests have been created. They primarily
5+
fall under two categories:
6+
7+
1. Semantic tests: These tests perform correctness checks on the API call to
8+
ensure the right data is being retrieved. The semantic tests are categorized
9+
into string table tests, trace point tests and notification tests.
10+
11+
2. Performance tests: These test attempt to capture the average cost of various
12+
operations that are a part of creating trace points in applications. The tests
13+
are categorized into data structure tests and instrumentation tests.
14+
15+
For more detail on the framework, the tests that are provided and their usage,
16+
please consult the [XPTI Framework library documentation](doc/XPTI_Framework.md).

0 commit comments

Comments
 (0)