This repository was archived by the owner on Mar 28, 2023. It is now read-only.
forked from llvm/llvm-test-suite
-
Notifications
You must be signed in to change notification settings - Fork 130
[SYCL][XPTI] Enable XPTI and XPTI Framework E2E tests #458
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
d26781a
[SYCL][XPTI] Enable XPTI and XPTI Frameworks E2E tests
alexbatashev 3684efb
Merge remote-tracking branch 'upstream/intel' into xpti_tests
alexbatashev 3eedfa4
clang-format
alexbatashev 6f9223e
Address feedback
alexbatashev 1e5f8f3
Update SYCL/XPTI/basic_event_collection.cpp
alexbatashev c2d58b9
Merge branch 'intel' into xpti_tests
ab58469
fix
9b7519b
Merge remote-tracking branch 'upstream/intel' into xpti_tests
4f1fd32
update test
1c9938e
update codeowners
alexbatashev 5bb745c
minor fixes
ba8dadd
Merge branch 'xpti_tests' of github.com:alexbatashev/llvm-test-suite …
7c018cb
make tests device agnostic?
2606dbe
windows?
alexbatashev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
#include "xpti/xpti_trace_framework.hpp" | ||
|
||
#include <iostream> | ||
#include <mutex> | ||
#include <string_view> | ||
|
||
std::mutex GMutex; | ||
|
||
XPTI_CALLBACK_API void syclCallback(uint16_t, xpti::trace_event_data_t *, | ||
xpti::trace_event_data_t *, uint64_t, | ||
const void *); | ||
XPTI_CALLBACK_API void syclPiCallback(uint16_t, xpti::trace_event_data_t *, | ||
xpti::trace_event_data_t *, uint64_t, | ||
const void *); | ||
|
||
XPTI_CALLBACK_API void xptiTraceInit(unsigned int MajorVersion, | ||
unsigned int MinorVersion, | ||
const char *VersionStr, | ||
const char *StreamName) { | ||
std::cout << "xptiTraceInit: Stream Name = " << StreamName << "\n"; | ||
std::string_view NameView{StreamName}; | ||
|
||
if (NameView == "sycl.pi") { | ||
uint8_t StreamID = xptiRegisterStream(StreamName); | ||
xptiRegisterCallback( | ||
StreamID, | ||
static_cast<uint16_t>(xpti::trace_point_type_t::function_begin), | ||
syclPiCallback); | ||
xptiRegisterCallback( | ||
StreamID, | ||
static_cast<uint16_t>(xpti::trace_point_type_t::function_with_args_end), | ||
syclPiCallback); | ||
} | ||
if (NameView == "sycl") { | ||
uint8_t StreamID = xptiRegisterStream(StreamName); | ||
xptiRegisterCallback( | ||
StreamID, static_cast<uint16_t>(xpti::trace_point_type_t::graph_create), | ||
syclCallback); | ||
xptiRegisterCallback( | ||
StreamID, static_cast<uint16_t>(xpti::trace_point_type_t::node_create), | ||
syclCallback); | ||
xptiRegisterCallback( | ||
StreamID, static_cast<uint16_t>(xpti::trace_point_type_t::edge_create), | ||
syclCallback); | ||
xptiRegisterCallback( | ||
StreamID, static_cast<uint16_t>(xpti::trace_point_type_t::task_begin), | ||
syclCallback); | ||
xptiRegisterCallback( | ||
StreamID, static_cast<uint16_t>(xpti::trace_point_type_t::task_end), | ||
syclCallback); | ||
xptiRegisterCallback( | ||
StreamID, static_cast<uint16_t>(xpti::trace_point_type_t::signal), | ||
syclCallback); | ||
xptiRegisterCallback( | ||
StreamID, | ||
static_cast<uint16_t>(xpti::trace_point_type_t::barrier_begin), | ||
syclCallback); | ||
xptiRegisterCallback( | ||
StreamID, static_cast<uint16_t>(xpti::trace_point_type_t::barrier_end), | ||
syclCallback); | ||
xptiRegisterCallback( | ||
StreamID, static_cast<uint16_t>(xpti::trace_point_type_t::wait_begin), | ||
syclCallback); | ||
xptiRegisterCallback( | ||
StreamID, static_cast<uint16_t>(xpti::trace_point_type_t::wait_end), | ||
syclCallback); | ||
xptiRegisterCallback( | ||
StreamID, static_cast<uint16_t>(xpti::trace_point_type_t::signal), | ||
syclCallback); | ||
} | ||
} | ||
|
||
XPTI_CALLBACK_API void xptiTraceFinish(const char *streamName) { | ||
std::cout << "xptiTraceFinish: Stream Name = " << streamName << "\n"; | ||
} | ||
|
||
XPTI_CALLBACK_API void syclPiCallback(uint16_t TraceType, | ||
xpti::trace_event_data_t *, | ||
xpti::trace_event_data_t *, uint64_t, | ||
const void *UserData) { | ||
std::lock_guard Lock{GMutex}; | ||
auto Type = static_cast<xpti::trace_point_type_t>(TraceType); | ||
const char *funcName = static_cast<const char *>(UserData); | ||
if (Type == xpti::trace_point_type_t::function_begin) { | ||
std::cout << "PI Call Begin : "; | ||
} else if (Type == xpti::trace_point_type_t::function_end) { | ||
std::cout << "PI Call End : "; | ||
} | ||
std::cout << funcName << "\n"; | ||
} | ||
|
||
XPTI_CALLBACK_API void syclCallback(uint16_t TraceType, | ||
xpti::trace_event_data_t *, | ||
xpti::trace_event_data_t *Event, uint64_t, | ||
const void *UserData) { | ||
std::lock_guard Lock{GMutex}; | ||
auto Type = static_cast<xpti::trace_point_type_t>(TraceType); | ||
switch (Type) { | ||
case xpti::trace_point_type_t::graph_create: | ||
std::cout << "Graph create\n"; | ||
break; | ||
case xpti::trace_point_type_t::node_create: | ||
std::cout << "Node create\n"; | ||
break; | ||
case xpti::trace_point_type_t::edge_create: | ||
std::cout << "Edge create\n"; | ||
break; | ||
case xpti::trace_point_type_t::task_begin: | ||
std::cout << "Task begin\n"; | ||
break; | ||
case xpti::trace_point_type_t::task_end: | ||
std::cout << "Task end\n"; | ||
break; | ||
case xpti::trace_point_type_t::signal: | ||
std::cout << "Signal\n"; | ||
break; | ||
case xpti::trace_point_type_t::wait_begin: | ||
std::cout << "Wait begin\n"; | ||
break; | ||
case xpti::trace_point_type_t::wait_end: | ||
std::cout << "Wait end\n"; | ||
break; | ||
case xpti::trace_point_type_t::barrier_begin: | ||
std::cout << "Barrier begin\n"; | ||
break; | ||
case xpti::trace_point_type_t::barrier_end: | ||
std::cout << "Barrier end\n"; | ||
break; | ||
default: | ||
std::cout << "Unknown tracepoint\n"; | ||
} | ||
|
||
xpti::metadata_t *Metadata = xptiQueryMetadata(Event); | ||
for (auto &Item : *Metadata) { | ||
std::cout << " " << xptiLookupString(Item.first) << " : " | ||
<< xptiLookupString(Item.second) << "\n"; | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
// REQUIRES: xptifw, opencl | ||
// RUN: %clangxx %s -DXPTI_COLLECTOR -DXPTI_CALLBACK_API_EXPORTS %xptifw_lib %shared_lib %fPIC %cxx_std_optionc++17 -o %t_collector.dll | ||
// RUN: %clangxx -fsycl -fsycl-unnamed-lambda -fsycl-targets=%sycl_triple %s -o %t.out | ||
// RUN: env XPTI_TRACE_ENABLE=1 env XPTI_FRAMEWORK_DISPATCHER=%xptifw_dispatcher env XPTI_SUBSCRIBERS=%t_collector.dll env SYCL_DEVICE_FILTER=opencl %t.out | FileCheck %s 2>&1 | ||
|
||
#ifdef XPTI_COLLECTOR | ||
|
||
#include "Inputs/test_collector.cpp" | ||
|
||
#else | ||
|
||
#include <sycl/sycl.hpp> | ||
|
||
int main() { | ||
sycl::queue Q{sycl::default_selector{}}; | ||
|
||
auto Ptr = sycl::malloc_device<int>(1, Q); | ||
|
||
auto Evt1 = Q.single_task([=]() { Ptr[0] = 1; }); | ||
|
||
auto Evt2 = Q.submit([&](sycl::handler &CGH) { | ||
CGH.depends_on(Evt1); | ||
CGH.single_task([=]() { Ptr[0]++; }); | ||
}); | ||
|
||
Evt2.wait(); | ||
|
||
int Res = 0; | ||
Q.memcpy(&Res, Ptr, 1); | ||
Q.wait(); | ||
|
||
assert(Res == 2); | ||
|
||
return 0; | ||
} | ||
|
||
#endif | ||
|
||
// CHECK: xptiTraceInit: Stream Name = sycl | ||
// CHECK-NEXT: Graph create | ||
// CHECK-NEXT: xptiTraceInit: Stream Name = sycl.pi | ||
// CHECK-NEXT: xptiTraceInit: Stream Name = sycl.pi.debug | ||
// CHECK-NEXT: PI Call Begin : piPlatformsGet | ||
// CHECK-NEXT: PI Call Begin : piPlatformsGet | ||
// CHECK-NEXT: PI Call Begin : piDevicesGet | ||
// CHECK-NEXT: PI Call Begin : piDevicesGet | ||
// CHECK-NEXT: PI Call Begin : piDeviceGetInfo | ||
// CHECK-NEXT: PI Call Begin : piDeviceGetInfo | ||
// CHECK-NEXT: PI Call Begin : piDeviceGetInfo | ||
// CHECK-NEXT: PI Call Begin : piDeviceRetain | ||
// CHECK-NEXT: PI Call Begin : piDeviceGetInfo | ||
// CHECK-NEXT: PI Call Begin : piDeviceGetInfo | ||
// CHECK-NEXT: PI Call Begin : piPlatformGetInfo | ||
// CHECK-NEXT: PI Call Begin : piPlatformGetInfo | ||
// CHECK-NEXT: PI Call Begin : piDeviceRelease | ||
// CHECK: PI Call Begin : piContextCreate | ||
// CHECK-NEXT: PI Call Begin : piQueueCreate | ||
// CHECK-NEXT: PI Call Begin : piextUSMDeviceAlloc | ||
// CHECK-NEXT: PI Call Begin : piextDeviceSelectBinary | ||
// CHECK-NEXT: PI Call Begin : piDeviceGetInfo | ||
// CHECK: PI Call Begin : piKernelCreate | ||
// CHECK-NEXT: PI Call Begin : piKernelSetExecInfo | ||
// CHECK-NEXT: PI Call Begin : piextKernelSetArgPointer | ||
// CHECK-NEXT: PI Call Begin : piKernelGetGroupInfo | ||
// CHECK-NEXT: PI Call Begin : piEnqueueKernelLaunch | ||
// CHECK-NEXT: Node create | ||
// CHECK-NEXT: sym_line_no : 21 | ||
// CHECK-NEXT: sym_source_file_name : {{.*}} | ||
// CHECK-NEXT: sym_function_name : typeinfo name for main::{lambda(cl::sycl::handler&)#1}::operator()(cl::sycl::handler&) const::{lambda()#1} | ||
// CHECK-NEXT: from_source : false | ||
// CHECK-NEXT: kernel_name : typeinfo name for main::{lambda(cl::sycl::handler&)#1}::operator()(cl::sycl::handler&) const::{lambda()#1} | ||
// CHECK-NEXT: sycl_device : {{.*}} | ||
// CHECK-NEXT: Node create | ||
// CHECK-NEXT: kernel_name : virtual_node[{{.*}}] | ||
// CHECK-NEXT: Edge create | ||
// CHECK-NEXT: event : Event[{{.*}}] | ||
// CHECK-NEXT: Task begin | ||
// CHECK-NEXT: sym_line_no : 21 | ||
// CHECK-NEXT: sym_source_file_name : {{.*}} | ||
// CHECK-NEXT: sym_function_name : typeinfo name for main::{lambda(cl::sycl::handler&)#1}::operator()(cl::sycl::handler&) const::{lambda()#1} | ||
// CHECK-NEXT: from_source : false | ||
// CHECK-NEXT: kernel_name : typeinfo name for main::{lambda(cl::sycl::handler&)#1}::operator()(cl::sycl::handler&) const::{lambda()#1} | ||
// CHECK-NEXT: sycl_device : {{.*}} | ||
// CHECK-NEXT: PI Call Begin : piKernelCreate | ||
// CHECK-NEXT: PI Call Begin : piKernelSetExecInfo | ||
// CHECK-NEXT: PI Call Begin : piextKernelSetArgPointer | ||
// CHECK-NEXT: PI Call Begin : piKernelGetGroupInfo | ||
// CHECK-NEXT: PI Call Begin : piEnqueueKernelLaunch | ||
// CHECK-NEXT: Signal | ||
// CHECK-NEXT: sym_line_no : 21 | ||
// CHECK-NEXT: sym_source_file_name : {{.*}} | ||
// CHECK-NEXT: sym_function_name : typeinfo name for main::{lambda(cl::sycl::handler&)#1}::operator()(cl::sycl::handler&) const::{lambda()#1} | ||
// CHECK-NEXT: from_source : false | ||
// CHECK-NEXT: kernel_name : typeinfo name for main::{lambda(cl::sycl::handler&)#1}::operator()(cl::sycl::handler&) const::{lambda()#1} | ||
// CHECK-NEXT: sycl_device : {{.*}} | ||
// CHECK-NEXT: Task end | ||
// CHECK-NEXT: sym_line_no : 21 | ||
// CHECK-NEXT: sym_source_file_name : {{.*}} | ||
// CHECK-NEXT: sym_function_name : typeinfo name for main::{lambda(cl::sycl::handler&)#1}::operator()(cl::sycl::handler&) const::{lambda()#1} | ||
// CHECK-NEXT: from_source : false | ||
// CHECK-NEXT: kernel_name : typeinfo name for main::{lambda(cl::sycl::handler&)#1}::operator()(cl::sycl::handler&) const::{lambda()#1} | ||
// CHECK-NEXT: sycl_device : {{.*}} | ||
// CHECK-NEXT: Wait begin | ||
// CHECK-NEXT: PI Call Begin : piEventsWait | ||
// CHECK-NEXT: Wait end | ||
// CHECK-NEXT: PI Call Begin : piextUSMEnqueueMemcpy | ||
// CHECK-NEXT: PI Call Begin : piEventRelease | ||
// CHECK-NEXT: Wait begin | ||
// CHECK-NEXT: sycl_device : {{.*}} | ||
// CHECK-NEXT: PI Call Begin : piQueueFinish | ||
// CHECK-NEXT: Wait end | ||
// CHECK-NEXT: sycl_device : {{.*}} | ||
// CHECK-NEXT: PI Call Begin : piEventRelease | ||
// CHECK-NEXT: PI Call Begin : piEventRelease | ||
// CHECK-NEXT: PI Call Begin : piQueueRelease | ||
// CHECK-NEXT: PI Call Begin : piContextRelease | ||
// CHECK-NEXT: PI Call Begin : piKernelRelease | ||
// CHECK-NEXT: PI Call Begin : piKernelRelease | ||
// CHECK-NEXT: PI Call Begin : piProgramRelease | ||
// CHECK-NEXT: PI Call Begin : piDeviceRelease | ||
// CHECK-NEXT: PI Call Begin : piTearDown |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.