Skip to content

Commit ba15609

Browse files
committed
Address feedback
1 parent 76919e2 commit ba15609

File tree

3 files changed

+39
-37
lines changed

3 files changed

+39
-37
lines changed

sycl/doc/EnvironmentVariables.md

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ variables in production code.</span>
210210
| `SYCL_USE_KERNEL_SPV` | Path to the SPIR-V binary | Load device image from the specified file. If runtime is unable to read the file, `sycl::runtime_error` exception is thrown. The image is assumed to have been created using the `-fno-sycl-dead-args-optimization` option. |
211211
| `SYCL_DUMP_IMAGES` | Any(\*) | Dump device image binaries to file. Control has no effect if `SYCL_USE_KERNEL_SPV` is set. |
212212
| `SYCL_HOST_UNIFIED_MEMORY` | Integer | Enforce host unified memory support or lack of it for the execution graph builder. If set to 0, it is enforced as not supported by all devices. If set to 1, it is enforced as supported by all devices. |
213-
| `SYCL_CACHE_TRACE` | Described [below](#sycl_cache_trace-options) | Enable tracing for different SYCL caches and kernel_compiler. |
213+
| `SYCL_CACHE_TRACE` | Described [below](#sycl_cache_trace-options) | Enable tracing for different SYCL and `kernel_compiler` caches. |
214214
| `SYCL_PARALLEL_FOR_RANGE_ROUNDING_TRACE` | Any(\*) | Enables tracing of `parallel_for` invocations with rounded-up ranges. |
215215
| `SYCL_PI_SUPPRESS_ERROR_MESSAGE` | Any(\*) | Suppress printing of error message, only used for CI in order not to interrupt errors generated by underlying toolchains; note that the variable only modifies the printing of the error message (error value, name, description and location), the handling of error return code and aborting/throwing behaviour remains unchanged. |
216216
| `SYCL_JIT_COMPILER_DEBUG` | Any(\*) | Passes can specify their own debug types, `sycl-spec-const-materializer` enables debug output generation in specialization constants materialization pass. |
@@ -247,19 +247,15 @@ Supported tracing levels are in the table below
247247

248248
### `SYCL_CACHE_TRACE` Options
249249

250-
`SYCL_CACHE_TRACE` enables tracing of different SYCL caches and kernel_compiler. It accepts one of the values from the table below:
251-
252-
| Option | Description |
250+
`SYCL_CACHE_TRACE` accepts a bit-mask to control the tracing of different SYCL caches. The input value is parsed as an integer and the following bit-masks are used to determine the tracing behavior:
251+
| Bit-mask | Corresponding cache tracing |
253252
| ------ | ----------- |
254-
| 0 | Disable tracing |
255-
| 1 | Enable tracing of persistent cache |
256-
| 2 | Enable tracing of in-memory cache |
257-
| 3 | Enable tracing of persistent and in-memory cache |
258-
| 4 | Enable tracing of kernel_compiler |
259-
| 5 | Enable tracing of persistent cache and kernel_compiler |
260-
| 6 | Enable tracing of in-memory cache and kernel_compiler |
261-
| 7 | Enable tracing of persistent, in-memory cache, and kernel_compiler |
262-
| Other non-null values | Enable tracing of persistent cache (Depreciated) |
253+
| 0x01 | Enable tracing of persistent cache |
254+
| 0x02 | Enable tracing of in-memory cache |
255+
| 0x04 | Enable tracing of `kernel_compiler` cache |
256+
257+
Any valid combination of the above bit-masks can be used to enable/disable tracing of the corresponding caches. If the input value is not null and not a valid number, the disk cache tracing will be enabled (depreciated behavior).
258+
The default value is 0 and no tracing is enabled.
263259

264260
## Debugging variables for Level Zero Plugin
265261

sycl/source/detail/config.hpp

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -698,25 +698,32 @@ template <> class SYCLConfig<SYCL_JIT_AMDGCN_PTX_TARGET_FEATURES> {
698698
}
699699
};
700700

701-
// SYCL_CACHE_TRACE accepts the following values:
702-
// 0 - no tracing
703-
// 1 - trace disk cache
704-
// 2 - trace in-memory cache
705-
// 3 - trace disk and in-memory cache
706-
// 4 - trace kernel_compiler
707-
// 5 - trace disk and kernel_compiler
708-
// 6 - trace in-memory and kernel_compiler
709-
// 7 - trace disk, in-memory and kernel_compiler
710-
// <Any other non-null value> - trace disk cache (Legacy behavior)
701+
// SYCL_CACHE_TRACE accepts a bit-mask to control the tracing of
702+
// different SYCL caches. The input value is parsed as an integer and
703+
// the following bit-masks is used to determine the tracing behavior:
704+
// 0x01 - trace disk cache
705+
// 0x02 - trace in-memory cache
706+
// 0x04 - trace kernel_compiler cache
707+
// Any valid combination of the above bit-masks can be used to enable/disable
708+
// tracing of the corresponding caches. If the input value is not null and
709+
// not a valid number, the disk cache tracing will be enabled (depreciated
710+
// behavior). The default value is 0 and no tracing is enabled.
711711
template <> class SYCLConfig<SYCL_CACHE_TRACE> {
712712
using BaseT = SYCLConfigBase<SYCL_CACHE_TRACE>;
713+
enum TraceBitmask { DiskCache = 1, InMemCache = 2, KernelCompiler = 4 };
713714

714715
public:
715716
static unsigned int get() { return getCachedValue(); }
716717
static void reset() { (void)getCachedValue(true); }
717-
static bool isTraceDiskCache() { return getCachedValue() & 1; }
718-
static bool isTraceInMemCache() { return getCachedValue() & 2; }
719-
static bool isTraceKernelCompiler() { return getCachedValue() & 4; }
718+
static bool isTraceDiskCache() {
719+
return getCachedValue() & TraceBitmask::DiskCache;
720+
}
721+
static bool isTraceInMemCache() {
722+
return getCachedValue() & TraceBitmask::InMemCache;
723+
}
724+
static bool isTraceKernelCompiler() {
725+
return getCachedValue() & TraceBitmask::KernelCompiler;
726+
}
720727

721728
private:
722729
static unsigned int getCachedValue(bool ResetCache = false) {

sycl/unittests/config/ConfigTests.cpp

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -233,17 +233,16 @@ TEST(ConfigTests, CheckConfigProcessing) {
233233
sycl::detail::SYCL_PRINT_EXECUTION_GRAPH>::get());
234234
}
235235

236-
// Unit test for SYCL_CACHE_TRACE environment variable.
237-
// SYCL_CACHE_TRACE accepts the following values:
238-
// 0 - no tracing
239-
// 1 - trace disk cache
240-
// 2 - trace in-memory cache
241-
// 3 - trace disk and in-memory cache
242-
// 4 - trace kernel_compiler
243-
// 5 - trace disk and kernel_compiler
244-
// 6 - trace in-memory and kernel_compiler
245-
// 7 - trace disk, in-memory and kernel_compiler
246-
// <Any other non-null value> - trace disk cache (Legacy behavior)
236+
// SYCL_CACHE_TRACE accepts a bit-mask to control the tracing of
237+
// different SYCL caches. The input value is parsed as an integer and
238+
// the following bit-masks is used to determine the tracing behavior:
239+
// 0x01 - trace disk cache
240+
// 0x02 - trace in-memory cache
241+
// 0x04 - trace kernel_compiler cache
242+
// Any valid combination of the above bit-masks can be used to enable/disable
243+
// tracing of the corresponding caches. If the input value is not null and
244+
// not a valid number, the disk cache tracing will be enabled (depreciated
245+
// behavior). The default value is 0 and no tracing is enabled.
247246
using namespace sycl::detail;
248247
TEST(ConfigTests, CheckSyclCacheTraceTest) {
249248

0 commit comments

Comments
 (0)