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

[XPTI][Framework] Reference implementation of the Xpti framework to be used with instrumentation in SYCL #1557

Merged
merged 18 commits into from
Apr 23, 2020

Conversation

tovinkere
Copy link
Contributor

This pull-request is for the reference implementation of the XPTI framework so users can pull the instrumentation data enabled in the SYCL runtime.

  1. The build environment for XPTIFW is standalone with unit tests and examples
  2. When the merge is completed, a subsequent patch will be applied to enable the XPTIFW builds with the SYCL Cmake
  3. The default build of XPTIFW uses standard containers and one can specify _DXPTI_ENABLE_TBB=ON to build a TBB based variant
  4. The documentation in xptifw/doc reflects the current state of the framework.

+ 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

Signed-off-by: Vasanth Tovinkere <vasanth.tovinkere@intel.com>
Signed-off-by: Vasanth Tovinkere <vasanth.tovinkere@intel.com>
Signed-off-by: Vasanth Tovinkere <vasanth.tovinkere@intel.com>
+ Minor formatting changes and spelling fixes
+ Implementation of std container based framework that
  doesn't depend on TBB

Signed-off-by: Vasanth Tovinkere <vasanth.tovinkere@intel.com>
Signed-off-by: Vasanth Tovinkere <vasanth.tovinkere@intel.com>
+ 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>
Signed-off-by: Vasanth Tovinkere <vasanth.tovinkere@intel.com>
Signed-off-by: Vasanth Tovinkere <vasanth.tovinkere@intel.com>
Signed-off-by: Vasanth Tovinkere <vasanth.tovinkere@intel.com>
Signed-off-by: Vasanth Tovinkere <vasanth.tovinkere@intel.com>
Signed-off-by: Vasanth Tovinkere <vasanth.tovinkere@intel.com>
Signed-off-by: Vasanth Tovinkere <vasanth.tovinkere@intel.com>
Signed-off-by: Vasanth Tovinkere <vasanth.tovinkere@intel.com>
Signed-off-by: Vasanth Tovinkere <vasanth.tovinkere@intel.com>
Signed-off-by: Vasanth Tovinkere <vasanth.tovinkere@intel.com>
@tovinkere tovinkere requested a review from bader as a code owner April 20, 2020 18:15
@tovinkere tovinkere requested a review from alexbatashev April 20, 2020 18:16
@tovinkere tovinkere changed the title [XPTI][Framework] Reference implementation of the Xpti framework to be used with instrumentaiton in SYCL [XPTI][Framework] Reference implementation of the Xpti framework to be used with instrumentation in SYCL Apr 20, 2020
@bader
Copy link
Contributor

bader commented Apr 21, 2020

LGTM, but I'd like @alexbatashev to approve before merging.

alexbatashev
alexbatashev previously approved these changes Apr 21, 2020
Copy link
Contributor

@alexbatashev alexbatashev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Comments are stylistic, I'm ok to fix them as a separate PR.

xptifw/basic_test/cl_processor.hpp Outdated Show resolved Hide resolved
xptifw/include/xpti_int64_hash_table.hpp Show resolved Hide resolved
xptifw/include/xpti_string_table.hpp Show resolved Hide resolved
+ Coding conventions mismatch

Signed-off-by: Vasanth Tovinkere <vasanth.tovinkere@intel.com>
Signed-off-by: Vasanth Tovinkere <vasanth.tovinkere@intel.com>
alexbatashev
alexbatashev previously approved these changes Apr 21, 2020
Copy link
Contributor

@keryell keryell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am impressed by the testing infrastructure!

xptifw/basic_test/cl_processor.hpp Outdated Show resolved Hide resolved
xptifw/basic_test/cl_processor.hpp Outdated Show resolved Hide resolved
xptifw/include/xpti_string_table.hpp Outdated Show resolved Hide resolved
xptifw/include/xpti_int64_hash_table.hpp Show resolved Hide resolved
xptifw/basic_test/cl_processor.hpp Outdated Show resolved Hide resolved
plugin_data_t queryPlugin(xpti_plugin_handle_t Handle) {
plugin_data_t PData;
#ifdef XPTI_USE_TBB
tbb::spin_mutex::scoped_lock MyLock(MMutex);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps you could suggest the TBB team to provide a standard mutex API?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@keryell For the critical section sizes here, the spin locks give better performance with increasing number of threads - as in the events/sec remain relatively constant whereas the std::mutex tends to drop off when threads are > 4ish. I am not sure if there are use cases that enqueue kernels from 10s of threads, but it is nice to have an option to handle that nicely, if required. This is the reason why std containers are the default and if required, users can enable TBB.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah sure. I agree with that. I was really talking about the API, not the mutex implementation details or semantics.
For example it would be nice to use it with:

std::unique_lock<tbb::spin_mutex> MyLock(MMutex);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I see it now - I'll definitely suggest this to the team.

xptifw/src/xpti_trace_framework.cpp Outdated Show resolved Hide resolved
xptifw/src/xpti_trace_framework.cpp Outdated Show resolved Hide resolved
xptifw/src/xpti_trace_framework.cpp Outdated Show resolved Hide resolved
printf("Notification statistics:\n");
for (auto &s : MStats) {
printf("%19s: [%llu] \n",
stringify_trace_type((xpti_trace_point_type_t)s.first).c_str(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At least with std::cout there is no need to go back to a C string :-)

Copy link
Contributor Author

@tovinkere tovinkere Apr 22, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:-) Agreed, but formatting strings in iostream is too verbose - and printfs are used only when someone enables usage statistics

Signed-off-by: Vasanth Tovinkere <vasanth.tovinkere@intel.com>
@tovinkere
Copy link
Contributor Author

I am impressed by the testing infrastructure!

Thank you Ronan. I appreciate the fact that you noticed it :-) Considering that we are instrumenting the SYCL runtime using this framework, it is only fair that the tests observe due diligence as well. It also gives us a good handle on how many events we can service when trying to keep the overheads low.

@tovinkere
Copy link
Contributor Author

LGTM, but I'd like @alexbatashev to approve before merging.

@bader I believe @alexbatashev had approved it but my patch to address feedback from @keryell appears to have dismissed it.

@alexbatashev and @keryell - Any objections? If not, I'd like this to be merged sooner than later. Thanks!

@bader bader merged commit cece82e into intel:sycl Apr 23, 2020
alexbatashev pushed a commit to alexbatashev/llvm that referenced this pull request Apr 26, 2020
…_docs

* origin/sycl:
  [XPTI][Framework] Reference implementation of the Xpti framework to be used with instrumentation in SYCL (intel#1557)
  [SYCL] Initial ABI checks implementation (intel#1528)
  [SYCL] Support connection with multiple plugins (intel#1490)
  [SYCL] Add a new header file with the reduction class definition (intel#1558)
  [SYCL] Add test for SYCL kernels with accessor and spec constant (intel#1536)
alexbatashev pushed a commit to alexbatashev/llvm that referenced this pull request Apr 29, 2020
…versioning

* origin/sycl:
  [XPTI][Framework] Reference implementation of the Xpti framework to be used with instrumentation in SYCL (intel#1557)
  [SYCL] Initial ABI checks implementation (intel#1528)
  [SYCL] Support connection with multiple plugins (intel#1490)
  [SYCL] Add a new header file with the reduction class definition (intel#1558)
  [SYCL] Add test for SYCL kernels with accessor and spec constant (intel#1536)
  [SYCL][CUDA] Move interop tests (intel#1570)
  [Driver][SYCL] Remove COFF object format designator for Windows device compiles (intel#1574)
  [SYCL] Fix conflicting visibility attributes (intel#1571)
  [SYCL][DOC] Update the SYCL Runtime Interface document with design details (intel#680)
  [SYCL] Improve image accessors support on a host device (intel#1502)
  [SYCL] Make queue's non-USM event ownership temporary (intel#1561)
  [SYCL] Added support of rounding modes for non-host devices (intel#1463)
  [SYCL] SemaSYCL significant refactoring (intel#1517)
  [SYCL] Support 0-dim accessor in handler::copy(accessor, accessor) (intel#1551)
@tovinkere tovinkere deleted the xpti_framework branch April 19, 2024 20:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants