Re: [Beignet] Weird clinfo ouput @ FreeBSD-11.0/Intel GPU

2016-10-18 Thread Rebecca N. Palmer
That looks like abi::__cxa_demangle is sometimes failing completely
(and possibly inconsistently, given that it's failing on a different
symbol this time).  Given that it only happens on FreeBSD, possibly
a libc++ (LLVM) vs libstdc++ (GCC) issue??

___
Beignet mailing list
Beignet@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/beignet


Re: [Beignet] Weird clinfo ouput @ FreeBSD-11.0/Intel GPU

2016-10-18 Thread Igor Pavlov
> possibly a name demangling problem?
> To find out, try this

The result is:


platform number 1
platform_profile "FULL_PROFILE"
platform_name "Intel Gen OCL Driver"
platform_vendor "Intel"
platform_version "OpenCL 1.2 beignet 1.2"
platform_extensions "cl_khr_global_int32_base_atomics
cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics
cl_khr_local_int32_extended_atomics cl_khr_byte_addressable_store
cl_khr_3d_image_writes cl_khr_image2d_from_buffer cl_khr_spir cl_khr_icd
cl_intel_accelerator cl_intel_motion_estimation cl_intel_subgroups"
Beignet: self-test failed: (3, 7, 5) + (5, 7, 3) returned (3, 7, 5)
See README.md or http://www.freedesktop.org/wiki/Software/Beignet/
Beignet: Warning - overriding self-test failure
device_profile "FULL_PROFILE"
device_name "Intel(R) HD Graphics Haswell GT1 Server"
device_vendor "Intel"
device_version "OpenCL 1.2 beignet 1.2"
device_extensions "cl_khr_global_int32_base_atomics
cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics
cl_khr_local_int32_extended_atomics cl_khr_byte_addressable_store
cl_khr_3d_image_writes cl_khr_image2d_from_buffer cl_khr_spir cl_khr_icd
cl_intel_accelerator cl_intel_motion_estimation cl_intel_subgroups"
device_opencl_c_version "OpenCL C 1.2 beignet 1.2"
23 image formats are supported
[CL_R CL_UNORM_INT8]
[CL_R CL_UNORM_INT16]
[CL_R CL_SIGNED_INT8]
[CL_R CL_SIGNED_INT16]
[CL_R CL_SIGNED_INT32]
[CL_R CL_UNSIGNED_INT8]
[CL_R CL_UNSIGNED_INT16]
[CL_R CL_UNSIGNED_INT32]
[CL_R CL_HALF_FLOAT]
[CL_R CL_FLOAT]
[CL_RG CL_UNORM_INT8]
[CL_RG CL_UNSIGNED_INT8]
[CL_RGBA CL_UNORM_INT8]
[CL_RGBA CL_UNORM_INT16]
[CL_RGBA CL_SIGNED_INT8]
[CL_RGBA CL_SIGNED_INT16]
[CL_RGBA CL_SIGNED_INT32]
[CL_RGBA CL_UNSIGNED_INT8]
[CL_RGBA CL_UNSIGNED_INT16]
[CL_RGBA CL_UNSIGNED_INT32]
[CL_RGBA CL_HALF_FLOAT]
[CL_RGBA CL_FLOAT]
[CL_BGRA CL_UNORM_INT8]
builtin_kernel_block_motion_estimate_intel()[SUCCESS]
runtime_climage_from_boname() Can't open Display, skipping.
[SUCCESS]
compiler_overflow_add_ulong4()[SUCCESS]
compiler_overflow_add_uint4()[SUCCESS]
compiler_overflow_add_ushort4()[SUCCESS]
compiler_overflow_add_uchar4()[SUCCESS]
compiler_overflow_sub_uint4()[SUCCESS]
compiler_bsort()[SUCCESS]
compiler_math_3op_float()[SUCCESS]
compiler_math_3op_half()No cl_khr_fp16, Skip![SUCCESS]
compiler_mix()Unresolved symbol: _Z13__gen_ocl_lrpfff   8
Aborting...
Unresolved symbol: _Z13__gen_ocl_lrpfff   8
Aborting...
[FAILED]
Error: error calling clBuildProgram with error CL_BUILD_PROGRAM_FAILURE

  at file
/usr/ports/lang/beignet/work/Beignet-1.2.0-Source/utests/utest_helper.cpp,
function cl_kernel_init, line 267
builtin_local_linear_id()Not OpenCL 2.0 device, Beignet extension test!
[SUCCESS]
builtin_global_linear_id()Not OpenCL 2.0 device, Beignet extension test!
[SUCCESS]
compiler_sub_group_shuffle_xor()[SUCCESS]
compiler_sub_group_shuffle_up()[SUCCESS]
compiler_sub_group_shuffle_down()[SUCCESS]
compiler_sub_group_shuffle()[SUCCESS]
compiler_get_sub_group_local_id()[SUCCESS]
compiler_get_max_sub_group_size()[SUCCESS]
runtime_use_host_ptr_image()[SUCCESS]
runtime_alloc_host_ptr_buffer()[SUCCESS]
runtime_use_host_ptr_buffer()[SUCCESS]
vload_test_uchar()[SUCCESS]
vload_test_char()[SUCCESS]
vload_test_ushort()[SUCCESS]
vload_test_short()[SUCCESS]
vload_test_uint()[SUCCESS]
vload_test_int()[SUCCESS]
vload_test_float()[SUCCESS]
compiler_assignment_operation_in_if()[SUCCESS]
compiler_constant_expr()[SUCCESS]
compiler_fill_image_2d_array()[SUCCESS]
compiler_fill_image_1d_array()[SUCCESS]
compare_image_2d_and_1d_array()Unresolved symbol: _Z14__gen_ocl_fminff   8
Aborting...
Unresolved symbol: _Z14__gen_ocl_fmaxff   8
Aborting...
Unresolved symbol: _Z14__gen_ocl_fminff   8
Aborting...
Unresolved symbol: _Z14__gen_ocl_fmaxff   8
Aborting...
[FAILED]
Error: error calling clBuildProgram with error CL_BUILD_PROGRAM_FAILURE

  at file
/usr/ports/lang/beignet/work/Beignet-1.2.0-Source/utests/utest_helper.cpp,
function cl_kernel_init, line 267
image_from_buffer()[SUCCESS]
image_1D_buffer()[SUCCESS]
builtin_kernel_max_global_size()[SUCCESS]
enqueue_fill_buf()[SUCCESS]
test_printf()Warning: Have a int parameter for %f like specifier, take care
of it


And then it hung the OS.

--
Igor
___
Beignet mailing list
Beignet@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/beignet


[Beignet] [PATCH V2 3/3] Backend: Add hole reuse in reg alloction

2016-10-18 Thread Xiuli Pan
From: Pan Xiuli 

We first find regs that have pool in simple linear scale, and save them
in HoleRegPool, when allocte regs we first try to search fit candidate
in the pool and choose the most fit one to reuse.

V2: Refine hole reuse only in one block.
DEBUG version: You can export DUMPHOLE for easy review.

Signed-off-by: Pan Xiuli 
---
 backend/src/backend/gen_insn_selection.cpp |  31 ++
 backend/src/backend/gen_insn_selection.hpp |   3 +
 backend/src/backend/gen_reg_allocation.cpp | 167 ++---
 backend/src/backend/gen_reg_allocation.hpp |   7 ++
 4 files changed, 195 insertions(+), 13 deletions(-)

diff --git a/backend/src/backend/gen_insn_selection.cpp 
b/backend/src/backend/gen_insn_selection.cpp
index 97ee17a..ba78858 100644
--- a/backend/src/backend/gen_insn_selection.cpp
+++ b/backend/src/backend/gen_insn_selection.cpp
@@ -225,6 +225,37 @@ namespace gbe
 return this->opcode == SEL_OP_LABEL;
   }
 
+  bool SelectionInstruction::isNative(void) const {
+return this->opcode == SEL_OP_NOT || /* ALU1 */
+   this->opcode == SEL_OP_LZD ||
+   this->opcode == SEL_OP_RNDZ||
+   this->opcode == SEL_OP_RNDE||
+   this->opcode == SEL_OP_RNDD||
+   this->opcode == SEL_OP_RNDU||
+   this->opcode == SEL_OP_FRC ||
+   this->opcode == SEL_OP_F16TO32 ||
+   this->opcode == SEL_OP_F32TO16 ||
+   this->opcode == SEL_OP_CBIT||
+   this->opcode == SEL_OP_SEL || /* ALU2 */
+   this->opcode == SEL_OP_AND ||
+   this->opcode == SEL_OP_OR  ||
+   this->opcode == SEL_OP_XOR ||
+   this->opcode == SEL_OP_SHR ||
+   this->opcode == SEL_OP_SHL ||
+   this->opcode == SEL_OP_RSR ||
+   this->opcode == SEL_OP_RSL ||
+   this->opcode == SEL_OP_ASR ||
+   this->opcode == SEL_OP_SEL ||
+   this->opcode == SEL_OP_ADD ||
+   this->opcode == SEL_OP_MUL ||
+   this->opcode == SEL_OP_FBH ||
+   this->opcode == SEL_OP_FBL ||
+   this->opcode == SEL_OP_MACH||
+   this->opcode == SEL_OP_MATH||
+   this->opcode == SEL_OP_LRP || /* ALU3 */
+   this->opcode == SEL_OP_MAD;
+  }
+
   ///
   // SelectionVector
   ///
diff --git a/backend/src/backend/gen_insn_selection.hpp 
b/backend/src/backend/gen_insn_selection.hpp
index 814b449..2719858 100644
--- a/backend/src/backend/gen_insn_selection.hpp
+++ b/backend/src/backend/gen_insn_selection.hpp
@@ -82,6 +82,8 @@ namespace gbe
 bool isBranch(void) const;
 /*! Is it a label instruction (i.e. change the implicit mask) */
 bool isLabel(void) const;
+/*! Is it a simple navtive label instruction (i.e. will be one simple ISA) 
*/
+bool isNative(void) const;
 /*! Get the destination register */
 GenRegister (uint32_t dstID) { return regs[dstID]; }
 /*! Get the source register */
@@ -259,6 +261,7 @@ namespace gbe
 bool hasBarrier;
 bool hasBranch;
 bool removeSimpleIfEndif;
+uint32_t ID;
   };
 
   enum SEL_IR_OPT_FEATURE {
diff --git a/backend/src/backend/gen_reg_allocation.cpp 
b/backend/src/backend/gen_reg_allocation.cpp
index 4451efb..08f087a 100644
--- a/backend/src/backend/gen_reg_allocation.cpp
+++ b/backend/src/backend/gen_reg_allocation.cpp
@@ -50,12 +50,14 @@ namespace gbe
   struct GenRegInterval {
 INLINE GenRegInterval(ir::Register reg) :
   reg(reg), minID(INT_MAX), maxID(-INT_MAX), accessCount(0),
-  conflictReg(0), b3OpAlign(0) {}
+  conflictReg(0), b3OpAlign(0) , isreused(0), ishole(0),
+  lastblockID(-1), allocID(-1), useID(-1){}
 ir::Register reg; //!< (virtual) register of the interval
 int32_t minID, maxID; //!< Starting and ending points
 int32_t accessCount;
 ir::Register conflictReg; // < has banck conflict with this register
-bool b3OpAlign;
+bool b3OpAlign, isreused, ishole;
+int32_t allocblockID, lastblockID, allocID, useID;
   };
 
   struct SpillInterval {
@@ -123,7 +125,7 @@ namespace gbe
 /*! Allocate the vectors detected in the instruction selection pass */
 void allocateVector(Selection );
 /*! Allocate the given interval. Return true if success */
-bool createGenReg(const Selection , const GenRegInterval 
);
+bool createGenReg(const Selection , GenRegInterval );
 /*! Indicate if the registers are already allocated in vectors */
 bool isAllocated(const SelectionVector *vector) const;
 /*! Reallocate registers if needed to make the registers in the vector
@@ -164,6 +166,8 @@ namespace gbe
 uint32_t reservedReg;

Re: [Beignet] Weird clinfo ouput @ FreeBSD-11.0/Intel GPU

2016-10-18 Thread Rebecca N. Palmer
> builtin_kernel_block_motion_estimate_intel()[SUCCESS]
> runtime_climage_from_boname()Unresolved symbol:
> _Z22__gen_ocl_write_imagef11ocl_image2dDv2_iDv4_f
> Aborting...

That message is from backend/src/llvm/llvm_gen_backend.hpp:97, and means 
it can't find that function (in its internal list, not the actual 
library files): possibly a name demangling problem?

To find out, try this:

--- a/backend/src/llvm/llvm_gen_backend.hpp
+++ b/backend/src/llvm/llvm_gen_backend.hpp
@@ -80,12 +80,13 @@ namespace gbe
 gbe::map map;
 OCLInstrinsic find(const std::string symbol) const {
   auto it = map.find(symbol);
+  std::string realFnName, stripName;
+  int status;

   if (it == map.end()) {
-int status;
 char *realName = abi::__cxa_demangle(symbol.c_str(), NULL, NULL, 
);
 if (status == 0) {
-  std::string realFnName(realName), stripName;
+  realFnName=std::string(realName);
   stripName = realFnName.substr(0, realFnName.find("("));
   it = map.find(stripName);
 }
@@ -94,7 +95,7 @@ namespace gbe
   // FIXME, should create a complete error reporting mechanism
   // when found error in beignet managed passes including Gen pass.
   if (it == map.end()) {
-std::cerr << "Unresolved symbol: " << symbol << std::endl;
+std::cerr << "Unresolved symbol: " << symbol << " " << realFnName << " 
" << stripName << " " << status << std::endl;
 std::cerr << "Aborting..." << std::endl;
 return GEN_OCL_NOT_FOUND;
   }

___
Beignet mailing list
Beignet@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/beignet