boostorg / compute

A C++ GPU Computing Library for OpenCL
http://boostorg.github.io/compute/
Boost Software License 1.0
1.56k stars 333 forks source link

Work around incomplete closure input arguments on some platforms #817

Closed rosenrodt closed 4 years ago

rosenrodt commented 5 years ago

This fixes all the kernel compile errors I encountered when running test_closure, one example:

--- build log ---
BC-src-code:6:75: error: use of undeclared identifier 'pi'
 inline float add_two_and_pi(float x, int two, float  p){ return x + two + pi; }
                                                                           ^
1 diagnostic(s) generated.

I encountered this curious case when cross-compiling with the standalone toolchain generated from android NDK. Most tests pass. But closure is among one of the few that fails. It seems like boost::trim() from the main boost library somehow cuts off more character than it should and also leaves a leading whitespace.

two, pi          // original string   
[two,  pi]       // vector after split()

two              // after trim()
int two          // capture_traits<T>::type_name() << " " << variable_name

 p               // after trim(), there is a leading space before 'pi' and 'i' is cut off 
float  p         // capture_traits<T>::type_name() << " " << variable_name
jszuppe commented 5 years ago

That's odd that such an old function works incorrectly (boost::trim()). You should report that to https://github.com/boostorg/algorithm.

coveralls commented 5 years ago

Coverage Status

Coverage decreased (-0.002%) to 84.017% when pulling 73d978b0846f533936c40ba8ecd6d9c3341e201f on rosenrodt:fix-closure-argument-cutoff into 36c89134d4013b2e5e45bc55656a18bd6141995a on boostorg:develop.

rosenrodt commented 5 years ago

Thank @jszuppe. I have opened a ticket here see how this goes https://github.com/boostorg/algorithm/issues/58