From: Junyan He <[email protected]> printfiptr for printf index buffer pointer in curbe and printfbptr for printf output buffer pointer in curbe.
Signed-off-by: Junyan He <[email protected]> --- backend/src/backend/gen_context.cpp | 2 ++ backend/src/backend/program.h | 2 ++ backend/src/ir/profile.cpp | 5 ++++- backend/src/ir/profile.hpp | 4 +++- backend/src/llvm/llvm_gen_backend.cpp | 10 ++++++++++ backend/src/llvm/llvm_gen_ocl_function.hxx | 5 +++++ backend/src/ocl_stdlib.tmpl.h | 5 +++++ 7 files changed, 31 insertions(+), 2 deletions(-) diff --git a/backend/src/backend/gen_context.cpp b/backend/src/backend/gen_context.cpp index f4c80e3..ab19f72 100644 --- a/backend/src/backend/gen_context.cpp +++ b/backend/src/backend/gen_context.cpp @@ -1991,6 +1991,8 @@ namespace gbe INSERT_REG(numgroup1, GROUP_NUM_Y) INSERT_REG(numgroup2, GROUP_NUM_Z) INSERT_REG(stackptr, STACK_POINTER) + INSERT_REG(printfbptr, PRINTF_BUF_POINTER); + INSERT_REG(printfiptr, PRINTF_INDEX_POINTER); do {} while(0); } }); diff --git a/backend/src/backend/program.h b/backend/src/backend/program.h index e23f4db..7297ea8 100644 --- a/backend/src/backend/program.h +++ b/backend/src/backend/program.h @@ -72,6 +72,8 @@ enum gbe_curbe_type { GBE_CURBE_WORK_DIM, GBE_CURBE_IMAGE_INFO, GBE_CURBE_STACK_POINTER, + GBE_CURBE_PRINTF_BUF_POINTER, + GBE_CURBE_PRINTF_INDEX_POINTER, GBE_CURBE_KERNEL_ARGUMENT, GBE_CURBE_EXTRA_ARGUMENT, GBE_CURBE_BLOCK_IP, diff --git a/backend/src/ir/profile.cpp b/backend/src/ir/profile.cpp index 4b57efe..a1957cb 100644 --- a/backend/src/ir/profile.cpp +++ b/backend/src/ir/profile.cpp @@ -41,7 +41,8 @@ namespace ir { "block_ip", "barrier_id", "thread_number", "work_dimension", "zero", "one", - "retVal", "slm_offset", "invalid" + "retVal", "slm_offset", "invalid", + "printf_buffer_pointer", "printf_index_buffer_pointer" }; #if GBE_DEBUG @@ -83,6 +84,8 @@ namespace ir { DECL_NEW_REG(FAMILY_WORD, retVal, 1); DECL_NEW_REG(FAMILY_WORD, slmoffset, 1); DECL_NEW_REG(FAMILY_DWORD, invalid, 1); + DECL_NEW_REG(FAMILY_DWORD, printfbptr, 1); + DECL_NEW_REG(FAMILY_DWORD, printfiptr, 1); } #undef DECL_NEW_REG diff --git a/backend/src/ir/profile.hpp b/backend/src/ir/profile.hpp index 41a4e09..1d7042d 100644 --- a/backend/src/ir/profile.hpp +++ b/backend/src/ir/profile.hpp @@ -70,7 +70,9 @@ namespace ir { static const Register retVal = Register(26); // helper register to do data flow analysis. static const Register slmoffset = Register(27); // Group's SLM offset in total 64K SLM static const Register invalid = Register(28); // used for valid comparation. - static const uint32_t regNum = 29; // number of special registers + static const Register printfbptr = Register(29); // printf buffer address . + static const Register printfiptr = Register(30); // printf index buffer address. + static const uint32_t regNum = 31; // number of special registers extern const char *specialRegMean[]; // special register name. } /* namespace ocl */ diff --git a/backend/src/llvm/llvm_gen_backend.cpp b/backend/src/llvm/llvm_gen_backend.cpp index e8fa673..bb82be4 100644 --- a/backend/src/llvm/llvm_gen_backend.cpp +++ b/backend/src/llvm/llvm_gen_backend.cpp @@ -2152,6 +2152,10 @@ namespace gbe regTranslator.newScalarProxy(ir::ocl::goffset2, dst); break; case GEN_OCL_GET_WORK_DIM: regTranslator.newScalarProxy(ir::ocl::workdim, dst); break; + case GEN_OCL_PRINTF_BUF_ADDR: + regTranslator.newScalarProxy(ir::ocl::printfbptr, dst); break; + case GEN_OCL_PRINTF_INDEX_BUF_ADDR: + regTranslator.newScalarProxy(ir::ocl::printfiptr, dst); break; case GEN_OCL_FBH: case GEN_OCL_FBL: case GEN_OCL_COS: @@ -2308,6 +2312,8 @@ namespace gbe case GEN_OCL_SIMD_ALL: this->newRegister(&I); break; + case GEN_OCL_PRINTF: + break; default: GBE_ASSERTM(false, "Function call are not supported yet"); }; @@ -2935,6 +2941,10 @@ handle_write_image: ctx.F32TO16(ir::TYPE_U16, ir::TYPE_FLOAT, getRegister(&I), getRegister(I.getOperand(0))); break; #undef DEF + + case GEN_OCL_PRINTF: + case GEN_OCL_PRINTF_BUF_ADDR: + case GEN_OCL_PRINTF_INDEX_BUF_ADDR: default: break; } } diff --git a/backend/src/llvm/llvm_gen_ocl_function.hxx b/backend/src/llvm/llvm_gen_ocl_function.hxx index e6f25b3..f3ce096 100644 --- a/backend/src/llvm/llvm_gen_ocl_function.hxx +++ b/backend/src/llvm/llvm_gen_ocl_function.hxx @@ -189,3 +189,8 @@ DECL_LLVM_GEN_FUNCTION(CONV_F32_TO_F16, __gen_ocl_f32to16) // SIMD level function for internal usage DECL_LLVM_GEN_FUNCTION(SIMD_ANY, __gen_ocl_simd_any) DECL_LLVM_GEN_FUNCTION(SIMD_ALL, __gen_ocl_simd_all) + +// printf function +DECL_LLVM_GEN_FUNCTION(PRINTF, __gen_ocl_printf) +DECL_LLVM_GEN_FUNCTION(PRINTF_BUF_ADDR, __gen_ocl_printf_get_buf_addr) +DECL_LLVM_GEN_FUNCTION(PRINTF_INDEX_BUF_ADDR, __gen_ocl_printf_get_index_buf_addr) diff --git a/backend/src/ocl_stdlib.tmpl.h b/backend/src/ocl_stdlib.tmpl.h index e5f8973..a4bdfbd 100755 --- a/backend/src/ocl_stdlib.tmpl.h +++ b/backend/src/ocl_stdlib.tmpl.h @@ -5016,4 +5016,9 @@ INLINE_OVERLOADABLE float __gen_ocl_internal_fastpath_tanh (float x) #undef CONST #undef OVERLOADABLE #undef INLINE + +/* The printf function. */ +int __gen_ocl_printf_stub(const char * format, ...); +#define printf __gen_ocl_printf_stub + #endif /* __GEN_OCL_STDLIB_H__ */ -- 1.8.3.2 _______________________________________________ Beignet mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/beignet
