Skip to content

Commit af1e131

Browse files
author
vzakhari
authored
[libdevice] Mark compiler ITT wrappers with always_inline. (#3807)
Compiler generated ITT annotations may interfere with debugging the instrumented user code even in non-ITT mode (when ITT is disabled via the specialization constant). This change marks the wrappers used by the compiler generated code with always_inline so that device compiler are able to get rid of the extra code in non-ITT mode. Signed-off-by: Vyacheslav Zakharin <vyacheslav.p.zakharin@intel.com>
1 parent c0807ba commit af1e131

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

libdevice/device_itt.h

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include "spirv_vars.h"
1616

1717
#define ITT_STUB_ATTRIBUTES __attribute__((noinline, optnone))
18+
#define ITT_WRAPPER_ATTRIBUTES __attribute__((always_inline))
1819

1920
/// Atomic operation type
2021
enum __itt_atomic_mem_op_t {
@@ -36,7 +37,7 @@ DEVICE_EXTERN_C char __spirv_SpecConstant(int, char);
3637

3738
#define ITT_SPEC_CONSTANT 0xFF747469
3839

39-
static inline bool isITTEnabled() {
40+
static ITT_WRAPPER_ATTRIBUTES bool isITTEnabled() {
4041
return __spirv_SpecConstant(ITT_SPEC_CONSTANT, 0) != 0;
4142
}
4243

@@ -50,14 +51,15 @@ static inline bool isITTEnabled() {
5051
// be computed in the wrapper itself and has to be passed from outside.
5152
// If a compiler needs to invoke such an API, it has to use the user
5253
// visible API directly (i.e. __itt_offload_sync_acquired).
53-
DEVICE_EXTERN_C
54-
void __itt_offload_wi_start_wrapper();
55-
DEVICE_EXTERN_C
56-
void __itt_offload_wi_finish_wrapper();
57-
DEVICE_EXTERN_C
58-
void __itt_offload_wg_barrier_wrapper();
59-
DEVICE_EXTERN_C
60-
void __itt_offload_wi_resume_wrapper();
54+
//
55+
// FIXME: we need to add always_inline compiler wrappers
56+
// for atomic_op_start/finish. Compiler calls user
57+
// wrappers right now, and they may interfere with
58+
// debugging user code in non-ITT mode.
59+
DEVICE_EXTERN_C ITT_WRAPPER_ATTRIBUTES void __itt_offload_wi_start_wrapper();
60+
DEVICE_EXTERN_C ITT_WRAPPER_ATTRIBUTES void __itt_offload_wi_finish_wrapper();
61+
DEVICE_EXTERN_C ITT_WRAPPER_ATTRIBUTES void __itt_offload_wg_barrier_wrapper();
62+
DEVICE_EXTERN_C ITT_WRAPPER_ATTRIBUTES void __itt_offload_wi_resume_wrapper();
6163

6264
// Non-inlinable and non-optimizable APIs that are recognized
6365
// by profiling tools.

0 commit comments

Comments
 (0)