Change arg type to unsigned int from signed int (#1078)

* Change arg type to unsigned int from signed int

* Fix formatting issues
This commit is contained in:
Grzegorz Wawiorko
2021-02-02 17:43:37 +01:00
committed by GitHub
parent ca673af488
commit 216455842d
3 changed files with 333 additions and 278 deletions

View File

@@ -1,6 +1,6 @@
//
// Copyright (c) 2017 The Khronos Group Inc.
//
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
@@ -17,15 +17,19 @@
const char *find_targets_kernel[] = {
"__kernel void find_targets(__global uint* image, uint target, volatile __global atomic_uint *numTargetsFound, volatile __global atomic_uint *targetLocations)\n"
"{\n"
" size_t i = get_global_id(0);\n"
" uint index;\n"
" if(image[i] == target) {\n"
" index = atomic_fetch_add_explicit(numTargetsFound, 1, memory_order_relaxed, memory_scope_device); \n"
" atomic_exchange_explicit(&targetLocations[index], i, memory_order_relaxed, memory_scope_all_svm_devices); \n"
" }\n"
"}\n"
"__kernel void find_targets(__global uint* image, uint target, volatile "
"__global atomic_uint *numTargetsFound, volatile __global atomic_uint "
"*targetLocations)\n"
"{\n"
" size_t i = get_global_id(0);\n"
" uint index;\n"
" if(image[i] == target) {\n"
" index = atomic_fetch_add_explicit(numTargetsFound, 1u, "
"memory_order_relaxed, memory_scope_device); \n"
" atomic_exchange_explicit(&targetLocations[index], i, "
"memory_order_relaxed, memory_scope_all_svm_devices); \n"
" }\n"
"}\n"
};