GBE/libocl: Add __gen_ocl_get_timestamp() to get timestamp.
authorRuiling Song <ruiling.song@intel.com>
Thu, 18 Sep 2014 06:42:01 +0000 (14:42 +0800)
committerZhigang Gong <zhigang.gong@intel.com>
Thu, 18 Sep 2014 07:03:05 +0000 (15:03 +0800)
commitc0ba37d62dcac92adfc309e73abd7e12a02d8498
tree4c1a7865c530101dcdf627bc6f93c5db5d7f43f5
parent68a81947984de6cceab310c0f205ae66361b7468
GBE/libocl: Add __gen_ocl_get_timestamp() to get timestamp.

Gen provide tm0 register for intra-kernel profiling.
Here we provide an API __gen_ocl_get_timestamp() to return
the timestamp in TM.

The return type is defined as:
struct time_stamp {
  ulong tick;
  uint event;
};

'tick' is a 64bit time tick. 'event' stores a value which means
whether a tmEvent has occured (non-zero) or not (0). tmEvent includes
time-impacting event such as context switch or frequency change
since last time tm0 was read.

I add a sample in the kernels/compiler_time_stamp.cl. Hope it
would help you understand how to use it.

V2:
Introduce ir::ARFRegister to avoid directly use of nr/subnr in Gen IR.
Rename __gen_ocl_extract_reg to __gen_ocl_region.
Rename beignet_get_time_stamp to __gen_ocl_get_timestamp.

Signed-off-by: Ruiling Song <ruiling.song@intel.com>
Reviewed-by: Zhigang Gong <zhigang.gong@linux.intel.com>
18 files changed:
backend/src/backend/gen/gen_mesa_disasm.c
backend/src/backend/gen_context.cpp
backend/src/backend/gen_defs.hpp
backend/src/backend/gen_insn_scheduling.cpp
backend/src/backend/gen_insn_selection.cpp
backend/src/backend/gen_insn_selection.hxx
backend/src/ir/instruction.cpp
backend/src/ir/instruction.hpp
backend/src/ir/instruction.hxx
backend/src/ir/liveness.cpp
backend/src/ir/register.hpp
backend/src/libocl/include/ocl_misc.h
backend/src/libocl/src/ocl_misc.cl
backend/src/llvm/llvm_gen_backend.cpp
backend/src/llvm/llvm_gen_ocl_function.hxx
kernels/compiler_time_stamp.cl [new file with mode: 0644]
utests/CMakeLists.txt
utests/compiler_time_stamp.cpp [new file with mode: 0644]