Skip to content

Commit 16472ce

Browse files
committed
remove filename trimming - follow review
1 parent 6f924e7 commit 16472ce

File tree

3 files changed

+10
-23
lines changed

3 files changed

+10
-23
lines changed

unified-runtime/source/CMakeLists.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@
66
add_definitions(-DUR_VERSION="${PROJECT_VERSION_MAJOR}")
77
add_definitions(-DUR_VALIDATION_LAYER_SUPPORTED_VERSION="${PROJECT_VERSION_MAJOR}")
88

9-
string(LENGTH "${CMAKE_SOURCE_DIR}/" SRC_PATH_SIZE)
10-
add_definitions("-DSRC_PATH_SIZE=${SRC_PATH_SIZE}") # for nicer log messages
11-
129
add_subdirectory(common)
1310
add_subdirectory(loader)
1411
add_subdirectory(mock)

unified-runtime/source/common/logger/ur_logger_details.hpp

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -106,27 +106,18 @@ class Logger {
106106

107107
} // namespace logger
108108

109-
#ifdef SRC_PATH_SIZE
110-
#define SHORT_FILE \
111-
((SRC_PATH_SIZE < sizeof(__FILE__)) \
112-
? ((const char *)__FILE__ + SRC_PATH_SIZE) \
113-
: __FILE__)
114-
#else
115-
#define SHORT_FILE __FILE__
116-
#endif
117-
118109
#define UR_STRIMPL_(x) #x
119110
#define UR_STR_(x) UR_STRIMPL_(x)
120111

121112
#define URLOG2_(logger_instance, level, ...) \
122113
{ \
123-
(logger_instance).log(level, SHORT_FILE, UR_STR_(__LINE__), __VA_ARGS__); \
114+
(logger_instance).log(level, __FILE__, UR_STR_(__LINE__), __VA_ARGS__); \
124115
}
116+
125117
#define URLOG_L2_(logger_instance, level, legacy_message, ...) \
126118
{ \
127119
(logger_instance) \
128-
.log(legacy_message, level, SHORT_FILE, UR_STR_(__LINE__), \
129-
__VA_ARGS__); \
120+
.log(legacy_message, level, __FILE__, UR_STR_(__LINE__), __VA_ARGS__); \
130121
}
131122

132123
// some symbols usefuls for log levels are predfined in some systems,

unified-runtime/source/loader/layers/validation/ur_leak_check.hpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ struct RefCountContext {
6868
ptr, RefRuntimeInfo{1, std::type_index(typeid(handle)),
6969
getCurrentBacktrace()});
7070
} else {
71-
getContext()->logger.log(UR_LOGGER_LEVEL_ERROR, SHORT_FILE,
71+
getContext()->logger.log(UR_LOGGER_LEVEL_ERROR, __FILE__,
7272
UR_STR_(__LINE__), "Handle {} already exists",
7373
ptr);
7474
return;
@@ -77,7 +77,7 @@ struct RefCountContext {
7777
case REFCOUNT_INCREASE:
7878
if (it == counts.end()) {
7979
getContext()->logger.log(
80-
UR_LOGGER_LEVEL_ERROR, SHORT_FILE, UR_STR_(__LINE__),
80+
UR_LOGGER_LEVEL_ERROR, __FILE__, UR_STR_(__LINE__),
8181
"Attempting to retain nonexistent handle {}", ptr);
8282
return;
8383
} else {
@@ -95,16 +95,15 @@ struct RefCountContext {
9595

9696
if (it->second.refCount < 0) {
9797
getContext()->logger.log(
98-
UR_LOGGER_LEVEL_ERROR, SHORT_FILE, UR_STR_(__LINE__),
98+
UR_LOGGER_LEVEL_ERROR, __FILE__, UR_STR_(__LINE__),
9999
"Attempting to release nonexistent handle {}", ptr);
100100
} else if (it->second.refCount == 0 && isAdapterHandle) {
101101
adapterCount--;
102102
}
103103
break;
104104
}
105105

106-
getContext()->logger.log(UR_LOGGER_LEVEL_DEBUG, SHORT_FILE,
107-
UR_STR_(__LINE__),
106+
getContext()->logger.log(UR_LOGGER_LEVEL_DEBUG, __FILE__, UR_STR_(__LINE__),
108107
"Reference count for handle {} changed to {}", ptr,
109108
it->second.refCount);
110109

@@ -114,7 +113,7 @@ struct RefCountContext {
114113

115114
// No more active adapters, so any references still held are leaked
116115
if (adapterCount == 0) {
117-
logInvalidReferences(SHORT_FILE, UR_STR_(__LINE__));
116+
logInvalidReferences(__FILE__, UR_STR_(__LINE__));
118117
counts.clear();
119118
}
120119
}
@@ -175,10 +174,10 @@ struct RefCountContext {
175174
} // namespace ur_validation_layer
176175

177176
#define URLOG_CTX_INVALID_REFERENCE(ptr) \
178-
getContext()->refCountContext->logInvalidReference(SHORT_FILE, \
177+
getContext()->refCountContext->logInvalidReference(__FILE__, \
179178
UR_STR_(__LINE__), ptr);
180179
#define URLOG_CTX_INVALID_REFERENCES() \
181-
getContext()->refCountContext->logInvalidReferences(SHORT_FILE, \
180+
getContext()->refCountContext->logInvalidReferences(__FILE__, \
182181
UR_STR_(__LINE__));
183182

184183
#endif /* UR_LEAK_CHECK_H */

0 commit comments

Comments
 (0)