GBE: Refine bti usage in backend & runtime.
authorRuiling Song <ruiling.song@intel.com>
Wed, 30 Jul 2014 05:59:29 +0000 (13:59 +0800)
committerZhigang Gong <zhigang.gong@intel.com>
Wed, 30 Jul 2014 07:23:43 +0000 (15:23 +0800)
commite16f34c027b3e7a19355c91d728632d82995b2b0
tree188e10aea38d79b2c8fee9e2c91b569bcf383880
parent778f56447172c737eceb8aaccca3d2801f242152
GBE: Refine bti usage in backend & runtime.

Previously, we simply map 2G surface for memory access,
which has obvious security issue, user can easily read/write graphics
memory that does not belong to him. To prevent such kind of behaviour,
We bind each surface to a dedicated bti. HW provides automatic
bounds check. For out-of-bound write, it will be ignored. And for read
out-of-bound, hardware will simply return zero value.

The idea behind the patch is for a load/store instruction, it will search
through the LLVM use-def chain until finding out where the address
comes from. Then the bti is saved in ir::Instruction and used for
the later code generation. And for mixed pointer case, a load/store
will access more than one bti.

To simplify some code, '0' is reserved for constant address space,
'1' is reserved for private address space. Other btis are assigned
automatically by backend.

Signed-off-by: Ruiling Song <ruiling.song@intel.com>
Reviewed-by: Zhigang Gong <zhigang.gong@linux.intel.com>
26 files changed:
backend/src/backend/context.cpp
backend/src/backend/context.hpp
backend/src/backend/gen_insn_selection.cpp
backend/src/backend/program.cpp
backend/src/backend/program.h
backend/src/backend/program.hpp
backend/src/gbe_bin_interpreter.cpp
backend/src/ir/context.cpp
backend/src/ir/context.hpp
backend/src/ir/function.hpp
backend/src/ir/image.cpp
backend/src/ir/image.hpp
backend/src/ir/instruction.cpp
backend/src/ir/instruction.hpp
backend/src/llvm/llvm_gen_backend.cpp
kernels/compiler_mixed_pointer.cl [new file with mode: 0644]
src/cl_command_queue.c
src/cl_command_queue_gen7.c
src/cl_driver.h
src/cl_gbe_loader.cpp
src/cl_gbe_loader.h
src/cl_kernel.c
src/cl_kernel.h
src/intel/intel_gpgpu.c
utests/CMakeLists.txt
utests/compiler_mixed_pointer.cpp [new file with mode: 0644]