Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions cliloader/cliloader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,10 @@ static bool parseArguments(int argc, char *argv[])
{
checkSetEnv("CLI_DumpKernelISABinaries", "1");
}
else if( !strcmp(argv[i], "-ct") || !strcmp(argv[i], "--conditional-timing") )
{
checkSetEnv("CLI_PerformanceTimingConditional", "1");
}
else if( !strcmp(argv[i], "-d") || !strcmp(argv[i], "--device-timing") )
{
checkSetEnv("CLI_DevicePerformanceTiming", "1");
Expand Down Expand Up @@ -622,6 +626,7 @@ static bool parseArguments(int argc, char *argv[])
" --dump-spirv [-dspv] Dump Input Program IL (SPIR-V)\n"
" --dump-output-binaries Dump Output Program Binaries\n"
" --dump-kernel-isa-binaries Dump Kernel ISA Binaries (Intel GPU Only)\n"
" --conditional-timing [-ct] Enable Conditional Timing Based on Environment Variables\n"
" --device-timing [-d] Report Device Execution Time\n"
" --device-timing-verbose [-dv] Report More Detailed Device Execution Time\n"
" --chrome-call-logging [-ccl] Record Host API Calls to a JSON Trace File\n"
Expand Down
4 changes: 4 additions & 0 deletions docs/controls.md
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,10 @@ If set to a nonzero value, the Intercept Layer for OpenCL Applications will orga

If set to a nonzero value, the Intercept Layer for OpenCL Applications will unconditionally estimate the queued time for Chrome Tracing rather than computing it using device and host timers and event profiling data. The estimated time is less accurate than the computed time, but may be more reliable if the device and host timers or event profiling data is incorrect or imprecise.

##### `PerformanceTimingConditional` (bool)

If set to a nonzero value, the Intercept Layer for OpenCL Applications will only collect host performance timing, device performance timing, and chrome performance timing conditionally, when the "CLI\_ENABLE\_PERFORMANCE\_TIMING" environment variable is set to a non-zero value.

### Controls for Dumping and Injecting Programs and Build Options

##### `OmitProgramNumber` (bool)
Expand Down
11 changes: 11 additions & 0 deletions intercept/OS/OS_linux.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@ class Services
bool CheckMDAPIPermissions(
std::string& str ) const;

bool CheckConditionalEnable(
const char* name) const;

private:
bool GetControlFromFile(
const std::string& fileName,
Expand Down Expand Up @@ -472,4 +475,12 @@ inline bool Services::CheckMDAPIPermissions(
return str.empty();
}

inline bool Services::CheckConditionalEnable(
const char* name) const
{
const char* envVal = getenv(name);
bool enabled = envVal && strcmp(envVal, "0") != 0;
return enabled;
}

}
11 changes: 11 additions & 0 deletions intercept/OS/OS_mac.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ class Services
bool CheckMDAPIPermissions(
std::string& str ) const;

bool CheckConditionalEnable(
const char* name) const;

private:
bool GetControlFromFile(
const std::string& fileName,
Expand Down Expand Up @@ -291,4 +294,12 @@ inline bool Services::CheckMDAPIPermissions(
return true;
}

inline bool Services::CheckConditionalEnable(
const char* name) const
{
const char* envVal = getenv(name);
bool enabled = envVal && strcmp(envVal, "0") != 0;
return enabled;
}

}
21 changes: 21 additions & 0 deletions intercept/OS/OS_windows.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ class Services
bool CheckMDAPIPermissions(
std::string& str ) const;

bool CheckConditionalEnable(
const char* name) const;

private:
HINSTANCE m_hInstance;
};
Expand Down Expand Up @@ -585,4 +588,22 @@ inline bool Services::CheckMDAPIPermissions(
return true;
}

inline bool Services::CheckConditionalEnable(
const char* name) const
{
bool enabled = false;
char* envVal = NULL;
size_t len = 0;
errno_t err = _dupenv_s( &envVal, &len, name );
if( !err && envVal )
{
if( strcmp(envVal, "0") != 0 )
{
enabled = true;
}
free( envVal );
}
return enabled;
}

}
1 change: 1 addition & 0 deletions intercept/src/controls.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ CLI_CONTROL( bool, ChromePerformanceTiming, false, "If s
CLI_CONTROL( bool, ChromePerformanceTimingInStages, false, "If set to a nonzero value, the Intercept Layer for OpenCL Applications will separate the performance information placed in the JSON file into Queued, Submitted, and Execution stages. It will also reorder the threads/queues by starting runtime. This flag is only functional when ChromePerformanceTiming is also set." )
CLI_CONTROL( bool, ChromePerformanceTimingPerKernel, false, "If set to a nonzero value, the Intercept Layer for OpenCL Applications will organize the performance information placed in the JSON file on a per kernel name basis. It is only functional when ChromePerformanceTiming is also set. When ChromePerformanceTimingInStages is also set, information about event stages will be retained." )
CLI_CONTROL( bool, ChromePerformanceTimingEstimateQueuedTime, false, "If set to a nonzero value, the Intercept Layer for OpenCL Applications will unconditionally estimate the queued time for Chrome Tracing rather than computing it using device and host timers and event profiling data. The estimated time is less accurate than the computed time, but may be more reliable if the device and host timers or event profiling data is incorrect or imprecise." )
CLI_CONTROL( bool, PerformanceTimingConditional, false, "If set to a nonzero value, the Intercept Layer for OpenCL Applications will only collect host performance timing, device performance timing, and chrome performance timing conditionally, when the \"CLI_ENABLE_PERFORMANCE_TIMING\" environment variable is set to a non-zero value." )

CLI_CONTROL_SEPARATOR( Controls for Dumping and Injecting Programs and Build Options: )
CLI_CONTROL( bool, OmitProgramNumber, false, "If set to a nonzero value, the Intercept Layer for OpenCL Applications will omit the program number from dumped file names and hash tracking. This can produce deterministic results even if programs are built in a non-deterministic order (say, by multiple threads)." )
Expand Down
Loading