ComputeLibrary
ComputeLibrary copied to clipboard
Histogram output mismatch GPU and NEON . ACL Version 17.10
Hi Sir,
When trying to execute histogram kernel, outputs of NEON and GPU is different. NEON is matching with the reference implementation what we have. GPU is having issue. Issue observed for 16 to 255 sizes in GPU . Other sizes works fine .
Version: 17.10
Attaching the logs , stand alone script for reference.
Please help us in resolving the issue..
Thanks, Vinith cl_histogram_test.txt acl_GPU_histogram_mistmatch_btw_neon_and_gpu_for_some_sizes.txt
This one is indeed broken in 17.10: I get the same result as you.
However it works on 18.03:
root@acl_hikey_dev:~/tmp/antbar01/acl/build/linux-arm64-v8a-neon-cl-debug# LD_LIBRARY_PATH=. ./examples/cl_histogram 16 16
./examples/cl_histogram
width 16 height 16
******Input Image *******
103 198 105 115 81 255 74 236 41 205 186 171 242 251 227 70
124 194 84 248 27 232 231 141 118 90 46 99 51 159 201 154
102 50 13 183 49 88 163 90 37 93 5 23 88 233 94 212
171 178 205 198 155 180 84 17 14 130 116 65 33 61 220 135
112 233 62 161 65 225 252 103 62 1 126 151 234 220 107 150
143 56 92 42 236 176 59 251 50 175 60 84 236 24 219 92
2 26 254 67 251 250 170 58 251 41 209 230 5 60 124 148
117 216 190 97 137 249 92 187 168 153 15 149 177 235 241 179
5 239 247 0 233 161 58 229 202 11 203 208 72 71 100 189
31 35 30 168 28 123 100 197 20 115 90 197 94 75 121 99
59 112 100 36 17 158 9 220 170 212 172 242 27 16 175 59
51 205 227 80 72 71 21 92 187 111 34 25 186 155 125 245
11 225 26 28 127 35 248 41 248 164 27 19 181 202 78 232
152 50 56 224 121 77 61 52 188 95 78 119 250 203 108 5
172 134 33 43 170 26 85 162 190 112 181 115 59 4 92 211
54 148 179 175 226 240 228 158 79 50 21 73 253 130 78 169
Distri
1 1 1 0 1 4 0 0 0 1 0 2 0 1 1 1 1 2 0 1 1 2 0 1 1 1 3 3 2 0 1 1 0 2 1 2 1 1 0 0 0 3 1 1 0 0 1 0 0 1 4 2 1 0 1 0 2 0 2 4 2 2 2 0 0 2 0 1 0 0 1 2 2 1 1 1 0 1 3 1 1 1 0 0 3 1 0 0 2 0 3 0 5 1 2 1 0 1 0 2 3 0 1 2 0 1 0 1 1 0 0 1 3 0 0 3 1 1 1 1 0 2 0 1 2 1 1 1 0 0 2 0 0 0 1 1 0 1 0 0 0 1 0 1 0 0 0 0 2 1 1 1 1 1 1 2 0 0 2 1 0 2 1 1 1 0 0 0 2 1 3 2 2 0 0 3 1 1 1 2 1 2 0 1 0 0 2 2 1 1 2 0 0 0 1 0 0 2 2 0 0 1 2 2 0 3 0 0 1 1 0 1 2 0 0 0 1 0 0 1 3 0 0 0 1 2 1 2 1 1 1 1 2 3 1 1 3 0 0 1 1 1 2 0 0 1 0 1 3 1 2 4 1 1 1 1
Test passed
With this updated example:
#ifndef ARM_COMPUTE_CL /* Needed by Utils.cpp to handle OpenCL exceptions properly */
#error "This example needs to be built with -DARM_COMPUTE_CL"
#endif /* ARM_COMPUTE_CL */
#include "arm_compute/core/Types.h"
#include "arm_compute/runtime/CL/CLFunctions.h"
#include "arm_compute/runtime/CL/CLScheduler.h"
#include "utils/Utils.h"
#include <sys/time.h>
using namespace arm_compute;
using namespace utils;
class Histogram: public Example
{
public:
void do_setup(int argc, char **argv)override
{
CLScheduler::get().default_init();
CLImage src;
CLHistogram histogram;
size_t numBins = 256; // The number of bins in the distribution.
int32_t offset = 0; // The start offset into the range value that marks
// the begining of the 1D Distribution
int32_t range = 256; //The total number of the consecutive values of the
// distribution interval.
CLDistribution1D dst(numBins, offset, range);
uint32_t width;
uint32_t height;
if (argc > 2) {
width = atoi(argv[1]);
height = atoi(argv[2]);
} else {
printf("Usage : <executable_name> <width> <height>\n");
exit(0);
}
printf("width %d height %d\n", width, height);
// Initialize Images
src.allocator()->init(TensorInfo(width, height, Format::U8));
// Call ACL configure. Padding info updated inside images (accurate padding)
histogram.configure(&src, &dst);
src.allocator()->allocate();
//feed input data to buffers
src.map();
for (int i=0; i < height; i++) {
for (int j=0; j < width; j++) {
*(src.buffer() + src.info()->offset_element_in_bytes(Coordinates(0,i)) + j) =
(unsigned char) (rand() & 0xFF);
}
}
src.unmap();
// Call ACL run
histogram.run();
CLScheduler::get().sync();
// printf i/p image buffer
printf("\n******Input Image ******* \n");
src.map();
src.print(std::cout);
src.unmap();
// printf o/p image buffer
dst.map(true);
printf("\nDistri\n");
for(int i =0; i < numBins; i++ ) {
printf("%d ", *(dst.buffer()+i));
}
printf("\n");
dst.unmap();
}
};
/** Main program
*
* @param[in] argc Number of arguments
* @param[in] argv Arguments
*/
int main(int argc, char **argv)
{
return utils::run_example<Histogram>(argc, argv);
}
No update, closing