Skip to content

Commit 7d1361a

Browse files
authored
[SYCL] Remove fallback profiling (#18303)
Remove the fallback queue profiling. This seems no longer relevant, and if it is, should be handled inside UR anyway. --------- Signed-off-by: James Brodman <james.brodman@intel.com>
1 parent 8614a89 commit 7d1361a

13 files changed

+111
-350
lines changed

sycl/source/detail/device_global_map_entry.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,7 @@ DeviceGlobalUSMMem &DeviceGlobalMapEntry::getOrAllocateDeviceGlobalUSM(
7979
reinterpret_cast<uintptr_t>(MDeviceGlobalPtr) +
8080
sizeof(MDeviceGlobalPtr)),
8181
QueueImpl, MDeviceGlobalTSize, NewAlloc.MPtr,
82-
std::vector<ur_event_handle_t>{}, &InitEvent,
83-
nullptr);
82+
std::vector<ur_event_handle_t>{}, &InitEvent);
8483
NewAlloc.MInitEvent = InitEvent;
8584
}
8685

sycl/source/detail/device_impl.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -881,14 +881,6 @@ uint64_t device_impl::getCurrentDeviceTime() {
881881
return MDeviceHostBaseTime.first + Diff;
882882
}
883883

884-
bool device_impl::isGetDeviceAndHostTimerSupported() {
885-
const auto &Adapter = getAdapter();
886-
uint64_t DeviceTime = 0, HostTime = 0;
887-
auto Result = Adapter->call_nocheck<UrApiKind::urDeviceGetGlobalTimestamps>(
888-
MDevice, &DeviceTime, &HostTime);
889-
return Result != UR_RESULT_ERROR_INVALID_OPERATION;
890-
}
891-
892884
bool device_impl::extOneapiCanBuild(
893885
ext::oneapi::experimental::source_language Language) {
894886
try {

sycl/source/detail/device_impl.hpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -280,10 +280,6 @@ class device_impl : public std::enable_shared_from_this<device_impl> {
280280
/// @throw sycl::feature_not_supported if feature is not supported on device
281281
uint64_t getCurrentDeviceTime();
282282

283-
/// Check clGetDeviceAndHostTimer is available for fallback profiling
284-
285-
bool isGetDeviceAndHostTimerSupported();
286-
287283
/// Get the backend of this device
288284
backend getBackend() const { return MPlatform->getBackend(); }
289285

sycl/source/detail/event_impl.cpp

Lines changed: 21 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,7 @@ event_impl::event_impl(ur_event_handle_t Event, const context &SyclContext)
160160
}
161161

162162
event_impl::event_impl(const QueueImplPtr &Queue)
163-
: MQueue{Queue}, MIsProfilingEnabled{!Queue || Queue->MIsProfilingEnabled},
164-
MFallbackProfiling{MIsProfilingEnabled && Queue &&
165-
Queue->isProfilingFallback()} {
163+
: MQueue{Queue}, MIsProfilingEnabled{!Queue || Queue->MIsProfilingEnabled} {
166164
if (Queue)
167165
this->setContextImpl(Queue->getContextImplPtr());
168166
else {
@@ -181,7 +179,6 @@ event_impl::event_impl(const QueueImplPtr &Queue)
181179
void event_impl::setQueue(const QueueImplPtr &Queue) {
182180
MQueue = Queue;
183181
MIsProfilingEnabled = Queue->MIsProfilingEnabled;
184-
MFallbackProfiling = MIsProfilingEnabled && Queue->isProfilingFallback();
185182

186183
// TODO After setting the queue, the event is no longer default
187184
// constructed. Consider a design change which would allow
@@ -348,17 +345,8 @@ event_impl::get_profiling_info<info::event_profiling::command_start>() {
348345
if (!MIsHostEvent) {
349346
auto Handle = getHandle();
350347
if (Handle) {
351-
auto StartTime =
352-
get_event_profiling_info<info::event_profiling::command_start>(
353-
Handle, this->getAdapter());
354-
if (!MFallbackProfiling) {
355-
return StartTime;
356-
} else {
357-
auto DeviceBaseTime =
358-
get_event_profiling_info<info::event_profiling::command_submit>(
359-
Handle, this->getAdapter());
360-
return MHostBaseTime - DeviceBaseTime + StartTime;
361-
}
348+
return get_event_profiling_info<info::event_profiling::command_start>(
349+
Handle, this->getAdapter());
362350
}
363351
return 0;
364352
}
@@ -376,17 +364,8 @@ uint64_t event_impl::get_profiling_info<info::event_profiling::command_end>() {
376364
if (!MIsHostEvent) {
377365
auto Handle = this->getHandle();
378366
if (Handle) {
379-
auto EndTime =
380-
get_event_profiling_info<info::event_profiling::command_end>(
381-
Handle, this->getAdapter());
382-
if (!MFallbackProfiling) {
383-
return EndTime;
384-
} else {
385-
auto DeviceBaseTime =
386-
get_event_profiling_info<info::event_profiling::command_submit>(
387-
Handle, this->getAdapter());
388-
return MHostBaseTime - DeviceBaseTime + EndTime;
389-
}
367+
return get_event_profiling_info<info::event_profiling::command_end>(
368+
Handle, this->getAdapter());
390369
}
391370
return 0;
392371
}
@@ -587,40 +566,27 @@ void event_impl::cleanDepEventsThroughOneLevel() {
587566
void event_impl::setSubmissionTime() {
588567
if (!MIsProfilingEnabled && !MProfilingTagEvent)
589568
return;
590-
if (!MFallbackProfiling) {
591-
if (QueueImplPtr Queue = MQueue.lock()) {
592-
try {
593-
MSubmitTime = Queue->getDeviceImpl().getCurrentDeviceTime();
594-
} catch (sycl::exception &e) {
595-
if (e.code() == sycl::errc::feature_not_supported)
596-
throw sycl::exception(
597-
make_error_code(errc::profiling),
598-
std::string("Unable to get command group submission time: ") +
599-
e.what());
600-
std::rethrow_exception(std::current_exception());
601-
}
602-
} else {
603-
// Returning host time
604-
using namespace std::chrono;
605-
MSubmitTime =
606-
duration_cast<nanoseconds>(steady_clock::now().time_since_epoch())
607-
.count();
569+
570+
if (QueueImplPtr Queue = MQueue.lock()) {
571+
try {
572+
MSubmitTime = Queue->getDeviceImpl().getCurrentDeviceTime();
573+
} catch (sycl::exception &e) {
574+
if (e.code() == sycl::errc::feature_not_supported)
575+
throw sycl::exception(
576+
make_error_code(errc::profiling),
577+
std::string("Unable to get command group submission time: ") +
578+
e.what());
579+
std::rethrow_exception(std::current_exception());
608580
}
609581
} else {
610-
// Capture the host timestamp for a return value of function call
611-
// <info::event_profiling::command_submit>. See MFallbackProfiling
612-
MSubmitTime = getTimestamp();
582+
// Returning host time
583+
using namespace std::chrono;
584+
MSubmitTime =
585+
duration_cast<nanoseconds>(steady_clock::now().time_since_epoch())
586+
.count();
613587
}
614588
}
615589

616-
void event_impl::setHostEnqueueTime() {
617-
if (!MIsProfilingEnabled || !MFallbackProfiling)
618-
return;
619-
// Capture a host timestamp to use normalize profiling time in
620-
// <command_start> and <command_end>. See MFallbackProfiling
621-
MHostBaseTime = getTimestamp();
622-
}
623-
624590
uint64_t event_impl::getSubmissionTime() { return MSubmitTime; }
625591

626592
bool event_impl::isCompleted() {

sycl/source/detail/event_impl.hpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -255,10 +255,6 @@ class event_impl {
255255
/// submission time for the command associated with this event.
256256
void setSubmissionTime();
257257

258-
/// Calling this function to capture the host timestamp to use
259-
/// profiling base time. See MFallbackProfiling
260-
void setHostEnqueueTime();
261-
262258
/// @return Submission time for command associated with this event
263259
uint64_t getSubmissionTime();
264260

@@ -365,13 +361,11 @@ class event_impl {
365361
std::atomic<ur_event_handle_t> MEvent = nullptr;
366362
// Stores submission time of command associated with event
367363
uint64_t MSubmitTime = 0;
368-
uint64_t MHostBaseTime = 0;
369364
ContextImplPtr MContext;
370365
std::unique_ptr<HostProfilingInfo> MHostProfilingInfo;
371366
void *MCommand = nullptr;
372367
std::weak_ptr<queue_impl> MQueue;
373368
bool MIsProfilingEnabled = false;
374-
bool MFallbackProfiling = false;
375369

376370
std::weak_ptr<queue_impl> MWorkerQueue;
377371
std::weak_ptr<queue_impl> MSubmittedQueue;

sycl/source/detail/graph_impl.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1043,7 +1043,6 @@ exec_graph_impl::enqueue(const std::shared_ptr<sycl::detail::queue_impl> &Queue,
10431043
// enqueue it directly
10441044
if (CGData.MRequirements.empty() && CGData.MEvents.empty()) {
10451045
NewEvent->setSubmissionTime();
1046-
NewEvent->setHostEnqueueTime();
10471046
ur_result_t Res =
10481047
Queue->getAdapter()
10491048
->call_nocheck<

0 commit comments

Comments
 (0)