Skip to content

Commit

Permalink
Minor improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
anton-v-gorshkov committed Jan 28, 2022
1 parent e6a4ada commit 66c166e
Show file tree
Hide file tree
Showing 17 changed files with 103 additions and 60 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.43.0
0.43.3
30 changes: 24 additions & 6 deletions build_utils/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ macro(FindOpenCLLibrary TARGET)
endif()
else()
if(DEFINED ENV{LD_LIBRARY_PATH})
string(REPLACE ":" ";" SEARCH_LIB_PATH $ENV{LD_LIBRARY_PATH})
string(COMPARE EQUAL "$ENV{LD_LIBRARY_PATH}" "" RESULT)
if (NOT RESULT)
string(REPLACE ":" ";" SEARCH_LIB_PATH $ENV{LD_LIBRARY_PATH})
endif()
endif()

list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES .so.1)
Expand Down Expand Up @@ -191,7 +194,10 @@ macro(FindIGALibrary TARGET)
endif()
else()
if(DEFINED ENV{LD_LIBRARY_PATH})
string(REPLACE ":" ";" SEARCH_LIB_PATH $ENV{LD_LIBRARY_PATH})
string(COMPARE EQUAL "$ENV{LD_LIBRARY_PATH}" "" RESULT)
if (NOT RESULT)
string(REPLACE ":" ";" SEARCH_LIB_PATH $ENV{LD_LIBRARY_PATH})
endif()
endif()
find_library(IGA_LIB_PATH
NAMES iga64
Expand Down Expand Up @@ -321,7 +327,10 @@ macro(CheckForMDLibrary TARGET)
endif()
else()
if(DEFINED ENV{LD_LIBRARY_PATH})
string(REPLACE ":" ";" SEARCH_LIB_PATH $ENV{LD_LIBRARY_PATH})
string(COMPARE EQUAL "$ENV{LD_LIBRARY_PATH}" "" RESULT)
if (NOT RESULT)
string(REPLACE ":" ";" SEARCH_LIB_PATH $ENV{LD_LIBRARY_PATH})
endif()
endif()
find_library(MD_LIB_PATH
NAMES md
Expand Down Expand Up @@ -349,7 +358,10 @@ macro(CheckForMetricsLibrary)
file(GLOB_RECURSE ML_LIB_PATH "${WIN_SYS_PATH}/igdml64.dll")
else()
if(DEFINED ENV{LD_LIBRARY_PATH})
string(REPLACE ":" ";" SEARCH_LIB_PATH $ENV{LD_LIBRARY_PATH})
string(COMPARE EQUAL "$ENV{LD_LIBRARY_PATH}" "" RESULT)
if (NOT RESULT)
string(REPLACE ":" ";" SEARCH_LIB_PATH $ENV{LD_LIBRARY_PATH})
endif()
endif()
find_library(ML_LIB_PATH
NAMES igdml64
Expand Down Expand Up @@ -580,7 +592,10 @@ macro(FindL0Library TARGET)
endif()
else()
if(DEFINED ENV{LD_LIBRARY_PATH})
string(REPLACE ":" ";" SEARCH_LIB_PATH $ENV{LD_LIBRARY_PATH})
string(COMPARE EQUAL "$ENV{LD_LIBRARY_PATH}" "" RESULT)
if (NOT RESULT)
string(REPLACE ":" ";" SEARCH_LIB_PATH $ENV{LD_LIBRARY_PATH})
endif()
endif()

find_library(L0_LIB_PATH
Expand Down Expand Up @@ -651,7 +666,10 @@ endmacro()

macro(FindDRMLibrary TARGET)
if(DEFINED ENV{LD_LIBRARY_PATH})
string(REPLACE ":" ";" SEARCH_LIB_PATH $ENV{LD_LIBRARY_PATH})
string(COMPARE EQUAL "$ENV{LD_LIBRARY_PATH}" "" RESULT)
if (NOT RESULT)
string(REPLACE ":" ";" SEARCH_LIB_PATH $ENV{LD_LIBRARY_PATH})
endif()
endif()

find_library(DRM_LIB_PATH
Expand Down
2 changes: 1 addition & 1 deletion chapters/binary_source_correlation/LevelZero.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ assert(status == ZE_RESULT_SUCCESS);
To decode debug symbols for GPU modules one should refer to [Intel(R) Processor Graphics Compiler (IGC)](https://github.com/intel/intel-graphics-compiler) internal formats described [here](GenSymbolsDecoding.md).
## Usage Details
- refer to oneAPI Level Zero [documentation](https://spec.oneapi.com/level-zero/latest/index.html) to learn more
- refer to oneAPI Level Zero [documentation](https://spec.oneapi.io/level-zero/latest/index.html) to learn more
- look into GEN binary decoding [chapter](GenBinaryDecoding.md) to learn more on GEN binary decoding/disassembling interfaces
- look into GEN symbols decoding [chapter](GenSymbolsDecoding.md) to learn more on symbols format
- refer to the IGC [patch_list.h](https://github.com/intel/intel-graphics-compiler/blob/master/IGC/AdaptorOCL/ocl_igc_shared/executable_format/patch_list.h) header to learn more on module binary layout
Expand Down
8 changes: 4 additions & 4 deletions chapters/code_annotation/ITT.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Instrumentation and Tracing Technology API (ITT API)
## Overview
The [Instrumentation and Tracing Technology API (ITT API)](https://software.intel.com/content/www/us/en/develop/documentation/vtune-help/top/api-support/instrumentation-and-tracing-technology-apis.html) enables the application to generate and control the collection of tracing data during its execution.
It is intended for use with [Intel(R) VTune(TM) Profiler](https://software.intel.com/content/www/us/en/develop/tools/oneapi/components/vtune-profiler.html).
It is intended for use with [Intel(R) VTune(TM) Analyzer](https://software.intel.com/content/www/us/en/develop/tools/oneapi/components/vtune-profiler.html).

Instrumentation and Tracing Technology API (ITT API) provides the following capabilities:
- Enable user to control collection;
Expand All @@ -10,7 +10,7 @@ Instrumentation and Tracing Technology API (ITT API) provides the following capa
- Enable user to specify custom synchronization primitives implemented without standard system APIs;
- Support applications in C/C++ environments.

User applications/modules linked to the static user API library do not have a runtime dependency on a dynamic library. Therefore, they can be executed without Intel(R) VTune(TM) Profiler with close-to-zero overhead.
User applications/modules linked to the static user API library do not have a runtime dependency on a dynamic library. Therefore, they can be executed without Intel(R) VTune(TM) Analyzer with close-to-zero overhead.

**Supported OS**:
- Linux
Expand All @@ -23,7 +23,7 @@ User applications/modules linked to the static user API library do not have a ru
- [ittnotify.h](https://github.com/intel/ittapi/blob/master/include/ittnotify.h)

**Needed Libraries**:
- Instrumentation and Tracing Technology (ITT) [library](https://github.com/intel/ittapi), can be installed as part of [Intel(R) VTune(TM) Profiler](https://software.intel.com/content/www/us/en/develop/tools/oneapi/components/vtune-profiler.html)
- Instrumentation and Tracing Technology (ITT) [library](https://github.com/intel/ittapi), can be installed as part of [Intel(R) VTune(TM) Analyzer](https://software.intel.com/content/www/us/en/develop/tools/oneapi/components/vtune-profiler.html)

## How To Use
The following steps should be performed to enable ITT based code annotation for target application:
Expand Down Expand Up @@ -63,7 +63,7 @@ int main() {
}
```
3. Build the application and link it with ITT library implementation. One may build ITT static library first, and then link the application with it. Another way is to add ITT sources (in particular, [ittnotify_static.c](https://github.com/intel/ittapi/blob/master/src/ittnotify/ittnotify_static.c) file) into the application directly.
4. Run the application under [Intel(R) VTune(TM) Profiler](https://software.intel.com/content/www/us/en/develop/tools/oneapi/components/vtune-profiler.html) to see the result.
4. Run the application under [Intel(R) VTune(TM) Analyzer](https://software.intel.com/content/www/us/en/develop/tools/oneapi/components/vtune-profiler.html) to see the result.

## Usage Details
- refer to Instrumentation and Tracing Technology API (ITT API) [documentation](https://software.intel.com/content/www/us/en/develop/documentation/vtune-help/top/api-support/instrumentation-and-tracing-technology-apis.html) documentation to learn more on programming interfaces
Expand Down
2 changes: 1 addition & 1 deletion chapters/device_activity_tracing/LevelZero.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ Event pool profiling does not require any additional environment variables to be
```
## Usage Details
- refer to oneAPI Level Zero [documentation](https://spec.oneapi.com/level-zero/latest/index.html) to learn more
- refer to oneAPI Level Zero [documentation](https://spec.oneapi.io/level-zero/latest/index.html) to learn more
## Samples
- [Level Zero GEMM](../../samples/ze_gemm)
Expand Down
8 changes: 4 additions & 4 deletions samples/cl_gemm/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -153,16 +153,16 @@ static void Compute(cl_device_id device, const std::vector<float>& a,
PTI_ASSERT(status == CL_SUCCESS && kernel != nullptr);

for (unsigned i = 0; i < repeat_count; ++i) {
if (i == 0) { // Disable data collection for the first iteration
utils::SetEnv("PTI_DISABLE_COLLECTION", "1");
if (i == 0) { // Enable data collection for the first iteration
utils::SetEnv("PTI_ENABLE_COLLECTION", "1");
}

float eps = RunAndCheck(kernel, queue, a, b, c, size, expected_result);
std::cout << "Results are " << ((eps < MAX_EPS) ? "" : "IN") <<
"CORRECT with accuracy: " << eps << std::endl;

if (i == 0) { // Enable data collection for the rest iterations
utils::SetEnv("PTI_DISABLE_COLLECTION", "");
if (i == 0) { // Disable data collection for the rest iterations
utils::SetEnv("PTI_ENABLE_COLLECTION", "");
}
}

Expand Down
4 changes: 2 additions & 2 deletions samples/cl_gemm_itt/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# OpenCL(TM) GEMM with Code Annotation
## Overview
This sample application performs general matrix multiplication using OpenCL(TM) CPU or GPU device. Its code is annotated with Instrumentation and Tracing Technology API (ITT API) that allows to highligh its regions-of-interest while using Intel(R) VTune(TM) Profiler.
This sample application performs general matrix multiplication using OpenCL(TM) CPU or GPU device. Its code is annotated with Instrumentation and Tracing Technology API (ITT API) that allows to highligh its regions-of-interest while using Intel(R) VTune(TM) Analyzer.
```
OpenCL Matrix Multiplication (matrix size: 1024 x 1024, repeats 4 times)
Target device: Intel(R) Gen9 HD Graphics NEO
Expand Down Expand Up @@ -53,4 +53,4 @@ Use this command line to run the application:
cl_gemm_itt.exe [cpu|gpu] [matrix_size] [repeats_count]
```

Use [Intel(R) VTune(TM) Profiler](https://software.intel.com/content/www/us/en/develop/tools/oneapi/components/vtune-profiler.html) to profile this application in order to look into its regions-of-interest.
Use [Intel(R) VTune(TM) Analyzer](https://software.intel.com/content/www/us/en/develop/tools/oneapi/components/vtune-profiler.html) to profile this application in order to look into its regions-of-interest.
10 changes: 5 additions & 5 deletions samples/ze_gemm/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -219,23 +219,23 @@ static void Compute(ze_device_handle_t device,
PTI_ASSERT(status == ZE_RESULT_SUCCESS && module != nullptr);

ze_kernel_desc_t kernel_desc = {
ZE_STRUCTURE_TYPE_KERNEL_DESC, nullptr, 0, "GEMM"};
ZE_STRUCTURE_TYPE_KERNEL_DESC, nullptr, 0, "GEMM"};
ze_kernel_handle_t kernel = nullptr;
status = zeKernelCreate(module, &kernel_desc, &kernel);
PTI_ASSERT(status == ZE_RESULT_SUCCESS && kernel != nullptr);

for (unsigned i = 0; i < repeat_count; ++i) {
if (i == 0) { // Disable data collection for the first iteration
utils::SetEnv("PTI_DISABLE_COLLECTION", "1");
if (i == 0) { // Enable data collection for the first iteration
utils::SetEnv("PTI_ENABLE_COLLECTION", "1");
}

float eps = RunAndCheck(kernel, device, context, a, b, c,
size, expected_result);
std::cout << "Results are " << ((eps < MAX_EPS) ? "" : "IN") <<
"CORRECT with accuracy: " << eps << std::endl;

if (i == 0) { // Enable data collection for the rest iterations
utils::SetEnv("PTI_DISABLE_COLLECTION", "");
if (i == 0) { // Disable data collection for the rest iterations
utils::SetEnv("PTI_ENABLE_COLLECTION", "");
}
}

Expand Down
8 changes: 4 additions & 4 deletions tools/cl_tracer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,13 @@ Device Timeline (queue: 0x55a9c7e51e70): clEnqueueReadBuffer [ns] = 361479600 (q

**Chrome Device Stages** mode provides alternative view for device queue where each kernel invocation is divided into stages: "queued", "sumbitted" and "execution". Can't be used with **Chrome Device Timeline**.

**Conditional Collection** mode allows one to disable data collection for any target interval using environment variable `PTI_DISABLE_COLLECTION`, e.g.:
**Conditional Collection** mode allows one to enable data collection for any target interval (by default collection will be disabled) using environment variable `PTI_ENABLE_COLLECTION`, e.g.:
```cpp
// Collection enabled
setenv("PTI_DISABLE_COLLECTION", "1", 1);
// Collection disabled
unsetenv("PTI_DISABLE_COLLECTION");
setenv("PTI_ENABLE_COLLECTION", "1", 1);
// Collection enabled
unsetenv("PTI_ENABLE_COLLECTION");
// Collection disabled
```
All the API calls and kernels, which submission happens while collection disabled interval, will be omitted from final results.
Expand Down
2 changes: 1 addition & 1 deletion tools/cl_tracer/cl_api_collector.h
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ class ClApiCollector {

if (callback_data->site == CL_CALLBACK_SITE_ENTER) {
PTI_ASSERT(collector->correlator_ != nullptr);
if (collector->correlator_->IsCollectionDisabled()) {
if (!collector->correlator_->IsCollectionEnabled()) {
*reinterpret_cast<uint64_t*>(callback_data->correlationData) = 0;
return;
}
Expand Down
4 changes: 2 additions & 2 deletions tools/cl_tracer/cl_kernel_collector.h
Original file line number Diff line number Diff line change
Expand Up @@ -811,7 +811,7 @@ class ClKernelCollector {
PTI_ASSERT(collector->correlator_ != nullptr);
collector->correlator_->SetKernelId(instance->kernel_id);
instance->need_to_process =
!collector->correlator_->IsCollectionDisabled();
collector->correlator_->IsCollectionEnabled();

ClEnqueueData* enqueue_data =
reinterpret_cast<ClEnqueueData*>(data->correlationData[0]);
Expand Down Expand Up @@ -851,7 +851,7 @@ class ClKernelCollector {
PTI_ASSERT(collector->correlator_ != nullptr);
collector->correlator_->SetKernelId(instance->kernel_id);
instance->need_to_process =
!collector->correlator_->IsCollectionDisabled();
collector->correlator_->IsCollectionEnabled();

ClEnqueueData* enqueue_data =
reinterpret_cast<ClEnqueueData*>(data->correlationData[0]);
Expand Down
8 changes: 4 additions & 4 deletions tools/onetrace/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,13 +138,13 @@ Device Timeline (queue: 0x55a9c7e51e70): clEnqueueReadBuffer [ns] = 361479600 (q

**Chrome Device Stages** mode provides alternative view for device queue where each kernel invocation is divided into stages: "queued" or "appended", "sumbitted" and "execution". Can't be used with **Chrome Device Timeline**.

**Conditional Collection** mode allows one to disable data collection for any target interval using environment variable `PTI_DISABLE_COLLECTION`, e.g.:
**Conditional Collection** mode allows one to enable data collection for any target interval (by default collection will be disabled) using environment variable `PTI_ENABLE_COLLECTION`, e.g.:
```cpp
// Collection enabled
setenv("PTI_DISABLE_COLLECTION", "1", 1);
// Collection disabled
unsetenv("PTI_DISABLE_COLLECTION");
setenv("PTI_ENABLE_COLLECTION", "1", 1);
// Collection enabled
unsetenv("PTI_ENABLE_COLLECTION");
// Collection disabled
```
All the API calls and kernels, which submission happens while collection disabled interval, will be omitted from final results.
Expand Down
20 changes: 13 additions & 7 deletions tools/sysmon/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1040,19 +1040,25 @@ void PrintTemperatureInfo(
if (temp_props.type == ZES_TEMP_SENSORS_GPU) {
double temp = 0.0f;
status = zesTemperatureGetState(sensor_list[i], &temp);
PTI_ASSERT(status == ZE_RESULT_SUCCESS);

std::cout << std::setw(TEXT_WIDTH) << std::left <<
"Core Temperature(C)," << temp << std::endl;
std::cout << std::setw(TEXT_WIDTH) <<
std::left << "Core Temperature(C),";
if (status == ZE_RESULT_SUCCESS) {
std::cout << temp << std::endl;
} else {
std::cout << "N/A" << std::endl;
}
}

if (temp_props.type == ZES_TEMP_SENSORS_MEMORY) {
double temp = 0.0f;
status = zesTemperatureGetState(sensor_list[i], &temp);
PTI_ASSERT(status == ZE_RESULT_SUCCESS);

std::cout << std::setw(TEXT_WIDTH) << std::left <<
"Memory Temperature(C)," << temp << std::endl;
"Memory Temperature(C),";
if (status == ZE_RESULT_SUCCESS) {
std::cout << temp << std::endl;
} else {
std::cout << "N/A" << std::endl;
}
}
}
}
Expand Down
9 changes: 6 additions & 3 deletions tools/utils/correlator.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,14 @@ class Correlator {
kernel_id_ = kernel_id;
}

bool IsCollectionDisabled() const {
bool IsCollectionEnabled() const {
if (conditional_collection_) {
return !utils::GetEnv("PTI_DISABLE_COLLECTION").empty();
std::string enabled = utils::GetEnv("PTI_ENABLE_COLLECTION");
if (enabled.empty() || enabled == "0") {
return false;
}
}
return false;
return true;
}

#ifdef PTI_LEVEL_ZERO
Expand Down
8 changes: 4 additions & 4 deletions tools/ze_tracer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,13 @@ Device Timeline (queue: 0x556fa2318fc0): zeCommandListAppendMemoryCopy [ns] = 39

**Chrome Device Stages** mode provides alternative view for device queue where each kernel invocation is divided into stages: "appended", "sumbitted" and "execution". Can't be used with **Chrome Device Timeline**.

**Conditional Collection** mode allows one to disable data collection for any target interval using environment variable `PTI_DISABLE_COLLECTION`, e.g.:
**Conditional Collection** mode allows one to enable data collection for any target interval (by default collection will be disabled) using environment variable `PTI_ENABLE_COLLECTION`, e.g.:
```cpp
// Collection enabled
setenv("PTI_DISABLE_COLLECTION", "1", 1);
// Collection disabled
unsetenv("PTI_DISABLE_COLLECTION");
setenv("PTI_ENABLE_COLLECTION", "1", 1);
// Collection enabled
unsetenv("PTI_ENABLE_COLLECTION");
// Collection disabled
```
All the API calls and kernels, which submission happens while collection disabled interval, will be omitted from final results.
Expand Down
Loading

0 comments on commit 66c166e

Please sign in to comment.