Skip to content

Commit 1581306

Browse files
authored
[PTISDK] fixes for iso metrics test failure with oneapi_2025_2 (#582)
1 parent 6249caf commit 1581306

File tree

2 files changed

+22
-10
lines changed

2 files changed

+22
-10
lines changed

sdk/samples/metrics_iso3dfd_dpcpp/src/iso3dfd_kernels.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -365,12 +365,12 @@ bool Iso3dfdDevice(sycl::queue &q, float *ptr_next, float *ptr_prev,
365365
if (i == 0 || i == (nIterations / 2)) {
366366
if (i == 0) { // Collect a different group for the first half of the iterations
367367
// TIME metric groups
368-
group_name = /*"GpuOffload"*/ "ComputeBasic" /* "MemProfile" "DataportProfile" "L1ProfileReads" "L1ProfileSlmBankConflicts" "L1ProfileWrites" */;
368+
group_name = "ComputeBasic"; //"GpuOffload" "ComputeBasic" "MemProfile" "DataportProfile" "L1ProfileReads" "L1ProfileSlmBankConflicts" "L1ProfileWrites"
369369

370370
// TRACE metric groups
371371
//group_name = "tpcs_utilization_and_bw" /* "nic_stms" "dcore0_bmons_bw"*/;
372372
group_type = /*PTI_METRIC_GROUP_TYPE_TRACE_BASED*/ PTI_METRIC_GROUP_TYPE_TIME_BASED;
373-
} else { // collect a different metric group for the second hald of the iterations
373+
} else { // collect a different metric group for the second half of the iterations
374374
// Stop the collection for the first half of the iterations
375375
if (MetricsProfiler::MetricsProfilerInstance().StopCollection() != true) {
376376
exit(-1);
@@ -388,8 +388,10 @@ bool Iso3dfdDevice(sycl::queue &q, float *ptr_next, float *ptr_prev,
388388
DeleteFile(lib_filename);
389389
DeleteFile(sample_filename);
390390

391-
// TIME metric groups
392-
group_name = /*"GpuOffload"*/ /*"ComputeBasic" "MemProfile" "DataportProfile"*/ "L1ProfileReads" /* "L1ProfileSlmBankConflicts" "L1ProfileWrites"*/ ;
391+
// TIME metric groups for second half -- this needs to be *named* same across other architectures!
392+
// Choose same group to ensure we do not fail on other architectures.
393+
//group_name = "TestOa";
394+
group_name = "ComputeBasic"; //"GpuOffload" "ComputeBasic" "MemProfile" "DataportProfile" "L1ProfileReads" "L1ProfileSlmBankConflicts" "L1ProfileWrites"
393395

394396
// TRACE metric groups
395397
//group_name = "tpcs_utilization_and_bw" /* "nic_stms" "dcore0_bmons_bw"*/;

sdk/src/metrics_handler.h

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,10 @@ class PtiStreamMetricsProfiler : public PtiMetricsProfiler {
587587
std::ifstream(it->second->metric_file_name_, std::ios::in | std::ios::binary);
588588
PTI_ASSERT(inf.is_open());
589589
inf.seekg(0, inf.end);
590-
uint32_t file_size = inf.tellg();
590+
std::streamsize stream_file_size = inf.tellg();
591+
PTI_ASSERT(stream_file_size >= 0);
592+
size_t file_size = static_cast<size_t>(stream_file_size);
593+
591594
inf.seekg(0, inf.beg); // rewind
592595
std::vector<uint8_t> raw_metrics(file_size);
593596

@@ -611,7 +614,6 @@ class PtiStreamMetricsProfiler : public PtiMetricsProfiler {
611614
}
612615

613616
// Option 2: user wants the buffer filled.
614-
std::vector<uint8_t> raw_metrics(PtiMetricsProfiler::GetMaxMetricBufferSize());
615617

616618
*metrics_values_count = 0;
617619

@@ -661,9 +663,14 @@ class PtiStreamMetricsProfiler : public PtiMetricsProfiler {
661663
// open input file stream where metrics data is saved
662664
std::ifstream inf =
663665
std::ifstream(it->second->metric_file_name_, std::ios::in | std::ios::binary);
664-
if (!inf.is_open()) {
665-
continue;
666-
}
666+
PTI_ASSERT(inf.is_open());
667+
inf.seekg(0, inf.end);
668+
std::streamsize stream_file_size = inf.tellg();
669+
PTI_ASSERT(stream_file_size >= 0);
670+
size_t file_size = static_cast<size_t>(stream_file_size);
671+
672+
inf.seekg(0, inf.beg); // rewind
673+
std::vector<uint8_t> raw_metrics(file_size);
667674

668675
user_logger_->info("{\n\t\"displayTimeUnit\": \"us\",\n\t\"traceEvents\": [");
669676

@@ -1162,7 +1169,10 @@ class PtiTraceMetricsProfiler : public PtiMetricsProfiler {
11621169
// Option 1: user wants metrics values count
11631170
if (metrics_values_buffer == nullptr) {
11641171
inf.seekg(0, inf.end);
1165-
uint32_t file_size = inf.tellg();
1172+
std::streamsize stream_file_size = inf.tellg();
1173+
PTI_ASSERT(stream_file_size >= 0);
1174+
size_t file_size = static_cast<size_t>(stream_file_size);
1175+
11661176
inf.seekg(0, inf.beg); // rewind
11671177
std::vector<uint8_t> raw_metrics(file_size);
11681178

0 commit comments

Comments
 (0)